ruby_parser 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -2
- data/.autotest +21 -14
- data/History.txt +50 -0
- data/Manifest.txt +3 -1
- data/Rakefile +20 -14
- data/bin/ruby_parse_extract_error +8 -2
- data/lib/.document +1 -0
- data/lib/ruby18_parser.rb +12 -7
- data/lib/ruby18_parser.y +12 -7
- data/lib/ruby19_parser.rb +5 -3
- data/lib/ruby19_parser.y +5 -3
- data/lib/ruby20_parser.rb +17 -5
- data/lib/ruby20_parser.y +17 -5
- data/lib/ruby_lexer.rb +502 -664
- data/lib/ruby_lexer.rex +189 -0
- data/lib/ruby_lexer.rex.rb +263 -0
- data/lib/ruby_parser_extras.rb +45 -58
- data/test/test_ruby_lexer.rb +22 -13
- data/test/test_ruby_parser.rb +85 -25
- metadata +21 -5
- metadata.gz.sig +0 -0
- data/lib/gauntlet_rubyparser.rb +0 -117
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
|
30
30
|
xx3n58i0lQkBE1EpKE0lFu/y
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2014-
|
32
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: sexp_processor
|
@@ -101,20 +101,34 @@ dependencies:
|
|
101
101
|
- - <
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '11'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: oedipus_lex
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.1'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.1'
|
104
118
|
- !ruby/object:Gem::Dependency
|
105
119
|
name: hoe
|
106
120
|
requirement: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - ~>
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '3.
|
124
|
+
version: '3.8'
|
111
125
|
type: :development
|
112
126
|
prerelease: false
|
113
127
|
version_requirements: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ~>
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
131
|
+
version: '3.8'
|
118
132
|
description: |-
|
119
133
|
ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
|
120
134
|
racc--which does by default use a C extension). RP's output is
|
@@ -161,7 +175,7 @@ files:
|
|
161
175
|
- Rakefile
|
162
176
|
- bin/ruby_parse
|
163
177
|
- bin/ruby_parse_extract_error
|
164
|
-
- lib
|
178
|
+
- lib/.document
|
165
179
|
- lib/ruby18_parser.rb
|
166
180
|
- lib/ruby18_parser.y
|
167
181
|
- lib/ruby19_parser.rb
|
@@ -169,6 +183,8 @@ files:
|
|
169
183
|
- lib/ruby20_parser.rb
|
170
184
|
- lib/ruby20_parser.y
|
171
185
|
- lib/ruby_lexer.rb
|
186
|
+
- lib/ruby_lexer.rex
|
187
|
+
- lib/ruby_lexer.rex.rb
|
172
188
|
- lib/ruby_parser.rb
|
173
189
|
- lib/ruby_parser_extras.rb
|
174
190
|
- test/test_ruby_lexer.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/gauntlet_rubyparser.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -ws
|
2
|
-
|
3
|
-
$f ||= false
|
4
|
-
|
5
|
-
$:.unshift "../../ruby_parser/dev/lib"
|
6
|
-
$:.unshift "../../ruby2ruby/dev/lib"
|
7
|
-
|
8
|
-
require 'rubygems'
|
9
|
-
require 'ruby2ruby'
|
10
|
-
require 'ruby_parser'
|
11
|
-
|
12
|
-
require 'gauntlet'
|
13
|
-
|
14
|
-
class RubyParserGauntlet < Gauntlet
|
15
|
-
def initialize
|
16
|
-
super
|
17
|
-
|
18
|
-
self.data = Hash.new { |h,k| h[k] = {} }
|
19
|
-
old_data = load_yaml data_file
|
20
|
-
self.data.merge! old_data
|
21
|
-
end
|
22
|
-
|
23
|
-
def should_skip? name
|
24
|
-
if $f then
|
25
|
-
if Hash === data[name] then
|
26
|
-
! data[name].empty?
|
27
|
-
else
|
28
|
-
data[name]
|
29
|
-
end
|
30
|
-
else
|
31
|
-
data[name] == true # yes, == true on purpose
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def diff_pp o1, o2
|
36
|
-
require 'pp'
|
37
|
-
|
38
|
-
Tempfile.new('ruby_parser_a') do |file_a|
|
39
|
-
PP.pp o1, file_a
|
40
|
-
|
41
|
-
Tempfile.new('ruby_parser_b') do |file_b|
|
42
|
-
PP.pp o2, file_b
|
43
|
-
|
44
|
-
`diff -u #{file_a.path} #{file_b.path}`
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def broke name, file, msg
|
50
|
-
warn "bad"
|
51
|
-
self.data[name][file] = msg
|
52
|
-
self.dirty = true
|
53
|
-
end
|
54
|
-
|
55
|
-
def process path, name
|
56
|
-
begin
|
57
|
-
$stderr.print " #{path}: "
|
58
|
-
rp = RubyParser.new
|
59
|
-
r2r = Ruby2Ruby.new
|
60
|
-
|
61
|
-
old_ruby = File.read(path)
|
62
|
-
|
63
|
-
begin
|
64
|
-
old_sexp = rp.process old_ruby
|
65
|
-
rescue Racc::ParseError => e
|
66
|
-
self.data[name][path] = :unparsable
|
67
|
-
self.dirty = true
|
68
|
-
return
|
69
|
-
end
|
70
|
-
|
71
|
-
new_ruby = r2r.process old_sexp.deep_clone
|
72
|
-
|
73
|
-
begin
|
74
|
-
new_sexp = rp.process new_ruby
|
75
|
-
rescue Racc::ParseError => e
|
76
|
-
broke name, path, "couldn't parse new_ruby: #{e.message.strip}"
|
77
|
-
return
|
78
|
-
end
|
79
|
-
|
80
|
-
if old_sexp != new_sexp then
|
81
|
-
broke name, path, diff_pp(old_sexp, new_sexp)
|
82
|
-
return
|
83
|
-
end
|
84
|
-
|
85
|
-
self.data[name][path] = true
|
86
|
-
self.dirty = true
|
87
|
-
|
88
|
-
warn "good"
|
89
|
-
rescue Interrupt
|
90
|
-
puts "User cancelled"
|
91
|
-
exit 1
|
92
|
-
rescue Exception => e
|
93
|
-
broke name, path, " UNKNOWN ERROR: #{e}: #{e.message.strip}"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def run name
|
98
|
-
warn name
|
99
|
-
Dir["**/*.rb"].sort.each do |path|
|
100
|
-
next if path =~ /gemspec.rb/ # HACK
|
101
|
-
next if data[name][path] == true
|
102
|
-
process path, name
|
103
|
-
end
|
104
|
-
|
105
|
-
if self.data[name].values.all? { |v| v == true } then
|
106
|
-
warn " ALL GOOD!"
|
107
|
-
self.data[name] = true
|
108
|
-
self.dirty = true
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
filter = ARGV.shift
|
114
|
-
filter = Regexp.new filter if filter
|
115
|
-
|
116
|
-
gauntlet = RubyParserGauntlet.new
|
117
|
-
gauntlet.run_the_gauntlet filter
|