Redigera

Dela via


LGTemplateLexer class

Extends

Lexer

Constructors

LGTemplateLexer(CharStream)

Properties

beginOfStructureProperty
beginOfTemplateBody
beginOfTemplateLine
CASE
channelNames
channelNames
COMMENTS
DASH
DEFAULT
ELSE
ELSEIF
ESCAPE_CHARACTER
ESCAPE_CHARACTER_IN_STRUCTURE_BODY
EXPRESSION
EXPRESSION_IN_STRUCTURE_BODY
grammarFileName
IF
ignoreWS
inMultiline
inStructuredValue
INVALID_TOKEN
LEFT_SQUARE_BRACKET
modeNames
modeNames
MULTILINE_MODE
MULTILINE_PREFIX
MULTILINE_SUFFIX
NEWLINE
NEWLINE_IN_BODY
NEWLINE_IN_STRUCTURE_NAME
NORMAL_TEMPLATE_BODY_MODE
ruleNames
ruleNames
serializedATN
STRUCTURED_BODY_END
STRUCTURED_COMMENTS
STRUCTURED_NEWLINE
STRUCTURE_BODY_MODE
STRUCTURE_EQUALS
STRUCTURE_IDENTIFIER
STRUCTURE_NAME
STRUCTURE_NAME_MODE
STRUCTURE_OR_MARK
SWITCH
TEXT
TEXT_IN_STRUCTURE_BODY
TEXT_IN_STRUCTURE_NAME
VOCABULARY
vocabulary
WS
WS_IN_BODY
WS_IN_STRUCTURE_BODY
WS_IN_STRUCTURE_NAME

Inherited Properties

atn

Get the serializedATN used by the recognizer for prediction.

channel
charIndex

What is the index of the current character of lookahead?

charPositionInLine
DEFAULT_MODE
DEFAULT_TOKEN_CHANNEL
EOF
HIDDEN
inputStream

Set the char stream and reset the lexer

interpreter

Set the ATN interpreter used by the recognizer for prediction.

line
MAX_CHAR_VALUE
MIN_CHAR_VALUE
MORE
parseInfo

If profiling during the parse/lex, this will return DecisionInfo records for each decision in recognizer in a ParseInfo object.

SKIP
sourceName
state

Indicate that the recognizer has changed internal state that is consistent with the ATN state passed in. This way we always know where we are in the ATN as the parser goes along. The rule context objects form a stack that lets us see the stack of invoking rules. Combine this and we have complete ATN configuration information.

text

Set the complete text of this token; it wipes any previous changes to the text.

token

Override if emitting multiple tokens.

tokenFactory
type

Methods

action(RuleContext, number, number)
sempred(RuleContext, number, number)

Inherited Methods

addErrorListener(ANTLRErrorListener<number>)
emit()

By default does not support multiple emits per nextToken invocation for efficiency reasons. Subclass and override this method, nextToken, and getToken (to push tokens into a list and pull from that list rather than a single variable as this implementation does).

emit(Token)

The standard method called to automatically emit a token at the outermost lexical rule. The token object should point into the char buffer start..stop. If there is a text override in 'text', use that to set the token's text. Override this method to emit custom Token objects or provide a new factory.

emitEOF()
getAllTokens()

Return a list of all Token objects in input char stream. Forces load of all tokens. Does not include EOF token.

getCharErrorDisplay(number)
getErrorDisplay(string | number)
getErrorHeader(RecognitionException)

What is the error header, normally line/character position information?

getErrorListenerDispatch()
getErrorListeners()
getRuleIndexMap()

Get a map from rule names to rule indexes. Used for XPath and tree pattern compilation.

getTokenType(string)
getTokenTypeMap()

Get a map from token names to token types. Used for XPath and tree pattern compilation.

mode(number)
more()
nextToken()

Return a token from this source; i.e., match a token on the char stream.

notifyListeners(LexerNoViableAltException)
popMode()
precpred(RuleContext | undefined, number)
pushMode(number)
recover(LexerNoViableAltException)
recover(RecognitionException)

