new Seq(nodes [, terminal])
Creates a sequence of nodes, i.e., one alternative;
see factory method grammar.seq().
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
nodes |
Array.<(module:Base~Symbol|module:EBNF~Opt|module:EBNF~Some)> | descendants,
not empty, not all |
|
terminal |
module:Base~T |
<optional> <nullable> |
can define precedence; only for translation to BNF. |
- Mixes In:
- Source:
Properties:
| Name | Type | Argument | Description |
|---|---|---|---|
nodes |
Array.<(module:Base~Symbol|module:EBNF~Opt|module:EBNF~Some)> | descendants,
not empty, not all |
|
terminal |
module:Base~T |
<optional> <nullable> |
can define precedence; only for translation to BNF. |
expect |
module:EBNF~Set | set of terminals which a node
expects to see as |
|
follow |
module:EBNF~Set |
<nullable> |
see |
Methods
-
check(error, name)
-
Check for ambiguity: delegate to descendants.
Parameters:
Name Type Description errorfunction should be bound to
grammar.error().namestring current rule.
Returns:
error message, if any.
- Type
- undefined | string
-
deep()
-
Override getter: computes the set from right to left, implements optional.
Returns:
the set, maps terminal names to true.
- Type
- module:EBNF~Set
-
follow( [increment])
-
Override setter: sets me, and sets descendants, pushing from right to left; implements optional.
Parameters:
Name Type Argument Description incrementmodule:EBNF~Set <optional>
<nullable>
controls getter/setter behavior, setter adds.
Returns:
the set, maps terminal names to true.
- Type
- module:EBNF~Set
-
parse(parser)
-
Recognizes a sequence of descendants; implements
Optwith a result ofnullor the collected array.Parameters:
Name Type Description parsermodule:EBNF~Parser context.
Throws:
-
if recognition fails.
- Type
- string
Returns:
list of results produced by the descendants, cannot be empty, see
parser.parse().- Type
- Array
-
-
shallow( [increment])
-
Override getter: computes
.expectfrom left to right as far as necessary.Parameters:
Name Type Argument Description incrementmodule:EBNF~Set <optional>
<nullable>
controls getter/setter behavior, setter adds.
Throws:
-
Seq: all elements are optional(cannot happen) - Type
- Error
Returns:
the (incremented) set, maps terminal names to true.
- Type
- module:EBNF~Set
-
-
toString()
-
Displays all descendants and precedence terminal, if any.
Returns:
- Type
- string