parser 3.0.3.2 → 3.1.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 +1 -1
- data/lib/parser/context.rb +19 -45
- data/lib/parser/current.rb +4 -4
- data/lib/parser/lexer/explanation.rb +1 -1
- data/lib/parser/lexer.rb +10655 -10668
- data/lib/parser/macruby.rb +2476 -2448
- data/lib/parser/max_numparam_stack.rb +5 -5
- data/lib/parser/ruby18.rb +2155 -2114
- data/lib/parser/ruby19.rb +2458 -2424
- data/lib/parser/ruby20.rb +2634 -2598
- data/lib/parser/ruby21.rb +2700 -2667
- data/lib/parser/ruby22.rb +2533 -2491
- data/lib/parser/ruby23.rb +2616 -2571
- data/lib/parser/ruby24.rb +2651 -2609
- data/lib/parser/ruby25.rb +2545 -2513
- data/lib/parser/ruby26.rb +2669 -2624
- data/lib/parser/ruby27.rb +3181 -3133
- data/lib/parser/ruby30.rb +3476 -3444
- data/lib/parser/ruby31.rb +3848 -3786
- data/lib/parser/rubymotion.rb +2454 -2415
- data/lib/parser/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ed45256e09de6d92098e12e73a655fe9d4f35518f573984bf1d92ac87ae8ded
|
4
|
+
data.tar.gz: 68ee7fca4f6d1794e2fb160552b01b983466cd482cad8783ba5f7b1466d0e70b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f8f0785aba15f53c97b046aa5155ffeff4063b12fb611612bd7c3b94affb282487b5aad5ca783d2b928a91333db6e572a2a8a466fe9c7f5716354cb23644471
|
7
|
+
data.tar.gz: b8ecfc04463142cffb2aaad920e95e11257a1a6f7587bf439620b73e59102f15850c413dc807b613379678de9878aa2d941f3fa65ab20716f6be6d80fcf03299
|
data/lib/parser/context.rb
CHANGED
@@ -16,60 +16,34 @@ module Parser
|
|
16
16
|
# + :lambda - in the lambda body (-> {})
|
17
17
|
#
|
18
18
|
class Context
|
19
|
-
|
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
|
-
|
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
|
-
@
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
@
|
40
|
-
|
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
|
-
|
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
|
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
|
data/lib/parser/current.rb
CHANGED
@@ -93,7 +93,7 @@ module Parser
|
|
93
93
|
CurrentRuby = Ruby30
|
94
94
|
|
95
95
|
when /^3\.1\./
|
96
|
-
current_version = '3.1.0
|
96
|
+
current_version = '3.1.0'
|
97
97
|
if RUBY_VERSION != current_version
|
98
98
|
warn_syntax_deviation 'parser/ruby31', current_version
|
99
99
|
end
|
@@ -103,8 +103,8 @@ module Parser
|
|
103
103
|
|
104
104
|
else # :nocov:
|
105
105
|
# Keep this in sync with released Ruby.
|
106
|
-
warn_syntax_deviation 'parser/
|
107
|
-
require 'parser/
|
108
|
-
CurrentRuby =
|
106
|
+
warn_syntax_deviation 'parser/ruby31', '3.1.x'
|
107
|
+
require 'parser/ruby31'
|
108
|
+
CurrentRuby = Ruby31
|
109
109
|
end
|
110
110
|
end
|