Package pyparsing :: Module pyparsing :: Class ParseResults
[frames | no frames]

Type ParseResults

object --+
         |
        ParseResults


Structured parse results, to provide multiple means of access to the parsed data:
Method Summary
  __init__(self, toklist, name, asList, modal)
  __add__(self, other)
  __bool__(self)
  __contains__(self, k)
  __delitem__(self, i)
  __getattr__(self, name)
  __getitem__(self, i)
  __getstate__(self)
  __iadd__(self, other)
  __iter__(self)
  __len__(self)
  __new__(cls, toklist, name, asList, modal)
(Static method)
  __nonzero__(self)
  __repr__(self)
  __reversed__(self)
  __setitem__(self, k, v)
  __setstate__(self, state)
  __str__(self)
  asDict(self)
Returns the named parse results as dictionary.
  asList(self)
Returns the parse results as a nested list of matching tokens, all converted to strings.
  asXML(self, doctag, namedItemsOnly, indent, formatted)
Returns the parse results as XML.
  copy(self)
Returns a new copy of a ParseResults object.
  dump(self, indent, depth)
Diagnostic method for listing out the contents of a ParseResults.
  get(self, key, defaultValue)
Returns named result matching the given key, or if there is no such name, then returns the given defaultValue or None if no defaultValue is specified.
  getName(self)
Returns the results name for this token expression.
  insert(self, index, insStr)
  items(self)
Returns all named result keys and values as a list of tuples.
  keys(self)
Returns all named result keys.
  pop(self, index)
Removes and returns item at specified index (default=last).
  values(self)
Returns all named result values.
Inherited from object: __delattr__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__

Class Variable Summary
tuple __slots__ = ('__toklist', '__tokdict', '__doinit', '__na...

Instance Method Details

asDict(self)

Returns the named parse results as dictionary.

asList(self)

Returns the parse results as a nested list of matching tokens, all converted to strings.

asXML(self, doctag=None, namedItemsOnly=False, indent='', formatted=True)

Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.

copy(self)

Returns a new copy of a ParseResults object.

dump(self, indent='', depth=0)

Diagnostic method for listing out the contents of a ParseResults. Accepts an optional indent argument so that this string can be embedded in a nested display of other data.

get(self, key, defaultValue=None)

Returns named result matching the given key, or if there is no such name, then returns the given defaultValue or None if no defaultValue is specified.

getName(self)

Returns the results name for this token expression.

items(self)

Returns all named result keys and values as a list of tuples.

keys(self)

Returns all named result keys.

pop(self, index=-1)

Removes and returns item at specified index (default=last). Will work with either numeric indices or dict-key indicies.

values(self)

Returns all named result values.

Class Variable Details

__slots__

Type:
tuple
Value:
('__toklist',
 '__tokdict',
 '__doinit',
 '__name',
 '__parent',
 '__accumNames',
 '__weakref__')                                                        

Generated by Epydoc 2.1 on Sun Feb 10 18:01:06 2008 http://epydoc.sf.net