KDevelop API Documentation

editors/qeditor/pascal_colorizer.cpp

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2003 Alexander Dymo * 00003 * cloudtemple@mksat.net * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 ***************************************************************************/ 00011 #include "pascal_colorizer.h" 00012 #include "qeditor.h" 00013 #include "paragdata.h" 00014 00015 #include <qfont.h> 00016 #include <qapplication.h> 00017 #include <qsettings.h> 00018 #include <private/qrichtext_p.h> 00019 00020 static const char *pascal_keywords[] = { 00021 // Pascal keywords taken from Free Pascal 1.0.6 reference manual 00022 "absolute", 00023 "and", 00024 "array", 00025 "asm", 00026 "begin", 00027 "break", 00028 "case", 00029 "const", 00030 "constructor", 00031 "continue", 00032 "destructor", 00033 "div", 00034 "do", 00035 "downto", 00036 "else", 00037 "end", 00038 "file", 00039 "for", 00040 "function", 00041 "goto", 00042 "if", 00043 "implementation", 00044 "in", 00045 "inherited", 00046 "inline", 00047 "interface", 00048 "label", 00049 "mod", 00050 "nil", 00051 "not", 00052 "object", 00053 "of", 00054 "on", 00055 "operator", 00056 "or", 00057 "packed", 00058 "procedure", 00059 "program", 00060 "record", 00061 "repeat", 00062 "self", 00063 "set", 00064 "shl", 00065 "shr", 00066 "string", 00067 "then", 00068 "to", 00069 "type", 00070 "unit", 00071 "until", 00072 "uses", 00073 "var", 00074 "while", 00075 "with", 00076 "xor", 00077 "as", 00078 "class", 00079 "except", 00080 "exports", 00081 "finalization", 00082 "finally", 00083 "initialization", 00084 "is", 00085 "library", 00086 "on", 00087 "property", 00088 "raise", 00089 "try", 00090 "dispose", 00091 "exit", 00092 "false", 00093 "new", 00094 "true", 00095 "absolute", 00096 "abstract", 00097 "alias", 00098 "assembler", 00099 "cdecl", 00100 "default", 00101 "export", 00102 "external", 00103 "far", 00104 "forward", 00105 "index", 00106 "name", 00107 "near", 00108 "override", 00109 "pascal", 00110 "popstack", 00111 "private", 00112 "protected", 00113 "public", 00114 "published", 00115 "read", 00116 "register", 00117 "saveregisters", 00118 "stdcall", 00119 "virtual", 00120 "write", 00121 0 00122 }; 00123 00124 PascalColorizer::PascalColorizer( QEditor * editor) 00125 : QSourceColorizer( editor ) 00126 { 00127 //default context 00128 HLItemCollection* context0 = new HLItemCollection( 0 ); 00129 context0->appendChild( new StartsWithHLItem( "//", Comment, 0 ) ); 00130 context0->appendChild( new StringHLItem( "{", Comment, 1 ) ); 00131 context0->appendChild( new StringHLItem( "(*", Comment, 2 ) ); 00132 context0->appendChild( new KeywordsHLItem( pascal_keywords, Keyword, Normal, 0 ) ); 00133 context0->appendChild( new WhiteSpacesHLItem( Normal, 0 ) ); 00134 context0->appendChild( new StringHLItem( "'", String, 3 ) ); 00135 context0->appendChild( new NumberHLItem( Constant, 0 ) ); 00136 context0->appendChild( new RegExpHLItem( "\\$[A-Fa-f0-9]*", Constant, 0 ) ); 00137 context0->appendChild( new RegExpHLItem( "\\%[0-1]*", Constant, 0 ) ); 00138 00139 HLItemCollection* context1 = new HLItemCollection( Comment ); 00140 context1->appendChild( new StringHLItem( "}", Comment, 0 ) ); 00141 00142 HLItemCollection* context2 = new HLItemCollection( Comment ); 00143 context2->appendChild( new StringHLItem( "*)", Comment, 0 ) ); 00144 00145 HLItemCollection* context3 = new HLItemCollection( String ); 00146 context3->appendChild( new StringHLItem( "'", String, 0 ) ); 00147 00148 m_items.append( context0 ); 00149 m_items.append( context1 ); 00150 m_items.append( context2 ); 00151 m_items.append( context3 ); 00152 } 00153 00154 PascalColorizer::~PascalColorizer( ) 00155 { 00156 }
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