Public Member Functions | Public Attributes | Properties
rve_interface_gen.antlr3.recognizers.Lexer Class Reference
Inheritance diagram for rve_interface_gen.antlr3.recognizers.Lexer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def emit
def getCharErrorDisplay
def getCharIndex
def getCharPositionInLine
def getErrorMessage
def getLine
def getSourceName
def getText
def match
def matchAny
def matchRange
def mTokens
def nextToken
def recover
def reportError
def reset
def setCharStream
def setText
def skip
def traceIn
def traceOut

Public Attributes

 input

Properties

 text = property(getText, setText)

Detailed Description

@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.

Definition at line 1061 of file recognizers.py.


Constructor & Destructor Documentation

def rve_interface_gen.antlr3.recognizers.Lexer.__init__ (   self,
  input,
  state = None 
)

Reimplemented in rve_interface_gen.InterfaceLexer.InterfaceLexer.

Definition at line 1071 of file recognizers.py.


Member Function Documentation

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.

If you are building trees, then you should also override
Parser or TreeParser.getMissingSymbol().

Definition at line 1166 of file recognizers.py.

Definition at line 1332 of file recognizers.py.

What is the index of the current character of lookahead?

Definition at line 1244 of file recognizers.py.

Definition at line 1240 of file recognizers.py.

def rve_interface_gen.antlr3.recognizers.Lexer.getErrorMessage (   self,
  e,
  tokenNames 
)
What error message should be generated for the various
exception types?

Not very object-oriented code, but I like having all error message
generation within one method rather than spread among all of the
exception classes. This also makes it much easier for the exception
handling because the exception classes do not have to have pointers back
to this object to access utility routines and so on. Also, changing
the message for an exception type would be difficult because you
would have to subclassing exception, but then somehow get ANTLR
to make those kinds of exception objects instead of the default.
This looks weird, but trust me--it makes the most sense in terms
of flexibility.

For grammar debugging, you will want to override this to add
more information such as the stack frame with
getRuleInvocationStack(e, this.getClass().getName()) and,
for no viable alts, the decision description and state etc...

Override this to change the message generated for one or more
exception types.

Reimplemented from rve_interface_gen.antlr3.recognizers.BaseRecognizer.

Definition at line 1289 of file recognizers.py.

Definition at line 1236 of file recognizers.py.

Definition at line 1162 of file recognizers.py.

Return the text matched so far for the current token or any
text override.

Definition at line 1250 of file recognizers.py.

Definition at line 1195 of file recognizers.py.

Definition at line 1220 of file recognizers.py.

Definition at line 1224 of file recognizers.py.

This is the lexer entry point that sets instance var 'token'

Reimplemented in rve_interface_gen.InterfaceLexer.InterfaceLexer.

Definition at line 1148 of file recognizers.py.

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

Reimplemented from rve_interface_gen.antlr3.recognizers.TokenSource.

Definition at line 1100 of file recognizers.py.

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.

Definition at line 1338 of file recognizers.py.

Report a recognition problem.
    
This method sets errorRecovery to indicate the parser is recovering
not parsing.  Once in recovery mode, no errors are generated.
To get out of recovery mode, the parser must successfully match
a token (after a resync).  So it will go:

1. error occurs
2. enter recovery mode, report error
3. consume until token found in resynch set
4. try to resume parsing
5. next match() will reset errorRecovery mode

If you override, make sure to update syntaxErrors if you care about
that.

Reimplemented from rve_interface_gen.antlr3.recognizers.BaseRecognizer.

Definition at line 1275 of file recognizers.py.

reset the parser's state; subclasses must rewinds the input stream

Reimplemented from rve_interface_gen.antlr3.recognizers.BaseRecognizer.

Definition at line 1079 of file recognizers.py.

Set the char stream and reset the lexer

Definition at line 1155 of file recognizers.py.

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

Definition at line 1264 of file recognizers.py.

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==null at end of any token rule, it creates one for you
and emits it.

Definition at line 1136 of file recognizers.py.

def rve_interface_gen.antlr3.recognizers.Lexer.traceIn (   self,
  ruleName,
  ruleIndex 
)

Definition at line 1349 of file recognizers.py.

def rve_interface_gen.antlr3.recognizers.Lexer.traceOut (   self,
  ruleName,
  ruleIndex 
)

Definition at line 1358 of file recognizers.py.


Member Data Documentation

Reimplemented from rve_interface_gen.antlr3.recognizers.BaseRecognizer.

Definition at line 1071 of file recognizers.py.


Property Documentation

Definition at line 1272 of file recognizers.py.


The documentation for this class was generated from the following file:


rve_interface_gen
Author(s): Josh Faust
autogenerated on Wed Dec 11 2013 14:31:00