Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm writing a source-code editor in Java (for Java source code), and I'd like to add simple syntax highlighting (distinctive coloring for keywords would suffice). Any suggestions?
Something like JSyntaxPane, perhaps?
A very simple to use and extend JEditorKit that supports few languages. The main goal is to make it easy to have nice looking Java Swing Editors with support for Syntax Highlighting.
What about RSyntaxTextArea? It uses a modified BSD license.
You first should think about using a common parser to create an AST (abstract syntax tree) from the sources. There are some tools around, first I find googling the internet was javaparser. It looks like this parser also records line numbers and columns, so the AST from javaparser can be a nice model for the editor.
Just process the tree, define colors for the AST node types and print it.
Might want to look at an existing editor (Notepad++ for example - http://notepad-plus.sourceforge.net/uk/site.htm) and see how user-defined syntax highlighting is done (oneo of the plugins to check - Gmod 10 Lua Syntax Highlighter). I'd wager that the Java (and other languages) are done similarly...
You should check Google's prettify.js out. Some pretty neat tricks in there, and you might get a more robust feel for syntax highlighting.
http://www.neathighlighter.com/ is a good JavaScript highlighter
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Ive been searching for a while and can't seem to find what im looking for. What I want to do is write a python script to report problems and enforce code standards in Java code. Everything I have found so far has been things to translate java into python or python into java and that isn't really what I want. Im looking for a python library that can parse a multi-thousand class project and present the source itself in python in such a way where I can write rules something like
every class must have class level javadoc
every class must have a #primaryContactName tag in class level javadoc
every class must have a #primaryContactEmail tag in class level javadoc
the authorized 3rd party library list is {1,2,3,4,5} are any libraries other than this
list used
all lists and maps fully type safe.
bla bla bla
I reallize that I can get a great deal of this info from javac with very little effort, and I may investigate using javac to make version work, but im looking to do something a bit more advanced where I can build in real analytics
I have done similar with XDoclet in the past, but that was primarily used to mantain metadata in the source code about what systems it was accessing and such, nothing really to this analytics level im looking for now.
Anyone come across a python library that would help out with this? I would consider other languages (java, c, etc) its simply in my current situation, python is easier to work with than anything else.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I have to produce a report on all of my program's classes and methods and put it into a word document. Now, I really want to know if there is a software that will generate a text file documentation from my project files without inserting comments to source codes. I just want a list of all methods and classes in a text or ms word file, so that I can fill in the description on my own.
You can generate javadoc documentation just from uncommented source code. It will generate HTML, but there are probably converters to Word available.
However, I would strongly recommend that you add comments to your code instead. It's what Java programmers the world over expect; the documentation will show up in tooltips when you're writing new code calling into your current API; the tooling is geared up for it. Basically, try to work with the language conventions instead of fighting them.
EDIT: It sounds like you can use a doclet to generate the Word document for you. The MIF Doclet may be a good starting point, or PDFDoclet.
Generate the documentation using javadoc and then convert it to the required format. Look for different options here: https://www.oracle.com/java/technologies/javase/javadoc-faq.html#print.
Hope it helps.
There is a Maven plugin, "maven-site-plugin" that is useful for producing editable HTML docs from a Java project.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have been looking for an existing open-source syntax-checker for the Object Constraint Language (OCL). I intend to extend the syntax-checker with additional functionality not present in the OCL standard to be more applicable to my usage with entity-relationship diagrams. However, most of the projects I have found are based on the Eclipse Meta-Object Facility (MOF), while I seek only the ability to verify the grammar of an OCL expression (completely independent of any associated class diagrams, etc.). I have begun looking into the source of the Dresden OCL Toolkit (dresden-ocl.sourceforge.net), even though the newest toolkit is also intended for use with the Eclipse MOF. Unfortunately, all downloads are blocked at the company I work for, and it takes 1-2 days minimum to get permission for any download, so I want to know if anyone might be able to point me in the right direction to find what I am looking for.
Thank you very much in advance.
Best regards,
Shona
I've been using Dresden OCL for quite a long time and I think it is a really good starting point for what you want (of course, it is not perfect, last time I checked it still had some problems with recognizing some set operators or navigation expression from association classes).
You can also take a look at the Eclipse OCL plug/in http://www.eclipse.org/modeling/mdt/downloads/?project=ocl
part of the model-development tools initiative
Pointers to other tools supporting OCL (not necessarily open-source) here: http://modeling-languages.com/content/list-ocl-tools
Also, you might by interested in having a look at other tools supporting OCL syntax checking, like Octopus, created(?) by Jos Warmer and Anneke Kleppe, who are authors of the OCL specs.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
What is the single best pretty-printing library for Java? I mean a library for printing formatted output with indentation, break hints, etc., not a library for beautifying/re-formatting Java code itself. Ideally, the library would "play nice" with System.out.println and friends.
For an idea of what I'm looking for, see OCaml's Format module, particularly Format.fprintf.
[UPDATE] I am not looking for a console windowing library. A pretty-printing library allows you to define methods for formatting arbitrary values such that indentation is preserved and line breaks are chosen at sensible locations. Such libraries exist for Haskell, Standard ML, OCaml, F#, and Scheme. The XTC library provides some of this functionality in xtc.tree.Printer, but it is not nearly as flexible as the libraries in other languages.
Is it jpplib?
Since you talk about boxes, break hints and so on I assume you mean to build a text-based windowing application. So I guess that you are looking for something similar to Ncurses but in Java. Maybe charva could help you.
You may also try javacurses.
According to Dr. Dobb's Code Talk it is cute.
I would say its still easier using Xalan + Sax, like in this example.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm not committed to any particular GUI tookit or anything - just needs to be Java based. I want to do simple syntax highlighting ( XML and XQuery ) inside editable text areas.
My only candidate so far is Swing's JTextPane, as it supports seems to support the styling of text, but I have no idea how to implement it in this context.
If a particular toolkit has something like this out of the box, that would be awesome, but I'm open to doing this by hand if need be.
JSyntaxPane handles XML and can be extended
http://code.google.com/p/jsyntaxpane/wiki/Using
Or, it should be possible to extract the NetBeans editor, but that would probably be more work...
[edit] btw, I got the XML info from here... it doesn't seem to mention it on the google code pages...
Jide software has a Syntax Highligher component. It is still in beta, but I think it supposed XML. I haven't used it myself, so I don't know how well it will do what you want.
Why not check out Ostermiller's Syntax Highlighter.
Here's a simple code editor demo
It still uses JTextPane though.