BlockIt
blockit::external::pyparsing::ParserElement Class Reference
Inheritance diagram for blockit::external::pyparsing::ParserElement:
Collaboration diagram for blockit::external::pyparsing::ParserElement:

List of all members.

Public Member Functions

def setDefaultWhitespaceChars
def __init__
def copy
def setName
def setResultsName
def setBreak
def setParseAction
def addParseAction
def setFailAction
def preParse
def parseImpl
def postParse
def tryParse
def resetCache
def enablePackrat
def parseString
def scanString
def transformString
def searchString
def __add__
def __radd__
def __sub__
def __rsub__
def __mul__
def __rmul__
def __or__
def __ror__
def __xor__
def __rxor__
def __and__
def __rand__
def __invert__
def __call__
def suppress
def leaveWhitespace
def setWhitespaceChars
def parseWithTabs
def ignore
def setDebugActions
def setDebug
def __str__
def __repr__
def streamline
def checkRecursion
def validate
def parseFile
def getException
def __getattr__
def __eq__
def __ne__
def __hash__
def __req__
def __rne__

Public Attributes

 parseAction
 failAction
 strRepr
 resultsName
 saveAsList
 skipWhitespace
 whiteChars
 copyDefaultWhiteChars
 mayReturnEmpty
 keepTabs
 ignoreExprs
 debug
 streamlined
 mayIndexError
 errmsg
 modalResults
 debugActions
 re
 callPreparse
 callDuringTry
 name
 myException

Static Public Attributes

string DEFAULT_WHITE_CHARS = " \n\t\r"
tuple setDefaultWhitespaceChars = staticmethod(setDefaultWhitespaceChars)
tuple resetCache = staticmethod(resetCache)
tuple enablePackrat = staticmethod(enablePackrat)

Private Member Functions

def _normalizeParseActionArgs
def _skipIgnorables
def _parseNoCache
def _parseCache

Private Attributes

 __dict__

Static Private Attributes

tuple _normalizeParseActionArgs = staticmethod(_normalizeParseActionArgs)
 _parse = _parseNoCache
dictionary _exprArgCache = {}
 _packratEnabled = False

Detailed Description

Abstract base level parser element class.

Definition at line 666 of file pyparsing.py.


Constructor & Destructor Documentation


Member Function Documentation

def blockit::external::pyparsing::ParserElement::__add__ (   self,
  other 
)
Implementation of + operator - returns And

Definition at line 1153 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__and__ (   self,
  other 
)
Implementation of & operator - returns Each

Definition at line 1285 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__call__ (   self,
  name 
)
Shortcut for setResultsName, with listAllMatches=default::
     userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno")
   could be written as::
     userdata = Word(alphas)("name") + Word(nums+"-")("socsecno")
   

Definition at line 1309 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__eq__ (   self,
  other 
)

Definition at line 1420 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__getattr__ (   self,
  aname 
)

Definition at line 1413 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__hash__ (   self)

Definition at line 1435 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__invert__ (   self)
Implementation of ~ operator - returns NotAny

Definition at line 1305 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__mul__ (   self,
  other 
)

Definition at line 1193 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__ne__ (   self,
  other 
)

Definition at line 1432 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__or__ (   self,
  other 
)
Implementation of | operator - returns MatchFirst

Definition at line 1245 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__radd__ (   self,
  other 
)
Implementation of + operator when left operand is not a ParserElement

Definition at line 1163 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__rand__ (   self,
  other 
)
Implementation of & operator when left operand is not a ParserElement

Definition at line 1295 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__repr__ (   self)

Definition at line 1378 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__req__ (   self,
  other 
)

Definition at line 1438 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__rmul__ (   self,
  other 
)

Definition at line 1242 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__rne__ (   self,
  other 
)

Definition at line 1441 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__ror__ (   self,
  other 
)
Implementation of | operator when left operand is not a ParserElement

Definition at line 1255 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__rsub__ (   self,
  other 
)
Implementation of - operator when left operand is not a ParserElement

Definition at line 1183 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__rxor__ (   self,
  other 
)
Implementation of ^ operator when left operand is not a ParserElement

Definition at line 1275 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__sub__ (   self,
  other 
)
Implementation of - operator, returns And with error stop

Definition at line 1173 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::__xor__ (   self,
  other 
)
Implementation of ^ operator - returns Or

Definition at line 1265 of file pyparsing.py.

Internal method used to decorate parse actions that take fewer than 3 arguments,
   so that all parse actions can be called as f(s,l,t).

