PDA

View Full Version : Javascript Parser



waynefrank
04-25-2005, 05:17 PM
Is there a good Javascript parser, that can point out things like syntax errors, or a misspelled variable name? I know Javascript is not compiled, but this type of thing would be handy.

Thanks

mwinter
04-25-2005, 08:03 PM
Is there a good Javascript parser, that can point out things like syntax errors, or a misspelled variable name?JSLint (http://www.crockford.com/javascript/lint.html) is a tool that will parse scripts and point out syntax errors. It will also highlight code that could cause problems. I personally find that last feature annoying because I sometimes use 'questionable' constructs on purpose, but I appreciate why the warnings are given.

It's not really possible to point out misspelt identifiers due to the nature of ECMAScript itself. There are very few truly standardised member names and, more importantly, new names can be introduced at any time. JSLint does, however, list identifiers and how often they are used which helps with discovering typos.

Mike