%option noyywrap %option nounput %option noinput %{ #include #include "skup.h" #include "y.tab.h" %} %% print { return print_token; } check { return check_token; } card { return card_token; } [A-Za-z]+ { yylval.ime = malloc((yyleng+1) * sizeof(char)); if (yylval.ime == NULL){ fprintf(stderr, "malloc() error"); exit(EXIT_FAILURE); } strcpy(yylval.ime, yytext); return id_token; } [;={},\\:<~] { return *yytext; } ([+-])?[0-9]+ { yylval.broj = atoi(yytext); return num_token; } \.\. { return oddo_token; } "/\\" { return presek_token; } "\\/" { return unija_token; } [ \n\t] { } . { fprintf(stderr, "Neprepoznat karakter '%c'\n", *yytext); exit(EXIT_FAILURE); } %%