Subj : Re: Help! - JavaScript syntax checking To : Chris Myers From : Igor Bukanov Date : Wed Jan 21 2004 12:12 pm Chris Myers wrote: > I've been desparately trawling the internet trying to find a way of > syntax checking JavaScript (Rhino). > > We need to do this because we save the script and run it later on a > server. > > Does anyone know of a JavaCC grammar or a way of getting Rhino to tell > us if a script is syntactically correct. See http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/Context.html#stringIsCompilableUnit(java.lang.String) which allows to check if compilation of the given string would succeed. But note it would not help that much in general since most of errors comes when scripts accesses undefined global properties or non-existing members at runtime. Regards, Igor .