ruby_parser 3.8.0 → 3.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -455,6 +455,10 @@ rule
455
455
  {
456
456
  result = s(:attrasgn, val[0], :"#{val[2]}=")
457
457
  }
458
+ | primary_value tLONELY tIDENTIFIER
459
+ {
460
+ result = s(:attrasgnx, val[0], :"#{val[2]}=")
461
+ }
458
462
  | primary_value tCOLON2 tIDENTIFIER
459
463
  {
460
464
  result = s(:attrasgn, val[0], :"#{val[2]}=")
@@ -463,6 +467,10 @@ rule
463
467
  {
464
468
  result = s(:attrasgn, val[0], :"#{val[2]}=")
465
469
  }
470
+ | primary_value tLONELY tCONSTANT
471
+ {
472
+ result = s(:attrasgnx, val[0], :"#{val[2]}=")
473
+ }
466
474
  | primary_value tCOLON2 tCONSTANT
467
475
  {
468
476
  if (self.in_def || self.in_single > 0) then
@@ -507,10 +515,6 @@ rule
507
515
  {
508
516
  result = s(:safe_attrasgn, val[0], :"#{val[2]}=")
509
517
  }
510
- | primary_value tLONELY tCONSTANT
511
- {
512
- result = s(:safe_attrasgn, val[0], :"#{val[2]}=")
513
- }
514
518
  | primary_value tCOLON2 tIDENTIFIER
515
519
  {
516
520
  result = s(:attrasgn, val[0], :"#{val[2]}=")
@@ -519,6 +523,10 @@ rule
519
523
  {
520
524
  result = s(:attrasgn, val[0], :"#{val[2]}=")
521
525
  }
526
+ | primary_value tLONELY tCONSTANT
527
+ {
528
+ result = s(:safe_attrasgn, val[0], :"#{val[2]}=")
529
+ }
522
530
  | primary_value tCOLON2 tCONSTANT
523
531
  {
524
532
  if (self.in_def || self.in_single > 0) then
@@ -473,6 +473,12 @@ rule
473
473
  {
474
474
  result = s(:attrasgn, val[0], :"#{val[2]}=")
475
475
  }
476
+ #if defined(RUBY23)
477
+ | primary_value tLONELY tIDENTIFIER
478
+ {
479
+ result = s(:attrasgnx, val[0], :"#{val[2]}=")
480
+ }
481
+ #endif
476
482
  | primary_value tCOLON2 tIDENTIFIER
477
483
  {
478
484
  result = s(:attrasgn, val[0], :"#{val[2]}=")
@@ -481,6 +487,12 @@ rule
481
487
  {
482
488
  result = s(:attrasgn, val[0], :"#{val[2]}=")
483
489
  }
490
+ #if defined(RUBY23)
491
+ | primary_value tLONELY tCONSTANT
492
+ {
493
+ result = s(:attrasgnx, val[0], :"#{val[2]}=")
494
+ }
495
+ #endif
484
496
  | primary_value tCOLON2 tCONSTANT
485
497
  {
486
498
  if (self.in_def || self.in_single > 0) then
@@ -526,10 +538,6 @@ rule
526
538
  {
527
539
  result = s(:safe_attrasgn, val[0], :"#{val[2]}=")
528
540
  }
529
- | primary_value tLONELY tCONSTANT
530
- {
531
- result = s(:safe_attrasgn, val[0], :"#{val[2]}=")
532
- }
533
541
  #endif
534
542
  | primary_value tCOLON2 tIDENTIFIER
535
543
  {
@@ -539,6 +547,12 @@ rule
539
547
  {
540
548
  result = s(:attrasgn, val[0], :"#{val[2]}=")
541
549
  }
550
+ #if defined(RUBY23)
551
+ | primary_value tLONELY tCONSTANT
552
+ {
553
+ result = s(:safe_attrasgn, val[0], :"#{val[2]}=")
554
+ }
555
+ #endif
542
556
  | primary_value tCOLON2 tCONSTANT
543
557
  {
544
558
  if (self.in_def || self.in_single > 0) then
@@ -91,7 +91,7 @@ class RPStringScanner < StringScanner
91
91
  end
92
92
 
93
93
  module RubyParserStuff
94
- VERSION = "3.8.0" unless constants.include? "VERSION" # SIGH
94
+ VERSION = "3.8.1" unless constants.include? "VERSION" # SIGH
95
95
 
96
96
  attr_accessor :lexer, :in_def, :in_single, :file
97
97
  attr_reader :env, :comments
@@ -3422,6 +3422,13 @@ class TestRuby23Parser < RubyParserTestCase
3422
3422
  assert_parse rb, pt
3423
3423
  end
3424
3424
 
3425
+ def test_safe_call_newline
3426
+ rb = "a&.b\n"
3427
+ pt = s(:safe_call, s(:call, nil, :a), :b)
3428
+
3429
+ assert_parse rb, pt
3430
+ end
3431
+
3425
3432
  def test_safe_calls
3426
3433
  rb = "a&.b&.c(1)"
3427
3434
  pt = s(:safe_call, s(:safe_call, s(:call, nil, :a), :b), :c, s(:lit, 1))
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.8.0
4
+ version: 3.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
metadata.gz.sig CHANGED
Binary file