mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-26 13:55:52 +08:00
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>
This commit is contained in:
parent
80a0cb3745
commit
c8a343f9f8
@ -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;
|
||||
}
|
||||
|
||||
|
8
gcc/testsuite/gm2/pim/fail/missingquote.mod
Normal file
8
gcc/testsuite/gm2/pim/fail/missingquote.mod
Normal file
@ -0,0 +1,8 @@
|
||||
MODULE missingquote ;
|
||||
|
||||
CONST
|
||||
MyConst = 'foobar
|
||||
|
||||
BEGIN
|
||||
|
||||
END missingquote.
|
Loading…
Reference in New Issue
Block a user