KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > text > syntax > XMLTokenContext


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.text.syntax;
20
21 import org.netbeans.editor.BaseTokenCategory;
22 import org.netbeans.editor.BaseTokenID;
23 import org.netbeans.editor.TokenContext;
24 import org.netbeans.editor.TokenContextPath;
25
26 import org.netbeans.modules.xml.text.syntax.javacc.lib.*;
27
28 /**
29  * Token-ids and token-categories for XML
30  *
31  * @author Miloslav Metelka
32  * @author Petr Kuzel
33  * @version 1.0
34  */

35
36 public class XMLTokenContext extends TokenContext {
37
38     public static final int ATT_ID = 1;
39     public static final int CDATA_ID = 2;
40     public static final int COMMENT_ID = 3;
41     public static final int EOL_ID = 4;
42     public static final int ERROR_ID = 5;
43     public static final int KW_ID = 6;
44     public static final int PLAIN_ID = 7;
45     public static final int REF_ID = 8;
46     public static final int STRING_ID = 9;
47     public static final int SYMBOL_ID = 10;
48     public static final int TAG_ID = 11;
49     public static final int TARGET_ID = 12;
50     public static final int CDATA_MARKUP_ID = 13;
51
52
53
54     // <home attname="..."> // NOI18N
55
public static final JJTokenID ATT = new JJTokenID("attribute", ATT_ID); // NOI18N
56
// <![CDATA[ dtatasection ]]>
57
public static final JJTokenID CDATA = new JJTokenID("cdata", CDATA_ID); // NOI18N
58

59     public static final JJTokenID COMMENT = new JJTokenID("comment", COMMENT_ID); // NOI18N
60
public static final JJTokenID EOL = new JJTokenID("EOL", EOL_ID); // NOI18N
61
public static final JJTokenID ERROR = new JJTokenID("error", ERROR_ID, true); // NOI18N
62

63     // <!declatarion + "SYSTEM"/"PUBLIC" // NOI18N
64
public static final JJTokenID KW = new JJTokenID("keyword", KW_ID); // NOI18N
65
public static final JJTokenID PLAIN = new JJTokenID("plain", PLAIN_ID); // NOI18N
66
// &aref; &#x000;
67
public static final JJTokenID REF = new JJTokenID("ref", REF_ID); // NOI18N
68
// <home id="attrvalue" > // NOI18N
69
public static final JJTokenID STRING = new JJTokenID("string", STRING_ID); // NOI18N
70
// <>!
71
public static final JJTokenID SYMBOL = new JJTokenID("symbol", SYMBOL_ID); // NOI18N
72
// <atagname ....>
73
public static final JJTokenID TAG = new JJTokenID("tag", TAG_ID); // NOI18N
74
// <? target ...>
75
public static final JJTokenID TARGET = new JJTokenID("target", TARGET_ID); // NOI18N
76

77     public static final JJTokenID CDATA_MARKUP = new JJTokenID("markup-in-CDATA", CDATA_MARKUP_ID); // NOI18N
78

79     // Context instance declaration
80
public static final XMLTokenContext context = new XMLTokenContext();
81
82     public static final TokenContextPath contextPath = context.getContextPath();
83
84
85     protected XMLTokenContext() {
86         super("xml-"); // NOI18N
87

88         try {
89             addDeclaredTokenIDs();
90         } catch (Exception JavaDoc e) {
91             if (Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N
92
e.printStackTrace();
93             }
94         }
95
96     }
97
98 }
99
Popular Tags