ruby_parser 2.3.1 → 3.0.0.a1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ruby_parser might be problematic. Click here for more details.

@@ -3,10 +3,15 @@ require 'racc/parser'
3
3
  require 'sexp'
4
4
  require 'strscan'
5
5
 
6
+ def d o
7
+ $stderr.puts o.inspect
8
+ end
9
+
6
10
  # WHY do I have to do this?!?
7
11
  class Regexp
8
- unless defined? ONCE then
9
- ONCE = 0 # 16 # ?
12
+ ONCE = 0 unless defined? ONCE # FIX: remove this - it makes no sense
13
+
14
+ unless defined? ENC_NONE then
10
15
  ENC_NONE = /x/n.options
11
16
  ENC_EUC = /x/e.options
12
17
  ENC_SJIS = /x/s.options
@@ -47,11 +52,6 @@ class RPStringScanner < StringScanner
47
52
 
48
53
  # TODO: once we get rid of these, we can make things like
49
54
  # TODO: current_line and lineno much more accurate and easy to do
50
- def unread c # TODO: remove this entirely - we should not need it
51
- return if c.nil? # UGH
52
- warn({:unread => caller[0]}.inspect) if ENV['TALLY']
53
- string[pos, 0] = c
54
- end
55
55
 
56
56
  def unread_many str # TODO: remove this entirely - we should not need it
57
57
  warn({:unread_many => caller[0]}.inspect) if ENV['TALLY']
@@ -59,14 +59,6 @@ class RPStringScanner < StringScanner
59
59
  string[pos, 0] = str
60
60
  end
61
61
 
62
- def begin_of_line?
63
- pos == 0 or string[pos-1] == ?\n
64
- end
65
-
66
- def was_begin_of_line # TODO: kill me
67
- pos <= 2 or string[pos-2] == ?\n
68
- end
69
-
70
62
  if ENV['DEBUG'] then
71
63
  alias :old_getch :getch
72
64
  def getch
@@ -78,7 +70,7 @@ class RPStringScanner < StringScanner
78
70
  alias :old_scan :scan
79
71
  def scan re
80
72
  s = old_scan re
81
- p :scan => [s, caller.first] if s
73
+ d :scan => [s, caller.first] if s
82
74
  s
83
75
  end
84
76
  end
@@ -122,8 +114,8 @@ class RPStringScanner < StringScanner
122
114
  # end
123
115
  end
124
116
 
125
- class RubyParser < Racc::Parser
126
- VERSION = '2.3.1' unless constants.include? "VERSION" # SIGH
117
+ module RubyParserStuff
118
+ VERSION = '3.0.0.a1' unless constants.include? "VERSION" # SIGH
127
119
 
128
120
  attr_accessor :lexer, :in_def, :in_single, :file
129
121
  attr_reader :env, :comments
@@ -149,7 +141,32 @@ class RubyParser < Racc::Parser
149
141
  node1
150
142
  end
151
143
 
152
- def args arg, optarg, rest_arg, block_arg
144
+ def block_var ary, splat, block
145
+ ary ||= s(:array)
146
+
147
+ if splat then
148
+ if splat == s(:splat) then
149
+ ary << splat
150
+ else
151
+ ary << s(:splat, splat)
152
+ end
153
+ end
154
+
155
+ if block then
156
+ block[-1] = :"&#{block[-1]}"
157
+ ary << block
158
+ end
159
+
160
+ result = if ary.length > 2 or ary.splat then
161
+ s(:masgn, ary)
162
+ else
163
+ ary.last
164
+ end
165
+
166
+ result
167
+ end
168
+
169
+ def args arg, optarg, rest_arg, block_arg, post_arg = nil
153
170
  arg ||= s(:args)
154
171
 
155
172
  result = arg
@@ -161,15 +178,53 @@ class RubyParser < Racc::Parser
161
178
  end
162
179
 
163
180
  result << rest_arg if rest_arg
181
+
164
182
  result << :"&#{block_arg.last}" if block_arg
165
183
  result << optarg if optarg # TODO? huh - processed above as well
