2014-10-16 15:30:59 +02:00
|
|
|
%{
|
2014-10-17 17:43:57 +02:00
|
|
|
|
|
|
|
#include "lemon_parser.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "token_def.h"
|
|
|
|
|
|
|
|
|
2014-10-16 15:30:59 +02:00
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
|
|
%option reentrant
|
|
|
|
%option noyywrap
|
2014-10-17 17:43:57 +02:00
|
|
|
%option bison-bridge
|
2014-10-16 15:30:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
%%
|
2014-10-17 17:43:57 +02:00
|
|
|
[0-9]+|[0-9]+.[0-9]+ { yylval->fval = atof(yytext); return NUMBER; }
|
2014-10-16 15:30:59 +02:00
|
|
|
[+] return PLUS;
|
|
|
|
[\n] return NL;
|
|
|
|
[ \t] ; /* skip whitespace */
|
|
|
|
. {printf("Unknown character '%c'\n", yytext[0]); return 0;}
|
|
|
|
%%
|