From ae0589ef2b64a70877da727c3debd4816c495b6e Mon Sep 17 00:00:00 2001
From: LaplongeJunior <laplongejunior@gmail.com>
Date: Thu, 11 Jun 2020 14:13:30 +0000
Subject: [PATCH] Fixed parsing of an external variable according to tests
 explained in issue #5

---
 jsonparser.gs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/jsonparser.gs b/jsonparser.gs
index 5164e74..65f194a 100644
--- a/jsonparser.gs
+++ b/jsonparser.gs
@@ -251,7 +251,10 @@ Parser._parseNumber = function()
 		if "0123456789+-.eE".indexOf(c) == null then break
 		self._p = self._p + 1
 	end while
-	result = val(self.source[startPos : self._p])
+	// In original source, operation was
+	//result = val(self.source[startPos : self._p])
+	// However, it had the side-effect of using the "val" variable from the calling script!
+	result = self.source[startPos : self._p].val
 	return result
 end function
 
-- 
GitLab