Parser(Rl)
Context sensitive parser
Constructor
new Parser(Rl)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
Rl |
object | Rule | null | The root rule |
Methods
addRule(Rl) → Rule
Adds a new rule
Parameters:
Name | Type | Description |
---|---|---|
Rl |
object | Rule | The rule to add |
Returns:
The Rule
object which has peen added
- Type:
- Rule
addRules(Rls) → Array.<Rule>
Adds multiple new rules
Parameters:
Name | Type | Description |
---|---|---|
Rls |
Array.<object> | Array.<Rule> | An array of the rules to add |
Returns:
An array of Rule
objects which have been added
- Type:
- Array.<Rule>
protectedonComplete(Cx)
Parameters:
Name | Type | Description |
---|---|---|
Cx |
Context | The finished context |
protectedonStart(Cx)
Parameters:
Name | Type | Description |
---|---|---|
Cx |
Context | The root context |
parse(Data) → Context
Parses the data specified as a string or Buffer. After the parsing completed, returns the root context which contains all the generated sub-contexts through the entire parsing
Parameters:
Name | Type | Description |
---|---|---|
Data |
string | Buffer | The data to be parsed |
Returns:
The root context
- Type:
- Context
parseFile(Url, Opt) → Promise
Parses a file asynchronously
Parameters:
Name | Type | Default | Description |
---|---|---|---|
Url |
string | The file URL |
|
Opt |
object | null | Streaming options |
Returns:
A Promise that will resolve when the parsing completes.
You can get the root context as the 1st parameter of a callback
which you can pass to .then()
- Type:
- Promise