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