01: package net.xoetrope.builder.editor.syntaxhighlight;
02:
03: /*
04: * JavaTokenMarker.java - Java 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: * Java token marker.
16: *
17: * @author Slava Pestov
18: * @version $Id: JavaTokenMarker.java,v 1.22 2005/01/05 17:20:48 luano Exp $
19: */
20: public class JavaTokenMarker extends CTokenMarker {
21: public JavaTokenMarker() {
22: super (false, getKeywords());
23: }
24:
25: public static KeywordMap getKeywords() {
26: if (javaKeywords == null) {
27: javaKeywords = new KeywordMap(false);
28: javaKeywords.add("package", Token.KEYWORD2);
29: javaKeywords.add("import", Token.KEYWORD2);
30: javaKeywords.add("byte", Token.KEYWORD3);
31: javaKeywords.add("char", Token.KEYWORD3);
32: javaKeywords.add("short", Token.KEYWORD3);
33: javaKeywords.add("int", Token.KEYWORD3);
34: javaKeywords.add("long", Token.KEYWORD3);
35: javaKeywords.add("float", Token.KEYWORD3);
36: javaKeywords.add("double", Token.KEYWORD3);
37: javaKeywords.add("boolean", Token.KEYWORD3);
38: javaKeywords.add("void", Token.KEYWORD3);
39: javaKeywords.add("class", Token.KEYWORD3);
40: javaKeywords.add("interface", Token.KEYWORD3);
41: javaKeywords.add("abstract", Token.KEYWORD1);
42: javaKeywords.add("final", Token.KEYWORD1);
43: javaKeywords.add("private", Token.KEYWORD1);
44: javaKeywords.add("protected", Token.KEYWORD1);
45: javaKeywords.add("public", Token.KEYWORD1);
46: javaKeywords.add("static", Token.KEYWORD1);
47: javaKeywords.add("synchronized", Token.KEYWORD1);
48: javaKeywords.add("native", Token.KEYWORD1);
49: javaKeywords.add("volatile", Token.KEYWORD1);
50: javaKeywords.add("transient", Token.KEYWORD1);
51: javaKeywords.add("break", Token.KEYWORD1);
52: javaKeywords.add("case", Token.KEYWORD1);
53: javaKeywords.add("continue", Token.KEYWORD1);
54: javaKeywords.add("default", Token.KEYWORD1);
55: javaKeywords.add("do", Token.KEYWORD1);
56: javaKeywords.add("else", Token.KEYWORD1);
57: javaKeywords.add("for", Token.KEYWORD1);
58: javaKeywords.add("if", Token.KEYWORD1);
59: javaKeywords.add("instanceof", Token.KEYWORD1);
60: javaKeywords.add("new", Token.KEYWORD1);
61: javaKeywords.add("return", Token.KEYWORD1);
62: javaKeywords.add("switch", Token.KEYWORD1);
63: javaKeywords.add("while", Token.KEYWORD1);
64: javaKeywords.add("throw", Token.KEYWORD1);
65: javaKeywords.add("try", Token.KEYWORD1);
66: javaKeywords.add("catch", Token.KEYWORD1);
67: javaKeywords.add("extends", Token.KEYWORD1);
68: javaKeywords.add("finally", Token.KEYWORD1);
69: javaKeywords.add("implements", Token.KEYWORD1);
70: javaKeywords.add("throws", Token.KEYWORD1);
71: javaKeywords.add("this", Token.LITERAL2);
72: javaKeywords.add("null", Token.LITERAL2);
73: javaKeywords.add("super", Token.LITERAL2);
74: javaKeywords.add("true", Token.LITERAL2);
75: javaKeywords.add("false", Token.LITERAL2);
76: }
77: return javaKeywords;
78: }
79:
80: // private members
81: private static KeywordMap javaKeywords;
82: }
|