Skip to content

Commit

Permalink
Don't treat missing value of one value keyword as an error
Browse files Browse the repository at this point in the history
Since missing value might lead to StopIteration exception for now
let's just allow that value to be missing. Previously it'd stop
formating of remaining files in the batch. More details: PEP 479

Although it's an issue with incorrect CMake code rather than
parsing/formatting such code nevertheless it'd be more of an annoyance
in that case
  • Loading branch information
BlankSpruce committed Jun 20, 2020
1 parent 858e079 commit c21aa20
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion gersemi/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
__license__ = "MPL 2.0"
__title__ = "gersemi"
__url__ = "https://github.com/BlankSpruce/gersemi"
__version__ = "0.2.0"
__version__ = "0.2.1"
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
try_compile(FOO BAR BAZ OUTPUT_VARIABLE)

try_compile(FOO__________________________________________________ BAR__________________________________________________ BAZ__________________________________________________ OUTPUT_VARIABLE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
try_compile(FOO BAR BAZ OUTPUT_VARIABLE)

try_compile(
FOO__________________________________________________
BAR__________________________________________________
BAZ__________________________________________________
OUTPUT_VARIABLE
)

0 comments on commit c21aa20

Please sign in to comment.