parser 3.2.0.0 → 3.2.2.4

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: 1f610391f493e02fe53d3282d0334cae06d96e736f65f90127a03e737b216eb2
4
- data.tar.gz: 2105182a6079d599d5757205a6dd9400484422be82b02bae9f50f515d2388f2b
3
+ metadata.gz: 8565383a05692fe05c5f0962a0cb6c4594ad1eaab98f8e1c8b1053ddfa665858
4
+ data.tar.gz: 280636e65eab161acc6369cdf992faa4f81a6496ebbbad794a96ee60ea3e4884
5
5
  SHA512:
6
- metadata.gz: 7ea8cc04e8e2d69867bf7f6566001fb88f0ad59fbe3a2e6782e4e939e662a3bdee0a5a77b42aff275b95125e3f51f6adb16ba859ddff7ab5e672a7a119ef323e
7
- data.tar.gz: afeac266aea582d8c84c395e467698d6c7243e1cf7400613f7512f2d7dfb08dd94a3553f20ae07fe99a27035e54da6fcfbfdd20dbf484c7c18e00edb62ed0f18
6
+ metadata.gz: 8721d3c59c29a9bcb9562b6f0bad1ca119f854873fb3b6f5e550553a6d2fa471afb2d3e1c6c5b1323d5121b36f4070ed0a3bca24866b3dede1682658bbce934f
7
+ data.tar.gz: e312e821428e6c15ec871971aabee38cd7c238adfc855ff1a4b70edb31f529e359162c1961141d2ce3fe0d5f6aee3fce009c6a479aaa3909920993af58d3c3f2
data/lib/parser/all.rb CHANGED
@@ -13,3 +13,4 @@ require 'parser/ruby27'
13
13
  require 'parser/ruby30'
14
14
  require 'parser/ruby31'
15
15
  require 'parser/ruby32'
16
+ require 'parser/ruby33'
@@ -5,8 +5,8 @@ module Parser
5
5
 
6
6
  ##
7
7
  # {Parser::AST::Node} contains information about a single AST node and its
8
- # child nodes. It extends the basic [AST::Node](http://rdoc.info/gems/ast/AST/Node)
9
- # class provided by gem [ast](http://rdoc.info/gems/ast).
8
+ # child nodes. It extends the basic [AST::Node](https://www.rubydoc.info/gems/ast/AST/Node)
9
+ # class provided by gem [ast](https://www.rubydoc.info/gems/ast).
10
10
  #
11
11
  # @api public
12
12
  #
@@ -538,29 +538,23 @@ module Parser
538
538
  end
539
539
 
540
540
  def associate(begin_t, pairs, end_t)
541
- 0.upto(pairs.length - 1) do |i|
542
- (i + 1).upto(pairs.length - 1) do |j|
543
- key1, = *pairs[i]
544
- key2, = *pairs[j]
545
-
546
- do_warn = false
547
-
548
- # keys have to be simple nodes, MRI ignores equal composite keys like
549
- # `{ a(1) => 1, a(1) => 1 }`
550
- case key1.type
551
- when :sym, :str, :int, :float
552
- if key1 == key2
553
- do_warn = true
554
- end
555
- when :rational, :complex, :regexp
556
- if @parser.version >= 31 && key1 == key2
557
- do_warn = true
558
- end
559
- end
541
+ key_set = Set.new
560
542
 
561
- if do_warn
562
- diagnostic :warning, :duplicate_hash_key, nil, key2.loc.expression
563
- end
543
+ pairs.each do |pair|
544
+ next unless pair.type.eql?(:pair)
545
+
546
+ key, = *pair
547
+
548
+ case key.type
549
+ when :sym, :str, :int, :float
550
+ when :rational, :complex, :regexp
551
+ next unless @parser.version >= 31
552
+ else
553
+ next
554
+ end
555
+
556
+ unless key_set.add?(key)
557
+ diagnostic :warning, :duplicate_hash_key, nil, key.loc.expression
564
558
  end
565
559
  end
566
560
 
@@ -1696,24 +1690,34 @@ module Parser
1696
1690
  cond
1697
1691
  end
1698
1692
 
1699
- when :and, :or, :irange, :erange
1693
+ when :and, :or
1700
1694
  lhs, rhs = *cond
1701
1695
 
1702
- type = case cond.type
1703
- when :irange then :iflipflop
1704
- when :erange then :eflipflop
1705
- end
1706
-
1707
- if [:and, :or].include?(cond.type) &&
1708
- @parser.version == 18
1696
+ if @parser.version == 18
1709
1697
  cond
1710
1698
  else
1711
- cond.updated(type, [
1699
+ cond.updated(cond.type, [
1712
1700
  check_condition(lhs),
1713
1701
  check_condition(rhs)
1714
1702
  ])
1715
1703
  end
1716
1704
 
1705
+ when :irange, :erange
1706
+ lhs, rhs = *cond
1707
+
1708
+ type = case cond.type
1709
+ when :irange then :iflipflop
1710
+ when :erange then :eflipflop
1711
+ end
1712
+
1713
+ lhs_condition = check_condition(lhs) unless lhs.nil?
1714
+ rhs_condition = check_condition(rhs) unless rhs.nil?
1715
+
1716
+ return cond.updated(type, [
1717
+ lhs_condition,
1718
+ rhs_condition
1719
+ ])
1720
+
1717
1721
  when :regexp
1718
1722
  n(:match_current_line, [ cond ], expr_map(cond.loc.expression))
1719
1723
 
@@ -75,7 +75,7 @@ module Parser
75
75
  CurrentRuby = Ruby26
76
76
 
77
77
  when /^2\.7\./
78
- current_version = '2.7.7'
78
+ current_version = '2.7.8'
79
79
  if RUBY_VERSION != current_version
80
80
  warn_syntax_deviation 'parser/ruby27', current_version
81
81
  end
@@ -84,7 +84,7 @@ module Parser
84
84
  CurrentRuby = Ruby27
85
85
 
86
86
  when /^3\.0\./
87
- current_version = '3.0.5'
87
+ current_version = '3.0.6'
88
88
  if RUBY_VERSION != current_version
89
89
  warn_syntax_deviation 'parser/ruby30', current_version
90
90
  end
@@ -93,7 +93,7 @@ module Parser
93
93
  CurrentRuby = Ruby30
94
94
 
95
95
  when /^3\.1\./
96
- current_version = '3.1.3'
96
+ current_version = '3.1.4'
97
97
  if RUBY_VERSION != current_version
98
98
  warn_syntax_deviation 'parser/ruby31', current_version
99
99
  end
@@ -102,7 +102,7 @@ module Parser
102
102
  CurrentRuby = Ruby31
103
103
 
104
104
  when /^3\.2\./
105
- current_version = '3.2.0'
105
+ current_version = '3.2.2'
106
106
  if RUBY_VERSION != current_version
107
107
  warn_syntax_deviation 'parser/ruby32', current_version
108
108
  end
@@ -110,6 +110,15 @@ module Parser
110
110
  require 'parser/ruby32'
111
111
  CurrentRuby = Ruby32
112
112
 
113
+ when /^3\.3\./
114
+ current_version = '3.3.0-dev'
115
+ if RUBY_VERSION != current_version
116
+ warn_syntax_deviation 'parser/ruby33', current_version
117
+ end
118
+
119
+ require 'parser/ruby33'
120
+ CurrentRuby = Ruby33
121
+
113
122
  else # :nocov:
114
123
  # Keep this in sync with released Ruby.
115
124
  warn_syntax_deviation 'parser/ruby32', '3.2.x'