184
+ post_arg[1..-1].each {|pa| result << pa } if post_arg
185
+
186
+ result
187
+ end
188
+
189
+ def args19 vals # TODO: migrate to args once 1.8 tests pass as well
190
+ result = s(:args)
191
+ block = nil
192
+
193
+ vals.each do |val|
194
+ case val
195
+ when Sexp then
196
+ case val.first
197
+ when :args then
198
+ val[1..-1].each do |name|
199
+ result << name
200
+ end
201
+ when :block_arg then
202
+ result << :"&#{val.last}"
203
+ when :block then
204
+ block = val
205
+ val[1..-1].each do |lasgn| # FIX clean sexp iter
206
+ raise "wtf? #{val.inspect}" unless lasgn[0] == :lasgn
207
+ result << lasgn[1]
208
+ end
209
+ else
210
+ raise "unhandled sexp: #{val.inspect}"
211
+ end
212
+ when Symbol then
213
+ result << val
214
+ when ",", nil then
215
+ # ignore
216
+ else
217
+ raise "unhandled val: #{val.inspect} in #{vals.inspect}"
218
+ end
219
+ end
220
+
221
+ result << block if block
166
222
 
167
223
  result
168
224
  end
169
225
 
170
226
  def aryset receiver, index
171
- index[0] = :arglist if index[0] == :array
172
- s(:attrasgn, receiver, :"[]=", index)
227
+ s(:attrasgn, receiver, :"[]=", *index[1..-1])
173
228
  end
174
229
 
175
230
  def assignable(lhs, value = nil)
@@ -288,7 +343,7 @@ class RubyParser < Racc::Parser
288
343
  end
289
344
  end
290
345
 
291
- return s(:call, lhs, :"=~", s(:arglist, rhs)).line(lhs.line)
346
+ return new_call(lhs, :"=~", argl(rhs)).line(lhs.line)
292
347
  end
293
348
 
294
349
  def gettable(id)
@@ -307,10 +362,8 @@ class RubyParser < Racc::Parser
307
362
  type = env[id]
308
363
  if type then
309
364
  s(type, id)
310
- elsif env.dynamic? and :dvar == env[id] then
311
- s(:lvar, id)
312
365
  else
313
- s(:call, nil, id, s(:arglist))
366
+ new_call(nil, id)
314
367
  end
315
368
  end
316
369
 
@@ -332,7 +385,9 @@ class RubyParser < Racc::Parser
332
385
 
333
386
  def initialize(options = {})
334
387
  super()
335
- self.lexer = RubyLexer.new
388
+
389
+ v = self.class.name[/1[89]/]
390
+ self.lexer = RubyLexer.new v && v.to_i
336
391
  self.lexer.parser = self
337
392
  @env = Environment.new
338
393
  @comments = []
@@ -453,14 +508,37 @@ class RubyParser < Racc::Parser
453
508
  return result
454
509
  end
455
510
 
511
+ def argl x
512
+ x = s(:arglist, x) if x and x[0] != :arglist
513
+ x
514
+ end
515
+
516
+ def backref_assign_error ref
517
+ # TODO: need a test for this... obviously
518
+ case ref.first
519
+ when :nth_ref then
520
+ raise SyntaxError, "Can't set variable %p" % ref.last
521
+ when :back_ref then
522
+ raise SyntaxError, "Can't set back reference %p" % ref.last
523
+ else
524
+ raise "Unknown backref type: #{ref.inspect}"
525
+ end
526
+ end
527
+
456
528
  def new_call recv, meth, args = nil
457
529
  result = s(:call, recv, meth)
458
530
  result.line = recv.line if recv
459
531
 
532
+ # TODO: need a test with f(&b) to produce block_pass
533
+ # TODO: need a test with f(&b) { } to produce warning
534
+
460
535
  args ||= s(:arglist)
461
536
  args[0] = :arglist if args.first == :array
462
537
  args = s(:arglist, args) unless args.first == :arglist
463
- result << args
538
+
539
+ # HACK quick hack to make this work quickly... easy to clean up above
540
+ result.concat args[1..-1]
541
+
464
542
  result
465
543
  end
466
544
 
@@ -473,6 +551,11 @@ class RubyParser < Racc::Parser
473
551
  body = body.delete_at 3
474
552
  end
475
553
 
554
+ result[2..-1].each do |node|
555
+ block = node.block(:delete)
556
+ node.concat block[1..-1] if block
557
+ end
558
+
476
559
  # else
477
560
  body = nil if body == s(:block)
478
561
  result << body
@@ -483,8 +566,17 @@ class RubyParser < Racc::Parser
483
566
 
