Skip to content
Snippets Groups Projects
Commit ea0d481a authored by Arne Goedeke's avatar Arne Goedeke
Browse files

lexer: added support for non abbreviated #line directive

parent 38e29605
Branches
Tags
No related merge requests found
...@@ -703,6 +703,16 @@ static int low_yylex(struct lex *lex, YYSTYPE *yylval) ...@@ -703,6 +703,16 @@ static int low_yylex(struct lex *lex, YYSTYPE *yylval)
switch(len>0?INDEX_CHARP(buf, 0, SHIFT):0) switch(len>0?INDEX_CHARP(buf, 0, SHIFT):0)
{ {
case 'l':
if (ISWORD("line"))
{
SKIPSPACE();
if (LOOK() < '0' || LOOK() > '9') goto unknown_directive;
READBUF(C!='\n' && C!=' ' && C!='\t');
/* fallthrough */
} else goto unknown_directive;
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
lex->current_line = lex_strtol(buf, NULL, 10)-1; lex->current_line = lex_strtol(buf, NULL, 10)-1;
...@@ -791,6 +801,7 @@ static int low_yylex(struct lex *lex, YYSTYPE *yylval) ...@@ -791,6 +801,7 @@ static int low_yylex(struct lex *lex, YYSTYPE *yylval)
/* FALL_THROUGH */ /* FALL_THROUGH */
default: default:
unknown_directive:
/* FIXME: This doesn't look all that safe... /* FIXME: This doesn't look all that safe...
* buf isn't NUL-terminated, and it won't work on wide strings. * buf isn't NUL-terminated, and it won't work on wide strings.
* /grubba 1999-02-20 * /grubba 1999-02-20
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment