Class: Token

BNF~ Token

Represents a token symbol for BNF.

mixes module:BNF~T

new Token(name, pat)

Creates a token symbol for BNF; see factory method grammar.token().

Parameters:
Name Type Description
name string

token name.

pat RegExp

for a token.

Properties:
Name Type Argument Description
ord number

global index; set in check().

first Object.<number, module:Base~T>

maps ord to this.

name string

name for the token. Empty string is reserved for $error, can be something unexpected.

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.

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