Javacc - plugin detail

Basic javacc *.jj edit and compile support. Check out the project in Kenai!

NetBeans Plugin - Javacc
Plugin owner: tlazaro
Website: http://kenai.com/projects/nbjavacc
Added: 2009-07-31
License: CDDL / GPL 2.0
Category:
Downloaded: 7,953 times
Rating:
 4.32, by 2 users

Plugin Log Show log

Versions available

Download plugin   Download size: 0.04 MB   Last Update: 2010-05-31

What's new in this version

I think the Lexer works fine now. Parser not ready yet.

Verifications for NetBeans versions

Plugin is not subject to any verification



Introduction

Provides basic support to javacc's *.jj files. Syntax coloring is achieved with a lexer based on it's own specification and compiled with javacc 4.2. By defaul the command "javacc" is executed, in case you don't have it in your path you must go to Options->Miscellaneous->Javacc and enter the full path to your javacc binary i.e. /home/user/javac4.2/bin/javacc

If you don't see any output in the Output window, make sure the path includes "javacc" at the end, the name of the binary to execute.

To compile a *.jj, right-click on it in the project window and select Compile

[ You have to be logged in to be able to comment. ]

User Comments

  

JJTree support

If you just need the .jj syntax coloring/highlighting for files with .jjt suffix:
- go to Tools > Options > Miscellaneous > Files
- File Extension: New.. > File Extension: jjt > OK
- Associated File Type > select "text/x-javacc"

For execution (JavaCC or JJTree code generation) I use the excellent JavaCC Maven plugin
Posted by denbo on Jul 05, 2012
  

Please support jjtree, too.

Hi tiazaro, thank you for tremendous plugin.

But unfortunately, I have to use eclipse to only edit jjt now.

If you extend this plugin being able to manage jjt file and call jjtree command, I'll very happy because I can program with using only elegant netbeans.

Please help me!
Posted by kagyuu on Mar 20, 2012
  

for winXP javacc.bat and not javacc

If you don't see any output in the Output window you must go to Options->Miscellaneous->Javacc and make sure the path includes "javacc.bat" and not "javacc" at the end, the name of the binary to execute.
And thank you for sharing your work!
Posted by Jaja56 on Nov 20, 2010
  

jjt support?

Hey tlazaro,
awesome plugin =)

Are you going to make it support .jjt files in the future?
Posted by SirHase on Jul 06, 2010
  

Uploaded latest version

Upload latest version.
Posted by tlazaro on May 29, 2010
  

Created Kenai Project

I created the http://kenai.com/projects/nbjavacc and uploaded the code. Now it's compatible with Java 5 and done in Netbeans 6.8, the nbm here is still old but you can check out the source code for now until I upload it.
Posted by tlazaro on May 28, 2010
  

I face the same problem as you did

Hey tlazaro
Thank you for sharing your work
also eagerly waiting for the 6.8 version and the source code :-)
Posted by zolta on Feb 12, 2010
  

Answering some question

BACKGROUND:

I don't have much time lately to work on my language parsing project. I would rather having someone else continuing this project. I created the plugin for myself because it was annoying to compile JavaCC externally and then moving files into project, it is not intended as a complete JavaCC editor (at least for version 1.0). I just followed the tutorial in the wiki about adding languages using JavaCC and instead of using a custom javacc file I used the definition for JavaCC itself provided with it's distribution. Then I added an ugly option menu for JavaCC to add the path for the compiler and just added a context menu for the files to Compile them. The difference between having the tool and not having it at all is huge and it took just a couple hours to make. Doing the remaining 20% would just take me too much time and give me just a small return to be affordable right now.

WHAT' NEXT?
I will create a Kenai project within the next few days with the code and I would rather having someone continuing it. I had big plans for this project but I can't work on them right now.

ANSWERS::

1) I compiled the plugin with Java 6 instead of Java 5, that might be causing the problem in Mac. I will re upload a Java 5 version soon after testing in 6.8

2) a) Adding nested languages support is something planned in the Parsing API itself (please correct me if I'm wrong) which should make it easier but I don't know if it's done yet and still might be quite hard. Maybe the definition of Java provided with JavaCC might be usable to enable syntax highlighting but it will sure be tricky to get the full java support we are used to with NB.
b) I think parsing errors are caused by the integration of the JavaCC to the Netbeans Editor, I have similar issues with other custom languages implementations. Also UTF-8 is not supported which makes it unusable in many scenarios.
c) I will check those dependencies issues.

THANKS
Thanks for the feedback!
Posted by tlazaro on Jan 06, 2010
  

Doesn't seem to work in NB 6.8 on Windows

I've tried to install this on NetBeans 6.8 on Windows and it just throws a message about org.netbeans.modules.parsing.api not being available. I've manually edited it out from:

\Info\info.xml
\netbeans\modules\org-javacc.jar\META-INF\MANIFEST.MF

It now installs cleanly for me, but wouldn't do so out of the box.

One issue, and it might be me not driving it correctly, but it never seems to actually do the JavaCC compile and I don't ever get any output from it either success or failure. I've tried various path settings, and I can run javacc directly from a Windows command prompt fine.

I've also been playing around with the other JavaCC plugin ( http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=5402 ), which does compile properly (once you've added the entry into the build.xml), but doesn't offer syntax highlighting. I don't know if there is any chance of the two of you combining, or sharing your code so someone else could combine them.

One other requests, and I appreciate it may be a biggie, I'm not sure how easy it would be to just add, but any chance of the rest of the Java full code completion, like you get in a normal Java document, but within the Java code bits of the JavaCC file?

The JavaCC syntax highlighting also seems to be slightly broken, sticking the following in a production:
( {System.out.println("a ");}| {System.out.println("b ");})
it incorrectly hightlights the text between the second and third quotes as a string. Changing to the following:
(
{
System.out.println("a ");
}
|
{
System.out.println("b ");
}
)
Stops it highlight the quotes at all.

Other than that its an excellent module, thanks very much for it and your work on it.
Posted by peternewman on Jan 02, 2010
  

Re: Cannot get jj file recognized

Honestly no idea. I will ask around in the dev mail list to see if anyone was able to do it with mac. I will try out 6.7.1 as soon as I'm able to.
Posted by tlazaro on Aug 04, 2009
  

Cannot get jj file recognized

I have installed the plugin into NetBeans 6.7.1 on a Mac. The plugin installed without any errors, but I am not getting any syntax coloring. The .jj file icon in my explorer view is still the unrecognized icon. I checked in the Miscellaneous / Files tab, and the jj extension is mapped to the text/x-javacc MIME type. I have restarted NetBeans,but still no luck.

Any suggestions?
Posted by dkkopp on Aug 03, 2009
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo