%option noyywrap %option nounput %option noinput %{ #include #include #include #include "ast.hpp" using namespace std; #include "parser.tab.hpp" %} %% "def" return def_token; [a-zA-Z]+ { yylval.s = new string(yytext); return id_token; } [0-9]+(\.[0-9]*)? { yylval.d = atof(yytext); return num_token; } [-+*/(),;] return *yytext; [ \t\n] { } . { cerr << "Leksicka greska: neprepoznat karakter " << *yytext << endl; exit(EXIT_FAILURE); } %%