mparser: use an inherited ParseException everywhere

pull/11466/head
Eli Schwartz 2 years ago
parent 774212e738
commit 9423631b76
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 6
      mesonbuild/mparser.py

@ -47,7 +47,7 @@ class ParseException(MesonException):
self.lineno = lineno self.lineno = lineno
self.colno = colno self.colno = colno
class BlockParseException(MesonException): class BlockParseException(ParseException):
def __init__( def __init__(
self, self,
text: str, text: str,
@ -67,7 +67,7 @@ class BlockParseException(MesonException):
# Followed by a caret to show the block start # Followed by a caret to show the block start
# Followed by underscores # Followed by underscores
# Followed by a caret to show the block end. # Followed by a caret to show the block end.
super().__init__("{}\n{}\n{}".format(text, line, '{}^{}^'.format(' ' * start_colno, '_' * (colno - start_colno - 1)))) MesonException.__init__(self, "{}\n{}\n{}".format(text, line, '{}^{}^'.format(' ' * start_colno, '_' * (colno - start_colno - 1))))
else: else:
# If block start and end are on different lines, it is formatted as: # If block start and end are on different lines, it is formatted as:
# Error message # Error message
@ -76,7 +76,7 @@ class BlockParseException(MesonException):
# Followed by a message saying where the block started. # Followed by a message saying where the block started.
# Followed by the line of the block start. # Followed by the line of the block start.
# Followed by a caret for the block start. # Followed by a caret for the block start.
super().__init__("%s\n%s\n%s\nFor a block that started at %d,%d\n%s\n%s" % (text, line, '%s^' % (' ' * colno), start_lineno, start_colno, start_line, "%s^" % (' ' * start_colno))) MesonException.__init__(self, "%s\n%s\n%s\nFor a block that started at %d,%d\n%s\n%s" % (text, line, '%s^' % (' ' * colno), start_lineno, start_colno, start_line, "%s^" % (' ' * start_colno)))
self.lineno = lineno self.lineno = lineno
self.colno = colno self.colno = colno

Loading…
Cancel
Save