parser 3.2.2.4 → 3.3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parser/builders/default.rb +18 -1
- data/lib/parser/current.rb +4 -4
- data/lib/parser/lexer/literal.rb +15 -1
- data/lib/parser/lexer-F0.rb +295 -243
- data/lib/parser/lexer-F1.rb +444 -383
- data/lib/parser/macruby.rb +2 -2
- data/lib/parser/messages.rb +46 -41
- data/lib/parser/ruby18.rb +2 -2
- data/lib/parser/ruby19.rb +2 -2
- data/lib/parser/ruby20.rb +2 -2
- data/lib/parser/ruby21.rb +2 -2
- data/lib/parser/ruby22.rb +2 -2
- data/lib/parser/ruby23.rb +2 -2
- data/lib/parser/ruby24.rb +2 -2
- data/lib/parser/ruby25.rb +2 -2
- data/lib/parser/ruby26.rb +2 -2
- data/lib/parser/ruby27.rb +2 -2
- data/lib/parser/ruby30.rb +2 -2
- data/lib/parser/ruby31.rb +2 -2
- data/lib/parser/ruby32.rb +2 -2
- data/lib/parser/ruby33.rb +6782 -6897
- data/lib/parser/rubymotion.rb +2 -2
- data/lib/parser/static_environment.rb +12 -0
- data/lib/parser/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 780dd5ff7826fc0f5732ce77431124b80780db4aba31bb969778f856f3f3f856
|
4
|
+
data.tar.gz: 597eb758eb6f50230e1541bd30b317b43ef6efa060d1ae276f556e90f23ac50e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c3ce1ff689c04a1bbdc85b96bca0e14d5a7db8f6226436bc7782753827d3db872d311d34ab53a25649e36d7ef9f41c8c88e739a4b34a0caa1ca8a2e703801cb
|
7
|
+
data.tar.gz: 489be4885d7f1c3d011898b9790140b6aa4a1cca356dfb2a7f488d73fc3050ac08e7182bcb6a91f01a0167542ca388da3c71b5512bbdbae155163eaa496ac2ef
|
@@ -594,7 +594,13 @@ module Parser
|
|
594
594
|
end
|
595
595
|
|
596
596
|
def gvar(token)
|
597
|
-
|
597
|
+
gvar_name = value(token)
|
598
|
+
|
599
|
+
if gvar_name.start_with?('$0') && gvar_name.length > 2
|
600
|
+
diagnostic :error, :gvar_name, { :name => gvar_name }, loc(token)
|
601
|
+
end
|
602
|
+
|
603
|
+
n(:gvar, [ gvar_name.to_sym ],
|
598
604
|
variable_map(token))
|
599
605
|
end
|
600
606
|
|
@@ -654,6 +660,13 @@ module Parser
|
|
654
660
|
end
|
655
661
|
|
656
662
|
unless @parser.static_env.declared?(name)
|
663
|
+
if @parser.version == 33 &&
|
664
|
+
name == :it &&
|
665
|
+
@parser.context.in_block &&
|
666
|
+
!@parser.max_numparam_stack.has_ordinary_params?
|
667
|
+
diagnostic :warning, :ambiguous_it_call, nil, node.loc.expression
|
668
|
+
end
|
669
|
+
|
657
670
|
return n(:send, [ nil, name ],
|
658
671
|
var_send_map(node))
|
659
672
|
end
|
@@ -2255,6 +2268,10 @@ module Parser
|
|
2255
2268
|
|
2256
2269
|
def static_regexp_node(node)
|
2257
2270
|
if node.type == :regexp
|
2271
|
+
if @parser.version >= 33 && node.children[0..-2].any? { |child| child.type != :str }
|
2272
|
+
return nil
|
2273
|
+
end
|
2274
|
+
|
2258
2275
|
parts, options = node.children[0..-2], node.children[-1]
|
2259
2276
|
static_regexp(parts, options)
|
2260
2277
|
end
|
data/lib/parser/current.rb
CHANGED
@@ -111,7 +111,7 @@ module Parser
|
|
111
111
|
CurrentRuby = Ruby32
|
112
112
|
|
113
113
|
when /^3\.3\./
|
114
|
-
current_version = '3.3.0
|
114
|
+
current_version = '3.3.0'
|
115
115
|
if RUBY_VERSION != current_version
|
116
116
|
warn_syntax_deviation 'parser/ruby33', current_version
|
117
117
|
end
|
@@ -121,8 +121,8 @@ module Parser
|
|
121
121
|
|
122
122
|
else # :nocov:
|
123
123
|
# Keep this in sync with released Ruby.
|
124
|
-
warn_syntax_deviation 'parser/
|
125
|
-
require 'parser/
|
126
|
-
CurrentRuby =
|
124
|
+
warn_syntax_deviation 'parser/ruby33', '3.3.x'
|
125
|
+
require 'parser/ruby33'
|
126
|
+
CurrentRuby = Ruby33
|
127
127
|
end
|
128
128
|
end
|
data/lib/parser/lexer/literal.rb
CHANGED
@@ -5,6 +5,7 @@ module Parser
|
|
5
5
|
|
6
6
|
class Lexer::Literal
|
7
7
|
DELIMITERS = { '(' => ')', '[' => ']', '{' => '}', '<' => '>' }
|
8
|
+
SPACE = ' '.ord
|
8
9
|
|
9
10
|
TYPES = {
|
10
11
|
# type start token interpolate?
|
@@ -234,7 +235,20 @@ module Parser
|
|
234
235
|
protected
|
235
236
|
|
236
237
|
def delimiter?(delimiter)
|
237
|
-
if
|
238
|
+
if heredoc?
|
239
|
+
# This heredoc is valid:
|
240
|
+
# <<~E
|
241
|
+
# E
|
242
|
+
# and this:
|
243
|
+
# <<~E
|
244
|
+
# E
|
245
|
+
# but this one is not:
|
246
|
+
# <<~' E'
|
247
|
+
# E
|
248
|
+
# because there are not enough leading spaces in the closing delimiter.
|
249
|
+
delimiter.end_with?(@end_delim) &&
|
250
|
+
delimiter.delete_suffix(@end_delim).bytes.all? { |c| c == SPACE }
|
251
|
+
elsif @indent
|
238
252
|
@end_delim == delimiter.lstrip
|
239
253
|
else
|
240
254
|
@end_delim == delimiter
|