Created
October 21, 2016 22:15
-
-
Save jonschlinkert/099c8914f56529f75bc757cc9e5e8e2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mm = require('micromatch'); | |
var ast = mm.parse('*(*(of*(a)x)z)', {sourcemap: true}); | |
console.log(ast); | |
// results in: | |
{ type: 'root', | |
errors: [], | |
nodes: | |
[ { type: 'bos', val: '' }, | |
{ type: 'paren', | |
prefix: '*', | |
nodes: | |
[ { type: 'paren.open', parsed: '', val: '*(' }, | |
{ type: 'paren', | |
prefix: '*', | |
nodes: | |
[ { type: 'paren.open', parsed: '*(', val: '*(' }, | |
{ type: 'text', val: 'of' }, | |
{ type: 'paren', | |
prefix: '*', | |
nodes: | |
[ { type: 'paren.open', parsed: '*(*(of', val: '*(' }, | |
{ type: 'text', val: 'a' }, | |
{ type: 'paren.close', | |
rest: 'x)z)', | |
parsed: '*(*(of*(a', | |
val: ')', | |
prefix: '*' } ] }, | |
{ type: 'text', val: 'x' }, | |
{ type: 'paren.close', | |
rest: 'z)', | |
parsed: '*(*(of*(a)x', | |
val: ')', | |
prefix: '*' } ] }, | |
{ type: 'text', val: 'z' }, | |
{ type: 'paren.close', | |
rest: '', | |
parsed: '*(*(of*(a)x)z', | |
val: ')', | |
prefix: '*' } ] }, | |
{ type: 'eos', val: '' } ], | |
input: '*(*(of*(a)x)z)' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment