You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2014/07/25 14:46:30 UTC
[3/3] git commit: [flex-falcon] [refs/heads/falcon-antlr4] - - Added
the usage of the new jburg-maven-plugin - Started converting the falcon jburg
1.0 definitions to 2.0
- Added the usage of the new jburg-maven-plugin
- Started converting the falcon jburg 1.0 definitions to 2.0
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/a185d7ee
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/a185d7ee
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/a185d7ee
Branch: refs/heads/falcon-antlr4
Commit: a185d7ee151fd65954d1363227ce0e6fc30dc4d2
Parents: 59f6373
Author: cdutz <ch...@c-ware.de>
Authored: Fri Jul 25 14:46:11 2014 +0200
Committer: cdutz <ch...@c-ware.de>
Committed: Fri Jul 25 14:46:11 2014 +0200
----------------------------------------------------------------------
.../as/codegen/JSGeneratingReducer.java | 2 +-
compiler/pom.xml | 192 +---
.../apache/flex/compiler/internal/css/CSS.g4 | 12 +-
.../as/codegen/ABCGeneratingReducer.java | 2 +-
.../css/codegen/CSSCompilationSession.java | 11 +-
.../compiler/internal/as/codegen/CmcEmitter.jbg | 244 +++++
.../internal/as/codegen/CmcPatterns.jbg | 428 ++++----
.../compiler/internal/as/codegen/CmcRules.jbg | 1008 +++++++++---------
.../as/codegen/CompoundAssignmentPatterns.jbg | 10 +-
.../as/codegen/CompoundAssignmentRules.jbg | 20 +-
.../codegen/CompoundLogicalAssignmentRules.jbg | 22 +-
.../internal/as/codegen/ConstantArithmetic.jbg | 8 +-
.../internal/as/codegen/FunctionPatterns.jbg | 4 +-
.../internal/as/codegen/FunctionRules.jbg | 10 +-
.../flex/compiler/internal/as/codegen/cmc.jbg | 245 -----
.../internal/css/codegen/CSSEmitter.jbg | 57 +
.../internal/css/codegen/CSSPatterns.jbg | 26 +-
.../compiler/internal/css/codegen/CSSRules.jbg | 52 +-
.../flex/compiler/internal/css/codegen/css.jbg | 58 -
19 files changed, 1120 insertions(+), 1291 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a185d7ee/compiler.js/src/org/apache/flex/compiler/internal/as/codegen/JSGeneratingReducer.java
----------------------------------------------------------------------
diff --git a/compiler.js/src/org/apache/flex/compiler/internal/as/codegen/JSGeneratingReducer.java b/compiler.js/src/org/apache/flex/compiler/internal/as/codegen/JSGeneratingReducer.java
index 6bc7bd4..a165082 100644
--- a/compiler.js/src/org/apache/flex/compiler/internal/as/codegen/JSGeneratingReducer.java
+++ b/compiler.js/src/org/apache/flex/compiler/internal/as/codegen/JSGeneratingReducer.java
@@ -1238,7 +1238,7 @@ public class JSGeneratingReducer
/**
* generateFunctionBody() wrapper suitable for calling from the BURM. See
* JBurg ENHRQ <N> : the grammar that accepts the BURM's parameters to a
- * JBurg.Reduction routine doesn't grok function calls, so the BURM cannot
+ * @Reduction routine doesn't grok function calls, so the BURM cannot
* call generateFunctionBody(body, name.getName());
*/
String generateFunctionBody(IASNode iNode, String function_body, Binding return_type)
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a185d7ee/compiler/pom.xml
----------------------------------------------------------------------
diff --git a/compiler/pom.xml b/compiler/pom.xml
index f81242a..9939532 100644
--- a/compiler/pom.xml
+++ b/compiler/pom.xml
@@ -12,204 +12,51 @@
</parent>
<artifactId>compiler</artifactId>
+ <packaging>pom</packaging>
+
<name>Falcon Compiler</name>
<description>The Falcon compiler</description>
<properties>
<javac.debug>true</javac.debug>
<javac.deprecation>false</javac.deprecation>
-
- <jburg.input.file>${project.basedir}/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/cmc.jbg</jburg.input.file>
- <jburg.output.diectory>${project.build}/generated-sources/jburg/org/apache/flex/compiler/internal/as/codegen</jburg.output.diectory>
- <jburg.output.file>CmcEmitter.java</jburg.output.file>
</properties>
- <packaging>pom</packaging>
-
-
-
<build>
<plugins>
- <!--plugin>
- <groupId>de.jflex</groupId>
- <artifactId>jflex-maven-plugin</artifactId>
- <version>1.5.0</version>
- <configuration>
- <outputDirectory>${project.build.directory}/generated/src</outputDirectory>
- <skeleton>
- ${project.build.sourceDirectory}/org/apache/flex/compiler/internal/parsing/as/skeleton.default
- </skeleton>
- </configuration>
- <executions>
- <execution>
- <id>raw.as.tokenizer</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <lexDefinitions>
- <lexDefinition>
- ${project.build.sourceDirectory}/org/apache/flex/compiler/internal/parsing/as/RawASTokenizer.lex
- </lexDefinition>
- </lexDefinitions>
- <skeleton>
- ${project.build.sourceDirectory}/org/apache/flex/compiler/internal/parsing/as/skeleton.falcon
- </skeleton>
- </configuration>
- </execution>
- <execution>
- <id>raw.asdoc.tokenizer</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <lexDefinitions>
- <lexDefinition>
- ${project.build.sourceDirectory}/org/apache/flex/compiler/internal/parsing/as/RawASDocTokenizer.lex
- </lexDefinition>
- </lexDefinitions>
- </configuration>
- </execution>
- <execution>
- <id>raw.mxml.tokenizer</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <lexDefinitions>
- <lexDefinition>
- ${project.build.sourceDirectory}/org/apache/flex/compiler/internal/parsing/mxml/RawMXMLTokenizer.lex
- </lexDefinition>
- </lexDefinitions>
- </configuration>
- </execution>
- </executions>
- </plugin-->
-
- <!-- ANTLR -->
- <!--plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>antlr-maven-plugin</artifactId>
- <version>2.2.1</version>
- <configuration>
- <sourceDirectory>${project.build.sourceDirectory}/org/apache/flex/compiler/internal/parsing/as</sourceDirectory>
- <outputDirectory>${project.build.directory}/generated/src</outputDirectory>
- </configuration>
- <executions>
- <- Generating ASParser and ASTokenTypes ->
- <execution>
- <id>parseAS</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <grammarDefs>
- <grammar>
- <name>ASParser.g</name>
- </grammar>
- <grammar>
- <name>MetadataParser.g</name>
- </grammar>
- </grammarDefs>
- <sourceDirectory>${project.build.sourceDirectory}/org/apache/flex/compiler/internal/parsing/as</sourceDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.antlr</groupId>
- <artifactId>antlr3-maven-plugin</artifactId>
- <version>3.5.1</version>
- <configuration>
- <sourceDirectory>${project.build.sourceDirectory}/org/apache/flex/compiler/internal/css</sourceDirectory>
- <outputDirectory>${project.build.directory}/generated/src/org/apache/flex/compiler/internal/css</outputDirectory>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr-runtime</artifactId>
- <version>3.5.1</version>
- </dependency>
- </dependencies>
+ <artifactId>antlr4-maven-plugin</artifactId>
+ <version>4.3</version>
<executions>
- <- Generating ASParser and ASTokenTypes ->
<execution>
- <id>parseCSS</id>
<goals>
- <goal>antlr</goal>
+ <goal>antlr4</goal>
</goals>
</execution>
</executions>
- </plugin-->
-
-
- <!--<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>apt-maven-plugin</artifactId>
- <version>1.0-alpha-5</version>
+ </plugin>
+ <plugin>
+ <groupId>net.sourceforge.jburg</groupId>
+ <artifactId>jburg-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
<executions>
<execution>
+ <id>generate-cmc-emitter</id>
<goals>
- <goal>process</goal>
+ <goal>generate</goal>
</goals>
<configuration>
- <includes>
- <include>generated/src/org/apache/flex/compiler/internal/parsing/as/ASParser.java</include>
- </includes>
- <factory>@SuppressWarnings("unused")</factory>
-
+ <inputFile>org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg</inputFile>
</configuration>
</execution>
- </executions>
- </plugin>-->
- <!-- The AnnotateClass tool is used to add @SupressWarnings annotations to Java code produced by ANTLR and JBurg -->
- <!--<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <debug>${javac.debug}</debug>
- <showDeprecation>${javac.deprecation}</showDeprecation>
- <compilerArgument>-Xlint:all,-path,-fallthrough</compilerArgument>
- <source>tools/AnnotateClass</source>
- <generatedSourcesDirectory>generated/classes</generatedSourcesDirectory>
- </configuration>
- <goals>
- <goal>compile</goal>
- </goals>
- </plugin>-->
- <plugin>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-maven-plugin</artifactId>
- <version>4.3</version>
- <executions>
- <execution>
- <goals>
- <goal>antlr4</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.3.1</version>
- <executions>
<execution>
- <phase>generate-sources</phase>
+ <id>generate-css-emitter</id>
<goals>
- <goal>java</goal>
+ <goal>generate</goal>
</goals>
<configuration>
- <mainClass>jburg.burg.JBurgMain</mainClass>
- <arguments>
- <argument>${jburg.input.file}</argument>
- <argument>-outputdir</argument>
- <argument>${jburg.output.diectory}</argument>
- <argument>-outputfile</argument>
- <argument>${jburg.output.file}</argument>
- <argument>-g</argument>
- </arguments>
+ <inputFile>org/apache/flex/compiler/internal/css/codegen/CSSEmitter.jbg</inputFile>
</configuration>
</execution>
</executions>
@@ -242,13 +89,6 @@
<artifactId>guava</artifactId>
<version>17.0</version>
</dependency>
- <!-- JBurg - http://downloads.sourceforge.net/project/jburg/jburg-1.10.1.tar.gz
- (warning! this is not available publicly, I'm using a private maven repo for this one) -->
- <dependency>
- <groupId>net.sourceforge</groupId>
- <artifactId>jburg</artifactId>
- <version>1.10.1</version>
- </dependency>
<!-- lzma-sdk - http://downloads.sourceforge.net/project/sevenzip/LZMA%20SDK/lzma920.tar.bz2 -->
<dependency>
<groupId>com.github.jponge</groupId>
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a185d7ee/compiler/src/main/antlr4/org/apache/flex/compiler/internal/css/CSS.g4
----------------------------------------------------------------------
diff --git a/compiler/src/main/antlr4/org/apache/flex/compiler/internal/css/CSS.g4 b/compiler/src/main/antlr4/org/apache/flex/compiler/internal/css/CSS.g4
index 61f42a9..f5d1bad 100644
--- a/compiler/src/main/antlr4/org/apache/flex/compiler/internal/css/CSS.g4
+++ b/compiler/src/main/antlr4/org/apache/flex/compiler/internal/css/CSS.g4
@@ -26,8 +26,6 @@ grammar CSS;
options
{
language = Java;
-// output = AST;
-// k = 2;
}
tokens
@@ -237,19 +235,19 @@ selectorGroup
* s|VBox s|HBox.content s|Button
*/
compoundSelector
-@init
+/*@init
{
final List<Object> simpleSelectorNodeList = new ArrayList<Object>();
//Object currentSimpleSelectorNode = adaptor.create(I_SIMPLE_SELECTOR, "I_SIMPLE_SELECTOR");
Token simpleSelectorStartToken = null;
Token simpleSelectorStopToken = null;
}
-/*@after
+@after
{
for(final Object simpleSelectorNode : simpleSelectorNodeList)
adaptor.addChild($compoundSelector.tree, simpleSelectorNode);
}*/
- : ( l=simpleSelectorFraction
+ : ( /*l=*/simpleSelectorFraction
/* {
// expand token range of the current simple selector
if (simpleSelectorStartToken == null)
@@ -371,8 +369,8 @@ declaration
*
*/
value
-@init { int count = 1; }
- : singleValue ( COMMA? singleValue { count++; } )*
+/*@init { int count = 1; }*/
+ : singleValue ( COMMA? singleValue /*{ count++; }*/ )*
// -> {count > 1}? ^(I_ARRAY singleValue+)
// -> singleValue
;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a185d7ee/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 776993f..f26a59f 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
@@ -1848,7 +1848,7 @@ public class ABCGeneratingReducer
/**
* generateFunctionBody() wrapper suitable for calling from the BURM.
* See JBurg ENHRQ <N> : the grammar that accepts the BURM's parameters
- * to a JBurg.Reduction routine doesn't grok function calls, so the BURM
+ * to a @Reduction routine doesn't grok function calls, so the BURM
* cannot call generateFunctionBody(body, name.getName());
*/
InstructionList generateFunctionBody(IASNode iNode, InstructionList function_body, Binding return_type)
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a185d7ee/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
index eab5e1b..4b295a2 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
@@ -31,7 +31,6 @@ import java.util.Map;
import java.util.Set;
import org.antlr.v4.runtime.TokenStream;
-import org.antlr.runtime.tree.CommonTree;
import org.apache.flex.abc.visitors.IABCVisitor;
import org.apache.flex.compiler.css.ICSSDocument;
@@ -48,7 +47,6 @@ import org.apache.flex.compiler.internal.css.CSSProperty;
import org.apache.flex.compiler.internal.css.CSSRule;
import org.apache.flex.compiler.internal.css.CSSSelector;
import org.apache.flex.compiler.internal.css.semantics.CSSSemanticAnalyzer;
-import org.apache.flex.compiler.internal.css.codegen.CSSEmitter;
import org.apache.flex.compiler.internal.units.EmbedCompilationUnit;
import org.apache.flex.compiler.projects.ICompilerProject;
import org.apache.flex.compiler.projects.IFlexProject;
@@ -72,11 +70,6 @@ import com.google.common.collect.ImmutableList;
public class CSSCompilationSession
{
/**
- * Synthesized CSS model doesn't have an AST.
- */
- private static final CommonTree NO_TREE = null;
-
- /**
* Synthesized CSS model doesn't have a token stream.
*/
private static final TokenStream NO_TOKEN_STREAM = null;
@@ -324,7 +317,7 @@ public class CSSCompilationSession
NO_MEDIA_QUERIES,
ImmutableList.of(selector),
ImmutableList.copyOf(propertyMap.values()),
- NO_TREE,
+ null,
NO_TOKEN_STREAM);
return cssRule;
}
@@ -350,7 +343,7 @@ public class CSSCompilationSession
private SynthesizedCSSDocument(final List<CSSRule> rules)
{
- super(rules, NO_NAMESPACES, FONT_FACES, NO_TREE, NO_TOKEN_STREAM);
+ super(rules, NO_NAMESPACES, FONT_FACES, null, NO_TOKEN_STREAM);
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a185d7ee/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg
----------------------------------------------------------------------
diff --git a/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg b/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg
new file mode 100644
index 0000000..61f8ea7
--- /dev/null
+++ b/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg
@@ -0,0 +1,244 @@
+/*
+ *
+ * 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.as.codegen;
+
+@header
+{
+ import org.apache.flex.compiler.problems.ICompilerProblem;
+ import org.apache.flex.compiler.problems.*;
+ import org.apache.flex.compiler.exceptions.BURMAbortException;
+
+ import static org.apache.flex.abc.ABCConstants.*;
+
+ import org.apache.flex.abc.semantics.Label;
+ import org.apache.flex.abc.semantics.Name;
+ import org.apache.flex.abc.semantics.Namespace;
+ import org.apache.flex.abc.semantics.ECMASupport;
+ import org.apache.flex.abc.instructionlist.InstructionList;
+
+ import org.apache.flex.compiler.constants.IASLanguageConstants;
+
+ import org.apache.flex.compiler.tree.ASTNodeID;
+ import static org.apache.flex.compiler.tree.ASTNodeID.*;
+
+ import org.apache.flex.compiler.internal.semantics.SemanticUtils;
+
+ import org.apache.flex.compiler.tree.as.IASNode;
+ import org.apache.flex.compiler.tree.as.ITryNode;
+
+}
+
+@INodeType IASNode;
+@OpcodeType ASTNodeID;
+
+/*
+ * The I-node type is IASNode, and it has its own adapter.
+ */
+@INodeAdapter org.apache.flex.compiler.internal.as.codegen.IASNodeAdapter;
+
+// Generate Java output.
+@Language java;
+
+@ReturnType InstructionList;
+
+/*
+ * A Name built for a declaration, such as the name for 'x' in:
+ * var x : Foo;
+ * A declaration name can just be a simple AET Name, as there is no need to resolve
+ * it or do anything else to figure out what Name to use.
+ */
+@ReturnType decl_name = Name;
+
+/**
+ * This is a name to use in an expression context. It is a Binding
+ * as the Binding will also hold additional information like did the expression
+ * resolve to anything, and if so what did it resolve to. In an expression context
+ * we will always need that information.
+ */
+@ReturnType name = Binding;
+
+/**
+ * Qualified name - this acts the same as a name above, but is built a little differently.
+ */
+@ReturnType qualifiedName = Binding;
+@ReturnType qualifiedNamePart = String;
+
+/**
+ * This is a name used in a type annotation context, such as 'Foo' in:
+ * var x : Foo;
+ * It is a Binding, as type annotations must always be resolved.
+ * A type_name also allows '*', which can't happen in a general expression context.
+ */
+@ReturnType type_name = Binding;
+
+/**
+ * Name of a return type from a function signature.
+ * It is the same as a type_name, above, except it also allows 'void', which is not usually allowed as a type_name
+ */
+@ReturnType return_type_name = Binding;
+
+/**
+ * This is a name used in a new context, such as 'Foo' in:
+ * new Foo();
+ * We can do additional analysis when the new expression resolves to a Type, which
+ * is why we have a special name for the new expression.
+ */
+@ReturnType new_type_name = Binding;
+
+@ReturnType dottedNamePart = String;
+
+@ReturnType conditionalElements = ABCGeneratingReducer.ConditionalFragment;
+
+@ReturnType ifElseIf = ABCGeneratingReducer.ConditionalFragment;
+
+@ReturnType catch_block = ABCGeneratingReducer.CatchPrototype;
+
+@ReturnType integer_constant = Integer;
+@ReturnType uint_constant = Long;
+@ReturnType double_constant = Double;
+@ReturnType string_constant = String;
+@ReturnType boolean_constant = Boolean;
+
+@ReturnType numeric_constant = Number;
+
+@ReturnType constant_value = Object;
+@ReturnType required_constant_value = Object;
+
+@ReturnType non_resolving_identifier = String;
+
+@ReturnType runtime_name_expression = ABCGeneratingReducer.RuntimeMultiname;
+@ReturnType multinameL = Name;
+@ReturnType stmt_label = String;
+@ReturnType e4x_literal = String;
+
+@Constant ERROR_TRAP = 268435456;
+{
+ final static boolean NEED_VALUE = true;
+ final static boolean DISCARD_VALUE = false;
+
+
+ /**
+ * The reducer has all the implementation
+ * logic for the rewrite; the BURM constructed
+ * by this specification drives that logic.
+ */
+ ABCGeneratingReducer reducer;
+
+ /**
+ * Delegate calls to pushNumericConstant to the reducer.
+ * This routine is called from other parts of the code generator,
+ * so it's necessary to keep this layer of indirection.
+ */
+ public static void pushNumericConstant(long value, InstructionList result_list)
+ {
+ ABCGeneratingReducer.pushNumericConstant(value, result_list);
+ }
+
+ /*
+ * ** Cost functions **
+ */
+
+
+ /**
+ * @return "feasible" if the reducer can reduce this to a dotted name.
+ */
+ int isDottedName(IASNode iNode)
+ {
+ return reducer.isDottedName(iNode);
+ }
+
+ /**
+ * @return "feasible" if the reducer can reduce this to a package name.
+ */
+ int isPackageName(IASNode iNode)
+ {
+ return reducer.isPackageName(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node's qualifier is a compile-time constant.
+ */
+ int qualifierIsCompileTimeConstant(IASNode iNode)
+ {
+ return reducer.qualifierIsCompileTimeConstant(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node can be resolved to a compile-time constant.
+ */
+ int isCompileTimeConstant(IASNode iNode)
+ {
+ return reducer.isCompileTimeConstant(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node is for 'new Array()'.
+ */
+ int isEmptyArrayConstructor(IASNode iNode)
+ {
+ return reducer.isEmptyArrayConstructor(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node is for 'new Object()'.
+ */
+ int isEmptyObjectConstructor(IASNode iNode)
+ {
+ return reducer.isEmptyObjectConstructor(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node is "super(this)".
+ */
+ int isSuperThisForFieldAccess(IASNode iNode)
+ {
+ return SemanticUtils.isSuperThisForFieldAccess(iNode);
+ }
+
+ /**
+ * recordError is a convenience method for error reductions;
+ * it adds a problem to the current set of problems and
+ * returns an empty InstructionList.
+ * @return an empty InstructionList.
+ */
+ InstructionList recordError(ICompilerProblem problem)
+ {
+ reducer.getProblems().add(problem);
+ return new InstructionList();
+ }
+}
+
+/*
+ * Error recovery routine: deduce what we can from the problem
+ * tree, then abort this BURM with an exception that the caller
+ * can catch and ignore.
+ */
+@ErrorHandler
+{
+ new UnknownTreeHandler(reducer.getProblems()).analyze(p);
+ BURMAbortException.abort();
+}
+
+/*
+ * Patterns and rules are stored in their own, shareable file.
+ */
+@include "CmcPatterns.jbg"
+@include "CmcRules.jbg"
+@include "SemanticErrors.jbg"
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a185d7ee/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..8ae3fb4 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
@@ -24,10 +24,10 @@
/*
* Directives.
*/
-Pattern useNamespaceDirective
+@Pattern useNamespaceDirective
UseID(name ns_name);
-Pattern importDirective
+@Pattern importDirective
ImportID(import_name importName);
/*
@@ -37,64 +37,64 @@ ImportID(import_name importName);
// Patterns for function variants are factored into FunctionPatterns.jbg;
// include them with applicable modifications to the root node ID recognized
// and the names of the generated patterns.
-JBurg.include "FunctionPatterns.jbg"
-JBurg.include "FunctionPatterns.jbg" FunctionID="GetterID" typelessFunction="typelessGetter" typedFunction="typedGetter"
-JBurg.include "FunctionPatterns.jbg" FunctionID="SetterID" typelessFunction="typelessSetter" typedFunction="typedSetter"
+@include "FunctionPatterns.jbg"
+@include "FunctionPatterns.jbg" FunctionID="GetterID" typelessFunction="typelessGetter" typedFunction="typedGetter"
+@include "FunctionPatterns.jbg" FunctionID="SetterID" typelessFunction="typelessSetter" typedFunction="typedSetter"
// An anonymous function closure, e.g.,
// foo = function() { return 12; }
-Pattern anonymousFunction
+@Pattern anonymousFunction
AnonymousFunctionID(function function_body);
// A function closure with no type, e.g.,
// foo = function factorial(x) { return x == 1? 1: x * factorial(x-1); }
-Pattern typelessFunctionObject
+@Pattern typelessFunctionObject
FunctionObjectID(FunctionID(IdentifierID(void) function_name, parameterList plist, statement block));
// A function closure with a return type, e.g.,
// foo = function factorial(x):int { return x == 1? 1: x * factorial(x-1); }
-Pattern typedFunctionObject
+@Pattern typedFunctionObject
FunctionObjectID(FunctionID(IdentifierID(void) function_name, parameterList plist, return_type_name return_type, statement block));
// Parameter declarations.
-Pattern plist
+@Pattern plist
ContainerID(parameter pdecl*);
-Pattern requiredParameter
+@Pattern requiredParameter
ArgumentID(decl_name param_name, type_name param_type);
-Pattern optionalParameter
+@Pattern optionalParameter
ArgumentID(decl_name param_name, type_name param_type, required_constant_value default_value);
-Pattern restParameter
+@Pattern restParameter
ArgumentRestID(decl_name param_name, type_name param_type);
// Variable declarations.
-Pattern typedVariableDecl
+@Pattern typedVariableDecl
VariableID(decl_name var_name, type_name var_type, var_decl chained_decls*);
// variable or const decl with a non-constant initializer
// var v = func();
-Pattern typedVariableDeclWithInitializer
+@Pattern typedVariableDeclWithInitializer
VariableID(decl_name var_name, type_name var_type, expression var_initializer, var_decl chained_decls*);
// variable or const decl with a constant initializer
// var v = 10;
-Pattern typedVariableDeclWithConstantInitializer
+@Pattern typedVariableDeclWithConstantInitializer
VariableID(decl_name var_name, type_name var_type, constant_value constant_var_initializer, var_decl chained_decls*);
-Pattern typedBindableVariableDecl
+@Pattern typedBindableVariableDecl
BindableVariableID(decl_name var_name, type_name var_type, var_decl chained_decls*);
-Pattern typedBindableVariableDeclWithInitializer
+@Pattern typedBindableVariableDeclWithInitializer
BindableVariableID(decl_name var_name, type_name var_type, expression var_initializer, var_decl chained_decls*);
-Pattern variableExpression
+@Pattern variableExpression
VariableExpressionID(var_decl decls+);
-Pattern typedVariableExpression
+@Pattern typedVariableExpression
VariableExpressionID(
VariableID(
decl_name var_name,
@@ -103,16 +103,16 @@ VariableExpressionID(
);
// namespace NsFoo;
-Pattern namespaceDeclaration
+@Pattern namespaceDeclaration
NamespaceID(name ns_name);
// namespace NsBar = "http://foo";
-Pattern namespaceDeclarationConstantInitializer
+@Pattern namespaceDeclarationConstantInitializer
NamespaceID(name ns_name, string_constant uri);
// namespace NsCopy = NsOrig;
// See also CMP-268.
-Pattern namespaceDeclarationInitializer
+@Pattern namespaceDeclarationInitializer
NamespaceID(name ns_name, name second_ns);
/*
@@ -120,179 +120,179 @@ NamespaceID(name ns_name, name second_ns);
*/
// { stmts; } or { }
-Pattern blockStmt
+@Pattern blockStmt
BlockID(statement stmts*);
// CONFIG... { stmts; }
-Pattern configBlockStmt
+@Pattern configBlockStmt
ConfigBlockID(statement stmts*);
// break;
-Pattern breakStmt
+@Pattern breakStmt
BreakID(void);
// break foo;
-Pattern labeledBreakStmt
+@Pattern labeledBreakStmt
BreakID(IdentifierID(void));
// continue;
-Pattern continueStmt
+@Pattern continueStmt
ContinueID(void);
// continue foo;
-Pattern labeledContinueStmt
+@Pattern labeledContinueStmt
ContinueID(IdentifierID(void));
// goto foo;
-Pattern gotoStmt
+@Pattern gotoStmt
GotoID(IdentifierID(void));
// do { body } while ( cond );
-Pattern doStmt
+@Pattern doStmt
DoWhileLoopID(statement body, expression cond);
// for ( init; test_insns; incr ) body;
-Pattern countedForStmt
+@Pattern countedForStmt
ForLoopID(ContainerID( void_expression init, conditionalJump test_insns, void_expression incr ), statement body);
// for (it in base) body;
-Pattern forInStmt
+@Pattern forInStmt
ForLoopID(ContainerID(Op_InID(name it, expression base)), statement body);
// for (a[it] in base) body;
-Pattern forInArrayStmt
+@Pattern forInArrayStmt
ForLoopID(ContainerID(Op_InID(ArrayIndexExpressionID(expression stem, expression index), expression base)), statement body);
// for (x.y in base) body;
-Pattern forInMemberStmt
+@Pattern forInMemberStmt
ForLoopID(ContainerID(Op_InID(MemberAccessExpressionID(expression stem, name member), expression base)), statement body);
// for (x..y in base) body;
-Pattern forInDescendantStmt
+@Pattern forInDescendantStmt
ForLoopID(ContainerID(Op_InID(Op_DescendantsID(expression stem, name descendants), expression base)), statement body);
// for (super.y in base) body;
-Pattern forInSuperStmt
+@Pattern forInSuperStmt
ForLoopID(ContainerID(Op_InID(MemberAccessExpressionID(SuperID(void), name member), expression base)), statement body);
// for (super['y'] in base) body;
-Pattern forInSuperBracketStmt
+@Pattern forInSuperBracketStmt
ForLoopID(ContainerID(Op_InID(ArrayIndexExpressionID(SuperID(void), expression index), expression base)), statement body);
// for (var x:type = "init" in base) body;
-Pattern forVarDeclInStmt
+@Pattern forVarDeclInStmt
ForLoopID(ContainerID(Op_InID(VariableExpressionID(var_decl single_decl), expression base)), statement body);
// for each (var x:type = "init" in base) body;
-Pattern forEachVarDeclInStmt
+@Pattern forEachVarDeclInStmt
ForEachLoopID(ContainerID(Op_InID(VariableExpressionID(var_decl single_decl), expression base)), statement body);
// for each (it in base) body;
-Pattern forEachStmt
+@Pattern forEachStmt
ForEachLoopID(ContainerID(Op_InID(name it, expression base)), statement body);
// for each (a[it] in base) body;
-Pattern forEachArrayStmt
+@Pattern forEachArrayStmt
ForEachLoopID(ContainerID(Op_InID(ArrayIndexExpressionID(expression stem, expression index), expression base)), statement body);
// for each (x.y in base) body;
-Pattern forEachMemberStmt
+@Pattern forEachMemberStmt
ForEachLoopID(ContainerID(Op_InID(MemberAccessExpressionID(expression stem, name member), expression base)), statement body);
// for each (x..y in base) body;
-Pattern forEachInDescendantStmt
+@Pattern forEachInDescendantStmt
ForEachLoopID(ContainerID(Op_InID(Op_DescendantsID(expression stem, name descendants), expression base)), statement body);
// for each (super.y in base) body;
-Pattern forEachSuperStmt
+@Pattern forEachSuperStmt
ForEachLoopID(ContainerID(Op_InID(MemberAccessExpressionID(SuperID(void), name member), expression base)), statement body);
// for each (super['y'] in base) body;
-Pattern forEachSuperBracketStmt
+@Pattern forEachSuperBracketStmt
ForEachLoopID(ContainerID(Op_InID(ArrayIndexExpressionID(SuperID(void), expression index), expression base)), statement body);
// if ( test ) then; else ...
-Pattern ifElseIf
+@Pattern ifElseIf
IfStatementID ( ConditionalID(expression test, statement then), conditionalElements if_elseif* );
// final else following the linked chain of if/else if clauses above.
-Pattern lastElse
+@Pattern lastElse
ElseID ( statement else_clause );
// return value;
-Pattern returnValue
+@Pattern returnValue
ReturnStatementID(expression value);
// return void 0;
-Pattern returnVoidValue
+@Pattern returnVoidValue
ReturnStatementID(void_expression no_value);
// return void(expr);
-Pattern returnVoidSideEffect
+@Pattern returnVoidSideEffect
ReturnStatementID(Op_VoidID(expression expr));
// return;
-Pattern returnVoid
+@Pattern returnVoid
ReturnStatementID(void);
// this handles the no semi-colon case:
// return
-Pattern returnNil
+@Pattern returnNil
ReturnStatementID(NilID(void));
// switch ( switch_expr ) { cases }
-Pattern switchStmt
+@Pattern switchStmt
SwitchID(expression switch_expr, BlockID(conditionalElements cases*));
// case case_expr: case_actions; ...
-Pattern switchCase
+@Pattern switchCase
ConditionalID(expression case_expr, statement case_actions*);
// This is an optimization for constant conditionals such as:
// if (true) { }
// or:
// case 7: case_actions; ...
-Pattern constantSwitchCase
+@Pattern constantSwitchCase
ConditionalID(constant_value case_const_value, statement case_actions*);
// default: case_actions; ...
-Pattern switchDefault
+@Pattern switchDefault
DefaultID(BlockID(statement case_actions*));
// throw tossable;
-Pattern throwStmt
+@Pattern throwStmt
ThrowsStatementID(expression tossable);
// try { try_stmt; } catch( ex1:Etype1 ) { }... finally { finally_stmt }
-Pattern tryCatchFinallyStmt
+@Pattern tryCatchFinallyStmt
TryID(statement try_stmt, FinallyID(finally_clause finally_stmt), catch_block catch_blocks+);
// try { try_stmt; } catch( ex1:Etype1 ) { }...
-Pattern tryCatchStmt
+@Pattern tryCatchStmt
TryID(statement try_stmt, catch_block catch_blocks+);
// try { try_stmt; } finally { finally_stmt; }
-Pattern tryFinallyStmt
+@Pattern tryFinallyStmt
TryID(statement try_stmt, FinallyID(finally_clause finally_stmt));
// catch ( ex:ExType ) { actions; }
-Pattern catchBlockTyped
+@Pattern catchBlockTyped
CatchID(ArgumentID(name var_name, type_name exception), statement action);
// catch(ex) { actions; }
-Pattern catchBlockUntyped
+@Pattern catchBlockUntyped
CatchID(ArgumentID(name var_name), statement action);
// while(cond) body;
-Pattern whileStmt
+@Pattern whileStmt
WhileLoopID(expression cond, statement body);
// with(new_scope) body;
-Pattern withStmt
+@Pattern withStmt
WithID(expression new_scope, statement body);
// label: statement;
-Pattern labeledStmt
+@Pattern labeledStmt
LabledStatementID(non_resolving_identifier label, statement substatement);
@@ -301,55 +301,55 @@ LabledStatementID(non_resolving_identifier label, statement substatement);
*/
// x = <rvalue>
-Pattern assignToNameExpr
+@Pattern assignToNameExpr
Op_AssignId(name lval, expression r);
// x.rt_name.foo = <rvalue>
-Pattern assignToRuntimeNameExpr
+@Pattern assignToRuntimeNameExpr
Op_AssignId(runtime_name_expression lval, expression r);
// x.member.foo = <rvalue>
-Pattern assignToMemberExpr
+@Pattern assignToMemberExpr
Op_AssignId(MemberAccessExpressionID(expression stem, name member), expression r);
// x.ns::foo = <rvalue>
-Pattern assignToQualifiedMemberExpr
+@Pattern assignToQualifiedMemberExpr
Op_AssignId(MemberAccessExpressionID(expression stem, NamespaceAccessExpressionID(name qualifier, name member)), expression r);
// x.ns::[foo] = <rvalue>
-Pattern assignToQualifiedRuntimeMemberExpr
+@Pattern assignToQualifiedRuntimeMemberExpr
Op_AssignId(MemberAccessExpressionID(expression stem, NamespaceAccessExpressionID(name qualifier, expression member)), expression r);
// x.@ns::foo = <rvalue>
-Pattern assignToQualifiedAttributeExpr
+@Pattern assignToQualifiedAttributeExpr
Op_AssignId(MemberAccessExpressionID(expression stem, Op_AtID(NamespaceAccessExpressionID(name qualifier, name attribute))), expression r);
// x.@ns::[foo] = <rvalue>
-Pattern assignToQualifiedRuntimeAttributeExpr
+@Pattern assignToQualifiedRuntimeAttributeExpr
Op_AssignId(MemberAccessExpressionID(expression stem, Op_AtID(NamespaceAccessExpressionID(name qualifier, expression attribute))), expression r);
// x.@[foo] = <rvalue>
-Pattern assignToUnqualifiedRuntimeAttributeExpr
+@Pattern assignToUnqualifiedRuntimeAttributeExpr
Op_AssignId(MemberAccessExpressionID(expression stem, ArrayIndexExpressionID(Op_AtID(void), expression rt_attr_name)), expression r);
// x..@[foo] = <rvalue>
-Pattern assignToUnqualifiedRuntimeDescendantsAttributeExpr
+@Pattern assignToUnqualifiedRuntimeDescendantsAttributeExpr
Op_AssignId(Op_DescendantsID(expression stem, ArrayIndexExpressionID(Op_AtID(void), expression rt_attr_name)), expression r);
// a[i] = <rvalue>
-Pattern assignToBracketExpr
+@Pattern assignToBracketExpr
Op_AssignId(ArrayIndexExpressionID(expression stem, expression index), expression r);
// super[x] = <rvalue>
-Pattern assignToSuperBracketExpr
+@Pattern assignToSuperBracketExpr
Op_AssignId(ArrayIndexExpressionID(SuperID(void) stem, expression index), expression r);
// x..foo = <rvalue>
-Pattern assignToDescendantsExpr
+@Pattern assignToDescendantsExpr
Op_AssignId(Op_DescendantsID(expression stem, name member), expression r);
// lhs += rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_AddAssignID" \
compoundAssignToName="assignPlusToNameExpr" \
compoundAssignToMember="assignPlusToMemberExpr" \
@@ -358,7 +358,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignPlusToRuntimeNameExpr"
// lhs -= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_SubtractAssignID" \
compoundAssignToName="assignMinusToNameExpr" \
compoundAssignToMember="assignMinusToMemberExpr" \
@@ -367,7 +367,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignMinusToRuntimeNameExpr"
// lhs |= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_BitwiseOrAssignID" \
compoundAssignToName="assignBitwiseOrToNameExpr" \
compoundAssignToMember="assignBitwiseOrToMemberExpr" \
@@ -376,7 +376,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignBitwiseOrToRuntimeNameExpr"
// lhs &= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_BitwiseAndAssignID" \
compoundAssignToName="assignBitwiseAndToNameExpr" \
compoundAssignToMember="assignBitwiseAndToMemberExpr" \
@@ -385,7 +385,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignBitwiseAndToRuntimeNameExpr"
// lhs ^= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_BitwiseXorAssignID" \
compoundAssignToName="assignBitwiseXorToNameExpr" \
compoundAssignToMember="assignBitwiseXorToMemberExpr" \
@@ -394,7 +394,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignBitwiseXorToRuntimeNameExpr"
// lhs <<= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_LeftShiftAssignID" \
compoundAssignToName="assignLeftShiftToNameExpr" \
compoundAssignToMember="assignLeftShiftToMemberExpr" \
@@ -403,7 +403,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignLeftShiftToRuntimeNameExpr"
// lhs >>= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_RightShiftAssignID" \
compoundAssignToName="assignRightShiftToNameExpr" \
compoundAssignToMember="assignRightShiftToMemberExpr" \
@@ -413,7 +413,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
// lhs >>>= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_UnsignedRightShiftAssignID" \
compoundAssignToName="assignUnsignedRightShiftToNameExpr" \
compoundAssignToMember="assignUnsignedRightShiftToMemberExpr" \
@@ -422,7 +422,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignUnsignedRightShiftToRuntimeNameExpr"
// lhs *= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_MultiplyAssignID" \
compoundAssignToName="assignMultiplyToNameExpr" \
compoundAssignToMember="assignMultiplyToMemberExpr" \
@@ -431,7 +431,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignMultiplyToRuntimeNameExpr"
// lhs %= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_ModuloAssignID" \
compoundAssignToName="assignModuloToNameExpr" \
compoundAssignToMember="assignModuloToMemberExpr" \
@@ -440,7 +440,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignModuloToRuntimeNameExpr"
// lhs /= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_DivideAssignID" \
compoundAssignToName="assignDivideToNameExpr" \
compoundAssignToMember="assignDivideToMemberExpr" \
@@ -449,7 +449,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignDivideToRuntimeNameExpr"
// lhs ||= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_LogicalOrAssignID" \
compoundAssignToName="assignLogicalOrToNameExpr" \
compoundAssignToMember="assignLogicalOrToMemberExpr" \
@@ -458,7 +458,7 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
compoundAssignToRuntimeName="assignLogicalOrToRuntimeNameExpr"
// lhs &&= rhs
-JBurg.include "CompoundAssignmentPatterns.jbg" \
+@include "CompoundAssignmentPatterns.jbg" \
Op_COMPOUND_ASSIGN="Op_LogicalAndAssignID" \
compoundAssignToName="assignLogicalAndToNameExpr" \
compoundAssignToMember="assignLogicalAndToMemberExpr" \
@@ -470,280 +470,280 @@ JBurg.include "CompoundAssignmentPatterns.jbg" \
/*
* Binary expressions: relational.
*/
-Pattern equalExpr
+@Pattern equalExpr
Op_EqualID(expression l, expression r);
-Pattern neqExpr
+@Pattern neqExpr
Op_NotEqualID(expression l, expression r) ;
-Pattern stricteqExpr
+@Pattern stricteqExpr
Op_StrictEqualID(expression l, expression r);
-Pattern strictneqExpr
+@Pattern strictneqExpr
Op_StrictNotEqualID(expression l, expression r);
-Pattern greaterThanExpr
+@Pattern greaterThanExpr
Op_GreaterThanID(expression l, expression r);
-Pattern greaterThanEqExpr
+@Pattern greaterThanEqExpr
Op_GreaterThanEqualsID(expression l, expression r);
-Pattern lessExpr
+@Pattern lessExpr
Op_LessThanID(expression l, expression r);
-Pattern lessEqExpr
+@Pattern lessEqExpr
Op_LessThanEqualsID(expression l, expression r);
-Pattern istypeExprLate
+@Pattern istypeExprLate
Op_IsID(expression expr, expression typename);
-Pattern astypeExprLate
+@Pattern astypeExprLate
Op_AsID(expression expr, expression typename);
-Pattern inExpr
+@Pattern inExpr
Op_InID(expression needle, expression haystack);
-Pattern instanceofExpr
+@Pattern instanceofExpr
Op_InstanceOfID(expression expr, expression typename);
/*
* Binary expressions: multiplicative.
*/
-Pattern multExpr
+@Pattern multExpr
Op_MultiplyID(expression l, expression r);
-Pattern divideExpr
+@Pattern divideExpr
Op_DivideID(expression l, expression r);
-Pattern moduloExpr
+@Pattern moduloExpr
Op_ModuloID(expression l, expression r);
/*
* Binary expressions: additive.
*/
-Pattern addExpr
+@Pattern addExpr
Op_AddID(expression l, expression r);
-Pattern subtractExpr
+@Pattern subtractExpr
Op_SubtractID(expression l, expression r);
/*
* Binary expressions: bitwise.
*/
-Pattern bitwiseLeftShiftExpr
+@Pattern bitwiseLeftShiftExpr
Op_LeftShiftID(expression l, expression r);
-Pattern bitwiseRightShiftExpr
+@Pattern bitwiseRightShiftExpr
Op_RightShiftID(expression l, expression r);
-Pattern bitwiseUnsignedRightShiftExpr
+@Pattern bitwiseUnsignedRightShiftExpr
Op_UnsignedRightShift(expression l, expression r);
-Pattern bitwiseAndExpr
+@Pattern bitwiseAndExpr
Op_BitwiseAndID(expression l, expression r);
-Pattern bitwiseOrExpr
+@Pattern bitwiseOrExpr
Op_BitwiseOrID(expression l, expression r);
-Pattern bitwiseXorExpr
+@Pattern bitwiseXorExpr
Op_BitwiseXorID(expression l, expression r);
/*
* Unary expressions.
*/
-Pattern unaryMinusExpr
+@Pattern unaryMinusExpr
Op_SubtractID(expression e);
-Pattern unaryPlusExpr
+@Pattern unaryPlusExpr
Op_AddID(expression e);
// typeof(foo()) or typeof(foo.bar)
-Pattern typeofExpr
+@Pattern typeofExpr
Op_TypeOfID(expression expr);
// typeof(n) needs to find names that
// refer to local registers and synthesize
// their typeof results at compile time.
-Pattern typeofName
+@Pattern typeofName
Op_TypeOfID(name n);
-Pattern bitNotExpr
+@Pattern bitNotExpr
Op_BitwiseNotID(expression unary);
// Increment/decrement and variants
-Pattern preIncNameExpr
+@Pattern preIncNameExpr
Op_PreIncrID(name unary);
-Pattern postIncNameExpr
+@Pattern postIncNameExpr
Op_PostIncrID(name unary);
-Pattern preIncMemberExpr
+@Pattern preIncMemberExpr
Op_PreIncrID(MemberAccessExpressionID(expression stem, name field));
-Pattern postIncMemberExpr
+@Pattern postIncMemberExpr
Op_PostIncrID(MemberAccessExpressionID(expression stem, name field));
-Pattern preIncBracketExpr
+@Pattern preIncBracketExpr
Op_PreIncrID(ArrayIndexExpressionID(expression stem, expression index));
-Pattern postIncBracketExpr
+@Pattern postIncBracketExpr
Op_PostIncrID(ArrayIndexExpressionID(expression stem, expression index));
-Pattern preDecNameExpr
+@Pattern preDecNameExpr
Op_PreDecrID(name unary);
-Pattern postDecNameExpr
+@Pattern postDecNameExpr
Op_PostDecrID(name unary);
-Pattern preDecMemberExpr
+@Pattern preDecMemberExpr
Op_PreDecrID(MemberAccessExpressionID(expression stem, name field));
-Pattern postDecMemberExpr
+@Pattern postDecMemberExpr
Op_PostDecrID(MemberAccessExpressionID(expression stem, name field));
-Pattern preDecBracketExpr
+@Pattern preDecBracketExpr
Op_PreDecrID(ArrayIndexExpressionID(expression stem, expression index));
-Pattern postDecBracketExpr
+@Pattern postDecBracketExpr
Op_PostDecrID(ArrayIndexExpressionID(expression stem, expression index));
// foo.bar used in a context where it may be a compile-time constant.
-Pattern constantDottedName
+@Pattern constantDottedName
MemberAccessExpressionID(expression stem, name member);
/*
* Access to member, function call
*/
// a[i]
-Pattern arrayIndexExpr
+@Pattern arrayIndexExpr
ArrayIndexExpressionID(expression stem, expression index);
// super[x]
-Pattern superIndexExpr
+@Pattern superIndexExpr
ArrayIndexExpressionID(SuperID(void) stem, expression index);
// foo.bar
-Pattern memberAccessExpr
+@Pattern memberAccessExpr
MemberAccessExpressionID(expression stem, name member);
// qualified member reference, e.g., foo.bar::baz
-Pattern qualifiedMemberAccessExpr
+@Pattern qualifiedMemberAccessExpr
MemberAccessExpressionID(expression stem, NamespaceAccessExpressionID(name qualifier, name member));
// qualified member reference with runtime name, e.g. foo.ns1::[baz]
-Pattern qualifiedMemberRuntimeNameExpr
+@Pattern qualifiedMemberRuntimeNameExpr
MemberAccessExpressionID(expression stem, NamespaceAccessExpressionID(name qualifier, expression runtime_member));
// qualified attribute reference, e.g. foo@bar::baz
-Pattern qualifiedAttributeExpr
+@Pattern qualifiedAttributeExpr
MemberAccessExpressionID(expression stem, Op_AtID(NamespaceAccessExpressionID(name qualifier, name member)));
// Runtime qualified attribute, e.g. foo@bar::[baz]
-Pattern qualifiedAttributeRuntimeMemberExpr
+@Pattern qualifiedAttributeRuntimeMemberExpr
MemberAccessExpressionID(expression stem, Op_AtID(NamespaceAccessExpressionID(name qualifier, expression runtime_member)));
// qualified descendants reference, e.g., foo..bar::baz
-Pattern qualifiedDescendantsExpr
+@Pattern qualifiedDescendantsExpr
Op_DescendantsID(expression stem, NamespaceAccessExpressionID(name qualifier, name member));
// Runtime qualified descendants, e.g. foo..bar::[baz]
-Pattern qualifiedDescendantsRuntimeExpr
+@Pattern qualifiedDescendantsRuntimeExpr
Op_DescendantsID(expression stem, NamespaceAccessExpressionID(name qualifier, expression runtime_member));
// qualified descendants/attribute reference, e.g. foo..@bar::baz
-Pattern qualifiedDescendantsAttributeExpr
+@Pattern qualifiedDescendantsAttributeExpr
Op_DescendantsID(expression stem, Op_AtID(NamespaceAccessExpressionID(name qualifier, name member)));
// Runtime qualified descendants/attribute, e.g. foo..@bar::[baz]
-Pattern qualifiedDescendantsRuntimeMemberExpr
+@Pattern qualifiedDescendantsRuntimeMemberExpr
Op_DescendantsID(expression stem, Op_AtID(NamespaceAccessExpressionID(name qualifier, expression runtime_member)));
// Unqualified runtime attribute expression, e.g., foo@[bar]
-Pattern unqualifiedAttributeExpr
+@Pattern unqualifiedAttributeExpr
MemberAccessExpressionID(expression stem, ArrayIndexExpressionID(Op_AtID(void), expression expr));
// Unqualified runtime descendants/attribute expression, e.g., foo..@[bar]
-Pattern unqualifiedDescendantsAttributeExpr
+@Pattern unqualifiedDescendantsAttributeExpr
Op_DescendantsID(expression stem, ArrayIndexExpressionID(Op_AtID(void), expression expr));
// runtime attribute expression, e.g., @[bar]
-Pattern runtimeAttributeExp
+@Pattern runtimeAttributeExp
ArrayIndexExpressionID(Op_AtID(void), expression expr);
// foo()
-Pattern functionCallExpr
+@Pattern functionCallExpr
FunctionCallID(name method_name, ContainerID(expression args*));
// new foo()
-Pattern newExpr
+@Pattern newExpr
FunctionCallID(KeywordNewID(void), new_type_name class_binding, ContainerID(expression args*));
-Pattern newVectorLiteral
+@Pattern newVectorLiteral
FunctionCallID(KeywordNewID(void), vector_literal literal, ContainerID(void) /*vestigial*/);
// new foo.bar()
-Pattern newMemberProperty
+@Pattern newMemberProperty
FunctionCallID(KeywordNewID(void), MemberAccessExpressionID(expression stem, name member), ContainerID(expression args*));
// new (any_expression)
-Pattern newAsRandomExpr
+@Pattern newAsRandomExpr
FunctionCallID(KeywordNewID(void), expression random_expr, ContainerID(expression args*));
// foo.bar()
-Pattern functionAsMemberExpr
+@Pattern functionAsMemberExpr
FunctionCallID(MemberAccessExpressionID(expression stem, name method_name), ContainerID(expression args*));
// super.foo()
-Pattern functionCallOfSuperclassMethod
+@Pattern functionCallOfSuperclassMethod
FunctionCallID(MemberAccessExpressionID(SuperID(void), name method_name), ContainerID(expression args*));
// super(x).foo()
-Pattern functionCallOfExplicitObjectSuperclassMethod
+@Pattern functionCallOfExplicitObjectSuperclassMethod
FunctionCallID(MemberAccessExpressionID(FunctionCallID(SuperID(void), ContainerID(expression stem)), name method_name), ContainerID(expression args*));
// a[i]()
-Pattern functionAsBracketExpr
+@Pattern functionAsBracketExpr
FunctionCallID(ArrayIndexExpressionID(expression stem, expression index), ContainerID(expression args*));
// super()
-Pattern superCallExpr
+@Pattern superCallExpr
FunctionCallID(SuperID(void), ContainerID(expression args*));
// foo()()
-Pattern functionAsRandomExpr
+@Pattern functionAsRandomExpr
FunctionCallID(expression random_expr, ContainerID(expression args*));
/*
* Delete
*/
// delete foo
-Pattern deleteNameExpr
+@Pattern deleteNameExpr
Op_DeleteID(name n);
-Pattern deleteBracketExpr
+@Pattern deleteBracketExpr
Op_DeleteID(ArrayIndexExpressionID(expression stem, expression index));
// delete p.@[foo]
-Pattern deleteAtBracketExpr
+@Pattern deleteAtBracketExpr
Op_DeleteID(MemberAccessExpressionID(expression stem, ArrayIndexExpressionID(Op_AtID(void), expression index)));
// delete p.foo
-Pattern deleteMemberExpr
+@Pattern deleteMemberExpr
Op_DeleteID(MemberAccessExpressionID(expression stem, name field));
// delete p.ns_var::foo
-Pattern deleteRuntimeNameExpr
+@Pattern deleteRuntimeNameExpr
Op_DeleteID(MemberAccessExpressionID(expression stem, runtime_name_expression rt_name));
// delete foo..bar
-Pattern deleteDescendantsExpr
+@Pattern deleteDescendantsExpr
Op_DeleteID(Op_DescendantsID(expression stem, name field));
// delete new Object(), delete "foo", etc.
-Pattern deleteAnyExprExprExpr
+@Pattern deleteAnyExprExprExpr
Op_DeleteID(expression expr);
@@ -751,28 +751,28 @@ Op_DeleteID(expression expr);
* Misc
*/
-Pattern nilExpr
+@Pattern nilExpr
NilID(void);
/*
* Expressions with control flow.
*/
-Pattern logicalAndExpr
+@Pattern logicalAndExpr
Op_LogicalAndID(expression l, expression r);
-Pattern logicalOrExpr
+@Pattern logicalOrExpr
Op_LogicalOrID(expression l, expression r);
-Pattern logicalNotExpr
+@Pattern logicalNotExpr
Op_LogicalNotID(expression expr);
-Pattern ternaryExpr
+@Pattern ternaryExpr
TernaryExpressionID(expression test, expression when_true, expression when_false);
// Note: the IASNodeAdapter flips the trailing expression
// to the 0th position so that the trailing n-ary args can
// be processed as void_expressions.
-Pattern commaExpr
+@Pattern commaExpr
Op_CommaID(expression payload_expr, void_expression exprs+);
/*
@@ -780,132 +780,132 @@ Op_CommaID(expression payload_expr, void_expression exprs+);
*/
// A simple reference to a name.
-Pattern simpleName
+@Pattern simpleName
IdentifierID(void);
// A dotted name that looked like member access to the parser.
-Pattern dottedName
+@Pattern dottedName
MemberAccessExpressionID(dottedNamePart first, dottedNamePart second);
// A dotted name that was actually resolved as a dotted name.
-Pattern fullName
+@Pattern fullName
FullNameID(dottedNamePart first, dottedNamePart second);
// qualified namespace expression
// use a.b.Foo;
-Pattern qualifiedNamespaceName
+@Pattern qualifiedNamespaceName
QualifiedNamespaceExpressionID(dottedNamePart first, dottedNamePart second);
// A namespace-qualified name.
// For example: ns1::aVariable
-Pattern namespaceAccess
+@Pattern namespaceAccess
NamespaceAccessExpressionID(NamespaceIdentifierID(void) qualifier, name qualified_name);
// A namespace-qualified expression where the namespace
// is known, but the name is a runtime expression.
// For example: trace(ns1::[foo])
-Pattern namespaceMultinameL
+@Pattern namespaceMultinameL
NamespaceAccessExpressionID(NamespaceIdentifierID(void) qualifier, expression expr);
// A namespace-qualified expression where the name is known
// at compile time, but the namespace is an expression.
// For example: var rt_ns = getANamespace(); trace(rt_ns::aVariable)
-Pattern namespaceRTQName
+@Pattern namespaceRTQName
NamespaceAccessExpressionID(expression qualifier, name qualfied_name);
// A namespace-qualified expression where the name
// and the namespace are both runtime expressions.
// For example: var rt_ns = getANamespace(); trace(rt_ns::[foo])
-Pattern namespaceRTQNameL
+@Pattern namespaceRTQNameL
NamespaceAccessExpressionID(expression qualifier, expression expr);
// A namespace standing on its own as a name, or as a compile-time
// qualifier to a MultinameL.
-Pattern namespaceAsName
+@Pattern namespaceAsName
NamespaceIdentifierID(void);
// An expression packed inside a "it's an expression" node.
-Pattern runtimeNameExpression
+@Pattern runtimeNameExpression
RuntimeNameExpressionID(expression expr);
// super-qualified name.
-Pattern superAccess
+@Pattern superAccess
MemberAccessExpressionID(SuperID(void), name qualified_name);
// super(this).foo
// This pattern is feasible only when IdentifierID(void) is "this" keyword.
// The cost function "isSuperThisForFieldAccess" validates the condition.
-Pattern superThisAccess
+@Pattern superThisAccess
MemberAccessExpressionID(FunctionCallID(SuperID(void), ContainerID(IdentifierID(void))), name qualified_name);
// Parameterized name in a context where
// the name alone is needed.
// For example: Vector.<String>, Vector.<*>, __AS3__.vec.Vector.<T>
-Pattern parameterizedName
+@Pattern parameterizedName
TypedExpressionID(name base, type_name param);
// Parameterized name as a general expression
// For example, getVector().<int>, Vector.<*>.foo
-Pattern parameterizedTypeExpression
+@Pattern parameterizedTypeExpression
TypedExpressionID(expression base, type_param_expression param);
// attribute name
// For example: @foo
-Pattern attributeName
+@Pattern attributeName
Op_AtID(name attr_name);
// An EmbedNode which is constructed by the compiler when
// it comes across embed meta data and is used as an
// initial expression for an embed variable
-Pattern embedExpression
+@Pattern embedExpression
EmbedID(void);
/*
* Literals.
*/
-Pattern nullLiteral
+@Pattern nullLiteral
LiteralNullID(void);
-Pattern stringLiteral
+@Pattern stringLiteral
LiteralStringID(void);
-Pattern numericLiteral
+@Pattern numericLiteral
LiteralNumberID(void);
-Pattern integerLiteral
+@Pattern integerLiteral
LiteralIntegerID(void);
-Pattern uintLiteral
+@Pattern uintLiteral
LiteralUintID(void);
-Pattern doubleLiteral
+@Pattern doubleLiteral
LiteralDoubleID(void);
-Pattern objectLiteral
+@Pattern objectLiteral
ObjectLiteralExpressionID(ContainerID(object_literal_element elements*));
-Pattern objectLiteralElement
+@Pattern objectLiteralElement
ObjectLiteralValuePairID(expression id, expression value);
-Pattern nonResolvingIdentifier
+@Pattern nonResolvingIdentifier
NonResolvingIdentifierID(void);
-Pattern booleanLiteral
+@Pattern booleanLiteral
LiteralBooleanID(void);
-Pattern arrayLiteral
+@Pattern arrayLiteral
ArrayLiteralID(ContainerID(expression elements*));
-Pattern vectorLiteral
+@Pattern vectorLiteral
VectorLiteralID(type_name type_param, ContainerID(expression elements*));
-Pattern regexLiteral
+@Pattern regexLiteral
LiteralRegexID(void);
// This patern is used to match '<code>new Array()' and 'new Object()'
// so that they are efficiently codegen'd using 'newarray' and 'newobject' opcodes.
-Pattern emptyConstructor
+@Pattern emptyConstructor
FunctionCallID(KeywordNewID(void), IdentifierID(void), ContainerID(void));
/*
@@ -913,31 +913,31 @@ FunctionCallID(KeywordNewID(void), IdentifierID(void), ContainerID(void));
*/
// Expression-level packaging of an XML literal, e.g. <foo x="moo">bar</foo>
-Pattern XMLContent
+@Pattern XMLContent
XMLContentID(ContainerID(expression exprs+));
// XMLList literal, e.g. <><foo>bar</foo><foo>{myVar}</foo></>
-Pattern XMLList
+@Pattern XMLList
XMLListContentID(ContainerID(expression exprs*));
// XMLList literal with all constant elements, e.g. <><foo>bar</foo><foo>baz</foo></>
-Pattern XMLListConst
+@Pattern XMLListConst
XMLListContentID(ContainerID(e4x_literal elements*));
// XML literal token, e.g., <foo><bar>12</bar></foo>.
-Pattern XMLLiteral
+@Pattern XMLLiteral
LiteralXMLID(void);
// Filter expression, e.g. e.employee(id == 1234)
-Pattern e4xFilter
+@Pattern e4xFilter
E4XFilterID(expression stem, expression filter);
// default xml namespace
-Pattern defaultXMLNamespace
+@Pattern defaultXMLNamespace
DefaultXMLStatementID(expression ns_expr);
// descendants operator
-Pattern descendantsExpression
+@Pattern descendantsExpression
Op_DescendantsID(expression stem, name descendants);
@@ -945,27 +945,27 @@ Op_DescendantsID(expression stem, name descendants);
// these two patterns should merge into one.
// "void 0" idiom.
-Pattern void0Literal
+@Pattern void0Literal
LiteralObjectID(void);
// void(0)
-Pattern void0Operator
+@Pattern void0Operator
Op_VoidID(void);
// void(expr)
-Pattern voidOperator
+@Pattern voidOperator
Op_VoidID(expression expr);
// void("some constant")
-Pattern voidConstant
+@Pattern voidConstant
Op_VoidID(constant_value value);
// void;
-Pattern voidExpr
+@Pattern voidExpr
VoidID(void);
// Special forms of void expressions.
-Pattern groupedVoidExpression
+@Pattern groupedVoidExpression
ContainerID(void_expression contents+);
/*
@@ -989,7 +989,7 @@ ContainerID(void_expression contents+);
// IdentifierNode=doTaht
// ContainerNode
-Pattern mxmlEventSpecifier
+@Pattern mxmlEventSpecifier
MXMLEventSpecifierID(statement stmts*);
/*
@@ -997,5 +997,5 @@ MXMLEventSpecifierID(statement stmts*);
* where an expression is expected. Used by some MXML processing that wants to
* generate code without having to create a synthetic AST to pass to the burm.
*/
-Pattern instructionListExpression
+@Pattern instructionListExpression
InstructionListID(void);