%option noyywrap %option nounput %{ #include #include using namespace std; #include "funkcije.hpp" #include "parser.tab.hpp" %} %% function return function_token; value return value_token; sin return sin_token; cos return cos_token; [a-wyz] { yylval.c = *yytext; return id_token; } [0-9]+(\.[0-9]*)? { yylval.d = atof(yytext); return num_token; } [x\n\'\"+*/()=\[\]-] return *yytext; [ \t] { } . { cerr << "Leksicka greska: nepoznat karakter '" << yytext << "'" << endl; exit(EXIT_FAILURE); } %%