<private> new Alt(_nodes)
Creates a new representation of a choice for EBNF.
Parameters:
Name | Type | Description |
---|---|---|
_nodes |
Array.<eNode> | alternatives, at least two. |
- Source:
Properties:
Name | Type | Description |
---|---|---|
nodes |
Array.<eNode> | descendants, at least two. |
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
choice: a | b;
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.Alt.nt
and then delegates to the descendants.- Source:
-
<private> toBNF(_grammar [, _nt])
-
Called once by page.EBNF#init to recursively translate into BNF.
a | b | c
is translated to
$#: a; $#: b; $#: c;
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 alternatives in EBNF notation.
- Source:
Returns:
- Type
- string