CMake: pro2cmake.py: Fix parsing of Line continuation before end of file

... and add a test case for this.

Change-Id: If20d737b54ecb3f9e128e59070b238c840acad6c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tobias Hunger 2019-02-27 13:58:00 +01:00
parent 8512f5179d
commit 754ba28799
3 changed files with 10 additions and 1 deletions

View File

@ -518,7 +518,7 @@ class QmakeParser:
pp.ParserElement.setDefaultWhitespaceChars(' \t')
LC = pp.Suppress(pp.Literal('\\\n'))
EOL = pp.Suppress(pp.Literal('\n'))
EOL = pp.Suppress(pp.Literal('\n') ^ pp.LineEnd())
Else = pp.Keyword('else')
Identifier = pp.Word(pp.alphas + '_', bodyChars=pp.alphanums+'_-./')
BracedValue = pp.nestedExpr(ignoreExpr=pp.quotedString \

View File

@ -0,0 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = \
kernel \

View File

@ -281,3 +281,9 @@ def test_realworld_complex_condition():
assert len(else_branch) == 0
def test_realworld_sql():
result = parse_file(_tests_path + '/data/sql.pro')
assert len(result) == 2
validate_op('TEMPLATE', '=', ['subdirs'], result[0])
validate_op('SUBDIRS', '=', ['kernel'], result[1])