diff options
author | Teddy <ted.sybil@gmail.com> | 2014-04-12 22:24:35 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2014-04-12 22:24:35 +0800 |
commit | bbce3104de593c90b10778a379728f982bc3fdcb (patch) | |
tree | a7dc481f72b14dc454c60b3384d1ba11b3fdefc8 /cibic.l | |
parent | 85d862310c2e00361f68c317c6256b29f18eae36 (diff) |
typedef now works
Diffstat (limited to 'cibic.l')
-rw-r--r-- | cibic.l | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,5 +1,6 @@ %{ #include "cibic.tab.h" +#include "semantics.h" #define MAX_LINEBUFF 1024 int yycolumn = 1; char linebuff[MAX_LINEBUFF], *lptr = linebuff; @@ -69,10 +70,11 @@ char ([^\n'\\]|\\.|\\[0-7]+|\\[xX][0-9a-fA-F]+) "break" { return KW_BREAK; } "return" { return KW_RET; } "sizeof" { return KW_SIZEOF; } +"typedef" { return KW_TYPEDEF; } {letter}({letter}|{digit})* { yylval.strval = strdup(yytext); - return IDENTIFIER; + return is_identifier(yytext) ? IDENTIFIER : USER_TYPE; } ({digit}+)|(0[xX][0-9a-fA-F]+) { |