Lexers can normally match any char in it's vocabulary after matching a token, so do the easy thing and just kill a character and hope it all works out. You can instead use the rule invocation stack to do sophisticated error recovery if you are in a fragment rule.

removeErrorListener(ANTLRErrorListener<number>)
removeErrorListeners()
reset()
reset(boolean)
skip()

Instruct the lexer to skip creating a token for current lexer rule and look for another token. nextToken() knows to keep looking when a lexer rule finishes with token set to SKIP_TOKEN. Recall that if token==undefined at end of any token rule, it creates one for you and emits it.

Constructor Details

LGTemplateLexer(CharStream)

new LGTemplateLexer(input: CharStream)

Parameters

input

CharStream

Property Details

beginOfStructureProperty

beginOfStructureProperty: boolean = false

Property Value

boolean

beginOfTemplateBody

beginOfTemplateBody: boolean = true

Property Value

boolean

beginOfTemplateLine

beginOfTemplateLine: boolean = false

Property Value

boolean

CASE

public static CASE: 14 = 14

Property Value

14

channelNames

public static channelNames: string[] = [
		"DEFAULT_TOKEN_CHANNEL", "HIDDEN",
	]

Property Value

string[]

channelNames

string[] channelNames

Property Value

string[]

COMMENTS

public static COMMENTS: 3 = 3

Property Value

3

DASH

public static DASH: 4 = 4

Property Value

4

DEFAULT

public static DEFAULT: 15 = 15

Property Value

15

ELSE

public static ELSE: 12 = 12

Property Value

12

ELSEIF

public static ELSEIF: 11 = 11

Property Value

11

ESCAPE_CHARACTER

public static ESCAPE_CHARACTER: 16 = 16

Property Value

16

ESCAPE_CHARACTER_IN_STRUCTURE_BODY

public static ESCAPE_CHARACTER_IN_STRUCTURE_BODY: 31 = 31

Property Value

31

EXPRESSION

public static EXPRESSION: 17 = 17

Property Value

17

EXPRESSION_IN_STRUCTURE_BODY

public static EXPRESSION_IN_STRUCTURE_BODY: 32 = 32

Property Value

32

grammarFileName

string grammarFileName

Property Value

string

IF

public static IF: 10 = 10

Property Value

10

ignoreWS

ignoreWS: boolean = true

Property Value

boolean

inMultiline

inMultiline: boolean = false

Property Value

boolean

inStructuredValue

inStructuredValue: boolean = false

Property Value

boolean

INVALID_TOKEN

public static INVALID_TOKEN: 6 = 6

Property Value

6

LEFT_SQUARE_BRACKET

public static LEFT_SQUARE_BRACKET: 5 = 5

Property Value

5

modeNames

public static modeNames: string[] = [
		"DEFAULT_MODE", "NORMAL_TEMPLATE_BODY_MODE", "MULTILINE_MODE", "STRUCTURE_NAME_MODE", 
		"STRUCTURE_BODY_MODE",
	]

Property Value

string[]

modeNames

string[] modeNames

Property Value

string[]

MULTILINE_MODE

public static MULTILINE_MODE: 2 = 2

Property Value

2

MULTILINE_PREFIX

public static MULTILINE_PREFIX: 8 = 8

Property Value

8

MULTILINE_SUFFIX

public static MULTILINE_SUFFIX: 19 = 19

Property Value

19

NEWLINE

public static NEWLINE: 2 = 2

Property Value

2

NEWLINE_IN_BODY

public static NEWLINE_IN_BODY: 9 = 9

Property Value

9

NEWLINE_IN_STRUCTURE_NAME

public static NEWLINE_IN_STRUCTURE_NAME: 21 = 21

Property Value

21

NORMAL_TEMPLATE_BODY_MODE

public static NORMAL_TEMPLATE_BODY_MODE: 1 = 1

Property Value

1

ruleNames

