Skip to content

Commit c204656

Browse files
authoredMar 25, 2018
Merge pull request #9 from danez/update-snapdragon
Update snapdragon to 0.11
2 parents cc56339 + 8219034 commit c204656

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed
 

‎lib/compilers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = function(brackets) {
4242
*/
4343

4444
.set('bracket', function(node) {
45-
return this.mapVisit(node.nodes);
45+
return this.mapVisit(node);
4646
})
4747
.set('bracket.open', function(node) {
4848
return this.emit(node.val, node);

‎lib/parsers.js

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
var utils = require('./utils');
4-
var define = require('define-property');
54

65
/**
76
* Text regex
@@ -19,7 +18,7 @@ function parsers(brackets) {
1918
brackets.parser.sets.bracket = brackets.parser.sets.bracket || [];
2019
brackets.parser
2120

22-
.capture('escape', function() {
21+
.set('escape', function() {
2322
if (this.isInside('bracket')) return;
2423
var pos = this.position();
2524
var m = this.match(/^\\(.)/);
@@ -35,7 +34,7 @@ function parsers(brackets) {
3534
* Text parser
3635
*/
3736

38-
.capture('text', function() {
37+
.set('text', function() {
3938
if (this.isInside('bracket')) return;
4039
var pos = this.position();
4140
var m = this.match(not);
@@ -51,7 +50,7 @@ function parsers(brackets) {
5150
* POSIX character classes: "[[:alpha:][:digits:]]"
5251
*/
5352

54-
.capture('posix', function() {
53+
.set('posix', function() {
5554
var pos = this.position();
5655
var m = this.match(/^\[:(.*?):\](?=.*\])/);
5756
if (!m) return;
@@ -73,13 +72,13 @@ function parsers(brackets) {
7372
* Bracket (noop)
7473
*/
7574

76-
.capture('bracket', function() {})
75+
.set('bracket', function() {})
7776

7877
/**
7978
* Open: '['
8079
*/
8180

82-
.capture('bracket.open', function() {
81+
.set('bracket.open', function() {
8382
var parsed = this.parsed;
8483
var pos = this.position();
8584
var m = this.match(/^\[(?=.*\])/);
@@ -110,20 +109,19 @@ function parsers(brackets) {
110109

111110
var node = pos({
112111
type: 'bracket',
113-
nodes: [open]
112+
nodes: []
114113
});
115114

116-
define(node, 'parent', prev);
117-
define(open, 'parent', node);
118115
this.push('bracket', node);
119-
prev.nodes.push(node);
116+
this.pushNode(node, prev);
117+
this.pushNode(open, node);
120118
})
121119

122120
/**
123121
* Bracket text
124122
*/
125123

126-
.capture('bracket.inner', function() {
124+
.set('bracket.inner', function() {
127125
if (!this.isInside('bracket')) return;
128126
var pos = this.position();
129127
var m = this.match(not);
@@ -161,7 +159,7 @@ function parsers(brackets) {
161159
* Close: ']'
162160
*/
163161

164-
.capture('bracket.close', function() {
162+
.set('bracket.close', function() {
165163
var parsed = this.parsed;
166164
var pos = this.position();
167165
var m = this.match(/^\]/);
@@ -201,8 +199,7 @@ function parsers(brackets) {
201199
return node;
202200
}
203201

204-
bracket.nodes.push(node);
205-
define(node, 'parent', bracket);
202+
this.pushNode(node, bracket);
206203
});
207204
}
208205

‎package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@
2727
"test": "mocha"
2828
},
2929
"dependencies": {
30-
"debug": "^2.3.3",
31-
"define-property": "^0.2.5",
32-
"extend-shallow": "^2.0.1",
33-
"posix-character-classes": "^0.1.0",
30+
"debug": "^3.1.0",
31+
"extend-shallow": "^3.0.2",
32+
"posix-character-classes": "^1.0.0",
3433
"regex-not": "^1.0.0",
35-
"snapdragon": "^0.8.1",
34+
"snapdragon": "^0.11.3",
3635
"to-regex": "^3.0.1"
3736
},
3837
"devDependencies": {

‎test/wildmatch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe('original wildmatch', function() {
1313
assert(match.isMatch('a-b', 'a[]-]b'));
1414
assert(match.isMatch('a]b', 'a[]-]b'));
1515
assert(match.isMatch('a]b', 'a[]]b'));
16+
assert(match.isMatch('a[]b', 'a[]b'));
1617
assert(match.isMatch('aab', 'a[]a-]b'));
1718
assert(match.isMatch('ten', 't[a-g]n'));
1819
assert(match.isMatch('ton', 't[!a-g]n'));
@@ -102,7 +103,6 @@ describe('original wildmatch', function() {
102103
assert(!match.isMatch('\\]', '[\\]]'));
103104
assert(!match.isMatch(']', '[\\\\-^]'));
104105
assert(!match.isMatch('^', '[]-a]'));
105-
assert(!match.isMatch('a[]b', 'a[]b'));
106106
assert(!match.isMatch('ab', '[!'));
107107
assert(!match.isMatch('ab', '[-'));
108108
assert(!match.isMatch('ab', 'a[]b'));

0 commit comments

Comments
 (0)
Please sign in to comment.