From 88095a6fd0357a19ddb407b70e301be826c6bb46 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Sun, 23 Jun 2024 15:27:20 +0000 Subject: Try to match error messages with CWEB. We could (a) calculate the distance of a mismatch and print "! Hmm... N of the preceeding lines failed to match." (b) issue a warning/error about a missing @z. git-svn-id: svn://tug.org/texlive/trunk@71598 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/tests/fix-changefile-lines.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'Build/source/texk/web2c') diff --git a/Build/source/texk/web2c/tests/fix-changefile-lines.py b/Build/source/texk/web2c/tests/fix-changefile-lines.py index 6a40e5127f5..1f763fbda99 100755 --- a/Build/source/texk/web2c/tests/fix-changefile-lines.py +++ b/Build/source/texk/web2c/tests/fix-changefile-lines.py @@ -127,9 +127,7 @@ class ChangeReader: while True: self._pos += 1 if self._pos >= len(self._lines): - eprint( - f"ERROR: Missing @y for @x on l.{self._chunk_start + 1} in change file" - ) + eprint(f"! Change file ended before @y. (l. {self._pos+1} of change file)") sys.exit(1) line = self._lines[self._pos] if line.startswith("@y"): @@ -137,6 +135,10 @@ class ChangeReader: self._chunk_start + 1 : self._pos ] return True + elif line.startswith("@x") or line.startswith("@z"): + eprint(f"! Where is the matching @y?. (l. {self._pos+1} of change file)") + eprint(line) + sys.exit(1) self._pos += 1 return False @@ -149,8 +151,8 @@ class ChangeReader: try: (part, section, line_number), tex_line = web_reader.next_line() except: - eprint("ERROR: Could not find match for line:") - eprint(f" {self._match_lines[0]}") + eprint(f"! Change file entry did not match. (l. {self._chunk_start+2} of change file)") + eprint(self._match_lines[0]) sys.exit(1) if tex_line == self._match_lines[0]: for i in range(1, len(self._match_lines)): @@ -159,8 +161,8 @@ class ChangeReader: except: tex_line = None if tex_line is None or tex_line != self._match_lines[i]: - eprint("ERROR: Could not match all lines following match line:") - eprint(f" {self._match_lines[0]}") + eprint(f"! Change file entry did not match. (l. {self._chunk_start+2+i} of change file)") + eprint(self._match_lines[i]) sys.exit(1) return part, section, line_number -- cgit v1.2.3