Class: Seq

page.EBNFP. Seq

Represents a sequence with optional precedence for EBNFP.


<private> new Seq(_nodes [, _prec])

Creates a new representation of a sequence with optional precedence for EBNFP.

Parameters:
Name Type Argument Description
_nodes Array.<epNode>

sequence, at least two, or with precedence.

_prec page.BNF.T <optional>

terminal providing the precedence.

Properties:
Name Type Argument Description
nodes Array.<epNode>

descendants, at least two, or with precedence.

prec.t page.BNF.T <optional>

terminal providing the precedence.

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.

Source:
Example
alt: a b %prec 'x' | c %prec 'y';

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.Seq.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

is translated to

$#: a b;
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 %prec b

is translated to

$#: a %prec b;
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 a sequence in EBNF notation.

Inherited From:
Source:
Returns:

.

Type
string

toString()

Displays a sequence in EBNF notation with precedence, if any.

Source:
Returns:

.

Type
string