views:

60

answers:

3

I'm writing a Javascript syntax highlighter and I am not 100% I have everything.

So far I have:

  1. Comments (// and /* */)
  2. Regex
  3. Number Highlighting
  4. Quotes (" and ')

I also have keyword highlighting:

  1. if
  2. else
  3. new
  4. var
  5. function
  6. for
  7. return
  8. this
  9. do
  10. while
  11. true
  12. false

Am I missing any constructs or keywords that would be essential to highlight? Better yet, if you have some list of all keywords and constructs that would be even better.

+6  A: 

You are missing a few, e.g.: in, switch, break, try, catch, finally, throw, void, with, etc..

You can find a comprehensive list in the Specification:

CMS
+2  A: 

Hello,

See this for a list of present and possible future reserved words: http://javascript.about.com/library/blreserved.htm .

Also note that you can highlight operators as well. Some editors do that. Semicolons and parentheses may or may not be highlighted. It all depends on how you want you highlighting to look.

Alin Purcaru