Class: Lit

BNF~ Lit

Represents a literal symbol for BNF.


new Lit( [name])

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

Parameters:
Name Type Argument Description
name string <optional>

a (quoted) representation for the literal.

Properties:
Name Type Argument Description
ord number

global index; set in check().

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

maps ord to this.

name string

representation for a literal. Empty string is reserved for $eof, the end of input.

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.

value string

(unquoted) value for the literal; empty string for $eof, too.

screened boolean <optional>

set true only during scanner construction if literal value matches a token pattern.

Mixes In:
Source:

Extends

Methods


dump()

Displays description and precedence, if any.

Inherited From:
Overrides:
Source:
Returns:
Type
string

toString()

Displays representation of a literal or $eof.

Inherited From:
Overrides:
Source:
Returns:
Type
string

unescape(s)

Removes leading and trailing delimiter character and elaboarates backslash escapes.

Parameters:
Name Type Description
s string

string to unescape.

Inherited From:
Overrides:
Source:
Returns:

unquoted, unescaped string.

Type
string