484
567
  def new_class val
485
568
  line, path, superclass, body = val[1], val[2], val[3], val[5]
486
- scope = s(:scope, body).compact
487
- result = s(:class, path, superclass, scope)
569
+
570
+ result = s(:class, path, superclass)
571
+
572
+ if body then
573
+ if body.first == :block then
574
+ result.push(*body[1..-1])
575
+ else
576
+ result.push body
577
+ end
578
+ end
579
+
488
580
  result.line = line
489
581
  result.comments = self.comments.pop
490
582
  result
@@ -500,10 +592,16 @@ class RubyParser < Racc::Parser
500
592
  (_, line), name, args, body = val[0], val[1], val[3], val[4]
501
593
  body ||= s(:nil)
502
594
 
503
- body ||= s(:block)
504
- body = s(:block, body) unless body.first == :block
595
+ result = s(:defn, name.to_sym, args)
596
+
597
+ if body then
598
+ if body.first == :block then
599
+ result.push(*body[1..-1])
600
+ else
601
+ result.push body
602
+ end
603
+ end
505
604
 
506
- result = s(:defn, name.to_sym, args, s(:scope, body))
507
605
  result.line = line
508
606
  result.comments = self.comments.pop
509
607
  result
@@ -512,10 +610,16 @@ class RubyParser < Racc::Parser
512
610
  def new_defs val
513
611
  recv, name, args, body = val[1], val[4], val[6], val[7]
514
612
 
515
- body ||= s(:block)
516
- body = s(:block, body) unless body.first == :block
613
+ result = s(:defs, recv, name.to_sym, args)
614
+
615
+ if body then
616
+ if body.first == :block then
617
+ result.push(*body[1..-1])
618
+ else
619
+ result.push body
620
+ end
621
+ end
517
622
 
518
- result = s(:defs, recv, name.to_sym, args, s(:scope, body))
519
623
  result.line = recv.line
520
624
  result.comments = self.comments.pop
521
625
  result
@@ -555,7 +659,7 @@ class RubyParser < Racc::Parser
555
659
  def new_module val
556
660
  line, path, body = val[1], val[2], val[4]
557
661
  body = s(:scope, body).compact
558
- result = s(:module, path, body)
662
+ result = s(:module, path, *body[1..-1])
559
663
  result.line = line
560
664
  result.comments = self.comments.pop
561
665
  result
@@ -574,8 +678,7 @@ class RubyParser < Racc::Parser
574
678
  s(:op_asgn_and, self.gettable(name), lhs)
575
679
  else
576
680
  # TODO: why [2] ?
577
- lhs[2] = new_call(self.gettable(name), asgn_op,
578
- s(:arglist, arg))
681
+ lhs[2] = new_call(self.gettable(name), asgn_op, argl(arg))
579
682
  lhs
580
683
  end
581
684
  result.line = lhs.line
@@ -627,10 +730,28 @@ class RubyParser < Racc::Parser
627
730
  node
628
731
  end
629
732
 
733
+ def new_resbody cond, body
734
+ if body && body.first == :block then
735
+ body.shift # remove block and splat it in directly
736
+ else
737
+ body = [body]
738
+ end
739
+ s(:resbody, cond, *body)
740
+ end
741
+
630
742
  def new_sclass val
631
743
  recv, in_def, in_single, body = val[3], val[4], val[6], val[7]
632
- scope = s(:scope, body).compact
633
- result = s(:sclass, recv, scope)
744
+
745
+ result = s(:sclass, recv)
746
+
747
+ if body then
748
+ if body.first == :block then
749
+ result.push(*body[1..-1])
750
+ else
751
+ result.push body
752
+ end
753
+ end
754
+
634
755
  result.line = val[2]
635
756
  self.in_def = in_def
636
757
  self.in_single = in_single
@@ -654,6 +775,10 @@ class RubyParser < Racc::Parser
654
775
  end
655
776
  end
656
777
 
778
+ def new_until block, expr, pre
779
+ new_until_or_while :until, block, expr, pre
780
+ end
781
+
657
782
  def new_until_or_while type, block, expr, pre
658
783
  other = type == :until ? :while : :until
659
784
  line = [block && block.line, expr.line].compact.min
@@ -671,8 +796,8 @@ class RubyParser < Racc::Parser
671
796
  result
