gavo.stc.stcxgen module¶
Converting ASTs to/from STC-X.
The basic idea for conversion to STC-X is that for every ASTNode in dm, there is a serialize_<classname> function returning some xmlstan. In general they should handle the case when their argument is None and return None in that case.
Traversal is done manually (i.e., by each serialize_X method) rather than globally since the children in the AST may not have the right order to keep XSD happy, and also since ASTs are actually a bit more complicated than trees (e.g., coordinate frames usually have multiple parents).
- class gavo.stc.stcxgen.Context(rootNode)[source]¶
Bases:
object
is a generation context.
It is used to pass around genration-related information. Right now, that’s primarily the root node.
- gavo.stc.stcxgen.addId(node)[source]¶
adds a synthetic id attribute to node unless it’s already there.
- gavo.stc.stcxgen.astToStan(rootNode, stcRoot)[source]¶
returns STC stan for the AST rootNode wrapped in the stcRoot element.
The first coordinate system defined in the AST is always used for the embedded coordinates and areas.
- gavo.stc.stcxgen.makeAreas(rootNode, context)[source]¶
serializes the areas contained in rootNode.
This requires all kinds of insane special handling.
- gavo.stc.stcxgen.serialize_Intersection(node, context)¶
- gavo.stc.stcxgen.serialize_RedshiftCoo(node, context)¶
- gavo.stc.stcxgen.serialize_RedshiftInterval(node, context)¶
- gavo.stc.stcxgen.serialize_SpaceCoo(node, context)¶
- gavo.stc.stcxgen.serialize_SpaceInterval(node, context)¶
- gavo.stc.stcxgen.serialize_SpectralCoo(node, context)¶
- gavo.stc.stcxgen.serialize_SpectralInterval(node, context)¶
- gavo.stc.stcxgen.serialize_TimeCoo(node, context)¶
- gavo.stc.stcxgen.serialize_TimeInterval(node, context)¶
- gavo.stc.stcxgen.serialize_Union(node, context)¶
- gavo.stc.stcxgen.serialize_VelocityCoo(node, context)¶
- gavo.stc.stcxgen.serialize_VelocityInterval(node, context)¶