Module pyparsing :: Class Suppress
[hide private]
[frames] | no frames]

Class Suppress

source code

     object --+            
              |            
  ParserElement --+        
                  |        
ParseElementEnhance --+    
                      |    
         TokenConverter --+
                          |
                         Suppress

Converter for ignoring the results of a parsed expression.

Example:

   source = "a, b, c,d"
   wd = Word(alphas)
   wd_list1 = wd + ZeroOrMore(',' + wd)
   print(wd_list1.parseString(source))

   # often, delimiters that are useful during parsing are just in the
   # way afterward - use Suppress to keep them out of the parsed output
   wd_list2 = wd + ZeroOrMore(Suppress(',') + wd)
   print(wd_list2.parseString(source))

prints:

   ['a', ',', 'b', ',', 'c', ',', 'd']
   ['a', 'b', 'c', 'd']

(See also :class:`delimitedList`.)

Nested Classes [hide private]
Instance Methods [hide private]
 
postParse(self, instring, loc, tokenlist) source code
 
suppress(self)
Suppresses the output of this :class:`ParserElement`; useful to keep punctuation from cluttering up returned output.
source code

Inherited from TokenConverter: __init__

Inherited from ParseElementEnhance: __str__, checkRecursion, ignore, leaveWhitespace, parseImpl, streamline, validate

Inherited from ParserElement: __add__, __and__, __call__, __eq__, __getitem__, __hash__, __invert__, __iter__, __mul__, __ne__, __or__, __radd__, __rand__, __repr__, __req__, __rmul__, __rne__, __ror__, __rsub__, __rxor__, __sub__, __xor__, addCondition, addParseAction, canParseNext, copy, matches, parseFile, parseString, parseWithTabs, preParse, runTests, scanString, searchString, setBreak, setDebug, setDebugActions, setFailAction, setName, setParseAction, setResultsName, setWhitespaceChars, split, transformString, tryParse

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

Static Methods [hide private]

Inherited from ParserElement: enablePackrat, inlineLiteralsUsing, resetCache, setDefaultWhitespaceChars

Class Variables [hide private]

Inherited from ParserElement: DEFAULT_WHITE_CHARS, packrat_cache, packrat_cache_lock, packrat_cache_stats, verbose_stacktrace

Inherited from ParserElement (private): _packratEnabled

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

postParse(self, instring, loc, tokenlist)

source code 
Overrides: ParserElement.postParse

suppress(self)

source code 

Suppresses the output of this :class:`ParserElement`; useful to keep punctuation from cluttering up returned output.

Overrides: ParserElement.suppress
(inherited documentation)