LGFileLexer class
- Extends
-
Lexer
Constructors
LGFile |
Properties
Inherited Properties
atn | Get the serializedATN used by the recognizer for prediction. |
channel | |
char |
What is the index of the current character of lookahead? |
char |
|
DEFAULT_MODE | |
DEFAULT_TOKEN_CHANNEL | |
EOF | |
HIDDEN | |
input |
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 | |
parse |
If profiling during the parse/lex, this will return DecisionInfo records for each decision in recognizer in a ParseInfo object. |
SKIP | |
source |
|
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. |
token |
|
type |
Methods
action(Rule |
|
sempred(Rule |
Inherited Methods
add |
|
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() | |
get |
Return a list of all Token objects in input char stream. Forces load of all tokens. Does not include EOF token. |
get |
|
get |
|
get |
What is the error header, normally line/character position information? |
get |
|
get |
|
get |
Get a map from rule names to rule indexes. Used for XPath and tree pattern compilation. |
get |
|
get |
Get a map from token names to token types. Used for XPath and tree pattern compilation. |
mode(number) | |
more() | |
next |
Return a token from this source; i.e., match a token on the char stream. |
notify |
|
pop |
|
precpred(Rule |
|
push |
|
recover(Lexer |
|
recover(Recognition |
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. |
remove |
|
remove |
|
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
LGFileLexer(CharStream)
new LGFileLexer(input: CharStream)
Parameters
- input
-
CharStream
Property Details
channelNames
public static channelNames: string[] = [
"DEFAULT_TOKEN_CHANNEL", "HIDDEN",
]
Property Value
string[]
channelNames
string[] channelNames
Property Value
string[]
COMMENT
public static COMMENT: 3 = 3
Property Value
3
ESCAPE_CHARACTER
public static ESCAPE_CHARACTER: 11 = 11
Property Value
11
grammarFileName
string grammarFileName
Property Value
string
IMPORT
public static IMPORT: 4 = 4
Property Value
4
INLINE_MULTILINE
public static INLINE_MULTILINE: 6 = 6
Property Value
6
INVALID_LINE
public static INVALID_LINE: 9 = 9
Property Value
9
modeNames
public static modeNames: string[] = [
"DEFAULT_MODE", "MULTILINE_MODE",
]
Property Value
string[]
modeNames
string[] modeNames
Property Value
string[]
MULTILINE_MODE
public static MULTILINE_MODE: 1 = 1
Property Value
1
MULTILINE_PREFIX
public static MULTILINE_PREFIX: 7 = 7
Property Value
7
MULTILINE_SUFFIX
public static MULTILINE_SUFFIX: 10 = 10
Property Value
10
MULTILINE_TEXT
public static MULTILINE_TEXT: 12 = 12
Property Value
12
NEWLINE
public static NEWLINE: 1 = 1
Property Value
1
OPTION
public static OPTION: 2 = 2
Property Value
2
ruleNames
public static ruleNames: string[] = [
"WHITESPACE", "NEWLINE", "OPTION", "COMMENT", "IMPORT", "TEMPLATE_NAME_LINE",
"INLINE_MULTILINE", "MULTILINE_PREFIX", "TEMPLATE_BODY", "INVALID_LINE",
"MULTILINE_SUFFIX", "ESCAPE_CHARACTER", "MULTILINE_TEXT",
]
Property Value
string[]
ruleNames
string[] ruleNames
Property Value
string[]
serializedATN
string serializedATN
Property Value
string
startTemplate
startTemplate: boolean = false
Property Value
boolean
TEMPLATE_BODY
public static TEMPLATE_BODY: 8 = 8
Property Value
8
TEMPLATE_NAME_LINE
public static TEMPLATE_NAME_LINE: 5 = 5
Property Value
5
VOCABULARY
public static VOCABULARY: Vocabulary = new VocabularyImpl(LGFileLexer._LITERAL_NAMES, LGFileLexer._SYMBOLIC_NAMES, [])
Property Value
Vocabulary
vocabulary
Vocabulary vocabulary
Property Value
Vocabulary
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