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
Bug fixes, improvements, optimization & refactoring before parser generation #288
Commits on Dec 5, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 5fa25c2 - Browse repository at this point
Copy the full SHA 5fa25c2View commit details -
Remove duplicit information from int/float conversion errors
Both strconv.ParseInt and strconv.ParseFloat already report the input. The word invalid isn't always true - it could also just be out of range. The type is contained within the Parse* function being called. So as the extra context added nothing useful, I decided to remove it altogether, making things much easier for the generated parser.
Configuration menu - View commit details
-
Copy full SHA for 2795a9d - Browse repository at this point
Copy the full SHA 2795a9dView commit details -
Fix possible panic when optional groups are used within a capture
If an optional group within a capture matches no input (either because of an unexpected token or EOF), obtaining partial AST can cause `setField` to be called with no tokens, causing a panic. Fixed by not doing anything.
Configuration menu - View commit details
-
Copy full SHA for ad1557e - Browse repository at this point
Copy the full SHA ad1557eView commit details -
Improve mismatch error message for negation & negative lookahead group
It didn't properly escape the token, the error would be malformed if the token contained single quotes. It also used a custom error instead of `UnexpectedTokenError` for no good reason.
Configuration menu - View commit details
-
Copy full SHA for 5e400b6 - Browse repository at this point
Copy the full SHA 5e400b6View commit details -
Improve the choice of error reporting after optional branches
The last error in the added test explains the difference. Without this change, it would have been `1:15: unexpected token "(" (expected ";")`, which would be very confusing as '(' was actually allowed after the class name. After this change, it's `1:20: unexpected token ")" (expected <ident>)`, pointing out the real problem - that an identifier was expected after the comma.
Configuration menu - View commit details
-
Copy full SHA for 3de599c - Browse repository at this point
Copy the full SHA 3de599cView commit details -
Configuration menu - View commit details
-
Copy full SHA for d03a0d2 - Browse repository at this point
Copy the full SHA d03a0d2View commit details -
Optimize finding case insensitive tokens to be done at parser constru…
…ction Optimize finding case insensitive tokens to be done at parser construction Doing it before each parsing was unnecessary. One could worry the results would be different if `ParseFromLexer` was called with a different lexer than used to build the grammar, but then case-insentive tokens would be the least of our problems - literal & reference would check agaist the wrong TokenType.
Configuration menu - View commit details
-
Copy full SHA for b36c8c7 - Browse repository at this point
Copy the full SHA b36c8c7View commit details -
Avoid an allocation in newParseContext
Not very significant for the reflective parser, more significant for the generated one.
Configuration menu - View commit details
-
Copy full SHA for bb4e748 - Browse repository at this point
Copy the full SHA bb4e748View commit details -
Include explicit disjunction in the union node
The generated parser would be the second place that would construct a temporary disjunction in the implementation, I think it might as well contain the disjunction directly.
Configuration menu - View commit details
-
Copy full SHA for bf35800 - Browse repository at this point
Copy the full SHA bf35800View commit details -
Remove unused optional and repetition grammar nodes
They could never be created and were private, so this certainly can't break anything.
Configuration menu - View commit details
-
Copy full SHA for 9aefebf - Browse repository at this point
Copy the full SHA 9aefebfView commit details -
Change the receiver name of lookaheadGroup from n to l
It was n probably because I copied it from negation and assumed n was for node. Naming it l is more consistent with the convention for other nodes.
Configuration menu - View commit details
-
Copy full SHA for 8854a6d - Browse repository at this point
Copy the full SHA 8854a6dView commit details -
Configuration menu - View commit details
-
Copy full SHA for af8a3d3 - Browse repository at this point
Copy the full SHA af8a3d3View commit details -
Configuration menu - View commit details
-
Copy full SHA for a61174d - Browse repository at this point
Copy the full SHA a61174dView commit details