672
797
  end
673
798
 
674
- def new_until block, expr, pre
675
- new_until_or_while :until, block, expr, pre
799
+ def new_when cond, body
800
+ s(:when, cond, body)
676
801
  end
677
802
 
678
803
  def new_while block, expr, pre
@@ -723,12 +848,11 @@ class RubyParser < Racc::Parser
723
848
  rhs = value_expr rhs
724
849
 
725
850
  case lhs[0]
726
- when :gasgn, :iasgn, :lasgn, :dasgn, :dasgn_curr,
727
- :masgn, :cdecl, :cvdecl, :cvasgn then
851
+ when :gasgn, :iasgn, :lasgn, :masgn, :cdecl, :cvdecl, :cvasgn then
728
852
  lhs << rhs
729
853
  when :attrasgn, :call then
730
854
  args = lhs.pop unless Symbol === lhs.last
731
- lhs << arg_add(args, rhs)
855
+ lhs.concat arg_add(args, rhs)[1..-1]
732
856
  when :const then
733
857
  lhs[0] = :cdecl
734
858
  lhs << rhs
@@ -743,7 +867,7 @@ class RubyParser < Racc::Parser
743
867
  raise "bad val: #{str.inspect}" unless String === str
744
868
 
745
869
  self.file = file
746
- self.lexer.src = str
870
+ self.lexer.src = str.dup
747
871
 
748
872
  @yydebug = ENV.has_key? 'DEBUG'
749
873
 
@@ -809,10 +933,9 @@ class RubyParser < Racc::Parser
809
933
  # do nothing for now
810
934
  end
811
935
 
812
- alias :old_yyerror :yyerror
813
936
  def yyerror msg
814
937
  # for now do nothing with the msg
815
- old_yyerror
938
+ super
816
939
  end
817
940
 
818
941
  class Keyword
@@ -998,6 +1121,22 @@ class RubyParser < Racc::Parser
998
1121
  end
999
1122
  end
1000
1123
 
1124
+ class Ruby19Parser < Racc::Parser
1125
+ include RubyParserStuff
1126
+ end
1127
+
1128
+ class Ruby18Parser < Racc::Parser
1129
+ include RubyParserStuff
1130
+ end
1131
+
1132
+ class RubyParser < Ruby18Parser
1133
+ def initialize
1134
+ super
1135
+ warn "WA\RNING: Deprecated: RubyParser. Use Ruby18Parser or Ruby19Parser"
1136
+ warn " from #{caller.first}"
1137
+ end
1138
+ end
1139
+
1001
1140
  ############################################################
1002
1141
  # HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
1003
1142
 
@@ -1023,6 +1162,14 @@ class Sexp
1023
1162
  self.value.to_sym
1024
1163
  end
1025
1164
 
1165
+ def add x
1166
+ raise "no" # TODO: need a test to trigger this
1167
+ end
1168
+
1169
+ def add_all x
1170
+ raise "no" # TODO: need a test to trigger this
1171
+ end
1172
+
1026
1173
  alias :node_type :sexp_type
1027
1174
  alias :values :sexp_body # TODO: retire
1028
1175
  end
@@ -1,15 +1,21 @@
1
1
  #!/usr/local/bin/ruby
2
2
 
3
3
  require 'rubygems'
4
+ gem "minitest"
5
+
4
6
  require 'minitest/autorun'
5
7
  require 'ruby_lexer'
6
- require 'ruby_parser'
8
+ require 'ruby18_parser'
7
9
 
8
10
  class TestRubyLexer < MiniTest::Unit::TestCase
9
11
  alias :deny :refute
10
12
 
11
13
  def setup
12
- p = RubyParser.new
14
+ setup_lexer Ruby18Parser
15
+ end
16
+
17
+ def setup_lexer parser_class
18
+ p = parser_class.new
13
19
  @lex = p.lexer
14
20
  @lex.src = "blah blah"
15
21
  @lex.lex_state = :expr_beg
@@ -125,6 +131,38 @@ class TestRubyLexer < MiniTest::Unit::TestCase
125
131
  util_lex_token "=>", :tASSOC, "=>"
126
132
  end
127
133
 
