01: /*
02: * JavaTokenMarker.java - Java 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.KeywordMap;
13:
14: /**
15: * Java token marker.
16: *
17: * @author Slava Pestov
18: * @version $Id: JavaTokenMarker.java 3074 2004-11-08 04:24:58Z bquig $
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("abstract", Token.KEYWORD1);
29: javaKeywords.add("final", Token.KEYWORD1);
30: javaKeywords.add("private", Token.KEYWORD1);
31: javaKeywords.add("protected", Token.KEYWORD1);
32: javaKeywords.add("public", Token.KEYWORD1);
33: javaKeywords.add("static", Token.KEYWORD1);
34: javaKeywords.add("synchronized", Token.KEYWORD1);
35: javaKeywords.add("volatile", Token.KEYWORD1);
36: javaKeywords.add("transient", Token.KEYWORD1);
37: javaKeywords.add("break", Token.KEYWORD1);
38: javaKeywords.add("case", Token.KEYWORD1);
39: javaKeywords.add("continue", Token.KEYWORD1);
40: javaKeywords.add("default", Token.KEYWORD1);
41: javaKeywords.add("do", Token.KEYWORD1);
42: javaKeywords.add("else", Token.KEYWORD1);
43: javaKeywords.add("for", Token.KEYWORD1);
44: javaKeywords.add("if", Token.KEYWORD1);
45: javaKeywords.add("instanceof", Token.KEYWORD1);
46: javaKeywords.add("new", Token.KEYWORD1);
47: javaKeywords.add("return", Token.KEYWORD1);
48: javaKeywords.add("switch", Token.KEYWORD1);
49: javaKeywords.add("while", Token.KEYWORD1);
50: javaKeywords.add("throw", Token.KEYWORD1);
51: javaKeywords.add("try", Token.KEYWORD1);
52: javaKeywords.add("catch", Token.KEYWORD1);
53: javaKeywords.add("finally", Token.KEYWORD1);
54: javaKeywords.add("throws", Token.KEYWORD1);
55: javaKeywords.add("assert", Token.KEYWORD1);
56:
57: javaKeywords.add("package", Token.KEYWORD2);
58: javaKeywords.add("import", Token.KEYWORD2);
59: javaKeywords.add("class", Token.KEYWORD2);
60: javaKeywords.add("interface", Token.KEYWORD2);
61: javaKeywords.add("extends", Token.KEYWORD2);
62: javaKeywords.add("implements", Token.KEYWORD2);
63:
64: javaKeywords.add("this", Token.KEYWORD3);
65: javaKeywords.add("null", Token.KEYWORD3);
66: javaKeywords.add("super", Token.KEYWORD3);
67: javaKeywords.add("true", Token.KEYWORD3);
68: javaKeywords.add("false", Token.KEYWORD3);
69:
70: javaKeywords.add("byte", Token.PRIMITIVE);
71: javaKeywords.add("char", Token.PRIMITIVE);
72: javaKeywords.add("short", Token.PRIMITIVE);
73: javaKeywords.add("int", Token.PRIMITIVE);
74: javaKeywords.add("long", Token.PRIMITIVE);
75: javaKeywords.add("float", Token.PRIMITIVE);
76: javaKeywords.add("double", Token.PRIMITIVE);
77: javaKeywords.add("boolean", Token.PRIMITIVE);
78: javaKeywords.add("void", Token.PRIMITIVE);
79: javaKeywords.add("enum", Token.PRIMITIVE);
80: }
81: return javaKeywords;
82: }
83:
84: // private members
85: private static KeywordMap javaKeywords;
86: }
|