lex-just-parse 0.3.0

lex-just-parse is a simple and easy-to-use lexing and parsing crate for Rust. It provides a fast, stream-based lexical analyzer (Lexer) and combinator-style parser utilities (Parser) to assist in developing custom programming languages, DSLs, or handling structured text parsing needs.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Project Issues & TODOs

## 1. Customizable Keywords in Lexer
Currently, keywords in `lex-just-parse` are hardcoded or need to be manually added to the `lex_identfier` function inside `src/lexer.rs` (e.g., un-commenting the `"var" => TokenKind::Var` line).

**Problem:** 
If this library is published to `crates.io`, users will not be able to customize or add their own language keywords without forking the crate.

**Action Item:**
Refactor the `Lexer` to support injecting custom keywords dynamically. Potential solutions could involve:
- Passing a keyword mapping (e.g., `HashMap<&str, TokenKind>`) to the lexer upon initialization.
- Implementing a generic approach mapping specific string literals to a `TokenKind::Keyword(String)` variant.
- Providing a builder pattern: `Lexer::builder().with_keyword("let", TokenKind::Let).build()`.

**Status:** ✅ Resolved. The Lexer now supports a `with_keywords(&["a", "b"])` configuration method, avoiding the need to fork the crate.