Author Topic: class parse problem  (Read 10198 times)

Offline blueshake

  • Regular
  • ***
  • Posts: 459
class parse problem
« on: July 23, 2009, 01:38:00 pm »
hello:
    In this thread http://forums.codeblocks.org/index.php/topic,10641.0.html
Code
class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >
{
public:
LPTSTR m_lpstrLabel;
LPTSTR m_lpstrHyperLink;

HCURSOR m_hCursor;
HFONT m_hFont;
HFONT m_hFontNormal;
};

codes above can be parsed correctly now.
here is the patch
Code
Index: parserthread.cpp
===================================================================
--- parserthread.cpp (revision 5696)
+++ parserthread.cpp (working copy)
@@ -1345,6 +1357,8 @@
                     }
                 }
             }
+            else
+                m_Tokenizer.GetToken();
         }
         else
             break;

[attachment deleted by admin]
« Last Edit: July 23, 2009, 01:40:01 pm by blueshake »
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: class parse problem
« Reply #1 on: July 23, 2009, 02:48:41 pm »
forget to mention .It's brach version .
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: class parse problem
« Reply #2 on: July 23, 2009, 03:25:20 pm »
I applied to my local trunk copy.
It seems  "CHyperLinkImpl " has no Ancestors.

Code
m_Tokenizer.GetToken();
will eat the next Token. :D

By the way, the BraceCompletion related code was add in cbEditor, not CodeCompletion. in the current trunk :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: class parse problem
« Reply #3 on: July 23, 2009, 03:32:37 pm »
Quote
It seems  "CHyperLinkImpl " has no Ancestors.
I found that too .because CWindowImpl didnt exist in this case.
Code
class MyClass 
{
     int x;
     int y;
};

class ATL_NO_VTABLE CHyperLinkImpl : public MyClass
{
LPTSTR m_lpstrLabel;
LPTSTR m_lpstrHyperLink;

HCURSOR m_hCursor;
HFONT m_hFont;
HFONT m_hFontNormal;
};


in this case ,it will  have one . :D
« Last Edit: July 23, 2009, 03:35:36 pm by blueshake »
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: class parse problem
« Reply #4 on: July 23, 2009, 03:57:41 pm »
aha, it really works if its ancestor is a template.
Code
template<typename T1, typename T2>
class MyClass
{
     T1 x;
     T2 y;
};

class ATL_NO_VTABLE CHyperLinkImpl1 : public MyClass<float,int>
{
LPTSTR m_lpstrLabel;
LPTSTR m_lpstrHyperLink;

HCURSOR m_hCursor;
HFONT m_hFont;
HFONT m_hFontNormal;
};

This still works fine!!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: class parse problem
« Reply #5 on: July 23, 2009, 04:01:52 pm »
 :D
by the way,I have sent a e-mail to you ,Do you copy that.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?