%{ package config %} D [0-9] L [a-zA-Z_] %s S_GLOBAL S_GLOBAL_LABELS S_JOB S_TARGETS S_TARGET_LABELS %x S_COMMENTS %% . { yypos++; REJECT } \n { yyline++; yypos = 1; REJECT } "/*" { BEGIN(S_COMMENTS); } "*/" { BEGIN(0) } . { /* ignore chars within multi-line comments */ } \/\/[^\r\n]*\n { /* gobble up one-line comments */ } <0>global { BEGIN(S_GLOBAL); return GLOBAL } labels { BEGIN(S_GLOBAL_LABELS); return LABELS } rule_files { return RULE_FILES } "}" { BEGIN(S_GLOBAL); REJECT } "}" { BEGIN(0); REJECT } <0>job { BEGIN(S_JOB); return JOB } targets { BEGIN(S_TARGETS); return TARGETS } endpoints { return ENDPOINTS } labels { BEGIN(S_TARGET_LABELS); return LABELS } "}" { BEGIN(S_TARGETS); REJECT } "}" { BEGIN(S_JOB); REJECT } "}" { BEGIN(0); REJECT } {L}({L}|{D})+ { yylval.str = yytext; return IDENTIFIER } \"(\\.|[^\\"])*\" { yylval.str = yytext[1:len(yytext) - 1]; return STRING } \'(\\.|[^\\'])*\' { yylval.str = yytext[1:len(yytext) - 1]; return STRING } [{}\[\]()=,] { return int(yytext[0]) } . { /* don't print any remaining chars (whitespace) */ } \n { /* don't print any remaining chars (whitespace) */ } %%