KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jedit > syntax > JavaTokenMarker


1 package org.jedit.syntax;
2
3 /*
4  * JavaTokenMarker.java - Java token marker
5  * Copyright (C) 1999 Slava Pestov
6  *
7  * You may use and modify this package for any purpose. Redistribution is
8  * permitted, in both source and binary form, provided that this notice
9  * remains intact in all source distributions of this package.
10  */

11
12 import javax.swing.text.Segment JavaDoc;
13
14 /**
15  * Java token marker.
16  *
17  * @author Slava Pestov
18  * @version $Id: JavaTokenMarker.java,v 1.1 2003/12/14 16:29:49 daggerrz Exp $
19  */

20 public class JavaTokenMarker extends CTokenMarker
21 {
22    public JavaTokenMarker()
23    {
24       super(false,getKeywords());
25    }
26
27    public static KeywordMap getKeywords()
28    {
29       if(javaKeywords == null)
30       {
31          javaKeywords = new KeywordMap(false);
32          javaKeywords.add("package",Token.KEYWORD2);
33          javaKeywords.add("import",Token.KEYWORD2);
34          javaKeywords.add("byte",Token.KEYWORD3);
35          javaKeywords.add("char",Token.KEYWORD3);
36          javaKeywords.add("short",Token.KEYWORD3);
37          javaKeywords.add("int",Token.KEYWORD3);
38          javaKeywords.add("long",Token.KEYWORD3);
39          javaKeywords.add("float",Token.KEYWORD3);
40          javaKeywords.add("double",Token.KEYWORD3);
41          javaKeywords.add("boolean",Token.KEYWORD3);
42          javaKeywords.add("void",Token.KEYWORD3);
43          javaKeywords.add("class",Token.KEYWORD3);
44          javaKeywords.add("interface",Token.KEYWORD3);
45          javaKeywords.add("abstract",Token.KEYWORD1);
46          javaKeywords.add("final",Token.KEYWORD1);
47          javaKeywords.add("private",Token.KEYWORD1);
48          javaKeywords.add("protected",Token.KEYWORD1);
49          javaKeywords.add("public",Token.KEYWORD1);
50          javaKeywords.add("static",Token.KEYWORD1);
51          javaKeywords.add("synchronized",Token.KEYWORD1);
52          javaKeywords.add("native",Token.KEYWORD1);
53          javaKeywords.add("volatile",Token.KEYWORD1);
54          javaKeywords.add("transient",Token.KEYWORD1);
55          javaKeywords.add("break",Token.KEYWORD1);
56          javaKeywords.add("case",Token.KEYWORD1);
57          javaKeywords.add("continue",Token.KEYWORD1);
58          javaKeywords.add("default",Token.KEYWORD1);
59          javaKeywords.add("do",Token.KEYWORD1);
60          javaKeywords.add("else",Token.KEYWORD1);
61          javaKeywords.add("for",Token.KEYWORD1);
62          javaKeywords.add("if",Token.KEYWORD1);
63          javaKeywords.add("instanceof",Token.KEYWORD1);
64          javaKeywords.add("new",Token.KEYWORD1);
65          javaKeywords.add("return",Token.KEYWORD1);
66          javaKeywords.add("switch",Token.KEYWORD1);
67          javaKeywords.add("while",Token.KEYWORD1);
68          javaKeywords.add("throw",Token.KEYWORD1);
69          javaKeywords.add("try",Token.KEYWORD1);
70          javaKeywords.add("catch",Token.KEYWORD1);
71          javaKeywords.add("extends",Token.KEYWORD1);
72          javaKeywords.add("finally",Token.KEYWORD1);
73          javaKeywords.add("implements",Token.KEYWORD1);
74          javaKeywords.add("throws",Token.KEYWORD1);
75          javaKeywords.add("this",Token.LITERAL2);
76          javaKeywords.add("null",Token.LITERAL2);
77          javaKeywords.add("super",Token.LITERAL2);
78          javaKeywords.add("true",Token.LITERAL2);
79          javaKeywords.add("false",Token.LITERAL2);
80       }
81       return javaKeywords;
82    }
83
84    // private members
85
private static KeywordMap javaKeywords;
86 }
87
Popular Tags