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
Bug fixes, improvements, optimization & refactoring before parser generation #288
Merged
alecthomas
merged 13 commits into
alecthomas:master
from
petee-d:improvements-before-parser-generation
Dec 5, 2022
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5fa25c2
Fix bad float conformation error message + add coverage
2795a9d
Remove duplicit information from int/float conversion errors
petee-d ad1557e
Fix possible panic when optional groups are used within a capture
petee-d 5e400b6
Improve mismatch error message for negation & negative lookahead group
petee-d 3de599c
Improve the choice of error reporting after optional branches
petee-d d03a0d2
Optimize string field accumulation to do fewer allocations
b36c8c7
Optimize finding case insensitive tokens to be done at parser constru…
bb4e748
Avoid an allocation in newParseContext
petee-d bf35800
Include explicit disjunction in the union node
petee-d 9aefebf
Remove unused optional and repetition grammar nodes
8854a6d
Change the receiver name of lookaheadGroup from n to l
petee-d af8a3d3
Keep track of the number of usages of a strct node
a61174d
Allow specifying UnexpectedTokenError expected sequence as a string
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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.
@alecthomas I included the previous commit basically just to make it visible what the error message looked like before. IMHO none of the context being added was actually useful and just duplicated the stuff deeper in the error.
The main reason why I removed it had to do with generated parser performance - my parser avoids allocations for errors as much as possible as most errors are later suppressed, so it just collects some error information while parsing and then only allocates the final error once parsing is done. This made that approach tricky as I would need to depend on
fmt
just because of these int/uint/float errors and allocate extra stuff that might later be thrown away. Hope it makes sense.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.
Yep, makes sense 👍