From 33f4cecbbf92a1740d5b7d664a9ee106cb07922e Mon Sep 17 00:00:00 2001 From: Pekka Laiho Date: Sat, 5 Dec 2020 14:53:21 +0700 Subject: [PATCH] improve error from unterminated string --- src/Tokenizer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Tokenizer.php b/src/Tokenizer.php index 5afaa2b..6b97d9c 100644 --- a/src/Tokenizer.php +++ b/src/Tokenizer.php @@ -84,14 +84,14 @@ class Tokenizer $addCurrent(); // Check for errors - if ($parens[0] != 0) { + if ($isString) { + throw new MadLispException("unterminated string"); + } elseif ($parens[0] != 0) { throw new MadLispException("missing closing )"); } elseif ($parens[1] != 0) { throw new MadLispException("missing closing ]"); } elseif ($parens[2] != 0) { throw new MadLispException("missing closing }"); - } elseif ($isString) { - throw new MadLispException("unterminated string"); } return $tokens;