Class: RBelly::Visitors::SexpVisitor

Inherits:
Visitor
  • Object
show all
Defined in:
lib/rbelly/visitors/sexp_visitor.rb

Constant Summary

Constants inherited from Visitor

Visitor::ALL_NODES, Visitor::ARRAY_VALUE_NODES, Visitor::BELLEJS_FUNC_NODES, Visitor::BELLEJS_VAR_NODES, Visitor::BINARY_NODES, Visitor::CLASS_NODES, Visitor::CONDITIONAL_NODES, Visitor::FUNC_CALL_NODES, Visitor::FUNC_DECL_NODES, Visitor::NAME_VALUE_NODES, Visitor::PREFIX_POSTFIX_NODES, Visitor::SINGLE_VALUE_NODES, Visitor::TERMINAL_NODES

Instance Method Summary collapse

Methods inherited from Visitor

#accept

Instance Method Details

#visit_AddNode(o) ⇒ Object



76
77
78
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 76

def visit_AddNode(o)
  [:add, *super]
end

#visit_ArgumentsNode(o) ⇒ Object



360
361
362
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 360

def visit_ArgumentsNode(o)
  [:args, super]
end

#visit_ArrayNode(o) ⇒ Object



328
329
330
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 328

def visit_ArrayNode(o)
  [:array, super]
end

#visit_AssignExprNode(o) ⇒ Object



12
13
14
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 12

def visit_AssignExprNode(o)
  [:assign, super]
end

#visit_BitAndNode(o) ⇒ Object



132
133
134
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 132

def visit_BitAndNode(o)
  [:bit_and, *super]
end

#visit_BitOrNode(o) ⇒ Object



136
137
138
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 136

def visit_BitOrNode(o)
  [:bit_or, *super]
end

#visit_BitwiseNotNode(o) ⇒ Object



52
53
54
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 52

def visit_BitwiseNotNode(o)
  [:bitwise_not, super]
end

#visit_BitXOrNode(o) ⇒ Object



140
141
142
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 140

def visit_BitXOrNode(o)
  [:bit_xor, *super]
end

#visit_BlockNode(o) ⇒ Object



184
185
186
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 184

def visit_BlockNode(o)
  [:block, super]
end

#visit_BracketAccessorNode(o) ⇒ Object



220
221
222
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 220

def visit_BracketAccessorNode(o)
  [:bracket_access, *super]
end

#visit_BreakNode(o) ⇒ Object



232
233
234
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 232

def visit_BreakNode(o)
  [:break, o.value].compact
end

#visit_CaseBlockNode(o) ⇒ Object



172
173
174
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 172

def visit_CaseBlockNode(o)
  [:case_block, super]
end

#visit_CaseClauseNode(o) ⇒ Object



168
169
170
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 168

def visit_CaseClauseNode(o)
  [:case, *super]
end

#visit_ClassBodyNode(o) ⇒ Object



212
213
214
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 212

def visit_ClassBodyNode(o)
  [:class_body, super]
end

#visit_ClassNode(o) ⇒ Object



356
357
358
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 356

def visit_ClassNode(o)
  [ :class, *super]
end

#visit_CommaNode(o) ⇒ Object



320
321
322
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 320

def visit_CommaNode(o)
  [:comma, *super]
end

#visit_ConditionalNode(o) ⇒ Object



192
193
194
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 192

def visit_ConditionalNode(o)
  [:conditional, *super]
end

#visit_ConstStatementNode(o) ⇒ Object



60
61
62
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 60

def visit_ConstStatementNode(o)
  [:const, super]
end

#visit_ContinueNode(o) ⇒ Object



236
237
238
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 236

def visit_ContinueNode(o)
  [:continue, o.value].compact
end

#visit_DeleteNode(o) ⇒ Object



32
33
34
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 32

def visit_DeleteNode(o)
  [:delete, super]
end

