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

wxGetApp not in the list CC

(1/2) > >>

Borr:
wxGetApp not in the list CC. Maybe we should try to look at the Eclipse parser algorithm?

ollydbg:

--- Quote from: Borr on October 22, 2010, 06:33:40 am ---wxGetApp not in the list CC.

--- End quote ---

confirmed trunk rev 6736.

Just noticed that:

In my D:\code\wxWidgets-2.8.11\include\wx\app.h
The declaration is like:

--- Code: ---// this macro can be used multiple times and just allows you to use wxGetApp()
// function
#define DECLARE_APP(appname) extern appname& wxGetApp();

--- End code ---

But once the cc's parser meets a extern keyword, it will just skip the later statement.

see the source code: parserthread.cpp line 716

--- Code: ---            else if (token == ParserConsts::kw_extern)
            {
                // check for "C", "C++"
                m_Str = m_Tokenizer.GetToken();
                if (m_Str == ParserConsts::kw_C || m_Str == ParserConsts::kw_CPP)
                {
                    m_Tokenizer.GetToken(); // "eat" {
                    DoParse(); // time for recursion ;)
                }
                else
                {
                    // do nothing, just skip keyword "extern", otherwise uncomment:
                    //SkipToOneOfChars(ParserConsts::semicolon); // skip externs
                    m_Tokenizer.UngetToken();
                }
                m_Str.Clear();
            }

--- End code ---

So, the solution is:
some times, we will meet many instants of extern forward declaration. shall we add them to the TokensTree??? any good ideas???


--- Quote ---Maybe we should try to look at the Eclipse parser algorithm?
--- End quote ---
I'm interested in any parsers, but did you give more directions.
I have no idea about Eclipse parser.
Does it a Jave parser? or some one has familiar with it? Does it do a full C++ grammar match? macro expansion?  include expansion?

ollydbg.



oBFusCATed:

--- Quote from: Borr on October 22, 2010, 06:33:40 am ---... Maybe we should try to look at the Eclipse parser algorithm? ...

--- End quote ---

Looking at the source code of Eclipse is just a waste of time (I've tried it).
They have buried the useful parts in too many abstractions and patterns, and other "cool" java enterprise s**t.
It is impossible to understand it, unless you're java programmer or you have plenty of time to waste.

Looking at the code of clang will be way more useful :)

ollydbg:

--- Quote from: oBFusCATed on October 22, 2010, 08:57:46 am ---
--- Quote from: Borr on October 22, 2010, 06:33:40 am ---... Maybe we should try to look at the Eclipse parser algorithm? ...

--- End quote ---

Looking at the source code of Eclipse is just a waste of time (I've tried it).
They have buried the useful parts in too many abstractions and patterns, and other "cool" java enterprise s**t.
It is impossible to understand it, unless you're java programmer or you have plenty of time to waste.

Looking at the code of clang will be way more useful :)

--- End quote ---

thank you.
I have found that there is a minimal tutorial, see here:
http://amnoid.de/tmp/clangtut/tut.html

this is a step to step tutorial to build a lexer -> preprocesser -> parser. Nice.

But it seems not C++ grammar...

ollydbg:
by the way:
from this wiki:
Clang - Wikipedia, the free encyclopedia


--- Quote ---On June 7, 2010, Apple announced the preview of Xcode 4.0, which includes Clang C++ support as well as direct integration of Clang into the Xcode 4 IDE. This integration provides Xcode with precise code completion, indexing (cross referencing), on the fly detection of errors and warnings, as well as a new Fix It feature, which uses Clang to automatically corrects errors in the code.

On June 10, 2010, Clang/LLVM became an integral part of FreeBSD. While the default compiler being used is still GCC, it's expected that Clang will replace GCC as a default compiler in the future[19].
--- End quote ---

sounds Clang is powerful !!!

Navigation

[0] Message Index

[#] Next page

Go to full version