Click to See Complete Forum and Search --> : JavaScript syntax checking


emus
11-11-2003, 04:59 AM
Does anyone know of a program to check JavaScript syntax? For example verifying that String literals are closed properly etc.

I know that several editors can color-code syntax, however, I'm looking for something that will indicate a possible error similar to what is displayed when compiling a program.


Thanks in advance,

emus

blingbling!!
11-11-2003, 05:52 AM
I've never heared of a compiler for javascipt - javascript is not a compiled language, it's much higher level than that. Maybe what you want is an IDE - check Eclipse(www.eclipse.org) - i think there's a javascript editing plugin for that. Also, Mozilla Firebird has a 'javascript console' which acts as a terminal displaying all errors and warnings generated by javascript during your average surf. (There is also a kind of 'immediate window' where you can test out expressions). This could be useful if you're writing web pages.

ok - hth!!!

Robin

emus
11-11-2003, 07:04 AM
Thanks for the reply blingbling!!,

I know that JavaScript doesn't compile in the classical sense, it's a scripting language, maybe my post was unclear.

I'm just looking for compiler-type error messages.


For example if I do the following


document.write("random text message);


I'd like the program to show that I have an unclosed String literal. The error checking in browsers can indicate this, but my main problem is the cache; sometimes I have to refresh several times to test a script in order to get the error messages.

Anyways, I'll give firebird try, maybe the immediate window is what I'm looking for.


Thanks again,

emus

blingbling!!
11-11-2003, 07:19 AM
Ok, i just cut and paste your code into my Mozilla Firebird Javascript console, and it told me this:


Error: unterminated string literal
Source File: javascript: document.write("random text message); Line: 1


Is this what you mean?? Why not swing by the mozilla site and and grab yourself a firebird?? Apart from anything else it's an excellent browser!

hth.
Robin.

emus
11-11-2003, 01:42 PM
Hi blingbling!!,


I just tried what you suggested and I must say it's an excellent help utility.

Thanks a lot,


emus