From c70d329f8962e946589b03ac879b9819bd51e65c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 26 Feb 2021 19:29:15 +1100 Subject: [PATCH 1/3] BASIC: add *.bm to list of extensions This is a common include-file extension for modules including sub/function definitions. --- parsers/basic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsers/basic.c b/parsers/basic.c index 493b58a7f7..3138e9ecc9 100644 --- a/parsers/basic.c +++ b/parsers/basic.c @@ -187,7 +187,7 @@ static void findBasicTags (void) parserDefinition *BasicParser (void) { - static char const *extensions[] = { "bas", "bi", "bb", "pb", NULL }; + static char const *extensions[] = { "bas", "bi", "bm", "bb", "pb", NULL }; parserDefinition *def = parserNew ("Basic"); def->kindTable = BasicKinds; def->kindCount = ARRAY_SIZE (BasicKinds); From 9393260dc931c73b8074c5a3068b07edf217c36e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 26 Feb 2021 19:41:33 +1100 Subject: [PATCH 2/3] BASIC: don't match comments with trailing colons as labels --- Units/parser-basic.r/basic-labels.d/expected.tags | 1 + Units/parser-basic.r/basic-labels.d/input.bas | 7 +++++++ parsers/basic.c | 9 +++++++++ 3 files changed, 17 insertions(+) create mode 100644 Units/parser-basic.r/basic-labels.d/expected.tags create mode 100644 Units/parser-basic.r/basic-labels.d/input.bas diff --git a/Units/parser-basic.r/basic-labels.d/expected.tags b/Units/parser-basic.r/basic-labels.d/expected.tags new file mode 100644 index 0000000000..ab91c61e79 --- /dev/null +++ b/Units/parser-basic.r/basic-labels.d/expected.tags @@ -0,0 +1 @@ +repeat input.bas /^repeat:$/;" l diff --git a/Units/parser-basic.r/basic-labels.d/input.bas b/Units/parser-basic.r/basic-labels.d/input.bas new file mode 100644 index 0000000000..3e16aeb1c5 --- /dev/null +++ b/Units/parser-basic.r/basic-labels.d/input.bas @@ -0,0 +1,7 @@ +' This is not a label: +REM This is not a label: + +repeat: +PRINT "Going 'round again" +GOTO repeat +END diff --git a/parsers/basic.c b/parsers/basic.c index 3138e9ecc9..4a6cffa687 100644 --- a/parsers/basic.c +++ b/parsers/basic.c @@ -173,6 +173,15 @@ static void findBasicTags (void) if (!*p) continue; + /* REM comment? */ + if (strncasecmp (p, "REM", 3) == 0 && + (isspace (*(p + 3)) || *(p + 3) == '\0')) + continue; + + /* Single-quote comment? */ + if (*p == '\'') + continue; + /* In Basic, keywords always are at the start of the line. */ for (kw = keywords; kw->token; kw++) if (match_keyword (p, kw)) break; From 5ada4659c3986426e638c8b8b1efeb77108dbebb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 26 Feb 2021 20:36:31 +1100 Subject: [PATCH 3/3] Units: review BASIC (and Blitz Basic) test cases --- .../simple.bas.t => parser-basic.r/simple.bas.d}/expected.tags | 0 .../simple.bas.t => parser-basic.r/simple.bas.d}/input.bas | 0 .../simple.bb.t => parser-basic.r/simple.bb.d}/expected.tags | 0 .../simple.bb.t => parser-basic.r/simple.bb.d}/input.bb | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename Units/{review-needed.r/simple.bas.t => parser-basic.r/simple.bas.d}/expected.tags (100%) rename Units/{review-needed.r/simple.bas.t => parser-basic.r/simple.bas.d}/input.bas (100%) rename Units/{review-needed.r/simple.bb.t => parser-basic.r/simple.bb.d}/expected.tags (100%) rename Units/{review-needed.r/simple.bb.t => parser-basic.r/simple.bb.d}/input.bb (100%) diff --git a/Units/review-needed.r/simple.bas.t/expected.tags b/Units/parser-basic.r/simple.bas.d/expected.tags similarity index 100% rename from Units/review-needed.r/simple.bas.t/expected.tags rename to Units/parser-basic.r/simple.bas.d/expected.tags diff --git a/Units/review-needed.r/simple.bas.t/input.bas b/Units/parser-basic.r/simple.bas.d/input.bas similarity index 100% rename from Units/review-needed.r/simple.bas.t/input.bas rename to Units/parser-basic.r/simple.bas.d/input.bas diff --git a/Units/review-needed.r/simple.bb.t/expected.tags b/Units/parser-basic.r/simple.bb.d/expected.tags similarity index 100% rename from Units/review-needed.r/simple.bb.t/expected.tags rename to Units/parser-basic.r/simple.bb.d/expected.tags diff --git a/Units/review-needed.r/simple.bb.t/input.bb b/Units/parser-basic.r/simple.bb.d/input.bb similarity index 100% rename from Units/review-needed.r/simple.bb.t/input.bb rename to Units/parser-basic.r/simple.bb.d/input.bb