<private> new Rep(_node, _min, _max)
Creates a new representation of an iteration for EBNF.
Parameters:
Name | Type | Description |
---|---|---|
_node |
eNode | body; null if called during unmarshalling. |
_min |
number | minimum number of occurences, 0 or 1. |
_max |
number | maximum number of occurences, 1 or undefined. |
- Source:
Properties:
Name | Type | Description |
---|---|---|
node |
eNode | body. |
min |
number | minimum number of occurences, 0 or 1. |
max |
number | maximum number of occurences, 1 or undefined. |
nt |
page.BNF.NT | corresponding non-terminal for BNF. |
empty |
boolean | true if no input can be accepted. |
first |
Map | terminals at front, maps ord to page.BNF.T. |
follow |
Map | terminals following, maps ord to page.BNF.T. |
Example
some: item +; many: item *; optional: item ?;
Methods
-
<private> init()
-
Called once by page.EBNF#init to complete EBNF grammar initialization. Imports page.BNF.NT
.empty
, page.BNF.NT.first
, and page.BNF.NT.follow
from page.EBNF.Rep.nt
and then delegates to the descendant.- Source:
-
<private> toBNF(_grammar [, _nt])
-
Called once by page.EBNF#init to recursively translate into BNF.
a+ a* a?
where
.min
and.max
are1:undefined
,0:undefined
, or0:1
, respectively, are translated to$#: a $##; # .min == 1 $##: ; $##: a $##; $#: $##; # if left-hand side is known $##: ; # .min == 0 $##: a $##; $#: ; # .min == 0, .max == 1 $#: a;
Parameters:
Name Type Argument Description _grammar
page.EBNF object to which the construct belongs.
_nt
page.EBNF.NT <optional>
left-hand side, if known; avoids the need for a fresh non-terminal.
- Source:
Returns:
non-terminal representing the translated construct.
- Type
- page.BNF.NT
-
toString()
-
Displays iteration in EBNF notation.
- Source:
Returns:
- Type
- string