[antlr-interest] New Maven artifact for compiling antlr grammars
Howard Lewis Ship
hlship at gmail.com
Fri Dec 5 11:47:48 PST 2008
I'm having a problem; I need to split my grammar into a lexer grammar
and a parser grammar so I can specify a superClass option for the
lexer grammar.
My source files are
src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyTokens.g
and PropertyExpression.g.
The plugin generates a PropertyTokens.tokens file as
target/generated-sources/antlr/org/apache/tapestry5/internal/antlr/PropertyTokens.token
So far, so good.
However, in my PropertyExpression.g file I've tried
options { tokenVocab=PropertyTokens; }
and
options {
tokenVocab="org/apache/tapestry5/internal/antlr/PropertyTokens";
}
and both fail. The first should work, but gets:
[INFO] [antlr3:antlr {execution: default}]
org/apache/tapestry5/internal/antlr/PropertyTokens.g
org/apache/tapestry5/internal/antlr/PropertyExpression.g
[ERROR] error(3): cannot find tokens file
/Users/Howard/work/tapestry5/tapestry-core/target/generated-sources/antlr/PropertyTokens.tokens
I think the plugin is not setting the -lib option correctly (see
Definitive ANTLR Reference, p. 110).
My workaround:
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr3-maven-plugin</artifactId>
<version>3.1.1.2</version>
<executions>
<execution>
<goals>
<goal>antlr</goal>
</goals>
<configuration>
<!-- This is a hack so that the parser
grammar can locate the tokens file generated
by the lexer grammar. -->
<libDirectory>target/generated-sources/antlr/org/apache/tapestry5/internal/antlr</libDirectory>
</configuration>
</execution>
</executions>
</plugin>
This feels like a bug in either the Maven plugin or in ANTLR; it
should be able to find the .tokens file for a lexer grammar generated
from the same package folder. If I ended up having multiple grammars
in my project, I would have to put them all in a single package folder
for the build to work.
On Fri, Dec 5, 2008 at 10:13 AM, Jim Idle <jimi at temporal-wave.com> wrote:
> On Fri, 2008-12-05 at 09:57 -0800, Howard Lewis Ship wrote:
>
> Is this the right plugin artiface?
>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>antlr3-maven-plugin</artifactId>
> <version>3.1.1.1</version>
>
>
> No it is org.antlr as per teh post to the group:
>
> <plugin>
> <groupId>org.antlr</groupId>
> <artifactId>antlr3-maven-plugin</artifactId>
> <version>3.1.1.2</version>
>
> <configuration>
> ...
> </configuration>
>
> <executions>
>
> <execution>
> <goals>
> <goal>antlr</goal>
> </goals>
> </execution>
>
> </executions>
>
> </plugin>
>
> On Fri, Dec 5, 2008 at 9:39 AM, Jim Idle <jimi at temporal-wave.com> wrote:
>> On Fri, 2008-12-05 at 09:30 -0800, Howard Lewis Ship wrote:
>>
>> I don't see it here:
>>
>>
>> http://mirrors.ibiblio.org/pub/mirrors/maven2/org/codehaus/mojo/antlr3-maven-plugin/
>>
>> Where do you think it ended up?
>>
>> It is no longer in the codehaus repository, but maven central. Just
>> reference it and it will be pulled in. It works for me and others on the
>> list.
>>
>> Jim
>>
>> PS: There will be a 3.1.1.2 shortly as I found that 3.1.1.1 did not
>> respect
>> the conversionTimeout configuration.
>>
>> Jim
>>
>> On Wed, Dec 3, 2008 at 2:02 PM, Jim Idle <jimi at temporal-wave.com> wrote:
>>> I have just released org.antlr - antlr3-maven-plugin version 3.1.1.1,
>>> which
>>> should sync up with Maven central no later than 4 hours from now
>>> (depending
>>> on when in the sync cycle I deployed the artifacts).
>>>
>>> This release incorporates a few donated re-jigs, but more importantly I
>>> have
>>> re-implemented the dependency checking code as the previous
>>> implementations
>>> were using Collection sorting, which cannot handle interdependencies
>>> correctly. The dependency resolution is now evaluated using a topological
>>> sort and seems to work well.
>>>
>>> The release numbering reflects that this is the first revision to the
>>> plugin
>>> that processes .g files using ANTLR 3.1.1.
>>>
>>> Please let me know if you find errors of course. The generated usage web
>>> site will be updated and deployed to somewhere on www.antlr.org when the
>>> hardware for the web site is upgraded sometime this week.
>>>
>>> Jim
>>>
>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>> Unsubscribe:
>>>
>>>
>>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>
>
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
More information about the antlr-interest
mailing list