melbourne 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. data/HISTORY.md +9 -0
  2. data/LICENSE +0 -0
  3. data/README.md +43 -0
  4. data/Rakefile +20 -17
  5. data/ext/melbourne/bstring-license.txt +0 -0
  6. data/ext/melbourne/bstrlib.c +0 -0
  7. data/ext/melbourne/bstrlib.h +0 -0
  8. data/ext/melbourne/extconf.rb +0 -0
  9. data/ext/melbourne/grammar.cpp +0 -0
  10. data/ext/melbourne/grammar.hpp +0 -0
  11. data/ext/melbourne/grammar.y +0 -0
  12. data/ext/melbourne/internal.hpp +0 -0
  13. data/ext/melbourne/lex.c.tab +0 -0
  14. data/ext/melbourne/local_state.hpp +0 -0
  15. data/ext/melbourne/melbourne.cpp +0 -0
  16. data/ext/melbourne/node.hpp +0 -0
  17. data/ext/melbourne/node_types.cpp +0 -0
  18. data/ext/melbourne/node_types.hpp +0 -0
  19. data/ext/melbourne/node_types.rb +0 -0
  20. data/ext/melbourne/quark.cpp +0 -0
  21. data/ext/melbourne/quark.hpp +0 -0
  22. data/ext/melbourne/symbols.cpp +0 -0
  23. data/ext/melbourne/symbols.hpp +0 -0
  24. data/ext/melbourne/var_table.cpp +0 -0
  25. data/ext/melbourne/var_table.hpp +0 -0
  26. data/ext/melbourne/visitor.cpp +0 -0
  27. data/ext/melbourne/visitor.hpp +0 -0
  28. data/lib/melbourne.rb +16 -18
  29. data/lib/melbourne/ast.rb +14 -16
  30. data/lib/melbourne/ast/constants.rb +5 -5
  31. data/lib/melbourne/ast/control_flow.rb +18 -18
  32. data/lib/melbourne/ast/data.rb +1 -1
  33. data/lib/melbourne/ast/definitions.rb +37 -37
  34. data/lib/melbourne/ast/exceptions.rb +9 -9
  35. data/lib/melbourne/ast/file.rb +0 -0
  36. data/lib/melbourne/ast/grapher.rb +7 -1
  37. data/lib/melbourne/ast/literals.rb +14 -14
  38. data/lib/melbourne/ast/node.rb +1 -1
  39. data/lib/melbourne/ast/operators.rb +6 -6
  40. data/lib/melbourne/ast/self.rb +0 -0
  41. data/lib/melbourne/ast/sends.rb +23 -23
  42. data/lib/melbourne/ast/values.rb +6 -6
  43. data/lib/melbourne/ast/variables.rb +15 -15
  44. data/lib/melbourne/parser.rb +1 -1
  45. data/lib/melbourne/processor.rb +1 -1
  46. data/spec/helpers/ast/node.rb +0 -0
  47. data/spec/helpers/ast/reduced_graph.rb +0 -0
  48. data/spec/lib/parser/alias_spec.rb +0 -0
  49. data/spec/lib/parser/and_spec.rb +0 -0
  50. data/spec/lib/parser/array_spec.rb +0 -0
  51. data/spec/lib/parser/attrasgn_spec.rb +0 -0
  52. data/spec/lib/parser/back_ref_spec.rb +0 -0
  53. data/spec/lib/parser/call_spec.rb +0 -0
  54. data/spec/lib/parser/case_spec.rb +0 -0
  55. data/spec/lib/parser/cdecl_spec.rb +0 -0
  56. data/spec/lib/parser/class_spec.rb +0 -0
  57. data/spec/lib/parser/colon2_spec.rb +0 -0
  58. data/spec/lib/parser/colon3_spec.rb +0 -0
  59. data/spec/lib/parser/const_spec.rb +0 -0
  60. data/spec/lib/parser/cvar_spec.rb +0 -0
  61. data/spec/lib/parser/cvasgn_spec.rb +0 -0
  62. data/spec/lib/parser/cvdecl_spec.rb +0 -0
  63. data/spec/lib/parser/defined_spec.rb +0 -0
  64. data/spec/lib/parser/defn_spec.rb +0 -0
  65. data/spec/lib/parser/defs_spec.rb +0 -0
  66. data/spec/lib/parser/dot2_spec.rb +0 -0
  67. data/spec/lib/parser/dot3_spec.rb +0 -0
  68. data/spec/lib/parser/dregx_spec.rb +0 -0
  69. data/spec/lib/parser/dstr_spec.rb +0 -0
  70. data/spec/lib/parser/dsym_spec.rb +0 -0
  71. data/spec/lib/parser/dxstr_spec.rb +0 -0
  72. data/spec/lib/parser/ensure_spec.rb +0 -0
  73. data/spec/lib/parser/false_spec.rb +0 -0
  74. data/spec/lib/parser/flip2_spec.rb +0 -0
  75. data/spec/lib/parser/flip3_spec.rb +0 -0
  76. data/spec/lib/parser/for_spec.rb +0 -0
  77. data/spec/lib/parser/gasgn_spec.rb +0 -0
  78. data/spec/lib/parser/gvar_spec.rb +0 -0
  79. data/spec/lib/parser/hash_spec.rb +0 -0
  80. data/spec/lib/parser/iasgn_spec.rb +0 -0
  81. data/spec/lib/parser/if_spec.rb +0 -0
  82. data/spec/lib/parser/iter_spec.rb +0 -0
  83. data/spec/lib/parser/lasgn_spec.rb +0 -0
  84. data/spec/lib/parser/lit_spec.rb +0 -0
  85. data/spec/lib/parser/masgn_spec.rb +0 -0
  86. data/spec/lib/parser/match2_spec.rb +0 -0
  87. data/spec/lib/parser/match3_spec.rb +0 -0
  88. data/spec/lib/parser/match_spec.rb +0 -0
  89. data/spec/lib/parser/module_spec.rb +0 -0
  90. data/spec/lib/parser/nil_spec.rb +0 -0
  91. data/spec/lib/parser/not_spec.rb +0 -0
  92. data/spec/lib/parser/nth_ref_spec.rb +0 -0
  93. data/spec/lib/parser/op_asgn_spec.rb +0 -0
  94. data/spec/lib/parser/or_spec.rb +0 -0
  95. data/spec/lib/parser/postexe_spec.rb +0 -0
  96. data/spec/lib/parser/regex_spec.rb +0 -0
  97. data/spec/lib/parser/rescue_spec.rb +0 -0
  98. data/spec/lib/parser/return_spec.rb +0 -0
  99. data/spec/lib/parser/sclass_spec.rb +0 -0
  100. data/spec/lib/parser/str_spec.rb +0 -0
  101. data/spec/lib/parser/super_spec.rb +0 -0
  102. data/spec/lib/parser/true_spec.rb +0 -0
  103. data/spec/lib/parser/undef_spec.rb +0 -0
  104. data/spec/lib/parser/until_spec.rb +0 -0
  105. data/spec/lib/parser/valias_spec.rb +0 -0
  106. data/spec/lib/parser/while_spec.rb +0 -0
  107. data/spec/lib/parser/xstr_spec.rb +0 -0
  108. data/spec/lib/parser/yield_spec.rb +0 -0
  109. data/spec/lib/parser/zsuper_spec.rb +0 -0
  110. data/spec/matchers/parse_as.rb +0 -0
  111. data/spec/spec_helper.rb +0 -0
  112. metadata +19 -8
  113. data/HISTORY +0 -3
  114. data/README.rdoc +0 -38
  115. data/VERSION.yml +0 -4
