| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
pyparsing.ParseExpression Class Reference
Inheritance diagram for pyparsing.ParseExpression:
[legend]
Collaboration diagram for pyparsing.ParseExpression:
[legend]

## Public Member Functions
def | __init__
def | __getitem__
def | append
def | leaveWhitespace
def | ignore
def | __str__
def | streamline
def | setResultsName
def | validate
Public Member Functions inherited from pyparsing.ParserElement
def | setDefaultWhitespaceChars
def | __init__
def | copy
def | setName
def | setResultsName
def | setBreak
def | setParseAction
def | addParseAction
def | setFailAction
def | preParse
def | parseImpl
def | postParse
def | tryParse
def | resetCache
def | enablePackrat
def | parseString
def | scanString
def | transformString
def | searchString
def | __add__
def | __radd__
def | __sub__
def | __rsub__
def | __mul__
def | __rmul__
def | __or__
def | __ror__
def | __xor__
def | __rxor__
def | __and__
def | __rand__
def | __invert__
def | __call__
def | suppress
def | leaveWhitespace
def | setWhitespaceChars
def | parseWithTabs
def | ignore
def | setDebugActions
def | setDebug
def | __str__
def | __repr__
def | streamline
def | checkRecursion
def | validate
def | parseFile
def | getException
def | __getattr__
def | __eq__
def | __ne__
def | __hash__
def | __req__
def | __rne__

## Public Attributes
| exprs
| callPreparse
| strRepr
| skipWhitespace
Public Attributes inherited from pyparsing.ParserElement
| parseAction
| failAction
| strRepr
| resultsName
| saveAsList
| skipWhitespace
| whiteChars
| copyDefaultWhiteChars
| mayReturnEmpty
| keepTabs
| ignoreExprs
| debug
| streamlined
| mayIndexError
| errmsg
| modalResults
| debugActions
| re
| callPreparse
| callDuringTry
| name
| myException

## Additional Inherited Members
Static Public Attributes inherited from pyparsing.ParserElement
string | DEFAULT_WHITE_CHARS " \n\t\r"
tuple | setDefaultWhitespaceChars staticmethod(setDefaultWhitespaceChars)
tuple | resetCache staticmethod(resetCache)
tuple | enablePackrat staticmethod(enablePackrat)

## Detailed Description

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

Definition at line 2215 of file pyparsing.py.

## Constructor & Destructor Documentation

def pyparsing.ParseExpression.__init__ | ( |  | self,
|  |  | exprs,
|  |  | savelist = `False`
| ) |  |

Definition at line 2217 of file pyparsing.py.

2217
2218 def __init__( self, exprs, savelist = False ):
2219 super(ParseExpression,self).__init__(savelist)
2220 if isinstance( exprs, list ):
2221 self.exprs = exprs
2222 elif isinstance( exprs, basestring ):
2223 self.exprs = [ Literal( exprs ) ]
2224 else:
2225 try:
2226 self.exprs = list( exprs )
2227 except TypeError:
2228 self.exprs = [ exprs ]
2229 self.callPreparse = False

## Member Function Documentation

def pyparsing.ParseExpression.__getitem__ | ( |  | self,
|  |  | i
| ) |  |

Definition at line 2230 of file pyparsing.py.

2230
2231 def __getitem__( self, i ):
2232 return self.exprs[i]

def pyparsing.ParseExpression.__str__ | ( |  | self | ) |

Definition at line 2259 of file pyparsing.py.

2259
2260 def __str__( self ):
2261 try:
2262 return super(ParseExpression,self).__str__()
2263 except:
2264 pass
2265
2266 if self.strRepr is None:
2267 self.strRepr = "%s:(%s)" % ( self.__class__.__name__, _ustr(self.exprs) )
2268 return self.strRepr

def pyparsing.ParseExpression.append | ( |  | self,
|  |  | other
| ) |  |

Definition at line 2233 of file pyparsing.py.

