Index: lib/snippets.js |
=================================================================== |
--- a/lib/snippets.js |
+++ b/lib/snippets.js |
@@ -109,16 +109,17 @@ |
let withinQuotes = false; |
let unicodeEscape = null; |
let quotesClosed = false; |
let call = []; |
let argument = ""; |
+ let name = null; |
for (let character of script.trim() + ";") |
{ |
let afterQuotesClosed = quotesClosed; |
quotesClosed = false; |
if (unicodeEscape != null) |
{ |
@@ -150,23 +151,36 @@ |
{ |
withinQuotes = !withinQuotes; |
if (!withinQuotes) |
quotesClosed = true; |
} |
else if (withinQuotes || character != ";" && !/\s/.test(character)) |
{ |
- argument += character; |
+ if (!withinQuotes && character == "=" && name == null && call.length > 0) |
+ { |
+ name = argument; |
+ argument = ""; |
+ } |
+ else |
+ { |
+ argument += character; |
+ } |
} |
else |
{ |
- if (argument || afterQuotesClosed) |
+ if (name || argument || afterQuotesClosed) |
{ |
- call.push(argument); |
+ if (name != null) |
+ call[name] = argument; |
+ else |
+ call.push(argument); |
+ |
+ name = null; |
argument = ""; |
} |
if (character == ";" && call.length > 0) |
{ |
tree.push(call); |
call = []; |
} |