ruby_parser 3.10.1 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +12 -0
- data/Manifest.txt +2 -0
- data/README.rdoc +5 -1
- data/Rakefile +1 -1
- data/lib/ruby19_parser.rb +1751 -1745
- data/lib/ruby19_parser.y +2 -2
- data/lib/ruby20_parser.rb +1717 -1717
- data/lib/ruby20_parser.y +2 -2
- data/lib/ruby21_parser.rb +1824 -1819
- data/lib/ruby21_parser.y +2 -2
- data/lib/ruby22_parser.rb +1838 -1846
- data/lib/ruby22_parser.y +2 -2
- data/lib/ruby23_parser.rb +1836 -1837
- data/lib/ruby23_parser.y +2 -2
- data/lib/ruby24_parser.rb +1836 -1837
- data/lib/ruby24_parser.y +2 -2
- data/lib/ruby25_parser.rb +6818 -0
- data/lib/ruby25_parser.y +2378 -0
- data/lib/ruby_lexer.rb +8 -2
- data/lib/ruby_parser.rb +2 -0
- data/lib/ruby_parser.yy +4 -2
- data/lib/ruby_parser_extras.rb +2 -7
- data/test/test_ruby_lexer.rb +22 -0
- data/test/test_ruby_parser.rb +39 -0
- metadata +23 -16
- metadata.gz.sig +0 -0
data/lib/ruby_lexer.rb
CHANGED
@@ -548,7 +548,7 @@ class RubyLexer
|
|
548
548
|
self.lineno += matched.lines.to_a.size if scan(/\n+/)
|
549
549
|
|
550
550
|
return if in_lex_state?(:expr_beg, :expr_value, :expr_class,
|
551
|
-
:expr_fname, :expr_dot
|
551
|
+
:expr_fname, :expr_dot)
|
552
552
|
|
553
553
|
if scan(/([\ \t\r\f\v]*)(\.|&)/) then
|
554
554
|
self.space_seen = true unless ss[1].empty?
|
@@ -1042,7 +1042,13 @@ class RubyLexer
|
|
1042
1042
|
when scan(/\\[McCx]/) then
|
1043
1043
|
rb_compile_error "Invalid escape character syntax"
|
1044
1044
|
when scan(/\\(.)/m) then
|
1045
|
-
|
1045
|
+
chr = ss[1]
|
1046
|
+
prev = self.string_buffer.last
|
1047
|
+
if term == chr && prev && prev.end_with?("(?") then
|
1048
|
+
self.string_buffer << chr
|
1049
|
+
else
|
1050
|
+
self.string_buffer << matched
|
1051
|
+
end
|
1046
1052
|
else
|
1047
1053
|
rb_compile_error "Invalid escape character syntax"
|
1048
1054
|
end
|
data/lib/ruby_parser.rb
CHANGED
@@ -72,10 +72,12 @@ require "ruby21_parser"
|
|
72
72
|
require "ruby22_parser"
|
73
73
|
require "ruby23_parser"
|
74
74
|
require "ruby24_parser"
|
75
|
+
require "ruby25_parser"
|
75
76
|
|
76
77
|
class RubyParser # HACK
|
77
78
|
VERSIONS.clear # also a HACK caused by racc namespace issues
|
78
79
|
|
80
|
+
class V25 < ::Ruby25Parser; end
|
79
81
|
class V24 < ::Ruby24Parser; end
|
80
82
|
class V23 < ::Ruby23Parser; end
|
81
83
|
class V22 < ::Ruby22Parser; end
|
data/lib/ruby_parser.yy
CHANGED
@@ -10,6 +10,8 @@ class Ruby22Parser
|
|
10
10
|
class Ruby23Parser
|
11
11
|
#elif V == 24
|
12
12
|
class Ruby24Parser
|
13
|
+
#elif V == 25
|
14
|
+
class Ruby25Parser
|
13
15
|
#else
|
14
16
|
fail "version not specified or supported on code generation"
|
15
17
|
#endif
|
@@ -2418,9 +2420,9 @@ keyword_variable: kNIL { result = s(:nil) }
|
|
2418
2420
|
{
|
2419
2421
|
result = s(:array, val[0], val[2])
|
2420
2422
|
}
|
2421
|
-
| tLABEL arg_value
|
2423
|
+
| tLABEL opt_nl arg_value
|
2422
2424
|
{
|
2423
|
-
result = s(:array, s(:lit, val[0][0].to_sym), val
|
2425
|
+
result = s(:array, s(:lit, val[0][0].to_sym), val.last)
|
2424
2426
|
}
|
2425
2427
|
#if V >= 22
|
2426
2428
|
| tSTRING_BEG string_contents tLABEL_END arg_value
|
data/lib/ruby_parser_extras.rb
CHANGED
@@ -7,7 +7,7 @@ require "rp_extensions"
|
|
7
7
|
require "rp_stringscanner"
|
8
8
|
|
9
9
|
module RubyParserStuff
|
10
|
-
VERSION = "3.
|
10
|
+
VERSION = "3.11.0"
|
11
11
|
|
12
12
|
attr_accessor :lexer, :in_def, :in_single, :file
|
13
13
|
attr_reader :env, :comments
|
@@ -437,12 +437,7 @@ module RubyParserStuff
|
|
437
437
|
def new_aref val
|
438
438
|
val[2] ||= s(:arglist)
|
439
439
|
val[2].sexp_type = :arglist if val[2].sexp_type == :array # REFACTOR
|
440
|
-
|
441
|
-
result = new_call nil, :"[]", val[2]
|
442
|
-
else
|
443
|
-
result = new_call val[0], :"[]", val[2]
|
444
|
-
end
|
445
|
-
result
|
440
|
+
new_call val[0], :"[]", val[2]
|
446
441
|
end
|
447
442
|
|
448
443
|
def new_body val
|
data/test/test_ruby_lexer.rb
CHANGED
@@ -2053,6 +2053,14 @@ class TestRubyLexer < Minitest::Test
|
|
2053
2053
|
:tREGEXP_END, "", :expr_end)
|
2054
2054
|
end
|
2055
2055
|
|
2056
|
+
def test_yylex_regexp_escaped_delim
|
2057
|
+
assert_lex3("%r!blah(?\\!blah)!",
|
2058
|
+
nil,
|
2059
|
+
:tREGEXP_BEG, "%r\000", :expr_beg,
|
2060
|
+
:tSTRING_CONTENT, "blah(?!blah)", :expr_beg,
|
2061
|
+
:tREGEXP_END, "", :expr_end)
|
2062
|
+
end
|
2063
|
+
|
2056
2064
|
def test_yylex_regexp_escape_backslash_terminator_meta1
|
2057
2065
|
assert_lex3("%r{blah\\}blah}",
|
2058
2066
|
nil,
|
@@ -2797,6 +2805,20 @@ class TestRubyLexer < Minitest::Test
|
|
2797
2805
|
:tRCURLY, "}", :expr_endarg, 0, 0)
|
2798
2806
|
end
|
2799
2807
|
|
2808
|
+
def test_yylex_required_kwarg_no_value_22
|
2809
|
+
setup_lexer_class RubyParser::V22
|
2810
|
+
|
2811
|
+
assert_lex3("def foo a:, b:\nend",
|
2812
|
+
nil,
|
2813
|
+
:kDEF, "def", :expr_fname,
|
2814
|
+
:tIDENTIFIER, "foo", :expr_endfn,
|
2815
|
+
:tLABEL, "a", :expr_labelarg,
|
2816
|
+
:tCOMMA, ",", :expr_beg,
|
2817
|
+
:tLABEL, "b", :expr_labelarg,
|
2818
|
+
:tNL, nil, :expr_beg,
|
2819
|
+
:kEND, "end", :expr_end)
|
2820
|
+
end
|
2821
|
+
|
2800
2822
|
def test_ruby21_rational_literal
|
2801
2823
|
setup_lexer_class RubyParser::V21
|
2802
2824
|
|
data/test/test_ruby_parser.rb
CHANGED
@@ -171,6 +171,13 @@ module TestRubyParserShared
|
|
171
171
|
assert_parse rb, pt
|
172
172
|
end
|
173
173
|
|
174
|
+
def test_call_self_brackets
|
175
|
+
rb = "self[1]"
|
176
|
+
pt = s(:call, s(:self), :[], s(:lit, 1))
|
177
|
+
|
178
|
+
assert_parse rb, pt
|
179
|
+
end
|
180
|
+
|
174
181
|
def test_dasgn_icky2
|
175
182
|
rb = "a do\n v = nil\n begin\n yield\n rescue Exception => v\n break\n end\nend"
|
176
183
|
pt = s(:iter,
|
@@ -3419,6 +3426,17 @@ module TestRubyParserShared23Plus
|
|
3419
3426
|
assert_parse rb, pt
|
3420
3427
|
end
|
3421
3428
|
|
3429
|
+
def test_required_kwarg_no_value
|
3430
|
+
rb = "def x a:, b:\nend"
|
3431
|
+
pt = s(:defn, :x,
|
3432
|
+
s(:args,
|
3433
|
+
s(:kwarg, :a),
|
3434
|
+
s(:kwarg, :b)),
|
3435
|
+
s(:nil))
|
3436
|
+
|
3437
|
+
assert_parse rb, pt
|
3438
|
+
end
|
3439
|
+
|
3422
3440
|
def test_slashy_newlines_within_string
|
3423
3441
|
rb = %(puts "hello\\
|
3424
3442
|
my\\
|
@@ -3443,6 +3461,10 @@ module TestRubyParserShared24Plus
|
|
3443
3461
|
# ...version specific tests to go here...
|
3444
3462
|
end
|
3445
3463
|
|
3464
|
+
module TestRubyParserShared25Plus
|
3465
|
+
# ...version specific tests to go here...
|
3466
|
+
end
|
3467
|
+
|
3446
3468
|
class TestRubyParser < Minitest::Test
|
3447
3469
|
def test_cls_version
|
3448
3470
|
assert_equal 18, RubyParser::V18.version
|
@@ -3729,6 +3751,23 @@ class TestRubyParserV24 < RubyParserTestCase
|
|
3729
3751
|
end
|
3730
3752
|
end
|
3731
3753
|
|
3754
|
+
class TestRubyParserV25 < RubyParserTestCase
|
3755
|
+
include TestRubyParserShared
|
3756
|
+
include TestRubyParserShared19Plus
|
3757
|
+
include TestRubyParserShared20Plus
|
3758
|
+
include TestRubyParserShared21Plus
|
3759
|
+
include TestRubyParserShared22Plus
|
3760
|
+
include TestRubyParserShared23Plus
|
3761
|
+
include TestRubyParserShared24Plus
|
3762
|
+
include TestRubyParserShared25Plus
|
3763
|
+
|
3764
|
+
def setup
|
3765
|
+
super
|
3766
|
+
|
3767
|
+
self.processor = RubyParser::V25.new
|
3768
|
+
end
|
3769
|
+
end
|
3770
|
+
|
3732
3771
|
RubyParser::VERSIONS.each do |klass|
|
3733
3772
|
v = klass.version
|
3734
3773
|
describe "block args arity #{v}" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTE3MTEyMTIxMTExMFoXDTE4MTEyMTIxMTExMFowRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWC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1Xeu
|
30
|
+
V+HB+LYYhXWitInO/eXxDrFB
|
32
31
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
32
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
34
33
|
dependencies:
|
35
34
|
- !ruby/object:Gem::Dependency
|
36
35
|
name: sexp_processor
|
@@ -78,16 +77,22 @@ dependencies:
|
|
78
77
|
name: rdoc
|
79
78
|
requirement: !ruby/object:Gem::Requirement
|
80
79
|
requirements:
|
81
|
-
- - "
|
80
|
+
- - ">="
|
82
81
|
- !ruby/object:Gem::Version
|
83
82
|
version: '4.0'
|
83
|
+
- - "<"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '6'
|
84
86
|
type: :development
|
85
87
|
prerelease: false
|
86
88
|
version_requirements: !ruby/object:Gem::Requirement
|
87
89
|
requirements:
|
88
|
-
- - "
|
90
|
+
- - ">="
|
89
91
|
- !ruby/object:Gem::Version
|
90
92
|
version: '4.0'
|
93
|
+
- - "<"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '6'
|
91
96
|
- !ruby/object:Gem::Dependency
|
92
97
|
name: racc
|
93
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,6 +184,8 @@ files:
|
|
179
184
|
- lib/ruby23_parser.y
|
180
185
|
- lib/ruby24_parser.rb
|
181
186
|
- lib/ruby24_parser.y
|
187
|
+
- lib/ruby25_parser.rb
|
188
|
+
- lib/ruby25_parser.y
|
182
189
|
- lib/ruby_lexer.rb
|
183
190
|
- lib/ruby_lexer.rex
|
184
191
|
- lib/ruby_lexer.rex.rb
|
@@ -210,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
217
|
version: '0'
|
211
218
|
requirements: []
|
212
219
|
rubyforge_project:
|
213
|
-
rubygems_version: 2.
|
220
|
+
rubygems_version: 2.7.3
|
214
221
|
signing_key:
|
215
222
|
specification_version: 4
|
216
223
|
summary: ruby_parser (RP) is a ruby parser written in pure ruby (utilizing racc--which
|
metadata.gz.sig
CHANGED
Binary file
|