%option yylineno %{ void yyerror(char*); #define YY_SKIP_YYWRAP #define YYSTYPE double int yywrap(void) { return 1; } #include "myparser.h" %} %option always-interactive %% [ \t]+ { /* do nothing */ } [0-9]+(\.[0-9]+)?(E[+\-]?[0-9]+)? { sscanf(yytext, "%lf", &yylval); return NUMBER; } [+\-*/()\n] { return yytext[0]; } "*+" { return FOO; } . { yyerror("Illegal character."); return '\n'; } %%