summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/pro2cmake.py7
-rw-r--r--util/cmake/tests/data/lc_with_comment.pro4
-rwxr-xr-xutil/cmake/tests/test_parsing.py4
3 files changed, 14 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 5b6b3847d8..71053d288b 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -779,7 +779,12 @@ class QmakeParser:
expr.setDebug()
Grammar = StatementGroup('statements')
- Grammar.ignore(pp.pythonStyleComment())
+
+ # Ignore comment lines, including the final line break,
+ # otherwise parsing fails when looking at multi line assignments
+ # with comments in between.
+ Comment = pp.Regex(r"#.*\n").setName("qmake style comment")
+ Grammar.ignore(Comment())
return Grammar
diff --git a/util/cmake/tests/data/lc_with_comment.pro b/util/cmake/tests/data/lc_with_comment.pro
new file mode 100644
index 0000000000..c087dadacc
--- /dev/null
+++ b/util/cmake/tests/data/lc_with_comment.pro
@@ -0,0 +1,4 @@
+SUBDIRS = \
+# dds \
+ tga \
+ wbmp
diff --git a/util/cmake/tests/test_parsing.py b/util/cmake/tests/test_parsing.py
index 79ad0a4945..4b6f48b931 100755
--- a/util/cmake/tests/test_parsing.py
+++ b/util/cmake/tests/test_parsing.py
@@ -305,3 +305,7 @@ def test_realworld_lc():
result = parse_file(_tests_path + '/data/lc.pro')
assert len(result) == 3
+
+def test_realworld_lc_with_comment_in_between():
+ result = parse_file(_tests_path + '/data/lc_with_comment.pro')
+ assert len(result) == 1