flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshtynj...@apache.org
Subject [1/2] git commit: [flex-falcon] [refs/heads/feature/debugger-statement] - FLEX-35343 compiler/compiler-jx: added support for the debugger statement in generated JS. In SWF, it's a no-op for now.
Date Fri, 21 Jul 2017 23:37:36 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/feature/debugger-statement [created] 427d95c56


FLEX-35343 compiler/compiler-jx: added support for the debugger statement in generated JS.
In SWF, it's a no-op for now.


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/d4a38074
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/d4a38074
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/d4a38074

Branch: refs/heads/feature/debugger-statement
Commit: d4a38074bd5693756febcab059b2e9e18e167416
Parents: a877798
Author: Josh Tynjala <joshtynjala@apache.org>
Authored: Tue Jul 18 17:08:58 2017 -0700
Committer: Josh Tynjala <joshtynjala@apache.org>
Committed: Tue Jul 18 17:08:58 2017 -0700

----------------------------------------------------------------------
 .../flex/compiler/codegen/as/IASEmitter.java    |  3 +
 .../internal/codegen/as/ASBlockWalker.java      |  8 +++
 .../compiler/internal/codegen/as/ASEmitter.java |  7 ++
 .../internal/codegen/as/ASEmitterTokens.java    |  1 +
 .../compiler/internal/codegen/js/JSEmitter.java | 10 +++
 .../internal/codegen/js/jx/DebuggerEmitter.java | 44 ++++++++++++
 .../internal/visitor/as/ASNodeSwitch.java       |  5 ++
 .../compiler/visitor/as/IASBlockVisitor.java    |  3 +
 .../codegen/js/goog/TestGoogExpressions.java    |  9 +++
 .../js/sourcemaps/TestSourceMapExpressions.java |  9 +++
 .../compiler/internal/parsing/as/ASParser.g     | 23 ++++++
 .../compiler/constants/IASKeywordConstants.java |  1 +
 .../as/codegen/ABCGeneratingReducer.java        |  6 ++
 .../compiler/internal/parsing/as/ASToken.java   |  1 +
 .../parsing/as/StreamingASTokenizer.java        |  2 +
 .../compiler/internal/tree/as/DebuggerNode.java | 73 ++++++++++++++++++++
 .../apache/flex/compiler/tree/ASTNodeID.java    |  1 +
 .../flex/compiler/tree/as/IDebuggerNode.java    | 38 ++++++++++
 .../internal/as/codegen/CmcPatterns.jbg         |  4 ++
 .../compiler/internal/as/codegen/CmcRules.jbg   |  3 +
 .../internal/parsing/as/RawASTokenizer.lex      |  5 ++
 21 files changed, 256 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
index 077a824..35b3b8b 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
@@ -31,6 +31,7 @@ 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.IContainerNode;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IEmbedNode;
 import org.apache.flex.compiler.tree.as.IForLoopNode;
@@ -373,4 +374,6 @@ public interface IASEmitter extends INestingEmitter
 
     void emitBlockClose(IContainerNode node);
 
+    void emitDebugger(IDebuggerNode node);
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
index 5247583..492f750 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
@@ -34,6 +34,7 @@ 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.IContainerNode;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
 import org.apache.flex.compiler.tree.as.IDefaultXMLNamespaceNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IEmbedNode;
@@ -337,6 +338,13 @@ public class ASBlockWalker implements IASBlockVisitor, IASBlockWalker
     }
 
     @Override
+    public void visitDebugger(IDebuggerNode node)
+    {
+        debug("visitDebugger()");
+        emitter.emitDebugger(node);
+    }
+
+    @Override
     public void visitIf(IIfNode node)
     {
         debug("visitIf()");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index c34eadb..ffd11b2 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -52,6 +52,7 @@ 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.IContainerNode.ContainerType;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IEmbedNode;
@@ -1563,6 +1564,12 @@ public class ASEmitter implements IASEmitter, IEmitter
     {
         write(ASEmitterTokens.BLOCK_CLOSE);
     }
+    
+    @Override
+    public void emitDebugger(IDebuggerNode node)
+    {
+        
+    }
 
     @Override
     public String stringifyNode(IASNode node)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
index 9296a78..5ce2711 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
@@ -186,6 +186,7 @@ public enum ASEmitterTokens implements IEmitterTokens
     //    int TOKEN_E4X_BINDING_CLOSE = 151;
     NEW("new"),
     ATSIGN("@"),
+    DEBUGGER("debugger"),
     //    int TOKEN_OPERATOR_DESCENDANT_ACCESS = 154;
     ;
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index c70b98c..dd676d7 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -34,6 +34,7 @@ import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.jx.BlockCloseEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.BlockOpenEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.CatchEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.DebuggerEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.DoWhileLoopEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.DynamicAccessEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.ForLoopEmitter;
@@ -61,6 +62,7 @@ import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.ICatchNode;
 import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IForLoopNode;
@@ -120,6 +122,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     public ISubEmitter<IASNode> statementEmitter;
     public ISubEmitter<ILanguageIdentifierNode> languageIdentifierEmitter;
     public SourceMapDirectiveEmitter sourceMapDirectiveEmitter;
+    public ISubEmitter<IDebuggerNode> debuggerEmitter;
     
     @Override
     public JSSessionModel getModel()
@@ -169,6 +172,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         statementEmitter = new StatementEmitter(this);
         languageIdentifierEmitter = new LanguageIdentifierEmitter(this);
         sourceMapDirectiveEmitter = new SourceMapDirectiveEmitter(this);
+        debuggerEmitter = new DebuggerEmitter(this);
     }
 
     @Override
