ParserBuilder
Builds led/nud rules for a Parser
Constructor Summary
| Public Constructor | ||
| public |
constructor(parser: Parser<T>) Constructs a ParserBuilder See also: Parser.builder |
|
Method Summary
| Public Methods | ||
| public |
bp(tokenType: T, bp: number): ParserBuilder<T> Define the binding power for a token type |
|
| public |
Returns the parent Parser instance |
|
| public |
either(tokenType: strTng, bp: number, fn: LedFunction<T>): ParserBuilder<T> Define both |
|
| public |
led(tokenType: T, bp: number, fn: LedFunction<T>): ParserBuilder<T> Define |
|
| public |
nud(tokenType: T, bp: number, fn: NudFunction<T>): ParserBuilder<T> Define |
|
Public Constructors
public constructor(parser: Parser<T>) source
Constructs a ParserBuilder See also: Parser.builder
Params:
| Name | Type | Attribute | Description |
| parser | Parser<T> | The parser |
Public Methods
public bp(tokenType: T, bp: number): ParserBuilder<T> source
Define the binding power for a token type
Params:
| Name | Type | Attribute | Description |
| tokenType | T | The token type |
|
| bp | number | The binding power |
public either(tokenType: strTng, bp: number, fn: LedFunction<T>): ParserBuilder<T> source
Define both led and nud for a token type at once.
The supplied LedFunction may be called with a null left
parameter when invoked from a nud context.
Params:
| Name | Type | Attribute | Description |
| tokenType | strTng | The token type |
|
| bp | number | The binding power |
|
| fn | LedFunction<T> | The function that will parse the token |
public led(tokenType: T, bp: number, fn: LedFunction<T>): ParserBuilder<T> source
Define led for a token type
Params:
| Name | Type | Attribute | Description |
| tokenType | T | The token type |
|
| bp | number | The binding power |
|
| fn | LedFunction<T> | The function that will parse the token |
public nud(tokenType: T, bp: number, fn: NudFunction<T>): ParserBuilder<T> source
Define nud for a token type
Params:
| Name | Type | Attribute | Description |
| tokenType | T | The token type |
|
| bp | number | The binding power |
|
| fn | NudFunction<T> | The function that will parse the token |