001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.web.core.syntax.deprecated;
043:
044: import java.util.logging.Level;
045: import java.util.logging.Logger;
046: import org.netbeans.editor.TokenCategory;
047: import org.netbeans.editor.TokenContext;
048: import org.netbeans.editor.TokenContextPath;
049: import org.netbeans.editor.BaseTokenID;
050:
051: /**
052: * Syntax class for JSP tags. It is not meant to be used by itself, but as one of syntaxes with
053: * MultiSyntax. Recognizes JSP tags, comments and directives. Does not recognize scriptlets,
054: * expressions and declarations, which should be rocognized by the master syntax, as expressions
055: * can appear embedded in a JSP tag. Moreover, they all share Java syntax.
056: *
057: * @author Petr Jiricka
058: * @deprecated Use JSP Lexer instead
059: */
060:
061: public class JspTagTokenContext extends TokenContext {
062:
063: //there is not any token category for jsp tags
064: //TODO - consider whether there is a need to create a category for jsp tags
065: public static final TokenCategory tokenCategory = null;
066:
067: // Numeric-ids
068: public static final int TEXT_ID = 1;
069: public static final int ERROR_ID = 2;
070: public static final int TAG_ID = 3;
071: public static final int SYMBOL_ID = 4;
072: public static final int SYMBOL2_ID = 5;
073: public static final int COMMENT_ID = 6;
074: public static final int ATTRIBUTE_ID = 7;
075: public static final int ATTR_VALUE_ID = 8;
076: public static final int EOL_ID = 9;
077: public static final int AFTER_UNEXPECTED_LT_ID = 10;
078: public static final int WHITESPACE_ID = 11;
079:
080: // TokenIDs
081: public static final BaseTokenID TEXT = new BaseTokenID("text",
082: TEXT_ID, tokenCategory); // NOI18N
083: public static final BaseTokenID ERROR = new BaseTokenID("error",
084: ERROR_ID, tokenCategory); // NOI18N
085: public static final BaseTokenID TAG = new BaseTokenID(
086: "tag-directive", TAG_ID, tokenCategory); // NOI18N
087: public static final BaseTokenID SYMBOL = new BaseTokenID("symbol",
088: SYMBOL_ID, tokenCategory); // NOI18N
089: public static final BaseTokenID SYMBOL2 = new BaseTokenID(
090: "scriptlet-delimiter", SYMBOL2_ID, tokenCategory); // NOI18N
091: public static final BaseTokenID COMMENT = new BaseTokenID(
092: "comment", COMMENT_ID, tokenCategory); // NOI18N
093: public static final BaseTokenID ATTRIBUTE = new BaseTokenID(
094: "attribute-name", ATTRIBUTE_ID, tokenCategory); // NOI18N
095: public static final BaseTokenID ATTR_VALUE = new BaseTokenID(
096: "attribute-value", ATTR_VALUE_ID, tokenCategory); // NOI18N
097: public static final BaseTokenID EOL = new BaseTokenID("EOL",
098: EOL_ID, tokenCategory); // NOI18N
099: public static final BaseTokenID AFTER_UNEXPECTED_LT = new BaseTokenID(
100: "AFTER_UNEXPECTED_LT", AFTER_UNEXPECTED_LT_ID,
101: tokenCategory); // NOI18N
102: public static final BaseTokenID WHITESPACE = new BaseTokenID(
103: "whitespace", WHITESPACE_ID, tokenCategory); // NOI18N
104:
105: // Context instance declaration
106: public static final JspTagTokenContext context = new JspTagTokenContext();
107:
108: public static final TokenContextPath contextPath = context
109: .getContextPath();
110:
111: JspTagTokenContext() {
112: super ("jsptag-"); // NOI18N
113:
114: try {
115: addDeclaredTokenIDs();
116: } catch (Exception e) {
117: Logger.getLogger("global").log(Level.INFO, null, e);
118: }
119:
120: }
121:
122: }
|