New parser branch (Was: Dumping the source DOM?)

Vladimir Prus ghost at cs.msu.su
Wed Jul 13 13:28:06 UTC 2005


Roberto Raggi wrote:

>> 2. You don't care if you parser can handle Boost. So basically, you're
>> not trying to making your parser accept all possible C++ code, but only
>> C++ subset you're interested in?
> it's all about priorities. I'm going to implement the features I need.
> Boost is not a priority for me. Again, PLEASE TRY TO UNDERSTAND that it is
> *impossible* to accept all the possible valid C++ code in KDevelop.

Maybe you meant the opposite? That IDE should access invalid C++ code? If I
have a valid C++ program, I'd expect IDE to parse it without problems.

> We needs to understand/recover incorrect code. What do you think will be
> the output of gcc-xml if the source code in the KDevelop's texteditor
> looks like
> 
> class X {
>    void hello()
>    {
>         yy.             <<--- your cusrsor is here
>         a_method_call_here();
> 
> 
> a parser for a compiler expects complete code, while an IDE works on
> incomplete code. 

One possible approach I had in mind was to make parser restartable. First
you run g++ parser on the code till the first token it cannot parse. As you
type more tokens you feed them to the parser. If you go to the beginning of
the file and start typing there, you rewind parser state and start parsing
again.


- Volodya





More information about the KDevelop-devel mailing list