Class: CodeTools::Melbourne
- Inherits:
-
Object
- Object
- CodeTools::Melbourne
- Defined in:
- lib/rubinius/code/processor/processor.rb
Overview
TODO: This will change to: class Processor
Instance Method Summary collapse
-
#method_missing(sym, *args) ⇒ Object
TODO: remove when all processors are defined.
-
#process_alias(line, to, from) ⇒ Object
Processing methods.
- #process_and(line, left, right) ⇒ Object
- #process_andattrasgn(line, receiver, name, arguments) ⇒ Object
- #process_args(line, required, optional, splat, post, kwargs, kwrest, block) ⇒ Object
- #process_argscat(line, array, rest) ⇒ Object
- #process_argspush(line, arguments, value) ⇒ Object
- #process_array(line, array) ⇒ Object
- #process_attrasgn(line, receiver, name, arguments) ⇒ Object
- #process_back_ref(line, ref) ⇒ Object
- #process_begin(line, body) ⇒ Object
- #process_block(line, array) ⇒ Object
- #process_block_arg(line, name) ⇒ Object
- #process_block_pass(line, arguments, body) ⇒ Object
- #process_break(line, value) ⇒ Object
- #process_call(line, receiver, name, arguments) ⇒ Object
- #process_case(line, receiver, whens, else_body) ⇒ Object
- #process_cdecl(line, expr, value) ⇒ Object
- #process_class(line, name, superclass, body) ⇒ Object
- #process_colon2(line, outer, name) ⇒ Object
- #process_colon3(line, name) ⇒ Object
- #process_const(line, name) ⇒ Object
- #process_cvar(line, name) ⇒ Object
- #process_cvasgn(line, name, value) ⇒ Object
- #process_cvdecl(line, name, value) ⇒ Object
- #process_dangling_node ⇒ Object
- #process_defined(line, expr) ⇒ Object
- #process_defn(line, name, body) ⇒ Object
- #process_defnm(line, name, body) ⇒ Object
- #process_defs(line, receiver, name, body) ⇒ Object
- #process_defsm(line, receiver, name, body) ⇒ Object
- #process_dot2(line, start, finish) ⇒ Object
- #process_dot3(line, start, finish) ⇒ Object
- #process_dregx(line, str, array, flags) ⇒ Object
- #process_dregx_once(line, str, array, flags) ⇒ Object
- #process_dstr(line, str, array) ⇒ Object
- #process_dsym(line, str, array) ⇒ Object
- #process_dxstr(line, str, array) ⇒ Object
- #process_encoding(line, name) ⇒ Object
- #process_ensure(line, body, ensr) ⇒ Object
- #process_evstr(line, value) ⇒ Object
- #process_false(line) ⇒ Object
- #process_fcall(line, name, arguments) ⇒ Object
- #process_file(line) ⇒ Object
- #process_fixnum(line, value) ⇒ Object
- #process_flip2(line, start, finish) ⇒ Object
- #process_flip3(line, start, finish) ⇒ Object
- #process_float(line, str) ⇒ Object
- #process_for(line, iter, arguments, body) ⇒ Object
- #process_fun(line, name, body) ⇒ Object
- #process_funm(line, name, body) ⇒ Object
- #process_gasgn(line, name, expr) ⇒ Object
- #process_gvar(line, name) ⇒ Object
- #process_hash(line, array) ⇒ Object
- #process_iasgn(line, name, value) ⇒ Object
- #process_if(line, cond, body, else_body) ⇒ Object
- #process_imaginary(line, value) ⇒ Object
- #process_iter(line, method_send, scope) ⇒ Object
- #process_ivar(line, name) ⇒ Object
- #process_kw_arg(line, arguments) ⇒ Object
- #process_lambda(line, scope) ⇒ Object
- #process_lasgn(line, name, value) ⇒ Object
- #process_lit(line, sym) ⇒ Object
- #process_lvar(line, name) ⇒ Object
- #process_masgn(line, left, right, splat) ⇒ Object
- #process_match(line, pattern, flags) ⇒ Object
- #process_match2(line, pattern, value) ⇒ Object
- #process_match3(line, pattern, value) ⇒ Object
-
#process_missing_node(line, node_name, node_type) ⇒ Object
This method is analogous to #method_missing.
- #process_module(line, name, body) ⇒ Object
- #process_negate(line, value) ⇒ Object
- #process_next(line, value) ⇒ Object
- #process_nil(line) ⇒ Object
- #process_not(line, value) ⇒ Object
- #process_nth_ref(line, ref) ⇒ Object
- #process_number(line, value) ⇒ Object
- #process_op_asgn1(line, receiver, index, op, value) ⇒ Object
- #process_op_asgn2(line, receiver, anddot, name, op, value) ⇒ Object
- #process_op_asgn_and(line, var, value) ⇒ Object
- #process_op_asgn_or(line, var, value) ⇒ Object
- #process_op_cdecl(line, var, value, op) ⇒ Object
- #process_opt_arg(line, arguments) ⇒ Object
- #process_or(line, left, right) ⇒ Object
- #process_parse_error(message, column, line, source) ⇒ Object
- #process_postarg(line, into, rest) ⇒ Object
- #process_postexe(line, body) ⇒ Object
- #process_preexe(line, body) ⇒ Object
- #process_qcall(line, receiver, name, arguments) ⇒ Object
- #process_rational(line, value) ⇒ Object
- #process_redo(line) ⇒ Object
- #process_regex(line, str, flags) ⇒ Object
- #process_resbody(line, conditions, body, nxt) ⇒ Object
- #process_rescue(line, body, rescue_body, else_body) ⇒ Object
- #process_retry(line) ⇒ Object
- #process_return(line, value) ⇒ Object
- #process_sclass(line, receiver, body) ⇒ Object
- #process_scope(line, arguments, body, locals) ⇒ Object
- #process_self(line) ⇒ Object
- #process_splat(line, expr) ⇒ Object
- #process_str(line, str) ⇒ Object
- #process_super(line, arguments) ⇒ Object
- #process_svalue(line, expr) ⇒ Object
- #process_to_ary(line, expr) ⇒ Object
- #process_true(line) ⇒ Object
- #process_undef(line, sym) ⇒ Object
- #process_until(line, cond, body, check_first) ⇒ Object
- #process_valias(line, to, from) ⇒ Object
- #process_values(line, first, rest) ⇒ Object
- #process_vcall(line, name) ⇒ Object
- #process_when(line, conditions, body) ⇒ Object
- #process_while(line, cond, body, check_first) ⇒ Object
- #process_xstr(line, str) ⇒ Object
- #process_yield(line, arguments, unwrap) ⇒ Object
- #process_zarray(line) ⇒ Object
- #process_zsuper(line) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
TODO: remove when all processors are defined
22 23 24 |
# File 'lib/rubinius/code/processor/processor.rb', line 22 def method_missing(sym, *args) puts "#{self.class}#method_missing: #{sym} #{args.map { |x| x.inspect}.join(", ")}" end |
Instance Method Details
#process_alias(line, to, from) ⇒ Object
Processing methods
29 30 31 |
# File 'lib/rubinius/code/processor/processor.rb', line 29 def process_alias(line, to, from) AST::Alias.new line, to, from end |
#process_and(line, left, right) ⇒ Object
33 34 35 |
# File 'lib/rubinius/code/processor/processor.rb', line 33 def process_and(line, left, right) AST::And.new line, left, right end |
#process_andattrasgn(line, receiver, name, arguments) ⇒ Object
37 38 39 |
# File 'lib/rubinius/code/processor/processor.rb', line 37 def process_andattrasgn(line, receiver, name, arguments) AST::AndAttributeAssignment.new line, receiver, name, arguments end |
#process_args(line, required, optional, splat, post, kwargs, kwrest, block) ⇒ Object
41 42 43 |
# File 'lib/rubinius/code/processor/processor.rb', line 41 def process_args(line, required, optional, splat, post, kwargs, kwrest, block) AST::Parameters.new line, required, optional, splat, post, kwargs, kwrest, block end |
#process_argscat(line, array, rest) ⇒ Object
45 46 47 |
# File 'lib/rubinius/code/processor/processor.rb', line 45 def process_argscat(line, array, rest) AST::ConcatArgs.new line, array, rest end |
#process_argspush(line, arguments, value) ⇒ Object
49 50 51 |
# File 'lib/rubinius/code/processor/processor.rb', line 49 def process_argspush(line, arguments, value) AST::PushArgs.new line, arguments, value end |
#process_array(line, array) ⇒ Object
53 54 55 |
# File 'lib/rubinius/code/processor/processor.rb', line 53 def process_array(line, array) AST::ArrayLiteral.new line, array end |
#process_attrasgn(line, receiver, name, arguments) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/rubinius/code/processor/processor.rb', line 57 def process_attrasgn(line, receiver, name, arguments) if name == :[]= AST::ElementAssignment.new line, receiver, arguments else AST::AttributeAssignment.new line, receiver, name, arguments end end |
#process_back_ref(line, ref) ⇒ Object
65 66 67 |
# File 'lib/rubinius/code/processor/processor.rb', line 65 def process_back_ref(line, ref) AST::BackRef.new line, ref end |
#process_begin(line, body) ⇒ Object
69 70 71 |
# File 'lib/rubinius/code/processor/processor.rb', line 69 def process_begin(line, body) AST::Begin.new line, body end |
#process_block(line, array) ⇒ Object
73 74 75 |
# File 'lib/rubinius/code/processor/processor.rb', line 73 def process_block(line, array) AST::Block.new line, array end |
#process_block_arg(line, name) ⇒ Object
77 78 79 |
# File 'lib/rubinius/code/processor/processor.rb', line 77 def process_block_arg(line, name) AST::BlockArgument.new line, name end |
#process_block_pass(line, arguments, body) ⇒ Object
81 82 83 |
# File 'lib/rubinius/code/processor/processor.rb', line 81 def process_block_pass(line, arguments, body) AST::BlockPass19.new line, arguments, body end |
#process_break(line, value) ⇒ Object
85 86 87 |
# File 'lib/rubinius/code/processor/processor.rb', line 85 def process_break(line, value) AST::Break.new line, value end |
#process_call(line, receiver, name, arguments) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/rubinius/code/processor/processor.rb', line 89 def process_call(line, receiver, name, arguments) if arguments.kind_of? AST::BlockPass block = arguments arguments = block.arguments block.arguments = nil else block = nil end if node = process_transforms(line, receiver, name, arguments) node.block = block if block return node end if arguments node = AST::SendWithArguments.new line, receiver, name, arguments else node = AST::Send.new line, receiver, name end node.block = block node end |
#process_case(line, receiver, whens, else_body) ⇒ Object
137 138 139 140 141 142 143 |
# File 'lib/rubinius/code/processor/processor.rb', line 137 def process_case(line, receiver, whens, else_body) if receiver AST::ReceiverCase.new line, receiver, whens, else_body else AST::Case.new line, whens, else_body end end |
#process_cdecl(line, expr, value) ⇒ Object
145 146 147 |
# File 'lib/rubinius/code/processor/processor.rb', line 145 def process_cdecl(line, expr, value) AST::ConstantAssignment.new line, expr, value end |
#process_class(line, name, superclass, body) ⇒ Object
149 150 151 |
# File 'lib/rubinius/code/processor/processor.rb', line 149 def process_class(line, name, superclass, body) AST::Class.new line, name, superclass, body end |
#process_colon2(line, outer, name) ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/rubinius/code/processor/processor.rb', line 153 def process_colon2(line, outer, name) if outer if outer.kind_of? AST::ConstantAccess and outer.name == :Rubinius case name when :Type AST::TypeConstant.new line when :Mirror AST::MirrorConstant.new line else AST::ScopedConstant.new line, outer, name end else AST::ScopedConstant.new line, outer, name end else AST::ConstantAccess.new line, name end end |
#process_colon3(line, name) ⇒ Object
173 174 175 |
# File 'lib/rubinius/code/processor/processor.rb', line 173 def process_colon3(line, name) AST::ToplevelConstant.new line, name end |
#process_const(line, name) ⇒ Object
177 178 179 |
# File 'lib/rubinius/code/processor/processor.rb', line 177 def process_const(line, name) AST::ConstantAccess.new line, name end |
#process_cvar(line, name) ⇒ Object
181 182 183 |
# File 'lib/rubinius/code/processor/processor.rb', line 181 def process_cvar(line, name) AST::ClassVariableAccess.new line, name end |
#process_cvasgn(line, name, value) ⇒ Object
185 186 187 |
# File 'lib/rubinius/code/processor/processor.rb', line 185 def process_cvasgn(line, name, value) AST::ClassVariableAssignment.new line, name, value end |
#process_cvdecl(line, name, value) ⇒ Object
189 190 191 |
# File 'lib/rubinius/code/processor/processor.rb', line 189 def process_cvdecl(line, name, value) AST::ClassVariableDeclaration.new line, name, value end |
#process_dangling_node ⇒ Object
10 11 12 13 |
# File 'lib/rubinius/code/processor/processor.rb', line 10 def process_dangling_node puts "Processing called but node was NULL" # TODO: output info about the current AST node end |
#process_defined(line, expr) ⇒ Object
193 194 195 |
# File 'lib/rubinius/code/processor/processor.rb', line 193 def process_defined(line, expr) AST::Defined.new line, expr end |
#process_defn(line, name, body) ⇒ Object
197 198 199 |
# File 'lib/rubinius/code/processor/processor.rb', line 197 def process_defn(line, name, body) AST::Define.new line, name, body end |
#process_defnm(line, name, body) ⇒ Object
201 202 203 |
# File 'lib/rubinius/code/processor/processor.rb', line 201 def process_defnm(line, name, body) AST::DefineMulti.new line, name, body end |
#process_defs(line, receiver, name, body) ⇒ Object
205 206 207 |
# File 'lib/rubinius/code/processor/processor.rb', line 205 def process_defs(line, receiver, name, body) AST::DefineSingleton.new line, receiver, name, body end |
#process_defsm(line, receiver, name, body) ⇒ Object
209 210 211 |
# File 'lib/rubinius/code/processor/processor.rb', line 209 def process_defsm(line, receiver, name, body) AST::DefineSingletonMulti.new line, receiver, name, body end |
#process_dot2(line, start, finish) ⇒ Object
213 214 215 |
# File 'lib/rubinius/code/processor/processor.rb', line 213 def process_dot2(line, start, finish) AST::Range.new line, start, finish end |
#process_dot3(line, start, finish) ⇒ Object
217 218 219 |
# File 'lib/rubinius/code/processor/processor.rb', line 217 def process_dot3(line, start, finish) AST::RangeExclude.new line, start, finish end |
#process_dregx(line, str, array, flags) ⇒ Object
221 222 223 |
# File 'lib/rubinius/code/processor/processor.rb', line 221 def process_dregx(line, str, array, flags) AST::DynamicRegex.new line, str, array, flags end |
#process_dregx_once(line, str, array, flags) ⇒ Object
225 226 227 |
# File 'lib/rubinius/code/processor/processor.rb', line 225 def process_dregx_once(line, str, array, flags) AST::DynamicOnceRegex.new line, str, array, flags end |
#process_dstr(line, str, array) ⇒ Object
229 230 231 |
# File 'lib/rubinius/code/processor/processor.rb', line 229 def process_dstr(line, str, array) AST::DynamicString.new line, str, array end |
#process_dsym(line, str, array) ⇒ Object
233 234 235 |
# File 'lib/rubinius/code/processor/processor.rb', line 233 def process_dsym(line, str, array) AST::DynamicSymbol.new line, str, array end |
#process_dxstr(line, str, array) ⇒ Object
237 238 239 |
# File 'lib/rubinius/code/processor/processor.rb', line 237 def process_dxstr(line, str, array) AST::DynamicExecuteString.new line, str, array end |
#process_encoding(line, name) ⇒ Object
241 242 243 |
# File 'lib/rubinius/code/processor/processor.rb', line 241 def process_encoding(line, name) AST::Encoding.new line, name end |
#process_ensure(line, body, ensr) ⇒ Object
245 246 247 |
# File 'lib/rubinius/code/processor/processor.rb', line 245 def process_ensure(line, body, ensr) AST::Ensure.new line, body, ensr end |
#process_evstr(line, value) ⇒ Object
249 250 251 252 253 254 255 |
# File 'lib/rubinius/code/processor/processor.rb', line 249 def process_evstr(line, value) if value AST::ToString.new line, value else AST::StringLiteral.new line, "" end end |
#process_false(line) ⇒ Object
257 258 259 |
# File 'lib/rubinius/code/processor/processor.rb', line 257 def process_false(line) AST::FalseLiteral.new line end |
#process_fcall(line, name, arguments) ⇒ Object
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/rubinius/code/processor/processor.rb', line 261 def process_fcall(line, name, arguments) receiver = AST::Self.new line if arguments.kind_of? AST::BlockPass block = arguments arguments = block.arguments block.arguments = nil else block = nil end if node = process_transforms(line, receiver, name, arguments, true) node.block = block if block return node end if arguments node = AST::SendWithArguments.new line, receiver, name, arguments, true else node = AST::Send.new line, receiver, name, true end node.block = block node end |
#process_file(line) ⇒ Object
287 288 289 |
# File 'lib/rubinius/code/processor/processor.rb', line 287 def process_file(line) AST::File.new line end |
#process_fixnum(line, value) ⇒ Object
291 292 293 |
# File 'lib/rubinius/code/processor/processor.rb', line 291 def process_fixnum(line, value) AST::FixnumLiteral.new line, value end |
#process_flip2(line, start, finish) ⇒ Object
295 296 297 |
# File 'lib/rubinius/code/processor/processor.rb', line 295 def process_flip2(line, start, finish) AST::Flip2.new line, start, finish end |
#process_flip3(line, start, finish) ⇒ Object
299 300 301 |
# File 'lib/rubinius/code/processor/processor.rb', line 299 def process_flip3(line, start, finish) AST::Flip3.new line, start, finish end |
#process_float(line, str) ⇒ Object
303 304 305 |
# File 'lib/rubinius/code/processor/processor.rb', line 303 def process_float(line, str) AST::FloatLiteral.new line, str end |
#process_for(line, iter, arguments, body) ⇒ Object
307 308 309 310 311 |
# File 'lib/rubinius/code/processor/processor.rb', line 307 def process_for(line, iter, arguments, body) send = AST::Send.new line, iter, :each send.block = AST::For.new line, arguments, body send end |
#process_fun(line, name, body) ⇒ Object
313 314 315 |
# File 'lib/rubinius/code/processor/processor.rb', line 313 def process_fun(line, name, body) AST::DefineFunction.new line, name, body end |
#process_funm(line, name, body) ⇒ Object
317 318 319 |
# File 'lib/rubinius/code/processor/processor.rb', line 317 def process_funm(line, name, body) AST::DefineFunctionMulti.new line, name, body end |
#process_gasgn(line, name, expr) ⇒ Object
321 322 323 |
# File 'lib/rubinius/code/processor/processor.rb', line 321 def process_gasgn(line, name, expr) AST::GlobalVariableAssignment.new line, name, expr end |
#process_gvar(line, name) ⇒ Object
325 326 327 |
# File 'lib/rubinius/code/processor/processor.rb', line 325 def process_gvar(line, name) AST::GlobalVariableAccess.for_name line, name end |
#process_hash(line, array) ⇒ Object
329 330 331 |
# File 'lib/rubinius/code/processor/processor.rb', line 329 def process_hash(line, array) AST::HashLiteral.new line, array end |
#process_iasgn(line, name, value) ⇒ Object
333 334 335 |
# File 'lib/rubinius/code/processor/processor.rb', line 333 def process_iasgn(line, name, value) AST::InstanceVariableAssignment.new line, name, value end |
#process_if(line, cond, body, else_body) ⇒ Object
337 338 339 |
# File 'lib/rubinius/code/processor/processor.rb', line 337 def process_if(line, cond, body, else_body) AST::If.new line, cond, body, else_body end |
#process_imaginary(line, value) ⇒ Object
341 342 343 |
# File 'lib/rubinius/code/processor/processor.rb', line 341 def process_imaginary(line, value) AST::ImaginaryLiteral.new line, value end |
#process_iter(line, method_send, scope) ⇒ Object
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/rubinius/code/processor/processor.rb', line 345 def process_iter(line, method_send, scope) ary = scope && scope.array || [] arguments = nil if ary.first.kind_of? AST::Parameters arguments = scope.array.shift end unless arguments arguments = AST::Parameters.new line end case ary.size when 0 body = nil when 1 if scope.locals body = scope else body = scope.array.shift end else body = scope end method_send.block = AST::Iter.new line, arguments, body method_send end |
#process_ivar(line, name) ⇒ Object
374 375 376 |
# File 'lib/rubinius/code/processor/processor.rb', line 374 def process_ivar(line, name) AST::InstanceVariableAccess.new line, name end |
#process_kw_arg(line, arguments) ⇒ Object
378 379 380 |
# File 'lib/rubinius/code/processor/processor.rb', line 378 def process_kw_arg(line, arguments) AST::Block.new line, arguments end |
#process_lambda(line, scope) ⇒ Object
382 383 384 385 386 387 388 389 390 391 |
# File 'lib/rubinius/code/processor/processor.rb', line 382 def process_lambda(line, scope) arguments = scope.array.shift if scope.array.size == 1 body = scope.array.shift else body = scope end AST::Lambda.new line, arguments, body end |
#process_lasgn(line, name, value) ⇒ Object
394 395 396 |
# File 'lib/rubinius/code/processor/processor.rb', line 394 def process_lasgn(line, name, value) AST::LocalVariableAssignment.new line, name, value end |
#process_lit(line, sym) ⇒ Object
398 399 400 |
# File 'lib/rubinius/code/processor/processor.rb', line 398 def process_lit(line, sym) AST::SymbolLiteral.new line, sym end |
#process_lvar(line, name) ⇒ Object
402 403 404 |
# File 'lib/rubinius/code/processor/processor.rb', line 402 def process_lvar(line, name) AST::LocalVariableAccess.new line, name end |
#process_masgn(line, left, right, splat) ⇒ Object
406 407 408 |
# File 'lib/rubinius/code/processor/processor.rb', line 406 def process_masgn(line, left, right, splat) AST::MultipleAssignment.new line, left, right, splat end |
#process_match(line, pattern, flags) ⇒ Object
410 411 412 |
# File 'lib/rubinius/code/processor/processor.rb', line 410 def process_match(line, pattern, flags) AST::Match.new line, pattern, flags end |
#process_match2(line, pattern, value) ⇒ Object
414 415 416 |
# File 'lib/rubinius/code/processor/processor.rb', line 414 def process_match2(line, pattern, value) AST::Match2.new line, pattern, value end |
#process_match3(line, pattern, value) ⇒ Object
418 419 420 |
# File 'lib/rubinius/code/processor/processor.rb', line 418 def process_match3(line, pattern, value) AST::Match3.new line, pattern, value end |
#process_missing_node(line, node_name, node_type) ⇒ Object
This method is analogous to #method_missing. It is called if there is no processing method defined for a node.
17 18 19 |
# File 'lib/rubinius/code/processor/processor.rb', line 17 def process_missing_node(line, node_name, node_type) puts "Unhandled node #{node_name} (#{node_type})" end |
#process_module(line, name, body) ⇒ Object
422 423 424 |
# File 'lib/rubinius/code/processor/processor.rb', line 422 def process_module(line, name, body) AST::Module.new line, name, body end |
#process_negate(line, value) ⇒ Object
426 427 428 |
# File 'lib/rubinius/code/processor/processor.rb', line 426 def process_negate(line, value) AST::Negate.new line, value end |
#process_next(line, value) ⇒ Object
430 431 432 |
# File 'lib/rubinius/code/processor/processor.rb', line 430 def process_next(line, value) AST::Next.new line, value end |
#process_nil(line) ⇒ Object
434 435 436 |
# File 'lib/rubinius/code/processor/processor.rb', line 434 def process_nil(line) AST::NilLiteral.new line end |
#process_not(line, value) ⇒ Object
438 439 440 |
# File 'lib/rubinius/code/processor/processor.rb', line 438 def process_not(line, value) AST::Not.new line, value end |
#process_nth_ref(line, ref) ⇒ Object
442 443 444 |
# File 'lib/rubinius/code/processor/processor.rb', line 442 def process_nth_ref(line, ref) AST::NthRef.new line, ref end |
#process_number(line, value) ⇒ Object
446 447 448 449 450 451 452 453 |
# File 'lib/rubinius/code/processor/processor.rb', line 446 def process_number(line, value) case value when Fixnum AST::FixnumLiteral.new line, value when Bignum AST::NumberLiteral.new line, value end end |
#process_op_asgn1(line, receiver, index, op, value) ⇒ Object
455 456 457 |
# File 'lib/rubinius/code/processor/processor.rb', line 455 def process_op_asgn1(line, receiver, index, op, value) AST::OpAssignElement.new line, receiver, index, op, value end |
#process_op_asgn2(line, receiver, anddot, name, op, value) ⇒ Object
459 460 461 462 463 464 465 |
# File 'lib/rubinius/code/processor/processor.rb', line 459 def process_op_asgn2(line, receiver, anddot, name, op, value) if anddot AST::AndOpAssignAttribute.new line, receiver, name, op, value else AST::OpAssignAttribute.new line, receiver, name, op, value end end |
#process_op_asgn_and(line, var, value) ⇒ Object
467 468 469 |
# File 'lib/rubinius/code/processor/processor.rb', line 467 def process_op_asgn_and(line, var, value) AST::OpAssignAnd.new line, var, value end |
#process_op_asgn_or(line, var, value) ⇒ Object
471 472 473 |
# File 'lib/rubinius/code/processor/processor.rb', line 471 def process_op_asgn_or(line, var, value) AST::OpAssignOr.new line, var, value end |
#process_op_cdecl(line, var, value, op) ⇒ Object
475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/rubinius/code/processor/processor.rb', line 475 def process_op_cdecl(line, var, value, op) op_value = case op when :and AST::And.new line, var, value when :or AST::Or.new line, var, value else args = AST::ArrayLiteral.new line, [value] AST::SendWithArguments.new line, var, op, args end AST::ConstantAssignment.new line, var, op_value end |
#process_opt_arg(line, arguments) ⇒ Object
488 489 490 |
# File 'lib/rubinius/code/processor/processor.rb', line 488 def process_opt_arg(line, arguments) AST::Block.new line, arguments end |
#process_or(line, left, right) ⇒ Object
492 493 494 |
# File 'lib/rubinius/code/processor/processor.rb', line 492 def process_or(line, left, right) AST::Or.new line, left, right end |
#process_parse_error(message, column, line, source) ⇒ Object
5 6 7 8 |
# File 'lib/rubinius/code/processor/processor.rb', line 5 def process_parse_error(, column, line, source) msg = "#{}: #{@name}:#{line}:#{column}" @syntax_errors << SyntaxError.from(msg, column, line, source, @name) end |
#process_postarg(line, into, rest) ⇒ Object
496 497 498 |
# File 'lib/rubinius/code/processor/processor.rb', line 496 def process_postarg(line, into, rest) AST::PostArg.new line, into, rest end |
#process_postexe(line, body) ⇒ Object
500 501 502 503 504 |
# File 'lib/rubinius/code/processor/processor.rb', line 500 def process_postexe(line, body) node = AST::Send.new line, AST::Self.new(line), :at_exit, true node.block = AST::Iter.new line, nil, body node end |
#process_preexe(line, body) ⇒ Object
506 507 508 509 510 511 |
# File 'lib/rubinius/code/processor/processor.rb', line 506 def process_preexe(line, body) node = AST::PreExe19.new line node.block = AST::Iter.new line, nil, body add_pre_exe node node end |
#process_qcall(line, receiver, name, arguments) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/rubinius/code/processor/processor.rb', line 113 def process_qcall(line, receiver, name, arguments) if arguments.kind_of? AST::BlockPass block = arguments arguments = block.arguments block.arguments = nil else block = nil end if node = process_transforms(line, receiver, name, arguments) node.block = block if block return node end if arguments node = AST::AndSendWithArguments.new line, receiver, name, arguments else node = AST::AndSend.new line, receiver, name end node.block = block node end |
#process_rational(line, value) ⇒ Object
513 514 515 |
# File 'lib/rubinius/code/processor/processor.rb', line 513 def process_rational(line, value) AST::RationalLiteral.new line, value end |
#process_redo(line) ⇒ Object
517 518 519 |
# File 'lib/rubinius/code/processor/processor.rb', line 517 def process_redo(line) AST::Redo.new line end |
#process_regex(line, str, flags) ⇒ Object
521 522 523 |
# File 'lib/rubinius/code/processor/processor.rb', line 521 def process_regex(line, str, flags) AST::RegexLiteral.new line, str, flags end |
#process_resbody(line, conditions, body, nxt) ⇒ Object
525 526 527 |
# File 'lib/rubinius/code/processor/processor.rb', line 525 def process_resbody(line, conditions, body, nxt) AST::RescueCondition.new line, conditions, body, nxt end |
#process_rescue(line, body, rescue_body, else_body) ⇒ Object
529 530 531 |
# File 'lib/rubinius/code/processor/processor.rb', line 529 def process_rescue(line, body, rescue_body, else_body) AST::Rescue.new line, body, rescue_body, else_body end |
#process_retry(line) ⇒ Object
533 534 535 |
# File 'lib/rubinius/code/processor/processor.rb', line 533 def process_retry(line) AST::Retry.new line end |
#process_return(line, value) ⇒ Object
537 538 539 |
# File 'lib/rubinius/code/processor/processor.rb', line 537 def process_return(line, value) AST::Return.new line, value end |
#process_sclass(line, receiver, body) ⇒ Object
541 542 543 |
# File 'lib/rubinius/code/processor/processor.rb', line 541 def process_sclass(line, receiver, body) AST::SClass.new line, receiver, body end |
#process_scope(line, arguments, body, locals) ⇒ Object
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 |
# File 'lib/rubinius/code/processor/processor.rb', line 545 def process_scope(line, arguments, body, locals) case body when AST::Begin if body.rescue.kind_of? AST::NilLiteral return nil unless arguments end body = AST::Block.new line, [body.rescue] when AST::Block ary = body.array if ary.size > 1 and ary.first.kind_of?(AST::Begin) and ary.first.rescue.kind_of?(AST::NilLiteral) ary.shift end when nil # Nothing else body = AST::Block.new line, [body] end if arguments and body body.array.unshift arguments end body.locals = locals if locals body end |
#process_self(line) ⇒ Object
574 575 576 |
# File 'lib/rubinius/code/processor/processor.rb', line 574 def process_self(line) AST::Self.new line end |
#process_splat(line, expr) ⇒ Object
578 579 580 |
# File 'lib/rubinius/code/processor/processor.rb', line 578 def process_splat(line, expr) AST::SplatValue.new line, expr end |
#process_str(line, str) ⇒ Object
582 583 584 |
# File 'lib/rubinius/code/processor/processor.rb', line 582 def process_str(line, str) AST::StringLiteral.new line, str end |
#process_super(line, arguments) ⇒ Object
586 587 588 589 590 591 592 593 594 595 596 597 598 |
# File 'lib/rubinius/code/processor/processor.rb', line 586 def process_super(line, arguments) if arguments.kind_of? AST::BlockPass block = arguments arguments = block.arguments block.arguments = nil else block = nil end node = AST::Super.new line, arguments node.block = block node end |
#process_svalue(line, expr) ⇒ Object
600 601 602 |
# File 'lib/rubinius/code/processor/processor.rb', line 600 def process_svalue(line, expr) AST::SValue.new line, expr end |
#process_to_ary(line, expr) ⇒ Object
604 605 606 |
# File 'lib/rubinius/code/processor/processor.rb', line 604 def process_to_ary(line, expr) AST::ToArray.new line, expr end |
#process_true(line) ⇒ Object
608 609 610 |
# File 'lib/rubinius/code/processor/processor.rb', line 608 def process_true(line) AST::TrueLiteral.new line end |
#process_undef(line, sym) ⇒ Object
612 613 614 |
# File 'lib/rubinius/code/processor/processor.rb', line 612 def process_undef(line, sym) AST::Undef.new line, sym end |
#process_until(line, cond, body, check_first) ⇒ Object
616 617 618 |
# File 'lib/rubinius/code/processor/processor.rb', line 616 def process_until(line, cond, body, check_first) AST::Until.new line, cond, body, check_first end |
#process_valias(line, to, from) ⇒ Object
630 631 632 |
# File 'lib/rubinius/code/processor/processor.rb', line 630 def process_valias(line, to, from) AST::VAlias.new line, to, from end |
#process_values(line, first, rest) ⇒ Object
634 635 636 637 |
# File 'lib/rubinius/code/processor/processor.rb', line 634 def process_values(line, first, rest) rest.body.unshift first rest end |
#process_vcall(line, name) ⇒ Object
620 621 622 623 624 625 626 627 628 |
# File 'lib/rubinius/code/processor/processor.rb', line 620 def process_vcall(line, name) receiver = AST::Self.new line if node = process_transforms(line, receiver, name, nil, true) return node end AST::Send.new line, receiver, name, true, true end |
#process_when(line, conditions, body) ⇒ Object
639 640 641 |
# File 'lib/rubinius/code/processor/processor.rb', line 639 def process_when(line, conditions, body) AST::When.new line, conditions, body end |
#process_while(line, cond, body, check_first) ⇒ Object
643 644 645 |
# File 'lib/rubinius/code/processor/processor.rb', line 643 def process_while(line, cond, body, check_first) AST::While.new line, cond, body, check_first end |
#process_xstr(line, str) ⇒ Object
647 648 649 |
# File 'lib/rubinius/code/processor/processor.rb', line 647 def process_xstr(line, str) AST::ExecuteString.new line, str end |
#process_yield(line, arguments, unwrap) ⇒ Object
651 652 653 |
# File 'lib/rubinius/code/processor/processor.rb', line 651 def process_yield(line, arguments, unwrap) AST::Yield.new line, arguments, unwrap end |
#process_zarray(line) ⇒ Object
655 656 657 |
# File 'lib/rubinius/code/processor/processor.rb', line 655 def process_zarray(line) AST::EmptyArray.new line end |
#process_zsuper(line) ⇒ Object
659 660 661 |
# File 'lib/rubinius/code/processor/processor.rb', line 659 def process_zsuper(line) AST::ZSuper.new line end |