BlockIt
blockit::external::pyparsing Namespace Reference

Classes

class  _Constants
class  ParseBaseException
class  ParseException
class  ParseFatalException
class  ParseSyntaxException
class  RecursiveGrammarException
class  _ParseResultsWithOffset
class  ParseResults
class  ParserElement
class  Token
class  Empty
class  NoMatch
class  Literal
class  Keyword
class  CaselessLiteral
class  CaselessKeyword
class  Word
class  Regex
class  QuotedString
class  CharsNotIn
class  White
class  _PositionToken
class  GoToColumn
class  LineStart
class  LineEnd
class  StringStart
class  StringEnd
class  WordStart
class  WordEnd
class  ParseExpression
class  And
class  Or
class  MatchFirst
class  Each
class  ParseElementEnhance
class  FollowedBy
class  NotAny
class  ZeroOrMore
class  OneOrMore
class  _NullToken
class  Optional
class  SkipTo
class  Forward
class  _ForwardNoRecurse
class  TokenConverter
class  Upcase
class  Combine
class  Group
class  Dict
class  Suppress
class  OnlyOnce

Functions

def _ustr
def _str2dict
def _xml_escape
def col
def lineno
def line
def _defaultStartDebugAction
def _defaultSuccessDebugAction
def _defaultExceptionDebugAction
def nullDebugAction
def traceParseAction
def delimitedList
def countedArray
def _flatten
def matchPreviousLiteral
def matchPreviousExpr
def _escapeRegexRangeChars
def oneOf
def dictOf
def originalTextFor
def srange
def matchOnlyAtCol
def replaceWith
def removeQuotes
def upcaseTokens
def downcaseTokens
def keepOriginalText
def getTokensEndLoc
def _makeTags
def makeHTMLTags
def makeXMLTags
def withAttribute
def operatorPrecedence

Variables

 __doc__ = \
string __version__ = "1.5.2"
string __versionTime__ = "17 February 2009 19:45"
string __author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
list __all__
 _PY3K = True
 _MAX_INT = sys.maxsize
 basestring = str
 _ustr = str
 unichr = chr
 _str2dict = set
 alphas = string.lowercase+string.uppercase
 nums = string.digits
string hexnums = "ABCDEFabcdef"
 alphanums = alphas+nums
tuple _bslash = chr(92)
string printables = ""
 _L = Literal
