ruby_parser 3.19.1 → 3.19.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2901404db3548ad6415060c14df20ae11431fff4a97420659187601a534eb256
4
- data.tar.gz: 69705481ccbd6a8ffafbb81c25c40890a4683a19440196a19bbcc119f093612a
3
+ metadata.gz: 82ff82f1d9693451e0d2f740f5e7a9cbeaa31034bee66ffa61486bc0f930d60b
4
+ data.tar.gz: 15d8b71b9533534ffaa4184e50f0e5a795e4a7f190bf13a55858f59b17c1ed99
5
5
  SHA512:
6
- metadata.gz: 1a5d89ba1fed1a0a49b5eb71eeb8cc6f80a396d6eaf49bec5742d62cd503916b90136ae689de4fa3a5de180544ba3ef6e8fca03e52bd8349b32c65dfa7962a28
7
- data.tar.gz: c68ae86de3cbd9a1b86b6c5acbd0ecc8d809a30c42f7b50217d5038f262a6f61a3baa739332285d59158af9d3c9c3c8d8742e2eca499cf41536f14332e9f7eb9
6
+ metadata.gz: 78332be9c05d511d05f1c47977c74390658fcc00fc412009dba172d0e53c0e698b8e28c4803c4969720f2d2d29ed3fc891be2a990618098ae0cf04d00ad28e9f
7
+ data.tar.gz: 72f7e1c089bc80662ea2eb8c8056d7bb3bf84ff27224c2d450ffde94abd2fb5ba2317d1405a880bebb2c91ac34bcb7023685065f1a8b2e69f62ed8f6b0362e77
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,13 @@
1
+ === 3.19.2 / 2022-12-03
2
+
3
+ * 5 bug fixes:
4
+
5
+ * Fixed bug parsing array patterns using %w, %i, etc.
6
+ * Fixed dedenting when heredoc has only empty line and interpolation. (mvz)
7
+ * Fixed dsym unescaping. (mvz)
8
+ * Fixed vars in pattern matching that should be lasgn, not lvar.
9
+ * find_pat mid-patterns are now splatted inline, not wrapped in an array_pat.
10
+
1
11
  === 3.19.1 / 2022-04-05
2
12
 
3
13
  * 2 bug fixes:
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ Hoe.add_include_dirs "lib"
12
12
  Hoe.add_include_dirs "../../sexp_processor/dev/lib"
13
13
  Hoe.add_include_dirs "../../minitest/dev/lib"
14
14
  Hoe.add_include_dirs "../../oedipus_lex/dev/lib"
15
+ Hoe.add_include_dirs "../../ruby2ruby/dev/lib"
15
16
 
16
17
  V2 = %w[20 21 22 23 24 25 26 27]
17
18
  V3 = %w[30 31]
