Mercurial > vba-linux
diff src/sdl/expr.l @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/sdl/expr.l Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,71 @@ 1.4 +%{ 1.5 +#include "expr.cpp.h" 1.6 + 1.7 +#ifndef __GNUC__ 1.8 +#include <io.h> 1.9 +#define isatty _isatty 1.10 +#endif 1.11 + 1.12 +char *exprString; 1.13 +int exprCol; 1.14 + 1.15 +#define YY_INPUT(buf,result,max_size) \ 1.16 + { \ 1.17 + int c = *exprString++; \ 1.18 + exprCol++;\ 1.19 + result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ 1.20 + } 1.21 +%} 1.22 + 1.23 +%option nomain 1.24 +%option noyywrap 1.25 + 1.26 +SIZEOF "sizeof" 1.27 +ID [a-zA-Z_][a-zA-Z0-9_]* 1.28 +NUM [0-9]+ 1.29 +DOT "." 1.30 +ARROW "->" 1.31 +STAR "*" 1.32 +ADDR "&" 1.33 + 1.34 +%% 1.35 + 1.36 +{SIZEOF} { 1.37 + return TOKEN_SIZEOF; 1.38 +} 1.39 + 1.40 +{ID} { 1.41 + return TOKEN_IDENTIFIER; 1.42 +} 1.43 + 1.44 +{NUM} { 1.45 + return TOKEN_NUMBER; 1.46 +} 1.47 + 1.48 +{DOT} { 1.49 + return TOKEN_DOT; 1.50 +} 1.51 + 1.52 +{ARROW} { 1.53 + return TOKEN_ARROW; 1.54 +} 1.55 + 1.56 +{ADDR} { 1.57 + return TOKEN_ADDR; 1.58 +} 1.59 + 1.60 +{STAR} { 1.61 + return TOKEN_STAR; 1.62 +} 1.63 + 1.64 +[ \t\n]+ 1.65 + 1.66 +. return *yytext; 1.67 + 1.68 +%% 1.69 + 1.70 +void exprCleanBuffer() 1.71 +{ 1.72 + yy_delete_buffer(yy_current_buffer); 1.73 + yy_init = 1; 1.74 +}