aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>2018-02-18 17:18:51 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2018-02-20 00:20:58 +0200
commit37b702e9aa4255e1d0c5fa706e52842877cf01b3 (patch)
tree00de794330f4f6e9c0da910f68f0cb4511163386 /mesonbuild
parentaeee01f6392de9089b459d38ac077d8f9fa0e010 (diff)
downloadmeson-37b702e9aa4255e1d0c5fa706e52842877cf01b3.zip
meson-37b702e9aa4255e1d0c5fa706e52842877cf01b3.tar.gz
meson-37b702e9aa4255e1d0c5fa706e52842877cf01b3.tar.bz2
Fail if singleline string has multiple lines
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/mparser.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py
index 94d56e5..2db3375 100644
--- a/mesonbuild/mparser.py
+++ b/mesonbuild/mparser.py
@@ -141,6 +141,9 @@ class Lexer:
elif tid == 'dblquote':
raise ParseException('Double quotes are not supported. Use single quotes.', self.getline(line_start), lineno, col)
elif tid == 'string':
+ # Handle here and not on the regexp to give a better error message.
+ if match_text.find("\n") != -1:
+ raise ParseException("Use ''' (three single quotes) for multiline strings.", self.getline(line_start), lineno, col)
value = match_text[1:-1].replace(r"\'", "'")
value = newline_rx.sub(r'\1\n', value)
value = value.replace(r" \\ ".strip(), r" \ ".strip())