diff options
author | Gaius Mulley <gaiusmod2@gmail.com> | 2024-03-23 15:49:23 +0000 |
---|---|---|
committer | Gaius Mulley <gaiusmod2@gmail.com> | 2024-03-23 15:49:23 +0000 |
commit | c8a343f9f8602f4e6c1b385ddbeb58572234d447 (patch) | |
tree | 6653d165108ca2aceee4970e3c64beee32affb57 | |
parent | 80a0cb37456c49dbc25cca7cd554f78bc504373e (diff) | |
download | gcc-c8a343f9f8602f4e6c1b385ddbeb58572234d447.zip gcc-c8a343f9f8602f4e6c1b385ddbeb58572234d447.tar.gz gcc-c8a343f9f8602f4e6c1b385ddbeb58572234d447.tar.bz2 |
PR modula2/114443 missing quote cause ICE
This patch inserts a missing quotation at the end of a line
if required (after an appropiate error message is generated).
gcc/m2/ChangeLog:
PR modula2/114443
* m2.flex: Call AddTokCharStar with a stringtok if
end of line is reached without a closing quote.
gcc/testsuite/ChangeLog:
PR modula2/114443
* gm2/pim/fail/missingquote.mod: New test.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
-rw-r--r-- | gcc/m2/m2.flex | 2 | ||||
-rw-r--r-- | gcc/testsuite/gm2/pim/fail/missingquote.mod | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/m2/m2.flex b/gcc/m2/m2.flex index f8f5ce6..e8ee383 100644 --- a/gcc/m2/m2.flex +++ b/gcc/m2/m2.flex @@ -188,12 +188,14 @@ extern void yylex (void); \"[^\"\n]*\" { updatepos(); M2LexBuf_AddTokCharStar(M2Reserved_stringtok, yytext); return; } \"[^\"\n]*$ { updatepos(); m2flex_M2Error("missing terminating quote, \""); + M2LexBuf_AddTokCharStar(M2Reserved_stringtok, yytext); resetpos(); return; } '[^'\n]*' { updatepos(); M2LexBuf_AddTokCharStar(M2Reserved_stringtok, yytext); return; } '[^'\n]*$ { updatepos(); m2flex_M2Error("missing terminating quote, '"); + M2LexBuf_AddTokCharStar(M2Reserved_stringtok, yytext); resetpos(); return; } diff --git a/gcc/testsuite/gm2/pim/fail/missingquote.mod b/gcc/testsuite/gm2/pim/fail/missingquote.mod new file mode 100644 index 0000000..e78f0e3 --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/missingquote.mod @@ -0,0 +1,8 @@ +MODULE missingquote ; + +CONST + MyConst = 'foobar + +BEGIN + +END missingquote. |