diff --git a/org.antlr.feature/antlr.config b/org.antlr.feature/antlr.config new file mode 100644 index 000000000..e69de29bb diff --git a/org.antlr.feature/build.properties b/org.antlr.feature/build.properties new file mode 100644 index 000000000..64f93a9f0 --- /dev/null +++ b/org.antlr.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/org.antlr.feature/feature.xml b/org.antlr.feature/feature.xml new file mode 100644 index 000000000..e04c5c2c3 --- /dev/null +++ b/org.antlr.feature/feature.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/org.antlr.feature/pom.xml b/org.antlr.feature/pom.xml new file mode 100644 index 000000000..0593d294f --- /dev/null +++ b/org.antlr.feature/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + + org.antlr + antlr-master + 3.5.3-SNAPSHOT + + + org.antlr.feature + eclipse-feature + + org.antlr.feature + + + + + org.eclipse.tycho + tycho-maven-plugin + + + org.eclipse.tycho + target-platform-configuration + + + + + diff --git a/org.antlr.runtime/META-INF/MANIFEST.MF b/org.antlr.runtime/META-INF/MANIFEST.MF new file mode 100644 index 000000000..8af58a9d8 --- /dev/null +++ b/org.antlr.runtime/META-INF/MANIFEST.MF @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: org.antlr.runtime +Bundle-SymbolicName: org.antlr.runtime +Bundle-Version: 3.5.3.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Export-Package: org.antlr.runtime, + org.antlr.runtime.debug, + org.antlr.runtime.misc, + org.antlr.runtime.tree diff --git a/org.antlr.runtime/META-INF/maven/org.antlr/antlr-runtime/pom.properties b/org.antlr.runtime/META-INF/maven/org.antlr/antlr-runtime/pom.properties new file mode 100644 index 000000000..17fae3efa --- /dev/null +++ b/org.antlr.runtime/META-INF/maven/org.antlr/antlr-runtime/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Sun Apr 10 02:09:06 CEST 2016 +version=3.5.3-SNAPSHOT +groupId=org.antlr +artifactId=antlr-runtime diff --git a/org.antlr.runtime/META-INF/maven/org.antlr/antlr-runtime/pom.xml b/org.antlr.runtime/META-INF/maven/org.antlr/antlr-runtime/pom.xml new file mode 100644 index 000000000..9e4ac85b8 --- /dev/null +++ b/org.antlr.runtime/META-INF/maven/org.antlr/antlr-runtime/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + org.antlr + antlr-runtime + jar + + + + org.antlr + antlr-master + 3.5.3-SNAPSHOT + ../.. + + + ANTLR 3 Runtime + + A framework for constructing recognizers, compilers, and translators from grammatical descriptions containing Java, C#, C++, or Python actions. + http://www.antlr.org + + + Terence Parr + USFCA + http://www.cs.usfca.edu + parrt@antlr.org + + Project Leader + Developer - Java Target + + PST + + + Jim Idle + Temporal Wave LLC + http://www.temporal-wave.com + jimi@temporal-wave.com + + Developer - Maven stuff + Developer - C Target + + PST + + + + + + + org.antlr + stringtemplate + compile + true + + + + junit + junit + + + + + diff --git a/org.antlr.runtime/antlr.config b/org.antlr.runtime/antlr.config new file mode 100644 index 000000000..e69de29bb diff --git a/org.antlr.runtime/build.properties b/org.antlr.runtime/build.properties new file mode 100644 index 000000000..876835f39 --- /dev/null +++ b/org.antlr.runtime/build.properties @@ -0,0 +1,4 @@ +source.. = . +output.. = . +bin.includes = META-INF/,\ + org/ diff --git a/org.antlr.runtime/org/antlr/runtime/misc/DoubleKeyMap.class b/org.antlr.runtime/org/antlr/runtime/misc/DoubleKeyMap.class new file mode 100644 index 000000000..0cd0922ee Binary files /dev/null and b/org.antlr.runtime/org/antlr/runtime/misc/DoubleKeyMap.class differ diff --git a/org.antlr.runtime/org/antlr/runtime/misc/FastQueue.class b/org.antlr.runtime/org/antlr/runtime/misc/FastQueue.class new file mode 100644 index 000000000..00a13e50e Binary files /dev/null and b/org.antlr.runtime/org/antlr/runtime/misc/FastQueue.class differ diff --git a/org.antlr.runtime/org/antlr/runtime/misc/IntArray.class b/org.antlr.runtime/org/antlr/runtime/misc/IntArray.class new file mode 100644 index 000000000..08a2ba732 Binary files /dev/null and b/org.antlr.runtime/org/antlr/runtime/misc/IntArray.class differ diff --git a/org.antlr.runtime/org/antlr/runtime/misc/LookaheadStream.class b/org.antlr.runtime/org/antlr/runtime/misc/LookaheadStream.class new file mode 100644 index 000000000..0a4c34e29 Binary files /dev/null and b/org.antlr.runtime/org/antlr/runtime/misc/LookaheadStream.class differ diff --git a/org.antlr.runtime/org/antlr/runtime/misc/Stats.class b/org.antlr.runtime/org/antlr/runtime/misc/Stats.class new file mode 100644 index 000000000..4acdca40d Binary files /dev/null and b/org.antlr.runtime/org/antlr/runtime/misc/Stats.class differ diff --git a/org.antlr.runtime/pom.xml b/org.antlr.runtime/pom.xml new file mode 100644 index 000000000..b47cb49a6 --- /dev/null +++ b/org.antlr.runtime/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + + org.antlr + antlr-master + 3.5.3-SNAPSHOT + + + org.antlr.runtime + eclipse-plugin + + + + + org.eclipse.tycho + tycho-maven-plugin + + + org.eclipse.tycho + target-platform-configuration + + + + + diff --git a/org.antlr.updatesite/antlr.config b/org.antlr.updatesite/antlr.config new file mode 100644 index 000000000..e69de29bb diff --git a/org.antlr.updatesite/category.xml b/org.antlr.updatesite/category.xml new file mode 100644 index 000000000..c4d152ba1 --- /dev/null +++ b/org.antlr.updatesite/category.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.antlr.updatesite/pom.xml b/org.antlr.updatesite/pom.xml new file mode 100644 index 000000000..9cbd58749 --- /dev/null +++ b/org.antlr.updatesite/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + + org.antlr + antlr-master + 3.5.3-SNAPSHOT + + + org.antlr.updatesite + eclipse-repository + + + github + + + + + + org.eclipse.tycho + tycho-maven-plugin + + + org.eclipse.tycho + target-platform-configuration + + + org.eclipse.tycho + tycho-p2-director-plugin + ${tycho.version} + + + materialize-products + + materialize-products + + + + archive-products + + archive-products + + + + + + com.github.github + site-maven-plugin + 0.12 + + refs/heads/gh-pages + + **/* + + Creating site for ${project.version} + ${project.build.directory}/repository + + antlr3 + timeraider4u + true + + + + + site + + deploy + + + + + + + diff --git a/pom.xml b/pom.xml index e08d60f10..ff3a8cf94 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,9 @@ gunit-maven-plugin antlr3-maven-archetype antlr-complete + org.antlr.runtime + org.antlr.feature + org.antlr.updatesite 1.5 - - - - + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.1 + + false + internal.repo::default::file://${project.build.directory}/mvn-repo + + + + + com.github.github + site-maven-plugin + 0.12 + + refs/heads/mvn-repo + + **/* + + true + Creating site for ${project.version} + ${project.build.directory}/mvn-repo + + antlr3 + timeraider4u + true + + + + + site + + deploy + + + + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho.version} + true + + + org.eclipse.tycho + target-platform-configuration + ${tycho.version} + + + + linux + gtk + x86 + + + linux + gtk + x86_64 + + + win32 + win32 + x86 + + + win32 + win32 + x86_64 + + + macosx + cocoa + x86_64 + + + + + + + + + + + + + internal.repo + Temporary Staging Repository + file://${project.build.directory}/mvn-repo + + diff --git a/tool/src/main/java/org/antlr/analysis/NFAToDFAConverter.java b/tool/src/main/java/org/antlr/analysis/NFAToDFAConverter.java index f4b8538c4..48b19b794 100644 --- a/tool/src/main/java/org/antlr/analysis/NFAToDFAConverter.java +++ b/tool/src/main/java/org/antlr/analysis/NFAToDFAConverter.java @@ -595,6 +595,9 @@ public void closure(NFAState p, DFAState d, boolean collectPredicates) { + boolean forceHoisting = Boolean.parseBoolean((String)dfa.nfa.grammar.getOption("forceHoisting")); + collectPredicates = collectPredicates || forceHoisting; + if ( debug ){ System.out.println("closure at "+p.enclosingRule.name+" state "+p.stateNumber+"|"+ alt+" filling DFA state "+d.stateNumber+" with context "+context diff --git a/tool/src/main/java/org/antlr/tool/Grammar.java b/tool/src/main/java/org/antlr/tool/Grammar.java index 667ebb2dd..75f3cf144 100644 --- a/tool/src/main/java/org/antlr/tool/Grammar.java +++ b/tool/src/main/java/org/antlr/tool/Grammar.java @@ -249,6 +249,7 @@ public String toString() { add("k"); add("backtrack"); add("memoize"); + add("forceHoisting"); } }; @@ -262,6 +263,7 @@ public String toString() { add("k"); add("backtrack"); add("memoize"); + add("forceHoisting"); } }; diff --git a/tool/src/test/java/org/antlr/test/TestSemanticPredicates.java b/tool/src/test/java/org/antlr/test/TestSemanticPredicates.java index 0ad540cfc..28ee5ef35 100644 --- a/tool/src/test/java/org/antlr/test/TestSemanticPredicates.java +++ b/tool/src/test/java/org/antlr/test/TestSemanticPredicates.java @@ -171,6 +171,51 @@ public void testOrPredicates() throws Exception { checkDecision(g, 1, expecting, null, null, null, null, null, 0, true); } + + @Test public void testForceHoistingOverActions() throws Exception { + Grammar g = new Grammar( + "parser grammar P;\n"+ + "options {forceHoisting=true;}\n"+ + "a : {a1} {p1}? A | {a2} {p2}? A ;"); + String expecting = + ".s0-A->.s1\n" + + ".s1-{p1}?->:s2=>1\n" + + ".s1-{p2}?->:s3=>2\n"; + checkDecision(g, 1, expecting, null, null, null, null, null, 0, false); + } + + + @Test public void testForceHoistingOverActions2() throws Exception { + Grammar g = new Grammar( + "parser grammar P;\n"+ + "options {forceHoisting=true;}\n"+ + "foobar: (foo | bar)+\n;"+ + "foo: {/*do nothing*/} {p1}? MY;\n"+ + "bar: MY;\n"); + + String expecting = + ".s0-EOF->:s1=>3\n"+ + ".s0-MY->.s2\n"+ + ".s2-{p1}?->:s3=>1\n"+ + ".s2-{true}?->:s4=>2\n"; + checkDecision(g, 1, expecting, null, null, null, null, null, 0, false); + } + + @Test public void testForceHoistingOverActions3() throws Exception { + Grammar g = new Grammar( + "parser grammar P;\n"+ + "options {forceHoisting=true;}\n"+ + "foobar: {/*do nothing*/}(foo | bar)+\n;"+ + "foo: {/*do nothing*/} {p1}? MY;\n"+ + "bar: MY;\n"); + + String expecting = + ".s0-EOF->:s1=>3\n"+ + ".s0-MY->.s2\n"+ + ".s2-{p1}?->:s3=>1\n"+ + ".s2-{true}?->:s4=>2\n"; + checkDecision(g, 1, expecting, null, null, null, null, null, 0, false); + } /* @Test public void testIncompleteSemanticHoistedContextk2() throws Exception {