parser 2.6.4.1 → 2.6.5.0

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: 7d7b8b9f67b6aaacdb9a0d545465e924b4f648b111da6be699663c5c67c84e4f
4
- data.tar.gz: 171070fa439abfe6279d7e0c713d46a28528669085cfc643ab808569d17357c1
3
+ metadata.gz: c12b17e36f142aa8aacc1aae95cd464ea9239cf526d973b7b1ed3f0825fc7698
4
+ data.tar.gz: 49948dbdc512a19d0b02d5edea2e12ff4eed8c89a2827728e5f0f9a618109b44
5
5
  SHA512:
6
- metadata.gz: ab3de4f196504df68763d5efaa347b4febf2e2feed3dc1f0b407565a6f93434d4b1709dbe7a1fa36f28e39b25d67434ad861818ca7d570e0b2b0d8b5b1e71ff9
7
- data.tar.gz: 8634d57721f51fa9dd91c843960fb6c20a7bbb0331c6e62b3f29da3a770f5471f9adcaad14efb5a68904f2e93767e835022abcb9b739c113898822942085f112
6
+ metadata.gz: 67bbf82221c9795d5a892f51ccb3c51835657448842a078bbcee88b8b1ef649643600d01d2c1c0b2e59982a774803a3a780538c433e8cc3a4fdfe8168838a697
7
+ data.tar.gz: 9d7053f65800e04f8f2c0b1f344d9f83efd1282744aba49c02b384ea4242a3bcc5b65b7ac3eca4c4d0c34317ed70393a1eb26e146b34517ad75810b9498eb0a7
@@ -11,14 +11,14 @@ matrix:
11
11
  - name: 2.3.8 / Parser tests
12
12
  rvm: 2.3.8
13
13
  script: bundle exec rake test_cov
14
- - name: 2.4.7 / Parser tests
15
- rvm: 2.4.7
14
+ - name: 2.4.9 / Parser tests
15
+ rvm: 2.4.9
16
16
  script: bundle exec rake test_cov
17
- - name: 2.5.6 / Parser tests
18
- rvm: 2.5.6
17
+ - name: 2.5.7 / Parser tests
18
+ rvm: 2.5.7
19
19
  script: bundle exec rake test_cov
20
- - name: 2.6.4 / Parser tests
21
- rvm: 2.6.4
20
+ - name: 2.6.5 / Parser tests
21
+ rvm: 2.6.5
22
22
  script: bundle exec rake test_cov
23
23
  - name: ruby-head / Parser tests
24
24
  rvm: ruby-head
@@ -29,11 +29,11 @@ matrix:
29
29
  - name: rbx-2 / Parser tests
30
30
  rvm: rbx-2
31
31
  script: bundle exec rake test_cov
32
- - name: 2.5.6 / Rubocop tests
33
- rvm: 2.5.6
32
+ - name: 2.5.7 / Rubocop tests
33
+ rvm: 2.5.7
34
34
  script: ./ci/run_rubocop_specs
35
- - name: 2.6.4 / Rubocop tests
36
- rvm: 2.6.4
35
+ - name: 2.6.5 / Rubocop tests
36
+ rvm: 2.6.5
37
37
  script: ./ci/run_rubocop_specs
38
38
  allow_failures:
39
39
  - rvm: ruby-head
