Rule
The Rule base class.
Constructor Summary
Public Constructor | ||
public |
the Rule constructor |
Method Summary
Public Methods | ||
public |
match a single character |
|
public |
the base handler for every other lexems |
|
public |
match the end of string |
|
public |
force end parsing with error. |
|
public |
maybe match one element from string with provided rule |
|
public |
maybeOneOf(rules: Rule | Object): Rule maybe match one element from string with one of provided rules |
|
public |
match one element from string with provided rule |
|
public |
match one element from string with one of provided rules |
|
public |
match 1 or more element from string with provided rule |
|
public |
skip current descriptor |
|
public |
match a space (any spaces, or carriage returns, or new lines) |
|
public |
catch a terminal |
|
public |
use another rule |
|
public |
match x or more element from string with provided rule |
|
public |
zeroOrMore(rule: Rule | Object): Rule match 0 or more element from string with provided rule |
Public Constructors
Public Methods
public char(test: String): Rule source
match a single character
Params:
Name | Type | Attribute | Description |
test | String | the caracter to match |
public done(callback: Function): Rule source
the base handler for every other lexems
Params:
Name | Type | Attribute | Description |
callback | Function | the callback to handle string |
public error(msg: String): Rule source
force end parsing with error. Only aimed to be used in .oneOf().
Params:
Name | Type | Attribute | Description |
msg | String | the error message. |
public maybeOne(rule: Rule | Object): Rule source
maybe match one element from string with provided rule
public maybeOneOf(rules: Rule | Object): Rule source
maybe match one element from string with one of provided rules
public oneOf(rules: Rule | Object): Rule source
match one element from string with one of provided rules
public oneOrMore(rule: Rule | Object): Rule source
match 1 or more element from string with provided rule
public space(needed: Boolean): Rule source
match a space (any spaces, or carriage returns, or new lines)
Params:
Name | Type | Attribute | Description |
needed | Boolean | true if space is needed. false otherwise. |