Add Lexer API
parent
9a266e79fa
commit
3a37ed9f3c
1 changed files with 27 additions and 0 deletions
27
Lexer-API.md
Normal file
27
Lexer-API.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
The `interpret` helper object exposes the Lexing and Parsing API.
|
||||
|
||||
## Methods
|
||||
|
||||
### `interpret.first(input: str)`
|
||||
|
||||
Peeks the first token in the input string.
|
||||
|
||||
Returns: `Token`
|
||||
|
||||
### `interpret.input(prompt: str)`
|
||||
|
||||
An `input(prompt: str)` wrapper that tokenizes the user input.
|
||||
|
||||
Returns: `TokenSet`
|
||||
|
||||
### `interpret.parse_roll(input: str)`
|
||||
|
||||
Parses `input` using the default roll expression parser.
|
||||
|
||||
Returns: `int`
|
||||
|
||||
### `interpret.tokenize(input: str)`:
|
||||
|
||||
Tokenizes a string.
|
||||
|
||||
Returns: `TokenSet`
|
Reference in a new issue