summaryrefslogtreecommitdiff
path: root/antlr4-maven-plugin/src/test/projects
diff options
context:
space:
mode:
Diffstat (limited to 'antlr4-maven-plugin/src/test/projects')
-rw-r--r--antlr4-maven-plugin/src/test/projects/dependencyRemoved/pom.xml33
-rw-r--r--antlr4-maven-plugin/src/test/projects/dependencyRemoved/src/main/antlr4/imports/HelloBase.g416
-rw-r--r--antlr4-maven-plugin/src/test/projects/dependencyRemoved/src/main/antlr4/test/Hello.g47
-rw-r--r--antlr4-maven-plugin/src/test/projects/importTokens/pom.xml33
-rw-r--r--antlr4-maven-plugin/src/test/projects/importTokens/src/main/antlr4/imports/SimpleLexer.tokens3
-rw-r--r--antlr4-maven-plugin/src/test/projects/importTokens/src/main/antlr4/test/SimpleParser.g48
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsCustom/pom.xml48
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/Hello.g44
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/TestLexer.g46
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/TestParser.g45
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/imports/TestBaseLexer.g416
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsStandard/pom.xml33
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/imports/TestBaseLexer.g416
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/Hello.g44
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/TestLexer.g46
-rw-r--r--antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/TestParser.g45
16 files changed, 243 insertions, 0 deletions
diff --git a/antlr4-maven-plugin/src/test/projects/dependencyRemoved/pom.xml b/antlr4-maven-plugin/src/test/projects/dependencyRemoved/pom.xml
new file mode 100644
index 0000000..3163b81
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/dependencyRemoved/pom.xml
@@ -0,0 +1,33 @@
+<!--
+ ~ Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ ~ Use of this file is governed by the BSD 3-clause license that
+ ~ can be found in the LICENSE.txt file in the project root.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>deps.removed</groupId>
+ <artifactId>depRemoved</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Test processing after dependency removed</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>antlr4-maven-plugin</artifactId>
+ <configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/antlr4-maven-plugin/src/test/projects/dependencyRemoved/src/main/antlr4/imports/HelloBase.g4 b/antlr4-maven-plugin/src/test/projects/dependencyRemoved/src/main/antlr4/imports/HelloBase.g4
new file mode 100644
index 0000000..5fcc6d3
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/dependencyRemoved/src/main/antlr4/imports/HelloBase.g4
@@ -0,0 +1,16 @@
+lexer grammar TestBaseLexer;
+
+tokens { Name }
+
+// Default "mode": Everything OUTSIDE of a tag
+Comment : '<!--' .*? '-->' ;
+CDSect : '<![CDATA[' .*? ']]>' ;
+
+fragment
+Whitespace : ' ' | '\n' | '\t' | '\r' ;
+
+fragment
+Hexdigit : [a-fA-F0-9] ;
+
+fragment
+Digit : [0-9] ;
diff --git a/antlr4-maven-plugin/src/test/projects/dependencyRemoved/src/main/antlr4/test/Hello.g4 b/antlr4-maven-plugin/src/test/projects/dependencyRemoved/src/main/antlr4/test/Hello.g4
new file mode 100644
index 0000000..54f998c
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/dependencyRemoved/src/main/antlr4/test/Hello.g4
@@ -0,0 +1,7 @@
+grammar Hello;
+
+import HelloBase;
+
+r : 'hello' ID ;
+ID : [a-z]+ ;
+WS : [ \r\t\n]+ -> skip ;
diff --git a/antlr4-maven-plugin/src/test/projects/importTokens/pom.xml b/antlr4-maven-plugin/src/test/projects/importTokens/pom.xml
new file mode 100644
index 0000000..478b517
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importTokens/pom.xml
@@ -0,0 +1,33 @@
+<!--
+ ~ Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ ~ Use of this file is governed by the BSD 3-clause license that
+ ~ can be found in the LICENSE.txt file in the project root.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>import.tokens</groupId>
+ <artifactId>importTokens</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Test importing tokens file</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>antlr4-maven-plugin</artifactId>
+ <configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/antlr4-maven-plugin/src/test/projects/importTokens/src/main/antlr4/imports/SimpleLexer.tokens b/antlr4-maven-plugin/src/test/projects/importTokens/src/main/antlr4/imports/SimpleLexer.tokens
new file mode 100644
index 0000000..4637d6e
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importTokens/src/main/antlr4/imports/SimpleLexer.tokens
@@ -0,0 +1,3 @@
+ID=1
+INT=2
+SEMI=3
diff --git a/antlr4-maven-plugin/src/test/projects/importTokens/src/main/antlr4/test/SimpleParser.g4 b/antlr4-maven-plugin/src/test/projects/importTokens/src/main/antlr4/test/SimpleParser.g4
new file mode 100644
index 0000000..bbd8274
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importTokens/src/main/antlr4/test/SimpleParser.g4
@@ -0,0 +1,8 @@
+parser grammar SimpleParser;
+options {
+ // get token types from SimpleLexer.tokens; don't name it
+ // SimpleParser.tokens as ANTLR will overwrite!
+ tokenVocab=SimpleLexer;
+}
+
+s : ( ID | INT )* SEMI ;
diff --git a/antlr4-maven-plugin/src/test/projects/importsCustom/pom.xml b/antlr4-maven-plugin/src/test/projects/importsCustom/pom.xml
new file mode 100644
index 0000000..a5826bc
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsCustom/pom.xml
@@ -0,0 +1,48 @@
+<!--
+ ~ Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ ~ Use of this file is governed by the BSD 3-clause license that
+ ~ can be found in the LICENSE.txt file in the project root.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>imports.custom</groupId>
+ <artifactId>importsCustom</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Test importing, custom layout</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>antlr4-maven-plugin</artifactId>
+ <configuration>
+ <outputDirectory>${basedir}/src/main/java/com/foo</outputDirectory>
+ <arguments>
+ <argument>-visitor</argument>
+ <argument>-no-listener</argument>
+ <argument>-Xlog</argument>
+ <argument>-package</argument>
+ <argument>com.foo</argument>
+ </arguments>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>antlr4</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/Hello.g4 b/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/Hello.g4
new file mode 100644
index 0000000..e38ac87
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/Hello.g4
@@ -0,0 +1,4 @@
+grammar Hello;
+r : 'hello' ID ;
+ID : [a-z]+ ;
+WS : [ \r\t\n]+ -> skip ; \ No newline at end of file
diff --git a/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/TestLexer.g4 b/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/TestLexer.g4
new file mode 100644
index 0000000..668b764
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/TestLexer.g4
@@ -0,0 +1,6 @@
+lexer grammar TestLexer;
+
+import TestBaseLexer;
+
+WS : Whitespace+ -> skip;
+TEXT : ~[<&]+ ; // match any 16 bit char other than < and & \ No newline at end of file
diff --git a/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/TestParser.g4 b/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/TestParser.g4
new file mode 100644
index 0000000..5c25961
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/TestParser.g4
@@ -0,0 +1,5 @@
+parser grammar TestParser;
+
+options { tokenVocab=TestLexer; }
+
+document : (Comment | Name) EOF ; \ No newline at end of file
diff --git a/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/imports/TestBaseLexer.g4 b/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/imports/TestBaseLexer.g4
new file mode 100644
index 0000000..5fcc6d3
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsCustom/src/main/antlr4/imports/TestBaseLexer.g4
@@ -0,0 +1,16 @@
+lexer grammar TestBaseLexer;
+
+tokens { Name }
+
+// Default "mode": Everything OUTSIDE of a tag
+Comment : '<!--' .*? '-->' ;
+CDSect : '<![CDATA[' .*? ']]>' ;
+
+fragment
+Whitespace : ' ' | '\n' | '\t' | '\r' ;
+
+fragment
+Hexdigit : [a-fA-F0-9] ;
+
+fragment
+Digit : [0-9] ;
diff --git a/antlr4-maven-plugin/src/test/projects/importsStandard/pom.xml b/antlr4-maven-plugin/src/test/projects/importsStandard/pom.xml
new file mode 100644
index 0000000..77f63a2
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsStandard/pom.xml
@@ -0,0 +1,33 @@
+<!--
+ ~ Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ ~ Use of this file is governed by the BSD 3-clause license that
+ ~ can be found in the LICENSE.txt file in the project root.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>imports.standard</groupId>
+ <artifactId>importsStandard</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Test importing, standard layout</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>antlr4-maven-plugin</artifactId>
+ <configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/imports/TestBaseLexer.g4 b/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/imports/TestBaseLexer.g4
new file mode 100644
index 0000000..5fcc6d3
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/imports/TestBaseLexer.g4
@@ -0,0 +1,16 @@
+lexer grammar TestBaseLexer;
+
+tokens { Name }
+
+// Default "mode": Everything OUTSIDE of a tag
+Comment : '<!--' .*? '-->' ;
+CDSect : '<![CDATA[' .*? ']]>' ;
+
+fragment
+Whitespace : ' ' | '\n' | '\t' | '\r' ;
+
+fragment
+Hexdigit : [a-fA-F0-9] ;
+
+fragment
+Digit : [0-9] ;
diff --git a/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/Hello.g4 b/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/Hello.g4
new file mode 100644
index 0000000..e38ac87
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/Hello.g4
@@ -0,0 +1,4 @@
+grammar Hello;
+r : 'hello' ID ;
+ID : [a-z]+ ;
+WS : [ \r\t\n]+ -> skip ; \ No newline at end of file
diff --git a/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/TestLexer.g4 b/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/TestLexer.g4
new file mode 100644
index 0000000..668b764
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/TestLexer.g4
@@ -0,0 +1,6 @@
+lexer grammar TestLexer;
+
+import TestBaseLexer;
+
+WS : Whitespace+ -> skip;
+TEXT : ~[<&]+ ; // match any 16 bit char other than < and & \ No newline at end of file
diff --git a/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/TestParser.g4 b/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/TestParser.g4
new file mode 100644
index 0000000..5c25961
--- /dev/null
+++ b/antlr4-maven-plugin/src/test/projects/importsStandard/src/main/antlr4/test/TestParser.g4
@@ -0,0 +1,5 @@
+parser grammar TestParser;
+
+options { tokenVocab=TestLexer; }
+
+document : (Comment | Name) EOF ; \ No newline at end of file