#visit_DivideNode(o) ⇒ Object



68
69
70
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 68

def visit_DivideNode(o)
  [:divide, *super]
end

#visit_DotAccessorNode(o) ⇒ Object



364
365
366
367
368
369
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 364

def visit_DotAccessorNode(o)
  [:dot_access,
    super,
    o.accessor
  ]
end

#visit_DoWhileNode(o) ⇒ Object



156
157
158
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 156

def visit_DoWhileNode(o)
  [:do_while, *super]
end

#visit_ElementNode(o) ⇒ Object



264
265
266
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 264

def visit_ElementNode(o)
  [:element, super ]
end

#visit_EmptyStatementNode(o) ⇒ Object



204
205
206
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 204

def visit_EmptyStatementNode(o)
  [:empty]
end

#visit_EqualNode(o) ⇒ Object



116
117
118
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 116

def visit_EqualNode(o)
  [:equal, *super]
end

#visit_ExpressionStatementNode(o) ⇒ Object



268
269
270
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 268

def visit_ExpressionStatementNode(o)
  [:expression, super ]
end

#visit_ExtendsNode(o) ⇒ Object



344
345
346
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 344

def visit_ExtendsNode(o)
  [:extends, *super]
end

#visit_FalseNode(o) ⇒ Object



379
380
381
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 379

def visit_FalseNode(o)
  [:false]
end

#visit_ForInNode(o) ⇒ Object



196
197
198
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 196

def visit_ForInNode(o)
  [ :for_in, *super]
end

#visit_ForNode(o) ⇒ Object



180
181
182
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 180

def visit_ForNode(o)
  [ :for, *super]
end

#visit_FunctionBodyNode(o) ⇒ Object



208
209
210
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 208

def visit_FunctionBodyNode(o)
  [:func_body, super]
end

#visit_FunctionCallNode(o) ⇒ Object



324
325
326
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 324

def visit_FunctionCallNode(o)
  [:function_call, *super]
end

#visit_FunctionDeclNode(o) ⇒ Object



352
353
354
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 352

def visit_FunctionDeclNode(o)
  [ :func_decl, *super]
end

#visit_FunctionExprNode(o) ⇒ Object



348
349
350
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 348

def visit_FunctionExprNode(o)
  [ :func_expr, *super]
end

#visit_GetterPropertyNode(o) ⇒ Object



256
257
258
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 256

def visit_GetterPropertyNode(o)
  [ :getter ] + super
end

#visit_GreaterNode(o) ⇒ Object



100
101
102
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 100

def visit_GreaterNode(o)
  [:greater, *super]
end

#visit_GreaterOrEqualNode(o) ⇒ Object



108
109
110
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 108

def visit_GreaterOrEqualNode(o)
  [:greater_or_equal, *super]
end

#visit_IfNode(o) ⇒ Object



188
189
190
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 188

def visit_IfNode(o)
  [:if, *super].compact
end

#visit_ImportNode(o) ⇒ Object



340
341
342
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 340

def visit_ImportNode(o)
  [:import, *super]
end

#visit_InNode(o) ⇒ Object



152
153
154
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 152

def visit_InNode(o)
  [:in, *super]
end

#visit_InstanceOfNode(o) ⇒ Object



112
113
114
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 112

def visit_InstanceOfNode(o)
  [:instance_of, *super]
end

#visit_LabelNode(o) ⇒ Object



240
241
242
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 240

def visit_LabelNode(o)
  [:label ] + super
end

#visit_LeftShiftNode(o) ⇒ Object



80
81
82
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 80

def visit_LeftShiftNode(o)
  [:lshift, *super]
end

#visit_LessNode(o) ⇒ Object



96
97
98
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 96

def visit_LessNode(o)
  [:less, *super]
end

#visit_LessOrEqualNode(o) ⇒ Object



104
105
106
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 104

def visit_LessOrEqualNode(o)
  [:less_or_equal, *super]
