Package macromedia.asc.parser

Examples of macromedia.asc.parser.NodeFactory


    public int ExplicitVar( Context cx, ObjectValue ob, String name, Namespaces namespaces, TypeValue type, int expected_id, int method_id , int var_id )
    {
        int slot_id = super.ExplicitVar(cx,ob,name,namespaces,type,expected_id,-1/*method_id*/,-1/*var_id*/);
        ob.getSlot(cx,slot_id).addType(type.getDefaultTypeInfo());
        Slot slot = ob.getSlot(cx,slot_id);
        NodeFactory nf = cx.getNodeFactory();
        slot.setBaseNode(nf.memberExpression(null,nf.getExpression(nf.identifier(classname.toString(),0))));
        return slot_id;
    }
View Full Code Here


    public int ExplicitGet( Context cx, ObjectValue ob, String name, Namespaces namespaces, TypeValue type, boolean is_final, boolean is_override, int expected_id , int method_id , int var_id  )
    {
        int slot_id = super.ExplicitGet(cx,ob,name,namespaces,type,is_final,is_override,-1/*expected_id*/,-1/*method_id*/,-1/*var_id*/);
        Slot slot = ob.getSlot(cx,slot_id);
        NodeFactory nf = cx.getNodeFactory();
        slot.setBaseNode(nf.memberExpression(null,nf.getExpression(nf.identifier(classname.toString(),-1))));
        return slot_id;
    }
View Full Code Here

    public int ExplicitSet( Context cx, ObjectValue ob, String name, Namespaces namespaces, TypeValue type, boolean is_final, boolean is_override, int expected_id , int method_id , int var_id  )
    {
        int slot_id = super.ExplicitSet(cx,ob,name,namespaces,type,is_final,is_override,-1/*expected_id*/,-1/*method_id*/,-1/*var_id*/);
        Slot slot = ob.getSlot(cx,slot_id);
        NodeFactory nf = cx.getNodeFactory();
        slot.setBaseNode(nf.memberExpression(null,nf.getExpression(nf.identifier(classname.toString(),-1))));
        return slot_id;
    }
View Full Code Here

    TypeValue functionType = cx.useStaticSemantics() ? cx.functionType() : type;
    int slot_id = super.ExplicitCall(cx,ob,name,namespaces,functionType,is_final,is_override,-1/*expected_id*/,-1/*method_id*/,-1/*var_id*/);
        Slot slot = ob.getSlot(cx,slot_id);
    if (cx.useStaticSemantics())
      slot.setConst(true);
        NodeFactory nf = cx.getNodeFactory();
        slot.setBaseNode(nf.memberExpression(null,nf.getExpression(nf.identifier(classname.toString(),-1))));
        return slot_id;
    }
