[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevelop/plugins/managers/cmake
From: Aleix Pol Gonzalez <aleixpol () gmail ! com>
Date: 2009-01-28 23:56:32
Message-ID: 1233186992.560225.1914.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 918025 by apol:
Fix variable resolution when many variables are in the same argument.
M +13 -6 parser/cmakeprojectvisitor.cpp
M +1 -1 parser/cmakeprojectvisitor.h
M +2 -0 tests/cmake_cmakeprojectvisitor_test.cpp
--- trunk/KDE/kdevelop/plugins/managers/cmake/parser/cmakeprojectvisitor.cpp \
#918024:918025 @@ -144,16 +144,19 @@
return var.mid(0, dollar)+value+var.mid(dollar+id.size(), \
var.size()-(dollar+id.size())); }
-QStringList CMakeProjectVisitor::value(const QString& exp, const QList<IntPair>& \
poss, int desired) const +QStringList CMakeProjectVisitor::value(const QString& exp, \
const QList<IntPair>& poss, int& desired) const {
QString var=exp;
QList<IntPair> invars;
invars += poss[desired];
+ qDebug() << ">>>>>" << exp << desired << poss.count();
for(; desired+1<poss.size() && poss[desired].level>1; desired++)
{
invars+=poss[desired+1];
+ qDebug() << "poss@"<< desired+1 << "="<< poss[desired+1].print();
}
+ qDebug() << ";;;;;" << invars.count();
if(invars.count()>1)
{
QList<IntPair>::const_iterator itConstEnd=invars.constEnd();
@@ -187,7 +190,7 @@
int i=0;
IntPair last(-1,-1, 0);
- for(QList<IntPair>::const_iterator it=var.constBegin(); it!=var.constEnd(); \
++it) + for(QList<IntPair>::const_iterator it=var.constBegin(); \
it!=var.constEnd(); ++it, ++i) {
while(it!=var.constEnd() && it->level>1)
++it;
@@ -198,7 +201,7 @@
QString pre=exp.value.mid(last.second+1, dollar-last.second-1);
QStringList vars = value(exp.value, var, i);
-// qDebug() << "aaaaaaaaaA" << vars;
+// qDebug() << "aaaaaaaaaA" << pre << vars;
if(!vars.isEmpty())
{
@@ -207,7 +210,9 @@
ret.last()+=pre;
ret += vars;
last=p;
- i++;
+
+// qDebug() << "yaaaaaaa" << ret;
+// i++;
}
ret.last().append(exp.value.mid(last.second+1, exp.value.count()-last.second));
@@ -844,6 +849,7 @@
SimpleRange sr=def.arguments.first().range();
SimpleRange endsr=end.arguments.first().range();
int idx;
+
if(!decls.isEmpty())
{
idx=m_topctx->indexForUsedDeclaration(decls.first());
@@ -863,6 +869,7 @@
}
d->setAbstractType( AbstractType::Ptr(func) );
idx=m_topctx->indexForUsedDeclaration(d);
+ qDebug() << "creating macro decl: " << m_topctx << \
m_topctx->localDeclarations(); }
m_topctx->createUse(idx, endsr, 0);
}
@@ -1874,10 +1881,10 @@
element = new MacroCallAst;
createUses(*it);
- kDebug(9042) << "resolving:" << it->writeBack();
+// kDebug(9042) << "resolving:" << it->writeBack();
CMakeFunctionDesc func = resolveVariables(*it); //FIXME not correct in while \
case bool correct = element->parseFunctionInfo(func);
- kDebug(9042) << "resolved:" << func.writeBack() << correct;
+// kDebug(9042) << "resolved:" << func.writeBack() << correct;
if(!correct)
{
kDebug(9042) << "error! found an error while processing" << \
func.writeBack() << "was" << it->writeBack() << endl
--- trunk/KDE/kdevelop/plugins/managers/cmake/parser/cmakeprojectvisitor.h \
#918024:918025 @@ -160,7 +160,7 @@
void macroDeclaration(const CMakeFunctionDesc& def, const CMakeFunctionDesc& \
end, const QStringList& args); CMakeFunctionDesc resolveVariables(const \
CMakeFunctionDesc &exp);
- QStringList value(const QString& exp, const QList<IntPair>& poss, int \
desired) const; + QStringList value(const QString& exp, const QList<IntPair>& \
poss, int& desired) const; QStringList theValue(const QString& exp, const IntPair& \
p) const;
typedef QMap<QString, QString> TargetProperties;
--- trunk/KDE/kdevelop/plugins/managers/cmake/tests/cmake_cmakeprojectvisitor_test.cpp \
#918024:918025 @@ -305,6 +305,8 @@
"set(aaa ca)\n"
"set(aab co)\n"
"set(b a)\n"
+// "message(STATUS \"${aaa}${aab} should be caco\")\n"
+// "message(STATUS \"${a${b}a}${a${b}b} should be \
caco\")\n" "if(\"${a${b}a}${a${b}b}\" STREQUAL caco )\n"
" set(GOOD TRUE)\n"
"endif()\n"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic