Class: Rubinius::Melbourne

Inherits:
Object
  • Object
show all
Defined in:
lib/melbourne.rb,
lib/melbourne/processor.rb

Direct Known Subclasses

Melbourne19

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, line, transforms = []) ⇒ Melbourne

Returns a new instance of Melbourne.



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/melbourne.rb', line 73

def initialize(name, line, transforms=[])
  @name = name
  @line = line
  @transforms = transforms
  @magic_handler = nil
  @data_offset = nil
  @pre_exe = []

  # There can be multiple reported, we need to track them all.
  @syntax_errors = []
end

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/melbourne/processor.rb', line 22

def method_missing(sym, *args)
  puts " *** missing #{sym} #{args.map { |x| x.inspect}.join(", ")}"
end

Instance Attribute Details

#magic_handlerObject

Returns the value of attribute magic_handler.



50
51
52
# File 'lib/melbourne.rb', line 50

def magic_handler
  @magic_handler
end

#pre_exeObject (readonly)

Returns the value of attribute pre_exe.



52
53
54
# File 'lib/melbourne.rb', line 52

def pre_exe
  @pre_exe
end

#referencesObject

Returns the value of attribute references.



51
52
53
# File 'lib/melbourne.rb', line 51

def references
  @references
end

#syntax_errorsObject (readonly)

Returns the value of attribute syntax_errors.



85
86
87
# File 'lib/melbourne.rb', line 85

def syntax_errors
  @syntax_errors
end

#transformsObject

Returns the value of attribute transforms.



49
50
51
# File 'lib/melbourne.rb', line 49

def transforms
  @transforms
end

Class Method Details

.parse_file(name, line = 1) ⇒ Object



58
59
60
# File 'lib/melbourne.rb', line 58

def self.parse_file(name, line=1)
  system_parser.new(name, line).parse_file
end

.parse_string(string, name = "(eval)", line = 1) ⇒ Object



54
55
56
# File 'lib/melbourne.rb', line 54

def self.parse_string(string, name="(eval)", line=1)
  system_parser.new(name, line).parse_string string
end

.system_parserObject



62
63
64
65
66
67
68
69
70
71
# File 'lib/melbourne.rb', line 62

def self.system_parser
  case RUBY_VERSION
  when /1\.8/
    Melbourne
  when /1\.9/
    Melbourne19
  else
    raise Exception, "No parser configured for Ruby version #{RUBY_VERSION}."
  end
end

Instance Method Details

#add_magic_comment(str) ⇒ Object



91
92
93
94
95
# File 'lib/melbourne.rb', line 91

def add_magic_comment(str)
  if @magic_handler
    @magic_handler.add_magic_comment str
  end
end

#add_pre_exe(node) ⇒ Object



87
88
89
# File 'lib/melbourne.rb', line 87

def add_pre_exe(node)
  @pre_exe << node if node
end

#parse_fileObject



113
114
115
116
117
118
119
120
121
# File 'lib/melbourne.rb', line 113

def parse_file
  unless @name and File.exists? @name
    raise Errno::ENOENT, @name.inspect
  end

  syntax_error unless ast = file_to_ast(@name, @line)
  ast = AST::EndData.new @data_offset, ast if @data_offset
  ast
end

#parse_string(string) ⇒ Object



108
109
110
111
# File 'lib/melbourne.rb', line 108

def parse_string(string)
  syntax_error unless ast = string_to_ast(string, @name, @line)
  ast
end

#process_alias(line, to, from) ⇒ Object

Processing methods



29
30
31
# File 'lib/melbourne/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/melbourne/processor.rb', line 33

def process_and(line, left, right)
  AST::And.new line, left, right
end

#process_args(line, args, defaults, splat) ⇒ Object



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

def process_args(line, args, defaults, splat)
  AST::FormalArguments.new line, args, defaults, splat
end

#process_argscat(line, array, rest) ⇒ Object



41
42
43
# File 'lib/melbourne/processor.rb', line 41

def process_argscat(line, array, rest)
  AST::ConcatArgs.new line, array, rest
end

#process_argspush(line, arguments, value) ⇒ Object



45
46
47
# File 'lib/melbourne/processor.rb', line 45

def process_argspush(line, arguments, value)
  AST::PushArgs.new line, arguments, value
end

#process_array(line, array) ⇒ Object



49
50
51
# File 'lib/melbourne/processor.rb', line 49

def process_array(line, array)
  AST::ArrayLiteral.new line, array
end

#process_attrasgn(line, receiver, name, arguments) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/melbourne/processor.rb', line 53

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



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

def process_back_ref(line, ref)
  AST::BackRef.new line, ref
end

#process_begin(line, body) ⇒ Object



65
66
67
# File 'lib/melbourne/processor.rb', line 65

def process_begin(line, body)
  AST::Begin.new line, body
end

#process_block(line, array) ⇒ Object



69
70
71
# File 'lib/melbourne/processor.rb', line 69

def process_block(line, array)
  AST::Block.new line, array
end

#process_block_arg(line, name) ⇒ Object



73
74
75
# File 'lib/melbourne/processor.rb', line 73

def process_block_arg(line, name)
  AST::BlockArgument.new line, name
end

#process_block_pass(line, method_send, body) ⇒ Object



77
78
79
80
81
82
83
84
85
# File 'lib/melbourne/processor.rb', line 77

def process_block_pass(line, method_send, body)
  node = AST::BlockPass.new line, body
  if method_send
    method_send.block = node
    method_send
  else
    node
  end
end

#process_break(line, value) ⇒ Object



87
88
89
# File 'lib/melbourne/processor.rb', line 87

def process_break(line, value)
  AST::Break.new line, value
end

#process_call(line, receiver, name, arguments) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/melbourne/processor.rb', line 91

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



115
116
117
118
119
120
121
# File 'lib/melbourne/processor.rb', line 115

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



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

def process_cdecl(line, expr, value)
  AST::ConstantAssignment.new line, expr, value
end

#process_class(line, name, superclass, body) ⇒ Object



127
128
129
# File 'lib/melbourne/processor.rb', line 127

def process_class(line, name, superclass, body)
  AST::Class.new line, name, superclass, body
end

#process_colon2(line, outer, name) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/melbourne/processor.rb', line 131

def process_colon2(line, outer, name)
  if outer
    if name == :Type and
        outer.kind_of? AST::ConstantAccess and
        outer.name == :Rubinius
      AST::TypeConstant.new line
    else
      AST::ScopedConstant.new line, outer, name
    end
  else
    AST::ConstantAccess.new line, name
  end
end

#process_colon3(line, name) ⇒ Object



145
146
147
# File 'lib/melbourne/processor.rb', line 145

def process_colon3(line, name)
  AST::ToplevelConstant.new line, name
end

#process_const(line, name) ⇒ Object



149
150
151
# File 'lib/melbourne/processor.rb', line 149

def process_const(line, name)
  AST::ConstantAccess.new line, name
end

#process_cvar(line, name) ⇒ Object



153
154
155
# File 'lib/melbourne/processor.rb', line 153

def process_cvar(line, name)
  AST::ClassVariableAccess.new line, name
end

#process_cvasgn(line, name, value) ⇒ Object



157
158
159
# File 'lib/melbourne/processor.rb', line 157

def process_cvasgn(line, name, value)
  AST::ClassVariableAssignment.new line, name, value
end

#process_cvdecl(line, name, value) ⇒ Object



161
162
163
# File 'lib/melbourne/processor.rb', line 161

def process_cvdecl(line, name, value)
  AST::ClassVariableDeclaration.new line, name, value
end

#process_dangling_nodeObject



10
11
12
13
# File 'lib/melbourne/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_data(offset) ⇒ Object



97
98
99
# File 'lib/melbourne.rb', line 97

def process_data(offset)
  @data_offset = offset
end

#process_defined(line, expr) ⇒ Object



165
166
167
# File 'lib/melbourne/processor.rb', line 165

