Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

vector<int> is OK, but string or wstring no-work.

<< < (6/23) > >>

MortenMacFly:

--- Quote from: ollydbg on January 11, 2010, 08:41:02 am ---Ok, have a further test, [...]

--- End quote ---
Just for the record: I've implemented some more debugging facilities with the last commit of mine. You can now save the tokens tree to an ASCii file from  the CC debug window.

ollydbg:

--- Quote from: MortenMacFly on January 11, 2010, 08:49:24 am ---
--- Quote from: ollydbg on January 11, 2010, 08:41:02 am ---Ok, have a further test, [...]

--- End quote ---
Just for the record: I've implemented some more debugging facilities with the last commit of mine. You can now save the tokens tree to an ASCii file from  the CC debug window.

--- End quote ---

Yes, I have noticed that, it is a great improvement!

MortenMacFly:

--- Quote from: ollydbg on January 11, 2010, 08:41:02 am ---Ok, have a further test, I'm fully agree with blueshake's No ancestor's in the current string Token, so, the "string" have no ancestors, that's the reason why we don't have string members list auto completion.

--- End quote ---
I wonder if the modification you did in void ParserThread::ReadClsNames(wxString& ancestor) are 100% correct. NOtice this code snippet:
Before:

--- Code: ---        else if (   wxIsalpha(current.GetChar(0))
                 && (   (m_Tokenizer.PeekToken() == ParserConsts::semicolon)
                     || (m_Tokenizer.PeekToken() == ParserConsts::comma)) )
        {
            TRACE(_T("ReadClsNames() : Adding variable '%s' as '%s' to '%s'"),
                  current.wx_str(),
                  m_Str.wx_str(),
                  (m_pLastParent ? m_pLastParent->m_Name.wx_str():_T("<no-parent>")));

            Token* newToken = DoAddToken(tkTypedef, current, m_Tokenizer.GetLineNumber());
            if (!newToken)
                break;
            else
            {
                wxString tempAncestor       = ancestor;
                newToken->m_AncestorsString = tempAncestor;
                newToken->m_ActualType      = tempAncestor;
                newToken->m_Type            = tempAncestor;
            }
        }

--- End code ---
After:

--- Code: ---        else if (   wxIsalpha(current.GetChar(0))
                 && (   (m_Tokenizer.PeekToken() == ParserConsts::semicolon)
                     || (m_Tokenizer.PeekToken() == ParserConsts::comma)) )
        {
            TRACE(_T("ReadClsNames() : Adding variable '%s' as '%s' to '%s'"),
                  current.wx_str(),
                  m_Str.wx_str(),
                  (m_pLastParent ? m_pLastParent->m_Name.wx_str():_T("<no-parent>")));

            m_Str.clear();
            wxString tempAncestor = ancestor;
            m_Str = tempAncestor;
            Token* newToken = DoAddToken(tkTypedef, current, m_Tokenizer.GetLineNumber());
            if (!newToken)
                break;
            else
            {
                newToken->m_AncestorsString = tempAncestor;
                //newToken->m_ActualType      = tempAncestor;
                //if (m_IsPointer)
                //{
                //    newToken->m_Type = tempAncestor + _T("*");
                //}
                //else
                //newToken->m_Type            = tempAncestor;
            }
        }

--- End code ---
You are not setting the m_Type etc. This is commented out. Is this intended (and if so: Why)?

ollydbg:
I just do a test, that, I create a simple cpp file from basci_string.

It seems the parserThread failed in parsing these statement:


--- Code: ---  template<typename _CharT, typename _Traits, typename _Alloc>
    inline basic_string<_CharT, _Traits, _Alloc>::
    basic_string()
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
    : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
#else
    : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()) { }
#endif

  // operator+
  /**
   *  @brief  Concatenate two strings.
   *  @param lhs  First string.
   *  @param rhs  Last string.
   *  @return  New string with value of @a lhs followed by @a rhs.
   */
  template<typename _CharT, typename _Traits, typename _Alloc>
    basic_string<_CharT, _Traits, _Alloc>
    operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     const basic_string<_CharT, _Traits, _Alloc>& __rhs)
    {
      basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
      __str.append(__rhs);
      return __str;
    }

