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).
|
addId(node)
adds a synthetic id attribute to node unless it's already there. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodeToStan(astNode)
returns xmlstan for an AST node. |
source code
|
|
|
astToStan(rootNode,
stcRoot)
returns STC stan for the AST rootNode wrapped in the stcRoot element. |
source code
|
|
|
|