def process_defined(line, expr)
  AST::Defined.new line, expr
end

#process_defn(line, name, body) ⇒ Object



169
170
171
# File 'lib/melbourne/processor.rb', line 169

def process_defn(line, name, body)
  AST::Define.new line, name, body
end

#process_defs(line, receiver, name, body) ⇒ Object



173
174
175
# File 'lib/melbourne/processor.rb', line 173

def process_defs(line, receiver, name, body)
  AST::DefineSingleton.new line, receiver, name, body
end

#process_dot2(line, start, finish) ⇒ Object



177
178
179
# File 'lib/melbourne/processor.rb', line 177

def process_dot2(line, start, finish)
  AST::Range.new line, start, finish
end

#process_dot3(line, start, finish) ⇒ Object



181
182
183
# File 'lib/melbourne/processor.rb', line 181

def process_dot3(line, start, finish)
  AST::RangeExclude.new line, start, finish
end

#process_dregx(line, str, array, flags) ⇒ Object



185
186
187
# File 'lib/melbourne/processor.rb', line 185

def process_dregx(line, str, array, flags)
  AST::DynamicRegex.new line, str, array, flags
end

#process_dregx_once(line, str, array, flags) ⇒ Object



189
190
191
# File 'lib/melbourne/processor.rb', line 189

def process_dregx_once(line, str, array, flags)
  AST::DynamicOnceRegex.new line, str, array, flags
end

#process_dstr(line, str, array) ⇒ Object



193
194
195
# File 'lib/melbourne/processor.rb', line 193

def process_dstr(line, str, array)
  AST::DynamicString.new line, str, array
end

#process_dsym(line, str, array) ⇒ Object



197
198
199
# File 'lib/melbourne/processor.rb', line 197

def process_dsym(line, str, array)
  AST::DynamicSymbol.new line, str, array
end

#process_dxstr(line, str, array) ⇒ Object



201
202
203
# File 'lib/melbourne/processor.rb', line 201

def process_dxstr(line, str, array)
  AST::DynamicExecuteString.new line, str, array
end

#process_ensure(line, body, ensr) ⇒ Object



205
206
207
# File 'lib/melbourne/processor.rb', line 205

def process_ensure(line, body, ensr)
  AST::Ensure.new line, body, ensr
end

#process_evstr(line, value) ⇒ Object



209
210
211
212
213
214
215
# File 'lib/melbourne/processor.rb', line 209

def process_evstr(line, value)
  if value
    AST::ToString.new line, value
  else
    AST::StringLiteral.new line, ""
  end
end

#process_false(line) ⇒ Object



217
218
219
# File 'lib/melbourne/processor.rb', line 217

def process_false(line)
  AST::FalseLiteral.new line
end

#process_fcall(line, name, arguments) ⇒ Object



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/melbourne/processor.rb', line 221

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



247
248
249
# File 'lib/melbourne/processor.rb', line 247

def process_file(line)
  AST::File.new line
end

#process_fixnum(line, value) ⇒ Object



251
252
253
# File 'lib/melbourne/processor.rb', line 251

def process_fixnum(line, value)
  AST::FixnumLiteral.new line, value
end

#process_flip2(line, start, finish) ⇒ Object



255
256
257
# File 'lib/melbourne/processor.rb', line 255

def process_flip2(line, start, finish)
  AST::Flip2.new line, start, finish
end

#process_flip3(line, start, finish) ⇒ Object



259
260
261
# File 'lib/melbourne/processor.rb', line 259

def process_flip3(line, start, finish)
  AST::Flip3.new line, start, finish
end

#process_float(line, str) ⇒ Object



263
264
265
# File 'lib/melbourne/processor.rb', line 263

def process_float(line, str)
  AST::FloatLiteral.new line, str
end

#process_for(line, iter, arguments, body) ⇒ Object



267
268
269
270
271
# File 'lib/melbourne/processor.rb', line 267

def process_for(line, iter, arguments, body)
  method_send = AST::Send.new line, iter, :each
  method_send.block = AST::For.new line, arguments, body
  method_send
end

#process_gasgn(line, name, expr) ⇒ Object



273
274
275
# File 'lib/melbourne/processor.rb', line 273

def process_gasgn(line, name, expr)
  AST::GlobalVariableAssignment.new line, name, expr
end

#process_gvar(line, name) ⇒ Object



277
278
279
# File 'lib/melbourne/processor.rb', line 277

def process_gvar(line, name)
  AST::GlobalVariableAccess.for_name line, name
end

#process_hash(line, array) ⇒ Object



281
282
283
# File 'lib/melbourne/processor.rb', line 281

def process_hash(line, array)
  AST::HashLiteral.new line, array
end

#process_iasgn(line, name, value) ⇒ Object



285
286
287
# File 'lib/melbourne/processor.rb', line 285

def process_iasgn(line, name, value)
  AST::InstanceVariableAssignment.new line, name, value
end

#process_if(line, cond, body, else_body) ⇒ Object



289
290
291
# File 'lib/melbourne/processor.rb', line 289

def process_if(line, cond, body, else_body)
  AST::If.new line, cond, body, else_body
end

#process_iter(line, method_send, arguments, body) ⇒ Object



293
294
295
296
# File 'lib/melbourne/processor.rb', line 293

def process_iter(line, method_send, arguments, body)
  method_send.block = AST::Iter.new line, arguments, body
  method_send
end

#process_ivar(line, name) ⇒ Object



298
299
300
# File 'lib/melbourne/processor.rb', line 298

def process_ivar(line, name)
  AST::InstanceVariableAccess.new line, name
end

#process_lasgn(line, name, value) ⇒ Object



302
303
304
# File 'lib/melbourne/processor.rb', line 302

def process_lasgn(line, name, value)
  AST::LocalVariableAssignment.new line, name, value
end

#process_lit(line, sym) ⇒ Object



306
307
308
# File 'lib/melbourne/processor.rb', line 306

def process_lit(line, sym)
  AST::SymbolLiteral.new line, sym
end

#process_lvar(line, name) ⇒ Object



310
311
312
# File 'lib/melbourne/processor.rb', line 310

def process_lvar(line, name)
  AST::LocalVariableAccess.new line, name
end

#process_masgn(line, left, right, splat) ⇒ Object



314
315
316
# File 'lib/melbourne/processor.rb', line 314

def process_masgn(line, left, right, splat)
  AST::MultipleAssignment.new line, left, right, splat
end

#process_match(line, pattern, flags) ⇒ Object



318
319
320
# File 'lib/melbourne/processor.rb', line 318

def process_match(line, pattern, flags)
  AST::Match.new line, pattern, flags
end

#process_match2(line, pattern, value) ⇒ Object



322
323
324
# File 'lib/melbourne/processor.rb', line 322

def process_match2(line, pattern, value)
  AST::Match2.new line, pattern, value
end

#process_match3(line, pattern, value) ⇒ Object



326
327
328
# File 'lib/melbourne/processor.rb', line 326

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/melbourne/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



330
331
332
# File 'lib/melbourne/processor.rb', line 330

def process_module(line, name, body)
  AST::Module.new line, name, body
end

#process_negate(line, value) ⇒ Object



334
335
336
# File 'lib/melbourne/processor.rb', line 334

def process_negate(line, value)
  AST::Negate.new line, value
end

#process_next(line, value) ⇒ Object



338
339
340
# File 'lib/melbourne/processor.rb', line 338

def process_next(line, value)
  AST::Next.new line, value
end

#process_nil(line) ⇒ Object



342
343
344
# File 'lib/melbourne/processor.rb', line 342

def process_nil(line)
  AST::NilLiteral.new line
end

#process_not(line, value) ⇒ Object



346
347
348
# File 'lib/melbourne/processor.rb', line 346

def process_not(line, value)
  AST::Not.new line, value
end

#process_nth_ref(line, ref) ⇒ Object



350
351
352
# File 'lib/melbourne/processor.rb', line 350

def process_nth_ref(line, ref)
  AST::NthRef.new line, ref
end

#process_number(line, base, str) ⇒ Object

TODO: Fix the way 1.8 parser handles this



355
356
357
358
359
360
361
362
363
# File 'lib/melbourne/processor.rb', line 355

def process_number(line, base, str)
  value = str.to_i base
  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



365
366
367
# File 'lib/melbourne/processor.rb', line 365

def process_op_asgn1(line, receiver, index, op, value)
  AST::OpAssign1.new line, receiver, index, op, value
end

#process_op_asgn2(line, receiver, name, op, value) ⇒ Object



369
370
371
# File 'lib/melbourne/processor.rb', line 369

def process_op_asgn2(line, receiver, name, op, value)
  AST::OpAssign2.new line, receiver, name, op, value
end

#process_op_asgn_and(line, var, value) ⇒ Object



373
374
375
# File 'lib/melbourne/processor.rb', line 373

def process_op_asgn_and(line, var, value)
  AST::OpAssignAnd.new line, var, value
end

#process_op_asgn_or(line, var, value) ⇒ Object



377
378
379
# File 'lib/melbourne/processor.rb', line 377

def process_op_asgn_or(line, var, value)
  AST::OpAssignOr.new line, var, value
end

#process_or(line, left, right) ⇒ Object



381
382
383
# File 'lib/melbourne/processor.rb', line 381

def process_or(line, left, right)
  AST::Or.new line, left, right
end

#process_parse_error(message, column, line, source) ⇒ Object



6
7
8
# File 'lib/melbourne/processor.rb', line 6

def process_parse_error(message, column, line, source)
  @syntax_errors << SyntaxError.from(message, column, line, source, @name)
end

#process_postexe(line) ⇒ Object



385
386
387
# File 'lib/melbourne/processor.rb', line 385

def process_postexe(line)
  AST::Send.new line, AST::Self.new(line), :at_exit, true
end

#process_preexe(line) ⇒ Object



389
390
391
392
393
# File 'lib/melbourne/processor.rb', line 389

def process_preexe(line)
  node = AST::PreExe.new line
  add_pre_exe node
  node
end

#process_redo(line) ⇒ Object



395
396
397
# File 'lib/melbourne/processor.rb', line 395

def process_redo(line)
  AST::Redo.new line
end

#process_regex(line, str, flags) ⇒ Object



399
400
401
# File 'lib/melbourne/processor.rb', line 399

def process_regex(line, str, flags)
  AST::RegexLiteral.new line, str, flags
end

#process_resbody(line, conditions, body, nxt) ⇒ Object



403
404
405
# File 'lib/melbourne/processor.rb', line 403

def process_resbody(line, conditions, body, nxt)
  AST::RescueCondition.new line, conditions, body, nxt
end

#process_rescue(line, body, rescue_body, else_body) ⇒ Object



407
408
409
# File 'lib/melbourne/processor.rb', line 407

def process_rescue(line, body, rescue_body, else_body)
  AST::Rescue.new line, body, rescue_body, else_body
end

#process_retry(line) ⇒ Object



411
412
413
# File 'lib/melbourne/processor.rb', line 411

def process_retry(line)
  AST::Retry.new line
end

#process_return(line, value) ⇒ Object



415
416
417
# File 'lib/melbourne/processor.rb', line 415

def process_return(line, value)
  AST::Return.new line, value
end

#process_sclass(line, receiver, body) ⇒ Object



419
420
421
# File 'lib/melbourne/processor.rb', line 419

def process_sclass(line, receiver, body)
  AST::SClass.new line, receiver, body
end

#process_scope(line, body) ⇒ Object



423
424
425
426
427
428
429
# File 'lib/melbourne/processor.rb', line 423

def process_scope(line, body)
  if body.kind_of? AST::Block
    body
  elsif body
    AST::Block.new line, [body]
  end
end

#process_self(line) ⇒ Object



