From 5cea09d385f50d4eedc114ec1426b1f7e2a28260 Mon Sep 17 00:00:00 2001 From: Josh Johnston Date: Fri, 19 Jun 2015 21:09:12 +1000 Subject: [PATCH 1/2] added failing test case: escaped char becomes unescaped --- test/test-cases-values.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test-cases-values.js b/test/test-cases-values.js index a4775a2..2f4dd3e 100644 --- a/test/test-cases-values.js +++ b/test/test-cases-values.js @@ -52,6 +52,12 @@ module.exports = { { type: "string", value: "e\" f", stringType: "\"" } ]) ], + "strings with escaped chars": [ + "'\\f0e3'", + singleValue([ + { type: "string", value: "\\f0e3", stringType: "'" } + ]) + ], "comment": [ "item /* hello world */ item", singleValue([ From 095984b5efbff4f417cfd1ad0cd15cd9654fed2c Mon Sep 17 00:00:00 2001 From: Josh Johnston Date: Fri, 19 Jun 2015 21:09:42 +1000 Subject: [PATCH 2/2] fix failing test with stricter string unescaping --- lib/parseValues.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parseValues.js b/lib/parseValues.js index cc4dc53..ff125da 100644 --- a/lib/parseValues.js +++ b/lib/parseValues.js @@ -23,7 +23,7 @@ function endSpacingMatch(match) { } function unescapeString(content) { - return content.replace(/\\./g, function(escaped) { + return content.replace(/\\['"\(\)]/g, function(escaped) { return escaped.substr(1); }); }