~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/shared/proparser/qmakeevaluator.cpp

  • Committer: Timo Jyrinki
  • Date: 2013-11-15 12:25:23 UTC
  • mfrom: (1.1.28)
  • Revision ID: timo.jyrinki@canonical.com-20131115122523-i2kyamsu4gs2mu1m
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
265
265
        ushort unicode = vals_data[x].unicode();
266
266
        if (unicode == quote) {
267
267
            quote = 0;
 
268
            hadWord = true;
 
269
            build += QChar(unicode);
268
270
            continue;
269
271
        }
270
272
        switch (unicode) {
272
274
        case '\'':
273
275
            quote = unicode;
274
276
            hadWord = true;
275
 
            continue;
 
277
            break;
276
278
        case ' ':
277
279
        case '\t':
278
280
            if (!quote) {
283
285
                }
284
286
                continue;
285
287
            }
286
 
            build += QChar(unicode);
287
288
            break;
288
289
        case '\\':
289
290
            if (x + 1 != vals_len) {
290
291
                ushort next = vals_data[++x].unicode();
291
 
                if (next == '\'' || next == '"' || next == '\\')
 
292
                if (next == '\'' || next == '"' || next == '\\') {
 
293
                    build += QChar(unicode);
292
294
                    unicode = next;
293
 
                else
 
295
                } else {
294
296
                    --x;
 
297
                }
295
298
            }
296
299
            // fallthrough
297
300
        default:
298
301
            hadWord = true;
299
 
            build += QChar(unicode);
300
302
            break;
301
303
        }
 
304
        build += QChar(unicode);
302
305
    }
303
306
    if (hadWord)
304
307
        ret << ProString(build).setSource(source);
450
453
            break; }
451
454
        case TokEnvVar: {
452
455
            const ProString &var = getStr(tokPtr);
453
 
            const ProString &val = ProString(m_option->getEnv(var.toQString(m_tmp1)));
 
456
            const ProString &val = ProString(m_option->getEnv(var.toQString()));
454
457
            debugMsg(2, "env var %s => %s", dbgStr(var), dbgStr(val));
455
458
            addStr(val, ret, pending, joined);
456
459
            break; }
572
575
            okey = true, or_op = false; // force next evaluation
573
576
            break;
574
577
        case TokForLoop:
575
 
            if (m_cumulative) { // This is a no-win situation, so just pretend it's no loop
576
 
                skipHashStr(tokPtr);
577
 
                uint exprLen = getBlockLen(tokPtr);
578
 
                tokPtr += exprLen;
579
 
                blockLen = getBlockLen(tokPtr);
580
 
                ret = visitProBlock(tokPtr);
581
 
            } else if (okey != or_op) {
 
578
            if (m_cumulative || okey != or_op) {
582
579
                const ProKey &variable = getHashStr(tokPtr);
583
580
                uint exprLen = getBlockLen(tokPtr);
584
581
                const ushort *exprPtr = tokPtr;
748
745
    ProStringList list = values(it_list.toKey());
749
746
    if (list.isEmpty()) {
750
747
        if (it_list == statics.strforever) {
 
748
            if (m_cumulative) {
 
749
                // The termination conditions wouldn't be evaluated, so we must skip it.
 
750
                traceMsg("skipping forever loop in cumulative mode");
 
751
                return ReturnFalse;
 
752
            }
751
753
            infinite = true;
752
754
        } else {
753
755
            const QString &itl = it_list.toQString(m_tmp1);
758
760
                if (ok) {
759
761
                    int end = itl.mid(dotdot+2).toInt(&ok);
760
762
                    if (ok) {
 
763
                        if (m_cumulative && qAbs(end - start) > 100) {
 
764
                            // Such a loop is unlikely to contribute something useful to the
 
765
                            // file collection, and may cause considerable delay.
 
766
                            traceMsg("skipping excessive loop in cumulative mode");
 
767
                            return ReturnFalse;
 
768
                        }
761
769
                        if (start < end) {
762
770
                            for (int i = start; i <= end; i++)
763
771
                                list << ProString(QString::number(i));
1804
1812
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
1805
1813
        const QString &fileName, QMakeHandler::EvalFileType type, LoadFlags flags)
1806
1814
{
1807
 
    if (ProFile *pro = m_parser->parsedProFile(fileName, true)) {
 
1815
    QMakeParser::ParseFlags pflags = QMakeParser::ParseUseCache;
 
1816
    if (!(flags & LoadSilent))
 
1817
        pflags |= QMakeParser::ParseReportMissing;
 
1818
    if (ProFile *pro = m_parser->parsedProFile(fileName, pflags)) {
1808
1819
        m_locationStack.push(m_current);
1809
1820
        VisitReturn ok = visitProFile(pro, type, flags);
1810
1821
        m_current = m_locationStack.pop();
1819
1830
#endif
1820
1831
        return ok;
1821
1832
    } else {
1822
 
        if (!(flags & LoadSilent) && !m_vfs->exists(fileName))
1823
 
            evalError(fL1S("WARNING: Include file %1 not found").arg(fileName));
1824
1833
        return ReturnFalse;
1825
1834
    }
1826
1835
}