Class: Token

Base~ Token

Represents a token symbol.


<abstract> new Token(name, pat)

Creates a token symbol; should only be used by factory method.

Parameters:
Name Type Description
name string

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

pat RegExp

pattern for token; empty RegExp for $error.

Properties:
Name Type Argument Description
pat RegExp

pattern for token; empty RegExp for $error.

screen Array.<Lit> <optional>

contains literals with values matching the pattern, if any.

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.

used boolean

true if used in a grammar.

name string

name for a token, representation for a literal. Empty string is reserved for $error, can be something unexpected.

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.

Source:
Returns:
Type
string