01: package net.xoetrope.builder.editor.syntaxhighlight;
02:
03: /*
04: * JavaScriptTokenMarker.java - JavaScript token marker
05: * Copyright (C) 1999 Slava Pestov
06: *
07: * You may use and modify this package for any purpose. Redistribution is
08: * permitted, in both source and binary form, provided that this notice
09: * remains intact in all source distributions of this package.
10: */
11:
12: import javax.swing.text.Segment;
13:
14: /**
15: * JavaScript token marker.
16: *
17: * @author Slava Pestov
18: * @version $Id: JavaScriptTokenMarker.java,v 1.22 2005/01/05 17:20:48 luano Exp $
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: }
|