%option noyywrap %option nounput %{ #include #include using namespace std; #include "regex.hpp" #include #include "parser.tab.hpp" %} %% "BASIC" return basic_token; "DEFINITION" return definition_token; "MAXLEN" return maxlen_token; "MINSTR" return minstr_token; [A-Z] { yylval.c = *yytext; return id_token; } [a-z] { yylval.c = *yytext; return char_token; } \{[0-9]+\} { yylval.i = atoi(yytext + 1); return num_token; } [*+?\[\]|\n()={}] return *yytext; [ \t] { } . { cerr << "Leksicka greska: Neprepoznat karakter '" << *yytext << "'" << endl; exit(EXIT_FAILURE); } %%