431
432
433
# File 'lib/melbourne/processor.rb', line 431

def process_self(line)
  AST::Self.new line
end

#process_splat(line, expr) ⇒ Object



435
436
437
# File 'lib/melbourne/processor.rb', line 435

def process_splat(line, expr)
  AST::SplatValue.new line, expr
end

#process_str(line, str) ⇒ Object



439
440
441
# File 'lib/melbourne/processor.rb', line 439

def process_str(line, str)
  AST::StringLiteral.new line, str
end

#process_super(line, arguments) ⇒ Object



443
444
445
# File 'lib/melbourne/processor.rb', line 443

def process_super(line, arguments)
  AST::Super.new line, arguments
end

#process_svalue(line, expr) ⇒ Object



447
448
449
# File 'lib/melbourne/processor.rb', line 447

def process_svalue(line, expr)
  AST::SValue.new line, expr
end

#process_to_ary(line, expr) ⇒ Object



451
452
453
# File 'lib/melbourne/processor.rb', line 451

def process_to_ary(line, expr)
  AST::ToArray.new line, expr
end

#process_transforms(line, receiver, name, arguments, privately = false) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/melbourne.rb', line 123

def process_transforms(line, receiver, name, arguments, privately=false)
  @transforms.each do |transform|
    next unless transform.transform_kind == :call

    if node = transform.match?(line, receiver, name, arguments, privately)
      unless node.kind_of? AST::Node
        node = transform.new line, receiver, name, arguments, privately
      end
      return node
    end
  end
  nil
end

#process_true(line) ⇒ Object



455
456
457
# File 'lib/melbourne/processor.rb', line 455

def process_true(line)
  AST::TrueLiteral.new line
end

#process_undef(line, sym) ⇒ Object



459
460
461
# File 'lib/melbourne/processor.rb', line 459

def process_undef(line, sym)
  AST::Undef.new line, sym
end

#process_until(line, cond, body, check_first) ⇒ Object



463
464
465
# File 'lib/melbourne/processor.rb', line 463

def process_until(line, cond, body, check_first)
  AST::Until.new line, cond, body, check_first
end

#process_valias(line, to, from) ⇒ Object



477
478
479
# File 'lib/melbourne/processor.rb', line 477

def process_valias(line, to, from)
  AST::VAlias.new line, to, from
end

#process_values(line, first, rest) ⇒ Object



481
482
483
484
# File 'lib/melbourne/processor.rb', line 481

def process_values(line, first, rest)
  rest.body.unshift first
  rest
end

#process_vcall(line, name) ⇒ Object



467
468
469
470
471
472
473
474
475
# File 'lib/melbourne/processor.rb', line 467

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



486
487
488
# File 'lib/melbourne/processor.rb', line 486

def process_when(line, conditions, body)
  AST::When.new line, conditions, body
end

#process_while(line, cond, body, check_first) ⇒ Object



490
491
492
# File 'lib/melbourne/processor.rb', line 490

def process_while(line, cond, body, check_first)
  AST::While.new line, cond, body, check_first
end

#process_xstr(line, str) ⇒ Object



494
495
496
# File 'lib/melbourne/processor.rb', line 494

def process_xstr(line, str)
  AST::ExecuteString.new line, str
end

#process_yield(line, arguments, unwrap) ⇒ Object



498
499
500
# File 'lib/melbourne/processor.rb', line 498

def process_yield(line, arguments, unwrap)
  AST::Yield.new line, arguments, unwrap
end

#process_zarray(line) ⇒ Object



502
503
504
# File 'lib/melbourne/processor.rb', line 502

def process_zarray(line)
  AST::EmptyArray.new line
end

#process_zsuper(line) ⇒ Object



506
507
508
# File 'lib/melbourne/processor.rb', line 506

def process_zsuper(line)
  AST::ZSuper.new line
end

#syntax_errorObject



101
102
103
# File 'lib/melbourne.rb', line 101

def syntax_error
  raise @syntax_errors[0] unless @syntax_errors.empty?
end