diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-17 18:31:19 +0200 |
|---|---|---|
| committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-20 13:18:11 +0000 |
| commit | 76f5b784ce54730ed8d6ad4bb9c39c9a05c5d81d (patch) | |
| tree | 3bcbc26a9ad1eabebb87e92dbcc7fbbda2c2e48f /util/cmake/tests/test_parsing.py | |
| parent | e4b8c488bd8b350f1a19874c4859ae2699afc747 (diff) | |
Fix the fix to correctly handle comments in multi-line assignments
The previous fix where the Grammar comment style was changed to
remove the newlines was incorrect, because if you have
foo=1#comment
bar=2
after the Grammar comment ignoring, it would transform into
foo=1bar=2
which will clearly fail to parse, so the new line has to stay.
But we would still have the following case which would fail:
foo=a \
# comment
b
Apparently qmake things that's the equivalent of
foo=a b
but the grammar parses it as
foo=a \
\n (newline)
b
Thus the parsing fails because there's a newline and then some
weird 'b' token which the grammar does not expect.
The best fix I found is to preprocess the source, to remove
completely commented out lines.
So:
foo=a \
# comment
b
gets transformed into
foo=a \
b
Change-Id: I2487a0dbf94a6ad4d917d0a0ce05247341e9b7da
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'util/cmake/tests/test_parsing.py')
| -rwxr-xr-x | util/cmake/tests/test_parsing.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/cmake/tests/test_parsing.py b/util/cmake/tests/test_parsing.py index 4b6f48b931e..c8feeb18114 100755 --- a/util/cmake/tests/test_parsing.py +++ b/util/cmake/tests/test_parsing.py @@ -308,4 +308,4 @@ def test_realworld_lc(): def test_realworld_lc_with_comment_in_between(): result = parse_file(_tests_path + '/data/lc_with_comment.pro') - assert len(result) == 1 + assert len(result) == 6 |
