So you have a character appearing in your input that you don't know how to handle.
All lex files should have a final . rule that either prints an 'illegal character' error message (not a thrown exception), or else just returns yytext[0]
to the parser for the parser to deal with.
The latter strategy also saves you from having to write a rule for each special character, for example =, + and so on: the parser should just use them as '='
, '+'
, etc. Then (a) any illegal character just becomes a syntax error, but more importantly (b) the parser gets to use its error recovery, rather than just throwing the token away.