--- End code ---

because when I read the TRACE Debug output, these code were failed.
You can just copy the testString.txt(see the attachment of this post)'s content to a empty project, and set the
#define PARSERTHREAD_DEBUG_OUTPUT 1

Then view the debug log output.

Note: the testString.txt is just a modified source from STL header file of basic_string.

ollydbg:
You can see the last sentence of the debug log.

--- Code: ---DoAddToken() : Found token (parent).
DoAddToken() : Created token='compare', file_idx=1, line=2016
GetActualTokenType() : Searching within m_Str='int'
GetActualTokenType() : Compensated m_Str='int'
GetActualTokenType() : Found 'int'
DoAddToken() : Prepending ''
DoAddToken() : Added/updated token 'compare' (172), type 'int', actual 'int'. Parent is basic_string (1)
DoParse() : Loop:m_Str='', token=';'
DoParse() : Loop:m_Str='', token='int'
DoParse() : Loop:m_Str='int ', token='compare'
HandleFunction() : Adding function 'compare': m_Str='int '
HandleFunction() : name='compare', args='(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)', peek='const'
HandleFunction() : !(Ctor/Dtor) 'compare', m_Str='int ', localParent='<none>'
HandleFunction() : Adding function 'compare', ': m_Str='int ', enc_ns='nil'.
HandleFunction() : Add token name='compare', args='(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)', return type='int '
GetStrippedArgs() : args='(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)'.
GetStrippedArgs() : stripped_args='(size_type,size_type,const _CharT*,size_type)'.
DoAddToken() : Found token (parent).
DoAddToken() : Created token='compare', file_idx=1, line=2042
GetActualTokenType() : Searching within m_Str='int'
GetActualTokenType() : Compensated m_Str='int'
GetActualTokenType() : Found 'int'
DoAddToken() : Prepending ''
DoAddToken() : Added/updated token 'compare' (173), type 'int', actual 'int'. Parent is basic_string (1)
DoParse() : Loop:m_Str='', token=';'
DoParse() : Loop:m_Str='', token='}'
DoParse() : Loop:m_Str='', token='template'
DoParse() : template argument='<typename _CharT, typename _Traits, typename _Alloc>', token ='inline'
DoParse() : Loop:m_Str='', token='#'
HandlePreprocessorBlocks() : Saving nesting level: 1
HandlePreprocessorBlocks() : Restoring nesting level: 1 (was 1)
DoParse() : Loop:m_Str='', token='template'
DoParse() : template argument='<typename _CharT, typename _Traits, typename _Alloc>', token ='basic_string'
DoParse() : Loop:m_Str='', token='template'
DoParse() : template argument='<typename _CharT, typename _Traits, typename _Alloc>', token ='basic_string'
DoParse() : Loop:m_Str='', token='template'
DoParse() : template argument='<typename _CharT, typename _Traits, typename _Alloc>', token ='basic_string'
DoParse() : Loop:m_Str='', token='template'
DoParse() : template argument='<typename _CharT, typename _Traits, typename _Alloc>', token ='inline'
DoParse() : Loop:m_Str='', token='template'
DoParse() : template argument='<typename _CharT, typename _Traits, typename _Alloc>', token ='inline'
DoParse() : Loop:m_Str='', token='template'
DoParse() : template argument='<typename _CharT, typename _Traits, typename _Alloc>', token ='inline'
DoParse() : Loop:m_Str='', token='}'
DoParse() : Loop:m_Str='', token='template'
DoParse() : template argument='<typename _CharT, typename _Traits, typename _Alloc>', token ='inline'
Parsing stage done (1 total parsed files, 174 tokens in 0 minute(s), 8.377 seconds).
Updating class browser...
Class browser updated.

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version