diff --git a/CHANGELOG.md b/CHANGELOG.md index b633c0b..73b55bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [0.2.1] 2020-06-20 + +### Fixed +- Missing value for one value keyword no longer leads to stopping formatting of remaining files in the batch + ## [0.2.0] 2020-06-14 ### Added diff --git a/gersemi/__version__.py b/gersemi/__version__.py index eff8a9c..88f56c2 100644 --- a/gersemi/__version__.py +++ b/gersemi/__version__.py @@ -4,4 +4,4 @@ __license__ = "MPL 2.0" __title__ = "gersemi" __url__ = "https://github.com/BlankSpruce/gersemi" -__version__ = "0.2.0" +__version__ = "0.2.1" diff --git a/gersemi/command_invocation_dumpers/argument_aware_command_invocation_dumper.py b/gersemi/command_invocation_dumpers/argument_aware_command_invocation_dumper.py index fa6cf79..7af5785 100644 --- a/gersemi/command_invocation_dumpers/argument_aware_command_invocation_dumper.py +++ b/gersemi/command_invocation_dumpers/argument_aware_command_invocation_dumper.py @@ -67,7 +67,11 @@ def _split_by_keywords(self, arguments: Nodes) -> Tuple[Iterator[Nodes], Nodes]: groups += [[argument]] elif is_one_of_one_value_keywords(argument): groups += [pop_all(accumulator)] - groups += [[argument, next(iterator)]] + next_argument = next(iterator, None) + if next_argument is None: + groups += [[argument]] + else: + groups += [[argument, next_argument]] elif is_one_of_multi_value_keywords(argument): groups += [pop_all(accumulator)] accumulator = [argument] diff --git a/tests/formatter/missing_value_for_one_value_keyword_is_not_an_error.in.cmake b/tests/formatter/missing_value_for_one_value_keyword_is_not_an_error.in.cmake new file mode 100644 index 0000000..66d8aca --- /dev/null +++ b/tests/formatter/missing_value_for_one_value_keyword_is_not_an_error.in.cmake @@ -0,0 +1,3 @@ +try_compile(FOO BAR BAZ OUTPUT_VARIABLE) + +try_compile(FOO__________________________________________________ BAR__________________________________________________ BAZ__________________________________________________ OUTPUT_VARIABLE) diff --git a/tests/formatter/missing_value_for_one_value_keyword_is_not_an_error.out.cmake b/tests/formatter/missing_value_for_one_value_keyword_is_not_an_error.out.cmake new file mode 100644 index 0000000..44c38c0 --- /dev/null +++ b/tests/formatter/missing_value_for_one_value_keyword_is_not_an_error.out.cmake @@ -0,0 +1,8 @@ +try_compile(FOO BAR BAZ OUTPUT_VARIABLE) + +try_compile( + FOO__________________________________________________ + BAR__________________________________________________ + BAZ__________________________________________________ + OUTPUT_VARIABLE +)