From 312e1aeda5951f3f45a951d28c7aff50f1809a8d Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Thu, 24 Oct 2024 21:21:39 -0400 Subject: [PATCH] Updated hack to adapt for custom connective behavior --- parse_magic.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/parse_magic.py b/parse_magic.py index 25fc6f1..4254d5f 100644 --- a/parse_magic.py +++ b/parse_magic.py @@ -229,10 +229,13 @@ def parse_size(infile: SourceFile, first_run: bool) -> Optional[int]: """ Parse the line representing the matrix size. """ + size = int(next(infile)) - # HACK: The first size line may be -1 due to a bug. Skip it - if size == -1 and first_run: - size = int(next(infile)) + # HACK: When necessitation and custom connectives are enabled + # MaGIC may produce -1s at the beginning of the file + if first_run: + while size == -1: + size = int(next(infile)) if size == -1: return None