Lexer¶
bcql_py.parser.lexer
¶
Tokenize BCQL source text into a typed token stream.
BCQLLexer
¶
A hand-written lexer for BCQL query strings, converting a given string into a sequence of tokens.
Attributes:
| Name | Type | Description |
|---|---|---|
source |
str
|
The original BCQL query string (read-only property). |
pos |
int
|
Current character position in source during tokenization (read-only property). |
tokens |
tuple[Token, ...]
|
Immutable tuple of tokens produced by tokenization (read-only property). |
Initialize the empty lexer state for source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
BCQL query text to tokenize. |
required |
View source on GitHub: src/bcql_py/parser/lexer.py lines 20–30
tokens
property
¶
Return the tokenized source as an immutable token tuple.
tokenize
¶
We assume the base case where the token can be a sequence of [] tokens or "" or '' or a sequence of alphanumeric characters and underscores.
View source on GitHub: src/bcql_py/parser/lexer.py lines 250–507