Parser
Source code in pbi_parsers/pq/parser.py
consume
Returns the next token and advances the index.
peek
Peek at the next token without advancing the index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forward
|
int
|
How many tokens to look ahead. Defaults to 0. |
0
|
Returns:
Name | Type | Description |
---|---|---|
Token |
Token
|
The token at the current index + forward. |
Source code in pbi_parsers/pq/parser.py
remaining
Returns the remaining tokens from the current index.
Returns:
Type | Description |
---|---|
list[Token]
|
list[Token]: The list of tokens from the current index to the end. |
to_ast
Parse the tokens and return the root expression.
Raises:
Type | Description |
---|---|
ValueError
|
If no valid expression is found in the token stream. |