Skip to content

Conversation

jg-rp
Copy link
Owner

@jg-rp jg-rp commented Jul 21, 2025

This PR replaces lex_string_factory with accept_string_literal and moves all state functions (lex_*) to be methods of Lexer instead of functions.

I have thought about using functools.partialmethod instead, but I'm not sure that's much better than the factory function.

The one downside to this approach is that accept_string_literal is not a true state function, but it does emit a token, which doesn't feel very neat.

@jg-rp jg-rp marked this pull request as ready for review July 26, 2025 05:52
@jg-rp jg-rp merged commit 3d78f21 into main Jul 26, 2025
40 checks passed
@jg-rp jg-rp deleted the refactor-lexer branch July 26, 2025 05:53
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.

1 participant