From e1442cfe0521497b59a8204eb1e4d6c4202d42b9 Mon Sep 17 00:00:00 2001 From: Stephen Sugden Date: Thu, 17 Oct 2013 18:10:57 -0700 Subject: [PATCH] Update algo description --- index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 7ecd705..9f2571b 100644 --- a/index.js +++ b/index.js @@ -62,14 +62,13 @@ function parse (s, env) { // // 1. inside single quotes, all characters are printed literally. // 2. inside double quotes, all characters are printed literally - // except variables prefixed by '$' and double quotes prefixed by - // a backslash. - // 3. outside of any quotes, backslashes are not printed unless they - // are escaped. + // except variables prefixed by '$' and backslashes followed by + // either a double quote or another backslash. + // 3. outside of any quotes, backslashes are treated as escape + // characters and not printed (unless they are themselves escaped) // 4. quote context can switch mid-token if there is no whitespace // between the two quote contexts (e.g. all'one'"token" parses as // "allonetoken") - var SQ = "'"; var DQ = '"'; var BS = '\\';