Definition at line 747 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::_parseCache (   self,
  instring,
  loc,
  doActions = True,
  callPreParse = True 
) [private]

Definition at line 993 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::_parseNoCache (   self,
  instring,
  loc,
  doActions = True,
  callPreParse = True 
) [private]

Definition at line 913 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::_skipIgnorables (   self,
  instring,
  loc 
) [private]

Definition at line 881 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::addParseAction (   self,
  fns,
  kwargs 
)
Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.

Definition at line 862 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::checkRecursion (   self,
  parseElementList 
)
def blockit::external::pyparsing::ParserElement::copy (   self)
Make a copy of this ParserElement.  Useful for defining different parse actions
   for the same parsing pattern, using copies of the original parse element.

Reimplemented in blockit::external::pyparsing::Keyword, and blockit::external::pyparsing::Forward.

Definition at line 699 of file pyparsing.py.

Enables "packrat" parsing, which adds memoizing to the parsing logic.
   Repeated parse attempts at the same string location (which happens
   often in many complex grammars) can immediately return a cached value,
   instead of re-executing parsing/validating code.  Memoizing is done of
   both valid results and parsing exceptions.

   This speedup may break existing programs that use parse actions that
   have side-effects.  For this reason, packrat parsing is disabled when
   you first import pyparsing.  To activate the packrat feature, your
   program must call the class method ParserElement.enablePackrat().  If
   your program uses psyco to "compile as you go", you must call
   enablePackrat before calling psyco.full().  If you do not do this,
   Python will crash.  For best results, call enablePackrat() immediately
   after importing pyparsing.

Definition at line 1018 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::getException (   self)

Definition at line 1410 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::ignore (   self,
  other 
)
Define expression to be ignored (e.g., comments) while doing pattern
   matching; may be called repeatedly, to define multiple comment or other
   ignorable patterns.

Reimplemented in blockit::external::pyparsing::ParseExpression, blockit::external::pyparsing::ParseElementEnhance, and blockit::external::pyparsing::Combine.

Definition at line 1346 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::leaveWhitespace (   self)
Disables the skipping of whitespace before matching the characters in the
   ParserElement's defined pattern.  This is normally only used internally by
   the pyparsing module, but may be needed in some whitespace-sensitive grammars.

Reimplemented in blockit::external::pyparsing::ParseExpression, blockit::external::pyparsing::ParseElementEnhance, and blockit::external::pyparsing::Forward.

Definition at line 1323 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::parseFile (   self,
  file_or_filename,
  parseAll = False 
)
Execute the parse expression on the given file or filename.
   If a filename is specified (instead of a file object),
   the entire file is opened, read, and closed before parsing.

Definition at line 1393 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::parseString (   self,
  instring,
  parseAll = False 
)
Execute the parse expression with the given string.
   This is the main interface to the client code, once the complete
   expression has been built.

   If you want the grammar to require that the entire input string be
   successfully parsed, then set parseAll to True (equivalent to ending
   the grammar with StringEnd()).

   Note: parseString implicitly calls expandtabs() on the input string,
   in order to report proper column numbers in parse actions.
   If the input string contains tabs and
   the grammar uses parse actions that use the loc argument to index into the
   string being parsed, you can ensure you have a consistent view of the input
   string by:
    - calling parseWithTabs on your grammar before calling parseString
      (see L{I{parseWithTabs}<parseWithTabs>})
    - define your parse action using the full (s,loc,toks) signature, and
      reference the input string using the parse action's s argument
    - explictly expand the tabs in your input string before calling
      parseString

Definition at line 1039 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::parseWithTabs (   self)
Overrides default behavior to expand <TAB>s to spaces before parsing the input string.
   Must be called before parseString when the input grammar contains elements that
   match <TAB> characters.

Definition at line 1339 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::postParse (   self,
  instring,
  loc,
  tokenlist 
)
def blockit::external::pyparsing::ParserElement::preParse (   self,
  instring,
  loc 
)
def blockit::external::pyparsing::ParserElement::scanString (   self,
  instring,
  maxMatches = _MAX_INT 
)
Scan the input string for expression matches.  Each match will return the
   matching tokens, start location, and end location.  May be called with optional
   maxMatches argument, to clip scanning after 'n' matches are found.

   Note that the start and end locations are reported relative to the string
   being parsed.  See L{I{parseString}<parseString>} for more information on parsing
   strings with embedded tabs.

