%{ #include #include "expression.h" #include "parser.tab.h" %} %option reentrant %option bison-bridge %option nounput %option noinput %option noyywrap %% "\n" { return WEBDICE_TOKEN_EOL; } -?[0-9]+ { int64_t aux; sscanf(yytext,"%lld",&aux); (*yylval).exp = webdice_const(aux); return WEBDICE_TOKEN_CONST; } -?[0-9]+d[0-9]+ { int64_t count,type; sscanf(yytext,"%lldd%lld",&count,&type); (*yylval).exp = webdice_roll(count,type); return WEBDICE_TOKEN_ROLL; } "(" { return WEBDICE_TOKEN_LPAREN; } ")" { return WEBDICE_TOKEN_RPAREN; } "*" { return WEBDICE_TOKEN_MUL; } "/" { return WEBDICE_TOKEN_DIV; } "+" { return WEBDICE_TOKEN_ADD; } "-" { return WEBDICE_TOKEN_SUB; } [ \t]+ {} . { fprintf(stderr,"%s",yytext); return WEBDICE_TOKEN_EOL; } %%