001: /*
002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
003: * http://www.jaspersoft.com.
004: *
005: * Unless you have purchased a commercial license agreement from JasperSoft,
006: * the following license terms apply:
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License version 2 as published by
010: * the Free Software Foundation.
011: *
012: * This program is distributed WITHOUT ANY WARRANTY; and without the
013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014: * See the GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018: * or write to:
019: *
020: * Free Software Foundation, Inc.,
021: * 59 Temple Place - Suite 330,
022: * Boston, MA USA 02111-1307
023: *
024: *
025: *
026: *
027: * JavaTokenMarker.java
028: *
029: */
030:
031: package org.syntax.jedit.tokenmarker;
032:
033: import org.syntax.jedit.*;
034: import javax.swing.text.Segment;
035:
036: /**
037: * Java token marker.
038: *
039: * @author Slava Pestov
040: * @version $Id: JavaTokenMarker.java 1167 2008-01-15 18:49:05Z gtoffoli $
041: */
042: public class JavaTokenMarker extends CTokenMarker {
043: public JavaTokenMarker() {
044: super (false, getKeywords());
045: }
046:
047: public static KeywordMap getKeywords() {
048: if (javaKeywords == null) {
049: javaKeywords = new KeywordMap(false);
050: javaKeywords.add("package", Token.KEYWORD2);
051: javaKeywords.add("import", Token.KEYWORD2);
052: javaKeywords.add("byte", Token.KEYWORD3);
053: javaKeywords.add("char", Token.KEYWORD3);
054: javaKeywords.add("short", Token.KEYWORD3);
055: javaKeywords.add("int", Token.KEYWORD3);
056: javaKeywords.add("long", Token.KEYWORD3);
057: javaKeywords.add("float", Token.KEYWORD3);
058: javaKeywords.add("double", Token.KEYWORD3);
059: javaKeywords.add("boolean", Token.KEYWORD3);
060: javaKeywords.add("void", Token.KEYWORD3);
061: javaKeywords.add("class", Token.KEYWORD3);
062: javaKeywords.add("interface", Token.KEYWORD3);
063: javaKeywords.add("abstract", Token.KEYWORD1);
064: javaKeywords.add("final", Token.KEYWORD1);
065: javaKeywords.add("private", Token.KEYWORD1);
066: javaKeywords.add("protected", Token.KEYWORD1);
067: javaKeywords.add("public", Token.KEYWORD1);
068: javaKeywords.add("static", Token.KEYWORD1);
069: javaKeywords.add("synchronized", Token.KEYWORD1);
070: javaKeywords.add("native", Token.KEYWORD1);
071: javaKeywords.add("volatile", Token.KEYWORD1);
072: javaKeywords.add("transient", Token.KEYWORD1);
073: javaKeywords.add("break", Token.KEYWORD1);
074: javaKeywords.add("case", Token.KEYWORD1);
075: javaKeywords.add("continue", Token.KEYWORD1);
076: javaKeywords.add("default", Token.KEYWORD1);
077: javaKeywords.add("do", Token.KEYWORD1);
078: javaKeywords.add("else", Token.KEYWORD1);
079: javaKeywords.add("for", Token.KEYWORD1);
080: javaKeywords.add("if", Token.KEYWORD1);
081: javaKeywords.add("instanceof", Token.KEYWORD1);
082: javaKeywords.add("new", Token.KEYWORD1);
083: javaKeywords.add("return", Token.KEYWORD1);
084: javaKeywords.add("switch", Token.KEYWORD1);
085: javaKeywords.add("while", Token.KEYWORD1);
086: javaKeywords.add("throw", Token.KEYWORD1);
087: javaKeywords.add("try", Token.KEYWORD1);
088: javaKeywords.add("catch", Token.KEYWORD1);
089: javaKeywords.add("extends", Token.KEYWORD1);
090: javaKeywords.add("finally", Token.KEYWORD1);
091: javaKeywords.add("implements", Token.KEYWORD1);
092: javaKeywords.add("throws", Token.KEYWORD1);
093: javaKeywords.add("this", Token.LITERAL2);
094: javaKeywords.add("null", Token.LITERAL2);
095: javaKeywords.add("super", Token.LITERAL2);
096: javaKeywords.add("true", Token.LITERAL2);
097: javaKeywords.add("false", Token.LITERAL2);
098: javaKeywords.add("msg", Token.KEYWORD1);
099: javaKeywords.add("str", Token.KEYWORD1);
100: }
101: return javaKeywords;
102: }
103:
104: // private members
105: private static KeywordMap javaKeywords;
106: }
|