[Pkg-javascript-commits] [node-shell-quote] 81/137: fixed the parse test, broke the op tests
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Aug 25 19:19:41 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 74d66863615a60fcb222d2279991cff3a89ff015
Author: James Halliday <mail at substack.net>
Date: Mon Jun 24 04:47:43 2013 -0700
fixed the parse test, broke the op tests
---
index.js | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/index.js b/index.js
index 3119daa..69bfb9c 100644
--- a/index.js
+++ b/index.js
@@ -19,9 +19,9 @@ var CONTROL = '(?:' + [
'\\|\\|', '\\&\\&', ';;', '\\|\\&', '[&;()|<>]'
].join('|') + ')';
var META = '|&;()<> \\t';
-var BAREWORD = '(\\\\[' + META + ']|[^\\s' + META + '])+';
-var SINGLE_QUOTE = '[^\\s\'"]*(")((\\\\"|[^"])*?)"[^\\s\'"]*';
-var DOUBLE_QUOTE = '[^\\s\'"]*(\')((\\\\\'|[^\'])*?)\'[^\\s\'"]*';
+var BAREWORD = '(\\\\[\'"' + META + ']|[^\\s\'"' + META + '])+';
+var SINGLE_QUOTE = '"((\\\\"|[^"])*?)"';
+var DOUBLE_QUOTE = '\'((\\\\\'|[^\'])*?)\'';
var TOKEN = '';
for (var i = 0; i < 4; i++) {
@@ -46,12 +46,11 @@ exports.parse = function (s, env) {
function parse (s, env) {
var chunker = new RegExp([
- SINGLE_QUOTE,
- DOUBLE_QUOTE,
- BAREWORD,
+ '(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')*',
'(' + CONTROL + ')' // control chars
].join('|'), 'g');
- var match = s.match(chunker);
+ var match = s.match(chunker).filter(Boolean);
+
if (!match) return [];
if (!env) env = {};
return match.map(function (s) {
--
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