Fixed recognition of C++ files in kate/cppsymbolviewer plugin. This resolves bug 2498. Also fixed building warnings.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 9 years ago
parent 5e63e8ee96
commit 4d976d10e8

@ -23,9 +23,9 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
TQString cl; // Current Line TQString cl; // Current Line
TQString stripped; TQString stripped;
uint i, j, tmpPos = 0; uint i, j, tmpPos = 0;
int par = 0, graph = 0, retry = 0; int par = 0, graph = 0;
char mclass = 0, block = 0, comment = 0; // comment: 0-no comment 1-inline comment 2-multiline comment 3-string char mclass = 0, block = 0, comment = 0; // comment: 0-no comment 1-inline comment 2-multiline comment 3-string
char macro = 0, macro_pos = 0, func_close = 0; char macro = 0, func_close = 0;
bool structure = false; bool structure = false;
TQPixmap cls( ( const char** ) class_xpm ); TQPixmap cls( ( const char** ) class_xpm );
TQPixmap sct( ( const char** ) struct_xpm ); TQPixmap sct( ( const char** ) struct_xpm );
@ -76,7 +76,6 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
/* *********************** MACRO PARSING *****************************/ /* *********************** MACRO PARSING *****************************/
if(macro == 1) if(macro == 1)
{ {
//macro_pos = cl.find("#");
for (j = 0; j < cl.length(); j++) for (j = 0; j < cl.length(); j++)
{ {
if(cl.at(j)=='/' && cl.at(j+1)=='/') { macro = 4; break; } if(cl.at(j)=='/' && cl.at(j+1)=='/') { macro = 4; break; }
@ -113,7 +112,6 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
node->setText(1, TQString::number( i, 10)); node->setText(1, TQString::number( i, 10));
} }
macro = 0; macro = 0;
macro_pos = 0;
stripped = ""; stripped = "";
//kdDebug(13000)<<"Macro -- Inserted : "<<stripped<<" at row : "<<i<<endl; //kdDebug(13000)<<"Macro -- Inserted : "<<stripped<<" at row : "<<i<<endl;
if (cl.at(cl.length() - 1) == '\\') macro = 5; // continue in rows below if (cl.at(cl.length() - 1) == '\\') macro = 5; // continue in rows below
@ -158,7 +156,7 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
} }
if (mclass == 3) if (mclass == 3)
{ {
if (cl.find('{') >= 0) if (cl.find('{') >= 0)
{ {
cl = cl.right(cl.find('{')); cl = cl.right(cl.find('{'));
mclass = 4; mclass = 4;
@ -216,8 +214,8 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
break; break;
} }
if(cl.at(j)=='{' && structure == false && cl.find(";") < 0 || if((cl.at(j)=='{' && structure == false && cl.find(";") < 0) ||
cl.at(j)=='{' && structure == false && cl.find('}') > (int)j) (cl.at(j)=='{' && structure == false && cl.find('}') > (int)j))
{ {
stripped.replace(0x9, " "); stripped.replace(0x9, " ");
if(func_on == true) if(func_on == true)
@ -240,7 +238,7 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
node = new TQListViewItem(mtdNode, lastMtdNode, stripped); node = new TQListViewItem(mtdNode, lastMtdNode, stripped);
lastMtdNode = node; lastMtdNode = node;
} }
else else
{ {
node = new TQListViewItem(clsNode, lastClsNode, stripped); node = new TQListViewItem(clsNode, lastClsNode, stripped);
lastClsNode = node; lastClsNode = node;
@ -253,7 +251,6 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
node->setText(1, TQString::number( tmpPos, 10)); node->setText(1, TQString::number( tmpPos, 10));
} }
stripped = ""; stripped = "";
retry = 0;
block = 3; block = 3;
} }
if(cl.at(j)=='{' && structure == true) if(cl.at(j)=='{' && structure == true)
@ -263,7 +260,6 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
} }
if(cl.at(j)=='(' && structure == true) if(cl.at(j)=='(' && structure == true)
{ {
retry = 1;
block = 0; block = 0;
j = 0; j = 0;
//kdDebug(13000)<<"Restart from the beginning of line..."<<endl; //kdDebug(13000)<<"Restart from the beginning of line..."<<endl;
@ -319,7 +315,7 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
} // BLOCK > 0 } // BLOCK > 0
if (mclass == 4 && block == 0 && func_close == 0) if (mclass == 4 && block == 0 && func_close == 0)
{ {
if (cl.find('}') >= 0) if (cl.find('}') >= 0)
{ {
cl = cl.right(cl.find('}')); cl = cl.right(cl.find('}'));
mclass = 0; mclass = 0;

@ -219,7 +219,7 @@ void KatePluginSymbolViewerView::parseSymbols(void)
//TQListViewItem mcrNode = new TQListViewItem(symbols, symbols->lastItem(), hlModeName); //TQListViewItem mcrNode = new TQListViewItem(symbols, symbols->lastItem(), hlModeName);
if (hlModeName == "C++" || hlModeName == "C") if (hlModeName == "C" || hlModeName == "ISO C++" || hlModeName.find("C++")==0)
parseCppSymbols(); parseCppSymbols();
else if (hlModeName == "Tcl/Tk") else if (hlModeName == "Tcl/Tk")
parseTclSymbols(); parseTclSymbols();

Loading…
Cancel
Save