flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject svn commit: r1451312 - in /flex/falcon/trunk: compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/ compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/ compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/ compiler...
Date Thu, 28 Feb 2013 19:44:43 GMT
Author: erikdebruin
Date: Thu Feb 28 19:44:42 2013
New Revision: 1451312

URL: http://svn.apache.org/r1451312
Log:
Baby steps towards FalconJx MXML: the first two tests pass with actual MXML output. We have
lift-off!

Modified:
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitterTokens.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java?rev=1451312&r1=1451311&r2=1451312&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java
Thu Feb 28 19:44:42 2013
@@ -9,23 +9,34 @@ public class TestMXMLApplication extends
 {
 
     @Test
-    public void MXML_simple()
+    public void testSimple()
+    {
+        String code = "" +
+                "<s:Application xmlns:s=\"library://ns.adobe.com/flex/spark\">" +
+                "</s:Application>";
+        
+        IMXMLFileNode node = compileMXML(code);
+
+        mxmlBlockWalker.visitFile(node);
+        
+        assertOut("<Application>\n\t\n</Application>");
+    }
+
+    
+    @Test
+    public void testOneComponent()
     {
         String code = "" +
         		"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
         		"<s:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:s=\"library://ns.adobe.com/flex/spark\"
xmlns:mx=\"library://ns.adobe.com/flex/mx\">\n" +
-                "\n" +
-                "\t<fx:Declarations />\n" +
-                "\n" +
-                "\t<s:Button id=\"myBtn\" label=\"Hello world\" />\n" +
-                "\n" +
+                "\t<s:Button id=\"myBtn\" label=\"Hello world\"></s:Button>\n"
+
         		"</s:Application>";
         
         IMXMLFileNode node = compileMXML(code);
 
         mxmlBlockWalker.visitFile(node);
         
-        assertOut("Hello World ;-)");
+        assertOut("<Application>\n\t<Button id=\"myBtn\" label=\"Hello world\"></Button>\n</Application>");
     }
 
     @Ignore

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java?rev=1451312&r1=1451311&r2=1451312&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java
Thu Feb 28 19:44:42 2013
@@ -22,18 +22,21 @@ package org.apache.flex.compiler.interna
 import java.util.List;
 
 import org.apache.flex.compiler.definitions.IClassDefinition;
-import org.apache.flex.compiler.definitions.IPackageDefinition;
 import org.apache.flex.compiler.mxml.codegen.IMXMLEmitter;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.IASProject;
+import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStyleSpecifierNode;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;
 import org.apache.flex.compiler.visitor.IMXMLBlockVisitor;
@@ -46,8 +49,6 @@ public class MXMLBlockWalker implements 
 {
     private List<ICompilerProblem> errors;
 
-    private IMXMLBlockWalker visitor;
-
     private IMXMLEmitter emitter;
 
     //----------------------------------
@@ -94,46 +95,39 @@ public class MXMLBlockWalker implements 
         this.emitter = emitter;
         this.project = project;
         this.errors = errors;
-
-        this.visitor = emitter.getMXMLWalker();
+        emitter.setMXMLWalker(this);
     }
 
     public void visitFile(IMXMLFileNode node)
     {
         debug("visitFile()");
-        IMXMLClassDefinitionNode cnode = node.getDocumentNode();
-        walk(cnode);
+
+        walk(node.getDocumentNode());
+    }
+
+    public void visitDeclarations(IMXMLDeclarationsNode node)
+    {
+        debug("visitDeclarations()");
+
+        //
     }
 
     public void visitDocument(IMXMLDocumentNode node)
     {
         debug("visitDocument()");
-        // this might eventually need to check for parent being the file node
-        visitMainClassDefinition(node);
+
+        IClassDefinition cdef = node.getClassReference((ICompilerProject) project);
+
+        emitter.emitDocumentHeader(cdef);
+        visitClassDefinition(node);
+        emitter.emitDocumentFooter(cdef);
     }
 
-    public void visitMainClassDefinition(IMXMLClassDefinitionNode node)
+    public void visitClassDefinition(IMXMLClassDefinitionNode node)
     {
-        debug("visitMainClassDefinition()");
-        // we are at the root tags
-        // events, properties, declarations, 
-
-        IClassDefinition definition = node.getClassDefinition();
-        IPackageDefinition definition2 = (IPackageDefinition) definition
-                .getContainingScope().getDefinition();
-
-        emitter.emitPackageHeader(definition2);
-        //emitter.emitPackageHeaderContents(definition2);
-
-        // main contents of MXML are produced
-        IMXMLScriptNode[] snodes = node.getScriptNodes();
-        for (IMXMLScriptNode snode : snodes)
-        {
-            for (IASNode asnode : snode.getASNodes())
-            {
-                visitor.walk(asnode);
-            }
-        }
+        debug("visitClassDefinition()");
+
+        emitter.emitClass(node);
     }
 
     //--------------------------------------------------------------------------
@@ -141,6 +135,8 @@ public class MXMLBlockWalker implements 
     public void visitPropertySpecifier(IMXMLPropertySpecifierNode node)
     {
         debug("visitPropertySpecifier()");
+
+        emitter.emitPropertySpecifier(node);
     }
 
     public void visitEventSpecifier(IMXMLEventSpecifierNode node)
@@ -157,6 +153,8 @@ public class MXMLBlockWalker implements 
     public void visitInstance(IMXMLInstanceNode node)
     {
         debug("visitInstance()");
+        
+        emitter.emitInstance(node);
     }
 
     @Override
@@ -166,12 +164,28 @@ public class MXMLBlockWalker implements 
     }
 
     //--------------------------------------------------------------------------
