diff options
author | Teddy <[email protected]> | 2014-03-25 21:50:31 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2014-03-25 21:50:31 +0800 |
commit | e9c783cec3496c3b84681ce162f6133bec8a709d (patch) | |
tree | fa1063ba1eb69cd3e560c69f0bc9e6368b4a90ce /cibic.l | |
parent | bebc7300ad6987e76db8fca785a83123ba08a927 (diff) |
fixed bugs: str and char const recogn; fields wrapping
Diffstat (limited to 'cibic.l')
-rw-r--r-- | cibic.l | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -10,6 +10,9 @@ int yycolumn = 1; letter [a-zA-Z_$] digit [0-9] +string ((\\.|[^\n\"\\])*) +char ([^'\\]|\\.|\\[0-7][0-7]?[0-7]?|\\[xX][0-9a-fA-F]+) + %s IN_BLOCK_COMMENT IN_INLINE_COMMENT IN_DIRECTIVE %option yylineno %% @@ -72,16 +75,26 @@ digit [0-9] return INT_CONST; } -'([^\'\\]|\\.|\\[0-7][0-7]?[0-7]?|\\[xX][0-9a-fA-F]+)' { +'{char}' { yylval.strval = strdup(yytext); return CHAR_CONST; } -\"[^\n\"]*\" { +'{char} { + yyerror("missing terminating ' character\n"); + exit(1); +} + +\"{string}\" { yylval.strval = strndup(yytext + 1, strlen(yytext) - 2); return STR_CONST; } +\"{string} { + yyerror("missing terminating \" character\n"); + exit(1); +} + "||" { return OPT_OR; } "&&" { return OPT_AND; } "==" { return OPT_EQ; } |