[Pkg-javascript-commits] [node-shell-quote] 44/137: labeled regex states

Bastien Roucariès rouca at moszumanska.debian.org
Fri Aug 25 19:19:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-shell-quote.

commit 8c008b223e6174d6bec098251527053e5cc1f30c
Author: James Halliday <mail at substack.net>
Date:   Mon May 13 03:03:01 2013 -0700

    labeled regex states
---
 index.js | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/index.js b/index.js
index 8f5987b..22cbf14 100644
--- a/index.js
+++ b/index.js
@@ -16,12 +16,11 @@ var CONTROL = '(?:\\|\\||\\&\\&|;;|\\|\\&[&;()|])';
 var META = '[|&;()<> \\t]';
 
 exports.parse = function parse (s, env) {
-    var chunker = new RegExp(
-        '([\'"])((\\\\\\1|[^\\1])*?)\\1'
-        + '|(\\\\' + META + '|[^\\s&|])+'
-        + '|([&|])',
-        'g'
-    );
+    var chunker = new RegExp([
+        '([\'"])((\\\\\\1|[^\\1])*?)\\1', // quotes
+        '(\\\\' + META + '|[^\\s&|])+', // barewords
+        '([&|])' // control chars
+    ].join('|'), 'g');
     var match = s.match(chunker);
     if (!match) return [];
     if (!env) env = {};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-shell-quote.git



More information about the Pkg-javascript-commits mailing list