-    // 
+
+    @Override
+    public void visitLiteral(IMXMLLiteralNode node)
+    {
+        debug("visitLiteral()");
+        
+        emitter.emitLiteral(node);
+    }
+    
+    @Override
+    public void visitString(IMXMLStringNode node)
+    {
+        debug("visitString()");
+        
+        emitter.emitString(node);
+    }
+
     //--------------------------------------------------------------------------
 
     protected void debug(String message)
     {
-        System.out.println(message);
+        //System.out.println(message);
     }
 
 }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java?rev=1451312&r1=1451311&r2=1451312&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java
Thu Feb 28 19:44:42 2013
@@ -21,9 +21,19 @@ package org.apache.flex.compiler.interna
 
 import java.io.FilterWriter;
 
-import org.apache.flex.compiler.definitions.IPackageDefinition;
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.internal.as.codegen.ASEmitterTokens;
 import org.apache.flex.compiler.internal.common.codegen.Emitter;
 import org.apache.flex.compiler.mxml.codegen.IMXMLEmitter;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 
 /**
  * The base implementation for an MXML emitter.
@@ -52,20 +62,122 @@ public class MXMLEmitter extends Emitter
 
     //--------------------------------------------------------------------------
 
-    public void emitPackageHeader(IPackageDefinition definition)
+    public void emitDocumentHeader(IClassDefinition definition)
     {
-        write("Hello World ;-)");
+        writeNewline("<" + definition.getBaseName() + ">", true);
+    }
+
+    public void emitDocumentFooter(IClassDefinition definition)
+    {
+        writeNewline("", false);
+        write("</" + definition.getBaseName() + ">");
+    }
+
+    //--------------------------------------------------------------------------
+
+    public void emitClass(IMXMLClassDefinitionNode node)
+    {
+        // script traversal
+        IMXMLScriptNode[] snodes = node.getScriptNodes();
+        if (snodes != null)
+        {
+            for (IMXMLScriptNode snode : snodes)
+            {
+                for (IASNode asnode : snode.getASNodes())
+                {
+                    getMXMLWalker().walk(asnode);
+                }
+            }
+        }
+
+        // property specifier traversal
+        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
+        if (pnodes != null)
+        {
+            for (IMXMLPropertySpecifierNode pnode : pnodes)
+            {
+                getMXMLWalker().walk(pnode);
+            }
+        }
+
+        // node traversal
+        IMXMLDeclarationsNode[] dnodes = node.getDeclarationsNodes();
+        if (dnodes != null)
+        {
+            for (IMXMLDeclarationsNode dnode : dnodes)
+            {
+                getMXMLWalker().walk(dnode);
+            }
+        }
+    }
+
+    //--------------------------------------------------------------------------
+
+    public void emitInstance(IMXMLInstanceNode node)
+    {
+        IClassDefinition cdef = node
+                .getClassReference((ICompilerProject) getMXMLWalker()
+                        .getProject());
+
+        String cname = cdef.getBaseName();
+
+        write("<");
+        write(cname);
+        write(ASEmitterTokens.SPACE);
+        write("id");
+        write(ASEmitterTokens.EQUAL);
+        write("\"");
+        write(node.getID());
+        write("\"");
+
+        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
+        final int len = pnodes.length;
+        if (len != 0)
+        {
+            for (int i = 0; i < len; i++)
+            {
+                getMXMLWalker().walk(pnodes[i]);
+            }
+        }
+
+        write(">");
+        write("<");
+        write("/");
+        write(cname);
+        write(">");
+    }
+
+    public void emitPropertySpecifier(IMXMLPropertySpecifierNode node)
+    {
+        boolean isMXMLContentFactory = node.getName().equals(
+                "mxmlContentFactory");
+
+        if (!isMXMLContentFactory)
+        {
+            write(ASEmitterTokens.SPACE);
+            write(node.getName());
+            write(ASEmitterTokens.EQUAL);
+        }
 
-//        IPackageNode node = definition.getNode();
-//        String name = node.getQualifiedName();
-//        if (name != null && !name.equals(""))
-//        {
-//            write(MXMLEmitterTokens.SPACE);
-//            getWalker().walk(node.getNameExpressionNode());
-//        }
-//
-//        write(MXMLEmitterTokens.SPACE);
-//        write(MXMLEmitterTokens.BLOCK_OPEN);
+        getMXMLWalker().walk(node.getInstanceNode());
     }
-    
+
+    //--------------------------------------------------------------------------
+
+    public void emitString(IMXMLStringNode node)
+    {
+        write("\"");
+
+        getMXMLWalker().walk(node.getChild(0));
+
+        write("\"");
+    }
+
+    //--------------------------------------------------------------------------
+
+    public void emitLiteral(IMXMLLiteralNode node)
+    {
+        write(node.getValue().toString());
+    }
+
 }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitterTokens.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitterTokens.java?rev=1451312&r1=1451311&r2=1451312&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitterTokens.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitterTokens.java
Thu Feb 28 19:44:42 2013
@@ -22,170 +22,11 @@ package org.apache.flex.compiler.interna
 import org.apache.flex.compiler.common.codegen.IEmitterTokens;
 
 /**
- * @author Michael Schmalle
  * @author Erik de Bruin
  */
 public enum MXMLEmitterTokens implements IEmitterTokens
 {
-    INDENT("\t"), NEW_LINE("\n"), SINGLE_QUOTE("'"), SPACE(" "),
-
-    INTERNAL("internal"), PRIVATE("private"), PROTECTED("protected"),
-
-    ANY_TYPE("*"), UNDEFINED("undefined"),
-
-    //    int EOF = 1;
-    //    int NULL_TREE_LOOKAHEAD = 3;
-    //    int HIDDEN_TOKEN_COMMENT = 4;
-    //    int HIDDEN_TOKEN_SINGLE_LINE_COMMENT = 5;
-    //    int HIDDEN_TOKEN_STAR_ASSIGNMENT = 6;
-    //    int HIDDEN_TOKEN_BUILTIN_NS = 7;
-    //    int HIDDEN_TOKEN_MULTI_LINE_COMMENT = 8;
-    //    int TOKEN_ASDOC_TAG = 9;
-    //    int TOKEN_ASDOC_TEXT = 10;
-    EACH("each"),
-    //    int TOKEN_RESERVED_WORD_CONFIG = 12;
-    //    int TOKEN_KEYWORD_INCLUDE = 13;
-    //    int TOKEN_RESERVED_WORD_GOTO = 14;
-    //    int TOKEN_IDENTIFIER = 15;
-    FINALLY("finally"),
-    CATCH("catch"),
-    //    int TOKEN_LITERAL_STRING = 18;
-    BLOCK_OPEN("{"),
-    BLOCK_CLOSE("}"),
-    //    int TOKEN_NAMESPACE_NAME = 21;
-    //    int TOKEN_OPERATOR_NS_QUALIFIER = 22;
-    //    int TOKEN_NAMESPACE_ANNOTATION = 23;
-    COLON(":"),
-    IMPORT("import"),
-    //    int TOKEN_KEYWORD_USE = 26;
-    NAMESPACE("namespace"),
-    //    int TOKEN_ASDOC_COMMENT = 28;
-    FINAL("final"),
-    DYNAMIC("dynamic"),
-    OVERRIDE("override"),
-    //    int TOKEN_MODIFIER_STATIC = 32;
-    //    int TOKEN_MODIFIER_NATIVE = 33;
-    //    int TOKEN_MODIFIER_VIRTUAL = 34;
-    MEMBER_ACCESS("."),
-    //    int TOKEN_ATTRIBUTE = 36;
-    SQUARE_OPEN("["),
-    PACKAGE("package"),
-    INTERFACE("interface"),
-    EXTENDS("extends"),
-    COMMA(","),
-    CLASS("class"),
-    IMPLEMENTS("implements"),
-    FUNCTION("function"),
-    PAREN_CLOSE(")"),
-    PAREN_OPEN("("),
-    GET("get"),
-    SET("set"),
-    ELLIPSIS("..."),
-    VAR("var"),
-    CONST("const"),
-    //    int TOKEN_OPERATOR_ASSIGNMENT = 52;
-    //    int TOKEN_DIRECTIVE_DEFAULT_XML = 53;
-    SEMICOLON(";"),
-    RETURN("return"),
-    THROW("throw"),
-    FOR("for"),
-    //    int TOKEN_KEYWORD_IN = 58;
-    DO("do"),
-    WHILE("while"),
-    //    int TOKEN_KEYWORD_CONTINUE = 61;
-    //    int TOKEN_KEYWORD_BREAK = 62;
-    WITH("with"),
-    TRY("try"),
-    IF("if"),
-    ELSE("else"),
-    SWITCH("switch"),
-    CASE("case"),
-    DEFAULT("default"),
-    SUPER("super"),
-    //    int TOKEN_TYPED_COLLECTION_OPEN = 71;
-    //    int TOKEN_TYPED_COLLECTION_CLOSE = 72;
-    GREATER_THAN(">"),
-    //    int TOKEN_OPERATOR_LOGICAL_AND_ASSIGNMENT = 74;
-    //    int TOKEN_OPERATOR_LOGICAL_OR_ASSIGNMENT = 75;
-    //    int TOKEN_OPERATOR_PLUS_ASSIGNMENT = 76;
-    //    int TOKEN_OPERATOR_MINUS_ASSIGNMENT = 77;
-    //    int TOKEN_OPERATOR_MULTIPLICATION_ASSIGNMENT = 78;
-    //    int TOKEN_OPERATOR_DIVISION_ASSIGNMENT = 79;
-    //    int TOKEN_OPERATOR_MODULO_ASSIGNMENT = 80;
-    //    int TOKEN_OPERATOR_BITWISE_AND_ASSIGNMENT = 81;
-    //    int TOKEN_OPERATOR_BITWISE_OR_ASSIGNMENT = 82;
-    //    int TOKEN_OPERATOR_BITWISE_XOR_ASSIGNMENT = 83;
-    //    int TOKEN_OPERATOR_BITWISE_LEFT_SHIFT_ASSIGNMENT = 84;
-    //    int TOKEN_OPERATOR_BITWISE_RIGHT_SHIFT_ASSIGNMENT = 85;
-    //    int TOKEN_OPERATOR_BITWISE_UNSIGNED_RIGHT_SHIFT_ASSIGNMENT = 86;
-    TERNARY("?"),
-    LOGICAL_OR("||"),
-    LOGICAL_AND("&&"),
-    //    int TOKEN_OPERATOR_BITWISE_OR = 90;
-    //    int TOKEN_OPERATOR_BITWISE_XOR = 91;
-    //    int TOKEN_OPERATOR_BITWISE_AND = 92;
-    EQUAL("="),
-    //    int TOKEN_OPERATOR_NOT_EQUAL = 94;
-    //    int TOKEN_OPERATOR_STRICT_EQUAL = 95;
-    STRICT_NOT_EQUAL("!=="),
-    //    int TOKEN_OPERATOR_GREATER_THAN_EQUALS = 97;
-    LESS_THAN("<"),
-    //    int TOKEN_OPERATOR_LESS_THAN_EQUALS = 99;
-    //    int TOKEN_KEYWORD_INSTANCEOF = 100;
-    IS("is"),
-    AS("as"),
-    //    int TOKEN_OPERATOR_BITWISE_LEFT_SHIFT = 103;
-    //    int TOKEN_OPERATOR_BITWISE_RIGHT_SHIFT = 104;
-    //    int TOKEN_OPERATOR_BITWISE_UNSIGNED_RIGHT_SHIFT = 105;
-    MINUS("-"),
-    //    int TOKEN_OPERATOR_PLUS = 107;
-    //    int TOKEN_OPERATOR_DIVISION = 108;
-    //    int TOKEN_OPERATOR_MODULO = 109;
-    //    int TOKEN_OPERATOR_STAR = 110;
-    //    int TOKEN_KEYWORD_DELETE = 111;
-    //    int TOKEN_OPERATOR_INCREMENT = 112;
-    //    int TOKEN_OPERATOR_DECREMENT = 113;
-    VOID("void"),
-    TYPEOF("typeof"),
-    //    int TOKEN_OPERATOR_BITWISE_NOT = 116;
-    //    int TOKEN_OPERATOR_LOGICAL_NOT = 117;
-    NULL("null"),
-    TRUE("true"),
-    //    int TOKEN_KEYWORD_FALSE = 120;
-    THIS("this"),
-    //    int TOKEN_VOID_0 = 122;
-    //    int TOKEN_LITERAL_REGEXP = 123;
-    //    int TOKEN_LITERAL_NUMBER = 124;
-    //    int TOKEN_LITERAL_HEX_NUMBER = 125;
-    SQUARE_CLOSE("]"),
-    //    int TOKEN_TYPED_LITERAL_OPEN = 127;
-    //    int TOKEN_TYPED_LITERAL_CLOSE = 128;
-    //    int TOKEN_E4X_WHITESPACE = 129;
-    //    int TOKEN_E4X_COMMENT = 130;
-    //    int TOKEN_E4X_CDATA = 131;
-    //    int TOKEN_E4X_PROCESSING_INSTRUCTION = 132;
-    //    int TOKEN_E4X_ENTITY = 133;
-    //    int TOKEN_E4X_DECIMAL_ENTITY = 134;
-    //    int TOKEN_E4X_HEX_ENTITY = 135;
-    //    int TOKEN_E4X_TEXT = 136;
-    //    int TOKEN_E4X_STRING = 137;
-    //    int TOKEN_E4X_OPEN_TAG_START = 138;
-    //    int TOKEN_E4X_CLOSE_TAG_START = 139;
-    //    int HIDDEN_TOKEN_E4X = 140;
-    //    int TOKEN_E4X_NAME = 141;
-    //    int TOKEN_E4X_TAG_END = 142;
-    //    int TOKEN_E4X_EMPTY_TAG_END = 143;
-    //    int TOKEN_E4X_XMLNS = 144;
-    //    int TOKEN_E4X_NAME_DOT = 145;
-    //    int TOKEN_E4X_DOTTED_NAME_PART = 146;
-    //    int TOKEN_E4X_EQUALS = 147;
-    //    int TOKEN_LITERAL_XMLLIST = 148;
-    //    int TOKEN_E4X_XMLLIST_CLOSE = 149;
-    //    int TOKEN_E4X_BINDING_OPEN = 150;
-    //    int TOKEN_E4X_BINDING_CLOSE = 151;
-    NEW("new"),
-    ATSIGN("@"),
-    //    int TOKEN_OPERATOR_DESCENDANT_ACCESS = 154;
+    TAG_OPEN("<"), TAG_CLOSE(">")
     ;
 
     private String token;

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java?rev=1451312&r1=1451311&r2=1451312&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java
Thu Feb 28 19:44:42 2013
@@ -20,8 +20,13 @@
 package org.apache.flex.compiler.internal.mxml.visitor;
 
 import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;
 import org.apache.flex.compiler.visitor.IMXMLBlockVisitor;
 
@@ -40,19 +45,32 @@ public class MXMLNodeSwitch implements I
     @Override
     public void handle(IASNode node)
     {
-        System.out.println(node.getNodeID().getParaphrase());
-        
         switch (node.getNodeID())
         {
+        case MXMLClassDefinitionID:
+            visitor.visitClassDefinition((IMXMLClassDefinitionNode) node);
+            break;
+        case MXMLDeclarationsID:
+            visitor.visitDeclarations((IMXMLDeclarationsNode) node);
+            break;
         case MXMLDocumentID:
             visitor.visitDocument((IMXMLDocumentNode) node);
             break;
+        case MXMLInstanceID:
+            visitor.visitInstance((IMXMLInstanceNode) node);
+            break;
+        case MXMLLiteralID:
+            visitor.visitLiteral((IMXMLLiteralNode) node);
+            break;
         case MXMLPropertySpecifierID:
             visitor.visitPropertySpecifier((IMXMLPropertySpecifierNode) node);
             break;
-
-        default:
+        case MXMLStringID:
+            visitor.visitString((IMXMLStringNode) node);
             break;
+            
+        default:
+            throw new IllegalArgumentException("No handler specified for nodes of type '"
+ node.getNodeID().getParaphrase() + "'");
         }
     }
 

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java?rev=1451312&r1=1451311&r2=1451312&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java
Thu Feb 28 19:44:42 2013
@@ -22,8 +22,13 @@ package org.apache.flex.compiler.mxml.co
 import java.io.Writer;
 
 import org.apache.flex.compiler.common.codegen.IEmitter;
-import org.apache.flex.compiler.definitions.IPackageDefinition;
+import org.apache.flex.compiler.definitions.IClassDefinition;
 import org.apache.flex.compiler.internal.mxml.codegen.MXMLBlockWalker;
+import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;
 import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
 
@@ -40,6 +45,26 @@ public interface IMXMLEmitter extends IE
 
     void setMXMLWalker(MXMLBlockWalker mxmlBlockWalker);
 
-    void emitPackageHeader(IPackageDefinition definition);
+    //--------------------------------------------------------------------------
 
+    void emitDocumentHeader(IClassDefinition definition);
+    void emitDocumentFooter(IClassDefinition definition);
+
+    //--------------------------------------------------------------------------
+
+    void emitClass(IMXMLClassDefinitionNode node);
+
+    //--------------------------------------------------------------------------
+
+    void emitInstance(IMXMLInstanceNode node);
+    void emitPropertySpecifier(IMXMLPropertySpecifierNode node);
+
+    //--------------------------------------------------------------------------
+
+    void emitString(IMXMLStringNode node);
+
+    //--------------------------------------------------------------------------
+
+    void emitLiteral(IMXMLLiteralNode node);
+    
 }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java?rev=1451312&r1=1451311&r2=1451312&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java
Thu Feb 28 19:44:42 2013
@@ -20,12 +20,15 @@
 package org.apache.flex.compiler.visitor;
 
 import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStyleSpecifierNode;
 
 /**
@@ -37,8 +40,10 @@ public interface IMXMLBlockVisitor
 
     void visitDocument(IMXMLDocumentNode node);
 
-    void visitMainClassDefinition(IMXMLClassDefinitionNode node);
+    void visitClassDefinition(IMXMLClassDefinitionNode node);
 
+    void visitDeclarations(IMXMLDeclarationsNode node);
+    
     //--------------------------------------------------------------------------
 
     void visitPropertySpecifier(IMXMLPropertySpecifierNode node);
@@ -51,4 +56,12 @@ public interface IMXMLBlockVisitor
 
     void visitScript(IMXMLScriptNode node);
 
+    //--------------------------------------------------------------------------
+
+    void visitString(IMXMLStringNode node);
+
+    //--------------------------------------------------------------------------
+
+    void visitLiteral(IMXMLLiteralNode node);
+    
 }



Mime
View raw message