Package gavo :: Package adql :: Module nodes :: Class ADQLNode
[frames] | no frames]

Class ADQLNode

source code

             object --+    
                      |    
utils.autonode.AutoNode --+
                          |
                         ADQLNode
Known Subclasses:

A node within an ADQL parse tree.

ADQL nodes may be parsed out; in that case, they have individual attributes and are craftily flattened in special methods. We do this for nodes that are morphed.

Other nodes basically just have a children attribute, and their flattening is just a concatenation for their flattened children. This is convenient as long as they are not morphed.

To derive actual classes, define

The _getInitKWs methods must return a dictionary mapping constructor argument names to values. You do not need to manually call superclass _getInitKWs, since the fromParseResult classmethod figures out all _getInitKWs in the inheritance tree itself. It calls all of them in the normal MRO and updates the argument dictionary in reverse order.

The fromParseResult class method additionally filters out all names starting with an underscore; this is to allow easy returning of locals().

Nested Classes

Inherited from utils.autonode.AutoNode: __metaclass__

Instance Methods
 
__repr__(self)
repr(x)
source code
 
flatten(self)
returns a string representation of the text content of the tree.
source code
 
getFlattenedChildren(self)
returns a list of all preterminal children of all children of self.
source code
 
asTree(self) source code
 
iterTree(self) source code
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code

Inherited from utils.autonode.AutoNode: change, iterAttributes, iterChildren, iterNodeChildren, iterNodes

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

Class Methods
 
fromParseResult(cls, parseResult) source code

Inherited from utils.autonode.AutoNode: cloneFrom

Class Variables
  type = None
hash(x)
Properties

Inherited from object: __class__

Method Details

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

flatten(self)

source code 

returns a string representation of the text content of the tree.

This default implementation will only work if you returned all parsed elements as children. This, in turn, is something you only want to do if you are sure that the node is question will not be morphed.

Otherwise, override it to create an SQL fragment out of the parsed attributes.

getFlattenedChildren(self)

source code 

returns a list of all preterminal children of all children of self.

A child is preterminal if it has string content.

__init__(self)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)