bitclust-core 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2907 -0
- data/Gemfile +7 -0
- data/README +21 -0
- data/Rakefile +20 -0
- data/bin/bitclust +14 -0
- data/bin/refe +36 -0
- data/bitclust-dev.gemspec +33 -0
- data/bitclust.gemspec +30 -0
- data/config.in +23 -0
- data/config.ru +48 -0
- data/config.ru.sample +31 -0
- data/data/bitclust/catalog/ja_JP.EUC-JP +78 -0
- data/data/bitclust/catalog/ja_JP.UTF-8 +78 -0
- data/data/bitclust/template.lillia/class +98 -0
- data/data/bitclust/template.lillia/class-index +28 -0
- data/data/bitclust/template.lillia/doc +48 -0
- data/data/bitclust/template.lillia/layout +19 -0
- data/data/bitclust/template.lillia/library +129 -0
- data/data/bitclust/template.lillia/library-index +32 -0
- data/data/bitclust/template.lillia/method +20 -0
- data/data/bitclust/template.lillia/rd_file +6 -0
- data/data/bitclust/template.offline/class +67 -0
- data/data/bitclust/template.offline/class-index +28 -0
- data/data/bitclust/template.offline/doc +13 -0
- data/data/bitclust/template.offline/function +22 -0
- data/data/bitclust/template.offline/function-index +24 -0
- data/data/bitclust/template.offline/layout +18 -0
- data/data/bitclust/template.offline/library +87 -0
- data/data/bitclust/template.offline/library-index +32 -0
- data/data/bitclust/template.offline/method +21 -0
- data/data/bitclust/template.offline/rd_file +6 -0
- data/data/bitclust/template/class +133 -0
- data/data/bitclust/template/class-index +30 -0
- data/data/bitclust/template/doc +14 -0
- data/data/bitclust/template/function +21 -0
- data/data/bitclust/template/function-index +25 -0
- data/data/bitclust/template/layout +19 -0
- data/data/bitclust/template/library +89 -0
- data/data/bitclust/template/library-index +35 -0
- data/data/bitclust/template/method +24 -0
- data/data/bitclust/template/opensearchdescription +10 -0
- data/data/bitclust/template/search +57 -0
- data/lib/bitclust.rb +9 -0
- data/lib/bitclust/app.rb +129 -0
- data/lib/bitclust/classentry.rb +425 -0
- data/lib/bitclust/compat.rb +39 -0
- data/lib/bitclust/completion.rb +531 -0
- data/lib/bitclust/crossrubyutils.rb +91 -0
- data/lib/bitclust/database.rb +181 -0
- data/lib/bitclust/docentry.rb +83 -0
- data/lib/bitclust/entry.rb +223 -0
- data/lib/bitclust/exception.rb +38 -0
- data/lib/bitclust/functiondatabase.rb +115 -0
- data/lib/bitclust/functionentry.rb +81 -0
- data/lib/bitclust/functionreferenceparser.rb +76 -0
- data/lib/bitclust/htmlutils.rb +80 -0
- data/lib/bitclust/interface.rb +87 -0
- data/lib/bitclust/libraryentry.rb +211 -0
- data/lib/bitclust/lineinput.rb +165 -0
- data/lib/bitclust/messagecatalog.rb +95 -0
- data/lib/bitclust/methoddatabase.rb +401 -0
- data/lib/bitclust/methodentry.rb +202 -0
- data/lib/bitclust/methodid.rb +209 -0
- data/lib/bitclust/methodsignature.rb +82 -0
- data/lib/bitclust/nameutils.rb +236 -0
- data/lib/bitclust/parseutils.rb +60 -0
- data/lib/bitclust/preprocessor.rb +273 -0
- data/lib/bitclust/rdcompiler.rb +507 -0
- data/lib/bitclust/refsdatabase.rb +66 -0
- data/lib/bitclust/requesthandler.rb +330 -0
- data/lib/bitclust/ridatabase.rb +349 -0
- data/lib/bitclust/rrdparser.rb +522 -0
- data/lib/bitclust/runner.rb +143 -0
- data/lib/bitclust/screen.rb +554 -0
- data/lib/bitclust/searcher.rb +518 -0
- data/lib/bitclust/server.rb +59 -0
- data/lib/bitclust/simplesearcher.rb +84 -0
- data/lib/bitclust/subcommand.rb +746 -0
- data/lib/bitclust/textutils.rb +51 -0
- data/lib/bitclust/version.rb +3 -0
- data/packer.rb +224 -0
- data/refe2.gemspec +29 -0
- data/server.exe +0 -0
- data/server.exy +159 -0
- data/server.rb +10 -0
- data/setup.rb +1596 -0
- data/standalone.rb +193 -0
- data/test/run_test.rb +15 -0
- data/test/test_bitclust.rb +81 -0
- data/test/test_entry.rb +39 -0
- data/test/test_functiondatabase.rb +55 -0
- data/test/test_libraryentry.rb +31 -0
- data/test/test_methoddatabase.rb +81 -0
- data/test/test_methodsignature.rb +14 -0
- data/test/test_nameutils.rb +324 -0
- data/test/test_preprocessor.rb +84 -0
- data/test/test_rdcompiler.rb +534 -0
- data/test/test_refsdatabase.rb +76 -0
- data/test/test_rrdparser.rb +26 -0
- data/test/test_runner.rb +102 -0
- data/test/test_simplesearcher.rb +48 -0
- data/theme/default/images/external.png +0 -0
- data/theme/default/rurema.png +0 -0
- data/theme/default/style.css +288 -0
- data/theme/default/test.css +254 -0
- data/theme/lillia/rurema.png +0 -0
- data/theme/lillia/style.css +331 -0
- data/theme/lillia/test.css +254 -0
- data/tools/bc-ancestors.rb +153 -0
- data/tools/bc-checkparams.rb +246 -0
- data/tools/bc-classes.rb +80 -0
- data/tools/bc-convert.rb +165 -0
- data/tools/bc-list.rb +63 -0
- data/tools/bc-methods.rb +171 -0
- data/tools/bc-preproc.rb +42 -0
- data/tools/bc-rdoc.rb +343 -0
- data/tools/bc-tochm.rb +301 -0
- data/tools/bc-tohtml.rb +125 -0
- data/tools/bc-tohtmlpackage.rb +241 -0
- data/tools/check-signature.rb +19 -0
- data/tools/forall-ruby.rb +20 -0
- data/tools/gencatalog.rb +69 -0
- data/tools/statrefm.rb +98 -0
- data/tools/stattodo.rb +150 -0
- data/tools/update-database.rb +146 -0
- data/view.cgi +6 -0
- metadata +222 -0
@@ -0,0 +1,254 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
/*
|
4
|
+
default.css
|
5
|
+
*/
|
6
|
+
|
7
|
+
body {
|
8
|
+
margin-top: 20px;
|
9
|
+
margin-left: 2%;
|
10
|
+
margin-right: 2%;
|
11
|
+
line-height: 1.3;
|
12
|
+
text-align: left;
|
13
|
+
color: black;
|
14
|
+
font-family: osaka,'MS PGothic',sans-serif;
|
15
|
+
background-color: white;
|
16
|
+
}
|
17
|
+
|
18
|
+
/*
|
19
|
+
span.menuitem {
|
20
|
+
width: 3.9em;
|
21
|
+
text-align: center;
|
22
|
+
padding: 0px 2px;
|
23
|
+
margin: 0px;
|
24
|
+
color: white;
|
25
|
+
background-color: #ddd;
|
26
|
+
margin-right: 2px;
|
27
|
+
}
|
28
|
+
div.menu a:link,
|
29
|
+
div.menu a:visited {
|
30
|
+
width: 3.9em;
|
31
|
+
padding: 0px 2px;
|
32
|
+
margin: 0px;
|
33
|
+
color: #33a;
|
34
|
+
background-color: #ddd;
|
35
|
+
text-decoration: none;
|
36
|
+
}
|
37
|
+
div.menu a:active,
|
38
|
+
div.menu a:focus,
|
39
|
+
div.menu a:hover {
|
40
|
+
width: 3.9em;
|
41
|
+
padding: 0px 2px;
|
42
|
+
margin: 0px;
|
43
|
+
color: #fff;
|
44
|
+
background-color: #33a;
|
45
|
+
text-decoration: none;
|
46
|
+
}
|
47
|
+
span.menuseparator {
|
48
|
+
width: 1em;
|
49
|
+
padding: 0px;
|
50
|
+
margin: 0px;
|
51
|
+
}
|
52
|
+
*/
|
53
|
+
|
54
|
+
address {
|
55
|
+
text-align: right;
|
56
|
+
font-size: x-small;
|
57
|
+
}
|
58
|
+
|
59
|
+
h1 {
|
60
|
+
font-size: 200%;
|
61
|
+
text-align: left;
|
62
|
+
color: white;
|
63
|
+
background-color: #33a;
|
64
|
+
padding: 0.4em;
|
65
|
+
margin: 0.2em 0em 0.5em 0em;
|
66
|
+
}
|
67
|
+
|
68
|
+
img.sitelogo {
|
69
|
+
vertical-align: middle;
|
70
|
+
}
|
71
|
+
|
72
|
+
h2 {
|
73
|
+
font-size: 150%;
|
74
|
+
text-align: left;
|
75
|
+
border-left: 10px solid #33a;
|
76
|
+
padding-left: 0.5em;
|
77
|
+
margin-top: 1.5em;
|
78
|
+
margin-bottom: 0.5em;
|
79
|
+
}
|
80
|
+
|
81
|
+
h3 {
|
82
|
+
font-size: 150%;
|
83
|
+
text-align: left;
|
84
|
+
margin-top: 0.5em;
|
85
|
+
margin-bottom: 0.5em;
|
86
|
+
}
|
87
|
+
|
88
|
+
/* tmp */
|
89
|
+
h4 {
|
90
|
+
font-size: 150%;
|
91
|
+
text-align: left;
|
92
|
+
margin-top: 0.5em;
|
93
|
+
margin-bottom: 0.5em;
|
94
|
+
}
|
95
|
+
|
96
|
+
/* never use */
|
97
|
+
h5, h6 {
|
98
|
+
background-color: red;
|
99
|
+
}
|
100
|
+
|
101
|
+
p {
|
102
|
+
line-height: 1.4;
|
103
|
+
margin-top: 0.5em;
|
104
|
+
margin-bottom: 0.5em;
|
105
|
+
margin-left: 0px;
|
106
|
+
}
|
107
|
+
|
108
|
+
span.kindinfo {
|
109
|
+
text-align: right;
|
110
|
+
margin-left: 8em;
|
111
|
+
}
|
112
|
+
|
113
|
+
span.compileerror {
|
114
|
+
color: red;
|
115
|
+
font-weight: bold;
|
116
|
+
}
|
117
|
+
|
118
|
+
pre {
|
119
|
+
line-height: 1.1;
|
120
|
+
background-color: #eee;
|
121
|
+
padding: 10px;
|
122
|
+
font-weight: normal;
|
123
|
+
}
|
124
|
+
|
125
|
+
blockquote {
|
126
|
+
background-color: transparent;
|
127
|
+
padding: 4px;
|
128
|
+
margin-left: 3em;
|
129
|
+
font-weight: normal;
|
130
|
+
}
|
131
|
+
|
132
|
+
ul {
|
133
|
+
margin-left: 0px;
|
134
|
+
padding-left: 2em;
|
135
|
+
}
|
136
|
+
|
137
|
+
li {
|
138
|
+
margin-left: 0px;
|
139
|
+
padding-left: 0px;
|
140
|
+
}
|
141
|
+
|
142
|
+
dl {
|
143
|
+
margin-left: 0em;
|
144
|
+
}
|
145
|
+
|
146
|
+
dt {
|
147
|
+
font-weight: bold;
|
148
|
+
}
|
149
|
+
|
150
|
+
dl.methodlist dt {
|
151
|
+
font-family: sans-serif;
|
152
|
+
}
|
153
|
+
|
154
|
+
dd {
|
155
|
+
margin: 0.3em 0em 1em 4em;
|
156
|
+
}
|
157
|
+
|
158
|
+
table {
|
159
|
+
border-collapse: collapse;
|
160
|
+
}
|
161
|
+
|
162
|
+
th {
|
163
|
+
align: left;
|
164
|
+
valign: top;
|
165
|
+
text-align: left;
|
166
|
+
vertical-align: top;
|
167
|
+
}
|
168
|
+
|
169
|
+
td {
|
170
|
+
align: left;
|
171
|
+
valign: top;
|
172
|
+
text-align: left;
|
173
|
+
vertical-align: top;
|
174
|
+
}
|
175
|
+
|
176
|
+
table.entries tr {
|
177
|
+
/* border: 1px solid gray; */
|
178
|
+
align: left;
|
179
|
+
valign: top;
|
180
|
+
text-align: left;
|
181
|
+
vertical-align: top;
|
182
|
+
}
|
183
|
+
|
184
|
+
td.signature {
|
185
|
+
padding: 0.5em;
|
186
|
+
background-color: #DDD;
|
187
|
+
border: 3px solid white;
|
188
|
+
width: 20em;
|
189
|
+
}
|
190
|
+
|
191
|
+
td.description {
|
192
|
+
padding: 0.5em;
|
193
|
+
background-color: #EEE;
|
194
|
+
border: 3px solid white;
|
195
|
+
}
|
196
|
+
|
197
|
+
td.library {
|
198
|
+
width: 6em;
|
199
|
+
padding: 0.5em;
|
200
|
+
background-color: #DDD;
|
201
|
+
border: 3px solid white;
|
202
|
+
}
|
203
|
+
|
204
|
+
|
205
|
+
a {
|
206
|
+
font-weight: bold;
|
207
|
+
text-decoration: none;
|
208
|
+
}
|
209
|
+
a:link {
|
210
|
+
color: #33a;
|
211
|
+
background-color: transparent;
|
212
|
+
}
|
213
|
+
a:visited {
|
214
|
+
/* color: #666666; */
|
215
|
+
color: #33a;
|
216
|
+
background-color: transparent;
|
217
|
+
}
|
218
|
+
a:hover, a:focus, a:active {
|
219
|
+
color: #fff;
|
220
|
+
background-color: #33a;
|
221
|
+
}
|
222
|
+
|
223
|
+
form {
|
224
|
+
padding: 0px;
|
225
|
+
margin: 0px;
|
226
|
+
}
|
227
|
+
|
228
|
+
hr {
|
229
|
+
color: #33a;
|
230
|
+
height: 1px;
|
231
|
+
}
|
232
|
+
|
233
|
+
@media print {
|
234
|
+
body {
|
235
|
+
font-family: osaka,'MS Mincho',serif;
|
236
|
+
line-height: 1.5;
|
237
|
+
}
|
238
|
+
div.menu {
|
239
|
+
display: none;
|
240
|
+
}
|
241
|
+
div.footer {
|
242
|
+
display: none;
|
243
|
+
}
|
244
|
+
h1 {
|
245
|
+
color: black;
|
246
|
+
background-color: white;
|
247
|
+
border-bottom: 2px solid #33a;
|
248
|
+
padding-bottom: 0em;
|
249
|
+
}
|
250
|
+
a, a:link, a:visited {
|
251
|
+
color: #33a;
|
252
|
+
font-weight: normal;
|
253
|
+
}
|
254
|
+
}
|
@@ -0,0 +1,153 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
bindir = Pathname.new(__FILE__).realpath.dirname
|
6
|
+
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
7
|
+
|
8
|
+
require 'bitclust'
|
9
|
+
require 'bitclust/crossrubyutils'
|
10
|
+
require 'optparse'
|
11
|
+
require 'set'
|
12
|
+
|
13
|
+
include BitClust::CrossRubyUtils
|
14
|
+
|
15
|
+
def main
|
16
|
+
prefix = nil
|
17
|
+
requires = []
|
18
|
+
ver = RUBY_VERSION
|
19
|
+
@verbose = false
|
20
|
+
all = false
|
21
|
+
parser = OptionParser.new
|
22
|
+
parser.banner =<<BANNER
|
23
|
+
Usage: #{File.basename($0, '.*')} [-r<lib>] [--ruby=<VER>] --db=PATH <classname>
|
24
|
+
#{File.basename($0, '.*')} [-r<lib>] [--ruby=<VER>] --db=PATH --all
|
25
|
+
NG Sample:
|
26
|
+
$ #{File.basename($0, '.*')} -rfoo --ruby=1.9.1 --db=./db Foo
|
27
|
+
NG : Foo
|
28
|
+
+ FooModule (The Ruby have this class/module in ancestors of the class)
|
29
|
+
- BarModule (The Database have this class/module in ancestors of the class)
|
30
|
+
Options:
|
31
|
+
BANNER
|
32
|
+
parser.on('-d', '--database=PATH', 'Database prefix.') {|path|
|
33
|
+
prefix = path
|
34
|
+
}
|
35
|
+
parser.on('-r LIB', 'Requires library LIB') {|lib|
|
36
|
+
requires.push lib
|
37
|
+
}
|
38
|
+
parser.on('--ruby=[VER]', "The version of Ruby interpreter"){|ver|
|
39
|
+
ver = ver
|
40
|
+
}
|
41
|
+
parser.on('-v', '--verbose', 'Show differences'){
|
42
|
+
@verbose = true
|
43
|
+
}
|
44
|
+
parser.on('--all', 'Check anccestors for all classes'){
|
45
|
+
all = true
|
46
|
+
}
|
47
|
+
parser.on('--help', 'Prints this message and quit.') {
|
48
|
+
puts parser.help
|
49
|
+
exit 0
|
50
|
+
}
|
51
|
+
begin
|
52
|
+
parser.parse!
|
53
|
+
rescue OptionParser::ParseError => err
|
54
|
+
$stderr.puts err.message
|
55
|
+
$stderr.puts parser.help
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
unless ARGV.size == 1 || all
|
59
|
+
$stderr.puts "wrong number of arguments"
|
60
|
+
$stderr.puts parser.help
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
classname = ARGV[0]
|
64
|
+
db = BitClust::MethodDatabase.new(prefix)
|
65
|
+
ruby = get_ruby(ver)
|
66
|
+
if classname && !all
|
67
|
+
check_ancestors(db, ruby, requires, classname)
|
68
|
+
else
|
69
|
+
$stderr.puts 'check all...'
|
70
|
+
check_all_ancestors(db, ruby, requires)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def ancestors(ruby, requires, classname)
|
75
|
+
req = requires.map{|lib|
|
76
|
+
unless '_builtin' == lib
|
77
|
+
"-r#{lib}"
|
78
|
+
else
|
79
|
+
''
|
80
|
+
end
|
81
|
+
}.join(" ")
|
82
|
+
script =<<-SRC
|
83
|
+
c = #{classname}
|
84
|
+
puts c.ancestors.join("\n")
|
85
|
+
SRC
|
86
|
+
`#{ruby} #{req} -e '#{script}'`.split
|
87
|
+
end
|
88
|
+
|
89
|
+
def check_ancestors(db, ruby, requires, classname)
|
90
|
+
a = ancestors(ruby, requires, classname)
|
91
|
+
begin
|
92
|
+
b = db.fetch_class(classname).ancestors.map(&:name)
|
93
|
+
rescue BitClust::ClassNotFound => ex
|
94
|
+
$stderr.puts "class not found in database : #{classname}"
|
95
|
+
b = []
|
96
|
+
end
|
97
|
+
unless a.to_set == b.to_set
|
98
|
+
puts "NG : #{classname}"
|
99
|
+
puts (a-b).map{|c| "+ #{c}" }.join("\n")
|
100
|
+
puts (b-a).map{|c| "- #{c}" }.join("\n")
|
101
|
+
else
|
102
|
+
puts "OK : #{classname}" if @verbose
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def check_all_ancestors(db, ruby, requires)
|
107
|
+
classnames = []
|
108
|
+
requires.each do |lib|
|
109
|
+
classnames.push(*defined_classes(ruby, lib, []))
|
110
|
+
end
|
111
|
+
classnames.each do |classname|
|
112
|
+
check_ancestors(db, ruby, requires, classname)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def defined_classes(ruby, lib, rejects)
|
117
|
+
output = `#{ruby} -e '
|
118
|
+
def class_extent
|
119
|
+
result = []
|
120
|
+
ObjectSpace.each_object(Module) do |c|
|
121
|
+
result.push c
|
122
|
+
end
|
123
|
+
result
|
124
|
+
end
|
125
|
+
|
126
|
+
%w(#{rejects.join(" ")}).each do |lib|
|
127
|
+
begin
|
128
|
+
require lib
|
129
|
+
rescue LoadError
|
130
|
+
end
|
131
|
+
end
|
132
|
+
if "#{lib}" == "_builtin"
|
133
|
+
class_extent().each do |c|
|
134
|
+
puts c
|
135
|
+
end
|
136
|
+
else
|
137
|
+
before = class_extent()
|
138
|
+
begin
|
139
|
+
require "#{lib}"
|
140
|
+
rescue LoadError
|
141
|
+
$stderr.puts "\#{RUBY_VERSION} (\#{RUBY_RELEASE_DATE}): library not exist: #{lib}"
|
142
|
+
exit
|
143
|
+
end
|
144
|
+
after = class_extent()
|
145
|
+
(after - before).each do |c|
|
146
|
+
puts c
|
147
|
+
end
|
148
|
+
end
|
149
|
+
'`
|
150
|
+
output.split
|
151
|
+
end
|
152
|
+
|
153
|
+
main
|
@@ -0,0 +1,246 @@
|
|
1
|
+
#! /usr/bin/ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'pathname'
|
5
|
+
|
6
|
+
bindir = Pathname.new(__FILE__).realpath.dirname
|
7
|
+
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
8
|
+
|
9
|
+
require 'bitclust/preprocessor'
|
10
|
+
require 'bitclust/lineinput'
|
11
|
+
require 'bitclust/parseutils'
|
12
|
+
require 'bitclust/methodsignature'
|
13
|
+
|
14
|
+
def main
|
15
|
+
option = OptionParser.new
|
16
|
+
version = '1.9.1'
|
17
|
+
option.banner = "Usage: #{File.basename($0, '.*')} <filename>"
|
18
|
+
option.on('--ruby=[VER]', "The version of Ruby interpreter"){|ver|
|
19
|
+
version = ver
|
20
|
+
}
|
21
|
+
option.on('--help', 'Prints this message and quit.') {
|
22
|
+
puts option.help
|
23
|
+
exit 0
|
24
|
+
}
|
25
|
+
begin
|
26
|
+
option.parse!(ARGV)
|
27
|
+
rescue OptionParser::ParseError => ex
|
28
|
+
$stderr.puts err.message
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
unless ARGV.size == 1
|
32
|
+
$stderr.puts "wrong number of arguments"
|
33
|
+
$stderr.puts option.help
|
34
|
+
exit 1
|
35
|
+
end
|
36
|
+
filename = ARGV[0]
|
37
|
+
path = Pathname.new(filename)
|
38
|
+
|
39
|
+
params = { "version" => version }
|
40
|
+
parser = BitClust::RDParser.new(BitClust::Preprocessor.read(path, params))
|
41
|
+
parser.parse
|
42
|
+
end
|
43
|
+
|
44
|
+
module BitClust
|
45
|
+
class RDParser
|
46
|
+
def initialize(src)
|
47
|
+
@f = LineInput.new(StringIO.new(src))
|
48
|
+
@option = { :force => true }
|
49
|
+
end
|
50
|
+
|
51
|
+
def parse
|
52
|
+
while @f.next?
|
53
|
+
case @f.peek
|
54
|
+
when /\A---/
|
55
|
+
method_entry_chunk
|
56
|
+
else
|
57
|
+
@f.gets
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def method_entry_chunk
|
63
|
+
@f.while_match(/\A---/) do |line|
|
64
|
+
method_signature line
|
65
|
+
end
|
66
|
+
props = {}
|
67
|
+
@f.while_match(/\A:/) do |line|
|
68
|
+
k, v = line.sub(/\A:/, '').split(':', 2)
|
69
|
+
props[k.strip] = v.strip
|
70
|
+
end
|
71
|
+
while @f.next?
|
72
|
+
case @f.peek
|
73
|
+
when /\A===+/
|
74
|
+
@f.gets
|
75
|
+
when /\A==?/
|
76
|
+
if @option[:force]
|
77
|
+
break
|
78
|
+
else
|
79
|
+
raise "method entry includes headline: #{@f.peek.inspect}"
|
80
|
+
end
|
81
|
+
when /\A---/
|
82
|
+
break
|
83
|
+
when /\A\s+\*\s/
|
84
|
+
ulist
|
85
|
+
when /\A\s+\(\d+\)\s/
|
86
|
+
olist
|
87
|
+
when /\A:\s/
|
88
|
+
dlist
|
89
|
+
when %r<\A//emlist\{>
|
90
|
+
emlist
|
91
|
+
when /\A\s+\S/
|
92
|
+
list
|
93
|
+
when /@see/
|
94
|
+
see
|
95
|
+
when /\A@[a-z]/
|
96
|
+
method_info
|
97
|
+
else
|
98
|
+
if @f.peek.strip.empty?
|
99
|
+
@f.gets
|
100
|
+
else
|
101
|
+
method_entry_paragraph
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def headline(line)
|
108
|
+
# nop
|
109
|
+
end
|
110
|
+
|
111
|
+
def ulist
|
112
|
+
@f.while_match(/\A\s+\*\s/) do |line|
|
113
|
+
@f.while_match(/\A\s+[^\*\s]/) do |cont|
|
114
|
+
# nop
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def olist
|
120
|
+
@f.while_match(/\A\s+\(\d+\)/) do |line|
|
121
|
+
@f.while_match(/\A\s+(?!\(\d+\))\S/) do |cont|
|
122
|
+
# nop
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def dlist
|
128
|
+
while @f.next? and /\A:/ =~ @f.peek
|
129
|
+
@f.while_match(/\A:/) do |line|
|
130
|
+
# nop
|
131
|
+
end
|
132
|
+
dd_with_p
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# empty lines separate paragraphs.
|
137
|
+
def dd_with_p
|
138
|
+
while /\A(?:\s|\z)/ =~ @f.peek or %r!\A//emlist\{! =~ @f.peek
|
139
|
+
case @f.peek
|
140
|
+
when /\A$/
|
141
|
+
@f.gets
|
142
|
+
when /\A[ \t\z]/
|
143
|
+
@f.while_match(/\A[ \t\z]/) do |line|
|
144
|
+
# nop
|
145
|
+
end
|
146
|
+
when %r!\A//emlist\{!
|
147
|
+
emlist
|
148
|
+
else
|
149
|
+
raise 'must not happen'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# empty lines do not separate paragraphs.
|
155
|
+
def dd_without_p
|
156
|
+
while /\A[ \t]/ =~ @f.peek or %r!\A//emlist\{! =~ @f.peek
|
157
|
+
case @f.peek
|
158
|
+
when /\A[ \t\z]/
|
159
|
+
@f.while_match(/\A[ \t\z]/) do |line|
|
160
|
+
# nop
|
161
|
+
end
|
162
|
+
when %r!\A//emlist\{!
|
163
|
+
emlist
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def emlist
|
169
|
+
@f.gets # discard "//emlist{"
|
170
|
+
@f.until_terminator(%r<\A//\}>) do |line|
|
171
|
+
# nop
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def list
|
176
|
+
@f.break(/\A\S/)
|
177
|
+
end
|
178
|
+
|
179
|
+
def see
|
180
|
+
@f.gets
|
181
|
+
@f.span(/\A\s+\S/)
|
182
|
+
end
|
183
|
+
|
184
|
+
def paragraph
|
185
|
+
read_paragraph(@f).each do |line|
|
186
|
+
# nop
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def read_paragraph(f)
|
191
|
+
f.span(%r<\A(?!---|=|//emlist\{)\S>)
|
192
|
+
end
|
193
|
+
|
194
|
+
def method_info
|
195
|
+
params = []
|
196
|
+
while @f.next? and /\A\@(?!see)\w+|\A$/ =~ @f.peek
|
197
|
+
header = @f.gets
|
198
|
+
next if /\A$/ =~ header
|
199
|
+
cmd = header.slice!(/\A\@\w+/)
|
200
|
+
@f.ungets(header)
|
201
|
+
case cmd
|
202
|
+
when '@param', '@arg'
|
203
|
+
name = header.slice!(/\A\s*\w+/n) || '?'
|
204
|
+
params << name
|
205
|
+
when '@raise'
|
206
|
+
# nop
|
207
|
+
when '@return'
|
208
|
+
# nop
|
209
|
+
else
|
210
|
+
$stderr.puts "[UNKNOWN_META_INFO] #{cmd}"
|
211
|
+
end
|
212
|
+
dd_without_p
|
213
|
+
end
|
214
|
+
# check parameters
|
215
|
+
params.map(&:strip).each{|param|
|
216
|
+
unless @sig.params.split(',').map(&:strip).any?{|v|
|
217
|
+
param == v.tr('*', '').gsub(/\s*=\s*.+/, '')
|
218
|
+
}
|
219
|
+
$stderr.puts "#{@f.lineno}: #{@sig.friendly_string}"
|
220
|
+
$stderr.puts params.inspect
|
221
|
+
$stderr.puts @sig.params.inspect
|
222
|
+
end
|
223
|
+
}
|
224
|
+
rescue
|
225
|
+
$stderr.puts "#{@f.lineno}: #{@sig.friendly_string}"
|
226
|
+
$stderr.puts params.inspect
|
227
|
+
$stderr.puts @sig.params.inspect
|
228
|
+
end
|
229
|
+
|
230
|
+
def method_entry_paragraph
|
231
|
+
read_method_entry_paragraph(@f).each do |line|
|
232
|
+
# nop
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def read_method_entry_paragraph(f)
|
237
|
+
f.span(%r<\A(?!---|=|//emlist\{|@[a-z])\S>)
|
238
|
+
end
|
239
|
+
|
240
|
+
def method_signature(sig_line)
|
241
|
+
@sig = MethodSignature.parse(sig_line)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
main
|