Problems with the qmake parser

Alexander Dymo dymo at mk.ukrtelecom.ua
Fri Aug 4 09:49:34 UTC 2006


On Friday 04 August 2006 02:17, Andreas Pakulat wrote:
> I should we handle things like this:
> QT += foo bar
> contains(QT,foo)
> {
> }
> QT -= bar
> QT += baz
> QT = foobar

> I can't just remove all QT leafs and put the QT = foobar at the top as
> that will break the function. The "easiest" way here would be to just
> leave the AST alone, however then I have a problem when adding new
> values to the QT variable...
The challenge here is that you have to leave AST as is. Otherwise
it will be written back incorrectly. When you walk the AST you can evaluate
the value of QT variable and display only the result of the evaluation
in the GUI (mostly because our GUI can't handle two assignments to
the same variable).
Then if somebody in the GUI removes the value of QT var, you
can add the ast node just after the last assignment to have
QT -= foobar
in .pro
If somebody adds the value foo2 to QT, you should probably do
QT += foo2
again after the last assignment.

> Maybe I'm just overlooking something or making this to complex myself,
> but it seems a simple AST is not enough to really handle qmake project
> files... Or let's say the simple UI we have can by far not cover all use
> cases and it's hard to not screw up complex qmake files while still
> making sure the ui settings have an effect.
QMake AST is indeed very simple but it was designed to be processed
afterwards with something smarter. Apparently our current project
manager is not smart enough.
But if you have ideas on what can be done in AST level, just tell me.





More information about the KDevelop-devel mailing list