Commit f5e44fb7 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

parse braces on the RHS of assignments

this is less insane than (and thus incompatible to) qmake, but i
postulate that nobody will complain. :)
parent 40ef148c
...@@ -290,7 +290,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in) ...@@ -290,7 +290,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in)
m_operator = NoOperator; m_operator = NoOperator;
m_markLine = m_lineNo; m_markLine = m_lineNo;
Context context = CtxTest; Context context = CtxTest;
int parens = 0; int parens = 0; // Braces in value context
int argc = 0; int argc = 0;
int litCount = 0; int litCount = 0;
int expCount = 0; int expCount = 0;
...@@ -650,6 +650,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in) ...@@ -650,6 +650,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in)
FLUSH_LHS_LITERAL(false); FLUSH_LHS_LITERAL(false);
finalizeCond(tokPtr, buf, ptr); finalizeCond(tokPtr, buf, ptr);
flushScopes(tokPtr); flushScopes(tokPtr);
closeScope:
if (!m_blockstack.top().braceLevel) { if (!m_blockstack.top().braceLevel) {
parseError(fL1S("Excess closing brace.")); parseError(fL1S("Excess closing brace."));
} else if (!--m_blockstack.top().braceLevel } else if (!--m_blockstack.top().braceLevel
...@@ -695,6 +696,20 @@ bool ProFileParser::read(ProFile *pro, const QString &in) ...@@ -695,6 +696,20 @@ bool ProFileParser::read(ProFile *pro, const QString &in)
needSep = 0; needSep = 0;
goto nextToken; goto nextToken;
} }
} else { // context == CtxValue
if (c == '{') {
++parens;
} else if (c == '}') {
if (!parens) {
FLUSH_RHS_LITERAL(false);
tokPtr[-1] = litCount ? litCount + expCount : 0;
tokPtr = ptr;
putTok(tokPtr, TokValueTerminator);
context = CtxTest;
goto closeScope;
}
--parens;
}
} }
if (putSpace) { if (putSpace) {
putSpace = false; putSpace = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment