CMake: pro2cmake.py: Handle values with () in assignments
Change-Id: I0f59c7fa57cd6c64b151f439d4eea4ae56dca288 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
This commit is contained in:
parent
22dc78f417
commit
c971d2d359
@ -515,6 +515,12 @@ class QmakeParser:
|
|||||||
Else = pp.Keyword('else')
|
Else = pp.Keyword('else')
|
||||||
DefineTest = pp.Keyword('defineTest')
|
DefineTest = pp.Keyword('defineTest')
|
||||||
Identifier = pp.Word(pp.alphas + '_', bodyChars=pp.alphanums+'_-./')
|
Identifier = pp.Word(pp.alphas + '_', bodyChars=pp.alphanums+'_-./')
|
||||||
|
BracedValue = pp.nestedExpr(ignoreExpr=pp.quotedString \
|
||||||
|
| pp.QuotedString(quoteChar='$(',
|
||||||
|
endQuoteChar=')',
|
||||||
|
escQuote='\\',
|
||||||
|
unquoteResults=False)
|
||||||
|
).setParseAction(lambda s, l, t: ['(', *t[0], ')'])
|
||||||
|
|
||||||
Substitution \
|
Substitution \
|
||||||
= pp.Combine(pp.Literal('$')
|
= pp.Combine(pp.Literal('$')
|
||||||
@ -534,7 +540,8 @@ class QmakeParser:
|
|||||||
| pp.Literal('$')))
|
| pp.Literal('$')))
|
||||||
Value = pp.NotAny(Else | pp.Literal('}') | EOL | pp.Literal('\\')) \
|
Value = pp.NotAny(Else | pp.Literal('}') | EOL | pp.Literal('\\')) \
|
||||||
+ (pp.QuotedString(quoteChar='"', escChar='\\')
|
+ (pp.QuotedString(quoteChar='"', escChar='\\')
|
||||||
| SubstitutionValue)
|
| SubstitutionValue
|
||||||
|
| BracedValue)
|
||||||
|
|
||||||
Values = pp.ZeroOrMore(Value + pp.Optional(LC))('value')
|
Values = pp.ZeroOrMore(Value + pp.Optional(LC))('value')
|
||||||
|
|
||||||
@ -598,7 +605,7 @@ class QmakeParser:
|
|||||||
'Else ElseBranch SingleLineElse MultiLineElse ' \
|
'Else ElseBranch SingleLineElse MultiLineElse ' \
|
||||||
'SingleLineScope MultiLineScope ' \
|
'SingleLineScope MultiLineScope ' \
|
||||||
'Identifier ' \
|
'Identifier ' \
|
||||||
'Key Op Values Value ' \
|
'Key Op Values Value BracedValue ' \
|
||||||
'Scope Block ' \
|
'Scope Block ' \
|
||||||
'StatementGroup StatementLine Statement '\
|
'StatementGroup StatementLine Statement '\
|
||||||
'Load Include Option DefineTest ForLoop ' \
|
'Load Include Option DefineTest ForLoop ' \
|
||||||
|
2
util/cmake/tests/data/complex_assign.pro
Normal file
2
util/cmake/tests/data/complex_assign.pro
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
qmake-clean.commands += (cd qmake && $(MAKE) clean ":-(==)-:" '(Foo)' )
|
||||||
|
|
@ -254,3 +254,9 @@ def test_realworld_contains_scope():
|
|||||||
result = parse_file(_tests_path + '/data/contains_scope.pro')
|
result = parse_file(_tests_path + '/data/contains_scope.pro')
|
||||||
assert len(result) == 2
|
assert len(result) == 2
|
||||||
|
|
||||||
|
|
||||||
|
def test_realworld_complex_assign():
|
||||||
|
result = parse_file(_tests_path + '/data/complex_assign.pro')
|
||||||
|
assert len(result) == 1
|
||||||
|
validate_op('qmake-clean.commands', '+=', '( cd qmake && $(MAKE) clean ":-(==)-:" \'(Foo)\' )'.split(),
|
||||||
|
result[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user