View Full Code Here

        contextId = contextIds++;
        if (statics != null)
        {
            if (statics.nodeFactory == null)
            {
                statics.nodeFactory = new NodeFactory(this);
            }
            if (statics.builtins == null)
            {
                statics.builtins = new HashMap<String, TypeValue>();
                statics.userDefined = new HashMap<String, TypeValue>();
View Full Code Here

    public NodeFactory getNodeFactory()
    {
        if (statics.nodeFactory == null)
        {
            statics.nodeFactory = new NodeFactory(this);
        }
        else
        {
            statics.nodeFactory.setContext(this);
        }
View Full Code Here

        Map<String, Boolean> parts = classInfo.getSkinParts(true);
       
       
        if(parts != null && parts.size() > 0)
        {
            NodeFactory nodeFactory = context.getNodeFactory();
           
            //Add our generated AST to the statements list
            node.statements = genSkinPartsAST(parts, nodeFactory, node.statements);
        }
View Full Code Here

                unit.expressions.add(NameFormatter.toMultiName(node.getValue(0)));
                ClassDefinitionNode classDef = (ClassDefinitionNode) def;

                if (!classDeclaresIdentifier(cx, classDef, typeAnalyzer, SKINHOSTCOMPONENT))
                {
                    NodeFactory nodeFactory = cx.getNodeFactory();
                    MetaDataNode bindingMetaData = AbstractSyntaxTreeUtil.generateMetaData(nodeFactory, BINDABLE);
                    bindingMetaData.setId(BINDABLE);
                    StatementListNode statementList = nodeFactory.statementList(classDef.statements, bindingMetaData);

                    int listSize = node.def.metaData.items.size();
                    // if the HostComponent metadata node has more than one items.
                    // then look for the associated comment and stick it to the variable.
                    if (listSize > 1)
                    {
                        for (int ix = 0; ix < listSize; ix++)
                        {
                            // check if the node is of type MetaDataNode.
                            Node tempMeta = node.def.metaData.items.get(ix);

                            if (tempMeta instanceof MetaDataNode)
                            {
                                MetaDataNode tempMetaData = (MetaDataNode) tempMeta;

                                if ("HostComponent".equals(tempMetaData.getId()) && (ix < listSize - 1))
                                {
                                    // if the node has the comment, it would be the next one.
                                    Node temp = node.def.metaData.items.get(ix + 1);

                                    // if the last one is a DocCommentnode, we can run it through the evaluator.
                                    if (temp instanceof DocCommentNode)
                                    {
                                        DocCommentNode tempDoc = ((DocCommentNode)temp);

                                        // we can not access the metadata node directly because it doesn't
                                        // have public access and it is buried deep into the tree.  this is
                                        // required so that we can access the comment easily.
                                        macromedia.asc.parser.MetaDataEvaluator evaluator =
                                            new macromedia.asc.parser.MetaDataEvaluator();
                                        evaluator.evaluate(cx, tempDoc);

                                        // if evaluator has not null comment.
                                        if (evaluator.doccomments != null && evaluator.doccomments.size() != 0)
                                        {
                                            String comment = evaluator.doccomments.get(0).getId();

                                            // if comment is present then create a DocCommentNode for the hostComponent variable
                                            if (comment != null)
                                            {
                                                DocCommentNode hostComponentComment =
                                                    AbstractSyntaxTreeUtil.generateDocComment(nodeFactory, comment.intern());

                                                if (hostComponentComment != null)
                                                {
                                                    statementList = nodeFactory.statementList(statementList, hostComponentComment);
                                                }
                                            }
                                        }

                                        break; // if we got here we already got the comment. now lets short circuit.
                                    }
                                }
                            }
                        }
                    }

                    TypeExpressionNode typeExpression = AbstractSyntaxTreeUtil.generateTypeExpression(nodeFactory, node.getValue(0), true);
                    VariableDefinitionNode variableDefinition = AbstractSyntaxTreeUtil.generatePublicVariable(cx, typeExpression, SKINHOSTCOMPONENT);

                    classDef.statements = nodeFactory.statementList(statementList, variableDefinition);
                   
                   
                    BindableFirstPassEvaluator firstPassEvaluator =
                        (BindableFirstPassEvaluator) unit.getContext().getAttribute(BindableExtension.FIRST_PASS_EVALUATOR_KEY);
                    if (firstPassEvaluator != null)
View Full Code Here

    super(unit, classMap, typeAnalyzer, generatedOutputDirectory, generateAbstractSyntaxTree, processComments);
  }

    private void addIEventDispatcherImplementation(Context context, ClassDefinitionNode classDefinition)
    {
        NodeFactory nodeFactory = context.getNodeFactory();
        MemberExpressionNode memberExpression =
            AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, FLASH_EVENTS,
                                                          I_EVENT_DISPATCHER, false);
        classDefinition.interfaces = nodeFactory.list(classDefinition.interfaces, memberExpression);

        VariableDefinitionNode variableDefinition = generateBindingEventDispatcherVariable(nodeFactory);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, variableDefinition);

        DocCommentNode docCommentNode = generateInheritDocComment(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, docCommentNode);
       
        FunctionDefinitionNode addEventListenerFunctionDefinition =
            generateAddEventListenerFunctionDefinition(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, addEventListenerFunctionDefinition);

        docCommentNode = generateInheritDocComment(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, docCommentNode);
       
        FunctionDefinitionNode dispatchEventFunctionDefinition =
            generateDispatchEventFunctionDefinition(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, dispatchEventFunctionDefinition);

        docCommentNode = generateInheritDocComment(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, docCommentNode);
       
        FunctionDefinitionNode hasEventListenerFunctionDefinition =
            generateHasEventListenerFunctionDefinition(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, hasEventListenerFunctionDefinition);

        docCommentNode = generateInheritDocComment(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, docCommentNode);
       
        FunctionDefinitionNode removeEventListenerFunctionDefinition =
            generateRemoveEventListenerFunctionDefinition(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, removeEventListenerFunctionDefinition);

        docCommentNode = generateInheritDocComment(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, docCommentNode);
       
        FunctionDefinitionNode willTriggerFunctionDefinition =
            generateWillTriggerFunctionDefinition(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, willTriggerFunctionDefinition);
    }
View Full Code Here

            nodeFactory.statementList(classDefinition.statements, willTriggerFunctionDefinition);
    }

    private void addStaticEventDispatcherImplementation(Context context, ClassDefinitionNode classDefinition)
    {
        NodeFactory nodeFactory = context.getNodeFactory();
        VariableDefinitionNode variableDefinition = generateStaticBindingEventDispatcherVariable(nodeFactory);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, variableDefinition);

        FunctionDefinitionNode addEventListenerFunctionDefinition =
            generateStaticEventDispatcherGetter(context);
        classDefinition.statements =
            nodeFactory.statementList(classDefinition.statements, addEventListenerFunctionDefinition);
    }
View Full Code Here

TOP

Related Classes of macromedia.asc.parser.NodeFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.