new Rule(nt, symbols, index [, prec])
Creates a BNF rule;
see rule() factory method.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
nt |
module:BNF~NT | left-hand side, non-terminal. |
|
symbols |
Array.<module:Base~Symbol> | right-hand side. |
|
index |
number | rule's index in module:BNF~Grammar |
|
prec |
Object |
<optional> <nullable> |
precedence, if any. |
- Source:
Properties:
| Name | Type | Argument | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nt |
module:BNF~NT | rule's non-terminal (left-hand side). |
|||||||||||||
symbols |
Array.<module:Base~Symbol> | rule's right-hand side. |
|||||||||||||
index |
number | rule's index in |
|||||||||||||
empty |
boolean | computed from |
|||||||||||||
reached |
boolean | true if this can be reached from rule zero. |
|||||||||||||
finite |
boolean | true if all non-terminals in the
right-hand side have module:BNF~NT |
|||||||||||||
first |
Object.<number, module:BNF~T> | terminals at front, maps ord to module:BNF~T. |
|||||||||||||
reduced |
boolean | true if this rule has been reduced. |
|||||||||||||
prec |
Object |
<nullable> |
precedence. Properties
|
Methods
-
dump()
-
Displays index, rule,
empty, and content offirst.Returns:
- Type
- string
-
toString( [mark])
-
Displays a rule in BNF notation.
Parameters:
Name Type Argument Description marknumber <optional>
precedes a symbol on the right-hand side if it is in range.
Returns:
- Type
- string