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

## Public Member Functions
def | __init__
def | parseImpl
def | __ior__
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
| 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 that at least one ParseExpression is found.
       If two expressions match, the first one listed is the one that will match.
       May be constructed using the '|' operator.

Definition at line 2440 of file pyparsing.py.

## Constructor & Destructor Documentation

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

Definition at line 2445 of file pyparsing.py.

2445
2446 def __init__( self, exprs, savelist = False ):
2447 super(MatchFirst,self).__init__(exprs, savelist)
2448 if exprs:
2449 self.mayReturnEmpty = False
2450 for e in self.exprs:
2451 if e.mayReturnEmpty:
2452 self.mayReturnEmpty = True
2453 break
2454 else:
2455 self.mayReturnEmpty = True

## Member Function Documentation

def pyparsing.MatchFirst.__ior__ | ( |  | self,
|  |  | other
| ) |  |

Definition at line 2479 of file pyparsing.py.

2479
2480 def __ior__(self, other ):
2481 if isinstance( other, basestring ):
2482 other = Literal( other )
2483 return self.append( other ) #MatchFirst( [ self, other ] )

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

Definition at line 2484 of file pyparsing.py.

2484
2485 def __str__( self ):
2486 if hasattr(self,"name"):
2487 return self.name
2488
2489 if self.strRepr is None:
2490 self.strRepr = "{" + " | ".join( [ _ustr(e) for e in self.exprs ] ) + "}"
2491
2492 return self.strRepr

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

Definition at line 2493 of file pyparsing.py.

2493
2494 def checkRecursion( self, parseElementList ):
2495 subRecCheckList = parseElementList[:] + [ self ]
2496 for e in self.exprs:
2497 e.checkRecursion( subRecCheckList )
2498

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

Definition at line 2456 of file pyparsing.py.

2456
2457 def parseImpl( self, instring, loc, doActions=True ):
2458 maxExcLoc = -1
2459 maxException = None
2460 for e in self.exprs:
2461 try:
2462 ret = e._parse( instring, loc, doActions )
2463 return ret
2464 except ParseException, err:
2465 if err.loc > maxExcLoc:
2466 maxException = err
2467 maxExcLoc = err.loc
2468 except IndexError:
2469 if len(instring) > maxExcLoc:
2470 maxException = ParseException(instring,len(instring),e.errmsg,self)
2471 maxExcLoc = len(instring)
2472
2473 # only got here if no expression matched, raise exception for match that made it the furthest
2474 else:
2475 if maxException is not None:
2476 raise maxException
2477 else:
2478 raise ParseException(instring, loc, "no defined alternatives to match", self)

## Member Data Documentation

pyparsing.MatchFirst.mayReturnEmpty

Definition at line 2448 of file pyparsing.py.

pyparsing.MatchFirst.strRepr

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