Re: [Pyparsing] (no subject)
Brought to you by:
ptmcg
From: Eike W. <eik...@gm...> - 2008-04-03 21:20:08
|
Hello Martin! Just recently "Gre7g Luterman" had a very similar question. He also proposed a kind of decent solution: He stores the location (in the parsed text) of successfully parsed parts of the program. The code for storing is in the parse actions. When a syntax error happens he searches the error with special code, starting from the position of the last part, that was successfully parsed. I have a similar but much more simple solution in my compiler: I store the postion of the last statement that was successfully parsed. When a syntax error happens I print: Error below line XXX. I always wanted to propose some kind of backtracking break for Pyparsing. However it is difficult to describe (for me) what exactly should happen, so that you would get meaningful error messages. Regards, Eike. |