pyparsing.pyparsing.ParseElementEnhance

Package pyparsing :: Module pyparsing :: Class ParseElementEnhance |
[hide private]
[frames] | no frames]

# Class ParseElementEnhance

source code

       object --+
                |
    ParserElement --+
                    |
                   ParseElementEnhance

Known Subclasses:
  - TokenConverter
  - , FollowedBy
  - , Forward
  - , NotAny
  - , OneOrMore
  - , Optional
  - , SkipTo
  - , ZeroOrMore

Abstract subclass of ParserElement, for combining and post-processing parsed tokens.

Instance Methods | [hide private]
__init__(self, expr, savelist=False) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
parseImpl(self, instring, loc, doActions=True) | source code
leaveWhitespace(self) Disables the skipping of whitespace before matching the characters in the ParserElement's defined pattern. | source code
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. | source code
streamline(self) | source code
checkRecursion(self, parseElementList) | source code
validate(self, validateTrace=`[``]`) Check defined expressions for valid structure, check for infinite recursive definitions. | source code
__str__(self) str(x) | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`
Inherited from ParserElement
__add__(self, other) Implementation of + operator - returns And | source code
__and__(self, other) Implementation of & operator - returns Each | source code
__call__(self, name) Shortcut for setResultsName, with listAllMatches=default: | source code
__eq__(self, other) | source code
__getattr__(self, aname) | source code
__hash__(self) hash(x) | source code
__invert__(self) Implementation of ~ operator - returns NotAny | source code
__mul__(self, other) | source code
__ne__(self, other) | source code
__or__(self, other) Implementation of | operator - returns MatchFirst | source code
__radd__(self, other) Implementation of + operator when left operand is not a ParserElement | source code
__rand__(self, other) Implementation of & operator when left operand is not a ParserElement | source code
__repr__(self) repr(x) | source code
__req__(self, other) | source code
__rmul__(self, other) | source code
__rne__(self, other) | source code
__ror__(self, other) Implementation of | operator when left operand is not a ParserElement | source code
__rsub__(self, other) Implementation of - operator when left operand is not a ParserElement | source code
__rxor__(self, other) Implementation of ^ operator when left operand is not a ParserElement | source code
__sub__(self, other) Implementation of - operator, returns And with error stop | source code
__xor__(self, other) Implementation of ^ operator - returns Or | source code
_parse(self, instring, loc, doActions=True, callPreParse=True) | source code
_parseCache(self, instring, loc, doActions=True, callPreParse=True) | source code
_parseNoCache(self, instring, loc, doActions=True, callPreParse=True) | source code
_skipIgnorables(self, instring, loc) | source code
addParseAction(self, *fns, **kwargs) Add parse action to expression's list of parse actions. | source code
copy(self) Make a copy of this ParserElement. | source code
getException(self) | source code
parseFile(self, file_or_filename, parseAll=False) Execute the parse expression on the given file or filename. | source code
parseString(self, instring, parseAll=False) Execute the parse expression with the given string. | source code
parseWithTabs(self) Overrides default behavior to expand <TAB>s to spaces before parsing the input string. | source code
postParse(self, instring, loc, tokenlist) | source code
preParse(self, instring, loc) | source code
scanString(self, instring, maxMatches=2147483647) Scan the input string for expression matches. | source code
searchString(self, instring, maxMatches=2147483647) Another extension to scanString, simplifying the access to the tokens found to match the given parse expression. | source code
setBreak(self, breakFlag=True) Method to invoke the Python pdb debugger when this element is about to be parsed. | source code
setDebug(self, flag=True) Enable display of debugging messages while doing pattern matching. | source code
setDebugActions(self, startAction, successAction, exceptionAction) Enable display of debugging messages while doing pattern matching. | source code
setFailAction(self, fn) Define action to perform if parsing fails at this expression. | source code
setName(self, name) Define name for this expression, for use in debugging. | source code
setParseAction(self, *fns, **kwargs) Define action to perform when successfully matching parse element definition. | source code
setResultsName(self, name, listAllMatches=False) Define name for referencing matching tokens as a nested attribute of the returned parse results. | source code
setWhitespaceChars(self, chars) Overrides the default whitespace chars | source code
suppress(self) Suppresses the output of this ParserElement; useful to keep punctuation from cluttering up returned output. | source code
transformString(self, instring) Extension to scanString, to modify matching text with modified tokens that may be returned from a parse action. | source code
tryParse(self, instring, loc) | source code

Static Methods | [hide private]
Inherited from ParserElement
_normalizeParseActionArgs(f) 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). | source code
enablePackrat() Enables "packrat" parsing, which adds memoizing to the parsing logic. | source code
resetCache() | source code
setDefaultWhitespaceChars(chars) Overrides the default whitespace chars | source code

Class Variables | [hide private]
Inherited from ParserElement
| DEFAULT_WHITE_CHARS = ``'``\n\t\r``'``
| _exprArgCache = ``{``}``
| _packratEnabled = `False`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, expr, savelist=False) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### parseImpl(self, instring, loc, doActions=True) | source code
Overrides: ParserElement.parseImpl

### leaveWhitespace(self) | source code
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. Overrides: ParserElement.leaveWhitespace (inherited documentation)

### ignore(self, other) | source code
Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Overrides: ParserElement.ignore (inherited documentation)

### streamline(self) | source code
Overrides: ParserElement.streamline

### checkRecursion(self, parseElementList) | source code
Overrides: ParserElement.checkRecursion

### validate(self, validateTrace=`[``]`) | source code
Check defined expressions for valid structure, check for infinite recursive definitions. Overrides: ParserElement.validate (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)