Home | Trees | Index | Help |
|
---|
Module pyparsing :: Class ParserElement |
|
object
--+
|
ParserElement
ParseElementEnhance
,
ParseExpression
,
Token
Method Summary | |
---|---|
__init__(self,
savelist)
| |
Implementation of + operator - returns And | |
Implementation of ~ operator - returns NotAny | |
Implementation of | operator - returns MatchFirst | |
Implementation of += operator | |
__repr__(self)
| |
Implementation of |= operator | |
Implementation of ^= operator | |
__str__(self)
| |
Implementation of ^ operator - returns Or | |
checkRecursion(self,
parseElementList)
| |
Make a copy of this ParseElement. | |
Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. | |
Disables the skipping of whitespace before matching the characters in the ParserElement's defined pattern. | |
parse(self,
instring,
loc,
doActions)
| |
Execute the parse expression on the given file or filename. | |
parseImpl(self,
instring,
loc,
doActions)
| |
Execute the parse expression with the given string. | |
Overrides default behavior to expand <TAB>s to spaces before parsing the input string. | |
postParse(self,
instring,
loc,
tokenlist)
| |
preParse(self,
instring,
loc)
| |
Scan the input string for expression matches. | |
Enable display of debugging messages while doing pattern matching. | |
Enable display of debugging messages while doing pattern matching. | |
Overrides the default whitespace chars (Static method) | |
Define name for this expression, for use in debugging. | |
Define action to perform when successfully matching parse element definition. | |
Define name for referencing matching tokens as a nested attribute of the returned parse results. | |
Overrides the default whitespace chars | |
skipIgnorables(self,
instring,
loc)
| |
streamline(self)
| |
Suppresses the output of this ParseElement; useful to keep punctuation from cluttering up returned output. | |
Extension to scanString, to modify matching text with modified tokens that may be returned from a parse action. | |
tryParse(self,
instring,
loc)
| |
Check defined expressions for valid structure, check for infinite recursive definitions. | |
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|
Class Variable Summary | |
---|---|
str |
DEFAULT_WHITE_CHARS = ' \n\t\r'
|
Instance Method Details |
---|
__add__(self,
other)
Implementation of + operator - returns And
|
__invert__(self)Implementation of ~ operator - returns NotAny |
__or__(self,
other)
Implementation of | operator - returns MatchFirst
|
__radd__(self,
other)
Implementation of += operator
|
__ror__(self, other)Implementation of |= operator |
__rxor__(self, other)Implementation of ^= operator |
__xor__(self, other)Implementation of ^ operator - returns Or |
copy(self)Make a copy of this ParseElement. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element. |
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. |
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. |
parseFile(self, file_or_filename)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. |
parseString(self, instring)Execute the parse expression with the given string. This is the main interface to the client code, once the complete expression has been built. |
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. |
scanString(self, instring)Scan the input string for expression matches. Each match will return the matching tokens, start location, and end location. |
setDebug(self, flag=True)Enable display of debugging messages while doing pattern matching. |
setDebugActions(self, startAction, successAction, exceptionAction)Enable display of debugging messages while doing pattern matching. |
setName(self, name)Define name for this expression, for use in debugging. |
setParseAction(self, fn)Define action to perform when successfully matching parse element definition. Parse action fn is a callable method with the arguments (s, loc, toks) where:
|
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 ParseElement 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. |
setWhitespaceChars(self, chars)Overrides the default whitespace chars |
suppress(self)Suppresses the output of this ParseElement; useful to keep punctuation from cluttering up returned output. |
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. |
validate(self, validateTrace=[])Check defined expressions for valid structure, check for infinite recursive definitions. |
Static Method Details |
---|
setDefaultWhitespaceChars(chars)Overrides the default whitespace chars |
Class Variable Details |
---|
DEFAULT_WHITE_CHARS
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Wed Mar 23 23:59:24 2005 | http://epydoc.sf.net |