| Index: lib/snippets.js |
| =================================================================== |
| --- a/lib/snippets.js |
| +++ b/lib/snippets.js |
| @@ -89,21 +89,26 @@ |
| { |
| let tree = []; |
| let escape = false; |
| let withinQuotes = false; |
| let unicodeEscape = null; |
| + let quotesClosed = false; |
| + |
| let call = []; |
| let argument = ""; |
| for (let character of script.trim() + ";") |
| { |
| + let afterQuotesClosed = quotesClosed; |
| + quotesClosed = false; |
| + |
| if (unicodeEscape != null) |
| { |
| unicodeEscape += character; |
| if (unicodeEscape.length == 4) |
| { |
| let codePoint = parseInt(unicodeEscape, 16); |
| if (!isNaN(codePoint)) |
| @@ -123,24 +128,27 @@ |
| } |
| else if (character == "\\") |
| { |
| escape = true; |
| } |
| else if (character == "'") |
| { |
| withinQuotes = !withinQuotes; |
| + |
| + if (!withinQuotes) |
| + quotesClosed = true; |
| } |
| else if (withinQuotes || character != ";" && !/\s/.test(character)) |
| { |
| argument += character; |
| } |
| else |
| { |
| - if (argument) |
| + if (argument || afterQuotesClosed) |
| { |
| call.push(argument); |
| argument = ""; |
| } |
| if (character == ";" && call.length > 0) |
| { |
| tree.push(call); |