@@ -377,6 +381,12 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         blockCloseEmitter.emit(node);
     }
 
+    @Override
+    public void emitDebugger(IDebuggerNode node)
+    {
+        debuggerEmitter.emit(node);
+    }
+
     public void startMapping(ISourceLocation node)
     {
         startMapping(node, node.getLine(), node.getColumn());

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DebuggerEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DebuggerEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DebuggerEmitter.java
new file mode 100644
index 0000000..fed7de2
--- /dev/null
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DebuggerEmitter.java
@@ -0,0 +1,44 @@
+/*
+ *
+ *  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.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
+
+public class DebuggerEmitter extends JSSubEmitter implements
+        ISubEmitter<IDebuggerNode>
+{
+    public DebuggerEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IDebuggerNode node)
+    {
+        startMapping(node);
+        write(ASEmitterTokens.DEBUGGER);
+        System.out.println("emitting debugger!");
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/main/java/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
index cd64223..992f0e5 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
@@ -31,6 +31,7 @@ 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.IContainerNode;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
 import org.apache.flex.compiler.tree.as.IDefaultXMLNamespaceNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IEmbedNode;
@@ -282,6 +283,10 @@ public class ASNodeSwitch implements IASNodeStrategy
             visitor.visitLabeledStatement((LabeledStatementNode) node);
             return;
 
+        case DebuggerID:
+            visitor.visitDebugger((IDebuggerNode) node);
+            return;
+
         case BreakID:
         case ContinueID:
         case GotoID:

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/main/java/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
index db3cda0..ab5add0 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
@@ -27,6 +27,7 @@ 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.IContainerNode;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
 import org.apache.flex.compiler.tree.as.IDefaultXMLNamespaceNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IEmbedNode;
@@ -136,6 +137,8 @@ public interface IASBlockVisitor extends IBlockVisitor
 
     void visitThrow(IThrowNode node);
 
+    void visitDebugger(IDebuggerNode node);
+
     //--------------------------------------------------------------------------
     // Statement helper nodes
     //--------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java
index df0c1cc..862e7f9 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java
@@ -23,6 +23,7 @@ import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.codegen.as.TestExpressions;
 import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
 import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.INamespaceAccessExpressionNode;
@@ -35,6 +36,14 @@ import org.junit.Test;
  */
 public class TestGoogExpressions extends TestExpressions
 {
+    @Test
+    public void testVisitDebugger()
+    {
+        IDebuggerNode node = (IDebuggerNode) getNode("debugger", IDebuggerNode.class);
+        asBlockWalker.visitDebugger(node);
+        assertOut("debugger");
+    }
+
     @Override
     @Test
     public void testVisitLanguageIdentifierNode_SuperMethod_1()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
index 8fa13d6..4a65629 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@ -24,6 +24,7 @@ import org.apache.flex.compiler.internal.test.SourceMapTestBase;
 import org.apache.flex.compiler.internal.tree.as.ArrayLiteralNode;
 import org.apache.flex.compiler.internal.tree.as.ObjectLiteralNode;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IIterationFlowNode;
@@ -872,6 +873,14 @@ public class TestSourceMapExpressions extends SourceMapTestBase
         assertMapping(node, 0, 6, 0, 6, 0, 7); // )
     }
 
+    @Test
+    public void testVisitDebugger()
+    {
+        IDebuggerNode node = (IDebuggerNode) getNode("debugger", IDebuggerNode.class);
+        asBlockWalker.visitDebugger(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 8); // debugger
+    }
+
     protected IBackend createBackend()
     {
         return new FlexJSBackend();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
----------------------------------------------------------------------
diff --git a/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
b/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
index 1d7a283..49ff269 100644
--- a/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
+++ b/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
@@ -332,6 +332,7 @@ statement[ContainerNode c, int exitCondition]
     final int la2 = LA(2);
 }
     :   breakOrContinueStatement[c]
+    |   debuggerStatement[c]
     |   defaultXMLNamespaceStatement[c]
     |   gotoStatement[c]                 
     |   emptyStatement
@@ -1608,6 +1609,28 @@ breakOrContinueStatement[ContainerNode c]
     ;
     exception catch [RecognitionException ex] {handleParsingError(ex); }
  	
+ 	
+/**
+ * Matches a "debugger statement" or a "continue statement". For example:
+ *
+ *    debugger;
+ *
+ */
+debuggerStatement[ContainerNode c]
+{ 
+    IdentifierNode id = null; 
+    DebuggerNode n = null; 
+    final ASToken t = LT(1);
+}
+    :   ( TOKEN_KEYWORD_DEBUGGER ) 
+    	{ 
+    		n = new DebuggerNode(t);
+    		c.addItem(n);
+    		matchOptionalSemicolon();
+    	}
+    ;
+    exception catch [RecognitionException ex] {handleParsingError(ex); }
+ 	
 /**
  * Matches a "goto" statement.
  */

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/java/org/apache/flex/compiler/constants/IASKeywordConstants.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/constants/IASKeywordConstants.java
b/compiler/src/main/java/org/apache/flex/compiler/constants/IASKeywordConstants.java
index 5f77c0e..7112152 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/constants/IASKeywordConstants.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/constants/IASKeywordConstants.java
@@ -34,6 +34,7 @@ public interface IASKeywordConstants
     static final String CONFIG = "config";
     static final String CONST = "const";
     static final String CONTINUE = "continue";
+    static final String DEBUGGER = "debugger";
     static final String DELETE = "delete";
     static final String DEFAULT = "default";
     static final String DEFAULT_XML_NAMESPACE = "default xml namespace";

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/java/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java
index c712f56..359d32d 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java
@@ -3222,6 +3222,12 @@ public class ABCGeneratingReducer
         return SemanticUtils.getBooleanContent(iNode);
     }
 