public static ruleNames: string[] = [
		"A", "C", "D", "E", "F", "H", "I", "L", "S", "T", "U", "W", "LETTER", 
		"NUMBER", "WHITESPACE", "STRING_LITERAL", "STRING_INTERPOLATION", "ESCAPE_CHARACTER_FRAGMENT", 
		"IDENTIFIER", "OBJECT_DEFINITION", "EXPRESSION_FRAGMENT", "NEWLINE_FRAGMENT", 
		"WS", "NEWLINE", "COMMENTS", "DASH", "LEFT_SQUARE_BRACKET", "INVALID_TOKEN", 
		"WS_IN_BODY", "MULTILINE_PREFIX", "NEWLINE_IN_BODY", "IF", "ELSEIF", "ELSE", 
		"SWITCH", "CASE", "DEFAULT", "ESCAPE_CHARACTER", "EXPRESSION", "TEXT", 
		"MULTILINE_SUFFIX", "MULTILINE_ESCAPE_CHARACTER", "MULTILINE_EXPRESSION", 
		"MULTILINE_TEXT", "WS_IN_STRUCTURE_NAME", "NEWLINE_IN_STRUCTURE_NAME", 
		"STRUCTURE_NAME", "TEXT_IN_STRUCTURE_NAME", "STRUCTURED_COMMENTS", "WS_IN_STRUCTURE_BODY", 
		"STRUCTURED_NEWLINE", "STRUCTURED_BODY_END", "STRUCTURE_IDENTIFIER", "STRUCTURE_EQUALS", 
		"STRUCTURE_OR_MARK", "ESCAPE_CHARACTER_IN_STRUCTURE_BODY", "EXPRESSION_IN_STRUCTURE_BODY", 
		"TEXT_IN_STRUCTURE_BODY",
	]

Property Value

string[]

ruleNames

string[] ruleNames

Property Value

string[]

serializedATN

string serializedATN

Property Value

string

STRUCTURED_BODY_END

public static STRUCTURED_BODY_END: 27 = 27

Property Value

27

STRUCTURED_COMMENTS

public static STRUCTURED_COMMENTS: 24 = 24

Property Value

24

STRUCTURED_NEWLINE

public static STRUCTURED_NEWLINE: 26 = 26

Property Value

26

STRUCTURE_BODY_MODE

public static STRUCTURE_BODY_MODE: 4 = 4

Property Value

4

STRUCTURE_EQUALS

public static STRUCTURE_EQUALS: 29 = 29

Property Value

29

STRUCTURE_IDENTIFIER

public static STRUCTURE_IDENTIFIER: 28 = 28

Property Value

28

STRUCTURE_NAME

public static STRUCTURE_NAME: 22 = 22

Property Value

22

STRUCTURE_NAME_MODE

public static STRUCTURE_NAME_MODE: 3 = 3

Property Value

3

STRUCTURE_OR_MARK

public static STRUCTURE_OR_MARK: 30 = 30

Property Value

30

SWITCH

public static SWITCH: 13 = 13

Property Value

13

TEXT

public static TEXT: 18 = 18

Property Value

18

TEXT_IN_STRUCTURE_BODY

public static TEXT_IN_STRUCTURE_BODY: 33 = 33

Property Value

33

TEXT_IN_STRUCTURE_NAME

public static TEXT_IN_STRUCTURE_NAME: 23 = 23

Property Value

23

VOCABULARY

public static VOCABULARY: Vocabulary = new VocabularyImpl(LGTemplateLexer._LITERAL_NAMES, LGTemplateLexer._SYMBOLIC_NAMES, [])

Property Value

Vocabulary

vocabulary

Vocabulary vocabulary

Property Value

Vocabulary

WS

public static WS: 1 = 1

Property Value

1

WS_IN_BODY

public static WS_IN_BODY: 7 = 7

Property Value

7

WS_IN_STRUCTURE_BODY

public static WS_IN_STRUCTURE_BODY: 25 = 25

Property Value

25

WS_IN_STRUCTURE_NAME

public static WS_IN_STRUCTURE_NAME: 20 = 20

Property Value

20

Inherited Property Details

atn

Get the serializedATN used by the recognizer for prediction.

atn: ATN

Property Value

ATN

Inherited From Recognizer.atn

channel

channel: number

Property Value

number

