javascript (rhino) syntax highlighting jeditorppane

T

Timasmith

Hi,

Withing a large system, I have an 'editor' with lets the user modify
the contents of a script. I would like to add some color for
comments, text, etc, perhaps squiggly lines under code that fails to
compile. The language I want to validate against is Javascript.

What is the best open source code to add functionality like this to my
app (Eclipse, JEdit etc.) Not looking to have anything complex, just
some basics. Using JEdit as a plugin might work, though that adds a
lot of code and must integrate with my classes to persist the script.

thanks

Tim
 
C

Chris Uppal

Timasmith said:
What is the best open source code to add functionality like this to my
app (Eclipse, JEdit etc.) Not looking to have anything complex, just
some basics. Using JEdit as a plugin might work, though that adds a
lot of code and must integrate with my classes to persist the script.

Does JEdit add that much ? I had thought that it seemed to have a relatively
lightweight component inside it. I'm thinking of packages
org.gjt.sp.jedit.textarea and org.gjt.sp.jedit.syntax.in the documentation at
http://www.jedit.org/api/index.html .

Mind, that's only an impression from looking at the website, I haven't tried to
integrate that code with anything.

-- chris
 
C

Chris Uppal

[Sorry Tim, I emailed this to yoiu directly by mistake]
I've been using Rhino for a while with java 1.5. Now having spent a
couple of hours troubleshooting why the script was converting my Long
object into a double value, I would consider changing to 1.6 to avoid
scripts messing with my data type objects.

As far as I know, the only numeric type ECMAScript has is 64-bit floating
point. So there's very little else a JavaScript interpreter is allowed to
do.

Of more practical value to you, I imagine, is to know why Rhino makes your
long (when converted to floating point) behave and/or look like a floating
point value instead of coyly pretending to be an integer. I can only guess
that the original value is outside some range. For instance ECMAScript's
built in Number -> String conversion will only represent "integer" Number
values as if they /are/ integers if they lie within some range -- the rules
are a little complicated, but I think that range is +/-1.0e21.

What is the value of the original long ? And what are you doing with the
resulting JavaScript number to be able to see that it has "turned into"
floating point ?

-- chris
 
T

Thomas Kellerer

Hi,

Withing a large system, I have an 'editor' with lets the user modify
the contents of a script. I would like to add some color for
comments, text, etc, perhaps squiggly lines under code that fails to
compile. The language I want to validate against is Javascript.

What is the best open source code to add functionality like this to my
app (Eclipse, JEdit etc.) Not looking to have anything complex, just
some basics. Using JEdit as a plugin might work, though that adds a
lot of code and must integrate with my classes to persist the script.

The "old" jEdit syntax pacakge that is available at sourceforge is
probably not the "best" but for a simple editor it should be enough.
It's only a single package that doesn't add too much overhaed. For
apparent reasons it is not maintained any longer, but it does work for me.

http://sourceforge.net/projects/jedit-syntax/

I don't think it includes JavaScript highlighting, but this shouldn't be
too complicated to add.

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top