+    public InstructionList reduce_debuggerStmt(IASNode iNode)
+    {
+        //TODO: make runtime pause in debugger -JT
+        return createInstructionList(iNode);
+    }
+
     public InstructionList reduce_breakStmt(IASNode iNode)
     {
         try

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/ASToken.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/ASToken.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/ASToken.java
index 3782a0f..a2fa79b 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/ASToken.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/ASToken.java
@@ -549,6 +549,7 @@ public class ASToken extends TokenBase implements IASToken, ASTokenTypes
             case TOKEN_KEYWORD_DEFAULT:
             case TOKEN_KEYWORD_DELETE:
             case TOKEN_KEYWORD_DO:
+            case TOKEN_KEYWORD_DEBUGGER:
             case TOKEN_KEYWORD_ELSE:
             case TOKEN_KEYWORD_FALSE:
             case TOKEN_KEYWORD_FINALLY:

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
index d081e91..28be735 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
@@ -145,6 +145,7 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer,
Closeab
             .put(IASKeywordConstants.THIS, TOKEN_KEYWORD_THIS)
             .put(IASKeywordConstants.VOID, TOKEN_KEYWORD_VOID)
             .put(IASKeywordConstants.RETURN, TOKEN_KEYWORD_RETURN)
+            .put(IASKeywordConstants.DEBUGGER, TOKEN_KEYWORD_DEBUGGER)
             .build();
 
     /**
@@ -1183,6 +1184,7 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer,
Closeab
                 case TOKEN_BLOCK_OPEN:
                 case TOKEN_BLOCK_CLOSE:
                 case TOKEN_KEYWORD_FUNCTION:
+                case TOKEN_KEYWORD_DEBUGGER:
                     return retVal;
                 case HIDDEN_TOKEN_MULTI_LINE_COMMENT:
                 case HIDDEN_TOKEN_SINGLE_LINE_COMMENT:

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/DebuggerNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/DebuggerNode.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/DebuggerNode.java
new file mode 100644
index 0000000..02cbdf6
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/DebuggerNode.java
@@ -0,0 +1,73 @@
+/*
+ *
+ *  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.internal.tree.as;
+
+import org.apache.flex.compiler.parsing.IASToken;
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IDebuggerNode;
+
+/**
+ * Represents a statement that tells the runtime to enter the debugger.
+ */
+public class DebuggerNode extends ExpressionNodeBase implements IDebuggerNode
+{
+    /**
+     * Constructor.
+     */
+    public DebuggerNode(IASToken debuggerToken)
+    {
+        super();
+        if (debuggerToken != null)
+        {
+            startBefore(debuggerToken);
+            endAfter(debuggerToken);
+        }
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param other The node to copy.
+     */
+    protected DebuggerNode(DebuggerNode other)
+    {
+        super(other);
+    }
+
+    //
+    // NodeBase overrides
+    //
+
+    @Override
+    public ASTNodeID getNodeID()
+    {
+        return ASTNodeID.DebuggerID;
+    }
+
+    //
+    // ExpressionNodeBase overrides
+    //
+
+    @Override
+    protected DebuggerNode copy()
+    {
+        return new DebuggerNode(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/java/org/apache/flex/compiler/tree/ASTNodeID.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/tree/ASTNodeID.java b/compiler/src/main/java/org/apache/flex/compiler/tree/ASTNodeID.java
index 7fd2919..7454cc4 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/tree/ASTNodeID.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/tree/ASTNodeID.java
@@ -52,6 +52,7 @@ public enum ASTNodeID
     ConfigBlockID("CONFIG"),
     ContainerID(null),
     ContinueID("continue"),
+    DebuggerID("debugger"),
     DefaultID("default"),
     DefaultXMLStatementID(null),
     DoWhileLoopID("do"),

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/java/org/apache/flex/compiler/tree/as/IDebuggerNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/tree/as/IDebuggerNode.java b/compiler/src/main/java/org/apache/flex/compiler/tree/as/IDebuggerNode.java
new file mode 100644
index 0000000..5a80bc9
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/tree/as/IDebuggerNode.java
@@ -0,0 +1,38 @@
+/*
+ *
+ *  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.tree.as;
+
+
+/**
+ * An AST node representing a <code>debugger</code> statement.
+ * <p>
+ * The shape of this node is:
+ * <pre>
+ * IDebuggerNode
+ * </pre>
+ * For example, <pre>debugger;</pre> is represented as
+ * <pre>
+ * IDebuggerNode
+ * </pre>
+ * There are no child nodes
+ */
+public interface IDebuggerNode extends IExpressionNode
+{
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcPatterns.jbg
----------------------------------------------------------------------
diff --git a/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcPatterns.jbg
b/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcPatterns.jbg
index 0a7105d..0dde1b9 100644
--- a/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcPatterns.jbg
+++ b/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcPatterns.jbg
@@ -127,6 +127,10 @@ BlockID(statement stmts*);
 Pattern configBlockStmt
 ConfigBlockID(statement stmts*);
 
+//  debugger;
+Pattern debuggerStmt  
+DebuggerID(void);
+
 //  break;
 Pattern breakStmt  
 BreakID(void);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcRules.jbg
----------------------------------------------------------------------
diff --git a/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcRules.jbg
b/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcRules.jbg
index 18be2dc..e08a85d 100644
--- a/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcRules.jbg
+++ b/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcRules.jbg
@@ -198,6 +198,9 @@ JBurg.Reduction reducer.reduce_returnVoid(__p);
 statement = Pattern returnNil: 1
 JBurg.Reduction reducer.reduce_returnVoid(__p);
 
+statement = Pattern debuggerStmt: 1
+JBurg.Reduction reducer.reduce_debuggerStmt(__p);
+
 statement = Pattern breakStmt: 1
 JBurg.Reduction reducer.reduce_breakStmt(__p);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d4a38074/compiler/src/main/jflex/org/apache/flex/compiler/internal/parsing/as/RawASTokenizer.lex
----------------------------------------------------------------------
diff --git a/compiler/src/main/jflex/org/apache/flex/compiler/internal/parsing/as/RawASTokenizer.lex
b/compiler/src/main/jflex/org/apache/flex/compiler/internal/parsing/as/RawASTokenizer.lex
index 5c93547..f89bbf1 100644
--- a/compiler/src/main/jflex/org/apache/flex/compiler/internal/parsing/as/RawASTokenizer.lex
+++ b/compiler/src/main/jflex/org/apache/flex/compiler/internal/parsing/as/RawASTokenizer.lex
@@ -287,6 +287,11 @@ REGEX_CLASS="[" ({REGEX_ESCAPE}|[^\n\r\]\\])* "]"
 	return buildToken(TOKEN_KEYWORD_NEW, IASKeywordConstants.NEW);
 }
 
+<YYINITIAL> "debugger"
+{
+	return buildToken(TOKEN_KEYWORD_DEBUGGER, IASKeywordConstants.DEBUGGER);
+}
+
 // Identifier
 <YYINITIAL> {ID_FIRST}({ID_FOLLOW})*
 {


Mime
View raw message