javacc / javaccPlugin

A JavaCC plugin for Gradle
MIT License
33 stars 16 forks source link

Dealing with custom JJTree AST classes #13

Closed jponge closed 9 years ago

jponge commented 9 years ago

This plugin generates all classes for JJTree.

It is desirable to let developers write custom AST classes for some JJTree elements.

This plugin should detect and remove generated duplicates, which is the behaviour of the JavaCC Maven plugin.

Otherwise the generated classes and custom classes are in conflict at compilation time, resulting in duplicate class errors.

jponge commented 9 years ago

Any update on this issue?

johnmartel commented 9 years ago

Sorry, I am working on this project on my spare time. With the Easter holiday coming, I should be able to release a new version fixing this issue. I had a look at the maven plugin and will provide similar functionality.

Please feel free to provide an example on your setup. My initial plan is to have the custom AST classes sit right where they should be in the sourceSet and to avoid generating matching classes in compileJavacc task.

Regards,

John

On Apr 2, 2015, at 06:02, Julien Ponge notifications@github.com wrote:

Any update on this issue?

— Reply to this email directly or view it on GitHub https://github.com/johnmartel/javaccPlugin/issues/13#issuecomment-88854752.

jponge commented 9 years ago

No worries :-)

We have a setup like that in golo-lang/golo-lang if you want to have a look, where some of the classes are overridden by us.

p-muessig commented 9 years ago

I solved this problem by adding

// Copying our node classes prevents JJTree from generating its own implementations // of these classes. // It seems that javaccPlugin 2.1.1 will address this issue. task(copyJjtree, type: Copy) { from compileJjtree.inputDirectory into compileJjtree.outputDirectory include '*/.java' } compileJjtree.dependsOn copyJjtree

to 'build.gradle' as a workaround until it is sovled in 'javaccPlugin'.

Regards, Peter

jponge commented 9 years ago

Still no fix in sight?

johnmartel commented 9 years ago

Fix is coming in slowly, custom AST classes are now supported when they live directly with the JavaCC source code. I'm working on supporting them in the Java sourcesets as well.

jponge commented 9 years ago

Thanks @johnmartel for fixing it. I will shortly try it on eclipse/golo-lang