@@ -16,7 +16,7 @@ module Melbourne
16
16
  #
17
17
  attr_accessor :from
18
18
 
19
- def initialize(line, to, from) #:nodoc:
19
+ def initialize(line, to, from)
20
20
  @line = line
21
21
  @to = to
22
22
  @from = from
@@ -25,7 +25,7 @@ module Melbourne
25
25
  end
26
26
 
27
27
  # TODO: document!
28
- class VAlias < Alias #:nodoc:
28
+ class VAlias < Alias
29
29
 
30
30
  end
31
31
 
@@ -39,7 +39,7 @@ module Melbourne
39
39
  #
40
40
  attr_accessor :name
41
41
 
42
- def initialize(line, sym) #:nodoc:
42
+ def initialize(line, sym)
43
43
  @line = line
44
44
  @name = sym
45
45
  end
@@ -61,13 +61,13 @@ module Melbourne
61
61
  #
62
62
  attr_accessor :array
63
63
 
64
- def initialize(line, array) #:nodoc:
64
+ def initialize(line, array)
65
65
  @line = line
66
66
  @array = array
67
67
  end
68
68
 
69
69
  # TODO: document!
70
- def strip_arguments #:nodoc:
70
+ def strip_arguments
71
71
  if @array.first.kind_of? FormalArguments
