Forgive me, I'm completely new to parsing and lex/yacc, and I'm probably in way over my head, but nonetheless:
I'm writing a pretty basic calculator with PLY, but it's input might not always be an equation, and I need to determine if it is or not when parsing. The extremes of the input would be something that evaluates perfectly to an equation, which it parses fine and calculates, or something that is nothing like an equation, which fails parsing and is also fine.
The gray area is an input that has equation-like parts, of which the parser will grab and work out. This isn't what I want - I need to be able to tell if parts of the string didn't get picked up and tokenized so I can throw back an error, but I have no idea how to do this.
Does anyone know how I can define, basically, a 'catch anything that's left' token? Or is there a better way I can handle this?