%{ #include #include "y.tab.h" %} DIGIT [0-9] %% \[.*\] ; \"[^\"]*\" { yylval.string = strndup (yytext + 1, yyleng - 2); return STRING; } [-+]?{DIGIT}+"."{DIGIT}* { yylval.num = atof ( yytext ); return NUMBER; } \/\/.* ; [\040\t\r,] ; \n yylineno++; [\;\{\}()] return yytext[0]; . printf ("unexpected character '%c' in config file line %d, skipping", yytext[0], yylineno); %% int yywrap () { return 1; }