Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
818 bytes
|
Line | |
---|
1 | var TYPE = require('../../tokenizer').TYPE;
|
---|
2 |
|
---|
3 | var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
---|
4 | var RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;
|
---|
5 |
|
---|
6 | module.exports = {
|
---|
7 | name: 'Brackets',
|
---|
8 | structure: {
|
---|
9 | children: [[]]
|
---|
10 | },
|
---|
11 | parse: function(readSequence, recognizer) {
|
---|
12 | var start = this.scanner.tokenStart;
|
---|
13 | var children = null;
|
---|
14 |
|
---|
15 | this.eat(LEFTSQUAREBRACKET);
|
---|
16 |
|
---|
17 | children = readSequence.call(this, recognizer);
|
---|
18 |
|
---|
19 | if (!this.scanner.eof) {
|
---|
20 | this.eat(RIGHTSQUAREBRACKET);
|
---|
21 | }
|
---|
22 |
|
---|
23 | return {
|
---|
24 | type: 'Brackets',
|
---|
25 | loc: this.getLocation(start, this.scanner.tokenStart),
|
---|
26 | children: children
|
---|
27 | };
|
---|
28 | },
|
---|
29 | generate: function(node) {
|
---|
30 | this.chunk('[');
|
---|
31 | this.children(node);
|
---|
32 | this.chunk(']');
|
---|
33 | }
|
---|
34 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.