From da7811dc758a99b4aee5737713d90a5c12959fc9 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 1 Nov 2018 16:13:11 +0100 Subject: [PATCH] pro2cmake: Explicitly handle for loops Handle for loops by ignoring them:-) Change-Id: If4716e0615f4a0fa982281b94dbd4f70ae868fd8 Reviewed-by: Simon Hausmann --- util/cmake/pro2cmake.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 6471f3ff5f..3053b36598 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -325,11 +325,13 @@ class QmakeParser: Option = pp.Keyword('option') + pp.Suppress('(') + Identifier('option') + pp.Suppress(')') DefineTest = pp.Suppress(pp.Keyword('defineTest') + pp.Suppress('(') + Identifier + pp.Suppress(')') + pp.nestedExpr(opener='{', closer='}') + pp.LineEnd()) # ignore the whole thing... + ForLoop = pp.Suppress(pp.Keyword('for') + pp.nestedExpr() + + pp.nestedExpr(opener='{', closer='}', ignoreExpr=None) + pp.LineEnd()) # ignore the whole thing... FunctionCall = pp.Suppress(Identifier + pp.nestedExpr()) Scope = pp.Forward() - Statement = pp.Group(Load | Include | Option | DefineTest | FunctionCall | Operation) + Statement = pp.Group(Load | Include | Option | DefineTest | ForLoop | FunctionCall | Operation) StatementLine = Statement + EOL StatementGroup = pp.ZeroOrMore(StatementLine | Scope | EOL) @@ -350,7 +352,7 @@ class QmakeParser: Scope <<= pp.Group(Condition('condition') + (SingleLineScope | MultiLineScope) + pp.Optional(Else)) if debug: - for ename in "EOL Identifier Substitution SubstitutionValue LiteralValuePart Value Values SingleLineScope MultiLineScope Scope SingleLineElse MultiLineElse Else Condition Block StatementGroup Statement Load Include Option DefineTest FunctionCall Operation".split(): + for ename in "EOL Identifier Substitution SubstitutionValue LiteralValuePart Value Values SingleLineScope MultiLineScope Scope SingleLineElse MultiLineElse Else Condition Block StatementGroup Statement Load Include Option DefineTest ForLoop FunctionCall Operation".split(): expr = locals()[ename] expr.setName(ename) expr.setDebug()