Gaudi Framework, version v25r1

Home   Generated: Mon Mar 24 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
pyparsing.Keyword Class Reference
Inheritance diagram for pyparsing.Keyword:
Inheritance graph
[legend]
Collaboration diagram for pyparsing.Keyword:
Collaboration graph
[legend]

Public Member Functions

def __init__
 
def parseImpl
 
def copy
 
def setDefaultKeywordChars
 
- Public Member Functions inherited from pyparsing.Token
def __init__
 
def setName
 
- 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

 match
 
 matchLen
 
 firstMatchChar
 
 name
 
 errmsg
 
 mayReturnEmpty
 
 mayIndexError
 
 caseless
 
 caselessmatch
 
 identChars
 
- Public Attributes inherited from pyparsing.Token
 errmsg
 
- 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
 

Static Public Attributes

string DEFAULT_KEYWORD_CHARS "_$"
 
tuple setDefaultKeywordChars staticmethod(setDefaultKeywordChars)
 

Detailed Description

Token to exactly match a specified string as a keyword, that is, it must be
   immediately followed by a non-keyword character.  Compare with Literal::
     Literal("if") will match the leading 'if' in 'ifAndOnlyIf'.
     Keyword("if") will not; it will only match the leading 'if in 'if x=1', or 'if(y==2)'
   Accepts two optional constructor arguments in addition to the keyword string:
   identChars is a string of characters that would be valid identifier characters,
   defaulting to all alphanumerics + "_" and "$"; caseless allows case-insensitive
   matching, default is False.

Definition at line 1517 of file pyparsing.py.

Constructor & Destructor Documentation

def pyparsing.Keyword.__init__ (   self,
  matchString,
  identChars = DEFAULT_KEYWORD_CHARS,
  caseless = False 
)

Definition at line 1529 of file pyparsing.py.

1530  def __init__( self, matchString, identChars=DEFAULT_KEYWORD_CHARS, caseless=False ):
1531  super(Keyword,self).__init__()
1532  self.match = matchString
1533  self.matchLen = len(matchString)
1534  try:
1535  self.firstMatchChar = matchString[0]
1536  except IndexError:
1537  warnings.warn("null string passed to Keyword; use Empty() instead",
1538  SyntaxWarning, stacklevel=2)
1539  self.name = '"%s"' % self.match
1540  self.errmsg = "Expected " + self.name
1541  self.mayReturnEmpty = False
1542  #self.myException.msg = self.errmsg
1543  self.mayIndexError = False
1544  self.caseless = caseless
1545  if caseless:
1546  self.caselessmatch = matchString.upper()
1547  identChars = identChars.upper()
1548  self.identChars = _str2dict(identChars)

Member Function Documentation

def pyparsing.Keyword.copy (   self)

Definition at line 1567 of file pyparsing.py.

1568  def copy(self):
1569  c = super(Keyword,self).copy()
1570  c.identChars = Keyword.DEFAULT_KEYWORD_CHARS
1571  return c
def pyparsing.Keyword.parseImpl (   self,
  instring,
  loc,
  doActions = True 
)

Definition at line 1549 of file pyparsing.py.

1550  def parseImpl( self, instring, loc, doActions=True ):
1551  if self.caseless:
1552  if ( (instring[ loc:loc+self.matchLen ].upper() == self.caselessmatch) and
1553  (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen].upper() not in self.identChars) and
1554  (loc == 0 or instring[loc-1].upper() not in self.identChars) ):
1555  return loc+self.matchLen, self.match
1556  else:
1557  if (instring[loc] == self.firstMatchChar and
1558  (self.matchLen==1 or instring.startswith(self.match,loc)) and
1559  (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen] not in self.identChars) and
1560  (loc == 0 or instring[loc-1] not in self.identChars) ):
1561  return loc+self.matchLen, self.match
1562  #~ raise ParseException( instring, loc, self.errmsg )
1563  exc = self.myException
1564  exc.loc = loc
1565  exc.pstr = instring
1566  raise exc
def pyparsing.Keyword.setDefaultKeywordChars (   chars)
Overrides the default Keyword chars

Definition at line 1572 of file pyparsing.py.

1573  def setDefaultKeywordChars( chars ):
1574  """Overrides the default Keyword chars
1575  """
Keyword.DEFAULT_KEYWORD_CHARS = chars

Member Data Documentation

pyparsing.Keyword.caseless

Definition at line 1543 of file pyparsing.py.

pyparsing.Keyword.caselessmatch

Definition at line 1545 of file pyparsing.py.

string pyparsing.Keyword.DEFAULT_KEYWORD_CHARS "_$"
static

Definition at line 1527 of file pyparsing.py.

pyparsing.Keyword.errmsg

Definition at line 1539 of file pyparsing.py.

pyparsing.Keyword.firstMatchChar

Definition at line 1534 of file pyparsing.py.

pyparsing.Keyword.identChars

Definition at line 1547 of file pyparsing.py.

pyparsing.Keyword.match

Definition at line 1531 of file pyparsing.py.

pyparsing.Keyword.matchLen

Definition at line 1532 of file pyparsing.py.

pyparsing.Keyword.mayIndexError

Definition at line 1542 of file pyparsing.py.

pyparsing.Keyword.mayReturnEmpty

Definition at line 1540 of file pyparsing.py.

pyparsing.Keyword.name

Definition at line 1538 of file pyparsing.py.

tuple pyparsing.Keyword.setDefaultKeywordChars staticmethod(setDefaultKeywordChars)
static

Definition at line 1576 of file pyparsing.py.


The documentation for this class was generated from the following file:
Generated at Mon Mar 24 2014 18:27:54 for Gaudi Framework, version v25r1 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004