Class: Token

EBNF~ Token

Represents a token symbol for EBNF.


new Token(name, pat)

Creates a token symbol for BNF; see factory method grammar.token(). Sets .expect to contain this.

Parameters:
Name Type Description
name string

token name.

pat RegExp

for a token.

Properties:
Name Type Argument Description
expect module:EBNF~Set

set of terminals which a node expects to see as parser.current.t, maps terminal names to true; expect is not empty.

follow module:EBNF~Set <nullable>

see node.follow().

name string

name for the token. Empty string is reserved for $error, can be something unexpected; only for translation to BNF.

used boolean

true if used in a grammar.

prec Object

precedence.

Properties
Name Type Argument Description
assoc string <optional>

associativity, '%left', '%right', or '%nonassoc', if any.

level number <optional>

precedence level, from 0, if any.

pat RegExp

pattern for token; empty RegExp for $error.

screen Array.<Lit> <optional>

contains literals with values matching the pattern, if any.

Mixes In:
Source:

Extends

Methods


dump()

Displays description and precedence, if any.

Inherited From:
Overrides:
Source:
Returns:
Type
string

toString()

Displays name of a token or $error.

Inherited From:
Overrides:
Source:
Returns:
Type
string