[antlr-interest] errors in embedding grammar files in maven project - regd.
Ashok Varikuti
asoka250 at gmail.com
Sun Feb 22 14:12:31 PST 2009
Jim Idle wrote:
> On Wed, 2008-12-03 at 20:26 -0600, Ashok Varikuti wrote:
>> Hi List,
>>
>> I encapsulated antlr grammar files in a eclipse maven project. The
>> compilation task of grammar files is done at maven compile time. I
>> specified the output directory to be the following :-
>>
>
> Here is a sample configuration for antlr3-maven-plugin version
> 3.1.1.1, which is now synced with Maven central (because I just used
> it ;-).
>
>
> <plugin>
> <groupId>org.antlr</groupId>
> <artifactId>antlr3-maven-plugin</artifactId>
> <version>3.1.1.1</version>
> <configuration>
> <sourceDirectory>src/main/java/com/temporalwave/parsers/aspdotnet</sourceDirectory>
> <outputDirectory>target/generated-sources/aspdotnetjava/com/temporalwave/parsers/aspdotnet</outputDirectory>
> <libDirectory>src/main/java/com/temporalwave/parsers/aspdotnet</libDirectory>
> <excludes>
> <exclude>commonwalker.g</exclude>
> </excludes>
> </configuration>
>
> <executions>
>
> <execution>
> <goals>
> <goal>antlr</goal>
> </goals>
> </execution>
> </executions>
>
> </plugin>
>
>
> If you do not specify a source and output directory then it looks for
> grammar in the ./antlr directory and the output files should be in:
>
> target/generated-sources/nameofyourartifact/antlr
>
> But your package is:
>
> @header {
> package prefuse.parser.dotparser;
> }
> @lexer::header {
> package prefuse.parser.dotparser;
> }
>
>
> So you want your grammar files to be in the directory:
>
> <sourceDirectory>src/main/java/prefuse/parser/dotparser</sourceDirectory>
>
>
> and your output files should be:
>
> <outputDirectory>target/generated-sources/yourartifactname/prefuse/parser/dotparser</outputDirectory>
>
>
> Then it will all work. Be sure to use version 3.1.1.1 of the plugin if
> you have dependent grammars (tokenVocab option) as the 3.1.1 version
> and below do not calculate dependencies correctly.
>
> Jim
> ------------------------------------------------------------------------
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
Hi Jim,
I was able to figure out what you are talking. It did work for me. Cheers.
--
Ashok R Varikuti
Graduate Research Assistant
CIS Dept, Kansas State University
785-304-2401
ashokv at ksu.edu
More information about the antlr-interest
mailing list