From e7fc68e89e3c422ea2c4ebb3caac17eccff91473 Mon Sep 17 00:00:00 2001 From: Jeremy Green Date: Tue, 2 Sep 2025 21:01:56 +0100 Subject: [PATCH] Fix line ending for windows --- .vscode/launch.json | 13 +++++++++++++ .vscode/tasks.json | 28 ++++++++++++++++++++++++++++ run-ubasic.c | 6 ------ tokenizer.c | 2 ++ tokenizer.h | 1 + 5 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..8929625 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(Windows) Attach", + "type": "cppvsdbg", + "request": "attach", + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..6532339 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: cl.exe build active file", + "command": "cl.exe", + "args": [ + "/Zi", + "/EHsc", + "/nologo", + "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", + "${file}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$msCompile" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/run-ubasic.c b/run-ubasic.c index e19d3e9..7a12d29 100644 --- a/run-ubasic.c +++ b/run-ubasic.c @@ -28,12 +28,6 @@ * */ -/* - * Modified to support simple string variables and functions by David Mitchell - * November 2008. - * Changes and additions are marked 'string additions' throughout - */ - #include "ubasic.h" #include #include diff --git a/tokenizer.c b/tokenizer.c index cb971a8..02fbe29 100644 --- a/tokenizer.c +++ b/tokenizer.c @@ -80,6 +80,8 @@ singlechar(void) { if(*ptr == '\n') { return TOKENIZER_CR; + } else if(*ptr == '\r'){ + return TOKENIZER_LF; } else if(*ptr == ',') { return TOKENIZER_COMMA; } else if(*ptr == ';') { diff --git a/tokenizer.h b/tokenizer.h index d520ae8..f6b494d 100644 --- a/tokenizer.h +++ b/tokenizer.h @@ -70,6 +70,7 @@ enum { TOKENIZER_GT, TOKENIZER_EQ, TOKENIZER_CR, + TOKENIZER_LF }; void tokenizer_goto(const char *program);