data/lib/ruby27_parser.rb CHANGED
@@ -7722,10 +7722,10 @@ racc_reduce_table = [
7722
7722
  1, 364, :_reduce_none,
7723
7723
  1, 364, :_reduce_none,
7724
7724
  1, 364, :_reduce_none,
7725
- 1, 364, :_reduce_none,
7726
- 1, 364, :_reduce_none,
7727
- 1, 364, :_reduce_none,
7728
- 1, 364, :_reduce_none,
7725
+ 1, 364, :_reduce_548,
7726
+ 1, 364, :_reduce_549,
7727
+ 1, 364, :_reduce_550,
7728
+ 1, 364, :_reduce_551,
7729
7729
  1, 364, :_reduce_552,
7730
7730
  1, 364, :_reduce_none,
7731
7731
  1, 344, :_reduce_554,
@@ -11813,13 +11813,29 @@ end
11813
11813
 
11814
11814
  # reduce 547 omitted
11815
11815
 
11816
- # reduce 548 omitted
11816
+ def _reduce_548(val, _values, result)
11817
+ result = ary_to_pat val[0]
11818
+
11819
+ result
11820
+ end
11821
+
11822
+ def _reduce_549(val, _values, result)
11823
+ result = ary_to_pat val[0]
11817
11824
 
11818
- # reduce 549 omitted
11825
+ result
11826
+ end
11827
+
11828
+ def _reduce_550(val, _values, result)
11829
+ result = ary_to_pat val[0]
11830
+
11831
+ result
11832
+ end
11819
11833
 
11820
- # reduce 550 omitted
11834
+ def _reduce_551(val, _values, result)
11835
+ result = ary_to_pat val[0]
11821
11836
 
11822
- # reduce 551 omitted
11837
+ result
11838
+ end
11823
11839
 
11824
11840
  def _reduce_552(val, _values, result)
11825
11841
  # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
@@ -11835,7 +11851,7 @@ end
11835
11851
  def _reduce_554(val, _values, result)
11836
11852
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
11837
11853
  # TODO: assignable(p, $1, 0, &@$);
11838
- result = wrap :lvar, val[0]
11854
+ result = wrap :lasgn, val[0]
11839
11855
 
11840
11856
  result
11841
11857
  end
data/lib/ruby27_parser.y CHANGED
@@ -2453,9 +2453,21 @@ opt_block_args_tail: tCOMMA block_args_tail
2453
2453
  | xstring
2454
2454
  | regexp
2455
2455
  | words
2456
+ {
2457
+ result = ary_to_pat val[0]
2458
+ }
2456
2459
  | qwords
2460
+ {
2461
+ result = ary_to_pat val[0]
2462
+ }
2457
2463
  | symbols
2464
+ {
2465
+ result = ary_to_pat val[0]
2466
+ }
2458
2467
  | qsymbols
2468
+ {
2469
+ result = ary_to_pat val[0]
2470
+ }
2459
2471
  | keyword_variable
2460
2472
  {
2461
2473
  # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
@@ -2469,7 +2481,7 @@ opt_block_args_tail: tCOMMA block_args_tail
2469
2481
  {
2470
2482
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
2471
2483
  # TODO: assignable(p, $1, 0, &@$);
2472
- result = wrap :lvar, val[0]
2484
+ result = wrap :lasgn, val[0]
2473
2485
  }
2474
2486
 
2475
2487
  p_var_ref: tCARET tIDENTIFIER
data/lib/ruby30_parser.rb CHANGED
@@ -7841,10 +7841,10 @@ racc_reduce_table = [
7841
7841
  1, 371, :_reduce_none,
7842
7842
  1, 371, :_reduce_none,
7843
7843
  1, 371, :_reduce_none,
7844
- 1, 371, :_reduce_none,
7845
- 1, 371, :_reduce_none,
7846
- 1, 371, :_reduce_none,
7847
- 1, 371, :_reduce_none,
7844
+ 1, 371, :_reduce_561,
7845
+ 1, 371, :_reduce_562,
7846
+ 1, 371, :_reduce_563,
7847
+ 1, 371, :_reduce_564,
7848
7848
  1, 371, :_reduce_565,
7849
7849
  1, 371, :_reduce_none,
7850
7850
  1, 350, :_reduce_567,
@@ -12038,13 +12038,29 @@ end
12038
12038
 
12039
12039
  # reduce 560 omitted
12040
12040
 
12041
- # reduce 561 omitted
12041
+ def _reduce_561(val, _values, result)
12042
+ result = ary_to_pat val[0]
12043
+
12044
+ result
12045
+ end
12046
+
12047
+ def _reduce_562(val, _values, result)
12048
+ result = ary_to_pat val[0]
12042
12049
 
12043
- # reduce 562 omitted
12050
+ result
12051
+ end
12052
+
12053
+ def _reduce_563(val, _values, result)
12054
+ result = ary_to_pat val[0]
12055
+
12056
+ result
12057
+ end
12044
12058
 
12045
- # reduce 563 omitted
12059
+ def _reduce_564(val, _values, result)
12060
+ result = ary_to_pat val[0]
12046
12061
 
12047
- # reduce 564 omitted
12062
+ result
12063
+ end
12048
12064
 
12049
12065
  def _reduce_565(val, _values, result)
12050
12066
  # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
@@ -12060,7 +12076,7 @@ end
12060
12076
  def _reduce_567(val, _values, result)
12061
12077
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
12062
12078
  # TODO: assignable(p, $1, 0, &@$);
12063
- result = wrap :lvar, val[0]
12079
+ result = wrap :lasgn, val[0]
12064
12080
 
12065
12081
  result
12066
12082
  end
data/lib/ruby30_parser.y CHANGED
@@ -2534,9 +2534,21 @@ opt_block_args_tail: tCOMMA block_args_tail
2534
2534
  | xstring
2535
2535
  | regexp
2536
2536
  | words
2537
+ {
2538
+ result = ary_to_pat val[0]
2539
+ }
2537
2540
  | qwords
2541
+ {
2542
+ result = ary_to_pat val[0]
2543
+ }
2538
2544
  | symbols
2545
+ {
2546
+ result = ary_to_pat val[0]
2547
+ }
2539
2548
  | qsymbols
2549
+ {
2550
+ result = ary_to_pat val[0]
2551
+ }
2540
2552
  | keyword_variable
2541
2553
  {
2542
2554
  # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
@@ -2550,7 +2562,7 @@ opt_block_args_tail: tCOMMA block_args_tail
2550
2562
  {
2551
2563
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
2552
2564
  # TODO: assignable(p, $1, 0, &@$);
2553
- result = wrap :lvar, val[0]
2565
+ result = wrap :lasgn, val[0]
2554
2566
  }
2555
2567
 
2556
2568
  p_var_ref: tCARET tIDENTIFIER
data/lib/ruby31_parser.rb CHANGED
@@ -8153,10 +8153,10 @@ racc_reduce_table = [
8153
8153
  1, 373, :_reduce_none,
8154
8154
  1, 373, :_reduce_none,
8155
8155
  1, 373, :_reduce_none,
8156
- 1, 373, :_reduce_none,
8157
- 1, 373, :_reduce_none,
8158
- 1, 373, :_reduce_none,
8159
- 1, 373, :_reduce_none,
8156
+ 1, 373, :_reduce_569,
8157
+ 1, 373, :_reduce_570,
8158
+ 1, 373, :_reduce_571,
8159
+ 1, 373, :_reduce_572,
8160
8160
  1, 373, :_reduce_573,
8161
8161
  1, 373, :_reduce_none,
8162
8162
  1, 351, :_reduce_575,
@@ -12399,13 +12399,29 @@ end
12399
12399
 
12400
12400
  # reduce 568 omitted
12401
12401
 
12402
- # reduce 569 omitted
12402
+ def _reduce_569(val, _values, result)
12403
+ result = ary_to_pat val[0]
12404
+
12405
+ result
12406
+ end
12407
+
12408
+ def _reduce_570(val, _values, result)
12409
+ result = ary_to_pat val[0]
12403
12410
 
12404
- # reduce 570 omitted
12411
+ result
12412
+ end
12413
+
12414
+ def _reduce_571(val, _values, result)
12415
+ result = ary_to_pat val[0]
12416
+
12417
+ result
12418
+ end
12405
12419
 
12406
- # reduce 571 omitted
12420
+ def _reduce_572(val, _values, result)
12421
+ result = ary_to_pat val[0]
12407
12422
 
12408
- # reduce 572 omitted
12423
+ result
12424
+ end
12409
12425
 
12410
12426
  def _reduce_573(val, _values, result)
12411
12427
  # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
@@ -12421,7 +12437,7 @@ end
12421
12437
  def _reduce_575(val, _values, result)
12422
12438
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
12423
12439
  # TODO: assignable(p, $1, 0, &@$);
12424
- result = wrap :lvar, val[0]
12440
+ result = wrap :lasgn, val[0]
12425
12441
 
12426
12442
  result
12427
12443
  end
data/lib/ruby31_parser.y CHANGED
@@ -2562,9 +2562,21 @@ opt_block_args_tail: tCOMMA block_args_tail
2562
2562
  | xstring
2563
2563
  | regexp
2564
2564
  | words
2565
+ {
2566
+ result = ary_to_pat val[0]
2567
+ }
2565
2568
  | qwords
2569
+ {
2570
+ result = ary_to_pat val[0]
2571
+ }
2566
2572
  | symbols
2573
+ {
2574
+ result = ary_to_pat val[0]
2575
+ }
2567
2576
  | qsymbols
2577
+ {
2578
+ result = ary_to_pat val[0]
2579
+ }
2568
2580
  | keyword_variable
2569
2581
  {
2570
2582
  # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
@@ -2578,7 +2590,7 @@ opt_block_args_tail: tCOMMA block_args_tail
2578
2590
  {
2579
2591
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
2580
2592
  # TODO: assignable(p, $1, 0, &@$);
2581
- result = wrap :lvar, val[0]
2593
+ result = wrap :lasgn, val[0]
2582
2594
  }
2583
2595
 
2584
2596
  p_var_ref: tCARET tIDENTIFIER
data/lib/ruby3_parser.yy CHANGED
@@ -2591,9 +2591,21 @@ opt_block_args_tail: tCOMMA block_args_tail
2591
2591
  | xstring
2592
2592
  | regexp
2593
2593
  | words
2594
+ {
2595
+ result = ary_to_pat val[0]
2596
+ }
2594
2597
  | qwords
2598
+ {
2599
+ result = ary_to_pat val[0]
2600
+ }
2595
2601
  | symbols
2602
+ {
2603
+ result = ary_to_pat val[0]
2604
+ }
2596
2605
  | qsymbols
2606
+ {
2607
+ result = ary_to_pat val[0]
2608
+ }
2597
2609
  | keyword_variable
2598
2610
  {
2599
2611
  # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
@@ -2607,7 +2619,7 @@ opt_block_args_tail: tCOMMA block_args_tail
2607
2619
  {
2608
2620
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
2609
2621
  # TODO: assignable(p, $1, 0, &@$);
2610
- result = wrap :lvar, val[0]
2622
+ result = wrap :lasgn, val[0]
2611
2623
  }
2612
2624
 
2613
2625
  p_var_ref: tCARET tIDENTIFIER
data/lib/ruby_lexer.rb CHANGED
@@ -232,7 +232,7 @@ class RubyLexer
232
232
  content = match[1]
233
233
 
234
234
  if text =~ check then
235
- content.gsub(ESC) { unescape $1 }
235
+ unescape_string content
236
236
  else
237
237
  content.gsub(/\\\\/, "\\").gsub(/\\\'/, "'")
238
238
  end
@@ -590,9 +590,7 @@ class RubyLexer
590
590
  orig_line = lineno
591
591
  self.lineno += text.count("\n")
592
592
 
593
- str = text[1..-2]
594
- .gsub(ESC) { unescape($1).b.force_encoding Encoding::UTF_8 }
595
- str = str.b unless str.valid_encoding?
593
+ str = unescape_string text[1..-2]
596
594
 
597
595
  result EXPR_END, :tSTRING, str, orig_line
598
596
  end
@@ -817,6 +815,15 @@ class RubyLexer
817
815
  end
818
816
  end
819
817
 
818
+ def unescape_string str
819
+ str = str.gsub(ESC) { unescape($1).b.force_encoding Encoding::UTF_8 }
820
+ if str.valid_encoding?
821
+ str
822
+ else
823
+ str.b
824
+ end
825
+ end
826
+
820
827
  def unescape s
821
828
  r = ESCAPES[s]
822
829
 
data/lib/ruby_parser.yy CHANGED
@@ -2530,9 +2530,21 @@ opt_block_args_tail: tCOMMA block_args_tail
2530
2530
  | xstring
2531
2531
  | regexp
2532
2532
  | words
2533
+ {
2534
+ result = ary_to_pat val[0]
2535
+ }
2533
2536
  | qwords
2537
+ {
2538
+ result = ary_to_pat val[0]
2539
+ }
2534
2540
  | symbols
2541
+ {
2542
+ result = ary_to_pat val[0]
2543
+ }
2535
2544
  | qsymbols
2545
+ {
2546
+ result = ary_to_pat val[0]
2547
+ }
2536
2548
  | keyword_variable
2537
2549
  {
2538
2550
  # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
@@ -2546,7 +2558,7 @@ opt_block_args_tail: tCOMMA block_args_tail
2546
2558
  {
2547
2559
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
2548
2560
  # TODO: assignable(p, $1, 0, &@$);
2549
- result = wrap :lvar, val[0]
2561
+ result = wrap :lasgn, val[0]
2550
2562
  }
2551
2563
 
2552
2564
  p_var_ref: tCARET tIDENTIFIER
@@ -30,7 +30,7 @@ class Sexp
30
30
  end
31
31
 
32
32
  module RubyParserStuff
33
- VERSION = "3.19.1"
33
+ VERSION = "3.19.2"
34
34
 
35
35
  attr_accessor :lexer, :in_def, :in_single, :file
36
36
  attr_accessor :in_kwarg
@@ -471,7 +471,7 @@ module RubyParserStuff
471
471
  end
472
472
  else
473
473
  warn "unprocessed: %p" % [s]
474
- end.map { |l| whitespace_width l.chomp }
474
+ end.map { |l| whitespace_width l }
475
475
  }.compact.min
476
476
  end
477
477
 
@@ -731,6 +731,13 @@ module RubyParserStuff
731
731
  result
732
732
  end
733
733
 
734
+ def ary_to_pat ary
735
+ pat = ary.dup
736
+ pat.sexp_type = :array_TAIL
737
+
738
+ new_array_pattern nil, nil, pat, ary.line
739
+ end
740
+
734
741
  def new_array_pattern const, pre_arg, arypat, loc
735
742
  result = s(:array_pat, const).line loc
736
743
  result << pre_arg if pre_arg
@@ -1066,9 +1073,9 @@ module RubyParserStuff
1066
1073
  lhs_id = "*#{lhs_id}".to_sym
1067
1074
  rhs_id = "*#{rhs_id}".to_sym
1068
1075
 
1069
- mid.sexp_type = :array_pat # HACK?
1076
+ raise "BAD?" unless mid.sexp_type == :array_TAIL
1070
1077
 
1071
- s(:find_pat_TAIL, lhs_id, mid, rhs_id).line line
1078
+ s(:find_pat_TAIL, lhs_id, *mid.sexp_body, rhs_id).line line
1072
1079
  end
1073
1080
 
1074
1081
  def new_for expr, var, body
@@ -1651,7 +1658,7 @@ module RubyParserStuff
1651
1658
 
1652
1659
  if remove_width then
1653
1660
  line[idx..-1]
1654
- elsif line[idx].nil?
1661
+ elsif line[idx] == "\n"
1655
1662
  nil
1656
1663
  else
1657
1664
  col
@@ -3009,6 +3009,19 @@ class TestRubyLexer < Minitest::Test
3009
3009
  :tSTRING_END, "\"", EXPR_LIT)
3010
3010
  end
3011
3011
 
3012
+ def test_yylex_symbol_double_escape_octal
3013
+ setup_lexer ":\"Variet\\303\\240\""
3014
+
3015
+ adv = @lex.next_token
3016
+ act_token, act_value = adv
3017
+ act_value = act_value.first
3018
+
3019
+ assert_equal :tSYMBOL, act_token
3020
+ assert_match EXPR_LIT, @lex.lex_state
3021
+ # Force comparison of encodings
3022
+ assert_equal "Varietà", act_value
3023
+ end
3024
+
3012
3025
  def test_yylex_symbol_single
3013
3026
  assert_lex3(":'symbol'",
3014
3027
  nil,
@@ -826,6 +826,13 @@ module TestRubyParserShared
826
826
  assert_parse rb, pt
827
827
  end
828
828
 
829
+ def test_dsym_esc_to_sym
830
+ rb = ':"Variet\303\240"'
831
+ pt = s(:lit, :Varietà)
832
+
833
+ assert_parse rb, pt
834
+ end
835
+
829
836
  def test_empty
830
837
  refute_parse ""
831
838
  end
@@ -3541,10 +3548,8 @@ module TestRubyParserShared20Plus
3541
3548
  end
3542
3549
 
3543
3550
  def test_regexp_esc_C_slash
3544
- skip "https://bugs.ruby-lang.org/issues/18449" if RUBY_VERSION == "3.1.0"
3545
-
3546
3551
  rb = "/\\cC\\d/"
3547
- pt = s(:lit, /\cC\d/)
3552
+ pt = s(:lit, Regexp.new('\cC\d')) # https://bugs.ruby-lang.org/issues/18449
3548
3553
 
3549
3554
  assert_parse rb, pt
3550
3555
  end
@@ -4270,6 +4275,21 @@ module TestRubyParserShared23Plus
4270
4275
  assert_parse rb, pt
4271
4276
  end
4272
4277
 
4278
+ def test_heredoc_squiggly_blank_line_plus_interpolation
4279
+ rb = "a = foo(<<~EOF.chop)\n\n #\{bar}baz\n EOF"
4280
+ pt = s(:lasgn, :a,
4281
+ s(:call,
4282
+ nil,
4283
+ :foo,
4284
+ s(:call,
4285
+ s(:dstr, "\n",
4286
+ s(:evstr, s(:call, nil, :bar).line(3)).line(3),
4287
+ s(:str, "baz\n").line(3)).line(1),
4288
+ :chop).line(1)).line(1)).line(1)
4289
+
4290
+ assert_parse rb, pt
4291
+ end
4292
+
4273
4293
  def test_integer_with_if_modifier
4274
4294
  rb = "1_234if true"
4275
4295
  pt = s(:if, s(:true), s(:lit, 1234), nil)
@@ -4553,8 +4573,8 @@ module TestPatternMatching
4553
4573
  pt = s(:array_pat,
4554
4574
  nil,
4555
4575
  s(:lit, :a).line(2),
4556
- s(:lvar, :b).line(2),
4557
- s(:lvar, :c).line(2),
4576
+ s(:lasgn, :b).line(2),
4577
+ s(:lasgn, :c).line(2),
4558
4578
  s(:array_pat,
4559
4579
  nil,
4560
4580
  s(:lit, :d).line(2),
@@ -4647,19 +4667,19 @@ module TestPatternMatching
4647
4667
  end
4648
4668
 
4649
4669
  def test_case_in_78
4650
- assert_case_in "%W[a b]", s(:array, s(:str, "a").line(2), s(:str, "b").line(2)).line(2)
4670
+ assert_case_in "%W[a b]", s(:array_pat, nil, s(:str, "a").line(2), s(:str, "b").line(2)).line(2)
4651
4671
  end
4652
4672
 
4653
4673
  def test_case_in_79
4654
- assert_case_in "%w[a b]", s(:array, s(:str, "a").line(2), s(:str, "b").line(2)).line(2)
4674
+ assert_case_in "%w[a b]", s(:array_pat, nil, s(:str, "a").line(2), s(:str, "b").line(2)).line(2)
4655
4675
  end
4656
4676
 
4657
4677
  def test_case_in_80
4658
- assert_case_in "%I[a b]", s(:array, s(:lit, :a).line(2), s(:lit, :b).line(2)).line(2)
4678
+ assert_case_in "%I[a b]", s(:array_pat, nil, s(:lit, :a).line(2), s(:lit, :b).line(2)).line(2)
4659
4679
  end
4660
4680
 
4661
4681
  def test_case_in_81
4662
- assert_case_in "%i[a b]", s(:array, s(:lit, :a).line(2), s(:lit, :b).line(2)).line(2)
4682
+ assert_case_in "%i[a b]", s(:array_pat, nil, s(:lit, :a).line(2), s(:lit, :b).line(2)).line(2)
4663
4683
  end
4664
4684
 
4665
4685
  def test_case_in_83
@@ -4667,7 +4687,7 @@ module TestPatternMatching
4667
4687
  pt = s(:array_pat, nil,
4668
4688
  s(:iter, s(:lambda).line(2), s(:args, :b).line(2),
4669
4689
  s(:true).line(2)).line(2),
4670
- s(:lvar, :c).line(2)).line(2)
4690
+ s(:lasgn, :c).line(2)).line(2)
4671
4691
 
4672
4692
  assert_case_in rb, pt
4673
4693
  end
@@ -4677,7 +4697,7 @@ module TestPatternMatching
4677
4697
  pt = s(:array_pat, nil,
4678
4698
  s(:array_pat, nil,
4679
4699
  s(:lit, :b).line(2),
4680
- s(:lvar, :c).line(2)).line(2),
4700
+ s(:lasgn, :c).line(2)).line(2),
4681
4701
  s(:array_pat,
4682
4702
  nil,
4683
4703
  s(:lit, :d).line(2),
@@ -4723,7 +4743,7 @@ module TestPatternMatching
4723
4743
  s(:in,
4724
4744
  s(:array_pat,
4725
4745
  s(:const, :B).line(2),
4726
- s(:lvar, :c).line(2)).line(2),
4746
+ s(:lasgn, :c).line(2)).line(2),
4727
4747
  s(:lit, :d).line(3)).line(2),
4728
4748
  nil)
4729
4749
 
@@ -4736,7 +4756,7 @@ module TestPatternMatching
4736
4756
  s(:in,
4737
4757
  s(:array_pat,
4738
4758
  s(:const, s(:colon2, s(:const, :B).line(2), :C).line(2)).line(2),
4739
- s(:lvar, :d).line(2)).line(2),
4759
+ s(:lasgn, :d).line(2)).line(2),
4740
4760
  s(:lit, :e).line(3)).line(2),
4741
4761
  nil)
4742
4762
 
@@ -4841,7 +4861,7 @@ module TestPatternMatching
4841
4861
  s(:hash_pat,
4842
4862
  nil,
4843
4863
  s(:lit, :b).line(2),
4844
- s(:lvar, :c).line(2),
4864
+ s(:lasgn, :c).line(2),
4845
4865
  s(:kwrest, :"**rest").line(2)).line(2),
4846
4866
  s(:lit, :d).line(2)).line(2),
4847
4867
  nil)
@@ -4934,12 +4954,12 @@ module TestPatternMatching
4934
4954
  end
4935
4955
 
4936
4956
  def test_parse_pattern_044
4937
- rb = <<~RUBY
4938
- case obj
4939
- in Object[]
4940
- true
4941
- end
4942
- RUBY
4957
+ rb = <<~RUBY
4958
+ case obj
4959
+ in Object[]
4960
+ true
4961
+ end
4962
+ RUBY
4943
4963
  pt = s(:case,
4944
4964
  s(:call, nil, :obj),
4945
4965
  s(:in, s(:array_pat, s(:const, :Object).line(2)).line(2),
@@ -5072,7 +5092,7 @@ module TestPatternMatching30
5072
5092
  s(:find_pat,
5073
5093
  s(:const, :Symbol).line(2),
5074
5094
  :"*lhs",
5075
- s(:array_pat, s(:lvar, :x).line(2)).line(2),
5095
+ s(:lasgn, :x).line(2),
5076
5096
  :"*rhs").line(2))
5077
5097
  end
5078
5098
 
@@ -5080,7 +5100,7 @@ module TestPatternMatching30
5080
5100
  assert_case_in("Symbol[*lhs, x, *rhs]",
5081
5101
  s(:find_pat, s(:const, :Symbol).line(2),
5082
5102
  :"*lhs",
5083
- s(:array_pat, s(:lvar, :x).line(2)).line(2),
5103
+ s(:lasgn, :x).line(2),
5084
5104
  :"*rhs").line(2))
5085
5105
  end
5086
5106
  end
@@ -5196,7 +5216,7 @@ module TestRubyParserShared30Plus
5196
5216
  rb = "42 => n"
5197
5217
  pt = s(:case,
5198
5218
  s(:lit, 42),
5199
- s(:in, s(:lvar, :n), nil), nil)
5219
+ s(:in, s(:lasgn, :n), nil), nil)
5200
5220
 
5201
5221
  assert_parse rb, pt
5202
5222
  end
@@ -5208,7 +5228,7 @@ module TestRubyParserShared30Plus
5208
5228
  s(:in,
5209
5229
  s(:find_pat, nil,
5210
5230
  :"*a",
5211
- s(:array_pat, s(:lit, :+).line(2)).line(2),
5231
+ s(:lit, :+).line(2),
5212
5232
  :"*b").line(2),
5213
5233
  nil).line(2),
5214
5234
  nil)
@@ -5223,7 +5243,7 @@ module TestRubyParserShared30Plus
5223
5243
  s(:in,
5224
5244
  s(:find_pat, nil,
5225
5245
  :*,
5226
- s(:array_pat, s(:lit, :b).line(2), s(:lvar, :c).line(2)).line(2),
5246
+ s(:lit, :b).line(2), s(:lasgn, :c).line(2),
5227
5247
  :*).line(2),
5228
5248
  nil).line(2),
5229
5249
  nil)
@@ -5524,6 +5544,8 @@ class RubyParserTestCase < ParseTreeTestCase
5524
5544
 
5525
5545
  attr_accessor :assert_parse_ran
5526
5546
 
5547
+ require "ruby2ruby" if ENV["R2R"]
5548
+
5527
5549
  def assert_parse rb, pt
5528
5550
  self.processor.reset if assert_parse_ran # allows multiple calls
5529
5551
  self.assert_parse_ran = true
@@ -5534,6 +5556,10 @@ class RubyParserTestCase < ParseTreeTestCase
5534
5556
  pt.line ||= 1
5535
5557
 
5536
5558
  self.result = processor.parse rb, "(string)", timeout
5559
+
5560
+ # just try it for now:
5561
+ Ruby2Ruby.new.process(result.deep_clone) if ENV["R2R"]
5562
+
5537
5563
  assert_equal pt, result
5538
5564
  end
5539
5565
 
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- ��C-]̓�˺��)5J��������I�[���Y5��St?� ��e��z�1Q����e��i��ł��^���BU4�'b�����o!_�ٝ:�Q�"l�l�$c��5nV6L5{І��� 0}���Byp3�^�H�{���5�����jy���IN^�6�����IZ�DQ݆M2w|(|x�uaPF��L�i���6��M�>5s��@_�%�|�P����[��GP��i���
1
+ ��4iL[�.�M���4�D=�EuƜK��� OegEWKʱ�Dwc}����lٷ�3PWVg�L�_���7v]{�ؚH>n|���2Y��ZxM@oGz'Yq!���+����oۢ���UmY����WAQ��^��1gJ�tZ[wp�>ov2�q�h[��"��y/}l���j�߉� ]o�Qi/�[RԄ���b٢T��m^x{���9pHJjK.�eKz�B�ɹ�C6U8[$�L��9YV^��
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.19.1
4
+ version: 3.19.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  JFmxn4h9YO/pVdB962BdBNNDia0kgIjI3ENnkLq0dKpYU3+F3KhEuTksLO0L6X/V
30
30
  YsuyUzsMz6GQA4khyaMgKNSD
31
31
  -----END CERTIFICATE-----
32
- date: 2022-04-06 00:00:00.000000000 Z
32
+ date: 2022-12-03 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -119,14 +119,14 @@ dependencies:
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '3.23'
122
+ version: '3.25'
123
123
  type: :development
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: '3.23'
129
+ version: '3.25'
130
130
  description: |-
131
131
  ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
132
132
  racc--which does by default use a C extension). It outputs
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  - !ruby/object:Gem::Version
244
244
  version: '0'
245
245
  requirements: []
246
- rubygems_version: 3.3.3
246
+ rubygems_version: 3.3.12
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: ruby_parser (RP) is a ruby parser written in pure ruby (utilizing racc--which
metadata.gz.sig CHANGED
Binary file