On 2011-6-8 15:52, Jean-Marc Saffroy wrote:
Mostly, I think you need to use the "recursive decent parser", so you create a
lot of functions like:
HandleClass();
HandleNamespace();
HandleWhile();
With the approach you suggest, is it still possible to parse things like
this?

#ifdef foo
class foo {
#else
class bar {
#endif
...
Yes, currently, codeblocks' parser can handle this kind of preprocessor directive. But there are some limitations.
because
#if Const Expression
It need to do Const expression calculation and Macro expansion. Mostly, it need a Macro symbol table look-up. and note that each translation unit should have its own symbol table, so this is a time consuming work.

Current way, we just simplified this, if a symbol is not found, we just set if to "0", so we can always take a conditional preprocessor branch, although it is not 100% correct branch.

ctags has the same way to handle conditional preprocessor directives.
Global felt quite mature to me the last 10 years I used it. :)
Cheers,
Jean-Marc

Well, I'd admit that if your code is very complex (contains a lot of c++ template and template partial specialization), It is hard to parse them. This time, a full compiler front end can solve the issue, but a full compiler is always running slowly.:-) Clang compiler has an index feature, but gcc currently doesn't have such feature.

asmwarrior


_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global

Reply via email to