incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1421959 - in /incubator/flex/whiteboard/mschmalle/falconjx: compiler.jx.tests/ compiler.jx/ compiler.jx/src/org/apache/flex/compiler/visitor/ compiler.jx/src/org/apache/flex/js/
Date Fri, 14 Dec 2012 16:21:58 GMT
Author: mschmalle
Date: Fri Dec 14 16:21:56 2012
New Revision: 1421959

URL: http://svn.apache.org/viewvc?rev=1421959&view=rev
Log:
Flex:FalconJx 
- moved walker and added IJSEmitter
- added bin, lib and temp to ignore

Added:
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java
  (with props)
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSEmitter.java
  (with props)
Removed:
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IASBlockVisitor.java
Modified:
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/   (props changed)
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/   (props changed)

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Dec 14 16:21:56 2012
@@ -0,0 +1,2 @@
+bin
+lib

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Dec 14 16:21:56 2012
@@ -0,0 +1,3 @@
+bin
+lib
+temp

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java?rev=1421959&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java
(added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java
Fri Dec 14 16:21:56 2012
@@ -0,0 +1,223 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.visitor;
+
+import org.apache.flex.compiler.internal.js.codgen.ASBlockWalker;
+import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
+import org.apache.flex.compiler.internal.tree.as.NamespaceAccessExpressionNode;
+import org.apache.flex.compiler.internal.visitor.ASNodeSwitch;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IBlockNode;
+import org.apache.flex.compiler.tree.as.ICatchNode;
+import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IConditionalNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IDefaultXMLNamespaceNode;
+import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
+import org.apache.flex.compiler.tree.as.IEmbedNode;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IForLoopNode;
+import org.apache.flex.compiler.tree.as.IFunctionCallNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IGetterNode;
+import org.apache.flex.compiler.tree.as.IIdentifierNode;
+import org.apache.flex.compiler.tree.as.IIfNode;
+import org.apache.flex.compiler.tree.as.IInterfaceNode;
+import org.apache.flex.compiler.tree.as.IIterationFlowNode;
+import org.apache.flex.compiler.tree.as.IKeywordNode;
+import org.apache.flex.compiler.tree.as.ILanguageIdentifierNode;
+import org.apache.flex.compiler.tree.as.ILiteralNode;
+import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
+import org.apache.flex.compiler.tree.as.INamespaceNode;
+import org.apache.flex.compiler.tree.as.INumericLiteralNode;
+import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
+import org.apache.flex.compiler.tree.as.IPackageNode;
+import org.apache.flex.compiler.tree.as.IParameterNode;
+import org.apache.flex.compiler.tree.as.IReturnNode;
+import org.apache.flex.compiler.tree.as.ISetterNode;
+import org.apache.flex.compiler.tree.as.ISwitchNode;
+import org.apache.flex.compiler.tree.as.ITerminalNode;
+import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IThrowNode;
+import org.apache.flex.compiler.tree.as.ITryNode;
+import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
+import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+import org.apache.flex.compiler.tree.as.IWithNode;
+import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
+import org.apache.flex.compiler.tree.metadata.IMetaTagsNode;
+import org.apache.flex.compiler.units.ICompilationUnit;
+
+/**
+ * The {@link IASBlockVisitor} interface allows an {@link IASNodeStrategy} to
+ * delegate within it's {@link IASNodeStrategy#handle(IASNode)} method to this
+ * API's visitor method.
+ * <p>
+ * Currently the {@link ASNodeSwitch} class is a monolithic if else statement
+ * using instanceof to switch on the correct {@link IASNode} interface type.
+ * This is where more experienced developers in Java might know a way that is
+ * more efficient but, currently it works well, performance on the instanceof
+ * will have to be determined.
+ * <p>
+ * <strong>Note</strong> This API is not complete.
+ * 
+ * @author Michael Schmalle
+ * 
+ * @see ASBlockWalker
+ */
+public interface IASBlockVisitor
+{
+    //--------------------------------------------------------------------------
+    // Top level nodes
+    //--------------------------------------------------------------------------
+
+    void visitCompilationUnit(ICompilationUnit unit);
+
+    void visitPackage(IPackageNode node);
+
+    void visitFile(IFileNode node);
+
+    void visitClass(IClassNode node);
+
+    void visitInterface(IInterfaceNode node);
+
+    //--------------------------------------------------------------------------
+    // Member nodes
+    //--------------------------------------------------------------------------
+
+    // block var or field
+    void visitVariable(IVariableNode node);
+
+    void visitFunction(IFunctionNode node);
+
+    // TODO (mschmalle) Figure out if the indirection is useful
+    void visitConstructor(IFunctionNode node);
+
+    void visitGetter(IGetterNode node);
+
+    void visitSetter(ISetterNode node);
+
+    void visitNamespace(INamespaceNode node);
+
+    //--------------------------------------------------------------------------
+    // Statement nodes
+    //--------------------------------------------------------------------------
+
+    void visitIf(IIfNode node);
+
+    void visitForLoop(IForLoopNode node);
+
+    void visitWhileLoop(IWhileLoopNode node);
+
+    void visitTry(ITryNode node);
+
+    void visitCatch(ICatchNode node);
+
+    void visitSwitch(ISwitchNode node);
+
+    void visitLabeledStatement(LabeledStatementNode node);
+
+    void visitWith(IWithNode node);
+
+    void visitThrow(IThrowNode node);
+
+    //--------------------------------------------------------------------------
+    // Statement helper nodes
+    //--------------------------------------------------------------------------
+
+    void visitIterationFlow(IIterationFlowNode node);
+
+    void visitConditional(IConditionalNode node);
+
+    // is a IVariableNode
+    void visitParameter(IParameterNode node);
+
+    void visitIObjectLiteralValuePair(IObjectLiteralValuePairNode node);
+
+    //--------------------------------------------------------------------------
+    // Expression Statement nodes
+    //--------------------------------------------------------------------------
+
+    void visitMemberAccessExpression(IMemberAccessExpressionNode node);
+
+    void visitNamespaceAccessExpression(NamespaceAccessExpressionNode node);
+
+    void visitLanguageIdentifierNode(ILanguageIdentifierNode node);
+
+    void visitReturn(IReturnNode node);
+
+    void visitDefaultXMLNamespace(IDefaultXMLNamespaceNode node);
+
+    void visitTypedExpression(ITypedExpressionNode node);
+
+    // this is a IBinaryOperatorNode goes before
+    void visitDynamicAccess(IDynamicAccessNode node);
+
+    void visitTernaryOperator(ITernaryOperatorNode node);
+
+    //--------------------------------------------------------------------------
+    // Container nodes
+    //--------------------------------------------------------------------------
+
+    // TODO (mschmalle) make sure IContainerNode and IBlock are explicitly different and
independent 
+    void visitContainer(IContainerNode node);
+
+    void visitBlock(IBlockNode node);
+
+    //--------------------------------------------------------------------------
+    // Expression nodes
+    //--------------------------------------------------------------------------
+
+    void visitFunctionCall(IFunctionCallNode node);
+
+    void visitBinaryOperator(IBinaryOperatorNode node);
+
+    void visitUnaryOperator(IUnaryOperatorNode node);
+
+    void visitExpression(IExpressionNode node);
+
+    //--------------------------------------------------------------------------
+    // Terminal like Expression nodes
+    //--------------------------------------------------------------------------
+
+    void visitIdentifier(IIdentifierNode node);
+
+    void visitKeyword(IKeywordNode node);
+
+    void visitLiteral(ILiteralNode node);
+
+    void visitNumericLiteral(INumericLiteralNode node);
+
+    void visitTerminal(ITerminalNode node);
+
+    //--------------------------------------------------------------------------
+    // Various nodes
+    //--------------------------------------------------------------------------
+
+    void visitMetaTags(IMetaTagsNode node);
+
+    void visitMetaTag(IMetaTagNode node);
+
+    void visitEmbed(IEmbedNode node);
+
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSEmitter.java?rev=1421959&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSEmitter.java
(added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSEmitter.java
Fri Dec 14 16:21:56 2012
@@ -0,0 +1,52 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.js;
+
+import java.io.Writer;
+
+import org.apache.flex.compiler.visitor.IASNodeStrategy;
+
+/**
+ * The {@link IJSEmitter} interface allows abstraction between the
+ * {@link IASNodeStrategy} and the current output buffer {@link Writer}.
+ * 
+ * @author Michael Schmalle
+ */
+public interface IJSEmitter
+{
+    /**
+     * Writes a string to the writer.
+     * 
+     * @param value The string to write to the output buffer.
+     */
+    void write(String value);
+
+    /**
+     * Pushes an indent into the emitter so after newlines are emitted, the
+     * output is correctly formatted.
+     */
+    void indentPush();
+
+    /**
+     * Pops an indent from the emitter so after newlines are emitted, the
+     * output is correctly formatted.
+     */
+    void indentPop();
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message