diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-12-14 15:03:20 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-01-03 14:49:02 -0500 |
commit | 7460ab20cd42d79a3394a81f103228b1337aff34 (patch) | |
tree | f7766f176a148174c62e1a4af55a4831267627d1 /mesonbuild/mparser.py | |
parent | b9ef66292602349c7a48d8779355bdc87cfc06fa (diff) | |
download | meson-7460ab20cd42d79a3394a81f103228b1337aff34.zip meson-7460ab20cd42d79a3394a81f103228b1337aff34.tar.gz meson-7460ab20cd42d79a3394a81f103228b1337aff34.tar.bz2 |
mlog: move code for printing code with a caret to the mlog module
We need this outside the constructor for the ParseException class, so
let's pull it out. mlog seemed like a good place since it's a text
formatting function, and has no dependencies.
Diffstat (limited to 'mesonbuild/mparser.py')
-rw-r--r-- | mesonbuild/mparser.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index 6b49365..98f530f 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -47,7 +47,7 @@ def decode_match(match: T.Match[str]) -> str: class ParseException(MesonException): def __init__(self, text: str, line: str, lineno: int, colno: int) -> None: # Format as error message, followed by the line with the error, followed by a caret to show the error column. - super().__init__("{}\n{}\n{}".format(text, line, '{}^'.format(' ' * colno))) + super().__init__(mlog.code_line(text, line, colno)) self.lineno = lineno self.colno = colno |