134
+ def test_yylex_label__18
135
+ util_lex_token("{a:",
136
+ :tLBRACE, "{",
137
+ :tIDENTIFIER, "a",
138
+ :tSYMBEG, ":")
139
+ end
140
+
141
+ def test_yylex_label_in_params__18
142
+ util_lex_token("foo(a:",
143
+ :tIDENTIFIER, "foo",
144
+ :tLPAREN2, "(",
145
+ :tIDENTIFIER, "a",
146
+ :tSYMBEG, ":")
147
+ end
148
+
149
+ def test_yylex_label__19
150
+ setup_lexer Ruby19Parser
151
+
152
+ util_lex_token("{a:",
153
+ :tLBRACE, "{",
154
+ :tLABEL, "a")
155
+ end
156
+
157
+ def test_yylex_label_in_params__19
158
+ setup_lexer Ruby19Parser
159
+
160
+ util_lex_token("foo(a:",
161
+ :tIDENTIFIER, "foo",
162
+ :tLPAREN2, "(",
163
+ :tLABEL, "a")
164
+ end
165
+
128
166
  def test_yylex_back_ref
129
167
  util_lex_token("[$&, $`, $', $+]",
130
168
  :tLBRACK, "[",
@@ -610,7 +648,6 @@ class TestRubyLexer < MiniTest::Unit::TestCase
610
648
  :tEQL, "=",
611
649
  :tSTRING_BEG, "\"",
612
650
  :tSTRING_CONTENT, "blah\nblah\n",
613
- :tSTRING_CONTENT, "",
614
651
  :tSTRING_END, "EOF",
615
652
  :tNL, nil)
616
653
  end
@@ -628,7 +665,6 @@ class TestRubyLexer < MiniTest::Unit::TestCase
628
665
  :tEQL, "=",
629
666
  :tSTRING_BEG, "\"",
630
667
  :tSTRING_CONTENT, "blah\nblah\n",
631
- :tSTRING_CONTENT, "",
632
668
  :tSTRING_END, "EOF",
633
669
  :tNL, nil)
634
670
  end
@@ -805,14 +841,30 @@ class TestRubyLexer < MiniTest::Unit::TestCase
805
841
  util_bad_token "0d42__24"
806
842
  end
807
843
 
808
- def test_yylex_integer_eh_a
809
- util_lex_token '?a', :tINTEGER, 97
844
+ def test_yylex_question_eh_a__18
845
+ @lex = RubyLexer.new 18
846
+
847
+ util_lex_token "?a", :tINTEGER, 97
848
+ end
849
+
850
+ def test_yylex_question_eh_a__19
851
+ @lex = RubyLexer.new 19
852
+
853
+ util_lex_token '?a', :tSTRING, "a"
810
854
  end
811
855
 
812
- def test_yylex_integer_eh_escape_M_escape_C
856
+ def test_yylex_question_eh_escape_M_escape_C__18
857
+ @lex = RubyLexer.new 18
858
+
813
859
  util_lex_token '?\M-\C-a', :tINTEGER, 129
814
860
  end
815
861
 
862
+ def test_yylex_question_eh_escape_M_escape_C__19
863
+ @lex = RubyLexer.new 19
864
+
865
+ util_lex_token '?\M-\C-a', :tSTRING, "\M-\C-a"
866
+ end
867
+
816
868
  def test_yylex_integer_hex
817
869
  util_lex_token "0x2a", :tINTEGER, 42
818
870
  end
@@ -1028,7 +1080,7 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1028
1080
  def test_yylex_open_square_bracket_meth
1029
1081
  util_lex_token("m[3]",
1030
1082
  :tIDENTIFIER, "m",
1031
- "[", "[",
1083
+ :tLBRACK2, "[",
1032
1084
  :tINTEGER, 3,
1033
1085
  :tRBRACK, "]")
1034
1086
  end
@@ -1089,10 +1141,18 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1089
1141
  :tINTEGER, 42)
1090
1142
  end
1091
1143
 
1092
- def test_yylex_question
1144
+ def test_yylex_question__18
1145
+ @lex = RubyLexer.new 18
1146
+
1093
1147
  util_lex_token "?*", :tINTEGER, 42
1094
1148
  end
1095
1149
 
1150
+ def test_yylex_question__19
1151
+ @lex = RubyLexer.new 19
1152
+
1153
+ util_lex_token "?*", :tSTRING, "*"
1154
+ end
1155
+
1096
1156
  def test_yylex_question_bad_eos
