rkelly 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. data/CHANGELOG.txt +7 -0
  2. data/Manifest.txt +199 -0
  3. data/README.txt +58 -0
  4. data/Rakefile +85 -0
  5. data/lib/parser.y +870 -0
  6. data/lib/rkelly.rb +13 -0
  7. data/lib/rkelly/constants.rb +3 -0
  8. data/lib/rkelly/generated_parser.rb +3237 -0
  9. data/lib/rkelly/js.rb +14 -0
  10. data/lib/rkelly/js/array.rb +15 -0
  11. data/lib/rkelly/js/base.rb +91 -0
  12. data/lib/rkelly/js/boolean.rb +21 -0
  13. data/lib/rkelly/js/function.rb +39 -0
  14. data/lib/rkelly/js/function_prototype.rb +15 -0
  15. data/lib/rkelly/js/global_object.rb +52 -0
  16. data/lib/rkelly/js/math.rb +10 -0
  17. data/lib/rkelly/js/nan.rb +18 -0
  18. data/lib/rkelly/js/number.rb +22 -0
  19. data/lib/rkelly/js/object.rb +30 -0
  20. data/lib/rkelly/js/object_prototype.rb +14 -0
  21. data/lib/rkelly/js/property.rb +20 -0
  22. data/lib/rkelly/js/scope.rb +6 -0
  23. data/lib/rkelly/js/string.rb +21 -0
  24. data/lib/rkelly/lexeme.rb +18 -0
  25. data/lib/rkelly/nodes.rb +5 -0
  26. data/lib/rkelly/nodes/binary_node.rb +18 -0
  27. data/lib/rkelly/nodes/bracket_accessor_node.rb +11 -0
  28. data/lib/rkelly/nodes/case_clause_node.rb +11 -0
  29. data/lib/rkelly/nodes/comma_node.rb +11 -0
  30. data/lib/rkelly/nodes/conditional_node.rb +11 -0
  31. data/lib/rkelly/nodes/dot_accessor_node.rb +11 -0
  32. data/lib/rkelly/nodes/for_in_node.rb +12 -0
  33. data/lib/rkelly/nodes/for_node.rb +13 -0
  34. data/lib/rkelly/nodes/function_call_node.rb +16 -0
  35. data/lib/rkelly/nodes/function_decl_node.rb +6 -0
  36. data/lib/rkelly/nodes/function_expr_node.rb +12 -0
  37. data/lib/rkelly/nodes/if_node.rb +12 -0
  38. data/lib/rkelly/nodes/label_node.rb +11 -0
  39. data/lib/rkelly/nodes/new_expr_node.rb +11 -0
  40. data/lib/rkelly/nodes/node.rb +88 -0
  41. data/lib/rkelly/nodes/not_strict_equal_node.rb +6 -0
  42. data/lib/rkelly/nodes/op_equal_node.rb +16 -0
  43. data/lib/rkelly/nodes/postfix_node.rb +11 -0
  44. data/lib/rkelly/nodes/prefix_node.rb +6 -0
  45. data/lib/rkelly/nodes/property_node.rb +13 -0
  46. data/lib/rkelly/nodes/resolve_node.rb +19 -0
  47. data/lib/rkelly/nodes/strict_equal_node.rb +6 -0
  48. data/lib/rkelly/nodes/try_node.rb +13 -0
  49. data/lib/rkelly/nodes/var_decl_node.rb +15 -0
  50. data/lib/rkelly/parser.rb +100 -0
  51. data/lib/rkelly/runtime.rb +36 -0
  52. data/lib/rkelly/runtime/ruby_function.rb +13 -0
  53. data/lib/rkelly/runtime/scope_chain.rb +57 -0
  54. data/lib/rkelly/token.rb +15 -0
  55. data/lib/rkelly/tokenizer.rb +122 -0
  56. data/lib/rkelly/visitable.rb +16 -0
  57. data/lib/rkelly/visitors.rb +4 -0
  58. data/lib/rkelly/visitors/dot_visitor.rb +228 -0
  59. data/lib/rkelly/visitors/ecma_visitor.rb +314 -0
  60. data/lib/rkelly/visitors/enumerable_visitor.rb +18 -0
  61. data/lib/rkelly/visitors/evaluation_visitor.rb +419 -0
  62. data/lib/rkelly/visitors/function_visitor.rb +46 -0
  63. data/lib/rkelly/visitors/pointcut_visitor.rb +31 -0
  64. data/lib/rkelly/visitors/real_sexp_visitor.rb +16 -0
  65. data/lib/rkelly/visitors/sexp_visitor.rb +373 -0
  66. data/lib/rkelly/visitors/visitor.rb +136 -0
  67. data/rkelly.gemspec +33 -0
  68. data/test/ecma_script_test_case.rb +21 -0
  69. data/test/execute_test_case.rb +16 -0
  70. data/test/execution_contexts/test_10_1_3-1.rb +32 -0
  71. data/test/expressions/test_11_3_1.rb +64 -0
  72. data/test/expressions/test_11_3_2.rb +64 -0
  73. data/test/expressions/test_11_4_2.rb +13 -0
  74. data/test/expressions/test_11_4_3.rb +52 -0
  75. data/test/expressions/test_11_4_4.rb +68 -0
  76. data/test/expressions/test_11_4_5.rb +69 -0
  77. data/test/expressions/test_11_4_6.rb +88 -0
  78. data/test/expressions/test_11_4_8.rb +28 -0
  79. data/test/expressions/test_11_4_9.rb +103 -0
  80. data/test/expressions/test_11_5_1.rb +51 -0
  81. data/test/expressions/test_11_5_2.rb +80 -0
  82. data/test/expressions/test_11_5_3.rb +88 -0
  83. data/test/expressions/test_11_6_1-1.rb +19 -0
  84. data/test/expressions/test_11_9_1.rb +19 -0
  85. data/test/function/test_15_3_1_1-1.rb +34 -0
  86. data/test/global_object/test_15_1_1_1.rb +29 -0
  87. data/test/global_object/test_15_1_1_2.rb +17 -0
  88. data/test/global_object/test_15_1_1_3.rb +9 -0
  89. data/test/helper.rb +5 -0
  90. data/test/node_test_case.rb +11 -0
  91. data/test/object/test_15_2_1_1.rb +257 -0
  92. data/test/object/test_15_2_1_2.rb +21 -0
  93. data/test/object/test_15_2_2_1.rb +52 -0
  94. data/test/statements/test_12_5-1.rb +27 -0
  95. data/test/test_add_node.rb +8 -0
  96. data/test/test_arguments_node.rb +8 -0
  97. data/test/test_array_node.rb +9 -0
  98. data/test/test_assign_expr_node.rb +8 -0
  99. data/test/test_automatic_semicolon_insertion.rb +137 -0
  100. data/test/test_bit_and_node.rb +8 -0
  101. data/test/test_bit_or_node.rb +8 -0
  102. data/test/test_bit_x_or_node.rb +8 -0
  103. data/test/test_bitwise_not_node.rb +8 -0
  104. data/test/test_block_node.rb +14 -0
  105. data/test/test_bracket_accessor_node.rb +16 -0
  106. data/test/test_break_node.rb +11 -0
  107. data/test/test_case_block_node.rb +11 -0
  108. data/test/test_case_clause_node.rb +15 -0
  109. data/test/test_comma_node.rb +13 -0
  110. data/test/test_comments.rb +44 -0
  111. data/test/test_conditional_node.rb +17 -0
  112. data/test/test_const_statement_node.rb +14 -0
  113. data/test/test_continue_node.rb +11 -0
  114. data/test/test_delete_node.rb +8 -0
  115. data/test/test_divide_node.rb +8 -0
  116. data/test/test_do_while_node.rb +13 -0
  117. data/test/test_dot_accessor_node.rb +9 -0
  118. data/test/test_ecma_visitor.rb +192 -0
  119. data/test/test_element_node.rb +8 -0
  120. data/test/test_empty_statement_node.rb +8 -0
  121. data/test/test_equal_node.rb +8 -0
  122. data/test/test_evaluation_visitor.rb +66 -0
  123. data/test/test_expression_statement_node.rb +10 -0
  124. data/test/test_false_node.rb +8 -0
  125. data/test/test_for_in_node.rb +17 -0
  126. data/test/test_for_node.rb +24 -0
  127. data/test/test_function_body_node.rb +8 -0
  128. data/test/test_function_call_node.rb +10 -0
  129. data/test/test_function_decl_node.rb +16 -0
  130. data/test/test_function_expr_node.rb +16 -0
  131. data/test/test_function_visitor.rb +26 -0
  132. data/test/test_getter_property_node.rb +10 -0
  133. data/test/test_global_object.rb +49 -0
  134. data/test/test_greater_node.rb +8 -0
  135. data/test/test_greater_or_equal_node.rb +8 -0
  136. data/test/test_if_node.rb +17 -0
  137. data/test/test_in_node.rb +8 -0
  138. data/test/test_instance_of_node.rb +8 -0
  139. data/test/test_label_node.rb +13 -0
  140. data/test/test_left_shift_node.rb +8 -0
  141. data/test/test_less_node.rb +8 -0
  142. data/test/test_less_or_equal_node.rb +8 -0
  143. data/test/test_line_number.rb +23 -0
  144. data/test/test_logical_and_node.rb +8 -0
  145. data/test/test_logical_not_node.rb +8 -0
  146. data/test/test_logical_or_node.rb +8 -0
  147. data/test/test_modulus_node.rb +8 -0
  148. data/test/test_multiply_node.rb +8 -0
  149. data/test/test_new_expr_node.rb +9 -0
  150. data/test/test_not_equal_node.rb +8 -0
  151. data/test/test_not_strict_equal_node.rb +8 -0
  152. data/test/test_null_node.rb +8 -0
  153. data/test/test_number_node.rb +8 -0
  154. data/test/test_object_literal_node.rb +9 -0
  155. data/test/test_op_and_equal_node.rb +10 -0
  156. data/test/test_op_divide_equal_node.rb +10 -0
  157. data/test/test_op_equal_node.rb +10 -0
  158. data/test/test_op_l_shift_equal_node.rb +10 -0
  159. data/test/test_op_minus_equal_node.rb +10 -0
  160. data/test/test_op_mod_equal_node.rb +10 -0
  161. data/test/test_op_multiply_equal_node.rb +10 -0
  162. data/test/test_op_or_equal_node.rb +10 -0
  163. data/test/test_op_plus_equal_node.rb +10 -0
  164. data/test/test_op_r_shift_equal_node.rb +10 -0
  165. data/test/test_op_u_r_shift_equal_node.rb +10 -0
  166. data/test/test_op_x_or_equal_node.rb +10 -0
  167. data/test/test_parameter_node.rb +8 -0
  168. data/test/test_parser.rb +1355 -0
  169. data/test/test_pointcut_visitor.rb +34 -0
  170. data/test/test_postfix_node.rb +8 -0
  171. data/test/test_prefix_node.rb +8 -0
  172. data/test/test_property_node.rb +8 -0
  173. data/test/test_regexp_node.rb +8 -0
  174. data/test/test_resolve_node.rb +22 -0
  175. data/test/test_return_node.rb +11 -0
  176. data/test/test_right_shift_node.rb +8 -0
  177. data/test/test_rkelly.rb +19 -0
  178. data/test/test_runtime.rb +12 -0
  179. data/test/test_scope_chain.rb +50 -0
  180. data/test/test_setter_property_node.rb +10 -0
  181. data/test/test_source_elements.rb +9 -0
  182. data/test/test_strict_equal_node.rb +8 -0
  183. data/test/test_string_node.rb +8 -0
  184. data/test/test_subtract_node.rb +8 -0
  185. data/test/test_switch_node.rb +12 -0
  186. data/test/test_this_node.rb +8 -0
  187. data/test/test_throw_node.rb +7 -0
  188. data/test/test_tokenizer.rb +143 -0
  189. data/test/test_true_node.rb +8 -0
  190. data/test/test_try_node.rb +59 -0
  191. data/test/test_type_of_node.rb +8 -0
  192. data/test/test_unary_minus_node.rb +8 -0
  193. data/test/test_unary_plus_node.rb +8 -0
  194. data/test/test_unsigned_right_shift_node.rb +8 -0
  195. data/test/test_var_decl_node.rb +21 -0
  196. data/test/test_var_statement_node.rb +14 -0
  197. data/test/test_void_node.rb +8 -0
  198. data/test/test_while_node.rb +15 -0
  199. data/test/test_with_node.rb +8 -0
  200. metadata +390 -0
