| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
ParserElement --+
|
ParseElementEnhance --+
|
TokenConverter --+
|
Combine
Converter to concatenate all matching tokens to a single string. By
default, the matching patterns must also be contiguous in the input
string; this can be disabled by specifying 'adjacent=False'
in the constructor.
Example:
real = Word(nums) + '.' + Word(nums)
print(real.parseString('3.1416')) # -> ['3', '.', '1416']
# will also erroneously match the following
print(real.parseString('3. 1416')) # -> ['3', '.', '1416']
real = Combine(Word(nums) + '.' + Word(nums))
print(real.parseString('3.1416')) # -> ['3.1416']
# no match when there are internal spaces
print(real.parseString('3. 1416')) # -> Exception: Expected W:(0123...)
| Instance Methods | |||
|
|||
|
|||
|
|||
|
Inherited from Inherited from Inherited from |
|||
| Static Methods | |
|
Inherited from |
| Class Variables | |
__slotnames__ =
|
|
|
Inherited from |
|
| Properties | |
|
Inherited from |
| Method Details |
x.__init__(...) initializes x; see help(type(x)) for signature
|
Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Example:
patt = OneOrMore(Word(alphas))
patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj']
patt.ignore(cStyleComment)
patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj', 'lskjd']
|
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Sun Aug 14 16:58:53 2016 | http://epydoc.sourceforge.net |