@@ -1,6 +1,94 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v2.6.4.1 (2019-09-12)
5
+ ---------------------
6
+
7
+ Bugs fixed:
8
+ * lexer.rl: fix parsing of 'm a + b do end' (#605) (Ilya Bylich)
9
+
10
+ v2.6.4.0 (2019-08-30)
11
+ ---------------------
12
+
13
+ API modifications:
14
+ * Added specs for heredocs with mixed encoding. (#581) (Ilya Bylich)
15
+
16
+ Features implemented:
17
+ * ruby27.y: Revert "pipeline operator" (#601) (Koichi ITO)
18
+ * ruby27.y: Fix parsing of mutiple assignment with rescue modifier (#600) (Koichi ITO)
19
+ * ruby27.y: hoisted out f_rest_marg. (#594) (Ilya Bylich)
20
+ * ruby27.y: added pipeline operator. (#592) (Ilya Bylich)
21
+ * ruby27.y: reject safe navigator in LHS of mass-assignment. (#586) (Ilya Bylich)
22
+ * lexer.rl: reject whitespaces in meta and control chars. (#585) (Ilya Bylich)
23
+ * lexer.rl: Reject numparams as symbol literals. (#582) (Ilya Bylich)
24
+ * ruby27.y: Added numbered parameters support. (#565) (Ilya Bylich)
25
+ * lexer.rl: Reject \n and \r in heredoc identifiers starting from 2.7. (#575) (Ilya Bylich)
26
+
27
+ Bugs fixed:
28
+ * ruby-parse: print empty string when --emit-json and empty input are given. (#590) (Ilya Bylich)
29
+ * AST_FORMAT: fixed documentation of the string with interpolation. (#589) (Ilya Bylich)
30
+ * builder.rb, processor.rb: Changed format of the procarg0 node. (#587) (Ilya Bylich)
31
+
32
+ v2.6.3.0 (2019-04-28)
33
+ ---------------------
34
+
35
+ Features implemented:
36
+ * ruby27.y: Added beginless ranges support. (#570) (Ilya Bylich)
37
+
38
+ v2.6.2.1 (2019-04-05)
39
+ ---------------------
40
+
41
+ API modifications:
42
+ * Bump 2.4 branch to 2.4.6. (#569) (Ilya Bylich)
43
+ * Lexer should know about current parsing context. (#566) (Ilya Bylich)
44
+
45
+ v2.6.2.0 (2019-03-21)
46
+ ---------------------
47
+
48
+ API modifications:
49
+ * Bump ruby versions to 2.5.5 and 2.6.2. (#563) (Ilya Bylich)
50
+ * Bump Ruby version to 2.6.1. (#554) (Ilya Bylich)
51
+
52
+ Features implemented:
53
+ * ruby27.y: dsym should be treated as string. (#560) (Ilya Bylich)
54
+ * ruby27.y: Refactored symbol rules. (#557) (Ilya Bylich)
55
+ * ruby27.y: Added method reference operator. (#556) (Ilya Bylich)
56
+ * ruby27.y: branch parser. (#546) (Ilya Bylich)
57
+
58
+ v2.6.0.0 (2019-01-16)
59
+ ---------------------
60
+
61
+ API modifications:
62
+ * 2.6.0 was released, unmark is as -dev. (#538) (Ilya Bylich)
63
+
64
+ Bugs fixed:
65
+ * Fix parsing of "\\\n" escaped sequences in various literals. (#539) (Ilya Bylich)
66
+
67
+ v2.5.3.0 (2018-10-29)
68
+ ---------------------
69
+
70
+ Bugs fixed:
71
+ * lexer.rl: Fix parsing of 'm :key => m do; m() do end; end'. (#526) (Ilya Bylich)
72
+ * lexer.rl: Fix parsing of ambiguous 1re. (#523) (Ilya Bylich)
73
+
74
+ v2.5.1.2 (2018-07-10)
75
+ ---------------------
76
+
77
+ Bugs fixed:
78
+ * lexer.rl: Partially revert 5ba072d and properly handle 'm = -> *args do end'. (Ilya Bylich)
79
+
80
+ v2.5.1.1 (2018-07-10)
81
+ ---------------------
82
+
83
+ Features implemented:
84
+ * ruby26.y: Endless ranges support. (Ilya Bylich)
85
+
86
+ Bugs fixed:
87
+ * lexer.rl: Fix parsing of 'm = -> *args do end'. (Ilya Bylich)
88
+ * AST::Processor: Properly recurse into "kwsplat" nodes (Nelson Elhage)
89
+ * ruby24, ruby25, ruby26: Fix cmdargs after command_args followed by tLBRACE_ARG. This commit tracks upstream commit ruby/ruby@f168dbd. (Ilya Bylich)
90
+ * lexer.rl: Fix parsing of `let (:a) { m do; end }`. (Ilya Bylich)
91
+
4
92
  v2.5.1.0 (2018-04-12)
5
93
  ---------------------
6
94
 
@@ -48,7 +48,7 @@ module Parser
48
48
  CurrentRuby = Ruby23
49
49
 
50
50
  when /^2\.4\./
51
- current_version = '2.4.7'
51
+ current_version = '2.4.9'
52
52
  if RUBY_VERSION != current_version
53
53
  warn_syntax_deviation 'parser/ruby24', current_version
54
54
  end
@@ -57,7 +57,7 @@ module Parser
57
57
  CurrentRuby = Ruby24
58
58
 
59
59
  when /^2\.5\./
60
- current_version = '2.5.6'
60
+ current_version = '2.5.7'
61
61
  if RUBY_VERSION != current_version
62
62
  warn_syntax_deviation 'parser/ruby25', current_version
63
63
  end
@@ -66,7 +66,7 @@ module Parser
66
66
  CurrentRuby = Ruby25
67
67
 
68
68
  when /^2\.6\./
69
- current_version = '2.6.4'
69
+ current_version = '2.6.5'
70
70
  if RUBY_VERSION != current_version
71
71
  warn_syntax_deviation 'parser/ruby26', current_version
72
72
  end
@@ -89,7 +89,7 @@ class Parser::Lexer
89
89
 
90
90
  REGEXP_META_CHARACTERS = Regexp.union(*"\\$()*+.<>?[]^{|}".chars).freeze
91
91
 
92
- NUMPARAM_MAX = 100
92
+ NUMPARAM_MAX = 9
93
93
 
94
94
  attr_reader :source_buffer
95
95
  attr_reader :max_numparam_stack
@@ -2339,7 +2339,19 @@ class Parser::Lexer
2339
2339
  p = p - tok.length + 2
2340
2340
  fnext expr_dot; fbreak; };
2341
2341
 
2342
- '.:' | '.' | '&.' | '::'
2342
+ '.:'
2343
+ => {
2344
+ if @version >= 27
2345
+ emit_table(PUNCTUATION)
2346
+ else
2347
+ emit(:tDOT, tok(@ts, @ts + 1), @ts, @ts + 1)
2348
+ fhold;
2349
+ end
2350
+
2351
+ fnext expr_dot; fbreak;
2352
+ };
2353
+
2354
+ '.' | '&.' | '::'
2343
2355
  => { emit_table(PUNCTUATION)
2344
2356
  fnext expr_dot; fbreak; };
2345
2357
 
@@ -2453,7 +2465,25 @@ class Parser::Lexer
2453
2465
  leading_dot := |*
2454
2466
  # Insane leading dots:
2455
2467
  # a #comment
2468
+ # # post-2.7 comment
2456
2469
  # .b: a.b
2470
+
2471
+ # Here we use '\n' instead of w_newline to not modify @newline_s
2472
+ # and eventually properly emit tNL
2473
+ (w_space_comment '\n')+
2474
+ => {
2475
+ if @version < 27
2476
+ # Ruby before 2.7 doesn't support comments before leading dot.
2477
+ # If a line after "a" starts with a comment then "a" is a self-contained statement.
2478
+ # So in that case we emit a special tNL token and start reading the
2479
+ # next line as a separate statement.
2480
+ #
2481
+ # Note: block comments before leading dot are not supported on any version of Ruby.
2482
+ emit(:tNL, nil, @newline_s, @newline_s + 1)
2483
+ fhold; fnext line_begin; fbreak;
2484
+ end
2485
+ };
2486
+
2457
2487
  c_space* %{ tm = p } ('.' | '&.')
2458
2488
  => { p = tm - 1; fgoto expr_end; };
2459
2489
 
@@ -81,7 +81,7 @@ rule
81
81
  else_t, else_ = val[2]
82
82
  ensure_t, ensure_ = val[3]
83
83
 
84
- if rescue_bodies.empty? && !else_.nil?
84
+ if rescue_bodies.empty? && !else_t.nil?
85
85
  diagnostic :warning, :useless_else, nil, else_t
86
86
  end
87
87
 
@@ -54,7 +54,7 @@ rule
54
54
  else_t, else_ = val[2]
55
55
  ensure_t, ensure_ = val[3]
56
56
 
57
- if rescue_bodies.empty? && !else_.nil?
57
+ if rescue_bodies.empty? && !else_t.nil?
58
58
  diagnostic :warning, :useless_else, nil, else_t
59
59
  end
60
60
 
@@ -81,7 +81,7 @@ rule
81
81
  else_t, else_ = val[2]
82
82
  ensure_t, ensure_ = val[3]
83
83
 
84
- if rescue_bodies.empty? && !else_.nil?
84
+ if rescue_bodies.empty? && !else_t.nil?
85
85
  diagnostic :warning, :useless_else, nil, else_t
86
86
  end
87
87
 
@@ -81,7 +81,7 @@ rule
81
81
  else_t, else_ = val[2]
82
82
  ensure_t, ensure_ = val[3]
83
83
 
84
- if rescue_bodies.empty? && !else_.nil?
84
+ if rescue_bodies.empty? && !else_t.nil?
85
85
  diagnostic :warning, :useless_else, nil, else_t
86
86
  end
87
87
 
@@ -82,7 +82,7 @@ rule
82
82
  else_t, else_ = val[2]
83
83
  ensure_t, ensure_ = val[3]
84
84
 
85
- if rescue_bodies.empty? && !else_.nil?
85
+ if rescue_bodies.empty? && !else_t.nil?
86
86
  diagnostic :warning, :useless_else, nil, else_t
87
87
  end
88
88
 
@@ -82,7 +82,7 @@ rule
82
82
  else_t, else_ = val[2]
83
83
  ensure_t, ensure_ = val[3]
84
84
 
85
- if rescue_bodies.empty? && !else_.nil?
85
+ if rescue_bodies.empty? && !else_t.nil?
86
86
  diagnostic :warning, :useless_else, nil, else_t
87
87
  end
88
88
 
@@ -82,7 +82,7 @@ rule
82
82
  else_t, else_ = val[2]
83
83
  ensure_t, ensure_ = val[3]
84
84
 
85
- if rescue_bodies.empty? && !else_.nil?
85
+ if rescue_bodies.empty? && !else_t.nil?
86
86
  diagnostic :warning, :useless_else, nil, else_t
87
87
  end
88
88
 
@@ -82,7 +82,7 @@ rule
82
82
  else_t, else_ = val[2]
83
83
  ensure_t, ensure_ = val[3]
84
84
 
85
- if rescue_bodies.empty? && !else_.nil?
85
+ if rescue_bodies.empty? && !else_t.nil?
86
86
  diagnostic :warning, :useless_else, nil, else_t
87
87
  end
88
88
 
@@ -87,7 +87,7 @@ rule
87
87
  else_t, else_ = val[2]
88
88
  ensure_t, ensure_ = val[3]
89
89
 
90
- if rescue_bodies.empty? && !else_.nil?
90
+ if rescue_bodies.empty? && !else_t.nil?
91
91
  diagnostic :warning, :useless_else, nil, else_t
92
92
  end
93
93
 
@@ -87,7 +87,7 @@ rule
87
87
  else_t, else_ = val[2]
88
88
  ensure_t, ensure_ = val[3]
89
89
 
90
- if rescue_bodies.empty? && !else_.nil?
90
+ if rescue_bodies.empty? && !else_t.nil?
91
91
  diagnostic :error, :useless_else, nil, else_t
92
92
  end
93
93
 
@@ -87,7 +87,7 @@ rule
87
87
  else_t, else_ = val[2]
88
88
  ensure_t, ensure_ = val[3]
89
89
 
90
- if rescue_bodies.empty? && !else_.nil?
90
+ if rescue_bodies.empty? && !else_t.nil?
91
91
  diagnostic :error, :useless_else, nil, else_t
92
92
  end
93
93
 
@@ -53,7 +53,7 @@ rule
53
53
  else_t, else_ = val[2]
54
54
  ensure_t, ensure_ = val[3]
55
55
 
56
- if rescue_bodies.empty? && !else_.nil?
56
+ if rescue_bodies.empty? && !else_t.nil?
57
57
  diagnostic :warning, :useless_else, nil, else_t
58
58
  end
59
59
 
@@ -266,7 +266,7 @@ module Parser
266
266
 
267
267
  def combine(range, attributes)
268
268
  range = check_range_validity(range)
269
- action = TreeRewriter::Action.new(range, @enforcer, attributes)
269
+ action = TreeRewriter::Action.new(range, @enforcer, **attributes)
270
270
  @action_root = @action_root.combine(action)
271
271
  self
272
272
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parser
4
- VERSION = '2.6.4.1'
4
+ VERSION = '2.6.5.0'
5
5
  end
@@ -477,14 +477,18 @@ class TestLexer < Minitest::Test
477
477
  end
478
478
 
479
479
  def test_comment
480
- assert_scanned("1 # one\n# two\n2",
481
- :tINTEGER, 1, [0, 1],
482
- :tNL, nil, [7, 8],
483
- :tINTEGER, 2, [14, 15])
480
+ [26, 27].each do |version|
481
+ setup_lexer(version)
482
+
483
+ assert_scanned("1 # one\n# two\n2",
484
+ :tINTEGER, 1, [0, 1],
485
+ :tNL, nil, [7, 8],
486
+ :tINTEGER, 2, [14, 15])
484
487
 
485
- assert_equal 2, @lex.comments.length
486
- assert_equal '# one', @lex.comments[0].text
487
- assert_equal '# two', @lex.comments[1].text
488
+ assert_equal 2, @lex.comments.length
489
+ assert_equal '# one', @lex.comments[0].text
490
+ assert_equal '# two', @lex.comments[1].text
491
+ end
488
492
  end
489
493
 
490
494
  def test_comment_expr_beg
@@ -3559,6 +3563,8 @@ class TestLexer < Minitest::Test
3559
3563
  end
3560
3564
 
3561
3565
  def test_meth_ref
3566
+ setup_lexer(27)
3567
+
3562
3568
  assert_scanned('foo.:bar',
3563
3569
  :tIDENTIFIER, 'foo', [0, 3],
3564
3570
  :tMETHREF, '.:', [3, 5],
@@ -3571,6 +3577,8 @@ class TestLexer < Minitest::Test
3571
3577
  end
3572
3578
 
3573
3579
  def test_meth_ref_unary_op
3580
+ setup_lexer(27)
3581
+
3574
3582
  assert_scanned('foo.:+',
3575
3583
  :tIDENTIFIER, 'foo', [0, 3],
3576
3584
  :tMETHREF, '.:', [3, 5],
@@ -3646,11 +3654,11 @@ class TestLexer < Minitest::Test
3646
3654
  assert_equal(@lex.max_numparam, 1)
3647
3655
 
3648
3656
  setup_lexer(27)
3649
- assert_scanned_numbered_parameter('@100')
3650
- assert_equal(@lex.max_numparam, 100)
3657
+ assert_scanned_numbered_parameter('@9')
3658
+ assert_equal(@lex.max_numparam, 9)
3651
3659
 
3652
3660
  setup_lexer(27)
3653
- refute_scanned_numbered_parameter('@101', :too_large_numparam)
3661
+ refute_scanned_numbered_parameter('@10', :too_large_numparam)
3654
3662
 
3655
3663
  setup_lexer(27)
3656
3664
  refute_scanned_numbered_parameter('@01', :leading_zero_in_numparam)
@@ -5094,6 +5094,12 @@ class TestParser < Minitest::Test
5094
5094
  %q{begin; 1; else; 2; end},
5095
5095
  %q{ ~~~~ location},
5096
5096
  SINCE_2_6)
5097
+
5098
+ assert_diagnoses(
5099
+ [:error, :useless_else],
5100
+ %q{begin; 1; else; end},
5101
+ %q{ ~~~~ location},
5102
+ SINCE_2_6)
5097
5103
  end
5098
5104
 
5099
5105
  def test_ensure
@@ -5668,7 +5674,9 @@ class TestParser < Minitest::Test
5668
5674
  s(:def, :foo, s(:args),
5669
5675
  s(:begin,
5670
5676
  s(:begin, nil))),
5671
- %q{def foo; else; end})
5677
+ %q{def foo; else; end},
5678
+ %q{},
5679
+ ALL_VERSIONS - SINCE_2_6)
5672
5680
  end
5673
5681
 
5674
5682
  def test_bug_heredoc_do
@@ -7206,7 +7214,7 @@ class TestParser < Minitest::Test
7206
7214
  end
7207
7215
  end
7208
7216
 
7209
- def test_meth_ref
7217
+ def test_meth_ref__27
7210
7218
  assert_parses(
7211
7219
  s(:meth_ref, s(:lvar, :foo), :bar),
7212
7220
  %q{foo.:bar},
@@ -7224,6 +7232,20 @@ class TestParser < Minitest::Test
7224
7232
  SINCE_2_7)
7225
7233
  end
7226
7234
 
7235
+ def test_meth_ref__before_27
7236
+ assert_diagnoses(
7237
+ [:error, :unexpected_token, { :token => 'tCOLON' }],
7238
+ %q{foo.:bar},
7239
+ %q{ ^ location },
7240
+ ALL_VERSIONS - SINCE_2_7)
7241
+
7242
+ assert_diagnoses(
7243
+ [:error, :unexpected_token, { :token => 'tCOLON' }],
7244
+ %q{foo.:+@},
7245
+ %q{ ^ location },
7246
+ ALL_VERSIONS - SINCE_2_7)
7247
+ end
7248
+
7227
7249
  def test_meth_ref_unsupported_newlines
7228
7250
  assert_diagnoses(
7229
7251
  [:error, :unexpected_token, { :token => 'tCOLON' }],
@@ -7273,31 +7295,31 @@ class TestParser < Minitest::Test
7273
7295
  assert_parses(
7274
7296
  s(:numblock,
7275
7297
  s(:send, nil, :m),
7276
- 15,
7298
+ 9,
7277
7299
  s(:send,
7278
7300
  s(:numparam, 1), :+,
7279
- s(:numparam, 15))),
7280
- %q{m { @1 + @15 }},
7281
- %q{^^^^^^^^^^^^^^ expression
7301
+ s(:numparam, 9))),
7302
+ %q{m { @1 + @9 }},
7303
+ %q{^^^^^^^^^^^^^ expression
7282
7304
  | ^^ name (send/2.numparam/1)
7283
7305
  | ^^ expression (send/2.numparam/1)
7284
- | ^^^ name (send/2.numparam/2)
7285
- | ^^^ expression (send/2.numparam/2)},
7306
+ | ^^ name (send/2.numparam/2)
7307
+ | ^^ expression (send/2.numparam/2)},
7286
7308
  SINCE_2_7)
7287
7309
 
7288
7310
  assert_parses(
7289
7311
  s(:numblock,
7290
7312
  s(:send, nil, :m),
7291
- 15,
7313
+ 9,
7292
7314
  s(:send,
7293
7315
  s(:numparam, 1), :+,
7294
- s(:numparam, 15))),
7295
- %q{m do @1 + @15 end},
7296
- %q{^^^^^^^^^^^^^^^^^ expression
7316
+ s(:numparam, 9))),
7317
+ %q{m do @1 + @9 end},
7318
+ %q{^^^^^^^^^^^^^^^^ expression
7297
7319
  | ^^ name (send/2.numparam/1)
7298
7320
  | ^^ expression (send/2.numparam/1)
7299
- | ^^^ name (send/2.numparam/2)
7300
- | ^^^ expression (send/2.numparam/2)},
7321
+ | ^^ name (send/2.numparam/2)
7322
+ | ^^ expression (send/2.numparam/2)},
7301
7323
  SINCE_2_7)
7302
7324
 
7303
7325
  # Lambdas
@@ -7305,31 +7327,31 @@ class TestParser < Minitest::Test
7305
7327
  assert_parses(
7306
7328
  s(:numblock,
7307
7329
  s(:lambda),
7308
- 15,
7330
+ 9,
7309
7331
  s(:send,
7310
7332
  s(:numparam, 1), :+,
7311
- s(:numparam, 15))),
7312
- %q{-> { @1 + @15}},
7313
- %q{^^^^^^^^^^^^^^ expression
7333
+ s(:numparam, 9))),
7334
+ %q{-> { @1 + @9}},
7335
+ %q{^^^^^^^^^^^^^ expression
7314
7336
  | ^^ name (send.numparam/1)
7315
7337
  | ^^ expression (send.numparam/1)
7316
- | ^^^ name (send.numparam/2)
7317
- | ^^^ expression (send.numparam/2)},
7338
+ | ^^ name (send.numparam/2)
7339
+ | ^^ expression (send.numparam/2)},
7318
7340
  SINCE_2_7)
7319
7341
 
7320
7342
  assert_parses(
7321
7343
  s(:numblock,
7322
7344
  s(:lambda),
7323
- 15,
7345
+ 9,
7324
7346
  s(:send,
7325
7347
  s(:numparam, 1), :+,
7326
- s(:numparam, 15))),
7327
- %q{-> do @1 + @15 end},
7328
- %q{^^^^^^^^^^^^^^^^^^ expression
7348
+ s(:numparam, 9))),
7349
+ %q{-> do @1 + @9 end},
7350
+ %q{^^^^^^^^^^^^^^^^^ expression
7329
7351
  | ^^ name (send.numparam/1)
7330
7352
  | ^^ expression (send.numparam/1)
7331
- | ^^^ name (send.numparam/2)
7332
- | ^^^ expression (send.numparam/2)},
7353
+ | ^^ name (send.numparam/2)
7354
+ | ^^ expression (send.numparam/2)},
7333
7355
  SINCE_2_7)
7334
7356
  end
7335
7357
 
@@ -7576,4 +7598,47 @@ class TestParser < Minitest::Test
7576
7598
  %q{},
7577
7599
  ALL_VERSIONS)
7578
7600
  end
7601
+
7602
+ def test_comments_before_leading_dot__27
7603
+ assert_parses(
7604
+ s(:send,
7605
+ s(:send, nil, :a), :foo),
7606
+ %Q{a #\n#\n.foo\n},
7607
+ %q{},
7608
+ SINCE_2_7)
7609
+
7610
+ assert_parses(
7611
+ s(:csend,
7612
+ s(:send, nil, :a), :foo),
7613
+ %Q{a #\n#\n&.foo\n},
7614
+ %q{},
7615
+ SINCE_2_7)
7616
+
7617
+ assert_parses(
7618
+ s(:meth_ref,
7619
+ s(:send, nil, :a), :foo),
7620
+ %Q{a #\n#\n.:foo\n},
7621
+ %q{},
7622
+ SINCE_2_7)
7623
+ end
7624
+
7625
+ def test_comments_before_leading_dot__before_27
7626
+ assert_diagnoses(
7627
+ [:error, :unexpected_token, { :token => 'tDOT' }],
7628
+ %q{a #!#!.foo!}.gsub('!', "\n"),
7629
+ %q{ ^ location},
7630
+ ALL_VERSIONS - SINCE_2_7)
7631
+
7632
+ assert_diagnoses(
7633
+ [:error, :unexpected_token, { :token => 'tAMPER' }],
7634
+ %q{a #!#!&.foo!}.gsub('!', "\n"),
7635
+ %q{ ^ location},
7636
+ ALL_VERSIONS - SINCE_2_7)
7637
+
7638
+ assert_diagnoses(
7639
+ [:error, :unexpected_token, { :token => 'tDOT' }],
7640
+ %q{a #!#!.:foo!}.gsub('!', "\n"),
7641
+ %q{ ^ location},
7642
+ ALL_VERSIONS - SINCE_2_7)
7643
+ end
7579
7644
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.4.1
4
+ version: 2.6.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - whitequark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-11 00:00:00.000000000 Z
11
+ date: 2019-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
@@ -309,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
309
  - !ruby/object:Gem::Version
310
310
  version: '0'
311
311
  requirements: []
312
- rubygems_version: 3.0.6
312
+ rubygems_version: 3.0.1
313
313
  signing_key:
314
314
  specification_version: 4
315
315
  summary: A Ruby parser written in pure Ruby.