1097
1157
  util_bad_token "?"
1098
1158
  end
@@ -1106,7 +1166,9 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1106
1166
  util_lex_token "?\f", :tEH, "?"
1107
1167
  end
1108
1168
 
1109
- def test_yylex_question_ws_backslashed
1169
+ def test_yylex_question_ws_backslashed__18
1170
+ @lex = RubyLexer.new 18
1171
+
1110
1172
  @lex.lex_state = :expr_beg
1111
1173
  util_lex_token "?\\ ", :tINTEGER, 32
1112
1174
  @lex.lex_state = :expr_beg
@@ -1121,6 +1183,23 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1121
1183
  util_lex_token "?\\f", :tINTEGER, 12
1122
1184
  end
1123
1185
 
1186
+ def test_yylex_question_ws_backslashed__19
1187
+ @lex = RubyLexer.new 19
1188
+
1189
+ @lex.lex_state = :expr_beg
1190
+ util_lex_token "?\\ ", :tSTRING, " "
1191
+ @lex.lex_state = :expr_beg
1192
+ util_lex_token "?\\n", :tSTRING, "\n"
1193
+ @lex.lex_state = :expr_beg
1194
+ util_lex_token "?\\t", :tSTRING, "\t"
1195
+ @lex.lex_state = :expr_beg
1196
+ util_lex_token "?\\v", :tSTRING, "\v"
1197
+ @lex.lex_state = :expr_beg
1198
+ util_lex_token "?\\r", :tSTRING, "\r"
1199
+ @lex.lex_state = :expr_beg
1200
+ util_lex_token "?\\f", :tSTRING, "\f"
1201
+ end
1202
+
1124
1203
  def test_yylex_rbracket
1125
1204
  util_lex_token "]", :tRBRACK, "]"
1126
1205
  end
@@ -1614,7 +1693,7 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1614
1693
 
1615
1694
  def test_yylex_string_pct_w
1616
1695
  util_bad_token("%w[s1 s2 ",
1617
- :tAWORDS_BEG, "%w[",
1696
+ :tQWORDS_BEG, "%w[",
1618
1697
  :tSTRING_CONTENT, "s1",
1619
1698
  :tSPACE, nil,
1620
1699
  :tSTRING_CONTENT, "s2",
@@ -1623,7 +1702,7 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1623
1702
 
1624
1703
  def test_yylex_string_pct_w_bs_nl
1625
1704
  util_lex_token("%w[s1 \\\ns2]",
1626
- :tAWORDS_BEG, "%w[",
1705
+ :tQWORDS_BEG, "%w[",
1627
1706
  :tSTRING_CONTENT, "s1",
1628
1707
  :tSPACE, nil,
1629
1708
  :tSTRING_CONTENT, "\ns2",
@@ -1633,7 +1712,7 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1633
1712
 
1634
1713
  def test_yylex_string_pct_w_bs_sp
1635
1714
  util_lex_token("%w[s\\ 1 s\\ 2]",
1636
- :tAWORDS_BEG, "%w[",
1715
+ :tQWORDS_BEG, "%w[",
1637
1716
  :tSTRING_CONTENT, "s 1",
1638
1717
  :tSPACE, nil,
1639
1718
  :tSTRING_CONTENT, "s 2",
@@ -1643,7 +1722,7 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1643
1722
 
1644
1723
  def test_yylex_string_pct_w_tab
1645
1724
  util_lex_token("%w[abc\tdef]",
1646
- :tAWORDS_BEG, "%w[",
1725
+ :tQWORDS_BEG, "%w[",
1647
1726
  :tSTRING_CONTENT, "abc\tdef",
1648
1727
  :tSPACE, nil,
1649
1728
  :tSTRING_END, nil)
@@ -1820,7 +1899,7 @@ class TestRubyLexer < MiniTest::Unit::TestCase
1820
1899
  token = args.shift
1821
1900
  value = args.shift
1822
1901
  assert @lex.advance, "no more tokens"
1823
- assert_equal [token, value], [@lex.token, [@lex.yacc_value].flatten.first]
1902
+ assert_equal [token, value], [@lex.token, [@lex.yacc_value].flatten.first], input
1824
1903
  end
1825
1904
 
1826
1905
  deny @lex.advance, "must be empty, but had #{[@lex.token, @lex.yacc_value].inspect}"