diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..cceb80d1237c85704151285b6727046695476e63
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,30 @@
+# Maven build folders
+target/
+
+# IntelliJ project files
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# Eclipse project files
+.project
+.classpath
+.settings/
+
+# NetBeans user configuration
+nbactions.xml
+nb-configuration.xml
+
+# Python runtime files
+*.py[co]
+
+# ANTLR C# target build folders
+/runtime/CSharp3/Sources/Antlr3.Runtime/bin/
+/runtime/CSharp3/Sources/Antlr3.Runtime/obj/
+/runtime/CSharp3/Sources/Antlr3.Runtime.Debug/bin/
+/runtime/CSharp3/Sources/Antlr3.Runtime.Debug/obj/
+/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/bin/
+/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/obj/
+/runtime/CSharp3/Sources/Antlr3.Runtime.Test/bin/
+/runtime/CSharp3/Sources/Antlr3.Runtime.Test/obj/
diff --git a/BUILD.txt b/BUILD.txt
index f6e41c31e99bbd4eea6b2e50d0a0091f94d6626d..d0d1b166adaf00a5293d0fdd5b281eadb42f9ef5 100644
--- a/BUILD.txt
+++ b/BUILD.txt
@@ -1,493 +1,6 @@
- [The "BSD license"]
- Copyright (c) 2010 Terence Parr
- Maven Plugin - Copyright (c) 2009 Jim Idle
+We have moved instructions for building ANTLR with the maven build system to:
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-============================================================================
-
-This file contains the build instructions for the ANTLR toolset as
-of version 3.1.3 and beyond.
-
-The ANTLR toolset must be built using the Maven build system as
-this build system updates the version numbers and controls the
-whole build process. However, if you just want the latest build
-and do not care to learn anything about Maven, then visit the 'target'
-directories (for jars) under the depot mirror root here:
-
- http://antlr.org/depot
-
-If you are looking for the latest released version of ANTLR, then
-visit the downloads page on the main antlr.org website.
-
-These instructions are mainly for the ANTLR development team,
-though you are free to build ANTLR yourself of course.
-
-Source code Structure
------------------------
-
-The main development branch of ANTLR is stored within the Perforce SCM at:
-
- //depot/code/antlr/main/...
-
-release branches are stored in Perforce like so:
-
- //depot/code/antlr/release-3.1.3/...
-
-In this top level directory, you will find a master build file for
-Maven called pom.xml and you will also note that there are a number of
-subdirectories:
-
- tool - The ANTLR tool itself
- runtime/Java - The ANTLR Java runtime
- runtime/X - The runtime for language target X
- gunit - The grammar test tool
- antlr3-maven-plugin - The plugin tool for Maven allowing Maven
- projects to process ANTLR grammars.
-
-Each of these sub-directories also contains a file pom.xml that
-controls the build of each sub-component (or module in Maven
-parlance).
-
-Build Parameters
------------------
-
-Alongside each pom.xml (other than for the antlr3-maven-plugin), you
-will see that there is a file called antlr.config. This file is called
-a filter and should contain a set of key/value pairs in the same
-manner as Java properties files:
-
-antlr.something="Some config thang!"
-
-When the build of any component happens, any values in the
-antlr.config for the master build file and any values in the
-antlr.config file for each component are made available to the
-build. This is mainly used by the resource processor, which will
-filter any file it finds under: src/main/resources/** and replace any
-references such as ${antlr.something} with the actual value at the
-time of the build.
-
-Building
---------
-
-Building ANTLR is trivial, assuming that you have loaded Maven version
-3.0.3 or better on to your build system and installed it as explained
-here:
-
-http://maven.apache.org/download.html
-
-Note that the ANTLR toolset will ONLY build with version 3.0.3 of Maven
-as of release 3.4.
-
-If you are unfamiliar with Maven (and even if you are), the best
-resource for learning about it is The Definitive Guide:
-
-http://www.sonatype.com/books/maven-book/reference/public-book.html
-
-The instructions here assume that Maven is installed and working correctly.
-
-If this is the first time you have built the ANTLR toolset, you will
-possibly need to install the master pom in your local repository
-(however the build may be able to locate this in the ANTLR snapshot or
-release repository). If you try to build sub-modules on their own (as
-in run the mvn command in the sub directory for that tool, such as
-runtime/Java), and you receive a message that maven cannot find the
-master pom, then execute this in the main (or release) directory:
-
-mvn -N install
-
-This command will install the master build pom in your local maven
-repository (it's ~/.m2 on UNIX) and individual builds of sub-modules
-will now work correctly.
-
-To build then, simply cd into the master build directory
-(e.g. $P4ROOT//code/antlr/main) and type:
-
-mvn -Dmaven.test.skip=true
-
-Assuming that everything is correctly installed and synchronized, then
-ANTLR will build and skip any unit tests in the modules (the ANTLR
-tool tests can take a long time).
-
-This command will build each of the tools in the correct order and
-will create the jar artifacts of all the components in your local
-development Maven repository (which takes precedence over remote
-repositories by default). At the end of the build you should see:
-
-[INFO] ------------------------------------------------------------------------
-[INFO] Reactor Summary:
-[INFO] ------------------------------------------------------------------------
-[INFO] ANTLR Master build control POM ........................ SUCCESS [1.373s]
-[INFO] Antlr 3 Runtime ....................................... SUCCESS [0.879s]
-[INFO] ANTLR Grammar Tool .................................... SUCCESS [5.431s]
-[INFO] Maven plugin for ANTLR V3 ............................. SUCCESS [1.277s]
-[INFO] ANTLR gUnit ........................................... SUCCESS [1.566s]
-[INFO] Maven plugin for gUnit ANTLR V3 ....................... SUCCESS [0.079s]
-[INFO] ------------------------------------------------------------------------
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 11 seconds
-
-However, unless you are using Maven exclusively in your projects, you
-will most likely want to build the ANTLR Uber Jar, which is an
-executable jar containing all the components that ANTLR needs to build
-and run parsers (note that at runtime, you need only the runtime
-components you use, such as the Java runtime and say stringtemplate).
-
-Because the Uber jar is not something we want to deploy to Maven
-repositories it is built with a special invocation of Maven:
-
-mvn -Dmaven.test.skip=true package assembly:assembly
-
-Note that Maven will appear to build everything twice, which is a
-quirk of how it calculates the dependencies and makes sure it has
-everything packaged up so it can build the uber-jar assembly.
-
-Somewhere in the build output (towards the end), you will find a line
-like this:
-
-[INFO] Building jar: /home/jimi/antlrsrc/code/antlr/main/target/antlr-master-3.4-SNAPSHOT-completejar.jar
-
-This is the executable jar that you need and you can either copy it
-somewhere or, like me, you can create this script (assuming UNIX)
-somewhere in your PATH:
-
-#! /bin/bash
-java -jar ~/antlrsrc/code/antlr/main/target/antlr-master-3.4-SNAPSHOT-completejar.jar $*
-
-Version Numbering
--------------------
-
-The first and Golden rule is that any pom files stored under the main
-branch of the toolset should never be modified to contain a release
-version number. They should always contain a.b.c-SNAPSHOT
-(e.g. 3.1.3-SNAPSHOT). Only release branches should have their pom
-version numbers set to a release version. You can release as many
-SNAPSHOTS as you like, but only one release version. However, release
-versions may be updated with a patch level: 3.1.3-1, 3.1.3-2 and so
-on.
-
-Fortunately, Maven helps us with the version numbering in a number of
-ways. Firstly, the pom.xml files for the various modules do not
-specify a version of the artifacts themselves. They pick up their
-version number from the master build pom. However, there is a catch,
-because they need to know what version of the parent pom they inherit
-from and so they DO mention the version number. However, this does
-prevent accidentally releasing different versions of sub-modules than
-the master pom describes.
-
-Fortunately once again, Maven has a neat way of helping us change the
-version. All you need do is check out all the pom.xml files from
-perforce, then modify the a.b.c-SNAPSHOT in the
-master pom. When the version number is correct in the master pom, you
-make sure your working directory is the location of the master pom and
-type:
-
-mvn versions:update-child-modules
-
-This command will then update the child pom.xml files to reflect the
-version number defined in the master pom.xml.
-
-There is unfortunately one last catch here though and that is that the
-antlr3-maven-plugin and the gunit-maven-plugin are not able to use the
-parent pom. The reason for this is subtle but makes sense as doing so
-would create a circular dependency between the ANTLR tool (which uses
-the plugin to build its own grammar files), and the plugins (which
-uses the tool to build grammar files and gunit to test).
-
-This catch-22 situation means that the pom.xml file in the
-antlr3-maven-plugin directory and the one in the gunit-maven-plugin
-directory MUST be updated manually (or we must write a script to do
-this).
-
-Finally, we need to remember that because the tool is dependent on the
-antlr3-maven-plugin and the plugin is itself dependent on the
-tool, that we must manually update the versions of each that they
-reference. So, when we bump the version of the toolset to say
-3.1.4-SNAPSHOT, we need to change the antlr3-maven-plugin pom.xml and
-the gunit-maven-plugin pom.xml to reference that version of the antlr
-tool. The tool itself is always built with the prior released version
-of the plugin, so when we release we must change the main branch of
-the plugin to use the newly released version of the plugin. This is
-covered in the release checklist.
-
-Deploying
-----------
-
-Deploying the tools at the current version is relatively easy, but to
-deploy to the ANTLR repositories (snapshot or release) you must have
-been granted access to the Sonatype OSS repositories' ANTLR login.
-Few people will have this access of course.
-
-Next, because we do not publish access information for antlr.org, you
-will need to configure the repository server names locally. You do
-this by creating (or adding to) the file:
-
-~/.m2/settings.xml
-
-Which should look like this:
-
-
-
-
-
- sonatype-nexus-snapshots
- xxxxxxx
- xxxxxxx
-
-
- sonatype-nexus-staging
- xxxxxxx
- xxxxxxx
-
-
-
-
-When this configuration is in place, you will be able to deploy the components,
-either individually or from the master directory:
-
-mvn -Dmaven.test.skip=true -Ddeplot deploy
-
-You will then see lots of information about checking existing version
-information and so on, and the components will be deployed once you
-supply the ANTLR public key passphrase to sign the jars.
-
-Note that so long as the artifacts are versioned with a.b.c-SNAPSHOT
-then deployment will always be to the development snapshot
-directory. When the artifacts are versioned with a release version
-then deployment will be to the release stahinh repository, which
-will then be mirrored around the world if closed and release.
-The sonatype documentation should be consulted.
-
-Release Checklist
-------------------
-
-Here is the procedure to use to make a release of ANTLR. Note that we
-should really use the mvn release:release command, but the perforce
-plugin for Maven is not commercial quality and I want to rewrite it.
-
-For this checklist, let's assume that the current development version
-of ANTLR is 3.1.3-SNAPSHOT. This means that it will probably (but not
-necessarily) become release version 3.1.3 and that the development
-version will bump to 3.1.4-SNAPSHOT.
-
-0) Run a build of the main branch and check that it is builds and
- passes as many tests as you want it to.
-
-1) First make a branch from main into the target release
- directory. Then submit this to perforce. You could change versions
- numbers before submitting, but doing that in separate stages will
- keep things sane;
-
---- Use main development branch from here ---
-
-2) Before we deploy the release, we want to update the versions of the
- development branch, so we don't deploy what is now the new release
- as an older snapshot (this is not super important, but procedure is
- good right?).
-
- Check out all the pom.xml files (and if you are using any
- antlr.config parameters that must change, then do that too).
-
-3) Edit the master pom.xml in the main directory and change the version from
- 3.1.3-SNAPSHOT to 3.1.4-SNAPSHOT.
-
-4) Edit the pom.xml file for antlr3-maven-plugin under the main
- directory and change the version from 3.1.3-SNAPSHOT to
- 3.1.4-SNAPSHOT. Do the same for the pom.xml in the
- gunit-maven-plugin directory.
-
- Update the pom.xml for the archetype manually too.
-
-5) Now (from the main directory), run the command:
-
- mvn versions:update-child-modules
-
- You should see:
-
- [INFO] [versions:update-child-modules]
- [INFO] Module: gunit
- [INFO] Parent is org.antlr:antlr-master:3.1.4-SNAPSHOT
- [INFO] Module: runtime/Java
- [INFO] Parent is org.antlr:antlr-master:3.1.4-SNAPSHOT
- [INFO] Module: tool
- [INFO] Parent is org.antlr:antlr-master:3.1.4-SNAPSHOT
-
-6) Run a build of the main branch:
-
- mvn -Dmaven.test.skip=true
-
- All should be good.
-
-7) Submit the pom changes of the main branch to perforce.
-
-8) Deploy the new snapshot as a placeholder for the next release. It
- will go to the snapshot repository of course:
-
- mvn -N deploy
- mvn -Dmaven.test.skip=true deploy
-
-9) You are now finished with the main development branch and should change
- working directories to the release branch you made earlier.
-
---- Use release branch from here ---
-
-10) Check out all the pom.xml files in the release branch (and if you are
- using any antlr.config parameters that must change, then do that too).
-
-11) Edit the master pom.xml in the release-3.1.3 directory and change
- the version from 3.1.3-SNAPSHOT to 3.1.3.
-
-12) Edit the pom.xml file for antlr3-maven-plugin under the
- release-3.1.3 directory and change the version from 3.1.3-SNAPSHOT
- to 3.1.3. Also change the version of the tool that the this
- pom.xml references from 3.1.3-SNAPSHOT to 3.1.3 as we are now
- releasing the plugin of course and it needs to reference the
- version we are about to release. You will find this reference in
- the dependencies section of the antlr3-maven-plugin pom.xml. Also
- change the version references in the pom for gunit-maven-plugin.
-
-13) Now (from the release-3.1.3 directory), run the command:
-
- mvn versions:update-child-modules
-
- You should see:
-
- [INFO] [versions:update-child-modules]
- [INFO] Module: gunit
- [INFO] Parent was org.antlr:antlr-master:3.1.3-SNAPSHOT,
- now org.antlr:antlr-master:3.1.3
- [INFO] Module: runtime/Java
- [INFO] Parent was org.antlr:antlr-master:3.1.3-SNAPSHOT,
- now org.antlr:antlr-master:3.1.3
- [INFO] Module: tool
- [INFO] Parent was org.antlr:antlr-master:3.1.3-SNAPSHOT,
- now org.antlr:antlr-master:3.1.3
-
-14) Run a build of the release-3.1.3 branch:
-
- mvn # Note I am letting unit tests run here!
-
- All should be good, or as good as it gets ;-)
-
-15) Submit the pom changes of the release-3.1.3 branch to perforce.
-
-16) Deploy the new release (this is it guys, make sure you are happy):
-
- mvn -N deploy
- mvn -Dmaven.test.skip=true deploy
-
- Note that we must skip the tests as Maven will not let you
- deploy releases that fail any junit tests.
-
-17) The final step is that we must update the main branch pom.xml for
- the tool to reference the newly release version of the
- antlr3-maven-plugin. This is because each release of ANTLR is
- built with the prior release of ANTLR, and we have just released
- a new version. Edit the pom.xml for the tool (main/tool/pom.xml)
- under the main (that's the MAIN branch, not the release branch)
- and find the dependency reference to the antlr plugin. If you
- just released say 3.1.3, then the tool should now reference
- version 3.1.3 of the plugin. Having done this, you should
- probably rebuild the main branch and let it run the junit
- tests. Later, I will automate this dependency update as mvn can
- do this for us.
-
-18) Having deployed the release to maven, you will want to create the
- uber jar for the new release, to make it downloadable from the
- antlr.org website. This is a repeat of the earlier described step
- to build the uber jar:
-
- mvn -Dmaven.test.skip=true package assembly:assembly
-
- MAven will produce the uber jar in the target directory:
-
- antlr-master-3.1.3-completejar.jar
-
- And this is the complete jar that can be downloaded from the web site. You
- may wish to produce an md5 checksum to go with the jar:
-
- md5sum target/antlr-master-3.1.3-completejar.jar
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx target/antlr-master-3.1.4-SNAPSHOT-completejar.jar
-
- The command you just ran will also produce a second jar:
-
- antlr-master-3.1.3-src.jar
-
- This is the source code for everythign you just deployed and can
- be unjarred and built from scratch using the very procedures
- described here, which means you will now be reading this
- BUILD.txt file for ever.
-
-19) Reward anyone around you with good beer.
-
-
-Miscellany
------------
-
-It was a little tricky to get all the interdependencies correct
-because ANTLR builds itself using itself and the maven plugin
-references the ANTLR Tool as well. Hence the maven tool is not a child
-project of the master pom.xml file, even though it is built by it.
-
-An observant person will not that when the assembly:assembly phase is
-run, that it invokes the build of the ANTLR tool using the version of
-the Maven plugin that it has just built, and this results in the
-plugin using the version of ANTLR tool that it has just built. This is
-safe because everything will already be up to date and so we package
-up the version of the tool that we expect, but the Maven plugin we
-deploy will use the correct version of ANTLR, even though there is
-technically a circular dependency.
-
-The master pom.xml does give us a way to cause the build of the ANTLR
-tool to use itself to build itself. This is because in
-dependencyManagement in the master pom.xml, we can reference the
-current version of the Tool and the Maven plugin, even though in the
-pom.xml for the tool itself refers to the previous version of the
-plugin.
-
-What happens is that if we first cd into the tool and maven
-directories and build ANTLR, it will build itself with the prior
-version and this will deploy locally (.m2). We can then clean build
-from the master pom and when ANTLR asks for the prior version of the
-tool, the master pom.xml will override it and build with the interim
-versions we just built manually.
-
-However, strictly speaking, we need a third build where we rebuild the
-tool again with the version of the tool that was built with itself and
-not deploy the version that was built by the version of itself that
-was built by a prior version of itself. I decided that this was not
-particularly useful and complicates things too much. Building with a
-prior version of the tool is fine and if there was ever a need to, we
-could release twice in quick succession.
-
-I have occasionally seen the MAven reactor screw up (or perhaps it is
-the ANTLR tool) when building. If this happens you will see an ANTLR
-Panic - cannot find en.stg message. If this happens to you, then just
-rerun the build and it will eventually work.
-
-Jim Idle - March 2009
+http://www.antlr.org/wiki/display/ANTLR3/Building+ANTLR+with+Maven
+The notes are by Jim Idle (and are a bit out of date but we hope to
+update them).
diff --git a/METADATA b/METADATA
index 377e0f8c2c277da04604938e6a9d06f33ffc2c8c..a19780fda2ecbcbfe4a07c2af556ba5dc1742e40 100644
--- a/METADATA
+++ b/METADATA
@@ -1,7 +1,5 @@
name: "antlr3"
-description:
- "ANTLR (ANother Tool for Language Recognition) is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages."
-
+description: "ANTLR (ANother Tool for Language Recognition) is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages."
third_party {
url {
type: HOMEPAGE
@@ -9,8 +7,12 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://github.com/antlr/antlr3/archive/antlr-3.4.zip"
+ value: "https://github.com/antlr/antlr3/archive/3.5.2.zip"
+ }
+ version: "3.5.2"
+ last_upgrade_date {
+ year: 2018
+ month: 8
+ day: 28
}
- version: "3.4"
- last_upgrade_date { year: 2011 month: 11 day: 15 }
}
diff --git a/tool/README.txt b/README.txt
similarity index 80%
rename from tool/README.txt
rename to README.txt
index ca5e198baa9982bf95b43dd9d5e38f72e95aa864..c2fa6c4acf253774573b1e036bed2ea59c530a33 100644
--- a/tool/README.txt
+++ b/README.txt
@@ -1,5 +1,5 @@
-ANTLR v3.4
-July 18, 2011
+ANTLR v3.5
+January 4, 2013
Terence Parr, parrt at cs usfca edu
ANTLR project lead and supreme dictator for life
@@ -13,8 +13,8 @@ recognizers, interpreters, compilers, and translators from grammatical
descriptions containing actions in a variety of target
languages. ANTLR provides excellent support for tree construction,
tree walking, translation, error recovery, and error reporting. I've
-been working on parser generators for 20 years and on this particular
-version of ANTLR for 7 years.
+been working on parser generators for 25 years and on this particular
+version of ANTLR for 9 years.
You should use v3 in conjunction with ANTLRWorks:
@@ -74,17 +74,12 @@ EXAMPLES
ANTLR v3 sample grammars:
- http://www.antlr.org/download/examples-v3.tar.gz
+ https://github.com/antlr/examples-v3
Examples from Language Implementation Patterns:
http://www.pragprog.com/titles/tpdsl/source_code
-Also check out Mantra Programming Language for a prototype (work in
-progress) using v3:
-
- http://www.linguamantra.org/
-
----------------------------------------------------------------------
What is ANTLR?
@@ -113,27 +108,35 @@ See migration guide:
How do I install this damn thing?
-Just untar antlr-3.4.tar.gz and you'll get:
-
-antlr-3.4/BUILD.txt
-antlr-3.4/antlr3-maven-plugin
-antlr-3.4/antlrjar.xml
-antlr-3.4/antlrsources.xml
-antlr-3.4/gunit
-antlr-3.4/gunit-maven-plugin
-antlr-3.4/pom.xml
-antlr-3.4/runtime
-antlr-3.4/tool
-antlr-3.4/lib
-
-This is the source and java binaries. You could grab the
-antlr-3.4-complete.jar file from the website, but it's in lib dir.
+You will have grabbed either of these:
+
+ http://antlr.org/download/antlr-3.5-complete-no-st3.jar
+ http://antlr.org/download/antlr-3.5-complete.jar
+
It has all of the jars you need combined into one. Then you need to
-add antlr-3.4-complete.jar to your CLASSPATH or add
-to arg list; e.g., on unix:
+add antlr-3.5-complete.jar to your CLASSPATH or add to arg list; e.g., on unix:
+
+$ java -cp "/usr/local/lib/antlr-3.5-complete.jar:$CLASSPATH" org.antlr.Tool Test.g
-$ java -cp "/usr/local/lib/antlr-3.4-complete.jar:$CLASSPATH" org.antlr.Tool Test.g
+Source + java binaries: Just untar antlr-3.5.tar.gz and you'll get:
+
+antlr-3.5/BUILD.txt
+antlr-3.5/antlr3-maven-plugin
+antlr-3.5/antlrjar.xml
+antlr-3.5/antlrsources.xml
+antlr-3.5/gunit
+antlr-3.5/gunit-maven-plugin
+antlr-3.5/pom.xml
+antlr-3.5/runtime
+antlr-3.5/tool
+antlr-3.5/lib
Please see the FAQ
http://www.antlr.org/wiki/display/ANTLR3/ANTLR+v3+FAQ
+
+-------------------------
+
+How can I contribute to ANTLR v3?
+
+http://www.antlr.org/wiki/pages/viewpage.action?pageId=33947666
diff --git a/README.version b/README.version
deleted file mode 100644
index 7270f7b3e5a62017fd60d738550b94644b47f9a2..0000000000000000000000000000000000000000
--- a/README.version
+++ /dev/null
@@ -1,3 +0,0 @@
-URL: https://github.com/antlr/website-antlr3/raw/gh-pages/download/antlr-3.4.tar.gz
-Version: 3.4
-BugComponent: 99142
diff --git a/antlr-complete/antlr.config b/antlr-complete/antlr.config
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/antlr-complete/pom.xml b/antlr-complete/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..aad3c68a55fe93062a7a83a8a89d9989b2283721
--- /dev/null
+++ b/antlr-complete/pom.xml
@@ -0,0 +1,137 @@
+
+
+ 4.0.0
+ antlr-complete
+ jar
+
+ ANTLR 3 Complete
+ Complete distribution for ANTLR 3
+
+
+
+ org.antlr
+ antlr-master
+ 3.5.2
+
+
+ http://antlr.org/
+
+
+
+
+
+ org.antlr
+ antlr
+ ${project.version}
+ compile
+
+
+
+ org.antlr
+ antlr-runtime
+ ${project.version}
+ compile
+
+
+
+ org.antlr
+ gunit
+ ${project.version}
+ compile
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.0
+
+ false
+ true
+
+
+ org.antlr:antlr-complete
+
+ META-INF/**
+
+
+
+
+
+ org.antlr.Tool
+
+
+
+
+
+ complete-no-st3
+ package
+
+ shade
+
+
+ false
+ true
+ no-st3
+
+
+ antlr:antlr
+
+ **
+
+
+
+ org.antlr:stringtemplate
+
+ **
+
+
+
+
+
+
+
+ complete
+ package
+
+ shade
+
+
+ false
+ false
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+ true
+
+
+
+
+
+
+
diff --git a/antlr.config b/antlr.config
index 00ac54e8201e22cf5721138cd3de63851e580d81..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
--- a/antlr.config
+++ b/antlr.config
@@ -1 +0,0 @@
-fred=99
diff --git a/antlr3-maven-archetype/pom.xml b/antlr3-maven-archetype/pom.xml
index 6de349cafd6efc57fb4996304190b8107127caa9..c4b084bbef6387d9741cc36c99ac0c98e65f98a6 100644
--- a/antlr3-maven-archetype/pom.xml
+++ b/antlr3-maven-archetype/pom.xml
@@ -1,82 +1,27 @@
-
+4.0.0org.antlrantlr3-maven-archetype
- 3.4maven-archetype
- ANTLR3 Maven Archetype 3.4
-
-
- UTF-8
-
+ ANTLR 3 Maven Archetype
+ ANTLR 3 Maven Archetype
+
org.antlrantlr-master
- 3.4
+ 3.5.2
- -->
-
-
- org.sonatype.oss
- oss-parent
- 7
-
-
-
-
- release-sign-artifacts
-
-
- deploy
- true
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.3
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
-
-
-
-
+
@@ -84,7 +29,7 @@
org.apache.maven.archetypearchetype-packaging
- 2.0
+ 2.2
@@ -93,38 +38,10 @@
maven-archetype-plugin
- 2.0
+ 2.2true
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.2
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.8
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
diff --git a/antlr3-maven-archetype/src/main/resources/archetype-resources/pom.xml b/antlr3-maven-archetype/src/main/resources/archetype-resources/pom.xml
index e8db11434fa2cd03ac2d6d2fa5db2869cf318229..d0509c907f5576009e8add31e83742ce486adcd7 100644
--- a/antlr3-maven-archetype/src/main/resources/archetype-resources/pom.xml
+++ b/antlr3-maven-archetype/src/main/resources/archetype-resources/pom.xml
@@ -24,7 +24,7 @@
Archetype by Jim Idle (jimi@temporal-wave.com) - Oct 2009
Report bugs to the ANTLR interest list at http://www.antlr.org
- Generated by antlr3-maven-archetype version 3.4
+ Generated by antlr3-maven-archetype version 3.4.1-SNAPSHOT
=======================================================================
-->
@@ -58,7 +58,7 @@
org.antlrantlr-runtime
- 3.4
+ 3.4.1-SNAPSHOTcompile
@@ -84,7 +84,7 @@
org.antlrantlr3-maven-plugin
- 3.4
+ 3.4.1-SNAPSHOT
@@ -100,7 +100,7 @@
the prototype, but we use it to illustrate how you can get
the JDK 6 Java compiler to accept 1.5 or 1.6 targeted source code
but produce class files that are compatible with JRE 1.4. As
- Michael Caine might not say, "Not a lot of people know that!"
+ Michael Caine might say, "Not a lot of people know that!"
-->
maven-compiler-plugin
diff --git a/antlr3-maven-plugin/antlr.config b/antlr3-maven-plugin/antlr.config
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/antlr3-maven-plugin/pom.xml b/antlr3-maven-plugin/pom.xml
index 58dc982b840265705546f9a86013df48b0079c1f..6fc1770e41d8ed8150116004171518ae2973d882 100644
--- a/antlr3-maven-plugin/pom.xml
+++ b/antlr3-maven-plugin/pom.xml
@@ -33,26 +33,8 @@
-
+
-
-
-
- org.sonatype.oss
- oss-parent
- 7
-
-
4.0.0
@@ -77,12 +59,13 @@
antlr3-maven-pluginmaven-plugin
-
- 3.4
- Maven plugin for ANTLR V3.4
+
+ org.antlr
+ antlr-master
+ 3.5.2
+
+
+ ANTLR 3 Maven plugin2.0
@@ -126,44 +109,13 @@ Jim Idle - March 2009
-
-
- release-sign-artifacts
-
-
- deploy
- true
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.3
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
-
-
-
-
-
Jim Idlehttp://www.temporal-wave.com
- Originator, version 3.1.3+
+ Originator, version 3.1.3
@@ -193,44 +145,6 @@ Jim Idle - March 2009
-
-
- JIRA
- http://antlr.org/jira/browse/ANTLR
-
-
-
-
-
- repo
- The BSD License
- http://www.antlr.org/LICENSE.txt
-
-
-
-
- 2009
-
-
-
- http://antlr.markmail.org/
-
- http://www.antlr.org/pipermail/antlr-interest/
-
- ANTLR Users
- http://www.antlr.org/mailman/listinfo/antlr-interest/
- http://www.antlr.org/mailman/options/antlr-interest/
- antlr-interest@antlr.org
-
-
-
-
- ANTLR.org
- http://www.antlr.org
-
-
-
- junit
- junit
- 4.8.2
- test
-
+ ${project.version}org.apache.maven.sharedmaven-plugin-testing-harness
- 1.0
+ 1.1test
@@ -298,64 +200,34 @@ Jim Idle - March 2009
- install
-
-
- maven-compiler-plugin
- 2.0.2
-
- 1.6
- jsr14
-
-
-
org.apache.maven.pluginsmaven-site-plugin
- 2.0
+ 3.3org.apache.maven.pluginsmaven-project-info-reports-plugin
- 2.1.1
+ 2.7false
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.2
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.8
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ 3.2
+
+
+
diff --git a/antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3ErrorLog.java b/antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3ErrorLog.java
index bf2c3c67469a661e302452be3b3ef463e4531337..5a315da3066bd31026dc2f8f805963295c9f06f1 100644
--- a/antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3ErrorLog.java
+++ b/antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3ErrorLog.java
@@ -56,7 +56,7 @@ public class Antlr3ErrorLog implements ANTLRErrorListener {
/**
* Sends an informational message to the Maven log sink.
- * @param s The message to send to Maven
+ * @param message The message to send to Maven
*/
public void info(String message) {
log.info(message);
diff --git a/antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3Mojo.java b/antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3Mojo.java
index e7225d3d608c136362c11402225694b4e32d08b8..6c18c5564e080be59e75c720965204050304c730 100644
--- a/antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3Mojo.java
+++ b/antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3Mojo.java
@@ -45,7 +45,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.antlr.Tool;
-import org.antlr.runtime.RecognitionException;
import org.apache.maven.plugin.logging.Log;
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
@@ -54,13 +53,11 @@ import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
/**
- * Goal that picks up all the ANTLR grammars in a project and moves those that
- * are required for generation of the compilable sources into the location
- * that we use to compile them, such as target/generated-sources/antlr3 ...
+ * Parses ANTLR grammar files {@code *.g} and transforms them into Java source
+ * files.
*
* @goal antlr
- *
- * @phase process-sources
+ * @phase generate-sources
* @requiresDependencyResolution compile
* @requiresProject true
*
@@ -82,7 +79,7 @@ public class Antlr3Mojo
protected boolean report;
/**
* If set to true, then the ANTLR tool will print a version of the input
- * grammar which is devoid of any actions that may be present in the input file.
+ * grammar(s) which are stripped of any embedded actions.
*
* @parameter default-value="false"
*/
@@ -96,119 +93,124 @@ public class Antlr3Mojo
*/
protected boolean debug;
/**
- * If set to true, then then the generated parser will compute and report on
- * profile information at runtime.
+ * If set to true, then the generated parser will compute and report profile
+ * information at runtime.
*
* @parameter default-value="false"
*/
protected boolean profile;
/**
- * If set to true then the ANTLR tool will generate a description of the nfa
- * for each rule in Dot format
- *
+ * If set to true, then the ANTLR tool will generate a description of the
+ * NFA for each rule in Dot format
+ *
* @parameter default-value="false"
*/
protected boolean nfa;
/**
- * If set to true then the ANTLR tool will generate a description of the DFA
- * for each decision in the grammar in Dot format
- *
+ * If set to true, then the ANTLR tool will generate a description of the
+ * DFA for each decision in the grammar in
+ * Dot format.
+ *
* @parameter default-value="false"
*/
protected boolean dfa;
/**
- * If set to true, the generated parser code will log rule entry and exit points
- * to stdout as an aid to debugging.
+ * If set to true, the generated parser code will log rule entry and exit
+ * points to stdout ({@link System#out} for the Java target) as an aid to
+ * debugging.
*
* @parameter default-value="false"
*/
protected boolean trace;
/**
- * If this parameter is set, it indicates that any warning or error messages returned
- * by ANLTR, should be formatted in the specified way. Currently, ANTLR supports the
- * built-in formats of antlr, gnu and vs2005.
+ * If this parameter is set, it indicates that any warning or error messages
+ * returned by ANLTR, should be formatted in the specified way. Currently,
+ * ANTLR supports the built-in formats {@code antlr}, {@code gnu} and
+ * {@code vs2005}.
*
* @parameter default-value="antlr"
*/
protected String messageFormat;
/**
- * If this parameter is set to true, then ANTLR will report all sorts of things
- * about what it is doing such as the names of files and the version of ANTLR and so on.
+ * If set to true, then ANTLR will report verbose messages during the code
+ * generation process. This includes the names of files, the version of
+ * ANTLR, and more.
*
* @parameter default-value="true"
*/
protected boolean verbose;
/**
- * The number of alts, beyond which ANTLR will not generate a switch statement
- * for the DFA.
+ * The maximum number of alternatives allowed in an inline switch statement.
+ * Beyond this, ANTLR will not generate a switch statement for the DFA.
*
* @parameter default-value="300"
*/
private int maxSwitchCaseLabels;
/**
- * The number of alts, below which ANTLR will not choose to generate a switch
- * statement over an if statement.
+ * The minimum number of alternatives for ANTLR to generate a switch
+ * statement. For decisions with fewer alternatives, an if/else if/else
+ * statement will be used instead.
+ *
+ * @parameter default-value="3"
*/
private int minSwitchAlts;
/* --------------------------------------------------------------------
- * The following are Maven specific parameters, rather than specificlly
+ * The following are Maven specific parameters, rather than specific
* options that the ANTLR tool can use.
*/
+
/**
- * Provides an explicit list of all the grammars that should
- * be included in the generate phase of the plugin. Note that the plugin
- * is smart enough to realize that imported grammars should be included but
- * not acted upon directly by the ANTLR Tool.
- *
- * Unless otherwise specified, the include list scans for and includes all
- * files that end in ".g" in any directory beneath src/main/antlr3. Note that
- * this version of the plugin looks for the directory antlr3 and not the directory
- * antlr, so as to avoid clashes and confusion for projects that use both v2 and v3 grammars
- * such as ANTLR itself.
+ * Provides an explicit list of all the grammars that should be included in
+ * the generate phase of the plugin. Note that the plugin is smart enough to
+ * realize that imported grammars should be included but not acted upon
+ * directly by the ANTLR Tool.
+ *
+ * A set of Ant-like inclusion patterns used to select files from the source
+ * directory for processing. By default, the pattern **/*.g
+ * is used to select grammar files.
+ * To preserve backward compatibility, this method allows seeking past the
+ * end of the currently buffered data. In this case, the input pointer will
+ * be moved but the data will only actually be loaded upon the next call to
+ * {@link #consume} or {@link #LT} for {@code k>0}.
+ *
+ * @throws IllegalArgumentException if {@code index} is less than 0
+ * @throws UnsupportedOperationException if {@code index} lies before the
+ * beginning of the moving window buffer
+ * ({@code index < }{@link #currentElementIndex currentElementIndex} - {@link #p p}).
+ */
+ public void seek(int index) {
+ if (index < 0) {
+ throw new IllegalArgumentException("can't seek before the beginning of the input");
+ }
- public void rewind() {
- seek(lastMarker); // rewind but do not release marker
- }
+ int delta = currentElementIndex - index;
+ if (p - delta < 0) {
+ throw new UnsupportedOperationException("can't seek before the beginning of this stream's buffer");
+ }
- /** Seek to a 0-indexed position within data buffer. Can't handle
- * case where you seek beyond end of existing buffer. Normally used
- * to seek backwards in the buffer. Does not force loading of nodes.
- * Doesn't see to absolute position in input stream since this stream
- * is unbuffered. Seeks only into our moving window of elements.
- */
- public void seek(int index) { p = index; }
+ p -= delta;
+ currentElementIndex = index;
+ }
protected T LB(int k) {
- if ( k==1 ) return prevElement;
- throw new NoSuchElementException("can't look backwards more than one token in this stream");
+ assert k > 0;
+
+ int index = p - k;
+ if (index == -1) {
+ return prevElement;
+ }
+
+ // if k>0 then we know index < data.size(). avoid the double-check for
+ // performance.
+ if (index >= 0 /*&& index < data.size()*/) {
+ return data.get(index);
+ }
+
+ if (index < -1) {
+ throw new UnsupportedOperationException("can't look more than one token before the beginning of this stream's buffer");
+ }
+
+ throw new UnsupportedOperationException("can't look past the end of this stream's buffer using LB(int)");
}
-}
\ No newline at end of file
+}
diff --git a/runtime/Java/src/main/java/org/antlr/runtime/tree/BaseTree.java b/runtime/Java/src/main/java/org/antlr/runtime/tree/BaseTree.java
index 34dd05019f4317710f89ee9c6b6dbb3df8bf8d25..81620a01d3c2d06e0d3189d2027938993e9caf50 100644
--- a/runtime/Java/src/main/java/org/antlr/runtime/tree/BaseTree.java
+++ b/runtime/Java/src/main/java/org/antlr/runtime/tree/BaseTree.java
@@ -37,7 +37,7 @@ import java.util.List;
* non-null node is called "nil".
*/
public abstract class BaseTree implements Tree {
- protected List children;
+ protected List