|
1 | 1 | var rd = require('./rd_parser'); |
2 | 2 |
|
3 | | -function PEGJS_visitor(){} |
4 | | - |
5 | | -PEGJS_visitor.visit = function(node) { |
6 | | - return this[node.type](node); |
7 | | -}; |
8 | | -PEGJS_visitor.prototype.string = function(node) { |
9 | | - return node.match; |
10 | | -}; |
11 | | -PEGJS_visitor.prototype.regex_char = function(node) { |
12 | | - return node.match; |
13 | | -}; |
14 | | -PEGJS_visitor.prototype.sequence = function(node) { |
15 | | - return node.children.map(function(child) { return this.visit(child); }); |
16 | | -}; |
17 | | -PEGJS_visitor.prototype.ordered_choice = function(node) { |
18 | | - return node.children.map(function(child) { return this.visit(child); }); |
19 | | -}; |
20 | | -PEGJS_visitor.prototype.zero_or_more = function(node) { |
21 | | - return node.children.map(function(child) { return this.visit(child); }); |
22 | | -}; |
23 | | -PEGJS_visitor.prototype.one_or_more = function(node) { |
24 | | - return node.children.map(function(child) { return this.visit(child); }); |
25 | | -}; |
26 | | -PEGJS_visitor.prototype.optional = function(node) { |
27 | | - return node.children.map(function(child) { return this.visit(child); }); |
28 | | -}; |
29 | | -PEGJS_visitor.prototype.and_predicate = function(node) { |
30 | | - return null; |
31 | | -}; |
32 | | -PEGJS_visitor.prototype.not_predicate = function(node) { |
33 | | - return null; |
34 | | -}; |
35 | | -PEGJS_visitor.prototype.end_of_file = function(node) { |
36 | | - return null; |
37 | | -}; |
38 | | - |
39 | 3 | function SPEG_actions_visitor() { |
40 | 4 | this.actions = new SPEG_actions(); |
41 | 5 | } |
@@ -145,6 +109,5 @@ SPEG_actions.prototype.parsing_end_of_file = function(node) { |
145 | 109 | }; |
146 | 110 |
|
147 | 111 | module.exports = { |
148 | | - SPEG_actions_visitor: SPEG_actions_visitor, |
149 | | - PEGJS_visitor: PEGJS_visitor |
| 112 | + SPEG_actions_visitor: SPEG_actions_visitor |
150 | 113 | }; |
0 commit comments