Skip to content

Commit e3e9ac1

Browse files
author
James Halliday
committed
now passing all the single-char op tests
1 parent 710bb24 commit e3e9ac1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ exports.quote = function (xs) {
1515
var CONTROL = '(?:' + [
1616
'\\|\\|', '\\&\\&', ';;', '\\|\\&', '[&;()|]'
1717
].join('|') + ')';
18-
var META = '[|&;()<> \\t]';
18+
var META = '|&;()<> \\t';
1919

2020
exports.parse = function parse (s, env) {
2121
var chunker = new RegExp([
2222
'([\'"])((\\\\\\1|[^\\1])*?)\\1', // quotes
23-
'(\\\\' + META + '|[^\\s&|])+', // barewords
23+
'(\\\\[' + META + ']|[^\\s' + META + '])+', // barewords
2424
'(' + CONTROL + ')' // control chars
2525
].join('|'), 'g');
2626
var match = s.match(chunker);
@@ -41,7 +41,7 @@ exports.parse = function parse (s, env) {
4141
.replace(/\\([ "'\\$`(){}!#&*|])/g, '$1')
4242
;
4343
}
44-
else if (/^[&|]$/.test(s)) {
44+
else if (RegExp('^[' + META + ']$').test(s)) {
4545
return { op: s };
4646
}
4747
else return s.replace(

0 commit comments

Comments
 (0)