KDevelop API Documentation

sql_colorizer.cpp

Go to the documentation of this file.
00001 /*
00002  *  This program is free software; you can redistribute it and/or
00003  *  modify it under the terms of the GNU General Public
00004  *  License as published by the Free Software Foundation; either
00005  *  version 2 of the License, or (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00010  *  General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; see the file COPYING.  If not, write to
00014  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00015  *  Boston, MA 02111-1307, USA.
00016  *
00017  */
00018 
00019 #include "sql_colorizer.h"
00020 
00021 static const char *sql_keywords[] = {
00022   "alter", "analyze", "audit", "comment", "commit", "create",
00023   "delete", "drop", "execute", "explain", "grant", "insert", "lock", "noaudit",
00024   "rename", "revoke", "rollback", "savepoint", "select", "set",
00025   "truncate", "update",
00026 
00027   "boolean", "char", "character", "date", "float", "integer", "long",
00028   "number", "raw", "rowid", "varchar", "varchar2", "varray",
00029 
00030   "false", "null", "true",
00031 
00032   "access", "add", "as", "asc", "begin", "by", "check", "cluster", "column",
00033   "compress", "connect", "current", "cursor", "decimal", "default", "desc",
00034   "else", "elsif", "end", "exception", "exclusive", "file", "for", "from",
00035   "function", "group", "having", "identified", "if", "immediate", "increment",
00036   "index", "initial", "into", "is", "level", "loop", "maxextents", "mode", "modify",
00037   "nocompress", "nowait", "of", "offline", "on", "online", "start",
00038   "successful", "synonym", "table", "then", "to", "trigger", "uid",
00039   "unique", "user", "validate", "values", "view", "whenever",
00040   "where", "with", "option", "order", "pctfree", "privileges", "procedure",
00041   "public", "resource", "return", "row", "rowlabel", "rownum", "rows",
00042   "session", "share", "size", "smallint", "type", "using",
00043 
00044   "not", "and", "or", "in", "any", "some", "all", "between", "exists",
00045   "like", "escape", "union", "intersect", "minus", "prior", "distinct",
00046   "sysdate", "out",
00047 
00048   "left", "right", "outer", "inner", "join",
00049 
00050   0
00051 };
00052 
00053 SqlColorizer::SqlColorizer( QEditor* editor )
00054     : QSourceColorizer( editor )
00055 {
00056     // default context
00057     HLItemCollection* context0 = new HLItemCollection( 0 );
00058     context0->appendChild( new KeywordsHLItem( sql_keywords, Keyword, Normal, 0, true, true ) );
00059     context0->appendChild( new StartsWithHLItem( "--", Comment, 0 ) );
00060     context0->appendChild( new StringHLItem( "'", String, 1 ) );
00061     context0->appendChild( new StringHLItem( "\"", String, 2 ) );
00062 
00063     HLItemCollection* context1 = new HLItemCollection( String );
00064     context1->appendChild( new StringHLItem( "\\\\", String, 1 ) );
00065     context1->appendChild( new StringHLItem( "\\'", String, 1 ) );
00066     context1->appendChild( new StringHLItem( "'", String, 0 ) );
00067 
00068     HLItemCollection* context2 = new HLItemCollection( String );
00069     context2->appendChild( new StringHLItem( "\\\\", String, 2 ) );
00070     context2->appendChild( new StringHLItem( "\\\"", String, 2 ) );
00071     context2->appendChild( new StringHLItem( "\"", String, 0 ) );
00072 
00073     m_items.append( context0 );
00074     m_items.append( context1 );
00075     m_items.append( context2 );
00076 }
00077 
00078 SqlColorizer::~SqlColorizer()
00079 {
00080 }
00081 
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:42 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003