Fix exception when parsing tests.pro

The ParseResults may be a nested list of list. Now the code doesn't
raise exceptions, but it fails in do_include as includes that doesn't
provide resolved path will fail. Anyway step in the right direction.

Change-Id: Ice44e4c10d221293cc6c1facca30abd5495791be
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Jędrzej Nowacki 2019-03-28 13:25:04 +01:00
parent ce9a143467
commit a697df786d

View File

@ -629,8 +629,18 @@ class QmakeParser:
Operation = Key('key') + pp.Optional(LC) \ Operation = Key('key') + pp.Optional(LC) \
+ Op('operation') + pp.Optional(LC) \ + Op('operation') + pp.Optional(LC) \
+ Values('value') + Values('value')
CallArgs = pp.Optional(LC) + pp.nestedExpr() CallArgs = pp.Optional(LC) + pp.nestedExpr()\
CallArgs.setParseAction(lambda x: ' '.join(chain(*x)))
def parse_call_args(results):
out = ''
for item in chain(*results):
if isinstance(item, str):
out += item
else:
out += "(" + parse_call_args(item) + ")"
return out
CallArgs.setParseAction(parse_call_args)
Load = pp.Keyword('load') + CallArgs('loaded') Load = pp.Keyword('load') + CallArgs('loaded')
Include = pp.Keyword('include') + CallArgs('included') Include = pp.Keyword('include') + CallArgs('included')
Option = pp.Keyword('option') + CallArgs('option') Option = pp.Keyword('option') + CallArgs('option')