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:
parent
8512f5179d
commit
754ba28799
@ -518,7 +518,7 @@ class QmakeParser:
|
|||||||
pp.ParserElement.setDefaultWhitespaceChars(' \t')
|
pp.ParserElement.setDefaultWhitespaceChars(' \t')
|
||||||
|
|
||||||
LC = pp.Suppress(pp.Literal('\\\n'))
|
LC = pp.Suppress(pp.Literal('\\\n'))
|
||||||
EOL = pp.Suppress(pp.Literal('\n'))
|
EOL = pp.Suppress(pp.Literal('\n') ^ pp.LineEnd())
|
||||||
Else = pp.Keyword('else')
|
Else = pp.Keyword('else')
|
||||||
Identifier = pp.Word(pp.alphas + '_', bodyChars=pp.alphanums+'_-./')
|
Identifier = pp.Word(pp.alphas + '_', bodyChars=pp.alphanums+'_-./')
|
||||||
BracedValue = pp.nestedExpr(ignoreExpr=pp.quotedString \
|
BracedValue = pp.nestedExpr(ignoreExpr=pp.quotedString \
|
||||||
|
3
util/cmake/tests/data/sql.pro
Normal file
3
util/cmake/tests/data/sql.pro
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
TEMPLATE = subdirs
|
||||||
|
SUBDIRS = \
|
||||||
|
kernel \
|
@ -281,3 +281,9 @@ def test_realworld_complex_condition():
|
|||||||
|
|
||||||
assert len(else_branch) == 0
|
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])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user