<private> new Lst(_node, _delim, _min)
Creates a new representation of a delimited iteration for EBNFP.
Parameters:
Name | Type | Description |
---|---|---|
_node |
epNode | body. |
_delim |
epNode | delimiter. |
_min |
number | minimum number of occurences, 0 or 1. |
- Source:
Properties:
Name | Type | Description |
---|---|---|
node |
epNode | body. |
delim |
epNode | delimiter. |
min |
number | minimum number of occurences, 0 or 1. |
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 +/ delimiter; many: item ⭑/ delimiter;
Extends
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.Lst#nt and then delegates to the descendants.- Inherited From:
- Source:
-
<private> toBNF(_grammar [, _nt])
-
Called once by page.EBNF#init to recursively translate into BNF.
a +/ b a ⭑/ b
where
.min
is 1 or 0, respectively, are translated to$#: ; # for min == 0 $#: a $##; # factored out $##: ; $##: b 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.
- Inherited From:
- Source:
Returns:
non-terminal representing the translated construct.
- Type
- page.BNF.NT
-
<private> toBNF(_grammar [, _nt])
-
Called once by page.EBNFP#init to recursively translate into BNF.
a +/ b a ⭑/ b
where
.min
is 1 or 0, respectively, are translated to$#: %prec error; # for min == 0 $#: a $## %prec error; # factored out $#: error $##; $##: %prec error; $##: $## b a; $##: $# error a; $##: $# b error; $##: $# error;
error
depends on_grammar.recover
and%prec error
is inserted if the grammar specifies%right error
.Parameters:
Name Type Argument Description _grammar
page.EBNFP 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 delimited iteration in EBNF notation.
- Inherited From:
- Source:
Returns:
- Type
- string