| 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...)
|
|||
|
Inherited from |
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
__slotnames__ =
|
|||
|
Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
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 Wed Dec 25 07:03:29 2019 | http://epydoc.sourceforge.net |