Skip to content

Commit

Permalink
finally passing all the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Apr 15, 2013
1 parent 8467961 commit efa4084
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ exports.parse = function parse (s, env) {
;
}
else return s
.replace(/(^|[^\\])\$(\w+)/g, getVar)
.replace(/(^|[^\\])\${(\w+)}/g, getVar)
.replace(/(['"])((\\\1|[^\1])*?)\1/, function (s, q) {
return parse(s, env);
.replace(/(['"])((\\\1|[^\1])*?)\1|[^'"]+/g, function (s, q) {
if (/^['"]/.test(s)) return parse(s, env);
return s
.replace(/(^|[^\\])\$(\w+)/g, getVar)
.replace(/(^|[^\\])\${(\w+)}/g, getVar)
.replace(/\\([ "'\\$`(){}!#&*|])/g, '$1')
;
})
.replace(/\\([ "'\\$`(){}!#&*|])/g, '$1')
;
});

Expand Down

0 comments on commit efa4084

Please sign in to comment.