parser 3.2.0.0 → 3.2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/parser/all.rb +1 -0
- data/lib/parser/ast/node.rb +2 -2
- data/lib/parser/builders/default.rb +35 -31
- data/lib/parser/current.rb +13 -4
- data/lib/parser/lexer-F0.rb +8695 -13467
- data/lib/parser/lexer-F1.rb +11590 -17983
- data/lib/parser/lexer-strings.rb +5424 -0
- data/lib/parser/macruby.rb +3 -1
- data/lib/parser/ruby18.rb +3 -1
- data/lib/parser/ruby19.rb +3 -1
- data/lib/parser/ruby20.rb +3 -1
- data/lib/parser/ruby21.rb +3 -1
- data/lib/parser/ruby22.rb +3 -1
- data/lib/parser/ruby23.rb +3 -1
- data/lib/parser/ruby24.rb +3 -1
- data/lib/parser/ruby25.rb +3 -1
- data/lib/parser/ruby26.rb +3 -1
- data/lib/parser/ruby27.rb +3 -1
- data/lib/parser/ruby30.rb +3 -1
- data/lib/parser/ruby31.rb +3 -1
- data/lib/parser/ruby32.rb +3 -1
- data/lib/parser/ruby33.rb +12704 -0
- data/lib/parser/rubymotion.rb +3 -1
- data/lib/parser/runner.rb +5 -0
- data/lib/parser/source/comment/associator.rb +7 -7
- data/lib/parser/version.rb +1 -1
- data/lib/parser.rb +1 -0
- data/parser.gemspec +1 -1
- metadata +21 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8565383a05692fe05c5f0962a0cb6c4594ad1eaab98f8e1c8b1053ddfa665858
|
4
|
+
data.tar.gz: 280636e65eab161acc6369cdf992faa4f81a6496ebbbad794a96ee60ea3e4884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8721d3c59c29a9bcb9562b6f0bad1ca119f854873fb3b6f5e550553a6d2fa471afb2d3e1c6c5b1323d5121b36f4070ed0a3bca24866b3dede1682658bbce934f
|
7
|
+
data.tar.gz: e312e821428e6c15ec871971aabee38cd7c238adfc855ff1a4b70edb31f529e359162c1961141d2ce3fe0d5f6aee3fce009c6a479aaa3909920993af58d3c3f2
|
data/lib/parser/all.rb
CHANGED
data/lib/parser/ast/node.rb
CHANGED
@@ -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](
|
9
|
-
# class provided by gem [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
|
-
|
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
|
-
|
562
|
-
|
563
|
-
|
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
|
1693
|
+
when :and, :or
|
1700
1694
|
lhs, rhs = *cond
|
1701
1695
|
|
1702
|
-
|
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
|
|
data/lib/parser/current.rb
CHANGED
@@ -75,7 +75,7 @@ module Parser
|
|
75
75
|
CurrentRuby = Ruby26
|
76
76
|
|
77
77
|
when /^2\.7\./
|
78
|
-
current_version = '2.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.
|
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.
|
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.
|
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'
|