Inherited From Lexer.channel

charIndex

What is the index of the current character of lookahead?

charIndex: number

Property Value

number

Inherited From Lexer.charIndex

charPositionInLine

charPositionInLine: number

Property Value

number

Inherited From Lexer.charPositionInLine

DEFAULT_MODE

static DEFAULT_MODE: number

Property Value

number

Inherited From Lexer.DEFAULT_MODE

DEFAULT_TOKEN_CHANNEL

static DEFAULT_TOKEN_CHANNEL: number

Property Value

number

Inherited From Lexer.DEFAULT_TOKEN_CHANNEL

EOF

static EOF: number

Property Value

number

Inherited From Recognizer.EOF

HIDDEN

static HIDDEN: number

Property Value

number

Inherited From Lexer.HIDDEN

inputStream

Set the char stream and reset the lexer

inputStream: CharStream

Property Value

CharStream

Inherited From Lexer.inputStream

interpreter

Set the ATN interpreter used by the recognizer for prediction.

interpreter: LexerATNSimulator

Property Value

LexerATNSimulator

Inherited From Recognizer.interpreter

line

line: number

Property Value

number

Inherited From Lexer.line

MAX_CHAR_VALUE

static MAX_CHAR_VALUE: number

Property Value

number

Inherited From Lexer.MAX_CHAR_VALUE

MIN_CHAR_VALUE

static MIN_CHAR_VALUE: number

Property Value

number

Inherited From Lexer.MIN_CHAR_VALUE

MORE

static MORE: number

Property Value

number

Inherited From Lexer.MORE

parseInfo

If profiling during the parse/lex, this will return DecisionInfo records for each decision in recognizer in a ParseInfo object.

parseInfo: Promise<ParseInfo | undefined>

Property Value

Promise<ParseInfo | undefined>

Inherited From Recognizer.parseInfo

SKIP

static SKIP: number

Property Value

number

Inherited From Lexer.SKIP

sourceName

sourceName: string

Property Value

string

Inherited From Lexer.sourceName

state

Indicate that the recognizer has changed internal state that is consistent with the ATN state passed in. This way we always know where we are in the ATN as the parser goes along. The rule context objects form a stack that lets us see the stack of invoking rules. Combine this and we have complete ATN configuration information.

state: number

Property Value

number

Inherited From Recognizer.state

text

Set the complete text of this token; it wipes any previous changes to the text.

text: string

Property Value

string

Inherited From Lexer.text

token

Override if emitting multiple tokens.

token: Token | undefined

Property Value

Token | undefined

Inherited From Lexer.token

tokenFactory

tokenFactory: TokenFactory

Property Value

TokenFactory

Inherited From Lexer.tokenFactory

type

type: number

Property Value

number

Inherited From Lexer.type

Method Details

action(RuleContext, number, number)

function action(_localctx: RuleContext, ruleIndex: number, actionIndex: number)

Parameters

_localctx

RuleContext

ruleIndex

number

actionIndex

number

sempred(RuleContext, number, number)

function sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean

Parameters

_localctx

RuleContext

ruleIndex

number

predIndex

number

Returns

boolean

Inherited Method Details

addErrorListener(ANTLRErrorListener<number>)

function addErrorListener(listener: ANTLRErrorListener<number>)

Parameters

listener

ANTLRErrorListener<number>

Inherited From Recognizer.addErrorListener

emit()

By default does not support multiple emits per nextToken invocation for efficiency reasons. Subclass and override this method, nextToken, and getToken (to push tokens into a list and pull from that list rather than a single variable as this implementation does).

function emit(): Token

Returns

Token

Inherited From Lexer.emit

emit(Token)

The standard method called to automatically emit a token at the outermost lexical rule. The token object should point into the char buffer start..stop. If there is a text override in 'text', use that to set the token's text. Override this method to emit custom Token objects or provide a new factory.

function emit(token: Token): Token

Parameters

token

Token

Returns

Token

Inherited From Lexer.emit

emitEOF()

function emitEOF(): Token

Returns

Token

Inherited From Lexer.emitEOF

getAllTokens()

