Package spade :: Module pyparsing :: Class Keyword
[hide private]
[frames] | no frames]

Class Keyword

source code


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.

Instance Methods [hide private]
 
__init__(self, matchString, identChars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678..., caseless=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
parseImpl(self, instring, loc, doActions=True) source code
 
copy(self)
Make a copy of this ParseElement.
source code

Inherited from Token: setName

Inherited from ParserElement: __add__, __and__, __invert__, __or__, __radd__, __rand__, __repr__, __ror__, __rxor__, __str__, __xor__, checkRecursion, ignore, leaveWhitespace, parse, parseFile, parseString, parseWithTabs, postParse, preParse, scanString, setDebug, setDebugActions, setParseAction, setResultsName, setWhitespaceChars, skipIgnorables, streamline, suppress, transformString, tryParse, validate

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Static Methods [hide private]
 
setDefaultKeywordChars(chars)
Overrides the default Keyword chars
source code

Inherited from ParserElement: setDefaultWhitespaceChars

Class Variables [hide private]
  DEFAULT_KEYWORD_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJK...

Inherited from ParserElement: DEFAULT_WHITE_CHARS

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, matchString, identChars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678..., caseless=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

parseImpl(self, instring, loc, doActions=True)

source code 
Overrides: ParserElement.parseImpl

copy(self)

source code 

Make a copy of this ParseElement. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element.

Overrides: ParserElement.copy
(inherited documentation)

Class Variable Details [hide private]

DEFAULT_KEYWORD_CHARS

Value:
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'