def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     for initNode in astNode.getChildrenById('init'):
         initNode.setId('')
         res.addChild(initNode)
     
     return res
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     fileNode = astNode.getChildById('file')
     fileName = fileNode.getText().strip('"').strip("'")
     res.addChild(AstNode('file', fileName))
     
     return res
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     nameNode = AstNode('name', astNode.getChildById('name').getText())
     res.addChild(nameNode)
     
     util.addChild(astNode, res, 'value')
     
     return res       
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     nameNode = astNode.getChildById('name')
     res.addChild(AstNode('name', nameNode.getText()))
     
     util.addOptionalChildren(astNode, res, 'code')
     
     return res
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     nameNode = AstNode('name', astNode.getChildById('name').getText())
     res.addChild(nameNode)
     
     util.addOptionalChild(astNode, res, 'result')
     util.addOptionalChildren(astNode, res, 'parameter')
     
     return res
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     res.addChild(AstNode('name', astNode.getChildById('name').getText()))
     
     for child in astNode.getChildrenById('content'):
         child.setId('')
         res.addChild(child)
     
     return res
def _gt_transform(astNode):

    node = astNode.getChildById("id")
    if node:
        res = AstNode(_PropGType.name, node.getText())
    else:
        node = astNode.getChildById("typeName")
        res = AstNode(_PropGType.name)
        node.setId("")
        res.addChild(node)

    return res
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     nameNode = astNode.getChildById('interfaceName')
     res.addChild(AstNode('name', nameNode.getText()))
     
     util.addOptionalChild(astNode, res, 'prefix')
     util.addOptionalChildren(astNode, res, 'method')
     util.addOptionalChildren(astNode, res, 'signal')
     
     return res
def _code_transform(astNode):
    
    nameNode = astNode.getChildById('name')
    valNode = astNode.getChildById('value')
    
    if not valNode:
        res = AstNode('code', nameNode.getText())
    else:
        res = AstNode('code')
        res.addChild(AstNode('name', nameNode.getText()))
        res.addChild(AstNode('value', valNode.getText()))
    
    return res
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     typeNode = astNode.getChildById('type')
     typeNode.setId('')
     res.addChild(typeNode)
     
     modifiersNode = astNode.getChildById('modifiers')
     if modifiersNode:
         res.addChild(AstNode('const'))
                  
     return res
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     for node in astNode.getChildrenById('parameter'):
         node.setId('')
         res.addChild(node)
         
     node = astNode.getChildById('initProps')
     if node:
         node.setId('')
         res.addChild(node)
     
     return res
def _lc_transform(astNode):
    
    valueNode = astNode.getChildById('value')
    if valueNode:
        text = valueNode.getText()
        text = text[1:-1]
        return AstNode('value', text)
        
    enumNode = astNode.getChildById('enum')
    if enumNode:
        res = AstNode('codeValue')
        res.addChild(AstNode('enum', enumNode.getText()))
        codeNode = astNode.getChildById('code')
        res.addChild(AstNode('code', codeNode.getText()))
        return res
    
    raise Exception('Literal or code cannot be transformed')
def prop_transform(astNode):

    res = AstNode(Property.name)

    node = astNode.getChildById("name")
    res.addChild(AstNode("name", node.getText()))

    util.addOptionalChild(astNode, res, "type")

    util.addOptionalChild(astNode, res, "access")

    node = astNode.getChildById("description")
    if node:
        res.addChild(AstNode("description", node.getText()))

    util.addOptionalChild(astNode, res, "gtype")

    util.addOptionalChild(astNode, res, "max")
    util.addOptionalChild(astNode, res, "min")
    util.addOptionalChild(astNode, res, "default")

    node = astNode.getChildById("auto")
    if node:
        res.addChild(AstNode("autoCreate"))

    return res
    def transform(self, astNode):
        
        res = AstNode(self.getName())
        
        nameNode = AstNode('name', astNode.getChildById('name').getText())
        res.addChild(nameNode)
            
        util.addOptionalChildren(astNode, res, 'parameter')
        util.addOptionalChild(astNode, res, 'result')
        util.addOptionalChild(astNode, res, 'visi')
        util.addOptionalChild(astNode, res, 'inh')
        util.addOptionalChild(astNode, res, 'scope')

        node = astNode.getChildById('further_params')
        if node:
            res.addChild(AstNode('further_params'))
 
        return res
def argtype_transform(astNode):
    
    for ident in ['type', 'reference', 'list']:
        
        node = astNode.getChildById(ident)
        if not node:
            continue
        node.setId('')
        
        if ident == 'type':
            return AstNode('type', node.getText())
        else:
            res = AstNode(ident)
            argNode = astNode.getChildById('arg')
            argNode.setId('')
            res.addChild(argNode)
            return res

    raise Exception('AST transformation failed')
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     
     nameNode = astNode.getChildById('classname')
     res.addChild(AstNode('name', nameNode.getText()))
     
     self._addOptionalChild(res, astNode, 'super')
     self._addOptionalChild(res, astNode, 'abstract')
     self._addOptionalChild(res, astNode, 'final')
     self._addOptionalChild(res, astNode, 'prefix')
     self._addOptionalChildren(res, astNode, 'implements')
     self._addOptionalChild(res, astNode, 'constructor')
     self._addOptionalChildren(res, astNode, 'method')
     self._addOptionalChildren(res, astNode, 'override')
     self._addOptionalChildren(res, astNode, 'attr')
     self._addOptionalChildren(res, astNode, 'prop')
     self._addOptionalChildren(res, astNode, 'signal')
     
     return res
 def transform(self, astNode):
     
     res = AstNode(self.getName())
     res.addChild(AstNode('name', astNode.getChildById('name').getText()))
     
     typeNode = astNode.getChildById('type')
     typeNode.setId('')
     res.addChild(typeNode)
     
     modifiersNode = astNode.getChildById('modifiers')
     if modifiersNode:
         res.addChild(AstNode('const'))
         
     bindNode = astNode.getChildById('bindProperty')
     if bindNode:
         propIdNode = astNode.getChildById('propertyId')
         res.addChild(AstNode('bindProperty', propIdNode.getText()))
         
     return res
def _transform(astNode):
    
    res = AstNode('attribute')
    
    res.addChild(AstNode('name', astNode.getChildById('name').getText()))
    
    node = astNode.getChildById('type')
    node.setId('')
    res.addChild(node)
    
    node = astNode.getChildById('visi')
    if node:
        node.setId('')
        res.addChild(node)

    node = astNode.getChildById('scope')
    if node:
        node.setId('')
        res.addChild(node)
        
    return res