Classes | Functions | Variables
rve_interface_gen::antlr3::recognizers Namespace Reference

Classes

class  BaseRecognizer
class  Lexer
class  Parser
class  ParserRuleReturnScope
class  RecognizerSharedState
class  RuleReturnScope
class  TokenSource

Functions

def _getRuleInvocationStack
def alreadyParsedRule
def consumeUntil
 def recoverFromMissingElement(self, input, e, follow): """ This code is factored out from mismatched token and mismatched set recovery.
def failed
def getBacktrackingLevel
def getGrammarFileName
def getRuleInvocationStack
def getRuleMemoization
def getSourceName
def memoize
def setBacktrackingLevel
def toStrings
def traceIn
def traceOut

Variables

tuple _getRuleInvocationStack = classmethod(_getRuleInvocationStack)

Detailed Description

ANTLR3 runtime package

Function Documentation

def rve_interface_gen.antlr3.recognizers._getRuleInvocationStack (   cls,
  module 
) [private]
A more general version of getRuleInvocationStack where you can
pass in, for example, a RecognitionException to get it's rule
stack trace.  This routine is shared with all recognizers, hence,
static.

TODO: move to a utility class or something; weird having lexer call
this

Definition at line 853 of file recognizers.py.

def rve_interface_gen.antlr3.recognizers.alreadyParsedRule (   self,
  input,
  ruleIndex 
)
Has this rule already parsed input at the current index in the
input stream?  Return the stop token index or MEMO_RULE_UNKNOWN.
If we attempted but failed to parse properly before, return
MEMO_RULE_FAILED.

This method has a side-effect: if we have seen this input for
this rule and successfully parsed before, then seek ahead to
1 past the stop token matched for this rule last time.

Definition at line 945 of file recognizers.py.

def rve_interface_gen.antlr3.recognizers.consumeUntil (   self,
  input,
  tokenTypes 
)

def recoverFromMissingElement(self, input, e, follow): """ This code is factored out from mismatched token and mismatched set recovery.

It handles "single token insertion" error recovery for both. No tokens are consumed to recover from insertions. Return true if recovery was possible else return false. """ if self.mismatchIsMissingToken(input, follow): self.reportError(e) return True # nothing to do; throw exception return False

Consume tokens until one matches the given token or token set

tokenTypes can be a single token type or a set of token types

Definition at line 811 of file recognizers.py.

Return whether or not a backtracking attempt failed.

Definition at line 897 of file recognizers.py.

Definition at line 890 of file recognizers.py.

For debugging and other purposes, might want the grammar name.

Have ANTLR generate an implementation for this method.

Definition at line 903 of file recognizers.py.

Return List<String> of the rules in your parser instance
leading up to a call to this method.  You could override if
you want more details such as the file/line info of where
in the parser java code a rule is invoked.

This is very useful for error messages and for context-sensitive
error recovery.

You must be careful, if you subclass a generated recognizers.
The default implementation will only search the module of self
for rules, but the subclass will not contain any rules.
You probably want to override this method to look like

def getRuleInvocationStack(self):
    return self._getRuleInvocationStack(<class>.__module__)

where <class> is the class of the generated recognizer, e.g.
the superclass of self.

Definition at line 828 of file recognizers.py.

def rve_interface_gen.antlr3.recognizers.getRuleMemoization (   self,
  ruleIndex,
  ruleStartIndex 
)
Given a rule number and a start token index number, return
MEMO_RULE_UNKNOWN if the rule has not parsed input starting from
start index.  If this rule has parsed input starting from the
start index before, then return where the rule stopped parsing.
It returns the index of the last token matched by the rule.

Definition at line 928 of file recognizers.py.

Definition at line 912 of file recognizers.py.

def rve_interface_gen.antlr3.recognizers.memoize (   self,
  input,
  ruleIndex,
  ruleStartIndex,
  success 
)
Record whether or not this rule parsed the input at this position
successfully.

Definition at line 970 of file recognizers.py.

Definition at line 893 of file recognizers.py.

def rve_interface_gen.antlr3.recognizers.toStrings (   self,
  tokens 
)
A convenience method for use most often with template rewrites.

Convert a List<Token> to List<String>

Definition at line 916 of file recognizers.py.

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

Definition at line 985 of file recognizers.py.

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

Definition at line 994 of file recognizers.py.


Variable Documentation

Definition at line 887 of file recognizers.py.



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