%option noyywrap %option nounput %option noinput %{ #include #include "syntree.hpp" #include #include #include using namespace std; #include "parser.tab.hpp" %} %% [-=+*/(){},;?:] return *yytext; == return EQ; function return FUNCTION; print return PRINT; [a-z_]+ { yylval.string_a = new string(yytext); return ID; } [0-9]+ { yylval.int_a = atoi(yytext); return NUM; } [ \n\t] . { cerr << "Leksicka greska: Neprepoznat karakter '" << *yytext << "'" << endl; exit(EXIT_FAILURE); } %%