parser 3.0.3.2 → 3.1.2.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: e2251af231c276f8a7afbb8c5766ec286e076737a5446f3b453915243884684a
4
- data.tar.gz: 0045f0edcd07e6a0b152af2ea75146017fb0c0217584e2edc56d5eedcafe0f71
3
+ metadata.gz: 99a2cb2ef9fe58be50862176d8ee8b7fc1f3e616e16360b6777c7f0a366c37fb
4
+ data.tar.gz: ec7f0703c68564fdc55fc5a402ead6978da0bc3af9650dbc5d93127ce458b2d8
5
5
  SHA512:
6
- metadata.gz: 44814126d3b6b6e960e1044a320ca2e94cec80bef3a58be0dcb10b9ed92bb2ebe4c21ab4b446e3e14c65a8c4f18bd265252462d056944ad0e15c5928bcd58ba8
7
- data.tar.gz: da8145dd6a52dd3f4f9d4db73b4295d8df88dae974fac3df7db353a16ad95f45746066ddf98252ea3453660a2345d349cce8b2ca0e7f36bea2fade61cfd3368e
6
+ metadata.gz: 3474317cdd46eb6085244fc57c91d7bcc7a157550fe834e5d58792d472861fa3420d381535554dfaba5fd30142c60040cbc59973694e241ee8aa5ba7a9655690
7
+ data.tar.gz: 3a7cbfec0dfe94ea448930357d2692806080c033f3ccc0d2af472d7abc18d2e3c72d1bd163852310f5e852f188bc4ed7f2336a178bcbdcb2a1f7b79d438dbcf7
data/lib/parser/all.rb CHANGED
@@ -12,3 +12,4 @@ require 'parser/ruby26'
12
12
  require 'parser/ruby27'
13
13
  require 'parser/ruby30'
14
14
  require 'parser/ruby31'
15
+ require 'parser/ruby32'
@@ -714,7 +714,7 @@ module Parser
714
714
  node.updated(:gvasgn)
715
715
 
716
716
  when :const
717
- unless @parser.context.dynamic_const_definition_allowed?
717
+ if @parser.context.in_def
718
718
  diagnostic :error, :dynamic_const, nil, node.loc.expression
719
719
  end
720
720
 
@@ -16,60 +16,34 @@ module Parser
16
16
  # + :lambda - in the lambda body (-> {})
17
17
  #
18
18
  class Context
19
- attr_reader :stack
19
+ FLAGS = %i[
20
+ in_defined
21
+ in_kwarg
22
+ in_argdef
23
+ in_def
24
+ in_class
25
+ in_block
26
+ in_lambda
27
+ ]
20
28
 
21
29
  def initialize
22
- @stack = []
23
- freeze
24
- end
25
-
26
- def push(state)
27
- @stack << state
28
- end
29
-
30
- def pop
31
- @stack.pop
30
+ reset
32
31
  end
33
32
 
34
33
  def reset
35
- @stack.clear
36
- end
37
-
38
- def empty?
39
- @stack.empty?
40
- end
41
-
42
- def in_class?
43
- @stack.last == :class
44
- end
45
-
46
- def indirectly_in_def?
47
- @stack.include?(:def) || @stack.include?(:defs)
34
+ @in_defined = false
35
+ @in_kwarg = false
36
+ @in_argdef = false
37
+ @in_def = false
38
+ @in_class = false
39
+ @in_block = false
40
+ @in_lambda = false
48
41
  end
49
42
 
50
- def class_definition_allowed?
51
- def_index = stack.rindex { |item| [:def, :defs].include?(item) }
52
- sclass_index = stack.rindex(:sclass)
53
-
54
- def_index.nil? || (!sclass_index.nil? && sclass_index > def_index)
55
- end
56
- alias module_definition_allowed? class_definition_allowed?
57
- alias dynamic_const_definition_allowed? class_definition_allowed?
58
-
59
- def in_block?
60
- @stack.last == :block
61
- end
62
-
63
- def in_lambda?
64
- @stack.last == :lambda
65
- end
43
+ attr_accessor(*FLAGS)
66
44
 
67
45
  def in_dynamic_block?
68
- in_block? || in_lambda?
69
- end
70
-
71
- def in_def_open_args?
72
- @stack.last == :def_open_args
46
+ in_block || in_lambda
73
47
  end
74
48
  end
75
49
  end
@@ -66,7 +66,7 @@ module Parser
66
66
  CurrentRuby = Ruby25
67
67
 
68
68
  when /^2\.6\./
69
- current_version = '2.6.9'
69
+ current_version = '2.6.10'
70
70
  if RUBY_VERSION != current_version
71
71
  warn_syntax_deviation 'parser/ruby26', current_version
72
72
  end
@@ -75,7 +75,7 @@ module Parser
75
75
  CurrentRuby = Ruby26
76
76
 
77
77
  when /^2\.7\./
78
- current_version = '2.7.5'
78
+ current_version = '2.7.6'
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.3'
87
+ current_version = '3.0.4'
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.0-dev'
96
+ current_version = '3.1.2'
97
97
  if RUBY_VERSION != current_version
98
98
  warn_syntax_deviation 'parser/ruby31', current_version
99
99
  end
@@ -101,10 +101,19 @@ module Parser
101
101
  require 'parser/ruby31'
102
102
  CurrentRuby = Ruby31
103
103
 
104
+ when /^3\.2\./
105
+ current_version = '3.2.0-dev'
106
+ if RUBY_VERSION != current_version
107
+ warn_syntax_deviation 'parser/ruby32', current_version
108
+ end
109
+
110
+ require 'parser/ruby32'
111
+ CurrentRuby = Ruby32
112
+
104
113
  else # :nocov:
105
114
  # Keep this in sync with released Ruby.
106
- warn_syntax_deviation 'parser/ruby30', '3.0.x'
107
- require 'parser/ruby30'
108
- CurrentRuby = Ruby30
115
+ warn_syntax_deviation 'parser/ruby31', '3.1.x'
116
+ require 'parser/ruby31'
117
+ CurrentRuby = Ruby31
109
118
  end
110
119
  end
@@ -18,7 +18,7 @@ module Parser
18
18
  def advance
19
19
  type, (val, range) = advance_before_explanation
20
20
 
21
- more = "(in-kwarg)" if @in_kwarg
21
+ more = "(in-kwarg)" if @context.in_kwarg
22
22
 
23
23
  puts decorate(range,
24
24
  Color.green("#{type} #{val.inspect}"),