001: /*
002: * Sun Public License Notice
003: *
004: * The contents of this file are subject to the Sun Public License
005: * Version 1.0 (the "License"). You may not use this file except in
006: * compliance with the License. A copy of the License is available at
007: * http://www.sun.com/
008: *
009: * The Original Code is NetBeans. The Initial Developer of the Original
010: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
011: * Microsystems, Inc. All Rights Reserved.
012: */
013:
014: package org.netbeans.editor.ext.html;
015:
016: import org.netbeans.editor.BaseTokenID;
017: import org.netbeans.editor.TokenContext;
018: import org.netbeans.editor.TokenContextPath;
019:
020: /**
021: * HTML token-context defines token-ids and token-categories used in HTML
022: * language.
023: *
024: * @author Miloslav Metelka
025: * @version 1.00
026: */
027:
028: public class HTMLTokenContext extends TokenContext {
029:
030: // Token categories
031:
032: // Numeric-ids for token-ids
033: public static final int TEXT_ID = 1;
034: public static final int WS_ID = 2;
035: public static final int ERROR_ID = 3;
036: public static final int TAG_ID = 4;
037: public static final int ARGUMENT_ID = 5;
038: public static final int OPERATOR_ID = 6;
039: public static final int VALUE_ID = 7;
040: public static final int BLOCK_COMMENT_ID = 8;
041: public static final int SGML_COMMENT_ID = 9;
042: public static final int DECLARATION_ID = 10;
043: public static final int CHARACTER_ID = 11;
044:
045: public static final int EOL_ID = 12;
046:
047: // Token-ids
048: /** Plain text */
049: public static final BaseTokenID TEXT = new BaseTokenID("text",
050: TEXT_ID);
051: /** Erroneous Text */
052: public static final BaseTokenID WS = new BaseTokenID("ws", WS_ID);
053: /** Plain Text */
054: public static final BaseTokenID ERROR = new BaseTokenID("error",
055: ERROR_ID);
056: /** Html Tag */
057: public static final BaseTokenID TAG = new BaseTokenID("tag", TAG_ID);
058: /** Argument of a tag */
059: public static final BaseTokenID ARGUMENT = new BaseTokenID(
060: "argument", ARGUMENT_ID);
061: /** Operators - '=' between arg and value */
062: public static final BaseTokenID OPERATOR = new BaseTokenID(
063: "operator", OPERATOR_ID);
064: /** Value - value of an argument */
065: public static final BaseTokenID VALUE = new BaseTokenID("value",
066: VALUE_ID);
067: /** Block comment */
068: public static final BaseTokenID BLOCK_COMMENT = new BaseTokenID(
069: "block-comment", BLOCK_COMMENT_ID);
070: /** SGML comment - e.g. in DOCTYPE */
071: public static final BaseTokenID SGML_COMMENT = new BaseTokenID(
072: "sgml-comment", SGML_COMMENT_ID);
073: /** SGML declaration in HTML document - e.g. <!DOCTYPE> */
074: public static final BaseTokenID DECLARATION = new BaseTokenID(
075: "sgml-declaration", DECLARATION_ID);
076: /** Character reference, e.g. &lt; = < */
077: public static final BaseTokenID CHARACTER = new BaseTokenID(
078: "character", CHARACTER_ID);
079:
080: /** End of line */
081: public static final BaseTokenID EOL = new BaseTokenID("EOL", EOL_ID);
082:
083: // Context instance declaration
084: public static final HTMLTokenContext context = new HTMLTokenContext();
085:
086: public static final TokenContextPath contextPath = context
087: .getContextPath();
088:
089: private HTMLTokenContext() {
090: super ("html-");
091:
092: try {
093: addDeclaredTokenIDs();
094: } catch (Exception e) {
095: if (Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N
096: e.printStackTrace();
097: }
098: }
099:
100: }
101:
102: }
|