%{ #include #include #include #include "a2.h" #include "common.h" %} %option noyywrap %% "Subdiv" { yylval.id = SUBDIV; return FUNCNAME; } "Comp" { yylval.id = COMP; return FUNCNAME; } "Size" { yylval.id = SIZE; return FUNCNAME; } "Replace" { yylval.id = REPLACE; return FUNCNAME; } "rand" { yylval.id = RAND; return FUNCNAME; } "end" { return '@'; } "Texture" { yylval.id = TEXTURE; return FUNCNAME; } "Repeat" { yylval.id = REPEAT; return FUNCNAME; } "Translate" { yylval.id = TRANSLATE; return FUNCNAME; } "RX" { yylval.id = RX; return FUNCNAME; } "RY" { yylval.id = RY; return FUNCNAME; } "RZ" { yylval.id = RZ; return FUNCNAME; } "\[" { yylval.id = PUSH; return FUNCNAME; } "\]" { yylval.id = POP; return FUNCNAME; } "Model" { yylval.id = MODEL; return FUNCNAME; } "Assign" { yylval.id = ASSIGN; return FUNCNAME; } "->" { return '~'; } \( { return yytext[0]; } \) { return yytext[0]; } , { return yytext[0]; } \{ {return yytext[0]; } \} {return yytext[0]; } \| {return yytext[0]; } : {return yytext[0]; } [_a-zA-Z]+[.0-9_a-zA-Z]* { strcpy(yylval.word, yytext); return WORDVAL; } [+-/*><=!] { return yytext[0]; } [~]?[0-9]*[.[0-9]*]? { if (yytext[0] == '~') { yytext[0] = '0'; printf("!!%s\n", yytext); yylval.val = -(float)atof(yytext); } else { yylval.val = (float)atof(yytext); } return FLOATVAL; } ; { return yytext[0]; } [\^] { return '^'; } [\t\n ]+ { } %%