new Opt(seqs)
Creates an optional list of alternatives;
see opt() factory method.
Parameters:
| Name | Type | Description |
|---|---|---|
seqs |
Array.<module:EBNF~Seq> | the alternatives. |
- Source:
Properties:
| Name | Type | Argument | Description |
|---|---|---|---|
seqs |
Array.<module:EBNF~Seq> | the alternatives. |
|
expect |
module:EBNF~Set | set of terminals which a node
expects to see as |
|
follow |
module:EBNF~Set |
<nullable> |
see |
Extends
Methods
-
check(error, name)
-
Check for ambiguity:
expectandfollowmust be disjoint; delegate to superclass.Parameters:
Name Type Description errorfunction should be bound to
grammar.error().namestring current rule.
- Overrides:
- Source:
Returns:
error message, if any.
- Type
- undefined | string
-
deep()
-
Override getter: computes the set as sum over all descendants.
- Inherited From:
- Overrides:
- Source:
- See:
-
- {linkcode module:EBNF~Node#deep Node.deep(increment)}.
Returns:
the set, maps terminal names to true.
- Type
- module:EBNF~Set
-
follow( [increment])
-
Override setter: sets me and all descendants.
Parameters:
Name Type Argument Description incrementmodule:EBNF~Set <optional>
<nullable>
controls getter/setter behavior, setter adds.
- Inherited From:
- Overrides:
- Source:
- See:
-
- {linkcode module:EBNF~Node#follow Node.fallow(increment)}.
Returns:
the set, maps terminal names to true.
- Type
- module:EBNF~Set
-
parse(parser)
-
Recognizes one of several alternatives.
Parameters:
Name Type Description parsermodule:EBNF~Parser context.
- Inherited From:
- Overrides:
- Source:
Throws:
-
if recognition fails.
- Type
- string
Returns:
the list produced by the selected descendant
Seq, seeparser.parse().- Type
- Array
-
shallow( [increment])
-
Override getter: computes the set as sum over all descendants.
Parameters:
Name Type Argument Description incrementmodule:EBNF~Set <optional>
<nullable>
controls getter/setter behavior, setter adds.
- Inherited From:
- Overrides:
- Source:
- See:
-
- {linkcode module:EBNF~Node#shallow Node.shallow(increment)}.
Returns:
the (incremented) set, maps terminal names to true.
- Type
- module:EBNF~Set
-
toString()
-
Displays alternatives in brackets.
- Overrides:
- Source:
Returns:
- Type
- string