Class: Parser::AST::Processor
- Inherits:
-
AST::Processor
- Object
- AST::Processor
- Parser::AST::Processor
show all
- Defined in:
- lib/parser/ast/processor.rb
Instance Method Summary
collapse
-
#on_arg ⇒ Object
-
#on_argument(node) ⇒ Object
-
#on_back_ref ⇒ Object
-
#on_blockarg ⇒ Object
-
#on_casgn(node) ⇒ Object
-
#on_const(node) ⇒ Object
-
#on_cvar ⇒ Object
-
#on_cvasgn ⇒ Object
-
#on_def(node) ⇒ Object
-
#on_defs(node) ⇒ Object
-
#on_empty_else(node) ⇒ Object
-
#on_forward_arg ⇒ Object
-
#on_gvar ⇒ Object
-
#on_gvasgn ⇒ Object
-
#on_ivar ⇒ Object
-
#on_ivasgn ⇒ Object
-
#on_kwarg ⇒ Object
-
#on_kwoptarg ⇒ Object
-
#on_kwrestarg ⇒ Object
-
#on_lvar ⇒ Object
-
#on_lvasgn ⇒ Object
-
#on_match_var ⇒ Object
-
#on_nth_ref ⇒ Object
-
#on_numblock(node) ⇒ Object
-
#on_op_asgn(node) ⇒ Object
-
#on_optarg ⇒ Object
-
#on_procarg0(node) ⇒ Object
-
#on_restarg ⇒ Object
-
#on_send(node) ⇒ Object
(also: #on_csend)
-
#on_shadowarg ⇒ Object
-
#on_var(node) ⇒ Object
-
#on_vasgn(node) ⇒ Object
-
#process_argument_node(node) ⇒ Object
-
#process_regular_node(node) ⇒ Object
(also: #on_dstr, #on_dsym, #on_regexp, #on_xstr, #on_splat, #on_kwsplat, #on_array, #on_pair, #on_hash, #on_kwargs, #on_irange, #on_erange, #on_and_asgn, #on_or_asgn, #on_mlhs, #on_masgn, #on_args, #on_arg_expr, #on_restarg_expr, #on_blockarg_expr, #on_block_pass, #on_forwarded_restarg, #on_forwarded_kwrestarg, #on_module, #on_class, #on_sclass, #on_undef, #on_alias, #on_index, #on_indexasgn, #on_block, #on_lambda, #on_while, #on_while_post, #on_until, #on_until_post, #on_for, #on_return, #on_break, #on_next, #on_redo, #on_retry, #on_super, #on_yield, #on_defined?, #on_not, #on_and, #on_or, #on_if, #on_when, #on_case, #on_iflipflop, #on_eflipflop, #on_match_current_line, #on_match_with_lvasgn, #on_resbody, #on_rescue, #on_ensure, #on_begin, #on_kwbegin, #on_preexe, #on_postexe, #on_case_match, #on_in_match, #on_match_pattern, #on_match_pattern_p, #on_in_pattern, #on_if_guard, #on_unless_guard, #on_match_rest, #on_pin, #on_match_alt, #on_match_as, #on_array_pattern, #on_array_pattern_with_tail, #on_hash_pattern, #on_const_pattern, #on_find_pattern)
-
#process_var_asgn_node(node) ⇒ Object
-
#process_variable_node(node) ⇒ Object
Instance Method Details
#on_arg ⇒ Object
120
121
122
|
# File 'lib/parser/ast/processor.rb', line 120
def process_argument_node(node)
on_argument(node)
end
|
#on_argument(node) ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/parser/ast/processor.rb', line 103
def on_argument(node)
arg_name, value_node = *node
if !value_node.nil?
node.updated(nil, [
arg_name, process(value_node)
])
else
node
end
end
|
#on_back_ref ⇒ Object
40
41
42
|
# File 'lib/parser/ast/processor.rb', line 40
def process_variable_node(node)
on_var(node)
end
|
#on_blockarg ⇒ Object
123
124
125
|
# File 'lib/parser/ast/processor.rb', line 123
def process_argument_node(node)
on_argument(node)
end
|
#on_casgn(node) ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/parser/ast/processor.rb', line 87
def on_casgn(node)
scope_node, name, value_node = *node
if !value_node.nil?
node.updated(nil, [
process(scope_node), name, process(value_node)
])
else
node.updated(nil, [
process(scope_node), name
])
end
end
|
#on_const(node) ⇒ Object
79
80
81
82
83
84
85
|
# File 'lib/parser/ast/processor.rb', line 79
def on_const(node)
scope_node, name = *node
node.updated(nil, [
process(scope_node), name
])
end
|
#on_cvar ⇒ Object
39
40
41
|
# File 'lib/parser/ast/processor.rb', line 39
def process_variable_node(node)
on_var(node)
end
|
#on_cvasgn ⇒ Object
63
64
65
|
# File 'lib/parser/ast/processor.rb', line 63
def process_var_asgn_node(node)
on_vasgn(node)
end
|
#on_def(node) ⇒ Object
158
159
160
161
162
163
164
165
|
# File 'lib/parser/ast/processor.rb', line 158
def on_def(node)
name, args_node, body_node = *node
node.updated(nil, [
name,
process(args_node), process(body_node)
])
end
|
#on_defs(node) ⇒ Object
167
168
169
170
171
172
173
174
|
# File 'lib/parser/ast/processor.rb', line 167
def on_defs(node)
definee_node, name, args_node, body_node = *node
node.updated(nil, [
process(definee_node), name,
process(args_node), process(body_node)
])
end
|
#on_empty_else(node) ⇒ Object
286
287
288
|
# File 'lib/parser/ast/processor.rb', line 286
def on_empty_else(node)
node
end
|
#on_forward_arg ⇒ Object
128
129
130
|
# File 'lib/parser/ast/processor.rb', line 128
def process_argument_node(node)
on_argument(node)
end
|
#on_gvar ⇒ Object
38
39
40
|
# File 'lib/parser/ast/processor.rb', line 38
def process_variable_node(node)
on_var(node)
end
|
#on_gvasgn ⇒ Object
62
63
64
|
# File 'lib/parser/ast/processor.rb', line 62
def process_var_asgn_node(node)
on_vasgn(node)
end
|
#on_ivar ⇒ Object
37
38
39
|
# File 'lib/parser/ast/processor.rb', line 37
def process_variable_node(node)
on_var(node)
end
|
#on_ivasgn ⇒ Object
61
62
63
|
# File 'lib/parser/ast/processor.rb', line 61
def process_var_asgn_node(node)
on_vasgn(node)
end
|
#on_kwarg ⇒ Object
125
126
127
|
# File 'lib/parser/ast/processor.rb', line 125
def process_argument_node(node)
on_argument(node)
end
|
#on_kwoptarg ⇒ Object
126
127
128
|
# File 'lib/parser/ast/processor.rb', line 126
def process_argument_node(node)
on_argument(node)
end
|
#on_kwrestarg ⇒ Object
127
128
129
|
# File 'lib/parser/ast/processor.rb', line 127
def process_argument_node(node)
on_argument(node)
end
|
#on_lvar ⇒ Object
36
37
38
|
# File 'lib/parser/ast/processor.rb', line 36
def process_variable_node(node)
on_var(node)
end
|
#on_lvasgn ⇒ Object
60
61
62
|
# File 'lib/parser/ast/processor.rb', line 60
def process_var_asgn_node(node)
on_vasgn(node)
end
|
#on_match_var ⇒ Object
251
252
253
|
# File 'lib/parser/ast/processor.rb', line 251
def process_variable_node(node)
on_var(node)
end
|
#on_nth_ref ⇒ Object
41
42
43
|
# File 'lib/parser/ast/processor.rb', line 41
def process_variable_node(node)
on_var(node)
end
|
#on_numblock(node) ⇒ Object
196
197
198
199
200
201
202
|
# File 'lib/parser/ast/processor.rb', line 196
def on_numblock(node)
method_call, max_numparam, body = *node
node.updated(nil, [
process(method_call), max_numparam, process(body)
])
end
|
#on_op_asgn(node) ⇒ Object
68
69
70
71
72
73
74
|
# File 'lib/parser/ast/processor.rb', line 68
def on_op_asgn(node)
var_node, method_name, value_node = *node
node.updated(nil, [
process(var_node), method_name, process(value_node)
])
end
|
#on_optarg ⇒ Object
121
122
123
|
# File 'lib/parser/ast/processor.rb', line 121
def process_argument_node(node)
on_argument(node)
end
|
#on_procarg0(node) ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# File 'lib/parser/ast/processor.rb', line 130
def on_procarg0(node)
if node.children[0].is_a?(Symbol)
on_argument(node)
else
process_regular_node(node)
end
end
|
#on_restarg ⇒ Object
122
123
124
|
# File 'lib/parser/ast/processor.rb', line 122
def process_argument_node(node)
on_argument(node)
end
|
#on_send(node) ⇒ Object
Also known as:
on_csend
179
180
181
182
183
184
185
186
|
# File 'lib/parser/ast/processor.rb', line 179
def on_send(node)
receiver_node, method_name, *arg_nodes = *node
receiver_node = process(receiver_node) if receiver_node
node.updated(nil, [
receiver_node, method_name, *process_all(arg_nodes)
])
end
|
#on_shadowarg ⇒ Object
124
125
126
|
# File 'lib/parser/ast/processor.rb', line 124
def process_argument_node(node)
on_argument(node)
end
|
#on_var(node) ⇒ Object
27
28
29
|
# File 'lib/parser/ast/processor.rb', line 27
def on_var(node)
node
end
|
#on_vasgn(node) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/parser/ast/processor.rb', line 43
def on_vasgn(node)
name, value_node = *node
if !value_node.nil?
node.updated(nil, [
name, process(value_node)
])
else
node
end
end
|
#process_argument_node(node) ⇒ Object
116
117
118
|
# File 'lib/parser/ast/processor.rb', line 116
def process_argument_node(node)
on_argument(node)
end
|
#process_regular_node(node) ⇒ Object
Also known as:
on_dstr, on_dsym, on_regexp, on_xstr, on_splat, on_kwsplat, on_array, on_pair, on_hash, on_kwargs, on_irange, on_erange, on_and_asgn, on_or_asgn, on_mlhs, on_masgn, on_args, on_arg_expr, on_restarg_expr, on_blockarg_expr, on_block_pass, on_forwarded_restarg, on_forwarded_kwrestarg, on_module, on_class, on_sclass, on_undef, on_alias, on_index, on_indexasgn, on_block, on_lambda, on_while, on_while_post, on_until, on_until_post, on_for, on_return, on_break, on_next, on_redo, on_retry, on_super, on_yield, on_defined?, on_not, on_and, on_or, on_if, on_when, on_case, on_iflipflop, on_eflipflop, on_match_current_line, on_match_with_lvasgn, on_resbody, on_rescue, on_ensure, on_begin, on_kwbegin, on_preexe, on_postexe, on_case_match, on_in_match, on_match_pattern, on_match_pattern_p, on_in_pattern, on_if_guard, on_unless_guard, on_match_rest, on_pin, on_match_alt, on_match_as, on_array_pattern, on_array_pattern_with_tail, on_hash_pattern, on_const_pattern, on_find_pattern
10
11
12
|
# File 'lib/parser/ast/processor.rb', line 10
def process_regular_node(node)
node.updated(nil, process_all(node))
end
|
#process_var_asgn_node(node) ⇒ Object
56
57
58
|
# File 'lib/parser/ast/processor.rb', line 56
def process_var_asgn_node(node)
on_vasgn(node)
end
|
#process_variable_node(node) ⇒ Object
32
33
34
|
# File 'lib/parser/ast/processor.rb', line 32
def process_variable_node(node)
on_var(node)
end
|