flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [21/24] git commit: [flex-utilities] [refs/heads/feature/pmd-5.2-language-module] - Initial commit of the PMD language module for Apache Flex
Date Sat, 07 Mar 2015 12:07:14 GMT
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestCompilationUnit.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestCompilationUnit.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestCompilationUnit.java
new file mode 100644
index 0000000..a59d9c3
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestCompilationUnit.java
@@ -0,0 +1,84 @@
+/*
+ * 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.pmd.parser.impl;
+
+import static org.testng.Assert.*;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestCompilationUnit extends AbstractAs3ParserTestBase {
+
+    @Test
+    public void testEmptyPackage() throws TokenException {
+        assertCompilationUnit("1",
+                "package a { } ",
+                "<compilation-unit line=\"-1\">"
+                        + "<package line=\"1\">" + "<name line=\"1\">a"
+                        + "</name><content line=\"1\">"
+                        + "</content></package><content line=\"2\">"
+                        + "</content></compilation-unit>");
+    }
+
+    @Test
+    public void testEmptyPackagePlusLocalClass() throws TokenException {
+        assertCompilationUnit("1",
+                "package a { } class Local { }",
+                "<compilation-unit line=\"-1\"><package line=\"1\">"
+                        + "<name line=\"1\">a</name><content line=\"1\">"
+                        + "</content></package><content line=\"1\"><class line=\"1\""
+                        + "><name line=\"1\">Local</name>"
+                        + "<mod-list line=\"1\"></mod-list><content line=\"1\">"
+                        + "</content></class></content></compilation-unit>");
+    }
+
+    @Test
+    public void testPackageWithClass() throws TokenException {
+        assertCompilationUnit("1",
+                "package a { public class B { } } ",
+                "<compilation-unit line=\"-1\"><package line=\"1\">"
+                        + "<name line=\"1\">a</name><content line=\"1\">"
+                        + "<class line=\"1\"><name line=\"1\">B</name>"
+                        + "<mod-list line=\"1\"><mod line=\"1\">public"
+                        + "</mod></mod-list><content line=\"1\"></content>"
+                        + "</class></content></package><content line=\"2\">"
+                        + "</content></compilation-unit>");
+    }
+
+    @Test
+    public void testPackageWithInterface() throws TokenException {
+        assertCompilationUnit("1",
+                "package a { public interface B { } } ",
+                "<compilation-unit line=\"-1\"><package line=\"1\">"
+                        + "<name line=\"1\">a</name><content line=\"1\">"
+                        + "<interface line=\"1\"><name line=\"1\">B</name>"
+                        + "<mod-list line=\"1\"><mod line=\"1\">public</mod>"
+                        + "</mod-list><content line=\"1\"></content></interface>"
+                        + "</content></package><content line=\"2\"></content>"
+                        + "</compilation-unit>");
+    }
+
+    private void assertCompilationUnit(final String message,
+                                       final String input,
+                                       final String expected) throws TokenException {
+        scn.setLines(new String[]
+                {input,
+                        "__END__"});
+        final String result = new ASTToXMLConverter().convert(asp.parseCompilationUnit());
+        assertEquals(expected, result, message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestConstStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestConstStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestConstStatement.java
new file mode 100644
index 0000000..5743275
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestConstStatement.java
@@ -0,0 +1,62 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestConstStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testFullFeaturedConst() throws TokenException {
+        assertStatement("1",
+                "const a : int = 4",
+                "<const-list line=\"1\">"
+                        + "<name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"1\">int</type>"
+                        + "<init line=\"1\"><primary line=\"1\">4</primary>"
+                        + "</init></name-type-init></const-list>");
+    }
+
+    @Test
+    public void testInitializedConst() throws TokenException {
+        assertStatement("1",
+                "const a = 4",
+                "<const-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"1\">"
+                        + "</type><init line=\"1\"><primary line=\"1\">4"
+                        + "</primary></init></name-type-init></const-list>");
+    }
+
+    @Test
+    public void testSimpleConst() throws TokenException {
+        assertStatement("1",
+                "const a",
+                "<const-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"2\">"
+                        + "</type></name-type-init></const-list>");
+    }
+
+    @Test
+    public void testTypedConst() throws TokenException {
+        assertStatement("1",
+                "const a : Object",
+                "<const-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"1\">Object</type>"
+                        + "</name-type-init></const-list>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestDoStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestDoStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestDoStatement.java
new file mode 100644
index 0000000..d650f0a
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestDoStatement.java
@@ -0,0 +1,57 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestDoStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testDo() throws TokenException {
+        assertStatement("1",
+                "do{ trace( i ); } while( i++ );",
+                "<do line=\"1\"><block line=\"1\">"
+                        + "<call line=\"1\"><primary line=\"1\">"
+                        + "trace</primary><arguments line=\"1\">"
+                        + "<primary line=\"1\">i</primary></arguments>"
+                        + "</call></block><condition line=\"1\">"
+                        + "<post-inc line=\"1\"><primary line=\"1\">"
+                        + "i</primary></post-inc></condition></do>");
+    }
+
+    @Test
+    public void testDoWithEmptyStatement() throws TokenException {
+        assertStatement("1",
+                "do ; while( i++ ); ",
+                "<do line=\"1\"><stmt-empty line=\"1\">;</stmt-empty>"
+                        + "<condition line=\"1\"><post-inc line=\"1\">"
+                        + "<primary line=\"1\">i</primary></post-inc></condition></do>");
+    }
+
+    @Test
+    public void testDoWithoutBlock() throws TokenException {
+        assertStatement("1",
+                "do trace( i ); while( i++ ); ",
+                "<do line=\"1\"><call line=\"1\">"
+                        + "<primary line=\"1\">trace</primary><arguments line=\"1\""
+                        + "><primary line=\"1\">i</primary>"
+                        + "</arguments></call><condition line=\"1\">"
+                        + "<post-inc line=\"1\"><primary line=\"1\""
+                        + ">i</primary></post-inc></condition></do>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestE4xExpression.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestE4xExpression.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestE4xExpression.java
new file mode 100644
index 0000000..3ad142a
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestE4xExpression.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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestE4xExpression extends AbstractStatementTestBase {
+
+    @Test
+    public void testE4xFilter() throws TokenException {
+        assertStatement("",
+                "myXml.(lala=\"lala\")",
+                "<e4x-filter line=\"1\"><primary line=\"1\">myXml"
+                        + "</primary><assign line=\"1\"><primary line=\"1\">"
+                        + "lala</primary><op line=\"1\">=</op><primary line=\"1\">"
+                        + "\"lala\"</primary></assign></e4x-filter>");
+
+        assertStatement("",
+                "doc.*.worm[1]",
+                "<mul line=\"1\"><e4x-star line=\"1\"><primary line=\"1\""
+                        + ">doc</primary></e4x-star><op line=\"1\">*</op><primary "
+                        + "line=\"1\">.</primary></mul>");
+
+        assertStatement("",
+                "doc.@worm",
+                "<dot line=\"1\"><primary line=\"1\">doc</primary><primary "
+                        + "line=\"1\">@worm</primary></dot>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestEmptyStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestEmptyStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestEmptyStatement.java
new file mode 100644
index 0000000..454744a
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestEmptyStatement.java
@@ -0,0 +1,39 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestEmptyStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testComplex() throws TokenException {
+        assertStatement("1",
+                "{;1;;}",
+                "<block line=\"1\"><stmt-empty line=\"1\">;"
+                        + "</stmt-empty><primary line=\"1\">1"
+                        + "</primary><stmt-empty line=\"1\">;</stmt-empty></block>");
+    }
+
+    @Test
+    public void testSimple() throws TokenException {
+        assertStatement("1",
+                ";",
+                "<stmt-empty line=\"1\">;</stmt-empty>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestExpression.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestExpression.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestExpression.java
new file mode 100644
index 0000000..bda05e8
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestExpression.java
@@ -0,0 +1,186 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestExpression extends AbstractStatementTestBase {
+
+    @Test
+    public void testAddExpression() throws TokenException {
+        assertStatement("1",
+                "5+6",
+                "<add line=\"1\"><primary line=\"1\""
+                        + ">5</primary><op line=\"1\">+</op>" + "<primary line=\"1\">6</primary></add>");
+    }
+
+    @Test
+    public void testAndExpression() throws TokenException {
+        assertStatement("1",
+                "5&&6",
+                "<and line=\"1\"><primary line=\"1\">5</primary>"
+                        + "<op line=\"1\">&&</op>" + "<primary line=\"1\">6</primary></and>");
+    }
+
+    @Test
+    public void testAssignmentExpression() throws TokenException {
+        assertStatement("1",
+                "x+=6",
+                "<assign line=\"1\"><primary line=\"1\">x"
+                        + "</primary><op line=\"1\">+=</op><primary line=\"1\""
+                        + ">6</primary></assign>");
+    }
+
+    @Test
+    public void testBitwiseAndExpression() throws TokenException {
+        assertStatement("1",
+                "5&6",
+                "<b-and line=\"1\"><primary line=\"1\">5"
+                        + "</primary><op line=\"1\">&</op><primary line=\"1\">6</primary></b-and>");
+    }
+
+    @Test
+    public void testBitwiseOrExpression() throws TokenException {
+        assertStatement("1",
+                "5|6",
+                "<b-or line=\"1\"><primary line=\"1\">5"
+                        + "</primary><op line=\"1\">|</op><primary line=\"1\">6</primary></b-or>");
+    }
+
+    @Test
+    public void testBitwiseXorExpression() throws TokenException {
+        assertStatement("1",
+                "5^6",
+                "<b-xor line=\"1\"><primary line=\"1\">5"
+                        + "</primary><op line=\"1\">^</op><primary line=\"1\">6</primary></b-xor>");
+    }
+
+    @Test
+    public void testConditionalExpression() throws TokenException {
+        assertStatement("1",
+                "true?5:6",
+                "<conditional line=\"1\"><primary line=\"1\">"
+                        + "true</primary><primary line=\"1\">5" + "</primary><primary line=\"1\">6"
+                        + "</primary></conditional>");
+    }
+
+    @Test
+    public void testDivision() throws TokenException {
+        assertStatement("",
+                "offset = ( this[ axis.unscaled ] / 2 - ( rightPos ) / 2 );",
+                "<assign line=\"1\"><primary line=\"1\">offset</primary><op line=\"1\">=</op>"
+                        + "<primary line=\"1\"><encapsulated line=\"1\"><add line=\"1\"><mul line=\"1\">"
+                        + "<arr-acc line=\"1\"><primary line=\"1\">this</primary><dot line=\"1\"><primary "
+                        + "line=\"1\">axis</primary><primary line=\"1\">unscaled</primary></dot></arr-acc>"
+                        + "<op line=\"1\">/</op><primary line=\"1\">2</primary></mul><op line=\"1\">-</op>"
+                        + "<mul line=\"1\"><primary line=\"1\"><encapsulated line=\"1\"><primary line=\"1\">"
+                        + "rightPos</primary></encapsulated></primary><op line=\"1\">/</op><primary line=\"1\">"
+                        + "2</primary></mul></add></encapsulated></primary></assign>");
+    }
+
+    @Test
+    public void testEncapsulated() throws TokenException {
+        assertStatement("",
+                "(dataProvider as ArrayCollection) = null",
+                "<assign line=\"1\"><primary line=\"1\">"
+                        + "<encapsulated line=\"1\"><relation line=\"1\">"
+                        + "<primary line=\"1\">dataProvider</primary>"
+                        + "<as line=\"1\">as</as><primary line=\"1\">"
+                        + "ArrayCollection</primary></relation></encapsulated></primary>"
+                        + "<op line=\"1\">=</op><primary line=\"1\">" + "null</primary></assign>");
+    }
+
+    @Test
+    public void testEqualityExpression() throws TokenException {
+        assertStatement("1",
+                "5!==6",
+                "<equality line=\"1\"><primary line=\"1\">5"
+                        + "</primary><op line=\"1\">!==</op><primary line=\"1\">6</primary></equality>");
+    }
+
+    @Test
+    public void testExpressionList() throws TokenException {
+        assertStatement("1",
+                "5&&6,5&&9",
+                "<expr-list line=\"1\"><and line=\"1\">"
+                        + "<primary line=\"1\">5</primary><op line=\"1\">"
+                        + "&&</op><primary line=\"1\">6</primary></and><and line=\"1\""
+                        + "><primary line=\"1\">5</primary><op line=\"1\""
+                        + ">&&</op><primary line=\"1\">9</primary></and></expr-list>");
+    }
+
+    @Test
+    public void testInstanceOf() throws TokenException {
+        assertStatement("bug237",
+                "if (a instanceof b){}",
+                "<if line=\"1\"><condition line=\"1\"><relation line=\"1\"><primary "
+                        + "line=\"1\">a</primary><op line=\"1\">instanceof</op><primary line=\"1\">"
+                        + "b</primary></relation></condition><block line=\"1\"></block></if>");
+    }
+
+    @Test
+    public void testMulExpression() throws TokenException {
+        assertStatement("1",
+                "5/6",
+                "<mul line=\"1\"><primary line=\"1\">5"
+                        + "</primary><op line=\"1\">/</op><primary line=\"1\">6</primary></mul>");
+    }
+
+    @Test
+    public void testNewExpression() throws TokenException {
+        assertStatement("",
+                "new Event()",
+                "<new line=\"1\"><call line=\"1\">"
+                        + "<primary line=\"1\">Event</primary>"
+                        + "<arguments line=\"1\"></arguments></call></new>");
+
+        assertStatement("",
+                "new Event(\"lala\")",
+                "<new line=\"1\"><call line=\"1\">"
+                        + "<primary line=\"1\">Event</primary>"
+                        + "<arguments line=\"1\"><primary line=\"1\">"
+                        + "\"lala\"</primary></arguments></call></new>");
+
+    }
+
+    @Test
+    public void testOrExpression() throws TokenException {
+        assertStatement("1",
+                "5||6",
+                "<or line=\"1\"><primary line=\"1\">5"
+                        + "</primary><op line=\"1\">||</op><primary line=\"1\">6</primary></or>");
+    }
+
+    @Test
+    public void testRelationalExpression() throws TokenException {
+        assertStatement("1",
+                "5<=6",
+                "<relation line=\"1\"><primary line=\"1\">5"
+                        + "</primary><op line=\"1\">&lt;=</op><primary line=\"1\""
+                        + ">6</primary></relation>");
+    }
+
+    @Test
+    public void testShiftExpression() throws TokenException {
+        assertStatement("1",
+                "5<<6",
+                "<shift line=\"1\"><primary line=\"1\">5"
+                        + "</primary><op line=\"1\">&lt;&lt;</op><primary line=\"1\""
+                        + ">6</primary></shift>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestForStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestForStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestForStatement.java
new file mode 100644
index 0000000..8560c13
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestForStatement.java
@@ -0,0 +1,97 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestForStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testSimpleFor() throws TokenException {
+        assertStatement("1",
+                "for( var i : int = 0; i < length; i++ ){ trace( i ); }",
+                "<for line=\"1\"><init line=\"1\">"
+                        + "<var-list line=\"1\"><name-type-init line=\"1\""
+                        + "><name line=\"1\">i</name><type line=\"1\">int</type><init line=\"1\">"
+                        + "<primary line=\"1\">0</primary></init>"
+                        + "</name-type-init></var-list></init>"
+                        + "<cond line=\"1\"><relation line=\"1\">"
+                        + "<primary line=\"1\">i</primary><op line=\"1\""
+                        + ">&lt;</op><primary line=\"1\">length"
+                        + "</primary></relation></cond><iter line=\"1\">"
+                        + "<post-inc line=\"1\"><primary line=\"1\">i"
+                        + "</primary></post-inc></iter><block line=\"1\"><call line=\"1\""
+                        + "><primary line=\"1\">trace"
+                        + "</primary><arguments line=\"1\"><primary line=\"1\">i"
+                        + "</primary></arguments></call></block></for>");
+
+        assertStatement("",
+                "        for (i = 0; i < n; i++)",
+                "<for line=\"1\"><init line=\"1\">"
+                        + "<assign line=\"1\"><primary line=\"1\">i</primary><op line=\"1\">=</op>"
+                        + "<primary line=\"1\">0</primary></assign></init>"
+                        + "<cond line=\"1\"><relation line=\"1\"><primary line=\"1\">i</primary>"
+                        + "<op line=\"1\">&lt;</op><primary line=\"1\">n"
+                        + "</primary></relation></cond><iter line=\"1\">"
+                        + "<post-inc line=\"1\"><primary line=\"1\">i"
+                        + "</primary></post-inc></iter><primary line=\"2\">__END__</primary></for>");
+    }
+
+    @Test
+    public void testSimpleForEach() throws TokenException {
+        assertStatement("1",
+                "for each( var obj : Object in list ){ obj.print( i ); }",
+                "<foreach line=\"1\"><var line=\"1\">"
+                        + "<name-type-init line=\"1\"><name line=\"1\""
+                        + ">obj</name><type line=\"1\">Object"
+                        + "</type></name-type-init></var><in line=\"1\">"
+                        + "<primary line=\"1\">list</primary></in>"
+                        + "<block line=\"1\"><dot line=\"1\">"
+                        + "<primary line=\"1\">obj</primary><call line=\"1\""
+                        + "><primary line=\"1\">print</primary>"
+                        + "<arguments line=\"1\"><primary line=\"1\">"
+                        + "i</primary></arguments></call></dot></block></foreach>");
+
+        assertStatement("1",
+                "for each( obj in list ){}",
+                "<foreach line=\"1\"><name line=\"1\">obj</name>"
+                        + "<in line=\"1\"><primary line=\"1\">list</primary>"
+                        + "</in><block line=\"1\"></block></foreach>");
+
+        // assertStatement(
+        // "", "for each (var a:XML in classInfo..accessor) {}", "" );
+    }
+
+    @Test
+    public void testSimpleForIn() throws TokenException {
+        assertStatement("1",
+                "for( var s : String in obj ){ trace( s, obj[ s ]); }",
+                "<forin line=\"1\"><init line=\"1\">"
+                        + "<var-list line=\"1\"><name-type-init line=\"1\""
+                        + "><name line=\"1\">s</name>"
+                        + "<type line=\"1\">String</type></name-type-init>"
+                        + "</var-list></init><in line=\"1\"><primary line=\"1\""
+                        + ">obj</primary></in></forin>");
+
+        assertStatement("for in",
+                "            for (p in events);",
+                "<forin line=\"1\"><init line=\"1\">"
+                        + "<primary line=\"1\">p</primary></init><in line=\"1\""
+                        + "><primary line=\"1\">events</primary></in></forin>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestIfStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestIfStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestIfStatement.java
new file mode 100644
index 0000000..06c2f7f
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestIfStatement.java
@@ -0,0 +1,128 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestIfStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testBug232() throws TokenException {
+        assertStatement("",
+                "if (true || /* comment */!false) ) )",
+                "<if line=\"1\"><condition line=\"1\"><or line=\"1\"><primary line=\"1\">"
+                        + "true</primary><op line=\"1\">||</op><not line=\"1\"><primary "
+                        + "line=\"1\">false</primary></not></or></condition><primary "
+                        + "line=\"1\">)</primary></if>");
+    }
+
+    @Test
+    public void testIf() throws TokenException {
+        assertStatement("1",
+                "if( true ){ trace( true ); }",
+                "<if line=\"1\">"
+                        + "<condition line=\"1\">" + "<primary line=\"1\">true</primary></condition>"
+                        + "<block line=\"1\"><call line=\"1\">" + "<primary line=\"1\">trace"
+                        + "</primary><arguments line=\"1\">" + "<primary line=\"1\">true</primary>"
+                        + "</arguments></call></block></if>");
+
+        assertStatement("1",
+                "if( \"i\" in oaderContext ){ }",
+                "<if line=\"1\"><condition line=\"1\">"
+                        + "<relation line=\"1\"><primary line=\"1\">"
+                        + "\"i\"</primary><op line=\"1\">in</op>"
+                        + "<primary line=\"1\">oaderContext</primary>"
+                        + "</relation></condition><block line=\"1\"></block></if>");
+
+        assertStatement("internal",
+                "if (col.mx_internal::contentSize) {col.mx_internal::_width = NaN;}",
+                "<if line=\"1\"><condition line=\"1\">"
+                        + "<dot line=\"1\"><primary line=\"1\">col"
+                        + "</primary><dot line=\"1\"><primary line=\"1\">"
+                        + "mx_internal</primary><primary line=\"1\">contentSize"
+                        + "</primary></dot></dot></condition><block line=\"1\">"
+                        + "<dot line=\"1\"><primary line=\"1\">col"
+                        + "</primary><dot line=\"1\"><primary line=\"1\">"
+                        + "mx_internal</primary><assign line=\"1\">"
+                        + "<primary line=\"1\">_width</primary>"
+                        + "<op line=\"1\">=</op><primary line=\"1\">"
+                        + "NaN</primary></assign></dot></dot></block></if>");
+    }
+
+    @Test
+    public void testIfElse() throws TokenException {
+        assertStatement("1",
+                "if( true ){ trace( true ); } else { trace( false )}",
+                "<if line=\"1\"><condition line=\"1\">"
+                        + "<primary line=\"1\">true" + "</primary></condition><block line=\"1\">"
+                        + "<call line=\"1\"><primary line=\"1\">trace"
+                        + "</primary><arguments line=\"1\">"
+                        + "<primary line=\"1\">true</primary></arguments>"
+                        + "</call></block><block line=\"1\">" + "<call line=\"1\">"
+                        + "<primary line=\"1\">trace</primary>" + "<arguments line=\"1\">"
+                        + "<primary line=\"1\">false</primary>" + "</arguments></call></block></if>");
+    }
+
+    @Test
+    public void testIfWithArrayAccessor() throws TokenException {
+        assertStatement("",
+                "if ( chart.getItemAt( 0 )[ xField ] > targetXFieldValue ){}",
+                "<if line=\"1\"><condition line=\"1\"><dot line=\"1\""
+                        + "><primary line=\"1\">chart</primary><relation line=\"1\""
+                        + "><call line=\"1\"><primary line=\"1\""
+                        + ">getItemAt</primary><arguments line=\"1\"" + "><primary line=\"1\""
+                        + ">0</primary></arguments><array line=\"1\"" + "><primary line=\"1\""
+                        + ">xField</primary></array></call><op line=\"1\"" + ">&gt;</op><primary "
+                        + "line=\"1\">targetXFieldValue</primary>"
+                        + "</relation></dot></condition><block line=\"1\"" + "></block></if>");
+    }
+
+    @Test
+    public void testIfWithEmptyStatement() throws TokenException {
+        assertStatement("1",
+                "if( i++ ); ",
+                "<if line=\"1\"><condition line=\"1\">"
+                        + "<post-inc line=\"1\"><primary line=\"1\">"
+                        + "i</primary></post-inc></condition><stmt-empty line=\"1\">;"
+                        + "</stmt-empty></if>");
+    }
+
+    @Test
+    public void testIfWithoutBlock() throws TokenException {
+        assertStatement("1",
+                "if( i++ ) trace( i ); ",
+                "<if line=\"1\"><condition line=\"1\">"
+                        + "<post-inc line=\"1\"><primary line=\"1\">i"
+                        + "</primary></post-inc></condition><call line=\"1\">"
+                        + "<primary line=\"1\">trace</primary><arguments line=\"1\""
+                        + "><primary line=\"1\">i</primary>" + "</arguments></call></if>");
+    }
+
+    @Test
+    public void testIfWithReturn() throws TokenException {
+        assertStatement("",
+                "if ( true )return;",
+                "<if line=\"1\"><condition line=\"1\"><primary line=\"1\""
+                        + ">true</primary></condition><return line=\"2\"" + "></return></if>");
+
+        assertStatement("",
+                "if ( true )throw new Error();",
+                "<if line=\"1\"><condition line=\"1\"><primary line=\"1\""
+                        + ">true</primary></condition><primary line=\"1\">" + "throw</primary></if>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestInterface.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestInterface.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestInterface.java
new file mode 100644
index 0000000..cf27b05
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestInterface.java
@@ -0,0 +1,72 @@
+/*
+ * 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.pmd.parser.impl;
+
+import static org.testng.Assert.*;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestInterface extends AbstractAs3ParserTestBase {
+
+    @Test
+    public void testExtends() throws TokenException {
+        assertPackageContent("1",
+                "public interface A extends B { } ",
+                "<content line=\"2\"><interface line=\"2\">"
+                        + "<name line=\"2\">A</name><mod-list line=\"2\">"
+                        + "<mod line=\"2\">public</mod>"
+                        + "</mod-list><extends line=\"2\">B</extends>"
+                        + "<content line=\"2\"></content></interface></content>");
+
+        assertPackageContent("",
+                "   public interface ITimelineEntryRenderer extends IFlexDisplayObject, IDataRenderer{}",
+                "<content line=\"2\"><interface line=\"2\"><name line=\"2\""
+                        + ">ITimelineEntryRenderer</name><mod-list line=\"2\">"
+                        + "<mod line=\"2\">public</mod></mod-list><extends line=\"2\""
+                        + ">IFlexDisplayObject</extends><extends line=\"2\">"
+                        + "IDataRenderer</extends><content line=\"2\">"
+                        + "</content></interface></content>");
+    }
+
+    @Test
+    public void testInclude() throws TokenException {
+        assertPackageContent("1",
+                "public interface A extends B { include \"ITextFieldInterface.asz\" } ",
+                "<content line=\"2\"><interface line=\"2\">"
+                        + "<name line=\"2\">A</name><mod-list line=\"2\">"
+                        + "<mod line=\"2\">public</mod></mod-list>" + "<extends line=\"2\">"
+                        + "B</extends><content line=\"2\"><include line=\"2\">"
+                        + "<primary line=\"2\">\"ITextFieldInterface.asz\"</primary>"
+                        + "</include></content></interface></content>");
+    }
+
+    private void assertPackageContent(final String message,
+                                      final String input,
+                                      final String expected) throws TokenException {
+        scn.setLines(new String[]
+                {"{",
+                        input,
+                        "}",
+                        "__END__"});
+        asp.nextToken(); // first call
+        asp.nextToken(); // skip {
+        final String result = new ASTToXMLConverter().convert(asp.parsePackageContent());
+        assertEquals(expected, result, message);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestInterfaceContent.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestInterfaceContent.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestInterfaceContent.java
new file mode 100644
index 0000000..ea99d9b
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestInterfaceContent.java
@@ -0,0 +1,88 @@
+/*
+ * 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.pmd.parser.impl;
+
+import static org.testng.Assert.*;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestInterfaceContent extends AbstractAs3ParserTestBase {
+
+    @Test
+    public void testConditionalCompilation() throws TokenException {
+        assertInterfaceContent("with conditional compilation",
+                "CONFIG::DEBUG { function output():String; } ",
+                "<function line=\"2\"><name line=\"2\">"
+                        + "output</name><parameter-list line=\"2\"></parameter-list>"
+                        + "<type line=\"2\">String</type></function>");
+    }
+
+    @Test
+    public void testImports() throws TokenException {
+        assertInterfaceContent("1",
+                "import a.b.c;",
+                "<import line=\"2\">a.b.c</import>");
+
+        assertInterfaceContent("2",
+                "import a.b.c import x.y.z",
+                "<import line=\"2\">a.b.c</import>"
+                        + "<import line=\"2\">x.y.z</import>");
+    }
+
+    @Test
+    public void testMethods() throws TokenException {
+        assertInterfaceContent("1",
+                "function a()",
+                "<function line=\"3\">"
+                        + "<name line=\"2\">a</name>"
+                        + "<parameter-list line=\"2\">"
+                        + "</parameter-list><type line=\"3\">"
+                        + "</type></function>");
+
+        assertInterfaceContent("2",
+                "function set a( value : int ) : void",
+                "<set line=\"3\"><name line=\"2\">a"
+                        + "</name><parameter-list line=\"2\">"
+                        + "<parameter line=\"2\">"
+                        + "<name-type-init line=\"2\">"
+                        + "<name line=\"2\">value</name>"
+                        + "<type line=\"2\">int</type>"
+                        + "</name-type-init></parameter></parameter-list>"
+                        + "<type line=\"2\">void</type></set>");
+
+        assertInterfaceContent("3",
+                "function get a() : int",
+                "<get line=\"3\"><name line=\"2\">a"
+                        + "</name><parameter-list line=\"2\">"
+                        + "</parameter-list><type line=\"2\">int" + "</type></get>");
+    }
+
+    private void assertInterfaceContent(final String message,
+                                        final String input,
+                                        final String expected) throws TokenException {
+        scn.setLines(new String[]
+                {"{",
+                        input,
+                        "}",
+                        "__END__"});
+        asp.nextToken(); // first call
+        asp.nextToken(); // skip {
+        final String result = new ASTToXMLConverter().convert(asp.parseInterfaceContent());
+        assertEquals("<content line=\"2\">" + expected + "</content>", result, message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestPackageContent.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestPackageContent.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestPackageContent.java
new file mode 100644
index 0000000..224a0dd
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestPackageContent.java
@@ -0,0 +1,204 @@
+/*
+ * 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.pmd.parser.impl;
+
+import static org.testng.Assert.*;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestPackageContent extends AbstractAs3ParserTestBase {
+
+    @Test
+    public void testClass() throws TokenException {
+        assertPackageContent("1",
+                "public class A { }",
+                "<content line=\"2\"><class line=\"2\">"
+                        + "<name line=\"2\">A</name><mod-list line=\"2\">"
+                        + "<mod line=\"2\">public</mod>" + "</mod-list><content line=\"2\">"
+                        + "</content></class></content>");
+    }
+
+    @Test
+    public void testClassWithAsDoc() throws TokenException {
+        assertPackageContent("1",
+                "/** AsDoc */ public class A { }",
+                "<content line=\"2\"><class line=\"2\">"
+                        + "<as-doc line=\"2\">/** AsDoc */</as-doc><name line=\"2\""
+                        + ">A</name><mod-list line=\"2\"><mod line=\"2\""
+                        + ">public</mod></mod-list><content line=\"2\">"
+                        + "</content></class></content>");
+    }
+
+    @Test
+    public void testClassWithAsDocComplex() throws TokenException {
+        assertPackageContent("1",
+                "/** AsDoc */ public class A { "
+                        + "/** Member */ " + "public var tmp : Number; "
+                        + "private var tmp2 : int; " + "/** Function */ "
+                        + "protected function foo() : void { } }",
+                "<content line=\"2\"><class line=\"2\"><as-doc line=\"2\""
+                        + ">/** AsDoc */</as-doc><name line=\"2\">A</name>"
+                        + "<mod-list line=\"2\"><mod line=\"2\">public</mod>"
+                        + "</mod-list><content line=\"2\"><var-list line=\"2\">"
+                        + "<mod-list line=\"2\"><mod line=\"2\">public</mod>"
+                        + "</mod-list><name-type-init line=\"2\"><name line=\"2\">tmp</name>"
+                        + "<type line=\"2\">Number</type></name-type-init><as-doc line=\"2\""
+                        + ">/** Member */</as-doc></var-list><var-list line=\"2\">"
+                        + "<mod-list line=\"2\"><mod line=\"2\">private</mod></mod-list>"
+                        + "<name-type-init line=\"2\"><name line=\"2\">tmp2</name>"
+                        + "<type line=\"2\">int</type></name-type-init></var-list><function "
+                        + "line=\"2\"><as-doc line=\"2\">/** Function */</as-doc>"
+                        + "<mod-list line=\"2\"><mod line=\"2\">protected</mod></mod-list>"
+                        + "<name line=\"2\">foo</name><parameter-list line=\"2\">"
+                        + "</parameter-list><type line=\"2\">void</type><block line=\"2\""
+                        + "></block></function></content></class></content>");
+    }
+
+    @Test
+    public void testClassWithComment() throws TokenException {
+        assertPackageContent("1",
+                "/* lala */ /** asDoc */ public class A { }",
+                "<content line=\"2\"><class line=\"2\">"
+                        + "<as-doc line=\"2\">/** asDoc */</as-doc><multi-line-comment "
+                        + "line=\"2\">/* lala */</multi-line-comment><name line=\"2\""
+                        + ">A</name><mod-list line=\"2\"><mod line=\"2\""
+                        + ">public</mod></mod-list><content line=\"2\">"
+                        + "</content></class></content>");
+    }
+
+    @Test
+    public void testClassWithMetadata() throws TokenException {
+        assertPackageContent("1",
+                "[Bindable(name=\"abc\", value=\"123\")] public class A { }",
+                "<content line=\"2\"><class line=\"2\">"
+                        + "<name line=\"2\">A</name><meta-list line=\"2\">" + "<meta line=\"2\""
+                        + ">Bindable ( name = \"abc\" , value = \"123\" )</meta>"
+                        + "</meta-list><mod-list line=\"2\">" + "<mod line=\"2\">public"
+                        + "</mod></mod-list><content line=\"2\"></content></class></content>");
+    }
+
+    @Test
+    public void testClassWithMetadataAsDoc() throws TokenException {
+        assertPackageContent("1",
+                "/** Comment */ [Bindable] public class A { }",
+                "<content line=\"2\"><class line=\"2\"><as-doc line=\"2\">"
+                        + "/** Comment */</as-doc><name line=\"2\">A</name><meta-list "
+                        + "line=\"2\"><meta line=\"2\">Bindable</meta></meta-list><mod-list "
+                        + "line=\"2\"><mod line=\"2\">public</mod></mod-list><content "
+                        + "line=\"2\"></content></class></content>");
+    }
+
+    @Test
+    public void testClassWithMetadataComment() throws TokenException {
+        assertPackageContent("1",
+                "/* Comment */ [Bindable] public class A { }",
+                "<content line=\"2\"><class line=\"2\">"
+                        + "<multi-line-comment line=\"2\">/* Comment */"
+                        + "</multi-line-comment><name line=\"2\">A</name>"
+                        + "<meta-list line=\"2\"><meta line=\"2\">"
+                        + "Bindable</meta></meta-list><mod-list line=\"2\"><mod "
+                        + "line=\"2\">public</mod></mod-list><content line=\"2\""
+                        + "></content></class></content>");
+    }
+
+    @Test
+    public void testClassWithMetadataWithComment() throws TokenException {
+        assertPackageContent("1",
+                "/* lala */ /** asDoc */ [Bindable] public class A { }",
+                "<content line=\"2\"><class line=\"2\"><as-doc line=\"2\">"
+                        + "/** asDoc */</as-doc><multi-line-comment line=\"2\">"
+                        + "/* lala */</multi-line-comment><name line=\"2\">A</name>"
+                        + "<meta-list line=\"2\"><meta line=\"2\">Bindable</meta>"
+                        + "</meta-list><mod-list line=\"2\"><mod line=\"2\">public"
+                        + "</mod></mod-list><content line=\"2\"></content></class></content>");
+    }
+
+    @Test
+    public void testClassWithSimpleMetadata() throws TokenException {
+        assertPackageContent("1",
+                "[Bindable] public class A { }",
+                "<content line=\"2\"><class line=\"2\"><name line=\"2\""
+                        + ">A</name><meta-list line=\"2\"><meta line=\"2\""
+                        + ">Bindable</meta></meta-list><mod-list line=\"2\">"
+                        + "<mod line=\"2\">public</mod></mod-list><content line=\"2\""
+                        + "></content></class></content>");
+    }
+
+    @Test
+    public void testImports() throws TokenException {
+        assertPackageContent("1",
+                "import a.b.c;",
+                "<content line=\"2\"><import line=\"2\""
+                        + ">a.b.c</import></content>");
+
+        assertPackageContent("2",
+                "import a.b.c import x.y.z",
+                "<content line=\"2\"><import line=\"2\">a.b.c"
+                        + "</import><import line=\"2\">x.y.z</import></content>");
+    }
+
+    @Test
+    public void testInterface() throws TokenException {
+        assertPackageContent("1",
+                "public interface A { }",
+                "<content line=\"2\"><interface line=\"2\">"
+                        + "<name line=\"2\">A</name><mod-list line=\"2\">"
+                        + "<mod line=\"2\">public</mod>" + "</mod-list><content line=\"2\">"
+                        + "</content></interface></content>");
+    }
+
+    @Test
+    public void testMethodPackages() throws TokenException {
+        assertPackageContent("1",
+                "public function a() : void { }",
+                "<content line=\"2\"><function line=\"2\">"
+                        + "<mod-list line=\"2\"><mod line=\"2\">public</mod>"
+                        + "</mod-list><name line=\"2\">a</name><parameter-list line=\"2\""
+                        + "></parameter-list><type line=\"2\">void</type>"
+                        + "<block line=\"2\"></block></function></content>");
+    }
+
+    @Test
+    public void testUse() throws TokenException {
+        assertPackageContent("1",
+                "use namespace myNamespace",
+                "<content line=\"2\"><use line=\"2\""
+                        + ">myNamespace</use></content>");
+    }
+
+    @Test
+    public void testUseNameSpace() throws TokenException {
+        assertPackageContent("FlexPMD-108",
+                "use namespace mx_internal;",
+                "<content line=\"2\"><use line=\"2\">mx_internal</use></content>");
+    }
+
+    private void assertPackageContent(final String message,
+                                      final String input,
+                                      final String expected) throws TokenException {
+        scn.setLines(new String[]
+                {"{",
+                        input,
+                        "}",
+                        "__END__"});
+        asp.nextToken(); // first call
+        asp.nextToken(); // skip {
+        final String result = new ASTToXMLConverter().convert(asp.parsePackageContent());
+        assertEquals(expected, result, message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestPrimaryExpression.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestPrimaryExpression.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestPrimaryExpression.java
new file mode 100644
index 0000000..81a8730
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestPrimaryExpression.java
@@ -0,0 +1,102 @@
+/*
+ * 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.pmd.parser.impl;
+
+import static org.testng.Assert.*;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestPrimaryExpression extends AbstractAs3ParserTestBase {
+
+    @Test
+    public void testArrayLiteral() throws TokenException {
+        assertPrimary("[1,2,3]",
+                "<array line=\"1\"><primary line=\"1\">1"
+                        + "</primary><primary line=\"1\">2</primary>"
+                        + "<primary line=\"1\">3</primary></array>");
+    }
+
+    @Test
+    public void testBooleans() throws TokenException {
+        assertPrimary("true");
+        assertPrimary("false");
+    }
+
+    @Test
+    public void testFunctionLiteral() throws TokenException {
+        assertPrimary("function ( a : Object ) : * { trace('test'); }",
+                "<lambda line=\"1\"><parameter-list line=\"1\">"
+                        + "<parameter line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"1\">"
+                        + "Object</type></name-type-init></parameter></parameter-list>"
+                        + "<type line=\"1\">*</type><block line=\"1\">"
+                        + "<call line=\"1\"><primary line=\"1\">trace</primary>"
+                        + "<arguments line=\"1\"><primary line=\"1\">'test'"
+                        + "</primary></arguments></call></block></lambda>");
+    }
+
+    @Test
+    public void testNull() throws TokenException {
+        assertPrimary("null");
+    }
+
+    @Test
+    public void testNumbers() throws TokenException {
+        assertPrimary("1");
+        assertPrimary("0xff");
+        assertPrimary("0777");
+        assertPrimary(".12E5");
+    }
+
+    @Test
+    public void testObjectLiteral() throws TokenException {
+        assertPrimary("{a:1,b:2}",
+                "<object line=\"1\"><prop line=\"1\">"
+                        + "<name line=\"1\">a</name><value line=\"1\">"
+                        + "<primary line=\"1\">1</primary></value></prop><prop line=\"1\">"
+                        + "<name line=\"1\">b</name><value line=\"1\">"
+                        + "<primary line=\"1\">2</primary></value></prop></object>");
+    }
+
+    @Test
+    public void testStrings() throws TokenException {
+        assertPrimary("\"string\"");
+        assertPrimary("'string'");
+    }
+
+    @Test
+    public void testUndefined() throws TokenException {
+        assertPrimary("undefined");
+    }
+
+    private void assertPrimary(final String input) throws TokenException {
+        assertPrimary(input,
+                input);
+    }
+
+    private void assertPrimary(final String input,
+                               final String expected) throws TokenException {
+        scn.setLines(new String[]
+                {input,
+                        "__END__"});
+        asp.nextToken();
+        final String result = new ASTToXMLConverter().convert(asp.parsePrimaryExpression());
+        assertEquals("<primary line=\"1\">" + expected + "</primary>", result, "unexpected");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestReturnStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestReturnStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestReturnStatement.java
new file mode 100644
index 0000000..8110a05
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestReturnStatement.java
@@ -0,0 +1,65 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestReturnStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testEmptyReturn() throws TokenException {
+        assertStatement("1",
+                "return",
+                "<return line=\"2\"></return>");
+
+        assertStatement("2",
+                "return;",
+                "<return line=\"2\"></return>");
+    }
+
+    @Test
+    public void testFlexPMD181a() throws TokenException {
+        assertStatement("1",
+                "return (str1 === str2);",
+                "<return line=\"1\"><primary line=\"1\"><encapsulated line=\"1\">"
+                        + "<equality line=\"1\"><primary line=\"1\">str1</primary><op line=\"1\">"
+                        + "===</op><primary line=\"1\">str2</primary></equality>"
+                        + "</encapsulated></primary></return>");
+    }
+
+    @Test
+    public void testFlexPMD181b() throws TokenException {
+        assertStatement("1",
+                "return testString(str, /^[a-zA-Z\\s]*$/);",
+                "<return line=\"1\"><call line=\"1\"><primary line=\"1\">testString"
+                        + "</primary><arguments line=\"1\"><primary line=\"1\">str</primary>"
+                        + "<primary line=\"1\">/^[a-zA-Z\\s]*$/</primary></arguments></call></return>");
+    }
+
+    @Test
+    public void testReturnArrayLiteral() throws TokenException {
+        assertStatement("1",
+                "return []",
+                "<return line=\"1\"><primary line=\"1\">"
+                        + "<array line=\"1\"></array></primary></return>");
+        assertStatement("2",
+                "return [];",
+                "<return line=\"1\"><primary line=\"1\">"
+                        + "<array line=\"1\"></array></primary></return>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestSwitchStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestSwitchStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestSwitchStatement.java
new file mode 100644
index 0000000..284cc6b
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestSwitchStatement.java
@@ -0,0 +1,50 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestSwitchStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testFullFeatured() throws TokenException {
+        assertStatement("1",
+                "switch( x ){ case 1 : trace('one'); break; default : trace('unknown'); }",
+                "<switch line=\"1\"><condition line=\"1\">"
+                        + "<primary line=\"1\">x</primary>" + "</condition><cases line=\"1\">"
+                        + "<case line=\"1\"><primary line=\"1\">1</primary>"
+                        + "<switch-block line=\"1\"><call line=\"1\">"
+                        + "<primary line=\"1\">trace</primary><arguments line=\"1\">"
+                        + "<primary line=\"1\">'one'</primary></arguments>"
+                        + "</call><primary line=\"1\">break</primary>"
+                        + "</switch-block></case><case line=\"1\">" + "<default line=\"1\">"
+                        + "default</default><switch-block line=\"1\">"
+                        + "<call line=\"1\"><primary line=\"1\">trace" + "</primary>"
+                        + "<arguments line=\"1\">" + "<primary line=\"1\">'unknown'</primary>"
+                        + "</arguments></call></switch-block></case></cases></switch>");
+        assertStatement("1",
+                "switch( x ){ case 1 : break; default:}",
+                "<switch line=\"1\"><condition line=\"1\"><primary line=\"1\""
+                        + ">x</primary></condition><cases line=\"1\"><case line=\"1\""
+                        + "><primary line=\"1\">1</primary><switch-block line=\"1\""
+                        + "><primary line=\"1\">break</primary></switch-block></case>"
+                        + "<case line=\"1\"><default line=\"1\">default</default>"
+                        + "<switch-block line=\"1\"></switch-block></case></cases></switch>");
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestTryCatchFinallyStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestTryCatchFinallyStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestTryCatchFinallyStatement.java
new file mode 100644
index 0000000..190f129
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestTryCatchFinallyStatement.java
@@ -0,0 +1,54 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestTryCatchFinallyStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testCatch() throws TokenException {
+        assertStatement("1",
+                "catch( e : Error ) {trace( true ); }",
+                "<catch line=\"1\"><name line=\"1\">e"
+                        + "</name><type line=\"1\">Error</type><block line=\"1\">"
+                        + "<call line=\"1\"><primary line=\"1\">trace</primary>"
+                        + "<arguments line=\"1\"><primary line=\"1\">true"
+                        + "</primary></arguments></call></block></catch>");
+    }
+
+    @Test
+    public void testFinally() throws TokenException {
+        assertStatement("1",
+                "finally {trace( true ); }",
+                "<finally line=\"1\"><block line=\"1\">"
+                        + "<call line=\"1\"><primary line=\"1\">"
+                        + "trace</primary><arguments line=\"1\"><primary line=\"1\">"
+                        + "true</primary></arguments></call></block></finally>");
+    }
+
+    @Test
+    public void testTry() throws TokenException {
+        assertStatement("1",
+                "try {trace( true ); }",
+                "<try line=\"1\"><block line=\"1\">"
+                        + "<call line=\"1\"><primary line=\"1\">"
+                        + "trace</primary><arguments line=\"1\"><primary line=\"1\">"
+                        + "true</primary></arguments></call></block></try>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestUnaryExpression.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestUnaryExpression.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestUnaryExpression.java
new file mode 100644
index 0000000..5cc2b01
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestUnaryExpression.java
@@ -0,0 +1,126 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestUnaryExpression extends AbstractStatementTestBase {
+
+    @Test
+    public void testArrayAccess() throws TokenException {
+        assertStatement("1",
+                "x[0]",
+                "<arr-acc line=\"1\"><primary line=\"1\">x<"
+                        + "/primary><primary line=\"1\">0</primary></arr-acc>");
+    }
+
+    @Test
+    public void testComplex() throws TokenException {
+        assertStatement("1",
+                "a.b['c'].d.e(1)",
+                "<dot line=\"1\"><primary line=\"1\">a"
+                        + "</primary><dot line=\"1\"><arr-acc line=\"1\">"
+                        + "<primary line=\"1\">b</primary><primary line=\"1\">"
+                        + "'c'</primary></arr-acc><dot line=\"1\"><primary line=\"1\">"
+                        + "d</primary><call line=\"1\"><primary line=\"1\">e"
+                        + "</primary><arguments line=\"1\"><primary line=\"1\">1"
+                        + "</primary></arguments></call></dot></dot></dot>");
+
+        assertStatement("2",
+                "a.b['c']['d'].e(1)",
+                "<dot line=\"1\"><primary line=\"1\">a"
+                        + "</primary><dot line=\"1\"><arr-acc line=\"1\">"
+                        + "<primary line=\"1\">b</primary><primary line=\"1\">"
+                        + "'c'</primary><primary line=\"1\">'d'</primary>"
+                        + "</arr-acc><call line=\"1\"><primary line=\"1\">"
+                        + "e</primary><arguments line=\"1\"><primary line=\"1\">1"
+                        + "</primary></arguments></call></dot></dot>");
+    }
+
+    @Test
+    public void testMethodCall() throws TokenException {
+        assertStatement("1",
+                "method()",
+                "<call line=\"1\"><primary line=\"1\">"
+                        + "method</primary><arguments line=\"1\"></arguments></call>");
+
+        assertStatement("2",
+                "method( 1, \"two\" )",
+                "<call line=\"1\"><primary line=\"1\">"
+                        + "method</primary><arguments line=\"1\"><primary line=\"1\">1"
+                        + "</primary><primary line=\"1\">\"two\"</primary></arguments></call>");
+    }
+
+    @Test
+    public void testMultipleMethodCall() throws TokenException {
+        assertStatement("1",
+                "method()()",
+                "<call line=\"1\"><primary line=\"1\">"
+                        + "method</primary><arguments line=\"1\"></arguments>"
+                        + "<arguments line=\"1\"></arguments></call>");
+    }
+
+    @Test
+    public void testParseUnaryExpressions() throws TokenException {
+        assertStatement("1",
+                "++x",
+                "<pre-inc line=\"1\"><primary line=\"1\">x</primary></pre-inc>");
+        assertStatement("2",
+                "x++",
+                "<post-inc line=\"2\"><primary line=\"1\">x</primary></post-inc>");
+        assertStatement("3",
+                "--x",
+                "<pre-dec line=\"1\"><primary line=\"1\">x</primary></pre-dec>");
+        assertStatement("4",
+                "x--",
+                "<post-dec line=\"2\"><primary line=\"1\">x</primary></post-dec>");
+        assertStatement("5",
+                "+x",
+                "<plus line=\"1\"><primary line=\"1\">x</primary></plus>");
+        assertStatement("6",
+                "+ x",
+                "<plus line=\"1\"><primary line=\"1\">x</primary></plus>");
+        assertStatement("7",
+                "-x",
+                "<minus line=\"1\"><primary line=\"1\">x</primary></minus>");
+        assertStatement("8",
+                "- x",
+                "<minus line=\"1\"><primary line=\"1\">x</primary></minus>");
+        assertStatement("9",
+                "delete x",
+                "<delete line=\"1\"><primary line=\"1\">x</primary></delete>");
+        assertStatement("a",
+                "void x",
+                "<void line=\"1\"><primary line=\"1\">x</primary></void>");
+        assertStatement("b",
+                "typeof x",
+                "<typeof line=\"1\"><primary line=\"1\">x</primary></typeof>");
+        assertStatement("c",
+                "! x",
+                "<not line=\"1\"><primary line=\"1\">x</primary></not>");
+        assertStatement("d",
+                "~ x",
+                "<b-not line=\"1\"><primary line=\"1\">x</primary></b-not>");
+        assertStatement("e",
+                "x++",
+                "<post-inc line=\"2\"><primary line=\"1\">x</primary></post-inc>");
+        assertStatement("f",
+                "x--",
+                "<post-dec line=\"2\"><primary line=\"1\">x</primary></post-dec>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestVarStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestVarStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestVarStatement.java
new file mode 100644
index 0000000..325ed06
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestVarStatement.java
@@ -0,0 +1,119 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestVarStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testFlexPMD211() throws TokenException {
+        assertStatement("",
+                "var a:Vector.<String> = new Vector.<String>();\nvar i:int;",
+                "<var-list line=\"1\"><name-type-init line=\"1\"><name line=\"1\">a</name>"
+                        + "<vector line=\"1\"><type line=\"1\">String</type></vector>"
+                        + "<init line=\"1\"><new line=\"1\"><primary line=\"1\">Vector</primary>"
+                        + "<vector line=\"1\"><vector line=\"1\"><type line=\"1\">String</type>"
+                        + "</vector></vector><arguments line=\"1\"></arguments></new></init>"
+                        + "</name-type-init></var-list>");
+    }
+
+    @Test
+    public void testFullFeaturedVar() throws TokenException {
+        assertStatement("1",
+                "var a : int = 4",
+                "<var-list line=\"1\">"
+                        + "<name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"1\">int</type>"
+                        + "<init line=\"1\"><primary line=\"1\">4</primary>"
+                        + "</init></name-type-init></var-list>");
+
+        assertStatement("1",
+                "var a : int = 4, b : int = 2;",
+                "<var-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"1\">int</type>"
+                        + "<init line=\"1\"><primary line=\"1\">4</primary></init>"
+                        + "</name-type-init><name-type-init line=\"1\">"
+                        + "<name line=\"1\">b</name><type line=\"1\">int</type>"
+                        + "<init line=\"1\"><primary line=\"1\">2</primary></init>"
+                        + "</name-type-init></var-list>");
+
+        assertStatement("with array",
+                "var colors:Array = [0x2bc9f6, 0x0086ad];",
+                "<var-list line=\"1\">"
+                        + "<name-type-init line=\"1\">"
+                        + "<name line=\"1\">colors</name><type line=\"1\">Array</type>"
+                        + "<init line=\"1\">" + "<primary line=\"1\"><array line=\"1\">"
+                        + "<primary line=\"1\">0x2bc9f6</primary>"
+                        + "<primary line=\"1\">0x0086ad</primary>"
+                        + "</array></primary></init></name-type-init></var-list>");
+    }
+
+    @Test
+    public void testInitializedVar() throws TokenException {
+        assertStatement("1",
+                "var a = 4",
+                "<var-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"1\">"
+                        + "</type><init line=\"1\"><primary line=\"1\">4</primary>"
+                        + "</init></name-type-init></var-list>");
+    }
+
+    @Test
+    public void testSimpleVar() throws TokenException {
+        assertStatement("1",
+                "var a",
+                "<var-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"2\">"
+                        + "</type></name-type-init></var-list>");
+    }
+
+    @Test
+    public void testTypedVar() throws TokenException {
+        assertStatement("1",
+                "var a : Object",
+                "<var-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">a</name><type line=\"1\">Object</type>"
+                        + "</name-type-init></var-list>");
+    }
+
+    @Test
+    public void testVector() throws TokenException {
+        assertStatement("vector",
+                "var v:Vector.<DisplayObject> = new Vector.<Sprite>();",
+                "<var-list line=\"1\"><name-type-init line=\"1\"><name line=\"1\">v</name><vector line=\"1\"><type line=\"1\">DisplayObject</type></vector><init line=\"1\"><new line=\"1\"><primary line=\"1\">Vector</primary><vector line=\"1\"><vector line=\"1\"><type line=\"1\">Sprite</type></vector></vector><arguments line=\"1\"></arguments></new></init></name-type-init></var-list>");
+
+        assertStatement("vector",
+                "var v:Vector.< Vector.< String > >",
+                "<var-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">" + "v</name><vector line=\"1\"><vector line=\"1\""
+                        + "><type line=\"1\""
+                        + ">String</type></vector></vector></name-type-init></var-list>");
+
+        assertStatement("vector",
+                "var v:Vector.<Vector.<String>>;",
+                "<var-list line=\"1\"><name-type-init line=\"1\">"
+                        + "<name line=\"1\">"
+                        + "v</name><vector line=\"1\"><vector line=\"1\"><type line=\"1\""
+                        + ">String</type></vector></vector></name-type-init></var-list>");
+
+        assertStatement("",
+                "var HT:Vector.<BitString> = new Vector.<BitString>(251, true);",
+                "<var-list line=\"1\"><name-type-init line=\"1\"><name line=\"1\">HT</name><vector line=\"1\"><type line=\"1\">BitString</type></vector><init line=\"1\"><new line=\"1\"><primary line=\"1\">Vector</primary><vector line=\"1\"><vector line=\"1\"><type line=\"1\">BitString</type></vector></vector><arguments line=\"1\"><primary line=\"1\">251</primary><primary line=\"1\">true</primary></arguments></new></init></name-type-init></var-list>");
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/ff722d6f/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestWhileStatement.java
----------------------------------------------------------------------
diff --git a/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestWhileStatement.java b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestWhileStatement.java
new file mode 100644
index 0000000..6cd12dc
--- /dev/null
+++ b/FlexPMD/language-module/parser/parser-impl/src/test/java/org/apache/flex/pmd/parser/impl/TestWhileStatement.java
@@ -0,0 +1,63 @@
+/*
+ * 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.pmd.parser.impl;
+
+import org.apache.flex.pmd.parser.exceptions.TokenException;
+import org.testng.annotations.Test;
+
+public class TestWhileStatement extends AbstractStatementTestBase {
+
+    @Test
+    public void testWhile() throws TokenException {
+        assertStatement("1",
+                "while( i++ ){ trace( i ); }",
+                "<while line=\"1\">"
+                        + "<condition line=\"1\">"
+                        + "<post-inc line=\"1\">"
+                        + "<primary line=\"1\">i</primary>"
+                        + "</post-inc>"
+                        + "</condition>"
+                        + "<block line=\"1\"><call line=\"1\">"
+                        + "<primary line=\"1\">trace</primary>"
+                        + "<arguments line=\"1\"><primary line=\"1\">i</primary>"
+                        + "</arguments></call>" + "</block>" + "</while>");
+    }
+
+    @Test
+    public void testWhileWithEmptyStatement() throws TokenException {
+        assertStatement("1",
+                "while( i++ ); ",
+                "<while line=\"1\">"
+                        + "<condition line=\"1\">"
+                        + "<post-inc line=\"1\">"
+                        + "<primary line=\"1\">i</primary>"
+                        + "</post-inc></condition><stmt-empty line=\"1\">;</stmt-empty></while>");
+    }
+
+    @Test
+    public void testWhileWithoutBlock() throws TokenException {
+        assertStatement("1",
+                "while( i++ ) trace( i ); ",
+                "<while line=\"1\">"
+                        + "<condition line=\"1\">"
+                        + "<post-inc line=\"1\">"
+                        + "<primary line=\"1\">i</primary>"
+                        + "</post-inc></condition><call line=\"1\">"
+                        + "<primary line=\"1\">trace</primary><arguments line=\"1\">"
+                        + "<primary line=\"1\">i</primary></arguments></call></while>");
+    }
+}


Mime
View raw message