Author Topic: C++ parser errors  (Read 7351 times)

Profic

  • Guest
C++ parser errors
« on: March 28, 2005, 11:00:16 pm »
I'm evaluating C::B as replacement of Dev-cpp and found some errors:
1) First  of all class templates seemes parsed totally incorrectly
I got a lof of dublicate, bogus and out-of-place "symbols" (in selfnamed tab). I even got class named ">" and const named ",".
2) Also there can be something wrong with comment skipping in folding - C-style comments skipped properly, but C++-style ones not - it get commented } as end-of-group (noticed on commented code with } at line end).
3) Moreover if I choose "Jump to declaration" from context menu - I get to line next to expected.
4) Unnamed enum causes all defined in it constants (also last ",") appear in global scope independ of there is was really defined (see code below)
Code: [Select]
namespace ... {
class ... {
enum {
// full skip, even [{] and [}] skipped
// forces m_state.m_skip = true
// used to skip up to end group things not skipped otherwise
pdFullSkip,
// current depth of table - possible values are 1 and 2; 3 and more are ignored
pdDepth,
// current destination - see Dest enum
pdDest,
// either finish reached
// forces odDest = dNone
// forces m_state.m_skip = true
// used to check item correctness
pdFinish,
};
};
}

5) Every reload of tree indirectly (e.g. through saving file) leads to append of updated items to end instead of replace
I think there are more but those I found in couples of minutes and stop research.

PS. If not clear - most of above is about "Symbols" tab at left side of main window
PSS. Sorry for my English, it's not my primary language, but I tried :)
PSSS. Win/XP-SP2 C::B/1.0-b6

Profic

  • Guest
C++ parser errors
« Reply #1 on: April 02, 2005, 10:31:39 am »
Just to add
I post link to this topic in bug report about symbols tab (http://sourceforge.net/tracker/index.php?func=detail&aid=1162313&group_id=126998&atid=707416).
If needed I can provide example which causes template misparsing. But as I can see in sourses parser support of templates is very rudimentar, and so it is not quick fixable...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
C++ parser errors
« Reply #2 on: April 06, 2005, 10:40:31 pm »
Yes, I think that the parser should be labelled "experimental". At least that won't catch users off-guard (i.e. expecting a commercial-grade class browser, and getting errors)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
C++ parser errors
« Reply #3 on: April 07, 2005, 01:37:28 pm »
I started fixing some class-parser bugs. All submitted class-parser related bugs are now fixed.

Quote
But as I can see in sourses parser support of templates is very rudimentar, and so it is not quick fixable...

Templates support is not rudimentary... it's non-existent...

EDIT: to clarify "non-existent", no special handling is done for templates. They 're seen as normal classes.

Yiannis.
Be patient!
This bug will be fixed soon...

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
C++ parser errors
« Reply #4 on: April 07, 2005, 04:38:35 pm »
Well, I see, that they are not handled in special [read any] way, but misparsing is there :)

Member specializations do not appear in list at all, example:
Code: [Select]
template<typename Typename>
class Class { void member(); /*...*/ };
//...
template<>
void Class<void>::member() { /*...*/ }


Class specializations (at least one of them) appear as class named ">", example:
Code: [Select]
template<typename Typename>
class Class : public Base { /*...*/ };
//...
template<>
class Class<void> : public Base { /*...*/ };


Template members (defined outside of class) appear twice - once in class itself, and second sibling to it, example:
Code: [Select]
template<typename Typename>
Class { void member1(); std::string<Typename> member2(); /*...*/ };
//...
template<typename Typename>
void
Class<Typename>::member1() { /*...*/ }
//...
template<typename Typename>
std::string<Typename>
Class<Typename>::member2();

This example leads to:
Code: [Select]
- Class
| | - member1() : void
| | - member2()
| - member1() : ::
| - member2() : ::


Also, as I mentioned earlier when I select "Jump to declaration" in context menu, I jump to line next to expected
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
C++ parser errors
« Reply #5 on: April 08, 2005, 11:53:19 am »
Yep!
As I saw today in cvs most annoying bugs were fixed. Is there any way to obtain current cvs source in tarball or zip-archive?
If it is I then will compile it and test :)
I ask for tarball or zip because I have connection to internet only through password-protected proxy, which allow CONNECT only to HTTPS and ICQ and not CVS :(

EDIT: May be there will be new beta release soon?
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
C++ parser errors
« Reply #6 on: April 08, 2005, 12:19:22 pm »
Just now, I commited fixes for the issues you mentioned above. I 'm pretty happy with how it parses now :)
It still needs some things, but at least now you won't see "<" class members ;)

Quote
May be there will be new beta release soon?

This weekend, a server move is planned to a faster host. So next week, I believe, we might be ready for the next release :)

Yiannis.
Be patient!
This bug will be fixed soon...

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
C++ parser errors
« Reply #7 on: April 08, 2005, 01:28:42 pm »
Quote
So next week, I believe, we might be ready for the next release

Great news :) Thanks for fixing these bugs.

EDITED:
Found bug in folding. I don't know if this is bug of C::B or scintilla as I don't know how folding internally work, but code like
Code: [Select]
void func() {
    //if (false) {
    //    // do nothing
    //}
    otherFunc();
}

folds incorrectly to
Code: [Select]
void func() {
    otherFunc();
}

And if I put any char between // and } all become good.
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
C++ parser errors
« Reply #8 on: April 08, 2005, 08:28:10 pm »
I found that bug described above may be "feature" :) to force somewhere a fold. If it's so I suppose to support vim like folding, e.g.
Code: [Select]
/* {{{ */
// something
/* }}} */

and
Code: [Select]
// {{{
// something
// }}}

and have possibility to selectively turn on/off different type of folds (comment, preprocessor, general (e.g. scope), vim) per project or even per file.

Also it IMHO will be good if after folding the closing part will be visible too, e.g. previous example would become:
Code: [Select]
void func() {
}

and not
Code: [Select]
void func() {
which sometimes not clear enough

Of course, all above is applicable only if is possible at all.
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
C++ parser errors
« Reply #9 on: April 09, 2005, 01:41:10 am »
Class folding is related to Scintilla, i.e. wxWidget's SCT class. It's NOT related to class browser or code completion.

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
C++ parser errors
« Reply #10 on: April 10, 2005, 10:49:50 am »
Quote
Class folding is related to Scintilla, i.e. wxWidget's SCT class. It's NOT related to class browser or code completion

So you recommend me to contact wxWidgets' SCT class authors? Am I right?
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Anonymous

  • Guest
C++ parser errors
« Reply #11 on: April 16, 2005, 12:28:23 am »
actually SCT is only a wrapper around Scintilla. I think you'd better go to the Scintilla authors and ask them. (Frankly I'd prefer the code to be folded into a one-liner, but that'd be a helluva problem for long blocks :P )