@brief Baseclass for generated lexer classes.
A lexer is recognizer that draws input symbols from a character
stream. lexer grammars result in a subclass of this object. A Lexer
object uses simplified match() and error recovery mechanisms in the
interest of speed.
|
__init__(self,
input,
state=None)
x.__init__(...) initializes x; see help(type(x)) for signature |
|
|
|
emit(self,
token=None)
The standard method called to automatically emit a token at the
outermost lexical rule. |
|
|
|
getCharErrorDisplay(self,
c) |
|
|
|
getCharIndex(self)
What is the index of the current character of lookahead? |
|
|
|
getCharPositionInLine(self) |
|
|
|
getErrorMessage(self,
e,
tokenNames)
What error message should be generated for the various exception
types? |
|
|
|
|
|
|
|
getText(self)
Return the text matched so far for the current token or any text
override. |
|
|
|
mTokens(self)
This is the lexer entry point that sets instance var 'token' |
|
|
|
match(self,
s)
Match current input symbol against ttype. |
|
|
|
matchAny(self)
Match the wildcard: in a symbol |
|
|
|
|
|
nextToken(self)
Return a token from this source; i.e., match a token on the char
stream. |
|
|
|
recover(self,
re)
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. |
|
|
|
|
|
reset(self)
reset the parser's state; subclasses must rewinds the input stream |
|
|
|
setCharStream(self,
input)
Set the char stream and reset the lexer |
|
|
|
setText(self,
text)
Set the complete text of this token; it wipes any previous changes to
the text. |
|
|
|
skip(self)
Instruct the lexer to skip creating a token for current lexer rule
and look for another token. |
|
|
|
|
|
|
Inherited from BaseRecognizer :
alreadyParsedRule ,
beginResync ,
combineFollows ,
computeContextSensitiveRuleFOLLOW ,
computeErrorRecoverySet ,
consumeUntil ,
displayRecognitionError ,
emitErrorMessage ,
endResync ,
failed ,
getBacktrackingLevel ,
getCurrentInputSymbol ,
getErrorHeader ,
getGrammarFileName ,
getMissingSymbol ,
getNumberOfSyntaxErrors ,
getRuleInvocationStack ,
getRuleMemoization ,
getTokenErrorDisplay ,
memoize ,
mismatchIsMissingToken ,
mismatchIsUnwantedToken ,
recoverFromMismatchedSet ,
recoverFromMismatchedToken ,
setBacktrackingLevel ,
setInput ,
toStrings
Inherited from TokenSource :
__iter__ ,
next
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|