2233
2234 def append( self, other ):
2235 self.exprs.append( other )
2236 self.strRepr = None
2237 return self

def pyparsing.ParseExpression.ignore | ( |  | self,
|  |  | other
| ) |  |

Definition at line 2247 of file pyparsing.py.

2247
2248 def ignore( self, other ):
2249 if isinstance( other, Suppress ):
2250 if other not in self.ignoreExprs:
2251 super( ParseExpression, self).ignore( other )
2252 for e in self.exprs:
2253 e.ignore( self.ignoreExprs[-1] )
2254 else:
2255 super( ParseExpression, self).ignore( other )
2256 for e in self.exprs:
2257 e.ignore( self.ignoreExprs[-1] )
2258 return self

def pyparsing.ParseExpression.leaveWhitespace | ( |  | self | ) |

    Extends leaveWhitespace defined in base class, and also invokes leaveWhitespace on
       all contained expressions.

Definition at line 2238 of file pyparsing.py.

2238
2239 def leaveWhitespace( self ):
2240 """Extends leaveWhitespace defined in base class, and also invokes leaveWhitespace on
2241 all contained expressions."""
2242 self.skipWhitespace = False
2243 self.exprs = [ e.copy() for e in self.exprs ]
2244 for e in self.exprs:
2245 e.leaveWhitespace()
2246 return self

def pyparsing.ParseExpression.setResultsName | ( |  | self,
|  |  | name,
|  |  | listAllMatches = `False`
| ) |  |

Definition at line 2301 of file pyparsing.py.

2301
2302 def setResultsName( self, name, listAllMatches=False ):
2303 ret = super(ParseExpression,self).setResultsName(name,listAllMatches)
2304 return ret

def pyparsing.ParseExpression.streamline | ( |  | self | ) |

Definition at line 2269 of file pyparsing.py.

2269
2270 def streamline( self ):
2271 super(ParseExpression,self).streamline()
2272
2273 for e in self.exprs:
2274 e.streamline()
2275
2276 # collapse nested And's of the form And( And( And( a,b), c), d) to And( a,b,c,d )
2277 # but only if there are no parse actions or resultsNames on the nested And's
2278 # (likewise for Or's and MatchFirst's)
2279 if ( len(self.exprs) == 2 ):
2280 other = self.exprs[0]
2281 if ( isinstance( other, self.__class__ ) and
2282 not(other.parseAction) and
2283 other.resultsName is None and
2284 not other.debug ):
2285 self.exprs = other.exprs[:] + [ self.exprs[1] ]
2286 self.strRepr = None
2287 self.mayReturnEmpty |= other.mayReturnEmpty
2288 self.mayIndexError |= other.mayIndexError
2289
2290 other = self.exprs[-1]
2291 if ( isinstance( other, self.__class__ ) and
2292 not(other.parseAction) and
2293 other.resultsName is None and
2294 not other.debug ):
2295 self.exprs = self.exprs[:-1] + other.exprs[:]
2296 self.strRepr = None
2297 self.mayReturnEmpty |= other.mayReturnEmpty
2298 self.mayIndexError |= other.mayIndexError
2299
2300 return self

def pyparsing.ParseExpression.validate | ( |  | self,
|  |  | validateTrace = `[]`
| ) |  |

Definition at line 2305 of file pyparsing.py.

2305
2306 def validate( self, validateTrace=[] ):
2307 tmp = validateTrace[:]+[self]
2308 for e in self.exprs:
2309 e.validate(tmp)
2310 self.checkRecursion( [] )

## Member Data Documentation

pyparsing.ParseExpression.callPreparse

Definition at line 2228 of file pyparsing.py.

pyparsing.ParseExpression.exprs

Definition at line 2220 of file pyparsing.py.

pyparsing.ParseExpression.skipWhitespace

Definition at line 2241 of file pyparsing.py.

pyparsing.ParseExpression.strRepr

Definition at line 2235 of file pyparsing.py.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/cmake/cmt2cmake/pyparsing.py