72
72
  node = @array.shift
73
73
  if @array.first.kind_of? BlockArgument
@@ -80,7 +80,7 @@ module Melbourne
80
80
  end
81
81
 
82
82
  # TODO: document!
83
- class ClosedScope < Node #:nodoc:
83
+ class ClosedScope < Node
84
84
 
85
85
  attr_accessor :body
86
86
 
@@ -101,7 +101,7 @@ module Melbourne
101
101
  #
102
102
  attr_accessor :arguments
103
103
 
104
- def initialize(line, name, block) #:nodoc:
104
+ def initialize(line, name, block)
105
105
  @line = line
106
106
  @name = name
107
107
  @arguments = block.strip_arguments
@@ -126,7 +126,7 @@ module Melbourne
126
126
  #
127
127
  attr_accessor :body
128
128
 
129
- def initialize(line, receiver, name, block) #:nodoc:
129
+ def initialize(line, receiver, name, block)
130
130
  @line = line
131
131
  @receiver = receiver
132
132
  @body = DefineSingletonScope.new line, name, block
@@ -138,7 +138,7 @@ module Melbourne
138
138
  #
139
139
  class DefineSingletonScope < Define
140
140
 
141
- def initialize(line, name, block) #:nodoc:
141
+ def initialize(line, name, block)
142
142
  super line, name, block
143
143
  end
144
144
 
@@ -167,7 +167,7 @@ module Melbourne
167
167
  #
168
168
  attr_accessor :defaults
169
169
 
170
- # The splat (<tt>*some</tt>) arguments of the method
170
+ # The splat (+*some+) arguments of the method
171
171
  #
172
172
  attr_accessor :splat
173
173
 
@@ -175,7 +175,7 @@ module Melbourne
175
175
  #
176
176
  attr_accessor :block_arg
177
177
 
178
- def initialize(line, args, defaults, splat) #:nodoc:
178
+ def initialize(line, args, defaults, splat)
179
179
  @line = line
180
180
  @defaults = nil
181
181
  @block_arg = nil
@@ -203,7 +203,7 @@ module Melbourne
203
203
  @splat = splat
204
204
  end
205
205
 
206
- def block_arg=(node) #:nodoc:
206
+ def block_arg=(node)
207
207
  @names << node.name
208
208
  @block_arg = node
209
209
  end
@@ -232,7 +232,7 @@ module Melbourne
232
232
  end
233
233
 
234
234
  # TODO: document!
235
- def splat_index #:nodoc:
235
+ def splat_index
236
236
  if @splat
237
237
  index = @names.size
238
238
  index -= 1 if @block_arg
@@ -255,7 +255,7 @@ module Melbourne
255
255
  #
256
256
  attr_accessor :names
257
257
 
258
- def initialize(line, block) #:nodoc:
258
+ def initialize(line, block)
259
259
  @line = line
260
260
  array = block.array
261
261
  @names = array.map { |a| a.name }
@@ -264,7 +264,7 @@ module Melbourne
264
264
 
265
265
  end
266
266
 
267
- module LocalVariable #:nodoc:
267
+ module LocalVariable
268
268
 
269
269
  attr_accessor :variable
270
270
 
@@ -283,7 +283,7 @@ module Melbourne
283
283
  #
284
284
  attr_accessor :name
285
285
 
286
- def initialize(line, name) #:nodoc:
286
+ def initialize(line, name)
287
287
  @line = line
288
288
  @name = name
289
289
  end
@@ -308,7 +308,7 @@ module Melbourne
308
308
  #
309
309
  attr_accessor :body
310
310
 
311
- def initialize(line, name, superclass, body) #:nodoc:
311
+ def initialize(line, name, superclass, body)
312
312
  @line = line
