| # 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.Each Class Reference
Inheritance diagram for pyparsing.Each:
[legend]
Collaboration diagram for pyparsing.Each:
[legend]

## Public Member Functions
def | __init__
def | parseImpl
def | __str__
def | checkRecursion
Public Member Functions inherited from pyparsing.ParseExpression
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
| mayReturnEmpty
| skipWhitespace
| initExprGroups
| optionals
| multioptionals
| multirequired
| required
| strRepr
Public Attributes inherited from pyparsing.ParseExpression
| 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

    Requires all given ParseExpressions to be found, but in any order.
       Expressions may be separated by whitespace.
       May be constructed using the '&' operator.

Definition at line 2499 of file pyparsing.py.

## Constructor & Destructor Documentation

def pyparsing.Each.__init__ | ( |  | self,
|  |  | exprs,
|  |  | savelist = `True`
| ) |  |

Definition at line 2504 of file pyparsing.py.

2504
2505 def __init__( self, exprs, savelist = True ):
2506 super(Each,self).__init__(exprs, savelist)
2507 self.mayReturnEmpty = True
2508 for e in self.exprs:
2509 if not e.mayReturnEmpty:
2510 self.mayReturnEmpty = False
2511 break
2512 self.skipWhitespace = True
2513 self.initExprGroups = True

## Member Function Documentation

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

Definition at line 2570 of file pyparsing.py.

2570
2571 def __str__( self ):
2572 if hasattr(self,"name"):
2573 return self.name
2574
2575 if self.strRepr is None:
2576 self.strRepr = "{" + " & ".join( [ _ustr(e) for e in self.exprs ] ) + "}"
2577
2578 return self.strRepr

def pyparsing.Each.checkRecursion | ( |  | self,
|  |  | parseElementList
| ) |  |

Definition at line 2579 of file pyparsing.py.

2579
2580 def checkRecursion( self, parseElementList ):
2581 subRecCheckList = parseElementList[:] + [ self ]
2582 for e in self.exprs:
2583 e.checkRecursion( subRecCheckList )
2584

def pyparsing.Each.parseImpl | ( |  | self,
|  |  | instring,
|  |  | loc,
|  |  | doActions = `True`
| ) |  |

Definition at line 2514 of file pyparsing.py.

2514
2515 def parseImpl( self, instring, loc, doActions=True ):
2516 if self.initExprGroups:
2517 self.optionals = [ e.expr for e in self.exprs if isinstance(e,Optional) ]
2518 self.multioptionals = [ e.expr for e in self.exprs if isinstance(e,ZeroOrMore) ]
2519 self.multirequired = [ e.expr for e in self.exprs if isinstance(e,OneOrMore) ]
2520 self.required = [ e for e in self.exprs if not isinstance(e,(Optional,ZeroOrMore,OneOrMore)) ]
2521 self.required += self.multirequired
2522 self.initExprGroups = False
2523 tmpLoc = loc
2524 tmpReqd = self.required[:]
2525 tmpOpt = self.optionals[:]
2526 matchOrder = []
2527
2528 keepMatching = True
2529 while keepMatching:
2530 tmpExprs = tmpReqd + tmpOpt + self.multioptionals + self.multirequired
2531 failed = []
2532 for e in tmpExprs:
2533 try:
2534 tmpLoc = e.tryParse( instring, tmpLoc )
2535 except ParseException:
2536 failed.append(e)
2537 else:
2538 matchOrder.append(e)
2539 if e in tmpReqd:
2540 tmpReqd.remove(e)
2541 elif e in tmpOpt:
2542 tmpOpt.remove(e)
2543 if len(failed) == len(tmpExprs):
2544 keepMatching = False
2545
2546 if tmpReqd:
2547 missing = ", ".join( [ _ustr(e) for e in tmpReqd ] )
2548 raise ParseException(instring,loc,"Missing one or more required elements (%s)" % missing )
2549
2550 # add any unmatched Optionals, in case they have default values defined
2551 matchOrder += list(e for e in self.exprs if isinstance(e,Optional) and e.expr in tmpOpt)
2552
2553 resultlist = []
2554 for e in matchOrder:
2555 loc,results = e._parse(instring,loc,doActions)
2556 resultlist.append(results)
2557
2558 finalResults = ParseResults([])
2559 for r in resultlist:
2560 dups = {}
2561 for k in r.keys():
2562 if k in finalResults.keys():
2563 tmp = ParseResults(finalResults[k])
2564 tmp += ParseResults(r[k])
2565 dups[k] = tmp
2566 finalResults += ParseResults(r)
2567 for k,v in dups.items():
2568 finalResults[k] = v
2569 return loc, finalResults

## Member Data Documentation

pyparsing.Each.initExprGroups

Definition at line 2512 of file pyparsing.py.

pyparsing.Each.mayReturnEmpty

Definition at line 2506 of file pyparsing.py.

pyparsing.Each.multioptionals

Definition at line 2517 of file pyparsing.py.

pyparsing.Each.multirequired

Definition at line 2518 of file pyparsing.py.

pyparsing.Each.optionals

Definition at line 2516 of file pyparsing.py.

pyparsing.Each.required

Definition at line 2519 of file pyparsing.py.

pyparsing.Each.skipWhitespace

Definition at line 2511 of file pyparsing.py.

pyparsing.Each.strRepr

Definition at line 2575 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