Module pyparsing
[frames | no frames]

Module pyparsing

Classes
And Requires all given ParseExpressions to be found in the given order.
CaselessLiteral Token to match a specified string, ignoring case of letters.
CharsNotIn Token for matching words composed of characters *not* in a given set.
Combine Converter to concatenate all matching tokens to a single string.
Dict Converter to return a repetitive expression as a list, but also as a dictionary.
Empty An empty token, will always match.
Forward Forward declaration of an expression to be defined later - used for recursive grammars, such as algebraic infix notation.
GoToColumn Token to advance to a specific column of input text; useful for tabular report scraping.
Group Converter to return the matched tokens as a list - useful for returning tokens of ZeroOrMore and OneOrMore expressions.
LineEnd Matches if current position is at the end of a line within the parse string
LineStart Matches if current position is at the beginning of a line within the parse string
Literal Token to exactly match a specified string.
MatchFirst Requires that at least one ParseExpression is found.
NotAny Lookahead to disallow matching with the given parse expression.
OneOrMore Repetition of one or more of the given expression.
Optional Optional matching of the given expression.
Or Requires that at least one ParseExpression is found.
ParseElementEnhance Abstract subclass of ParserElement, for combining and post-processing parsed tokens.
ParseExpression Abstract subclass of ParserElement, for combining and post-processing parsed tokens.
ParserElement Abstract base level parser element class.
ParseResults Structured parse results, to provide multiple means of access to the parsed data:
PositionToken  
StringEnd Matches if current position is at the end of the parse string
StringStart Matches if current position is at the beginning of the parse string
Suppress Converter for ignoring the results of a parsed expression.
Token Abstract ParserElement subclass, for defining atomic matching patterns.
TokenConverter Abstract subclass of ParseExpression, for converting parsed results.
Upcase Converter to upper case all matching tokens.
Word Token for matching words composed of allowed character sets Defined with string containing all allowed initial characters, an optional string containing allowed body characters (if omitted, defaults to the initial character set), and an optional minimum, maximum, and/or exact length.
ZeroOrMore Optional repetition of zero or more of the given expression.

Exceptions
ParseException exception thrown when parse expressions don't match class
RecursiveGrammarException exception thrown by validate() if the grammar could be improperly recursive

Function Summary
  col(loc, strg)
Returns current column within a string, counting newlines as line separators The first column is number 1.
  delimitedList(expr, delim, combine)
Helper to define a delimited list of expressions - the delimiter defaults to ','.
  line(loc, strg)
Returns the line of text containing loc within a string, counting newlines as line separators The first line is number 1.
  lineno(loc, strg)
Returns current line number within a string, counting newlines as line separators The first line is number 1.
  oneOf(strs, caseless)
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.

Variable Summary
str __author__ = 'Paul McGuire <ptmcg@users.sourceforge.net>...
str __version__ = '1.1.2'
str alphanums = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ...
str alphas = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST...
And commaSeparatedList = commaSeparatedList
Combine cStyleComment = cStyleComment enclosed in /* ... */
Combine dblQuotedString = string enclosed in double quotes
Empty empty = empty
str nums = '0123456789'
str printables = '0123456789abcdefghijklmnopqrstuvwxyzABCDEF...
MatchFirst quotedString = quotedString using single or double quote...
Optional restOfLine = rest of line up to \n
Combine sglQuotedString = string enclosed in single quotes

Function Details

col(loc, strg)

Returns current column within a string, counting newlines as line separators The first column is number 1.

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.

line(loc, strg)

Returns the line of text containing loc within a string, counting newlines as line separators The first line is number 1.

lineno(loc, strg)

Returns current line number within a string, counting newlines as line separators The first line is number 1.

oneOf(strs, caseless=False)

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.

Variable Details

__author__

Type:
str
Value:
'Paul McGuire <ptmcg@users.sourceforge.net>'                           

__version__

Type:
str
Value:
'1.1.2'                                                                

alphanums

Type:
str
Value:
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'       

alphas

Type:
str
Value:
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'                 

commaSeparatedList

Type:
And
Value:
commaSeparatedList                                                     

cStyleComment

Type:
Combine
Value:
cStyleComment enclosed in /* ... */                                    

dblQuotedString

Type:
Combine
Value:
string enclosed in double quotes                                       

empty

Type:
Empty
Value:
empty                                                                  

nums

Type:
str
Value:
'0123456789'                                                           

printables

Type:
str
Value:
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\\
'()*+,-./:;<=>?@[\\]^_`{|}~'                                           

quotedString

Type:
MatchFirst
Value:
quotedString using single or double quotes                             

restOfLine

Type:
Optional
Value:
rest of line up to \n                                                  

sglQuotedString

Type:
Combine
Value:
string enclosed in single quotes                                       

Generated by Epydoc 2.0 on Sat Mar 20 09:58:33 2004 http://epydoc.sf.net