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