end

#visit_LogicalAndNode(o) ⇒ Object



144
145
146
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 144

def visit_LogicalAndNode(o)
  [:and, *super]
end

#visit_LogicalNotNode(o) ⇒ Object



56
57
58
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 56

def visit_LogicalNotNode(o)
  [:not, super]
end

#visit_LogicalOrNode(o) ⇒ Object



148
149
150
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 148

def visit_LogicalOrNode(o)
  [:or, *super]
end

#visit_ModulusNode(o) ⇒ Object



72
73
74
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 72

def visit_ModulusNode(o)
  [:modulus, *super]
end

#visit_MultiplyNode(o) ⇒ Object



64
65
66
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 64

def visit_MultiplyNode(o)
  [:multiply, *super]
end

#visit_NewExprNode(o) ⇒ Object



224
225
226
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 224

def visit_NewExprNode(o)
  [:new_expr, *super]
end

#visit_NotEqualNode(o) ⇒ Object



120
121
122
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 120

def visit_NotEqualNode(o)
  [:not_equal, *super]
end

#visit_NotStrictEqualNode(o) ⇒ Object



128
129
130
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 128

def visit_NotStrictEqualNode(o)
  [:not_strict_equal, *super]
end

#visit_NullNode(o) ⇒ Object



371
372
373
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 371

def visit_NullNode(o)
  [:nil]
end

#visit_NumberNode(o) ⇒ Object



4
5
6
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 4

def visit_NumberNode(o)
  [:lit, o.value]
end

#visit_ObjectLiteralNode(o) ⇒ Object



248
249
250
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 248

def visit_ObjectLiteralNode(o)
  [:object, super]
end

#visit_OpAndEqualNode(o) ⇒ Object



304
305
306
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 304

def visit_OpAndEqualNode(o)
  [:op_and_equal, *super ]
end

#visit_OpDivideEqualNode(o) ⇒ Object



288
289
290
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 288

def visit_OpDivideEqualNode(o)
  [:op_divide_equal, *super]
end

#visit_OpEqualNode(o) ⇒ Object



272
273
274
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 272

def visit_OpEqualNode(o)
  [:op_equal, *super ]
end

#visit_OpLShiftEqualNode(o) ⇒ Object



292
293
294
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 292

def visit_OpLShiftEqualNode(o)
  [:op_lshift_equal, *super ]
end

#visit_OpMinusEqualNode(o) ⇒ Object



280
281
282
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 280

def visit_OpMinusEqualNode(o)
  [:op_minus_equal, *super ]
end

#visit_OpModEqualNode(o) ⇒ Object



316
317
318
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 316

def visit_OpModEqualNode(o)
  [:op_mod_equal, *super]
end

#visit_OpMultiplyEqualNode(o) ⇒ Object



284
285
286
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 284

def visit_OpMultiplyEqualNode(o)
  [:op_multiply_equal, *super ]
end

#visit_OpOrEqualNode(o) ⇒ Object



312
313
314
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 312

def visit_OpOrEqualNode(o)
  [:op_or_equal, *super ]
end

#visit_OpPlusEqualNode(o) ⇒ Object



276
277
278
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 276

def visit_OpPlusEqualNode(o)
  [:op_plus_equal, *super ]
end

#visit_OpRShiftEqualNode(o) ⇒ Object



296
297
298
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 296

def visit_OpRShiftEqualNode(o)
  [:op_rshift_equal, *super ]
end

#visit_OpURShiftEqualNode(o) ⇒ Object



300
301
302
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 300

def visit_OpURShiftEqualNode(o)
  [:op_urshift_equal, *super ]
end

#visit_OpXOrEqualNode(o) ⇒ Object



308
309
310
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 308

def visit_OpXOrEqualNode(o)
  [:op_xor_equal, *super ]
end

#visit_ParameterNode(o) ⇒ Object