tuple _optionalNotMatched = _NullToken()
tuple empty = Empty()
tuple lineStart = LineStart()
tuple lineEnd = LineEnd()
tuple stringStart = StringStart()
tuple stringEnd = StringEnd()
tuple _escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 )
string _printables_less_backslash = ""
tuple _escapedHexChar = Combine( Suppress(_bslash + "0x") + Word(hexnums) )
tuple _escapedOctChar = Combine( Suppress(_bslash) + Word("0","01234567") )
tuple _singleChar = _escapedPunc|_escapedHexChar|_escapedOctChar|Word(_printables_less_backslash,exact=1)
tuple _charRange = Group(_singleChar + Suppress("-") + _singleChar)
tuple _reBracketExpr = Literal("[")
tuple _expanded = lambdap:(isinstance(p,ParseResults) and ''.join([ unichr(c) for c in range(ord(p[0]),ord(p[1])+1) ]) or p)
tuple opAssoc = _Constants()
tuple dblQuotedString = Regex(r'"(?:[^"\n\r\\]|(?:"")|(?:\\x[0-9a-fA-F]+)|(?:\\.))

Function Documentation

def blockit::external::pyparsing::_defaultExceptionDebugAction (   instring,
  loc,
  expr,
  exc 
) [private]

Definition at line 659 of file pyparsing.py.

def blockit::external::pyparsing::_defaultStartDebugAction (   instring,
  loc,
  expr 
) [private]

Definition at line 653 of file pyparsing.py.

def blockit::external::pyparsing::_defaultSuccessDebugAction (   instring,
  startloc,
  endloc,
  expr,
  toks 
) [private]

Definition at line 656 of file pyparsing.py.

def blockit::external::pyparsing::_escapeRegexRangeChars (   s) [private]

Definition at line 3189 of file pyparsing.py.

def blockit::external::pyparsing::_flatten (   L) [private]

Definition at line 3132 of file pyparsing.py.

def blockit::external::pyparsing::_makeTags (   tagStr,
  xml 
) [private]
Internal helper to construct opening and closing tag expressions, given a tag name

Definition at line 3390 of file pyparsing.py.

def blockit::external::pyparsing::_str2dict (   strg) [private]

Definition at line 139 of file pyparsing.py.

def blockit::external::pyparsing::_ustr (   obj) [private]
Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries
   str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It
   then < returns the unicode object | encodes it with the default encoding | ... >.

Definition at line 108 of file pyparsing.py.

def blockit::external::pyparsing::_xml_escape (   data) [private]
Escape &, <, >, ", ', etc. in a string of data.

Definition at line 144 of file pyparsing.py.

def blockit::external::pyparsing::col (   loc,
  strg 
)
Returns current column within a string, counting newlines as line separators.
   The first column is number 1.

   Note: the default parsing behavior is to expand tabs in the input string
   before starting the parsing process.  See L{I{ParserElement.parseString}<ParserElement.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 619 of file pyparsing.py.

def blockit::external::pyparsing::countedArray (   expr)
Helper to define a counted list of expressions.
   This helper defines a pattern of the form::
       integer expr expr expr...
   where the leading integer tells how many expr expressions follow.
   The matched tokens returns the array of expr tokens as a list - the leading count token is suppressed.

Definition at line 3118 of file pyparsing.py.

def blockit::external::pyparsing::delimitedList (   expr,
  delim = ",
  combine = False 
)
Helper to define a delimited list of expressions - the delimiter defaults to ','.
   By default, the list elements and delimiters can have intervening whitespace, and
   comments, but this can be overridden by passing 'combine=True' in the constructor.
   If combine is set to True, the matching tokens are returned as a single token
   string, with the delimiters included; otherwise, the matching tokens are returned
   as a list of tokens, with the delimiters suppressed.

Definition at line 3104 of file pyparsing.py.

def blockit::external::pyparsing::dictOf (   key,
  value 
)
Helper to easily and clearly define a dictionary by specifying the respective patterns
   for the key and value.  Takes care of defining the Dict, ZeroOrMore, and Group tokens
   in the proper order.  The key pattern can include delimiting markers or punctuation,
   as long as they are suppressed, thereby leaving the significant key text.  The value
   pattern can include named results, so that the Dict results can include named token
   fields.

Definition at line 3256 of file pyparsing.py.

def blockit::external::pyparsing::downcaseTokens (   s,
  l,
  t 
)
Helper parse action to convert tokens to lower case.

Definition at line 3359 of file pyparsing.py.

def blockit::external::pyparsing::getTokensEndLoc ( )
Method to be called from within a parse action to determine the end
   location of the parsed tokens.

Definition at line 3374 of file pyparsing.py.

def blockit::external::pyparsing::keepOriginalText (   s,
  startLoc,
  t 
)
Helper parse action to preserve original parsed text,
   overriding any nested parse actions.

Definition at line 3363 of file pyparsing.py.

def blockit::external::pyparsing::line (   loc,
  strg 
)
Returns the line of text containing loc within a string, counting newlines as line separators.
   

Definition at line 643 of file pyparsing.py.

def blockit::external::pyparsing::lineno (   loc,
  strg 
)
Returns current line number within a string, counting newlines as line separators.
   The first line is number 1.

   Note: the default parsing behavior is to expand tabs in the input string
   before starting the parsing process.  See L{I{ParserElement.parseString}<ParserElement.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 631 of file pyparsing.py.

def blockit::external::pyparsing::makeHTMLTags (   tagStr)
Helper to construct opening and closing tag expressions for HTML, given a tag name

Definition at line 3418 of file pyparsing.py.

def blockit::external::pyparsing::makeXMLTags (   tagStr)
Helper to construct opening and closing tag expressions for XML, given a tag name

Definition at line 3422 of file pyparsing.py.

def blockit::external::pyparsing::matchOnlyAtCol (   n)
Helper method for defining parse actions that require matching at a specific
   column in the input text.

Definition at line 3331 of file pyparsing.py.

def blockit::external::pyparsing::matchPreviousExpr (   expr)
Helper to define an expression that is indirectly defined from
   the tokens matched in a previous expression, that is, it looks
   for a 'repeat' of a previous expression.  For example::
       first = Word(nums)
       second = matchPreviousExpr(first)
       matchExpr = first + ":" + second
   will match "1:1", but not "1:2".  Because this matches by
   expressions, will *not* match the leading "1:1" in "1:10";
   the expressions are evaluated first, and then compared, so
   "1" is compared with "10".
   Do *not* use with packrat parsing enabled.

Definition at line 3163 of file pyparsing.py.

def blockit::external::pyparsing::matchPreviousLiteral (   expr)
Helper to define an expression that is indirectly defined from
   the tokens matched in a previous expression, that is, it looks
   for a 'repeat' of a previous expression.  For example::
       first = Word(nums)
       second = matchPreviousLiteral(first)
       matchExpr = first + ":" + second
   will match "1:1", but not "1:2".  Because this matches a
   previous literal, will also match the leading "1:1" in "1:10".
   If this is not desired, use matchPreviousExpr.
   Do *not* use with packrat parsing enabled.

Definition at line 3137 of file pyparsing.py.

def blockit::external::pyparsing::nullDebugAction (   args)
'Do-nothing' debug action, to suppress debugging output during parsing.

Definition at line 662 of file pyparsing.py.

def blockit::external::pyparsing::oneOf (   strs,
  caseless = False,
  useRegex = True 
)
Helper to quickly define a set of alternative Literals, and makes sure to do
   longest-first testing when there is a conflict, regardless of the input order,
   but returns a MatchFirst for best performance.

   Parameters:
    - strs - a string of space-delimited literals, or a list of string literals
    - caseless - (default=False) - treat all literals as caseless
    - useRegex - (default=True) - as an optimization, will generate a Regex
      object; otherwise, will generate a MatchFirst object (if caseless=True, or
      if creating a Regex raises an exception)

Definition at line 3197 of file pyparsing.py.

def blockit::external::pyparsing::operatorPrecedence (   baseExpr,
  opList 
)
Helper method for constructing grammars of expressions made up of
   operators working in a precedence hierarchy.  Operators may be unary or
   binary, left- or right-associative.  Parse actions can also be attached
   to operator expressions.

   Parameters:
    - baseExpr - expression representing the most basic element for the nested
    - opList - list of tuples, one for each operator precedence level in the
      expression grammar; each tuple is of the form
      (opExpr, numTerms, rightLeftAssoc, parseAction), where:
       - opExpr is the pyparsing expression for the operator;
          may also be a string, which will be converted to a Literal;
          if numTerms is 3, opExpr is a tuple of two expressions, for the
          two operators separating the 3 terms
       - numTerms is the number of terms for this operator (must
          be 1, 2, or 3)
       - rightLeftAssoc is the indicator whether the operator is
          right or left associative, using the pyparsing-defined
          constants opAssoc.RIGHT and opAssoc.LEFT.
       - parseAction is the parse action to be associated with
          expressions matching this operator expression (the
          parse action tuple member may be omitted)

Definition at line 3461 of file pyparsing.py.

def blockit::external::pyparsing::originalTextFor (   expr,
  asString = True 
)
Helper to return the original, untokenized text for a given expression.  Useful to
   restore the parsed fields of an HTML start tag into the raw tag text itself, or to
   revert separate tokens with intervening whitespace back to the original matching
   input text. Simpler to use than the parse action keepOriginalText, and does not
   require the inspect module to chase up the call stack.  By default, returns a 
   string containing the original parsed text.  
   
   If the optional asString argument is passed as False, then the return value is a 
   ParseResults containing any results names that were originally matched, and a 
   single token containing the original matched text from the input string.  So if 
   the expression passed to originalTextFor contains expressions with defined
   results names, you must set asString to False if you want to preserve those
   results name values.

Definition at line 3266 of file pyparsing.py.

def blockit::external::pyparsing::removeQuotes (   s,
  l,
  t 
)
Helper parse action for removing quotation marks from parsed quoted strings.
   To use, add this parse action to quoted string using::
     quotedString.setParseAction( removeQuotes )

Definition at line 3348 of file pyparsing.py.

def blockit::external::pyparsing::replaceWith (   replStr)
Helper method for common parse actions that simply return a literal value.  Especially
   useful when used with transformString().

Definition at line 3340 of file pyparsing.py.

def blockit::external::pyparsing::srange (   s)

Definition at line 3310 of file pyparsing.py.

def blockit::external::pyparsing::traceParseAction (   f)
Decorator for debugging parse actions.

Definition at line 3079 of file pyparsing.py.

def blockit::external::pyparsing::upcaseTokens (   s,
  l,
  t 
)
Helper parse action to convert tokens to upper case.

Definition at line 3355 of file pyparsing.py.

def blockit::external::pyparsing::withAttribute (   args,
  attrDict 
)
Helper to create a validating parse action to be used with start tags created
   with makeXMLTags or makeHTMLTags. Use withAttribute to qualify a starting tag
   with a required attribute value, to avoid false matches on common tags such as
   <TD> or <DIV>.

   Call withAttribute with a series of attribute names and values. Specify the list
   of filter attributes names and values as:
    - keyword arguments, as in (class="Customer",align="right"), or
    - a list of name-value tuples, as in ( ("ns1:class", "Customer"), ("ns2:align","right") )
   For attribute names with a namespace prefix, you must use the second form.  Attribute
   names are matched insensitive to upper/lower case.

   To verify that the attribute exists, but without specifying a value, pass
   withAttribute.ANY_VALUE as the value.
   

Definition at line 3426 of file pyparsing.py.


Variable Documentation

Initial value:
00001 [
00002 'And', 'CaselessKeyword', 'CaselessLiteral', 'CharsNotIn', 'Combine', 'Dict', 'Each', 'Empty',
00003 'FollowedBy', 'Forward', 'GoToColumn', 'Group', 'Keyword', 'LineEnd', 'LineStart', 'Literal',
00004 'MatchFirst', 'NoMatch', 'NotAny', 'OneOrMore', 'OnlyOnce', 'Optional', 'Or',
00005 'ParseBaseException', 'ParseElementEnhance', 'ParseException', 'ParseExpression', 'ParseFatalException',
00006 'ParseResults', 'ParseSyntaxException', 'ParserElement', 'QuotedString', 'RecursiveGrammarException',
00007 'Regex', 'SkipTo', 'StringEnd', 'StringStart', 'Suppress', 'Token', 'TokenConverter', 'Upcase',
00008 'White', 'Word', 'WordEnd', 'WordStart', 'ZeroOrMore',
00009 'alphanums', 'alphas', 'alphas8bit', 'anyCloseTag', 'anyOpenTag', 'cStyleComment', 'col',
00010 'commaSeparatedList', 'commonHTMLEntity', 'countedArray', 'cppStyleComment', 'dblQuotedString',
00011 'dblSlashComment', 'delimitedList', 'dictOf', 'downcaseTokens', 'empty', 'getTokensEndLoc', 'hexnums',
00012 'htmlComment', 'javaStyleComment', 'keepOriginalText', 'line', 'lineEnd', 'lineStart', 'lineno',
00013 'makeHTMLTags', 'makeXMLTags', 'matchOnlyAtCol', 'matchPreviousExpr', 'matchPreviousLiteral',
00014 'nestedExpr', 'nullDebugAction', 'nums', 'oneOf', 'opAssoc', 'operatorPrecedence', 'printables',
00015 'punc8bit', 'pythonStyleComment', 'quotedString', 'removeQuotes', 'replaceHTMLEntity', 
00016 'replaceWith', 'restOfLine', 'sglQuotedString', 'srange', 'stringEnd',
00017 'stringStart', 'traceParseAction', 'unicodeString', 'upcaseTokens', 'withAttribute',
00018 'indentedBlock', 'originalTextFor',
00019 ]

Definition at line 74 of file pyparsing.py.

string blockit::external::pyparsing::__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"

Definition at line 63 of file pyparsing.py.

Definition at line 26 of file pyparsing.py.

Definition at line 61 of file pyparsing.py.

string blockit::external::pyparsing::__versionTime__ = "17 February 2009 19:45"

Definition at line 62 of file pyparsing.py.

Definition at line 164 of file pyparsing.py.

Definition at line 3302 of file pyparsing.py.

Definition at line 3303 of file pyparsing.py.

tuple blockit::external::pyparsing::_escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 )

Definition at line 3300 of file pyparsing.py.

tuple blockit::external::pyparsing::_expanded = lambdap:(isinstance(p,ParseResults) and ''.join([ unichr(c) for c in range(ord(p[0]),ord(p[1])+1) ]) or p)

Definition at line 3308 of file pyparsing.py.

Definition at line 101 of file pyparsing.py.

Definition at line 100 of file pyparsing.py.

Definition at line 3306 of file pyparsing.py.

Definition at line 142 of file pyparsing.py.

Definition at line 135 of file pyparsing.py.

blockit::external::pyparsing::alphas = string.lowercase+string.uppercase

Definition at line 158 of file pyparsing.py.

Definition at line 102 of file pyparsing.py.

tuple blockit::external::pyparsing::dblQuotedString = Regex(r'"(?:[^"\n\r\\]|(?:"")|(?:\\x[0-9a-fA-F]+)|(?:\\.))

Definition at line 3532 of file pyparsing.py.

Definition at line 3294 of file pyparsing.py.

string blockit::external::pyparsing::hexnums = "ABCDEFabcdef"

Definition at line 162 of file pyparsing.py.

Definition at line 3296 of file pyparsing.py.

Definition at line 3295 of file pyparsing.py.

Definition at line 161 of file pyparsing.py.

Definition at line 3457 of file pyparsing.py.

Definition at line 165 of file pyparsing.py.

Definition at line 3298 of file pyparsing.py.

Definition at line 136 of file pyparsing.py.

 All Classes Namespaces Files Functions Variables Properties