diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-02-27 16:12:13 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-02-28 08:08:41 +0000 |
commit | 83354655b2f96f0fc5fa8f39d10b58c36a9e8bf5 (patch) | |
tree | 9255d7921f38f5f983fc332e7f16a108e220a96f /util | |
parent | f2e968b245e0428b75eecb0bb7244a0391e3b355 (diff) |
CMake: pro2cmake.py: Simplify code and add test for line continuation
Simplify code a bit and add a test for line continuation fixup.
Change-Id: If865bc94d7d419c65d3280b5f9613ebc0d3db74a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/pro2cmake.py | 2 | ||||
-rw-r--r-- | util/cmake/tests/data/lc.pro | 10 | ||||
-rwxr-xr-x | util/cmake/tests/test_parsing.py | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 06d0c925d9..ef81d4cfef 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -518,7 +518,7 @@ class QmakeParser: pp.ParserElement.setDefaultWhitespaceChars(' \t') LC = pp.Suppress(pp.Literal('\\\n')) - EOL = pp.Suppress(pp.Literal('\n') ^ pp.LineEnd()) + EOL = pp.Suppress(pp.LineEnd()) Else = pp.Keyword('else') Identifier = pp.Word(pp.alphas + '_', bodyChars=pp.alphanums+'_-./') BracedValue = pp.nestedExpr(ignoreExpr=pp.quotedString \ diff --git a/util/cmake/tests/data/lc.pro b/util/cmake/tests/data/lc.pro new file mode 100644 index 0000000000..def80e7c95 --- /dev/null +++ b/util/cmake/tests/data/lc.pro @@ -0,0 +1,10 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qmacstyle \ + qstyle \ + qstyleoption \ + qstylesheetstyle \ + +!qtConfig(private_tests): SUBDIRS -= \ + qstylesheetstyle \ + diff --git a/util/cmake/tests/test_parsing.py b/util/cmake/tests/test_parsing.py index 2f227e0ba2..79ad0a4945 100755 --- a/util/cmake/tests/test_parsing.py +++ b/util/cmake/tests/test_parsing.py @@ -300,3 +300,8 @@ def test_realworld_qtconfig(): assert len(result) == 1 validate_op('MODULE_AUX_INCLUDES', '=', ['\\$\\$QT_MODULE_INCLUDE_BASE/QtANGLE'], result[0]) + +def test_realworld_lc(): + result = parse_file(_tests_path + '/data/lc.pro') + assert len(result) == 3 + |