228
229
230
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 228

def visit_ParameterNode(o)
  [:param, o.value]
end

#visit_PostfixNode(o) ⇒ Object



24
25
26
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 24

def visit_PostfixNode(o)
  [:postfix, super, o.value]
end

#visit_PrefixNode(o) ⇒ Object



28
29
30
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 28

def visit_PrefixNode(o)
  [:prefix, super, o.value]
end

#visit_PropertyNode(o) ⇒ Object



252
253
254
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 252

def visit_PropertyNode(o)
  [ :property ] + super
end

#visit_RegexpNode(o) ⇒ Object



8
9
10
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 8

def visit_RegexpNode(o)
  [:lit, o.value]
end

#visit_ResolveNode(o) ⇒ Object



216
217
218
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 216

def visit_ResolveNode(o)
  [:resolve, o.value]
end

#visit_ReturnNode(o) ⇒ Object



336
337
338
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 336

def visit_ReturnNode(o)
  o.value ? [:return, super] : [:return]
end

#visit_RightShiftNode(o) ⇒ Object



84
85
86
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 84

def visit_RightShiftNode(o)
  [:rshift, *super]
end

#visit_SetterPropertyNode(o) ⇒ Object



260
261
262
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 260

def visit_SetterPropertyNode(o)
  [ :setter ] + super
end

#visit_StrictEqualNode(o) ⇒ Object



124
125
126
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 124

def visit_StrictEqualNode(o)
  [:strict_equal, *super]
end

#visit_StringNode(o) ⇒ Object



375
376
377
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 375

def visit_StringNode(o)
  [:str, o.value]
end

#visit_SubtractNode(o) ⇒ Object



92
93
94
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 92

def visit_SubtractNode(o)
  [:subtract, *super]
end

#visit_SwitchNode(o) ⇒ Object



176
177
178
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 176

def visit_SwitchNode(o)
  [:switch, *super]
end

#visit_ThisNode(o) ⇒ Object



332
333
334
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 332

def visit_ThisNode(o)
  [:this]
end

#visit_ThrowNode(o) ⇒ Object



244
245
246
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 244

def visit_ThrowNode(o)
  [:throw, super]
end

#visit_TrueNode(o) ⇒ Object



383
384
385
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 383

def visit_TrueNode(o)
  [:true]
end

#visit_TryNode(o) ⇒ Object



200
201
202
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 200

def visit_TryNode(o)
  [ :try, *super]
end

#visit_TypeOfNode(o) ⇒ Object



40
41
42
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 40

def visit_TypeOfNode(o)
  [:typeof, super]
end

#visit_UnaryMinusNode(o) ⇒ Object



48
49
50
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 48

def visit_UnaryMinusNode(o)
  [:u_minus, super]
end

#visit_UnaryPlusNode(o) ⇒ Object



44
45
46
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 44

def visit_UnaryPlusNode(o)
  [:u_plus, super]
end

#visit_UnsignedRightShiftNode(o) ⇒ Object



88
89
90
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 88

def visit_UnsignedRightShiftNode(o)
  [:urshift, *super]
end

#visit_VarDeclNode(o) ⇒ Object



16
17
18
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 16

def visit_VarDeclNode(o)
  [ o.constant? ? :const_decl : :var_decl ] + super(o)
end

#visit_VarStatementNode(o) ⇒ Object



20
21
22
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 20

def visit_VarStatementNode(o)
  [:var, super]
end

#visit_VoidNode(o) ⇒ Object



36
37
38
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 36

def visit_VoidNode(o)
  [:void, super]
end

#visit_WhileNode(o) ⇒ Object



160
161
162
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 160

def visit_WhileNode(o)
  [:while, *super]
end

#visit_WithNode(o) ⇒ Object



164
165
166
# File 'lib/rbelly/visitors/sexp_visitor.rb', line 164

def visit_WithNode(o)
  [:with, *super]
end