313
313
 
314
314
  @superclass = superclass ? superclass : Nil.new(line)
@@ -332,7 +332,7 @@ module Melbourne
332
332
  #
333
333
  class ClassScope < ClosedScope
334
334
 
335
- def initialize(line, name, body) #:nodoc:
335
+ def initialize(line, name, body)
336
336
  @line = line
337
337
  @name = name.name
338
338
  @body = body
@@ -351,9 +351,9 @@ module Melbourne
351
351
  attr_accessor :name
352
352
 
353
353
  # TODO: document!
354
- attr_accessor :superclass #:nodoc:
354
+ attr_accessor :superclass
355
355
 
356
- def initialize(line, name, superclass) #:nodoc:
356
+ def initialize(line, name, superclass)
357
357
  @line = line
358
358
  @name = name
359
359
  @superclass = superclass
@@ -367,11 +367,11 @@ module Melbourne
367
367
  #
368
368
  class ScopedClassName < ClassName
369
369
 
370
- # The parent of the scoped class name; for a class <tt>class X::Y; end</tt> the scoped class name is +Y+ and the parent is +X+
370
+ # The parent of the scoped class name; for a class +class X::Y; end+ the scoped class name is +Y+ and the parent is +X+
371
371
  #
372
372
  attr_accessor :parent
373
373
 
374
- def initialize(line, parent, superclass) #:nodoc:
374
+ def initialize(line, parent, superclass)
375
375
  @line = line
376
376
  @name = parent.name
377
377
  @parent = parent.parent
@@ -394,7 +394,7 @@ module Melbourne
394
394
  #
395
395
  attr_accessor :body
396
396
 
397
- def initialize(line, name, body) #:nodoc:
397
+ def initialize(line, name, body)
398
398
  @line = line
399
399
 
400
400
  if name.kind_of? Symbol
@@ -428,7 +428,7 @@ module Melbourne
428
428
  #
429
429
  attr_accessor :name
430
430
 
431
- def initialize(line, name) #:nodoc:
431
+ def initialize(line, name)
432
432
  @line = line
433
433
  @name = name
434
434
  end
@@ -441,11 +441,11 @@ module Melbourne
441
441
  #
442
442
  class ScopedModuleName < ModuleName
443
443
 
444
- # The parent of the scoped module name; for a module <tt>module X::M; end</tt> the scoped module name is +Y+ and the parent is +X+
444
+ # The parent of the scoped module name; for a module +module X::M; end+ the scoped module name is +Y+ and the parent is +X+
445
445
  #
446
446
  attr_accessor :parent
447
447
 
448
- def initialize(line, parent) #:nodoc:
448
+ def initialize(line, parent)
449
449
  @line = line
450
450
  @name = parent.name
451
451
  @parent = parent.parent
@@ -457,7 +457,7 @@ module Melbourne
457
457
  #
458
458
  class ModuleScope < ClosedScope
459
459
 
460
- def initialize(line, name, body) #:nodoc:
460
+ def initialize(line, name, body)
461
461
  @line = line
462
462
  @name = name.name
463
463
  @body = body
@@ -474,11 +474,11 @@ module Melbourne
474
474
  #
475
475
  class SClass < Node
476
476
 
477
- # The receiver (for <tt>class << self</tt>, +self+ is the receiver)
477
+ # The receiver (for +class << self+, +self+ is the receiver)
478
478
  #
479
479
  attr_accessor :receiver
480
480
 
481
- def initialize(line, receiver, body) #:nodoc:
481
+ def initialize(line, receiver, body)
482
482
  @line = line
483
483
  @receiver = receiver
484
484
  @body = SClassScope.new line, body
@@ -490,7 +490,7 @@ module Melbourne
490
490
  #
491
491
  class SClassScope < ClosedScope
492
492
 
493
- def initialize(line, body) #:nodoc:
493
+ def initialize(line, body)
494
494
  @line = line
495
495
  @body = body
496
496
  @name = nil
@@ -499,7 +499,7 @@ module Melbourne
499
499
  end
500
500
 
501
501
  # TODO: document!
502
- class Container < ClosedScope #:nodoc:
502
+ class Container < ClosedScope
503
503
 
504
504
  attr_accessor :file, :name, :variable_scope
