Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
vector<int> is OK, but string or wstring no-work.
ollydbg:
--- Code: --- if (token == ParserConsts::kw_template)
{
// There are some template defintions that are not working like
// within gcc headers (NB: This syntax is a GNU extension):
// extern template
// const codecvt<char, char, mbstate_t>&
// use_facet<codecvt<char, char, mbstate_t> >(const locale&);
m_Tokenizer.SetState(tsTemplateArgument);
wxString args = m_Tokenizer.GetToken();
token = m_Tokenizer.GetToken();
TRACE(_T("DoParse() : Template argument='%s', token ='%s'"), args.wx_str(), token.wx_str());
if (token==ParserConsts::kw_class)
{
m_Str.Clear();
if (m_Options.handleClasses)
HandleClass(ctClass, args);
else
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
}
else if (token==ParserConsts::kw_struct)
{
m_Str.Clear();
if (m_Options.handleClasses)
HandleClass(ctStructure, args);
else
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
}
else
{
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
}
}
--- End code ---
We should rethink the code above, for example, there are some template declaration like below:
--- Code: ---template<typename _CharT, typename _Traits, typename _Alloc>
inline bool
operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
{ return __lhs.compare(__rhs) <= 0; }
--- End code ---
at this time, the "token string" behind the template argument is not "class" nor "struct", but a general function declaration. So, I think we should use a variable like "template argument" to specify the current context".
For example:
When the parser eat these strings "template<typename _CharT, typename _Traits, typename _Alloc>", we can set the variable "template argument", then we continue our DoParse Loop. next we add a Token, we should attach this "template argument" context to the Token. So, This variable is just like other variables like: m_Str( store the type information) or m_EncounteredTypeNamespaces (store the namespace in data types).
Any way, checking the next token after the template argument is not a correct way.
MortenMacFly:
--- Quote from: ollydbg on January 11, 2010, 04:17:58 pm ---Any way, checking the next token after the template argument is not a correct way.
--- End quote ---
True, but I still wonder why it works with vector and alike and why with any revision before applying your and blueshake's patch it used to work. There must be another error.
Loaden:
Will it be to replace the rules of the problem? This is CodeLite replacement rules:
--- Code: ---EXPORT
WXDLLIMPEXP_CORE
WXDLLIMPEXP_BASE
WXDLLIMPEXP_XML
WXDLLIMPEXP_XRC
WXDLLIMPEXP_ADV
WXDLLIMPEXP_AUI
WXDLLIMPEXP_CL
WXDLLIMPEXP_LE_SDK
WXDLLIMPEXP_SQLITE3
WXMAKINGDLL
WXUSINGDLL
_CRTIMP
__CRT_INLINE
__cdecl
__stdcall
WXDLLEXPORT
WXDLLIMPORT
wxT
wxTopLevelWindowNative=wxTopLevelWindowMSW
wxWindow=wxWindowMSW
wxStatusBar=wxStatusBarBase
WXUNUSED
wxDEPRECATED
_T
ATTRIBUTE_PRINTF_1
ATTRIBUTE_PRINTF_2
WXDLLIMPEXP_FWD_BASE
WXDLLIMPEXP_FWD_CORE
DLLIMPORT
DECLARE_INSTANCE_TYPE
emit
Q_OBJECT
Q_PACKED
Q_GADGET
QT_BEGIN_HEADER
QT_END_HEADER
Q_REQUIRED_RESULT
Q_INLINE_TEMPLATE
Q_OUTOFLINE_TEMPLATE
_GLIBCXX_BEGIN_NAMESPACE(std)=namespace std{
_GLIBCXX_END_NAMESPACE=}
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)=namespace std{
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)=namespace std{
_GLIBCXX_END_NESTED_NAMESPACE=}
_GLIBCXX_STD=std
WXDLLIMPEXP_SCI
__const=const
__restrict
__THROW
__wur
_STD_BEGIN=namespace std{
_STD_END=}
__CLRCALL_OR_CDECL
_CRTIMP2_PURE
--- End code ---
Among them, through the following replacement rules, can support VC9 header file parsing:
--- Code: ---_STD_BEGIN=namespace std{
_STD_END=}
__CLRCALL_OR_CDECL
--- End code ---
blueshake:
hi,guys:
see what the template handle do,
--- Code: --- if (token == ParserConsts::kw_template)
{
m_Tokenizer.SetState(tsTemplateArgument);
wxString args = m_Tokenizer.GetToken();
token = m_Tokenizer.GetToken();
TRACE(_T("DoParse() : template argument='%s', token ='%s'"), args.wx_str(), token.wx_str());
if (token==ParserConsts::kw_class)
{
m_Str.Clear();
if (m_Options.handleClasses)
HandleClass(ctClass,args);
else
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
}
else if (token==ParserConsts::kw_struct)
{
m_Str.Clear();
if (m_Options.handleClasses)
HandleClass(ctStructure,args);
else
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
}
else
{
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
}
}
--- End code ---
just as ollydbg said,when the the next token is not class or struct,the parser will skip to }/;,I think it is wrong here.
ollydbg:
@blueshake:
Yes, the code is added by me.
--- Code: --- else
{
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
}
--- End code ---
I nearly forget what's in the visualfc's patch, he use a different logic. So, I will check it.
@macfly
I will exam it, it seems the code before is not correct either, but it do show some code completion list.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version