-
Notifications
You must be signed in to change notification settings - Fork 20
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
Query parser error reporting improvements #1052
Query parser error reporting improvements #1052
Conversation
🦋 Changeset detectedLatest commit: 9689b21 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Left a few questions/suggestions.
Thanks!
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.
One remaining suggestion about the error message.
Otherwise, LGTM!
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.
Thanks for the fixes!
This will greatly improve the DX working with the queries.
Fixes NomicFoundation#1041 Fixes NomicFoundation#1042 This PR improves on the query parse errors reported: - Compute row and column information for query parser errors (previously these were not computed and hard-coded to 0,0) - Improve reporting when the error occurs attempting to parse edge labels or node kinds: By using `cut()` and providing a `context()` we can get a better error message without fully customizing the error type used throughout the parser.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` ## @nomicfoundation/[email protected] ### Minor Changes - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: queries now ignore trivia nodes. - [#1030](#1030) [`7e467ce`](7e467ce) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: remove the ellipsis query `...` operator making it implicit, add an adjacency operator `.`. ### Patch Changes - [#1015](#1015) [`369ee30`](369ee30) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - upgrade to rust `1.79.0`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Compute row and column information for query parser errors. - [#1048](#1048) [`c408caa`](c408caa) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - support Yul multiple variables declaration - [#1047](#1047) [`2b32045`](2b32045) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - inline `MemberAccess` enum into the parent `MemberAccessExpression` - [#1062](#1062) [`6b05496`](6b05496) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix stack assignments operator `=:`. - [#1052](#1052) [`54c9067`](54c9067) Thanks [@ggiraldez](https://github.com/ggiraldez)! - Tree Query Language: Improve reporting when an error occurs attempting to parse edge labels or node kinds. - [#1037](#1037) [`2a74f91`](2a74f91) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - fix `ExponentiationExpression` associativity before `0.8.0` Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Fixes #1041
Fixes #1042
This PR improves on the query parse errors reported:
Compute row and column information for query parser errors (previously these were not computed and hard-coded to 0,0)
Improve reporting when the error occurs attempting to parse edge labels or node kinds: By using
cut()
and providing acontext()
we can get a better error message without fully customizing the error type used throughout the parser.