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

fix: handle unicode in lexer #187

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

fix: handle unicode in lexer #187

wants to merge 2 commits into from

Conversation

psteinroe
Copy link
Collaborator

@psteinroe psteinroe commented Jan 30, 2025

fixes #184

also using TextSize now. but we might want to revisit the lexer at some point because I dont think we should store the text in the tokens anymore.

Comment on lines -127 to +132
let token_text: String = text
.chars()
.skip(usize::try_from(pg_query_token.start).unwrap())
.take(
usize::try_from(pg_query_token.end).unwrap()
- usize::try_from(pg_query_token.start).unwrap(),
)
.collect();
let len = token_text.len();

// the lexer returns byte indices, so we need to slice
let token_text = &text[usize::try_from(pg_query_token.start).unwrap()
..usize::try_from(pg_query_token.end).unwrap()];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the important change is this

@psteinroe psteinroe changed the title fix: handle unicude in lexer fix: handle unicode in lexer Jan 30, 2025
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.

lexer: No token found at position
1 participant