aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mparser.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-07-08 11:48:49 -0700
committerEli Schwartz <eschwartz93@gmail.com>2023-01-03 14:49:02 -0500
commit8f9c6c10c4ec1fffd48a255320f4cbbb67496033 (patch)
treea75bf55cd9f95022a515ed0dac4df9f8d4524c9c /mesonbuild/mparser.py
parent7460ab20cd42d79a3394a81f103228b1337aff34 (diff)
downloadmeson-8f9c6c10c4ec1fffd48a255320f4cbbb67496033.zip
meson-8f9c6c10c4ec1fffd48a255320f4cbbb67496033.tar.gz
meson-8f9c6c10c4ec1fffd48a255320f4cbbb67496033.tar.bz2
mparser: Don't create an exception to pass to mlog.warning
Just call `mlog.code_line` directly, since the exception is never raised.
Diffstat (limited to 'mesonbuild/mparser.py')
-rw-r--r--mesonbuild/mparser.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py
index 98f530f..6bb08a7 100644
--- a/mesonbuild/mparser.py
+++ b/mesonbuild/mparser.py
@@ -193,11 +193,10 @@ class Lexer:
elif tid in {'string', 'fstring'}:
# Handle here and not on the regexp to give a better error message.
if match_text.find("\n") != -1:
- msg = ParseException("Newline character in a string detected, use ''' (three single quotes) "
- "for multiline strings instead.\n"
- "This will become a hard error in a future Meson release.",
- self.getline(line_start), lineno, col)
- mlog.warning(msg, location=BaseNode(lineno, col, filename))
+ msg = ("Newline character in a string detected, use ''' (three single quotes) "
+ "for multiline strings instead.\n"
+ "This will become a hard error in a future Meson release.")
+ mlog.warning(mlog.code_line(msg, self.getline(line_start), col), location=BaseNode(lineno, col, filename))
value = match_text[2 if tid == 'fstring' else 1:-1]
try:
value = ESCAPE_SEQUENCE_SINGLE_RE.sub(decode_match, value)