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: * CCTokenMarker.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: * C++ token marker.
038: *
039: * @author Slava Pestov
040: * @version $Id: CCTokenMarker.java 1167 2008-01-15 18:49:05Z gtoffoli $
041: */
042: public class CCTokenMarker extends CTokenMarker {
043: public CCTokenMarker() {
044: super (true, getKeywords());
045: }
046:
047: public static KeywordMap getKeywords() {
048: if (ccKeywords == null) {
049: ccKeywords = new KeywordMap(false);
050:
051: ccKeywords.add("and", Token.KEYWORD3);
052: ccKeywords.add("and_eq", Token.KEYWORD3);
053: ccKeywords.add("asm", Token.KEYWORD2); //
054: ccKeywords.add("auto", Token.KEYWORD1); //
055: ccKeywords.add("bitand", Token.KEYWORD3);
056: ccKeywords.add("bitor", Token.KEYWORD3);
057: ccKeywords.add("bool", Token.KEYWORD3);
058: ccKeywords.add("break", Token.KEYWORD1); //
059: ccKeywords.add("case", Token.KEYWORD1); //
060: ccKeywords.add("catch", Token.KEYWORD1);
061: ccKeywords.add("char", Token.KEYWORD3); //
062: ccKeywords.add("class", Token.KEYWORD3);
063: ccKeywords.add("compl", Token.KEYWORD3);
064: ccKeywords.add("const", Token.KEYWORD1); //
065: ccKeywords.add("const_cast", Token.KEYWORD3);
066: ccKeywords.add("continue", Token.KEYWORD1); //
067: ccKeywords.add("default", Token.KEYWORD1); //
068: ccKeywords.add("delete", Token.KEYWORD1);
069: ccKeywords.add("do", Token.KEYWORD1); //
070: ccKeywords.add("double", Token.KEYWORD3); //
071: ccKeywords.add("dynamic_cast", Token.KEYWORD3);
072: ccKeywords.add("else", Token.KEYWORD1); //
073: ccKeywords.add("enum", Token.KEYWORD3); //
074: ccKeywords.add("explicit", Token.KEYWORD1);
075: ccKeywords.add("export", Token.KEYWORD2);
076: ccKeywords.add("extern", Token.KEYWORD2); //
077: ccKeywords.add("false", Token.LITERAL2);
078: ccKeywords.add("float", Token.KEYWORD3); //
079: ccKeywords.add("for", Token.KEYWORD1); //
080: ccKeywords.add("friend", Token.KEYWORD1);
081: ccKeywords.add("goto", Token.KEYWORD1); //
082: ccKeywords.add("if", Token.KEYWORD1); //
083: ccKeywords.add("inline", Token.KEYWORD1);
084: ccKeywords.add("int", Token.KEYWORD3); //
085: ccKeywords.add("long", Token.KEYWORD3); //
086: ccKeywords.add("mutable", Token.KEYWORD3);
087: ccKeywords.add("namespace", Token.KEYWORD2);
088: ccKeywords.add("new", Token.KEYWORD1);
089: ccKeywords.add("not", Token.KEYWORD3);
090: ccKeywords.add("not_eq", Token.KEYWORD3);
091: ccKeywords.add("operator", Token.KEYWORD3);
092: ccKeywords.add("or", Token.KEYWORD3);
093: ccKeywords.add("or_eq", Token.KEYWORD3);
094: ccKeywords.add("private", Token.KEYWORD1);
095: ccKeywords.add("protected", Token.KEYWORD1);
096: ccKeywords.add("public", Token.KEYWORD1);
097: ccKeywords.add("register", Token.KEYWORD1);
098: ccKeywords.add("reinterpret_cast", Token.KEYWORD3);
099: ccKeywords.add("return", Token.KEYWORD1); //
100: ccKeywords.add("short", Token.KEYWORD3); //
101: ccKeywords.add("signed", Token.KEYWORD3); //
102: ccKeywords.add("sizeof", Token.KEYWORD1); //
103: ccKeywords.add("static", Token.KEYWORD1); //
104: ccKeywords.add("static_cast", Token.KEYWORD3);
105: ccKeywords.add("struct", Token.KEYWORD3); //
106: ccKeywords.add("switch", Token.KEYWORD1); //
107: ccKeywords.add("template", Token.KEYWORD3);
108: ccKeywords.add("this", Token.LITERAL2);
109: ccKeywords.add("throw", Token.KEYWORD1);
110: ccKeywords.add("true", Token.LITERAL2);
111: ccKeywords.add("try", Token.KEYWORD1);
112: ccKeywords.add("typedef", Token.KEYWORD3); //
113: ccKeywords.add("typeid", Token.KEYWORD3);
114: ccKeywords.add("typename", Token.KEYWORD3);
115: ccKeywords.add("union", Token.KEYWORD3); //
116: ccKeywords.add("unsigned", Token.KEYWORD3); //
117: ccKeywords.add("using", Token.KEYWORD2);
118: ccKeywords.add("virtual", Token.KEYWORD1);
119: ccKeywords.add("void", Token.KEYWORD1); //
120: ccKeywords.add("volatile", Token.KEYWORD1); //
121: ccKeywords.add("wchar_t", Token.KEYWORD3);
122: ccKeywords.add("while", Token.KEYWORD1); //
123: ccKeywords.add("xor", Token.KEYWORD3);
124: ccKeywords.add("xor_eq", Token.KEYWORD3);
125:
126: // non ANSI keywords
127: ccKeywords.add("NULL", Token.LITERAL2);
128: }
129: return ccKeywords;
130: }
131:
132: // private members
133: private static KeywordMap ccKeywords;
134: }
|