Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katehighlight.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katehighlight.cpp | 126 |
1 files changed, 65 insertions, 61 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 0d2c283..539d356 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp @@ -2,6 +2,6 @@ Copyright (C) 1998, 1999 Jochen Wilhelmy digisnap@cs.tu-berlin.de - (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org> - (C) 2002 Joseph Wenninger <jowenn@kde.org> + (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org> + (C) 2002 Joseph Wenninger <jowenn@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -20,24 +20,28 @@ */ -#include <string.h> - -#include <qtextstream.h> -#include <qpe/config.h> -#include <kglobal.h> -//#include <kinstance.h> -//#include <kmimemagic.h> -#include <klocale.h> -//#include <kregexp.h> -#include <kglobalsettings.h> -#include <kdebug.h> -#include <kstddirs.h> - #include "katehighlight.h" - - #include "katetextline.h" #include "katedocument.h" #include "katesyntaxdocument.h" +#include "kglobal.h" +//#include "kinstance.h" +//#include "kmimemagic.h" +#include "klocale.h" +//#include "kregexp.h" +#include "kglobalsettings.h" +#include "kdebug.h" +#include "kstddirs.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> + +/* QT */ +#include <qtextstream.h> + +/* STD */ +#include <string.h> + HlManager *HlManager::s_pSelf = 0; @@ -121,6 +125,6 @@ const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) { else { - QString tmp=QString(s,str.length()).upper(); - if (tmp==str) return s+str.length(); + QString tmp=QString(s,str.length()).upper(); + if (tmp==str) return s+str.length(); } return 0L; @@ -214,8 +218,8 @@ const QChar *HlInt::checkHgl(const QChar *str, int len, bool) { if (subItems) { - for (HlItem *it=subItems->first();it;it=subItems->next()) + for (HlItem *it=subItems->first();it;it=subItems->next()) { s1=it->checkHgl(s, len, false); - if (s1) return s1; + if (s1) return s1; } } @@ -249,12 +253,12 @@ const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) { else if (!p) return 0L; - else - { + else + { if (subItems) { - for (HlItem *it=subItems->first();it;it=subItems->next()) + for (HlItem *it=subItems->first();it;it=subItems->next()) { s1=it->checkHgl(s, len, false); - if (s1) return s1; + if (s1) return s1; } } @@ -346,5 +350,5 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) { if(pos > -1) return str+rx.matchedLength(); else - return 0L; + return 0L; #else @@ -401,5 +405,5 @@ const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) if (pos==-1) return 0L; else - return (s+Expr->matchedLength()); + return (s+Expr->matchedLength()); }; @@ -412,7 +416,7 @@ const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { if ((s[0].latin1() == '\\') && (len == 1)) - { + { return s + 1; - } + } return 0L; } @@ -622,5 +626,5 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine) if (s2 > s1) { - qDebug("An item has been detected"); + odebug << "An item has been detected" << oendl; textLine->setAttribs(item->attr,s1 - str,s2 - str); ctxNum = item->ctx; @@ -854,5 +858,5 @@ void Highlight::done() void Highlight::createItemData(ItemDataList &list) { - qDebug("Highlight::createItemData"); + odebug << "Highlight::createItemData" << oendl; // If no highlighting is selected we need only one default. @@ -875,5 +879,5 @@ void Highlight::createItemData(ItemDataList &list) syntaxContextData *data; - qDebug("Trying to read itemData section"); + odebug << "Trying to read itemData section" << oendl; //Tell the syntax document class which file we want to parse and which data group @@ -883,5 +887,5 @@ void Highlight::createItemData(ItemDataList &list) while (HlManager::self()->syntax->nextGroup(data)) { - qDebug("Setting up one itemData element"); + odebug << "Setting up one itemData element" << oendl; // read all attributes color=HlManager::self()->syntax->groupData(data,QString("color")); @@ -934,10 +938,10 @@ void Highlight::createItemData(ItemDataList &list) int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl) { - for (int i=0;i<iDl.count();i++) - { - if (iDl.at(i)->name==name) return i; - } - kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl; - return 0; + for (int i=0;i<iDl.count();i++) + { + if (iDl.at(i)->name==name) return i; + } + kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl; + return 0; } @@ -1078,9 +1082,9 @@ void Highlight::readCommentConfig() if (HlManager::self()->syntax->groupData(data,"name")=="singleLine") - cslStart=HlManager::self()->syntax->groupData(data,"start"); - if (HlManager::self()->syntax->groupData(data,"name")=="multiLine") + cslStart=HlManager::self()->syntax->groupData(data,"start"); + if (HlManager::self()->syntax->groupData(data,"name")=="multiLine") { - cmlStart=HlManager::self()->syntax->groupData(data,"start"); - cmlEnd=HlManager::self()->syntax->groupData(data,"end"); + cmlStart=HlManager::self()->syntax->groupData(data,"start"); + cmlEnd=HlManager::self()->syntax->groupData(data,"end"); } } @@ -1113,8 +1117,8 @@ void Highlight::readGlobalKeywordConfig() if (data) { - kdDebug(13010)<<"Found global keyword config"<<endl; + kdDebug(13010)<<"Found global keyword config"<<endl; if (HlManager::self()->syntax->groupItemData(data,QString("casesensitive"))!="0") - casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;} + casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;} //get the weak deliminators weakDeliminator=(!HlManager::self()->syntax->groupItemData(data,QString("weakDeliminator"))); @@ -1134,5 +1138,5 @@ void Highlight::readGlobalKeywordConfig() deliminatorLen = deliminator.length(); - HlManager::self()->syntax->freeGroupInfo(data); + HlManager::self()->syntax->freeGroupInfo(data); } else @@ -1205,23 +1209,23 @@ void Highlight::makeContextList() while (HlManager::self()->syntax->nextItem(data)) { -// kdDebug(13010)<< "In make Contextlist: Item:"<<endl; - c=createHlItem(data,iDl); - if (c) - { +// kdDebug(13010)<< "In make Contextlist: Item:"<<endl; + c=createHlItem(data,iDl); + if (c) + { contextList[i]->items.append(c); // Not supported completely atm and only one level. Subitems.(all have to be matched to at once) - datasub=HlManager::self()->syntax->getSubItems(data); - bool tmpbool; - if (tmpbool=HlManager::self()->syntax->nextItem(datasub)) - { + datasub=HlManager::self()->syntax->getSubItems(data); + bool tmpbool; + if (tmpbool=HlManager::self()->syntax->nextItem(datasub)) + { c->subItems=new QList<HlItem>; - for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub)) + for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub)) c->subItems->append(createHlItem(datasub,iDl)); } - HlManager::self()->syntax->freeGroupInfo(datasub); + HlManager::self()->syntax->freeGroupInfo(datasub); // end of sublevel - } -// kdDebug(13010)<<"Last line in loop"<<endl; + } +// kdDebug(13010)<<"Last line in loop"<<endl; } i++; @@ -1313,5 +1317,5 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { int nAttribs, z; - qDebug("HlManager::makeAttribs"); + odebug << "HlManager::makeAttribs" << oendl; defaultStyleList.setAutoDelete(true); @@ -1322,5 +1326,5 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { nAttribs = itemDataList.count(); for (z = 0; z < nAttribs; z++) { - qDebug("HlManager::makeAttribs: createing one attribute definition"); + odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl; itemData = itemDataList.at(z); if (itemData->defStyle) { @@ -1416,5 +1420,5 @@ void HlManager::setDefaults(ItemStyleList &list) { char s[64]; #warning fixme -/* +/* config = KateFactory::instance()->config(); config->setGroup("Default Item Styles"); |