Forgive me, I'm completely unfamiliar with parsing and lex / yacc, and I'm probably overhead, but nonetheless:
I am writing a fairly simple calculator with PLY, but its input may not always be an equation, and I need to determine if it exists or not when parsing. The extremes of input are something that is perfectly evaluated using an equation that it analyzes and calculates perfectly, or something that doesn't look like an equation that doesn't parse and is also great.
The gray area is the input, which has parts similar to the equations, of which the parser will capture and work. This is not what I want - I need to find out if parts of the string were raised and marked, so I can throw an error, but I have no idea how to do this.
Does anyone know how I can mainly define “catch all that is left”? Or is there a better way to handle this?
source
share