@@ -0,0 +1,46 @@
1
+ module RKelly
2
+ module Visitors
3
+ class FunctionVisitor < Visitor
4
+ attr_reader :scope_chain
5
+ def initialize(scope)
6
+ super()
7
+ @scope_chain = scope
8
+ end
9
+
10
+ def visit_SourceElementsNode(o)
11
+ o.value.each { |x| x.accept(self) }
12
+ end
13
+
14
+ def visit_FunctionDeclNode(o)
15
+ if o.value
16
+ scope_chain[o.value].value = RKelly::JS::Function.new(o.function_body, o.arguments)
17
+ end
18
+ end
19
+
20
+ %w{
21
+ AddNode ArgumentsNode ArrayNode AssignExprNode BitAndNode BitOrNode
22
+ BitXOrNode BitwiseNotNode BlockNode BracketAccessorNode BreakNode
23
+ CaseBlockNode CaseClauseNode CommaNode ConditionalNode
24
+ ConstStatementNode ContinueNode DeleteNode DivideNode
25
+ DoWhileNode DotAccessorNode ElementNode EmptyStatementNode EqualNode
26
+ ExpressionStatementNode FalseNode ForInNode ForNode FunctionBodyNode
27
+ FunctionExprNode GetterPropertyNode GreaterNode GreaterOrEqualNode
28
+ IfNode InNode InstanceOfNode LabelNode LeftShiftNode LessNode
29
+ LessOrEqualNode LogicalAndNode LogicalNotNode LogicalOrNode ModulusNode
30
+ MultiplyNode NewExprNode NotEqualNode NotStrictEqualNode NullNode
31
+ NumberNode ObjectLiteralNode OpAndEqualNode OpDivideEqualNode
32
+ OpEqualNode OpLShiftEqualNode OpMinusEqualNode OpModEqualNode
33
+ OpMultiplyEqualNode OpOrEqualNode OpPlusEqualNode OpRShiftEqualNode
34
+ OpURShiftEqualNode OpXOrEqualNode ParameterNode PostfixNode PrefixNode
35
+ PropertyNode RegexpNode ResolveNode ReturnNode RightShiftNode
36
+ SetterPropertyNode StrictEqualNode StringNode
37
+ SubtractNode SwitchNode ThisNode ThrowNode TrueNode TryNode TypeOfNode
38
+ UnaryMinusNode UnaryPlusNode UnsignedRightShiftNode VarDeclNode
39
+ VarStatementNode VoidNode WhileNode WithNode
40
+ }.each do |type|
41
+ define_method(:"visit_#{type}") do |o|
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,31 @@
1
+ module RKelly
2
+ module Visitors
3
+ class PointcutVisitor < Visitor
4
+ attr_reader :matches
5
+ def initialize(pattern, matches = [])
6
+ @pattern = pattern
7
+ @matches = matches
8
+ end
9
+
10
+ def >(pattern)
11
+ pattern =
12
+ case pattern
13
+ when Class
14
+ pattern.new(Object)
15
+ else
16
+ pattern
17
+ end
18
+ self.class.new(nil, @matches.map do |m|
19
+ m.pointcut(pattern).matches
20
+ end.flatten)
21
+ end
22
+
23
+ ALL_NODES.each do |type|
24
+ define_method(:"visit_#{type}Node") do |o|
25
+ @matches << o if @pattern === o
26
+ super
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,16 @@
1
+ module RKelly
2
+ module Visitors
3
+ class RealSexpVisitor < Visitor
4
+ ALL_NODES.each do |type|
5
+ eval <<-RUBY
6
+ def visit_#{type}Node(o)
7
+ sexp = s(:#{type.scan(/[A-Z][a-z]+/).join('_').downcase}, *super(o))
8
+ sexp.line = o.line if o.line
9
+ sexp.file = o.filename
10
+ sexp
11
+ end
12
+ RUBY
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,373 @@
1
+ module RKelly
2
+ module Visitors
3
+ class SexpVisitor < Visitor
4
+ def visit_NumberNode(o)
5
+ [:lit, o.value]
6
+ end
7
+
8
+ def visit_RegexpNode(o)
9
+ [:lit, o.value]
10
+ end
11
+
12
+ def visit_AssignExprNode(o)
13
+ [:assign, super]
14
+ end
15
+
16
+ def visit_VarDeclNode(o)
17
+ [ o.constant? ? :const_decl : :var_decl ] + super(o)
18
+ end
19
+
20
+ def visit_VarStatementNode(o)
21
+ [:var, super]
22
+ end
23
+
24
+ def visit_PostfixNode(o)
25
+ [:postfix, super, o.value]
26
+ end
27
+
28
+ def visit_PrefixNode(o)
29
+ [:prefix, super, o.value]
30
+ end
31
+
32
+ def visit_DeleteNode(o)
33
+ [:delete, super]
34
+ end
35
+
36
+ def visit_VoidNode(o)
37
+ [:void, super]
38
+ end
39
+
40
+ def visit_TypeOfNode(o)
41
+ [:typeof, super]
42
+ end
43
+
44
+ def visit_UnaryPlusNode(o)
45
+ [:u_plus, super]
46
+ end
47
+
48
+ def visit_UnaryMinusNode(o)
49
+ [:u_minus, super]
50
+ end
51
+
52
+ def visit_BitwiseNotNode(o)
53
+ [:bitwise_not, super]
54
+ end
55
+
56
+ def visit_LogicalNotNode(o)
57
+ [:not, super]
58
+ end
59
+
60
+ def visit_ConstStatementNode(o)
61
+ [:const, super]
62
+ end
63
+
64
+ def visit_MultiplyNode(o)
65
+ [:multiply, *super]
66
+ end
67
+
68
+ def visit_DivideNode(o)
69
+ [:divide, *super]
70
+ end
71
+
72
+ def visit_ModulusNode(o)
73
+ [:modulus, *super]
74
+ end
75
+
76
+ def visit_AddNode(o)
77
+ [:add, *super]
78
+ end
79
+
80
+ def visit_LeftShiftNode(o)
81
+ [:lshift, *super]
82
+ end
83
+
84
+ def visit_RightShiftNode(o)
85
+ [:rshift, *super]
86
+ end
87
+
88
+ def visit_UnsignedRightShiftNode(o)
89
+ [:urshift, *super]
90
+ end
91
+
92
+ def visit_SubtractNode(o)
93
+ [:subtract, *super]
94
+ end
95
+
96
+ def visit_LessNode(o)
97
+ [:less, *super]
98
+ end
99
+
100
+ def visit_GreaterNode(o)
101
+ [:greater, *super]
102
+ end
103
+
104
+ def visit_LessOrEqualNode(o)
105
+ [:less_or_equal, *super]
106
+ end
107
+
108
+ def visit_GreaterOrEqualNode(o)
109
+ [:greater_or_equal, *super]
110
+ end
111
+
112
+ def visit_InstanceOfNode(o)
113
+ [:instance_of, *super]
114
+ end
115
+
116
+ def visit_EqualNode(o)
117
+ [:equal, *super]
118
+ end
119
+
120
+ def visit_NotEqualNode(o)
121
+ [:not_equal, *super]
122
+ end
123
+
124
+ def visit_StrictEqualNode(o)
125
+ [:strict_equal, *super]
126
+ end
127
+
128
+ def visit_NotStrictEqualNode(o)
129
+ [:not_strict_equal, *super]
130
+ end
131
+
132
+ def visit_BitAndNode(o)
133
+ [:bit_and, *super]
134
+ end
135
+
136
+ def visit_BitOrNode(o)
137
+ [:bit_or, *super]
138
+ end
139
+
140
+ def visit_BitXOrNode(o)
141
+ [:bit_xor, *super]
142
+ end
143
+
144
+ def visit_LogicalAndNode(o)
145
+ [:and, *super]
146
+ end
147
+
148
+ def visit_LogicalOrNode(o)
149
+ [:or, *super]
150
+ end
151
+
152
+ def visit_InNode(o)
153
+ [:in, *super]
154
+ end
155
+
156
+ def visit_DoWhileNode(o)
157
+ [:do_while, *super]
158
+ end
159
+
160
+ def visit_WhileNode(o)
161
+ [:while, *super]
162
+ end
163
+
164
+ def visit_WithNode(o)
165
+ [:with, *super]
166
+ end
167
+
168
+ def visit_CaseClauseNode(o)
169
+ [:case, *super]
170
+ end
171
+
172
+ def visit_CaseBlockNode(o)
173
+ [:case_block, super]
174
+ end
175
+
176
+ def visit_SwitchNode(o)
177
+ [:switch, *super]
178
+ end
179
+
180
+ def visit_ForNode(o)
181
+ [ :for, *super]
182
+ end
183
+
184
+ def visit_BlockNode(o)
185
+ [:block, super]
186
+ end
187
+
188
+ def visit_IfNode(o)
189
+ [:if, *super].compact
190
+ end
191
+
192
+ def visit_ConditionalNode(o)
193
+ [:conditional, *super]
194
+ end
195
+
196
+ def visit_ForInNode(o)
197
+ [ :for_in, *super]
198
+ end
199
+
200
+ def visit_TryNode(o)
201
+ [ :try, *super]
202
+ end
203
+
204
+ def visit_EmptyStatementNode(o)
205
+ [:empty]
206
+ end
207
+
208
+ def visit_FunctionBodyNode(o)
209
+ [:func_body, super]
210
+ end
211
+
212
+ def visit_ResolveNode(o)
213
+ [:resolve, o.value]
214
+ end
215
+
216
+ def visit_BracketAccessorNode(o)
217
+ [:bracket_access, *super]
218
+ end
219
+
220
+ def visit_NewExprNode(o)
221
+ [:new_expr, *super]
222
+ end
223
+
224
+ def visit_ParameterNode(o)
225
+ [:param, o.value]
226
+ end
227
+
228
+ def visit_BreakNode(o)
229
+ [:break, o.value].compact
230
+ end
231
+
232
+ def visit_ContinueNode(o)
233
+ [:continue, o.value].compact
234
+ end
235
+
236
+ def visit_LabelNode(o)
237
+ [:label ] + super
238
+ end
239
+
240
+ def visit_ThrowNode(o)
241
+ [:throw, super]
242
+ end
243
+
244
+ def visit_ObjectLiteralNode(o)
245
+ [:object, super]
246
+ end
247
+
248
+ def visit_PropertyNode(o)
249
+ [ :property ] + super
250
+ end
251
+
252
+ def visit_GetterPropertyNode(o)
253
+ [ :getter ] + super
254
+ end
255
+
256
+ def visit_SetterPropertyNode(o)
257
+ [ :setter ] + super
258
+ end
259
+
260
+ def visit_ElementNode(o)
261
+ [:element, super ]
262
+ end
263
+
264
+ def visit_ExpressionStatementNode(o)
265
+ [:expression, super ]
266
+ end
267
+
268
+ def visit_OpEqualNode(o)
269
+ [:op_equal, *super ]
270
+ end
271
+
272
+ def visit_OpPlusEqualNode(o)
273
+ [:op_plus_equal, *super ]
274
+ end
275
+
276
+ def visit_OpMinusEqualNode(o)
277
+ [:op_minus_equal, *super ]
278
+ end
279
+
280
+ def visit_OpMultiplyEqualNode(o)
281
+ [:op_multiply_equal, *super ]
282
+ end
283
+
284
+ def visit_OpDivideEqualNode(o)
285
+ [:op_divide_equal, *super]
286
+ end
287
+
288
+ def visit_OpLShiftEqualNode(o)
289
+ [:op_lshift_equal, *super ]
290
+ end
291
+
292
+ def visit_OpRShiftEqualNode(o)
293
+ [:op_rshift_equal, *super ]
294
+ end
295
+
296
+ def visit_OpURShiftEqualNode(o)
297
+ [:op_urshift_equal, *super ]
298
+ end
299
+
300
+ def visit_OpAndEqualNode(o)
301
+ [:op_and_equal, *super ]
302
+ end
303
+
304
+ def visit_OpXOrEqualNode(o)
305
+ [:op_xor_equal, *super ]
306
+ end
307
+
308
+ def visit_OpOrEqualNode(o)
309
+ [:op_or_equal, *super ]
310
+ end
311
+
312
+ def visit_OpModEqualNode(o)
313
+ [:op_mod_equal, *super]
314
+ end
315
+
316
+ def visit_CommaNode(o)
317
+ [:comma, *super]
318
+ end
319
+
320
+ def visit_FunctionCallNode(o)
321
+ [:function_call, *super]
322
+ end
323
+
324
+ def visit_ArrayNode(o)
325
+ [:array, super]
326
+ end
327
+
328
+ def visit_ThisNode(o)
329
+ [:this]
330
+ end
331
+
332
+ def visit_ReturnNode(o)
333
+ o.value ? [:return, super] : [:return]
334
+ end
335
+
336
+ def visit_FunctionExprNode(o)
337
+ [ :func_expr, *super]
338
+ end
339
+
340
+ def visit_FunctionDeclNode(o)
341
+ [ :func_decl, *super]
342
+ end
343
+
344
+ def visit_ArgumentsNode(o)
345
+ [:args, super]
346
+ end
347
+
348
+ def visit_DotAccessorNode(o)
349
+ [:dot_access,
350
+ super,
351
+ o.accessor
352
+ ]
353
+ end
354
+
355
+ def visit_NullNode(o)
356
+ [:nil]
357
+ end
358
+
359
+ def visit_StringNode(o)
360
+ [:str, o.value]
361
+ end
362
+
363
+ def visit_FalseNode(o)
364
+ [:false]
365
+ end
366
+
367
+ def visit_TrueNode(o)
368
+ [:true]
369
+ end
370
+
371
+ end
372
+ end
373
+ end