505
505
 
@@ -510,7 +510,7 @@ module Melbourne
510
510
  end
511
511
 
512
512
  # TODO: document!
513
- class EvalExpression < Container #:nodoc:
513
+ class EvalExpression < Container
514
514
 
515
515
  def initialize(body)
516
516
  super body
@@ -520,7 +520,7 @@ module Melbourne
520
520
  end
521
521
 
522
522
  # TODO: document!
523
- class Snippit < Container #:nodoc:
523
+ class Snippit < Container
524
524
 
525
525
  def initialize(body)
526
526
  super body
@@ -530,7 +530,7 @@ module Melbourne
530
530
  end
531
531
 
532
532
  # TODO: document!
533
- class Script < Container #:nodoc:
533
+ class Script < Container
534
534
 
535
535
  def initialize(body)
536
536
  super body
@@ -539,17 +539,17 @@ module Melbourne
539
539
 
540
540
  end
541
541
 
542
- # A <tt>defined?</tt> statement as in:
542
+ # A +defined?+ statement as in:
543
543
  #
544
544
  # defined? a
545
545
  #
546
546
  class Defined < Node
547
547
 
548
- # The expression passed to <tt>defined?</tt>
548
+ # The expression passed to +defined?+
549
549
  #
550
550
  attr_accessor :expression
551
551
 
552
- def initialize(line, expr) #:nodoc:
552
+ def initialize(line, expr)
553
553
  @line = line
554
554
  @expression = expr
555
555
  end
@@ -16,7 +16,7 @@ module Melbourne
16
16
  #
17
17
  attr_accessor :rescue
18
18
 
19
- def initialize(line, body) #:nodoc:
19
+ def initialize(line, body)
20
20
  @line = line
21
21
  @rescue = body
22
22
  end
@@ -45,7 +45,7 @@ module Melbourne
45
45
  #
46
46
  attr_accessor :ensure
47
47
 
48
- def initialize(line, body, ensr) #:nodoc:
48
+ def initialize(line, body, ensr)
49
49
  @line = line
50
50
  @body = body || Nil.new(line)
51
51
  @ensure = ensr
@@ -77,7 +77,7 @@ module Melbourne
77
77
  #
78
78
  attr_accessor :else
79
79
 
80
- def initialize(line, body, rescue_body, else_body) #:nodoc:
80
+ def initialize(line, body, rescue_body, else_body)
81
81
  @line = line
82
82
  @body = body
83
83
  @rescue = rescue_body
@@ -100,7 +100,7 @@ module Melbourne
100
100
  #
101
101
  attr_accessor :conditions
102
102
 
103
- # Assignments in the rescue condition (e.g. <tt>RuntimeError => e</tt>, where +e+ is assigned)
103
+ # Assignments in the rescue condition (e.g. +RuntimeError => e+, where +e+ is assigned)
104
104
  #
105
105
  attr_accessor :assignment
106
106
 
@@ -109,12 +109,12 @@ module Melbourne
109
109
  attr_accessor :body
110
110
 
111
111
  # TODO: document!
112
- attr_accessor :next #:nodoc:
112
+ attr_accessor :next
113
113
 
114
114
  # TODO: document!
115
- attr_accessor :splat #:nodoc:
115
+ attr_accessor :splat
116
116
 
117
- def initialize(line, conditions, body, nxt) #:nodoc:
117
+ def initialize(line, conditions, body, nxt)
118
118
  @line = line
119
119
  @next = nxt
120
120
  @splat = nil
@@ -150,7 +150,7 @@ module Melbourne
150
150
  end
151
151
 
152
152
  # TODO: document!
153
- def assignment?(node) #:nodoc:
153
+ def assignment?(node)
154
154
  case node
155
155
  when VariableAssignment
156
156
  value = node.value
@@ -166,7 +166,7 @@ module Melbourne
166
166
  end
167
167
 
168
168
  # TODO: document!
169
- class RescueSplat < Node #:nodoc:
169
+ class RescueSplat < Node
170
170
 
171
171
  attr_accessor :value
172
172
 
File without changes
@@ -1,6 +1,9 @@
1
1
  module Melbourne
2
+
2
3
  module AST
4
+
3
5
  class AsciiGrapher
6
+
4
7
  def initialize(ast)
