-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathtiny-globs.js
More file actions
50 lines (41 loc) · 843 Bytes
/
Copy pathtiny-globs.js
File metadata and controls
50 lines (41 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict';
var Snapdragon = require('..');
var Snapdragon = new Snapdragon();
/**
* 1
*/
// var parser = new Parser();
// console.log(parser.parse('foo/*.js'));
/**
* 2
*/
snapdragon.parser
.set('text', function() {
var pos = this.position();
var m = this.match(/^\w+/);
if (m) {
return pos(this.node(m[0]));
}
})
.set('slash', function() {
var pos = this.position();
var m = this.match(/^\//);
if (m) {
return pos(this.node(m[0]));
}
})
.set('star', function() {
var pos = this.position();
var m = this.match(/^\*/);
if (m) {
return pos(this.node(m[0]));
}
})
.set('dot', function() {
var pos = this.position();
var m = this.match(/^\./);
if (m) {
return pos(this.node(m[0]));
}
});
console.log(parser.parse('foo/*.js'));