Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | var TYPE = require('../../tokenizer').TYPE;
|
---|
2 |
|
---|
3 | var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
---|
4 |
|
---|
5 | // <function-token> <sequence> )
|
---|
6 | module.exports = {
|
---|
7 | name: 'Function',
|
---|
8 | structure: {
|
---|
9 | name: String,
|
---|
10 | children: [[]]
|
---|
11 | },
|
---|
12 | parse: function(readSequence, recognizer) {
|
---|
13 | var start = this.scanner.tokenStart;
|
---|
14 | var name = this.consumeFunctionName();
|
---|
15 | var nameLowerCase = name.toLowerCase();
|
---|
16 | var children;
|
---|
17 |
|
---|
18 | children = recognizer.hasOwnProperty(nameLowerCase)
|
---|
19 | ? recognizer[nameLowerCase].call(this, recognizer)
|
---|
20 | : readSequence.call(this, recognizer);
|
---|
21 |
|
---|
22 | if (!this.scanner.eof) {
|
---|
23 | this.eat(RIGHTPARENTHESIS);
|
---|
24 | }
|
---|
25 |
|
---|
26 | return {
|
---|
27 | type: 'Function',
|
---|
28 | loc: this.getLocation(start, this.scanner.tokenStart),
|
---|
29 | name: name,
|
---|
30 | children: children
|
---|
31 | };
|
---|
32 | },
|
---|
33 | generate: function(node) {
|
---|
34 | this.chunk(node.name);
|
---|
35 | this.chunk('(');
|
---|
36 | this.children(node);
|
---|
37 | this.chunk(')');
|
---|
38 | },
|
---|
39 | walkContext: 'function'
|
---|
40 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.