diff options
Diffstat (limited to 'src/lexer.l')
-rw-r--r-- | src/lexer.l | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/lexer.l b/src/lexer.l index 24bda93..4f6598a 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -38,8 +38,7 @@ INT {HEX}|{DEC}|{OCT}|{BIN} HEXF [+-]?0[xX][0-9a-fA-F]+([pP][+-]?[0-9]+) DECF [+-]?[0-9]+[.]([eE]?[+-]?[0-9]+)?[fF]? -ID [_a-zA-Z][_a-zA-Z0-9]* -APPLY {ID}! +ID ((<>)|[_a-zA-Z])[_a-zA-Z0-9]* STRING \"(\\.|[^"\\])*\" @@ -64,7 +63,6 @@ STRING \"(\\.|[^"\\])*\" \n {} } -"::" {return SCOPE;} "(" {return LPAREN;} ")" {return RPAREN;} "{" {return LBRACE;} @@ -126,6 +124,7 @@ STRING \"(\\.|[^"\\])*\" "<<" {return LSHIFT;} ">>" {return RSHIFT;} +"as" {return AS;} "if" {return IF;} "else" {return ELSE;} "nil" {return NIL;} @@ -138,9 +137,9 @@ STRING \"(\\.|[^"\\])*\" "mut" {return MUT;} +"sizeof" {return SIZEOF;} + {STRING} { - /* seems risky, I know, but letting the parser choose when to allocate a - * new string seems to help with syntax error cleanup */ yylval->str = strdup(yytext); return STRING; } @@ -155,16 +154,6 @@ STRING \"(\\.|[^"\\])*\" return ID; } -{APPLY} { - /* strip trailing '!' */ - char *s = yytext + strlen(yytext); - s[-1] = '\0'; - - yylval->str = strdup(yytext); - return APPLY; -} - - [[:space:]]+ {/* skip whitespace */} . { |