%{ #include %} %option main %x INCL ID [a-zA-Z_][a-zA-Z0-9_]* %% ^"#include"[ \t]* { printf("Pragmat #include erkannt.\n"); BEGIN(INCL); } "<"[a-zA-Z._-]+">" | "\""[a-zA-Z._-]+"\"" { printf("Dateiname erkannt: '%s'\n", yytext); BEGIN(INITIAL); } . printf("Illegales Zeichen nach '#include': '%s'\n", yytext); {ID} printf("Bezeichner erkannt: '%s'\n", yytext); [ \t\n]+ /* ueberspringe White-Space */ . printf("Zeichen erkannt: '%s'\n", yytext);