Most likely, you have (in error) placed the opening ‘{’ of the action block on a different line than the rule, e.g.,
^(foo|bar)
{ <<<--- WRONG!
}
flex requires that the opening ‘{’ of an action associated with a rule
begin on the same line as does the rule. You need instead to write your rules
as follows:
^(foo|bar) { // CORRECT!
}