ruby_parser 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -2
- data/History.txt +7 -0
- data/lib/ruby18_parser.rb +2 -0
- data/lib/ruby18_parser.y +2 -0
- data/lib/ruby19_parser.rb +2 -0
- data/lib/ruby19_parser.y +2 -0
- data/lib/ruby_lexer.rb +5 -0
- data/lib/ruby_parser_extras.rb +21 -19
- data/test/test_ruby_parser.rb +7 -0
- metadata +11 -11
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
��)E�hs�t��)��3Z�-�4h���� (L'&@E�-6�)�.����EN1'�Pћ�ۓ�1DnS;�GEz�]h
|
2
|
+
Pk����D��9w���$�����ԉ�Y��Iޮf0Ǭ�Mx�m�G�<lrZ�K*ʍ�A����O��㸌�(4�������v�u=��|T6�]�D6� ��Zn䤧-�g�������h���EI@S^��T���+�QҘR��Ι���Jh�ҡ�@���|�Ni5Я{�W�
|
data/History.txt
CHANGED
data/lib/ruby18_parser.rb
CHANGED
data/lib/ruby18_parser.y
CHANGED
data/lib/ruby19_parser.rb
CHANGED
data/lib/ruby19_parser.y
CHANGED
data/lib/ruby_lexer.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
class RubyLexer
|
4
4
|
|
5
|
+
# :stopdoc:
|
5
6
|
RUBY19 = "".respond_to? :encoding
|
6
7
|
|
7
8
|
IDENT_CHAR_RE = if RUBY19 then
|
@@ -19,6 +20,7 @@ class RubyLexer
|
|
19
20
|
attr_accessor :nest
|
20
21
|
|
21
22
|
ESC_RE = /\\((?>[0-7]{1,3}|x[0-9a-fA-F]{1,2}|M-[^\\]|(C-|c)[^\\]|[^0-7xMCc]))/
|
23
|
+
# :startdoc:
|
22
24
|
|
23
25
|
##
|
24
26
|
# What version of ruby to parse. 18 and 19 are the only valid values
|
@@ -53,6 +55,8 @@ class RubyLexer
|
|
53
55
|
EOF = :eof_haha!
|
54
56
|
|
55
57
|
# ruby constants for strings (should this be moved somewhere else?)
|
58
|
+
|
59
|
+
# :stopdoc:
|
56
60
|
STR_FUNC_BORING = 0x00
|
57
61
|
STR_FUNC_ESCAPE = 0x01 # TODO: remove and replace with REGEXP
|
58
62
|
STR_FUNC_EXPAND = 0x02
|
@@ -82,6 +86,7 @@ class RubyLexer
|
|
82
86
|
"=~" => :tMATCH,
|
83
87
|
"->" => :tLAMBDA,
|
84
88
|
}
|
89
|
+
# :startdoc:
|
85
90
|
|
86
91
|
# How the parser advances to the next token.
|
87
92
|
#
|
data/lib/ruby_parser_extras.rb
CHANGED
@@ -7,6 +7,7 @@ require 'strscan'
|
|
7
7
|
require 'ruby_lexer'
|
8
8
|
require "timeout"
|
9
9
|
|
10
|
+
# :stopdoc:
|
10
11
|
# WHY do I have to do this?!?
|
11
12
|
class Regexp
|
12
13
|
ONCE = 0 unless defined? ONCE # FIX: remove this - it makes no sense
|
@@ -25,6 +26,7 @@ class Fixnum
|
|
25
26
|
self
|
26
27
|
end
|
27
28
|
end unless "a"[0] == "a"
|
29
|
+
# :startdoc:
|
28
30
|
|
29
31
|
class RPStringScanner < StringScanner
|
30
32
|
# if ENV['TALLY'] then
|
@@ -108,7 +110,7 @@ class RPStringScanner < StringScanner
|
|
108
110
|
end
|
109
111
|
|
110
112
|
module RubyParserStuff
|
111
|
-
VERSION =
|
113
|
+
VERSION = "3.1.3" unless constants.include? "VERSION" # SIGH
|
112
114
|
|
113
115
|
attr_accessor :lexer, :in_def, :in_single, :file
|
114
116
|
attr_reader :env, :comments
|
@@ -263,11 +265,6 @@ module RubyParserStuff
|
|
263
265
|
return head if tail.nil?
|
264
266
|
return tail if head.nil?
|
265
267
|
|
266
|
-
case head[0]
|
267
|
-
when :lit, :str then
|
268
|
-
return tail
|
269
|
-
end
|
270
|
-
|
271
268
|
line = [head.line, tail.line].compact.min
|
272
269
|
|
273
270
|
head = remove_begin(head)
|
@@ -473,29 +470,34 @@ module RubyParserStuff
|
|
473
470
|
end
|
474
471
|
|
475
472
|
def new_body val
|
476
|
-
|
473
|
+
body, resbody, elsebody, ensurebody = val
|
477
474
|
|
478
|
-
|
475
|
+
result = body
|
476
|
+
|
477
|
+
if resbody then
|
479
478
|
result = s(:rescue)
|
480
|
-
result <<
|
479
|
+
result << body if body
|
481
480
|
|
482
|
-
|
481
|
+
res = resbody
|
483
482
|
|
484
|
-
while
|
485
|
-
result <<
|
486
|
-
|
483
|
+
while res do
|
484
|
+
result << res
|
485
|
+
res = res.resbody(true)
|
487
486
|
end
|
488
487
|
|
489
|
-
result <<
|
488
|
+
result << elsebody if elsebody
|
489
|
+
|
490
|
+
result.line = (body || resbody).line
|
491
|
+
end
|
490
492
|
|
491
|
-
|
492
|
-
elsif not val[2].nil? then
|
493
|
+
if elsebody and not resbody then
|
493
494
|
warning("else without rescue is useless")
|
494
|
-
result = block_append(result,
|
495
|
+
result = block_append(s(:begin, result), elsebody)
|
495
496
|
end
|
496
497
|
|
497
|
-
result = s(:ensure, result,
|
498
|
-
|
498
|
+
result = s(:ensure, result, ensurebody).compact if ensurebody
|
499
|
+
|
500
|
+
result
|
499
501
|
end
|
500
502
|
|
501
503
|
def argl x
|
data/test/test_ruby_parser.rb
CHANGED
@@ -275,6 +275,13 @@ module TestRubyParserShared
|
|
275
275
|
assert_parse rb, pt
|
276
276
|
end
|
277
277
|
|
278
|
+
def test_bug_begin_else
|
279
|
+
rb = "begin 1; else; 2 end"
|
280
|
+
pt = s(:block, s(:lit, 1), s(:lit, 2))
|
281
|
+
|
282
|
+
assert_parse rb, pt
|
283
|
+
end
|
284
|
+
|
278
285
|
def test_bug_comment_eq_begin
|
279
286
|
rb = "\n\n#\n=begin\nblah\n=end\n\n"
|
280
287
|
pt = nil
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 3.1.
|
9
|
+
- 3
|
10
|
+
version: 3.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2013-
|
39
|
+
date: 2013-04-10 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sexp_processor
|
@@ -61,11 +61,11 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - ~>
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
hash:
|
64
|
+
hash: 21
|
65
65
|
segments:
|
66
66
|
- 4
|
67
|
-
-
|
68
|
-
version: "4.
|
67
|
+
- 7
|
68
|
+
version: "4.7"
|
69
69
|
type: :development
|
70
70
|
version_requirements: *id002
|
71
71
|
- !ruby/object:Gem::Dependency
|
@@ -76,11 +76,11 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
hash:
|
79
|
+
hash: 27
|
80
80
|
segments:
|
81
|
-
-
|
82
|
-
-
|
83
|
-
version: "
|
81
|
+
- 4
|
82
|
+
- 0
|
83
|
+
version: "4.0"
|
84
84
|
type: :development
|
85
85
|
version_requirements: *id003
|
86
86
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|