forked from jasder/antlr
Merge branch 'maven-updates' into master
This commit is contained in:
commit
8e9619a731
|
@ -194,20 +194,20 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
<version>3.0.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>2.0</version>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-compiler-api</artifactId>
|
||||
<version>1.8.6</version>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
|
@ -228,7 +228,7 @@
|
|||
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
|
||||
</dependency>
|
||||
|
@ -240,6 +240,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||
<artifactId>maven-plugin-annotations</artifactId>
|
||||
<version>3.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -258,7 +265,7 @@
|
|||
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
|
@ -270,16 +277,40 @@
|
|||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>3.2</version>
|
||||
<configuration>
|
||||
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
|
||||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>mojo-descriptor</id>
|
||||
<goals>
|
||||
<goal>descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>help-goal</id>
|
||||
<goals>
|
||||
<goal>helpmojo</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<version>3.2</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
|
||||
</configuration>
|
||||
|
@ -288,7 +319,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
|
@ -299,6 +330,20 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
|
|
@ -55,7 +55,7 @@ public class Antlr4ErrorLog implements ANTLRToolListener {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@Override
|
||||
public void info(String message) {
|
||||
|
|
|
@ -43,6 +43,10 @@ import org.apache.maven.plugin.AbstractMojo;
|
|||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
|
||||
import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
|
||||
|
@ -68,14 +72,13 @@ import java.util.Set;
|
|||
* are required for generation of the compilable sources into the location
|
||||
* that we use to compile them, such as target/generated-sources/antlr4 ...
|
||||
*
|
||||
* @goal antlr
|
||||
*
|
||||
* @phase process-sources
|
||||
* @requiresDependencyResolution compile
|
||||
* @requiresProject true
|
||||
*
|
||||
* @author <a href="mailto:jimi@temporal-wave.com">Jim Idle</a>
|
||||
*/
|
||||
@Mojo(
|
||||
name = "antlr",
|
||||
defaultPhase = LifecyclePhase.PROCESS_SOURCES,
|
||||
requiresDependencyResolution = ResolutionScope.COMPILE,
|
||||
requiresProject = true)
|
||||
public class Antlr4Mojo
|
||||
extends AbstractMojo {
|
||||
|
||||
|
@ -86,60 +89,52 @@ public class Antlr4Mojo
|
|||
* If set to true, then after the tool has processed an input grammar file
|
||||
* it will report variaous statistics about the parser, such as information
|
||||
* on cyclic DFAs, which rules may use backtracking, and so on.
|
||||
*
|
||||
* @parameter default-value="false"
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
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.
|
||||
*
|
||||
* @parameter default-value="false"
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean printGrammar;
|
||||
/**
|
||||
* If set to true, then the code generated by the ANTLR code generator will
|
||||
* be set to debug mode. This means that when run, the code will 'hang' and
|
||||
* wait for a debug connection on a TCP port (49100 by default).
|
||||
*
|
||||
* @parameter default-value="false"
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean debug;
|
||||
/**
|
||||
* If set to true, then then the generated parser will compute and report on
|
||||
* profile information at runtime.
|
||||
*
|
||||
* @parameter default-value="false"
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean profile;
|
||||
/**
|
||||
* If set to true then the ANTLR tool will generate a description of the atn
|
||||
* for each rule in <a href="http://www.graphviz.org">Dot format</a>
|
||||
*
|
||||
* @parameter default-value="false"
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean atn;
|
||||
/**
|
||||
* If set to true, the generated parser code will log rule entry and exit points
|
||||
* to stdout as an aid to debugging.
|
||||
*
|
||||
* @parameter default-value="false"
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean trace;
|
||||
/**
|
||||
* If this parameter is set, it indicates that any warning or error messages returned
|
||||
* by ANLTR, shoould be formatted in the specified way. Currently, ANTLR suports the
|
||||
* built-in formats of antlr, gnu and vs2005.
|
||||
*
|
||||
* @parameter default-value="antlr"
|
||||
*/
|
||||
@Parameter(defaultValue = "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.
|
||||
*
|
||||
* @parameter default-value="true"
|
||||
*/
|
||||
@Parameter(defaultValue = "true")
|
||||
protected boolean verbose;
|
||||
|
||||
protected boolean verbose_dfa;
|
||||
|
@ -151,9 +146,8 @@ public class Antlr4Mojo
|
|||
/**
|
||||
* The number of alts, beyond which ANTLR will not generate a switch statement
|
||||
* for the DFA.
|
||||
*
|
||||
* @parameter default-value="300"
|
||||
*/
|
||||
@Parameter(defaultValue = "300")
|
||||
private int maxSwitchCaseLabels;
|
||||
|
||||
/**
|
||||
|
@ -177,50 +171,41 @@ public class Antlr4Mojo
|
|||
* this version of the plugin looks for the directory antlr4 and not the directory
|
||||
* antlr, so as to avoid clashes and confusion for projects that use both v3 and v4 grammars
|
||||
* such as ANTLR itself.
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
@Parameter
|
||||
protected Set<String> includes = new HashSet<String>();
|
||||
/**
|
||||
* Provides an explicit list of any grammars that should be excluded from
|
||||
* the generate phase of the plugin. Files listed here will not be sent for
|
||||
* processing by the ANTLR tool.
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
@Parameter
|
||||
protected Set<String> excludes = new HashSet<String>();
|
||||
/**
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
@Parameter(property = "project", required = true, readonly = true)
|
||||
protected MavenProject project;
|
||||
/**
|
||||
* Specifies the Antlr directory containing grammar files. For
|
||||
* antlr version 4.x we default this to a directory in the tree
|
||||
* called antlr4 because the antlr3 directory is occupied by version
|
||||
* 3.x grammars.
|
||||
*
|
||||
* @parameter default-value="${basedir}/src/main/antlr4"
|
||||
* @required
|
||||
*/
|
||||
@Parameter(defaultValue = "${basedir}/src/main/antlr4", required = true)
|
||||
private File sourceDirectory;
|
||||
/**
|
||||
* Location for generated Java files. For antlr version 4.x we default
|
||||
* this to a directory in the tree called antlr4 because the antlr
|
||||
* directory is occupied by version 2.x grammars.
|
||||
*
|
||||
* @parameter default-value="${project.build.directory}/generated-sources/antlr4"
|
||||
* @required
|
||||
*/
|
||||
@Parameter(defaultValue = "${project.build.directory}/generated-sources/antlr4", required = true)
|
||||
private File outputDirectory;
|
||||
/**
|
||||
* Location for imported token files, e.g. <code>.tokens</code> and imported grammars.
|
||||
* Note that ANTLR will not try to process grammars that it finds to be imported
|
||||
* into other grammars (in the same processing session).
|
||||
*
|
||||
* @parameter default-value="${basedir}/src/main/antlr4/imports"
|
||||
*/
|
||||
@Parameter(defaultValue = "${basedir}/src/main/antlr4/imports")
|
||||
private File libDirectory;
|
||||
|
||||
public File getSourceDirectory() {
|
||||
|
@ -481,7 +466,7 @@ public class Antlr4Mojo
|
|||
throws TokenStreamException, RecognitionException, IOException, InclusionScanException {
|
||||
// Which files under the source set should we be looking for as grammar files
|
||||
//
|
||||
SourceMapping mapping = new SuffixMapping("g4", Collections.EMPTY_SET);
|
||||
SourceMapping mapping = new SuffixMapping("g4", Collections.<String>emptySet());
|
||||
|
||||
// What are the sets of includes (defaulted or otherwise).
|
||||
//
|
||||
|
|
|
@ -15,12 +15,6 @@
|
|||
<name>ANTLR 4 Runtime</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>ST4</artifactId>
|
||||
<version>4.0.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.abego.treelayout</groupId>
|
||||
<artifactId>org.abego.treelayout.core</artifactId>
|
||||
|
@ -37,7 +31,7 @@
|
|||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
|
@ -49,6 +43,34 @@
|
|||
<compilerArgument>-Xlint:-serial</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ package org.antlr.v4.runtime.misc;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -191,14 +192,14 @@ public class IntegerList {
|
|||
|
||||
/**
|
||||
* Compares the specified object with this list for equality. Returns
|
||||
* {@code true} if and only if the specified object is also an {@code IntegerList},
|
||||
* {@code true} if and only if the specified object is also an {@link IntegerList},
|
||||
* both lists have the same size, and all corresponding pairs of elements in
|
||||
* the two lists are equal. In other words, two lists are defined to be
|
||||
* equal if they contain the same elements in the same order.
|
||||
* <p>
|
||||
* This implementation first checks if the specified object is this
|
||||
* list. If so, it returns {@code true}; if not, it checks if the
|
||||
* specified object is an {@code IntegerList}. If not, it returns {@code false};
|
||||
* specified object is an {@link IntegerList}. If not, it returns {@code false};
|
||||
* if so, it checks the size of both lists. If the lists are not the same size,
|
||||
* it returns {@code false}; otherwise it iterates over both lists, comparing
|
||||
* corresponding pairs of elements. If any comparison returns {@code false},
|
||||
|
@ -233,8 +234,8 @@ public class IntegerList {
|
|||
|
||||
/**
|
||||
* Returns the hash code value for this list.
|
||||
*
|
||||
* <p>This implementation uses exactly the code that is used to define the
|
||||
* <p/>
|
||||
* This implementation uses exactly the code that is used to define the
|
||||
* list hash function in the documentation for the {@link List#hashCode}
|
||||
* method.
|
||||
*
|
||||
|
|
|
@ -110,7 +110,7 @@ public class ParseTreeVisitor<T> {
|
|||
*
|
||||
* @param aggregate The previous aggregate value. In the default
|
||||
* implementation, the aggregate value is initialized to
|
||||
* {@link #defaultValue}, which is passed as the {@code aggregate} argument
|
||||
* {@link #defaultResult}, which is passed as the {@code aggregate} argument
|
||||
* to this method after the first child node is visited.
|
||||
* @param nextResult The result of the immediately preceeding call to visit
|
||||
* a child node.
|
||||
|
@ -126,7 +126,7 @@ public class ParseTreeVisitor<T> {
|
|||
* {@link #visitChildren}. This method is first called before the first
|
||||
* child is visited; at that point {@code currentResult} will be the initial
|
||||
* value (in the default implementation, the initial value is returned by a
|
||||
* call to {@link #defaultValue}.
|
||||
* call to {@link #defaultResult}.
|
||||
* <p/>
|
||||
* The default implementation always returns {@code true}, indicating that
|
||||
* {@code visitChildren} should only return after all children are visited.
|
||||
|
|
34
tool/pom.xml
34
tool/pom.xml
|
@ -17,7 +17,7 @@
|
|||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -73,16 +73,44 @@
|
|||
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<version>2.12.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
|
@ -724,7 +724,6 @@ public class Tool {
|
|||
* given relative to the input directory.
|
||||
*
|
||||
* @param fileNameWithPath path to input source
|
||||
* @return
|
||||
*/
|
||||
public File getOutputDirectory(String fileNameWithPath) {
|
||||
File outputDir;
|
||||
|
|
Loading…
Reference in New Issue