Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
812 bytes
|
Line | |
---|
1 | var TYPE = require('../../tokenizer').TYPE;
|
---|
2 |
|
---|
3 | var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
---|
4 | var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
---|
5 |
|
---|
6 | module.exports = {
|
---|
7 | name: 'Parentheses',
|
---|
8 | structure: {
|
---|
9 | children: [[]]
|
---|
10 | },
|
---|
11 | parse: function(readSequence, recognizer) {
|
---|
12 | var start = this.scanner.tokenStart;
|
---|
13 | var children = null;
|
---|
14 |
|
---|
15 | this.eat(LEFTPARENTHESIS);
|
---|
16 |
|
---|
17 | children = readSequence.call(this, recognizer);
|
---|
18 |
|
---|
19 | if (!this.scanner.eof) {
|
---|
20 | this.eat(RIGHTPARENTHESIS);
|
---|
21 | }
|
---|
22 |
|
---|
23 | return {
|
---|
24 | type: 'Parentheses',
|
---|
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.