Skip to content
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

feat: show location info in parse errors #958

Merged
merged 2 commits into from
Sep 7, 2023

Conversation

MartinNowak
Copy link
Contributor

  • feat!: tokenize with locations by default
  • add consistent Display for Location
  • show (optional) token location in parse errors
  • keep Location line = 0 as noop

This PR does not attempt to add locations to the AST (#757).
Hence it's backwards compatible except for changing the default ParserError messages.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MartinNowak -- this looks like a nice change to me. If we can get the CI to pass I think we should merge it.

❤️

- add consistent Display for Location
- show (optional) token location in parse errors
- keep Location line = 0 as noop
- in parse_sql and try_with_sql
- update test_parser_error_loc
- change test_utils to parse without locations to avoid maintenance overhead

BREAKING CHANGE: changes the default ParserError messages
@MartinNowak
Copy link
Contributor Author

If we can get the CI to pass I think we should merge it.

Fixed @alamb

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MartinNowak -- this looks great to me. Sorry for the delay in review I was away last week

@alamb alamb merged commit b02c3f8 into apache:main Sep 7, 2023
10 checks passed
@MartinNowak MartinNowak deleted the parser-error-loc branch September 9, 2023 06:31
serprex pushed a commit to serprex/sqlparser-rs that referenced this pull request Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants