| | |
- __builtin__.object
-
- ParseResults
- ParserElement
-
- ParseElementEnhance
-
- FollowedBy
- Forward
- NotAny
- OneOrMore
- Optional
- SkipTo
- TokenConverter
-
- Combine
- Dict
- Group
- Suppress
- Upcase
- ZeroOrMore
- ParseExpression
-
- And
- Each
- MatchFirst
- Or
- Token
-
- CharsNotIn
- Empty
- Keyword
-
- CaselessKeyword
- Literal
-
- CaselessLiteral
- NoMatch
- PositionToken
-
- GoToColumn
- LineEnd
- LineStart
- StringEnd
- StringStart
- Regex
- White
- Word
- exceptions.Exception(exceptions.BaseException)
-
- ParseBaseException
-
- ParseException
- ParseFatalException
- RecursiveGrammarException
class And(ParseExpression) |
| |
Requires all given ParseExpressions to be found in the given order.
Expressions may be separated by whitespace.
May be constructed using the '+' operator. |
| |
- Method resolution order:
- And
- ParseExpression
- ParserElement
- __builtin__.object
Methods defined here:
- __iadd__(self, other)
- __init__(self, exprs, savelist=True)
- __str__(self)
- checkRecursion(self, parseElementList)
- parseImpl(self, instring, loc, doActions=True)
Data and other attributes defined here:
- __slotnames__ = []
Methods inherited from ParseExpression:
- __getitem__(self, i)
- append(self, other)
- ignore(self, other)
- leaveWhitespace(self)
- Extends leaveWhitespace defined in base class, and also invokes leaveWhitespace on
all contained expressions.
- setResultsName(self, name, listAllMatches=False)
- streamline(self)
- validate(self, validateTrace=[])
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- postParse(self, instring, loc, tokenlist)
- preParse(self, instring, loc)
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- setWhitespaceChars(self, chars)
- Overrides the default whitespace chars
- skipIgnorables(self, instring, loc)
- 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.
- tryParse(self, instring, loc)
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class CaselessKeyword(Keyword) |
| | |
- Method resolution order:
- CaselessKeyword
- Keyword
- Token
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self, matchString, identChars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$')
- parseImpl(self, instring, loc, doActions=True)
Methods inherited from Keyword:
- copy(self)
Static methods inherited from Keyword:
- setDefaultKeywordChars(chars)
- Overrides the default Keyword chars
Data and other attributes inherited from Keyword:
- DEFAULT_KEYWORD_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'
Methods inherited from Token:
- setName(self, name)
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __ror__(self, other)
- Implementation of |= operator
- __rxor__(self, other)
- Implementation of ^= operator
- __str__(self)
- __xor__(self, other)
- Implementation of ^ operator - returns Or
- checkRecursion(self, parseElementList)
- 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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- postParse(self, instring, loc, tokenlist)
- preParse(self, instring, loc)
- 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.
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- 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
- skipIgnorables(self, instring, loc)
- streamline(self)
- 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.
- tryParse(self, instring, loc)
- validate(self, validateTrace=[])
- Check defined expressions for valid structure, check for infinite recursive definitions.
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class CaselessLiteral(Literal) |
| |
Token to match a specified string, ignoring case of letters.
Note: the matched results will always be in the case of the given
match string, NOT the case of the input text. |
| |
- Method resolution order:
- CaselessLiteral
- Literal
- Token
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self, matchString)
- parseImpl(self, instring, loc, doActions=True)
Data and other attributes inherited from Literal:
- __slotnames__ = []
Methods inherited from Token:
- setName(self, name)
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __ror__(self, other)
- Implementation of |= operator
- __rxor__(self, other)
- Implementation of ^= operator
- __str__(self)
- __xor__(self, other)
- Implementation of ^ operator - returns Or
- checkRecursion(self, parseElementList)
- 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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- postParse(self, instring, loc, tokenlist)
- preParse(self, instring, loc)
- 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.
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- 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
- skipIgnorables(self, instring, loc)
- streamline(self)
- 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.
- tryParse(self, instring, loc)
- validate(self, validateTrace=[])
- Check defined expressions for valid structure, check for infinite recursive definitions.
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class CharsNotIn(Token) |
| |
Token for matching words composed of characters *not* in a given set.
Defined with string containing all disallowed characters, and an optional
minimum, maximum, and/or exact length. |
| |
- Method resolution order:
- CharsNotIn
- Token
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self, notChars, min=1, max=0, exact=0)
- __str__(self)
- parseImpl(self, instring, loc, doActions=True)
Data and other attributes defined here:
- __slotnames__ = []
Methods inherited from Token:
- setName(self, name)
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __ror__(self, other)
- Implementation of |= operator
- __rxor__(self, other)
- Implementation of ^= operator
- __xor__(self, other)
- Implementation of ^ operator - returns Or
- checkRecursion(self, parseElementList)
- 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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- postParse(self, instring, loc, tokenlist)
- preParse(self, instring, loc)
- 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.
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- 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
- skipIgnorables(self, instring, loc)
- streamline(self)
- 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.
- tryParse(self, instring, loc)
- validate(self, validateTrace=[])
- Check defined expressions for valid structure, check for infinite recursive definitions.
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class Combine(TokenConverter) |
| |
Converter to concatenate all matching tokens to a single string.
By default, the matching patterns must also be contiguous in the input string;
this can be disabled by specifying 'adjacent=False' in the constructor. |
| |
- Method resolution order:
- Combine
- TokenConverter
- ParseElementEnhance
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self, expr, joinString='', adjacent=True)
- ignore(self, other)
- postParse(self, instring, loc, tokenlist)
Methods inherited from ParseElementEnhance:
- __str__(self)
- checkRecursion(self, parseElementList)
- leaveWhitespace(self)
- parseImpl(self, instring, loc, doActions=True)
- streamline(self)
- validate(self, validateTrace=[])
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- preParse(self, instring, loc)
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- 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
- skipIgnorables(self, instring, loc)
- 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.
- tryParse(self, instring, loc)
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class Dict(TokenConverter) |
| |
Converter to return a repetitive expression as a list, but also as a dictionary.
Each element can also be referenced using the first token in the expression as its key.
Useful for tabular report scraping when the first column can be used as a item key. |
| |
- Method resolution order:
- Dict
- TokenConverter
- ParseElementEnhance
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self, exprs)
- postParse(self, instring, loc, tokenlist)
Methods inherited from ParseElementEnhance:
- __str__(self)
- checkRecursion(self, parseElementList)
- ignore(self, other)
- leaveWhitespace(self)
- parseImpl(self, instring, loc, doActions=True)
- streamline(self)
- validate(self, validateTrace=[])
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- preParse(self, instring, loc)
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- 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
- skipIgnorables(self, instring, loc)
- 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.
- tryParse(self, instring, loc)
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class Each(ParseExpression) |
| |
Requires all given ParseExpressions to be found, but in any order.
Expressions may be separated by whitespace.
May be constructed using the '&' operator. |
| |
- Method resolution order:
- Each
- ParseExpression
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self, exprs, savelist=True)
- __str__(self)
- checkRecursion(self, parseElementList)
- parseImpl(self, instring, loc, doActions=True)
Methods inherited from ParseExpression:
- __getitem__(self, i)
- append(self, other)
- ignore(self, other)
- leaveWhitespace(self)
- Extends leaveWhitespace defined in base class, and also invokes leaveWhitespace on
all contained expressions.
- setResultsName(self, name, listAllMatches=False)
- streamline(self)
- validate(self, validateTrace=[])
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- postParse(self, instring, loc, tokenlist)
- preParse(self, instring, loc)
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- setWhitespaceChars(self, chars)
- Overrides the default whitespace chars
- skipIgnorables(self, instring, loc)
- 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.
- tryParse(self, instring, loc)
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class Empty(Token) |
| |
An empty token, will always match. |
| |
- Method resolution order:
- Empty
- Token
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self)
Methods inherited from Token:
- setName(self, name)
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __ror__(self, other)
- Implementation of |= operator
- __rxor__(self, other)
- Implementation of ^= operator
- __str__(self)
- __xor__(self, other)
- Implementation of ^ operator - returns Or
- checkRecursion(self, parseElementList)
- 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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- parseImpl(self, instring, loc, doActions=True)
- 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.
- postParse(self, instring, loc, tokenlist)
- preParse(self, instring, loc)
- 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.
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- 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
- skipIgnorables(self, instring, loc)
- streamline(self)
- 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.
- tryParse(self, instring, loc)
- validate(self, validateTrace=[])
- Check defined expressions for valid structure, check for infinite recursive definitions.
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class FollowedBy(ParseElementEnhance) |
| |
Lookahead matching of the given parse expression. FollowedBy
does *not* advance the parsing position within the input string, it only
verifies that the specified parse expression matches at the current
position. FollowedBy always returns a null token list. |
| |
- Method resolution order:
- FollowedBy
- ParseElementEnhance
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self, expr)
- parseImpl(self, instring, loc, doActions=True)
Methods inherited from ParseElementEnhance:
- __str__(self)
- checkRecursion(self, parseElementList)
- ignore(self, other)
- leaveWhitespace(self)
- streamline(self)
- validate(self, validateTrace=[])
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- postParse(self, instring, loc, tokenlist)
- preParse(self, instring, loc)
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- 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
- skipIgnorables(self, instring, loc)
- 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.
- tryParse(self, instring, loc)
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
class Forward(ParseElementEnhance) |
| |
Forward declaration of an expression to be defined later -
used for recursive grammars, such as algebraic infix notation.
When the expression is known, it is assigned to the Forward variable using the '<<' operator. |
| |
- Method resolution order:
- Forward
- ParseElementEnhance
- ParserElement
- __builtin__.object
Methods defined here:
- __init__(self, other=None)
- __lshift__(self, other)
- __str__(self)
- leaveWhitespace(self)
- streamline(self)
- validate(self, validateTrace=[])
Methods inherited from ParseElementEnhance:
- checkRecursion(self, parseElementList)
- ignore(self, other)
- parseImpl(self, instring, loc, doActions=True)
Methods inherited from ParserElement:
- __add__(self, other)
- Implementation of + operator - returns And
- __and__(self, other)
- Implementation of & operator - returns Each
- __invert__(self)
- Implementation of ~ operator - returns NotAny
- __or__(self, other)
- Implementation of | operator - returns MatchFirst
- __radd__(self, other)
- Implementation of += operator
- __rand__(self, other)
- Implementation of right-& operator
- __repr__(self)
- __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.
- parse(self, instring, loc, doActions=True, callPreParse=True)
- #~ @profile
- 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.
- postParse(self, instring, loc, tokenlist)
- preParse(self, instring, loc)
- 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:
- s = the original string being parsed
- loc = the location of the matching substring
- toks = a list of the matched tokens, packaged as a ParseResults object
If the function fn modifies the tokens, it 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.
- 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
- skipIgnorables(self, instring, loc)
- 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.
- tryParse(self, instring, loc)
Static methods inherited from ParserElement:
- setDefaultWhitespaceChars(chars)
- Overrides the default whitespace chars
Data descriptors inherited from ParserElement:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ParserElement:
- DEFAULT_WHITE_CHARS = ' \n\t\r'
|
|