Skip to content

Commit

Permalink
Update snapdragon to 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Mar 21, 2018
1 parent cc56339 commit 8219034
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/compilers.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function(brackets) {
*/

.set('bracket', function(node) {
return this.mapVisit(node.nodes);
return this.mapVisit(node);
})
.set('bracket.open', function(node) {
return this.emit(node.val, node);
Expand Down
25 changes: 11 additions & 14 deletions lib/parsers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

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

/**
* Text regex
Expand All @@ -19,7 +18,7 @@ function parsers(brackets) {
brackets.parser.sets.bracket = brackets.parser.sets.bracket || [];
brackets.parser

.capture('escape', function() {
.set('escape', function() {
if (this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(/^\\(.)/);
Expand All @@ -35,7 +34,7 @@ function parsers(brackets) {
* Text parser
*/

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

.capture('posix', function() {
.set('posix', function() {
var pos = this.position();
var m = this.match(/^\[:(.*?):\](?=.*\])/);
if (!m) return;
Expand All @@ -73,13 +72,13 @@ function parsers(brackets) {
* Bracket (noop)
*/

.capture('bracket', function() {})
.set('bracket', function() {})

/**
* Open: '['
*/

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

var node = pos({
type: 'bracket',
nodes: [open]
nodes: []
});

define(node, 'parent', prev);
define(open, 'parent', node);
this.push('bracket', node);
prev.nodes.push(node);
this.pushNode(node, prev);
this.pushNode(open, node);
})

/**
* Bracket text
*/

.capture('bracket.inner', function() {
.set('bracket.inner', function() {
if (!this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(not);
Expand Down Expand Up @@ -161,7 +159,7 @@ function parsers(brackets) {
* Close: ']'
*/

.capture('bracket.close', function() {
.set('bracket.close', function() {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^\]/);
Expand Down Expand Up @@ -201,8 +199,7 @@ function parsers(brackets) {
return node;
}

bracket.nodes.push(node);
define(node, 'parent', bracket);
this.pushNode(node, bracket);
});
}

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@
"test": "mocha"
},
"dependencies": {
"debug": "^2.3.3",
"define-property": "^0.2.5",
"extend-shallow": "^2.0.1",
"posix-character-classes": "^0.1.0",
"debug": "^3.1.0",
"extend-shallow": "^3.0.2",
"posix-character-classes": "^1.0.0",
"regex-not": "^1.0.0",
"snapdragon": "^0.8.1",
"snapdragon": "^0.11.3",
"to-regex": "^3.0.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/wildmatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('original wildmatch', function() {
assert(match.isMatch('a-b', 'a[]-]b'));
assert(match.isMatch('a]b', 'a[]-]b'));
assert(match.isMatch('a]b', 'a[]]b'));
assert(match.isMatch('a[]b', 'a[]b'));
assert(match.isMatch('aab', 'a[]a-]b'));
assert(match.isMatch('ten', 't[a-g]n'));
assert(match.isMatch('ton', 't[!a-g]n'));
Expand Down Expand Up @@ -102,7 +103,6 @@ describe('original wildmatch', function() {
assert(!match.isMatch('\\]', '[\\]]'));
assert(!match.isMatch(']', '[\\\\-^]'));
assert(!match.isMatch('^', '[]-a]'));
assert(!match.isMatch('a[]b', 'a[]b'));
assert(!match.isMatch('ab', '[!'));
assert(!match.isMatch('ab', '[-'));
assert(!match.isMatch('ab', 'a[]b'));
Expand Down

0 comments on commit 8219034

Please sign in to comment.