Using antlr for kdev4
Roberto Raggi
roberto at kdevelop.org
Mon Dec 4 14:12:56 UTC 2006
Hi Andreas!
On Monday 04 December 2006 14:40, Andreas Pakulat wrote:
> On 04.12.06 14:15:17, Roberto Raggi wrote:
> For the qmake parser its important that I can change it, else I'd have
> to steadily reparse the .pro files and rebuild the UI. Of course I can
> build my own AST by using a visitor on the generated one.
you don't have to reparse the pro file. You just have to keep the list of the
delta changes (e.g. added foo.cpp to SOURCES, replaced debug with release,
and so on...). So your model will be the *initial AST* plus the
delta-changes. You can use the undo/redo framework to implement this kind of
model. When you need to regenerate the .pro file you just need to apply apply
the delta changes to the original AST using kdev-pg-replacement.h and you
will have your beautiful new .pro file :-)
>
> > The AST needs to be read only!
>
> Could you elaborate a bit? I'm just curious.
read-write AST are not necessary you can always store the extra attributes in
a different data structure (e.g. KDevelop code model, and so on..). read-only
AST are cool because you can run more visitors in parallel (no
read-writeconflicts). The other cool thing I like about read-only AST is that
they work very nicely with memory pools, and we use memory pools quite a bit
in KDevelop :-)
ciao robe
--
Roberto Raggi - roberto at kdevelop.org
KDevelop http://www.kdevelop.org
More information about the KDevelop-devel
mailing list