%option noyywrap %option nounput %{ #include #include using namespace std; #include "parser.tab.hpp" %} %% pocetak return pocetak_token; kraj return kraj_token; ispisi return ispisi_token; mod return mod_token; ["][^"]*["] { string tmp(yytext); yylval.s = new string(tmp.substr(1, tmp.size() - 2)); return string_token; /* " */ } [0-9]+ { yylval.x = atoi(yytext); return broj_token; } 0[xX][0-9a-fA-F]+ { yylval.x = atoi(yytext); return broj_token; } [().;+*/-] return *yytext; [ \n\t] { } . { cerr << "Leksicka greska: Neprepoznat karakter " << *yytext << endl; exit(EXIT_FAILURE); } %%