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)
| |
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)
| |
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. | |
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. | |
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__
|
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 |
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. |
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. |
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)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. |
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. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sun Jun 20 00:25:20 2004 | http://epydoc.sf.net |