01: /*
02: * JavaScriptTokenMarker.java - JavaScript token marker
03: * Copyright (C) 1999 Slava Pestov
04: *
05: * You may use and modify this package for any purpose. Redistribution is
06: * permitted, in both source and binary form, provided that this notice
07: * remains intact in all source distributions of this package.
08: */
09:
10: package org.syntax.jedit.tokenmarker;
11:
12: import org.syntax.jedit.*;
13:
14: /**
15: * JavaScript token marker.
16: *
17: * @author Slava Pestov
18: * @version $Id: JavaScriptTokenMarker.java 3074 2004-11-08 04:24:58Z bquig $
19: */
20: public class JavaScriptTokenMarker extends CTokenMarker {
21: public JavaScriptTokenMarker() {
22: super (false, getKeywords());
23: }
24:
25: public static KeywordMap getKeywords() {
26: if (javaScriptKeywords == null) {
27: javaScriptKeywords = new KeywordMap(false);
28: javaScriptKeywords.add("function", Token.KEYWORD3);
29: javaScriptKeywords.add("var", Token.KEYWORD3);
30: javaScriptKeywords.add("else", Token.KEYWORD1);
31: javaScriptKeywords.add("for", Token.KEYWORD1);
32: javaScriptKeywords.add("if", Token.KEYWORD1);
33: javaScriptKeywords.add("in", Token.KEYWORD1);
34: javaScriptKeywords.add("new", Token.KEYWORD1);
35: javaScriptKeywords.add("return", Token.KEYWORD1);
36: javaScriptKeywords.add("while", Token.KEYWORD1);
37: javaScriptKeywords.add("with", Token.KEYWORD1);
38: javaScriptKeywords.add("break", Token.KEYWORD1);
39: javaScriptKeywords.add("case", Token.KEYWORD1);
40: javaScriptKeywords.add("continue", Token.KEYWORD1);
41: javaScriptKeywords.add("default", Token.KEYWORD1);
42: javaScriptKeywords.add("false", Token.LABEL);
43: javaScriptKeywords.add("this", Token.LABEL);
44: javaScriptKeywords.add("true", Token.LABEL);
45: }
46: return javaScriptKeywords;
47: }
48:
49: // private members
50: private static KeywordMap javaScriptKeywords;
51: }
|