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

## Public Member Functions
def | __init__
def | parseImpl
def | __str__
Public Member Functions inherited from pyparsing.ParseElementEnhance
def | __init__
def | parseImpl
def | leaveWhitespace
def | ignore
def | streamline
def | checkRecursion
def | validate
def | __str__
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
| defaultValue
| mayReturnEmpty
| strRepr
Public Attributes inherited from pyparsing.ParseElementEnhance
| expr
| strRepr
| mayIndexError
| mayReturnEmpty
| skipWhitespace
| saveAsList
| callPreparse
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

    Optional matching of the given expression.
       A default return string can also be specified, if the optional expression
       is not found.

Definition at line 2789 of file pyparsing.py.

## Constructor & Destructor Documentation

def pyparsing.Optional.__init__ | ( |  | self,
|  |  | exprs,
|  |  | default = `_optionalNotMatched`
| ) |  |

Definition at line 2794 of file pyparsing.py.

2794
2795 def __init__( self, exprs, default=_optionalNotMatched ):
2796 super(Optional,self).__init__( exprs, savelist=False )
2797 self.defaultValue = default
2798 self.mayReturnEmpty = True

## Member Function Documentation

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

Definition at line 2813 of file pyparsing.py.

2813
2814 def __str__( self ):
2815 if hasattr(self,"name"):
2816 return self.name
2817
2818 if self.strRepr is None:
2819 self.strRepr = "[" + _ustr(self.expr) + "]"
2820
2821 return self.strRepr
2822

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

Definition at line 2799 of file pyparsing.py.

2799
2800 def parseImpl( self, instring, loc, doActions=True ):
2801 try:
2802 loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False )
2803 except (ParseException,IndexError):
2804 if self.defaultValue is not _optionalNotMatched:
2805 if self.expr.resultsName:
2806 tokens = ParseResults([ self.defaultValue ])
2807 tokens[self.expr.resultsName] = self.defaultValue
2808 else:
2809 tokens = [ self.defaultValue ]
2810 else:
2811 tokens = []
2812 return loc, tokens

## Member Data Documentation

pyparsing.Optional.defaultValue

Definition at line 2796 of file pyparsing.py.

pyparsing.Optional.mayReturnEmpty

Definition at line 2797 of file pyparsing.py.

pyparsing.Optional.strRepr

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