Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
vector<int> is OK, but string or wstring no-work.
blueshake:
--- Code: --- m_Str = m_Tokenizer.GetToken();
if (m_Str==ParserConsts::kw_C)
{
m_Tokenizer.GetToken(); // "eat" {
DoParse(); // time for recursion ;)
}
else
{
// do nothing, just skip keyword "extern", otherwise uncomment:
//SkipToOneOfChars(ParserConsts::semicolon); // skip externs
}
m_Str.Clear();
--- End code ---
it seems I get the reason.
e.g. extern int aa;
when we do this.
--- Code: ---m_Str = m_Tokenizer.GetToken();
--- End code ---
now the m_Str is int.
but here we clear the m_Str again.
--- Code: ---m_Str.Clear();
--- End code ---
so the m_Str is empty.I think this is why the cout can not be parsed correctly.
solution :
comment this statement may work.
--- Code: ---//m_Str.Clear();
--- End code ---
blueshake:
--- Quote from: Loaden on January 17, 2010, 04:32:08 pm ---New bug:
--- Code: ---#include <iostream>
int main()
{
// std::cou // not work!
std::endl // work here.
return 0;
}
--- End code ---
--- End quote ---
patch for it.
--- Code: ---Index: src/plugins/codecompletion/parser/parserthread.cpp
===================================================================
--- src/plugins/codecompletion/parser/parserthread.cpp (revision 6089)
+++ src/plugins/codecompletion/parser/parserthread.cpp (working copy)
@@ -524,7 +524,7 @@
else if (token==ParserConsts::kw_extern)
{
// check for "C"
- m_Str = m_Tokenizer.GetToken();
+ m_Str = m_Tokenizer.PeekToken();
if (m_Str==ParserConsts::kw_C)
{
m_Tokenizer.GetToken(); // "eat" {
--- End code ---
see the screen shot.
[attachment deleted by admin]
MortenMacFly:
--- Quote from: blueshake on January 18, 2010, 09:00:15 am ---patch for it.
--- Code: ---Index: src/plugins/codecompletion/parser/parserthread.cpp
// check for "C"
- m_Str = m_Tokenizer.GetToken();
+ m_Str = m_Tokenizer.PeekToken();
if (m_Str==ParserConsts::kw_C)
{
m_Tokenizer.GetToken(); // "eat" {
--- End code ---
--- End quote ---
Be careful: In that case not the "{" is "eaten" in the case of extern C {...} statements, but the "C". So your patch will work for the extern cout thing, but will break extern C {...}.
This maybe corrected by issuing "m_Tokenizer.GetToken();" twice in the if clause, the fiorst time for "C", the second time for the "{".
blueshake:
hi,morten:
what about this way.
--- Code: ---Index: src/plugins/codecompletion/parser/parserthread.cpp
===================================================================
--- src/plugins/codecompletion/parser/parserthread.cpp (revision 6089)
+++ src/plugins/codecompletion/parser/parserthread.cpp (working copy)
@@ -534,6 +534,7 @@
{
// do nothing, just skip keyword "extern", otherwise uncomment:
//SkipToOneOfChars(ParserConsts::semicolon); // skip externs
+ m_Tokenizer.UngetToken();
}
m_Str.Clear();
}
--- End code ---
Loaden:
--- Quote from: blueshake on January 18, 2010, 09:09:13 am ---hi,morten:
what about this way.
--- Code: ---Index: src/plugins/codecompletion/parser/parserthread.cpp
===================================================================
--- src/plugins/codecompletion/parser/parserthread.cpp (revision 6089)
+++ src/plugins/codecompletion/parser/parserthread.cpp (working copy)
@@ -534,6 +534,7 @@
{
// do nothing, just skip keyword "extern", otherwise uncomment:
//SkipToOneOfChars(ParserConsts::semicolon); // skip externs
+ m_Tokenizer.UngetToken();
}
m_Str.Clear();
}
--- End code ---
--- End quote ---
Work now! :P
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version