Skip to content

More tests and fixes for gen lexer word boundary#275

Merged
alecthomas merged 1 commit intoalecthomas:masterfrom
klondikedragon:fix/gen-wordboundary-2
Oct 28, 2022
Merged

More tests and fixes for gen lexer word boundary#275
alecthomas merged 1 commit intoalecthomas:masterfrom
klondikedragon:fix/gen-wordboundary-2

Conversation

@klondikedragon
Copy link
Copy Markdown
Contributor

Third time's the charm!

The correct word boundary test when the position is NOT at the beginning and NOT at the end is to always test the character before the current position and the character at the current position.

In the first version, it tested the character at the current position and the next character after the current position.

In the second version, it also tested the character before the current position and the character at the current position.

The correct solution is simpler and makes sense.

Added more conformance tests to cover the changes, including more cases to ensure \b does NOT match when it should not.

Third time's the charm!

The correct word boundary test when the position is NOT at the beginning
and NOT at the end is to always test the character before the current
position and the character at the current position.

In the first version, it tested the character at the current position
and the next character after the current position.

In the second version, it also tested the character
before the current position and the character at the current position.

The correct solution is simpler and makes sense.

Added more conformance tests to cover the changes, including more cases
to ensure \b does NOT match when it should not.
@alecthomas
Copy link
Copy Markdown
Owner

Awesome :)

@alecthomas alecthomas merged commit 6ca58cf into alecthomas:master Oct 28, 2022
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