-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
formatter continued 01 #22
Open
FredTheDino
wants to merge
17
commits into
main
Choose a base branch
from
formatter-continued-01
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
68f1d3c
Parse role anotations
FredTheDino b90597f
Thick arrows are operators too
FredTheDino 49326f8
Underscores are starts to expressions
FredTheDino 06dc230
Mitigate infinet loops from expression parse errors
FredTheDino 8c5af16
Parse newtypes
FredTheDino ab1c8c3
Update tests - these all look fairly right
FredTheDino 2c5713f
Fix bug with type-parsing
FredTheDino b485be4
Update all tests and fix a bug I introduced in the `one_or_more` func…
FredTheDino a3008bd
Make the tests a bit more robust
FredTheDino 5c71117
Add more information to the infinet loop-crash
FredTheDino e65e5da
Attempt to parse derive declarations
FredTheDino f3243d1
Update the tests - not sure if these are right
FredTheDino f2d1000
Clear error string is better than empty string
FredTheDino a0e2caf
Fix the crash
FredTheDino 0e367b0
Write something that kinda looks like a syntax tree from the formatter
FredTheDino 4da6f57
Parse a bunch of files instead
FredTheDino 704daf5
Remove `=>` from being a valid operator
FredTheDino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an example file that can cause this infinite loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minimum reproduction that I conjured is:
This fails due to how
expr_if
is defined:More specifically,
expect
is basicallyeat
but it emits an error if it isn't able to consume the current token. The newexpect_recover
function is more suitable for this, where it eats the current token indiscriminately while also emitting an error node for the CST.That being said, loop-safety in the parser is definitely something we should strive for; checking if the parser made progress is a good solution, and I think we should also look into "recovering" as much as possible in the parsing rules.