Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Grammar does not recover correctly on parse error #82

Closed
nishtahir opened this issue May 22, 2018 · 0 comments
Closed

Grammar does not recover correctly on parse error #82

nishtahir opened this issue May 22, 2018 · 0 comments
Labels
bug grammar Requires a change in the grammar

Comments

@nishtahir
Copy link
Member

Normally, when the ANTLR runtime encounters a parse error, it attempts to recover by removing tokens from the token stream until it finds a token that satisfies the current or enclosing context.

However, in our case, it seems that Wist is unable to recover from a parse error because it makes the assumption that the enclosing scope is always a componentContext or componentHeadContext. These are always followed by EOF which means that the runtime will continue to remove tokens from the stream until the end of the file.

It seems that the solution is to remove the component rule as well as the componentBody rule from componentHeadElement.

@nishtahir nishtahir changed the title Grammar parse error prevents recovery on parse error Grammar does not recover correctly on parse error May 22, 2018
@nishtahir nishtahir added bug grammar Requires a change in the grammar labels May 24, 2018
nishtahir added a commit that referenced this issue May 27, 2018
Looks like this was solved by removing componendBody from componentHead
#82
The result is that the parser doesn't bail out on the first error now.
The linter is now usable in its current state.
nishtahir added a commit that referenced this issue Jun 3, 2018
Looks like this was solved by removing componendBody from componentHead
#82
The result is that the parser doesn't bail out on the first error now.
The linter is now usable in its current state.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug grammar Requires a change in the grammar
Projects
None yet
Development

No branches or pull requests

1 participant