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 StringTokenizer::peekNextToken #1025

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

mwtoews
Copy link
Contributor

@mwtoews mwtoews commented Jan 9, 2024

This fixes StringTokenizer::peekNextToken so that both (EMPTY and ( EMPTY are StringTokenizer::TT_WORD.

The issue was that the second assignment of pos (from str.find_first_of) was less than the first (from str.find_first_not_of), meaning that it started searching from the wrong position. The fix is simply to set the starting position to pos + 1.

Closes #1013

@mwtoews mwtoews force-pushed the fix-stringtokenizer-peeknexttoken branch 2 times, most recently from 6dde60b to f319443 Compare January 9, 2024 20:47
@mwtoews mwtoews force-pushed the fix-stringtokenizer-peeknexttoken branch from f319443 to 418497d Compare January 14, 2024 08:24
@mwtoews mwtoews requested a review from dbaston January 14, 2024 08:25
@mwtoews mwtoews merged commit 8d87edc into libgeos:main Jan 14, 2024
28 checks passed
@mwtoews mwtoews deleted the fix-stringtokenizer-peeknexttoken branch January 14, 2024 20:26
mwtoews added a commit that referenced this pull request Jan 14, 2024
mwtoews added a commit that referenced this pull request Jan 14, 2024
mwtoews added a commit that referenced this pull request Jan 14, 2024
@mwtoews
Copy link
Contributor Author

mwtoews commented Jan 14, 2024

Backported to 3.12, 3.11, 3.10

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.

Cannot parse EMPTY token with white space
2 participants