Skip to content

Fix/lexer imprv#2

Open
msomierick wants to merge 11 commits intomainfrom
fix/lexer-imprv
Open

Fix/lexer imprv#2
msomierick wants to merge 11 commits intomainfrom
fix/lexer-imprv

Conversation

@msomierick
Copy link
Copy Markdown
Owner

Add token stream

BREAKING CHANGES:
- Lexer API now returns Result<Token, LexicalError> instead of Token
- Removed internal error accumulation from Lexer struct
- Removed TokenKind::Unknown variant used for error recovery

- Replace lexer error vector with immediate error propagation
- Introduce unified SmilesError enum with Lexical/Parse variants
- Remove problematic LexicalError to ParseError conversion
- Update main.rs to handle new lexer API
- Add comprehensive test coverage for unified error system

Benefits: Clear error separation, type-safe handling, better reporting
- Remove ParserState struct and consolidate into single Parser impl
- Eliminate token buffering: parse directly from iterator
- Convert all parsing methods to static/associated functions
- Pass line_iter and current_token through parsing call stack
- Maintain all existing parsing functionality and error handling
- Add streaming parser demo to showcase true streaming behavior
- All tests continue to pass, confirming correctness of refactor

This achieves a cleaner, more efficient streaming parser that processes
tokens one-by-one without intermediate buffering or state structs.
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