Definition at line 1080 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::searchString (   self,
  instring,
  maxMatches = _MAX_INT 
)
Another extension to scanString, simplifying the access to the tokens found
   to match the given parse expression.  May be called with optional
   maxMatches argument, to clip searching after 'n' matches are found.

Definition at line 1143 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::setBreak (   self,
  breakFlag = True 
)
Method to invoke the Python pdb debugger when this element is
   about to be parsed. Set breakFlag to True to enable, False to
   disable.

Definition at line 729 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::setDebug (   self,
  flag = True 
)
Enable display of debugging messages while doing pattern matching.
   Set flag to True to enable, False to disable.

Definition at line 1366 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::setDebugActions (   self,
  startAction,
  successAction,
  exceptionAction 
)
Enable display of debugging messages while doing pattern matching.

Definition at line 1358 of file pyparsing.py.

Overrides the default whitespace chars

Definition at line 670 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::setFailAction (   self,
  fn 
)
Define action to perform if parsing fails at this expression.
   Fail acton fn is a callable function that takes the arguments
   fn(s,loc,expr,err) where:
    - s = string being parsed
    - loc = location where expression match was attempted and failed
    - expr = the parse expression that failed
    - err = the exception thrown
   The function returns no value.  It may throw ParseFatalException
   if it is desired to stop parsing immediately.

Definition at line 868 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::setName (   self,
  name 
)
Define name for this expression, for use in debugging.

Reimplemented in blockit::external::pyparsing::Token.

Definition at line 709 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::setParseAction (   self,
  fns,
  kwargs 
)
Define action to perform when successfully matching parse element definition.
   Parse action fn is a callable method with 0-3 arguments, called as fn(s,loc,toks),
   fn(loc,toks), fn(toks), or just fn(), where:
    - s   = the original string being parsed (see note below)
    - loc = the location of the matching substring
    - toks = a list of the matched tokens, packaged as a ParseResults object
   If the functions in fns modify the tokens, they can return them as the return
   value from fn, and the modified list of tokens will replace the original.
   Otherwise, fn does not need to return any value.

   Note: the default parsing behavior is to expand tabs in the input string
   before starting the parsing process.  See L{I{parseString}<parseString>} for more information
   on parsing strings containing <TAB>s, and suggested methods to maintain a
   consistent view of the parsed string, the parse location, and line and column
   positions within the parsed string.
   

Definition at line 841 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::setResultsName (   self,
  name,
  listAllMatches = False 
)
Define name for referencing matching tokens as a nested attribute
   of the returned parse results.
   NOTE: this returns a *copy* of the original ParserElement object;
   this is so that the client can define a basic element, such as an
   integer, and reference it in multiple places with different names.

Reimplemented in blockit::external::pyparsing::ParseExpression, blockit::external::pyparsing::ZeroOrMore, and blockit::external::pyparsing::OneOrMore.

Definition at line 717 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::setWhitespaceChars (   self,
  chars 
)
Overrides the default whitespace chars

Definition at line 1331 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::streamline (   self)
def blockit::external::pyparsing::ParserElement::suppress (   self)
Suppresses the output of this ParserElement; useful to keep punctuation from
   cluttering up returned output.

Reimplemented in blockit::external::pyparsing::Suppress.

Definition at line 1317 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::transformString (   self,
  instring 
)
Extension to scanString, to modify matching text with modified tokens that may
   be returned from a parse action.  To use transformString, define a grammar and
   attach a parse action to it that modifies the returned token list.
   Invoking transformString() on a target string will then scan for matches,
   and replace the matched text patterns according to the logic in the parse
   action.  transformString() returns the resulting transformed string.

Definition at line 1115 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::tryParse (   self,
  instring,
  loc 
)

Definition at line 985 of file pyparsing.py.

def blockit::external::pyparsing::ParserElement::validate (   self,
  validateTrace = [] 
)
Check defined expressions for valid structure, check for infinite recursive definitions.

Reimplemented in blockit::external::pyparsing::ParseExpression, blockit::external::pyparsing::ParseElementEnhance, and blockit::external::pyparsing::Forward.

Definition at line 1389 of file pyparsing.py.


Member Data Documentation

Definition at line 1012 of file pyparsing.py.

Definition at line 1017 of file pyparsing.py.

blockit::external::pyparsing::ParserElement::_parse = _parseNoCache [static, private]

Definition at line 1009 of file pyparsing.py.

Definition at line 668 of file pyparsing.py.

Definition at line 1037 of file pyparsing.py.

Definition at line 1015 of file pyparsing.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Properties