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>
\"[^\"\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;
}
--- /dev/null
+MODULE missingquote ;
+
+CONST
+ MyConst = 'foobar
+
+BEGIN
+
+END missingquote.