You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is more a question then a bug report. How to properly terminate parsing, if the parser stumbles on an error? I just want to report that one error, but don't want to continue on parsing nor execute the AST. Just throw away everything and terminate gracefully reporting the line where the error has been detected.
Is there a way to clear the parsing stack and iterate over the rest of the tokens in the input or something similar?
My error function follows:
error(self, t):
while True:
tok = next(self.tokens, None)
if not tok:
break
self.restart()
return tok
However, this seems to be not working. Just one more point, which may be important, the error is "artificial" meaning, I got parts of my grammar which are unsupported and if the parser parses such code, the "error()" method is invoked.
File "C:\Users\nxf25094\Documents\sProjects\git_repos\spsdk\venv38\lib\site-packages\sly\yacc.py", line 2091, in parse
self.state = goto[statestack[-1]][pname]
IndexError: list index out of range
The text was updated successfully, but these errors were encountered:
Hello,
this is more a question then a bug report. How to properly terminate parsing, if the parser stumbles on an error? I just want to report that one error, but don't want to continue on parsing nor execute the AST. Just throw away everything and terminate gracefully reporting the line where the error has been detected.
Is there a way to clear the parsing stack and iterate over the rest of the tokens in the input or something similar?
My error function follows:
However, this seems to be not working. Just one more point, which may be important, the error is "artificial" meaning, I got parts of my grammar which are unsupported and if the parser parses such code, the "error()" method is invoked.
The error I'm getting from python:
File "C:\Users\nxf25094\Documents\sProjects\git_repos\spsdk\venv38\lib\site-packages\sly\yacc.py", line 2091, in parse
self.state = goto[statestack[-1]][pname]
IndexError: list index out of range
The text was updated successfully, but these errors were encountered: