-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error when parsing ERB files with yield on the top level
Top level yields are invalid Ruby on files, but are valid on `eval`. They exist on ERB files, and since those files are evaluated no written to disk they are fine. We can tell Prism to parse the code using the eval context by passing `scopes: [[]]` to `parse`, but since are are using the `Prism::Translation::Parser` class we have no way to do that. A [PR][1] was proposed to Prism to always consider the code as being evaluated in the `Parser` translation. For now, we can safely ignore that class of error by overriding the `valid_error?` method on our own parser. Fixes #400. [1]: ruby/prism#2741
- Loading branch information
1 parent
23f31a3
commit e24ea74
Showing
3 changed files
with
9 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters