Mercurial > vba-clojure
annotate src/sdl/expr.l @ 45:f6ff410a87fd
using libtool for convienence libraries
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 06 Mar 2012 22:07:22 -0600 |
parents | f9f4f1b99eed |
children |
rev | line source |
---|---|
rlm@1 | 1 %{ |
rlm@1 | 2 #include "expr.cpp.h" |
rlm@1 | 3 |
rlm@1 | 4 #ifndef __GNUC__ |
rlm@1 | 5 #include <io.h> |
rlm@1 | 6 #define isatty _isatty |
rlm@1 | 7 #endif |
rlm@1 | 8 |
rlm@1 | 9 char *exprString; |
rlm@1 | 10 int exprCol; |
rlm@1 | 11 |
rlm@1 | 12 #define YY_INPUT(buf,result,max_size) \ |
rlm@1 | 13 { \ |
rlm@1 | 14 int c = *exprString++; \ |
rlm@1 | 15 exprCol++;\ |
rlm@1 | 16 result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ |
rlm@1 | 17 } |
rlm@1 | 18 %} |
rlm@1 | 19 |
rlm@1 | 20 %option nomain |
rlm@1 | 21 %option noyywrap |
rlm@1 | 22 |
rlm@1 | 23 SIZEOF "sizeof" |
rlm@1 | 24 ID [a-zA-Z_][a-zA-Z0-9_]* |
rlm@1 | 25 NUM [0-9]+ |
rlm@1 | 26 DOT "." |
rlm@1 | 27 ARROW "->" |
rlm@1 | 28 STAR "*" |
rlm@1 | 29 ADDR "&" |
rlm@1 | 30 |
rlm@1 | 31 %% |
rlm@1 | 32 |
rlm@1 | 33 {SIZEOF} { |
rlm@1 | 34 return TOKEN_SIZEOF; |
rlm@1 | 35 } |
rlm@1 | 36 |
rlm@1 | 37 {ID} { |
rlm@1 | 38 return TOKEN_IDENTIFIER; |
rlm@1 | 39 } |
rlm@1 | 40 |
rlm@1 | 41 {NUM} { |
rlm@1 | 42 return TOKEN_NUMBER; |
rlm@1 | 43 } |
rlm@1 | 44 |
rlm@1 | 45 {DOT} { |
rlm@1 | 46 return TOKEN_DOT; |
rlm@1 | 47 } |
rlm@1 | 48 |
rlm@1 | 49 {ARROW} { |
rlm@1 | 50 return TOKEN_ARROW; |
rlm@1 | 51 } |
rlm@1 | 52 |
rlm@1 | 53 {ADDR} { |
rlm@1 | 54 return TOKEN_ADDR; |
rlm@1 | 55 } |
rlm@1 | 56 |
rlm@1 | 57 {STAR} { |
rlm@1 | 58 return TOKEN_STAR; |
rlm@1 | 59 } |
rlm@1 | 60 |
rlm@1 | 61 [ \t\n]+ |
rlm@1 | 62 |
rlm@1 | 63 . return *yytext; |
rlm@1 | 64 |
rlm@1 | 65 %% |
rlm@1 | 66 |
rlm@1 | 67 void exprCleanBuffer() |
rlm@1 | 68 { |
rlm@1 | 69 yy_delete_buffer(yy_current_buffer); |
rlm@1 | 70 yy_init = 1; |
rlm@1 | 71 } |