KDevelop API Documentation

editors/qeditor/jsp_colorizer.cpp

Go to the documentation of this file.
00001 /* $Id: jsp_colorizer.cpp,v 1.5 2002/12/19 22:02:39 raggi Exp $ 00002 * 00003 * This file is part of Klint 00004 * Copyright (C) 2001 Roberto Raggi (roberto@kdevelop.org) 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 * Boston, MA 02111-1307, USA. 00020 * 00021 */ 00022 00023 00024 #include "jsp_colorizer.h" 00025 #include "paragdata.h" 00026 00027 #include <qfont.h> 00028 #include <qapplication.h> 00029 #include <qsettings.h> 00030 #include <private/qrichtext_p.h> 00031 00032 static const char *jsp_keywords[] = { 00033 // Java keywords 00034 "abstract", 00035 "break", 00036 "case", 00037 "catch", 00038 "class", 00039 "continue", 00040 "default", 00041 "do", 00042 "else", 00043 "extends", 00044 "false", 00045 "finally", 00046 "for", 00047 "goto", 00048 "if", 00049 "implements", 00050 "import", 00051 "instanceof", 00052 "interface", 00053 "native", 00054 "new", 00055 "null", 00056 "package", 00057 "private", 00058 "protected", 00059 "public", 00060 "return", 00061 "super", 00062 "strictfp", 00063 "switch", 00064 "synchronized", 00065 "this", 00066 "throws", 00067 "throw", 00068 "transient", 00069 "true", 00070 "try", 00071 "volatile", 00072 "while", 00073 "boolean", 00074 "byte", 00075 "char", 00076 "const", 00077 "double", 00078 "final", 00079 "float", 00080 "int", 00081 "long", 00082 "short", 00083 "static", 00084 "void", 00085 0 00086 }; 00087 00088 JspColorizer::JspColorizer( QEditor* editor ) 00089 : QSourceColorizer( editor ) 00090 { 00091 00092 // xml 00093 // default context 00094 HLItemCollection* context0 = new HLItemCollection( 0 ); 00095 context0->appendChild( new StringHLItem( "<!--", Comment, 1 ) ); 00096 context0->appendChild( new StringHLItem( "<%", Comment, 4 ) ); 00097 context0->appendChild( new StringHLItem( "<", Normal, 2 ) ); 00098 context0->appendChild( new RegExpHLItem( "&[\\w|_|!]+;", Constant, 0 ) ); 00099 00100 // comment context 00101 HLItemCollection* context1 = new HLItemCollection( Comment ); 00102 context1->appendChild( new StringHLItem( "-->", Comment, 0 ) ); 00103 00104 HLItemCollection* context2 = new HLItemCollection( Normal ); 00105 context2->appendChild( new StringHLItem( "\"", String, 3 ) ); 00106 context2->appendChild( new RegExpHLItem( "[\\w|_]+", Keyword, 2 ) ); 00107 context2->appendChild( new StringHLItem( ">", Normal, 0 ) ); 00108 00109 HLItemCollection* context3 = new HLItemCollection( String ); 00110 context3->appendChild( new StringHLItem( "\\\"", String, 3 ) ); 00111 context3->appendChild( new StringHLItem( "\"", String, 2 ) ); 00112 00113 // begin java 00114 00115 // default context 00116 HLItemCollection* context4 = new HLItemCollection( Normal ); 00117 context4->appendChild( new StringHLItem( "%>", Comment, 0 ) ); 00118 context4->appendChild( new StartsWithHLItem( "//", Comment, 4 ) ); 00119 context4->appendChild( new StringHLItem( "/*", Comment, 5 ) ); 00120 context4->appendChild( new StringHLItem( "\"", String, 6 ) ); 00121 context4->appendChild( new StringHLItem( "'", String, 7 ) ); 00122 context4->appendChild( new KeywordsHLItem( jsp_keywords, Keyword, Normal, 4 ) ); 00123 context4->appendChild( new NumberHLItem( Constant, 4 ) ); 00124 00125 // comment context 00126 HLItemCollection* context5 = new HLItemCollection( Comment ); 00127 context5->appendChild( new StringHLItem( "*/", Comment, 4 ) ); 00128 00129 HLItemCollection* context6 = new HLItemCollection( String ); 00130 context6->appendChild( new StringHLItem( "\\\\", String, 6 ) ); 00131 context6->appendChild( new StringHLItem( "\\\"", String, 6 ) ); 00132 context6->appendChild( new StringHLItem( "\"", String, 4 ) ); 00133 00134 HLItemCollection* context7 = new HLItemCollection( String ); 00135 context7->appendChild( new StringHLItem( "\\\\", String, 7 ) ); 00136 context7->appendChild( new StringHLItem( "\\'", String, 7 ) ); 00137 context7->appendChild( new StringHLItem( "'", String, 4 ) ); 00138 00139 m_items.append( context0 ); 00140 m_items.append( context1 ); 00141 m_items.append( context2 ); 00142 m_items.append( context3 ); 00143 m_items.append( context4 ); 00144 m_items.append( context5 ); 00145 m_items.append( context6 ); 00146 m_items.append( context7 ); 00147 } 00148 00149 JspColorizer::~JspColorizer() 00150 { 00151 } 00152
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:38 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003