5
8
  @ast = ast
6
9
  end
@@ -70,6 +73,9 @@ module Melbourne
70
73
  graph_simple name, value.class, level
71
74
  end
72
75
  end
76
+
73
77
  end
78
+
74
79
  end
75
- end
80
+
81
+ end
@@ -12,7 +12,7 @@ module Melbourne
12
12
  #
13
13
  attr_accessor :body
14
14
 
15
- def initialize(line, array) #:nodoc:
15
+ def initialize(line, array)
16
16
  @line = line
17
17
  @body = array
18
18
  end
@@ -53,7 +53,7 @@ module Melbourne
53
53
  #
54
54
  attr_accessor :value
55
55
 
56
- def initialize(line, str) #:nodoc:
56
+ def initialize(line, str)
57
57
  @line = line
58
58
  @value = str.to_f
59
59
  end
@@ -70,7 +70,7 @@ module Melbourne
70
70
  #
71
71
  attr_accessor :array
72
72
 
73
- def initialize(line, array) #:nodoc:
73
+ def initialize(line, array)
74
74
  @line = line
75
75
  @array = array
76
76
  end
@@ -87,7 +87,7 @@ module Melbourne
87
87
  #
88
88
  attr_accessor :value
89
89
 
90
- def initialize(line, sym) #:nodoc:
90
+ def initialize(line, sym)
91
91
  @line = line
92
92
  @value = sym
93
93
  end
@@ -102,7 +102,7 @@ module Melbourne
102
102
 
103
103
  end
104
104
 
105
- class NumberLiteral < Node #:nodoc:
105
+ class NumberLiteral < Node
106
106
 
107
107
  attr_accessor :value
108
108
 
@@ -119,7 +119,7 @@ module Melbourne
119
119
  #
120
120
  class FixnumLiteral < NumberLiteral
121
121
 
122
- def initialize(line, value) #:nodoc:
122
+ def initialize(line, value)
123
123
  @line = line
124
124
  @value = value
125
125
  end
@@ -140,7 +140,7 @@ module Melbourne
140
140
  #
141
141
  attr_accessor :finish
142
142
 
143
- def initialize(line, start, finish) #:nodoc:
143
+ def initialize(line, start, finish)
144
144
  @line = line
145
145
  @start = start
146
146
  @finish = finish
@@ -154,7 +154,7 @@ module Melbourne
154
154
  #
155
155
  class RangeExclude < Range
156
156
 
157
- def initialize(line, start, finish) #:nodoc:
157
+ def initialize(line, start, finish)
158
158
  @line = line
159
159
  @start = start
160
160
  @finish = finish
@@ -176,7 +176,7 @@ module Melbourne
176
176
  #
177
177
  attr_accessor :options
178
178
 
179
- def initialize(line, str, flags) #:nodoc:
179
+ def initialize(line, str, flags)
180
180
  @line = line
181
181
  @source = str
182
182
  @options = flags
@@ -194,7 +194,7 @@ module Melbourne
194
194
  #
195
195
  attr_accessor :string
196
196
 
197
- def initialize(line, str) #:nodoc:
197
+ def initialize(line, str)
198
198
  @line = line
199
199
  @string = str
200
200
  end
@@ -211,9 +211,9 @@ module Melbourne
211
211
  #
212
212
  attr_accessor :array
213
213
 
214
- attr_accessor :options #:nodoc:
214
+ attr_accessor :options
215
215
 
216
- def initialize(line, str, array) #:nodoc:
216
+ def initialize(line, str, array)
217
217
  @line = line
218
218
  @string = str
219
219
  @array = array
@@ -243,7 +243,7 @@ module Melbourne
243
243
  #
244
244
  class DynamicRegex < DynamicString
245
245
 
246
- def initialize(line, str, array, flags) #:nodoc:
246
+ def initialize(line, str, array, flags)
247
247
  super line, str, array
248
248
  @options = flags || 0
249
249
  end
@@ -251,7 +251,7 @@ module Melbourne
251
251
  end
252
252
 
253
253
  # TODO: document!
254
- class DynamicOnceRegex < DynamicRegex #:nodoc:
254
+ class DynamicOnceRegex < DynamicRegex
255
255
 
256
256
  end
257
257