Return a list of all Token objects in input char stream. Forces load of all tokens. Does not include EOF token.

function getAllTokens(): Token[]

Returns

Token[]

Inherited From Lexer.getAllTokens

getCharErrorDisplay(number)

function getCharErrorDisplay(c: number): string

Parameters

c

number

Returns

string

Inherited From Lexer.getCharErrorDisplay

getErrorDisplay(string | number)

function getErrorDisplay(s: string | number): string

Parameters

s

string | number

Returns

string

Inherited From Lexer.getErrorDisplay

getErrorHeader(RecognitionException)

What is the error header, normally line/character position information?

function getErrorHeader(e: RecognitionException): string

Parameters

e

RecognitionException

Returns

string

Inherited From Recognizer.getErrorHeader

getErrorListenerDispatch()

function getErrorListenerDispatch(): ANTLRErrorListener<number>

Returns

ANTLRErrorListener<number>

Inherited From Recognizer.getErrorListenerDispatch

getErrorListeners()

function getErrorListeners(): Array<ANTLRErrorListener<number>>

Returns

Array<ANTLRErrorListener<number>>

Inherited From Recognizer.getErrorListeners

getRuleIndexMap()

Get a map from rule names to rule indexes. Used for XPath and tree pattern compilation.

function getRuleIndexMap(): ReadonlyMap<string, number>

Returns

ReadonlyMap<string, number>

Inherited From Recognizer.getRuleIndexMap

getTokenType(string)

function getTokenType(tokenName: string): number

Parameters

tokenName

string

Returns

number

Inherited From Recognizer.getTokenType

getTokenTypeMap()

Get a map from token names to token types. Used for XPath and tree pattern compilation.

function getTokenTypeMap(): ReadonlyMap<string, number>

Returns

ReadonlyMap<string, number>

Inherited From Recognizer.getTokenTypeMap

mode(number)

function mode(m: number)

Parameters

m

number

Inherited From Lexer.mode

more()

function more()

Inherited From Lexer.more

nextToken()

Return a token from this source; i.e., match a token on the char stream.

function nextToken(): Token

Returns

Token

Inherited From Lexer.nextToken

notifyListeners(LexerNoViableAltException)

function notifyListeners(e: LexerNoViableAltException)

Parameters

e

LexerNoViableAltException

Inherited From Lexer.notifyListeners

popMode()

function popMode(): number

Returns

number

Inherited From Lexer.popMode

precpred(RuleContext | undefined, number)

function precpred(localctx: RuleContext | undefined, precedence: number): boolean

Parameters

localctx

RuleContext | undefined

precedence

number

Returns

boolean

Inherited From Recognizer.precpred

pushMode(number)

function pushMode(m: number)

Parameters

m

number

Inherited From Lexer.pushMode

recover(LexerNoViableAltException)

function recover(re: LexerNoViableAltException)

Parameters

re

LexerNoViableAltException

Inherited From Lexer.recover

recover(RecognitionException)

Lexers can normally match any char in it's vocabulary after matching a token, so do the easy thing and just kill a character and hope it all works out. You can instead use the rule invocation stack to do sophisticated error recovery if you are in a fragment rule.

function recover(re: RecognitionException)

Parameters

re

RecognitionException

Inherited From Lexer.recover

removeErrorListener(ANTLRErrorListener<number>)

function removeErrorListener(listener: ANTLRErrorListener<number>)

Parameters

listener

ANTLRErrorListener<number>

Inherited From Recognizer.removeErrorListener

removeErrorListeners()

function removeErrorListeners()

Inherited From Recognizer.removeErrorListeners

reset()

function reset()

Inherited From Lexer.reset

reset(boolean)

function reset(resetInput: boolean)

Parameters

resetInput

boolean

Inherited From Lexer.reset

skip()

Instruct the lexer to skip creating a token for current lexer rule and look for another token. nextToken() knows to keep looking when a lexer rule finishes with token set to SKIP_TOKEN. Recall that if token==undefined at end of any token rule, it creates one for you and emits it.

function skip()

Inherited From Lexer.skip