%option noyywrap %option nounput %{ #include #include #include #include "izraz.hpp" #include "naredba.hpp" #include using namespace std; #include "parser.tab.hpp" %} %% "pocetak" return pocetak_token; "kraj" return kraj_token; "ispisi" return ispisi_token; "mod" return mod_token; \"([^"])*\" { // " yylval.s = new string(yytext+1); yylval.s->pop_back(); return string_token; } [0-9]+ { yylval.v = atoi(yytext); return num_token; } "0x"[0-9a-fA-F]+ { sscanf(yytext, "%d", &yylval.v); return num_token; } [-+*/();.] { return *yytext; } [ \t\n] { } . { cerr << "Leksicka greska: neporepoznat karakter " << *yytext << endl; exit(EXIT_FAILURE); } %%