[ http://jira.codehaus.org/browse/MANTLRTHREE-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=130695#action_130695 ]
Silvester Pozarnik commented on MANTLRTHREE-4: ---------------------------------------------- The plugin works now as it should on our installations. Thanks for fix. > Unable to force the processing sequence of several interdependent grammar > files > ------------------------------------------------------------------------------- > > Key: MANTLRTHREE-4 > URL: http://jira.codehaus.org/browse/MANTLRTHREE-4 > Project: Maven 2.x Antlr3 Plugin > Issue Type: Bug > Components: antlr > Affects Versions: 1.0-beta-1 > Reporter: Silvester Pozarnik > Assignee: David Holroyd > Fix For: 1.0-beta-2 > > > As from antlr 3.0, you have to have at least two grammar files if you are > using the tree parser. As the Tree parser usually uses a Token file generated > by the parser, the tree parser grammar file _must_ be processed after the > parser file. The implementation of plugin uses a > SimpleSourceInclusionScanner class in processGrammarFiles() and iterator > through the set runs completely randomly. We experienced that on WINDOWS it > runs ok, but on Linux it runs OK when you build the module, but fails due to > other sorting order if you are using reactor build. The reason for this is > different relevant paths to grammar files which will generate different hash > values. If for example your "TreeParser.g3" grammar is dependent on tokens > generated by compiling the "Parser.g3" file, you should be able to force the > processing order by calling the plugin as f.ex.: > > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>antlr3-maven-plugin</artifactId> > ... > <includes> > <include>**/Parser.g3</include> > <include>**/TreeParser.g3</include> > </includes> > This does not work now, as "TreeParser.g3" may get processed before the > "Parser.g3". > The problem is also that even if you get message regarding the missing token > file (easy to miss) - the build will succeed and you get a strange message( > ".. expecting token X, got token X..."!?) from antlr tree parser in run time. > The work around is to run antlr3-maven-plugin in two pases: > ... > <executions> > <execution> > <id>run-antlr-step1</id> > <phase>generate-sources</phase> <!-- for "Parser.g3" --> > ... > <include>**/Parser.g3</include> > and > <execution> > <id>run-antlr-step2</id> > <phase>process-sources</phase> <!-- for "TreeParser.g3" --> > ... > <include>**/TreeParser.g3</include> > But this is ugly way of solving the problem. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email