Class: Parser::AST::Processor

Inherits:
AST::Processor
  • Object
show all
Defined in:
lib/parser/ast/processor.rb

Instance Method Summary collapse

Instance Method Details

#on_argObject



118
119
120
# File 'lib/parser/ast/processor.rb', line 118

def process_argument_node(node)
  on_argument(node)
end

#on_argument(node) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/parser/ast/processor.rb', line 101

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_refObject



38
39
40
# File 'lib/parser/ast/processor.rb', line 38

def process_variable_node(node)
  on_var(node)
end

#on_blockargObject



121
122
123
# File 'lib/parser/ast/processor.rb', line 121

def process_argument_node(node)
  on_argument(node)
end

#on_casgn(node) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/parser/ast/processor.rb', line 85

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



77
78
79
80
81
82
83
# File 'lib/parser/ast/processor.rb', line 77

def on_const(node)
  scope_node, name = *node

  node.updated(nil, [
    process(scope_node), name
  ])
end

#on_cvarObject



37
38
39
# File 'lib/parser/ast/processor.rb', line 37

def process_variable_node(node)
  on_var(node)
end

#on_cvasgnObject



61
62
63
# File 'lib/parser/ast/processor.rb', line 61

def process_var_asgn_node(node)
  on_vasgn(node)
end

#on_def(node) ⇒ Object



137
138
139
140
141
142
143
144
# File 'lib/parser/ast/processor.rb', line 137

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



146
147
148
149
150
151
152
153
# File 'lib/parser/ast/processor.rb', line 146

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_gvarObject



36
37
38
# File 'lib/parser/ast/processor.rb', line 36

def process_variable_node(node)
  on_var(node)
end

#on_gvasgnObject



60
61
62
# File 'lib/parser/ast/processor.rb', line 60

def process_var_asgn_node(node)
  on_vasgn(node)
end

#on_ivarObject



35
36
37
# File 'lib/parser/ast/processor.rb', line 35

def process_variable_node(node)
  on_var(node)
end

#on_ivasgnObject



59
60
61
# File 'lib/parser/ast/processor.rb', line 59

def process_var_asgn_node(node)
  on_vasgn(node)
end

#on_kwargObject



123
124
125
# File 'lib/parser/ast/processor.rb', line 123

def process_argument_node(node)
  on_argument(node)
end

#on_kwoptargObject



124
125
126
# File 'lib/parser/ast/processor.rb', line 124

def process_argument_node(node)
  on_argument(node)
end

#on_kwrestargObject



125
126
127
# File 'lib/parser/ast/processor.rb', line 125

def process_argument_node(node)
  on_argument(node)
end

#on_lvarObject



34
35
36
# File 'lib/parser/ast/processor.rb', line 34

def process_variable_node(node)
  on_var(node)
end

#on_lvasgnObject



58
59
60
# File 'lib/parser/ast/processor.rb', line 58

def process_var_asgn_node(node)
  on_vasgn(node)
end

#on_nth_refObject



39
40
41
# File 'lib/parser/ast/processor.rb', line 39

def process_variable_node(node)
  on_var(node)
end

#on_op_asgn(node) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/parser/ast/processor.rb', line 66

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_optargObject



119
120
121
# File 'lib/parser/ast/processor.rb', line 119

def process_argument_node(node)
  on_argument(node)
end

#on_procarg0Object



126
127
128
# File 'lib/parser/ast/processor.rb', line 126

def process_argument_node(node)
  on_argument(node)
end

#on_restargObject



120
121
122
# File 'lib/parser/ast/processor.rb', line 120

def process_argument_node(node)
  on_argument(node)
end

#on_send(node) ⇒ Object Also known as: on_csend



158
159
160
161
162
163
164
165
# File 'lib/parser/ast/processor.rb', line 158

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_shadowargObject



122
123
124
# File 'lib/parser/ast/processor.rb', line 122

def process_argument_node(node)
  on_argument(node)
end

#on_var(node) ⇒ Object



25
26
27
# File 'lib/parser/ast/processor.rb', line 25

def on_var(node)
  node
end

#on_vasgn(node) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/parser/ast/processor.rb', line 41

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



114
115
116
# File 'lib/parser/ast/processor.rb', line 114

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_array, on_pair, on_hash, 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_module, on_class, on_sclass, on_undef, on_alias, on_block, 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



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



54
55
56
# File 'lib/parser/ast/processor.rb', line 54

def process_var_asgn_node(node)
  on_vasgn(node)
end

#process_variable_node(node) ⇒ Object



30
31
32
# File 'lib/parser/ast/processor.rb', line 30

def process_variable_node(node)
  on_var(node)
end