bitclust-core 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f79dad5d50c6ae45ebf5e028d9b26e73562a71163fc22e4e2bfb218ea790e6a
4
- data.tar.gz: d4f215f77dc34e08d46b26ed93c2ddca3d5f90e22ecd28a20c324ff5067fb1f9
3
+ metadata.gz: 0b2eea15e85eb324e528b0528b01f84eae456154be836941cc43375028336fc7
4
+ data.tar.gz: 2cda706afc4b6bc09d4ca21e51eb9167068554b00193c23ba07f8e8ab9c31b98
5
5
  SHA512:
6
- metadata.gz: d819f311b99228af293af81eff952c0f6b05c4320ec2ed42d0046f4d4b6ce61b6e42f7d699893ef8aa39001533bc1664b8371347cfb2bc327302dc249e3244e4
7
- data.tar.gz: d7d5e8d7d6e7a307b809c637c1d5337276e46f8b4a398779b9f7dffd547dcda330cd0d78bca449b55e7488113e5c7770f16249a697d1dcec9b1eeeaf47a1f8cf
6
+ metadata.gz: ed87e3a8a250751dfe518cd40c76b8dc92ee90312810f79e384a78239b7167bbbc80d5da86ca742114f65b977f0338af40a26b8dd62d0890915201c021d1b7ec
7
+ data.tar.gz: 5377b074eb7f16a473998d9869ae04911f703cdd35fc9306a5153092b185d09f57a8e057dfaded3a08e178f869ae4e3c080ac1bf088756f19636ce5e21f09c62
@@ -45,12 +45,11 @@
45
45
  </li>
46
46
  </ol>
47
47
  </nav>
48
+ <% headline_init %>
49
+ <%= headline("#{@entry.type} #{@entry.name}" + @entry.ancestors[1..@alevel].map{|c| " + #{c.name}" }.join) %>
48
50
  </header>
49
51
 
50
- <%
51
- headline_init
52
- %>
53
- <%= headline("#{@entry.type} #{@entry.name}" + @entry.ancestors[1..@alevel].map{|c| " + #{c.name}" }.join) %>
52
+ <main>
54
53
  <%
55
54
  myself, *supers = @entry.ancestors
56
55
  n = 0
@@ -67,7 +66,7 @@
67
66
  <% n += 1 %>
68
67
  <% end %>
69
68
  <li>
70
- <%= escape_html(myself.name) %>
69
+ <%= @entry.object? ? class_link(myself.name) : escape_html(myself.name) %>
71
70
  </li>
72
71
  </ol>
73
72
  </nav>
@@ -128,15 +127,18 @@
128
127
  <% items.each do |label, entries, prefix| next if entries.empty? %>
129
128
  <dt><%= label %></dt>
130
129
  <dd>
130
+ <ul class="class-toc">
131
131
  <%
132
- entries.each do |m|
133
- m.names.each do |mname|
132
+ entries.inject([]){ |ary, m| ary.concat(m.names.map{ |mname| [m.index_id, mname] }) }
133
+ .uniq
134
+ .sort_by{ |_, mname| mname.gsub(/(?=[^\da-zA-Z])/, "\t") }
135
+ .each do |index_id, mname|
134
136
  %>
135
- <a href="#<%= m.index_id %>"><%= "#{prefix}#{mname}" %></a>
137
+ <li><a href="#<%= index_id %>"><%= escape_html "#{prefix}#{mname}" %></a></li>
136
138
  <%
137
- end
138
139
  end
139
140
  %>
141
+ </ul>
140
142
  </dd>
141
143
  <% end %>
142
144
  </dl>
@@ -151,14 +153,18 @@ displayed_methods = Set.new(ents.instance_methods.map(&:name))
151
153
  <dl>
152
154
  <% ancestors.each do |c|
153
155
  methods = c.partitioned_entries(@alevel).instance_methods
154
- .reject { |m| displayed_methods.include?(m.name) }
156
+ .flat_map { |m| m.names.map { |n| [n, m] } }
157
+ .reject { |name,| displayed_methods.include?(name) }
158
+ .sort
155
159
  next if methods.empty? %>
156
160
  <dt><%= _('Ancestor Methods %s', c.name) %></dt>
157
161
  <dd>
158
- <% methods.each do |m| %>
159
- <%= method_link(m.spec_string, m.name) %>
160
- <% displayed_methods << m.name %>
162
+ <ul class="class-toc">
163
+ <% methods.each do |name, m| %>
164
+ <li><%= method_link(m.spec_string, name) %></li>
165
+ <% displayed_methods << name %>
161
166
  <% end %>
167
+ </ul>
162
168
  </dd>
163
169
  <%
164
170
  end
@@ -185,3 +191,4 @@ end %>
185
191
  end
186
192
  headline_pop
187
193
  %>
194
+ </main>
@@ -31,12 +31,11 @@
31
31
  </li>
32
32
  </ol>
33
33
  </nav>
34
+ <% headline_init %>
35
+ <%= headline(_("Class Index")) %>
34
36
  </header>
35
37
 
36
- <%
37
- headline_init
38
- %>
39
- <%= headline(_("Class Index")) %>
38
+ <main>
40
39
  <p>
41
40
  <%= @entries.size %> classes/modules in database
42
41
  </p>
@@ -56,3 +55,4 @@
56
55
  headline_pop
57
56
  %>
58
57
  </ul>
58
+ </main>
@@ -38,9 +38,11 @@
38
38
  <% end %>
39
39
  </ol>
40
40
  </nav>
41
- </header>
42
-
43
41
  <% headline_init %>
44
42
  <%= headline(@entry.title) %>
43
+ </header>
44
+
45
+ <main>
45
46
  <% headline_push %>
46
47
  <%= compile_rd(@entry.source) %>
48
+ </main>
@@ -39,10 +39,11 @@
39
39
  </li>
40
40
  </ol>
41
41
  </nav>
42
- </header>
43
-
44
42
  <% headline_init %>
45
43
  <%= headline("#{entry.type_label} #{entry.label}") %>
44
+ </header>
45
+
46
+ <main>
46
47
  <dl class="functionlist">
47
48
  <dt>
48
49
  <code><%= entry.header %></code>
@@ -51,3 +52,4 @@
51
52
  <%= compile_function(entry) %>
52
53
  </dd>
53
54
  </dl>
55
+ </main>
@@ -31,12 +31,11 @@
31
31
  </li>
32
32
  </ol>
33
33
  </nav>
34
+ <% headline_init %>
35
+ <%= headline(_("Function Index")) %>
34
36
  </header>
35
37
 
36
- <%
37
- headline_init
38
- %>
39
- <%= headline(_("Function Index")) %>
38
+ <main>
40
39
  <table class="entries functions">
41
40
  <%
42
41
  headline_push
@@ -51,3 +50,4 @@
51
50
  headline_pop
52
51
  %>
53
52
  </table>
53
+ </main>
@@ -1,28 +1,29 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="ja-JP">
3
3
  <head>
4
- <%= google_tag_manager %>
5
- <%= meta_robots %>
6
- <meta http-equiv="Content-Type" content="text/html; charset=<%=h charset() %>">
7
- <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <link rel="stylesheet" type="text/css" href="<%=h css_url() %>">
9
- <link rel="stylesheet" type="text/css" href="<%=h custom_css_url("syntax-highlight.css") %>">
10
- <link rel="icon" type="image/png" href="<%=h favicon_url() %>">
11
- <% if @conf[:canonical_base_url] %>
12
- <link rel="canonical" href="<%= canonical_url() %>">
13
- <% end %>
14
- <title><%=h @title %> (Ruby <%=h ruby_version %> リファレンスマニュアル)</title>
15
- <meta name="description" content="<%=h @description %>">
16
- <script src="<%=h custom_js_url('script.js') %>"></script>
4
+ <%= google_tag_manager %>
5
+ <%= meta_robots %>
6
+ <meta charset="<%=h charset() %>">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <link rel="stylesheet" href="<%=h css_url() %>">
9
+ <link rel="stylesheet" href="<%=h custom_css_url("syntax-highlight.css") %>">
10
+ <link rel="icon" type="image/png" href="<%=h favicon_url() %>">
11
+ <% if @conf[:canonical_base_url] %>
12
+ <link rel="canonical" href="<%= canonical_url() %>">
13
+ <% end %>
14
+ <title><%=h @title %> (Ruby <%=h ruby_version %> リファレンスマニュアル)</title>
15
+ <meta name="description" content="<%=h @description %>">
16
+ <script src="<%=h custom_js_url('script.js') %>"></script>
17
17
  </head>
18
18
  <body>
19
19
  <%= yield %>
20
- <div id="footer">
20
+ <footer id="footer">
21
21
  <a rel="license" href="https://creativecommons.org/licenses/by/3.0/">
22
22
  <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/3.0/88x31.png" />
23
23
  </a>
24
24
 
25
25
  フィードバックは<a href="https://github.com/rurema/doctree/issues/new" id="feedback-link">こちら</a>
26
- <script>if (window.URLSearchParams) { document.getElementById("feedback-link").search = new URLSearchParams({'body': document.location}); }</script></div>
26
+ <script>if (window.URLSearchParams) { document.getElementById("feedback-link").search = new URLSearchParams({'body': document.location}); }</script>
27
+ </footer>
27
28
  </body>
28
29
  </html>
@@ -38,13 +38,11 @@
38
38
  </li>
39
39
  </ol>
40
40
  </nav>
41
- </header>
42
-
43
- <%
44
- headline_init
45
- %>
41
+ <% headline_init %>
46
42
  <%= headline(@entry.id == '_builtin' ? _('Builtin Library') : "library #{@entry.name}") %>
43
+ </header>
47
44
 
45
+ <main>
48
46
  <%
49
47
  headline_push
50
48
  all_classes = @entry.all_classes
@@ -99,12 +97,17 @@
99
97
  end
100
98
  %>
101
99
  <%
102
- ents = @entry.methods.sort
100
+ ents = @entry.methods.flat_map do |m|
101
+ c, t, n, = methodid2specparts(m.id)
102
+ prefix = (t == '$' ? '' : c) + t
103
+ m.names.map { |name| [prefix + name, c + t + n] }
104
+ end.sort
103
105
  unless ents.empty? %>
104
106
  <%= headline(_("Added/Redefined Methods")) %>
105
107
  <p><code>
106
- <% ents.each do |m| %>
107
- <%= link_to_method(m, true) %>
108
+ <% ents.each do |label, spec| %>
109
+ <%= method_link(spec, label) %>
108
110
  <% end %>
109
111
  </code></p>
110
112
  <% end %>
113
+ </main>
@@ -31,12 +31,11 @@
31
31
  </li>
32
32
  </ol>
33
33
  </nav>
34
+ <% headline_init %>
35
+ <%= headline(_("Library Index")) %>
34
36
  </header>
35
37
 
36
- <%
37
- headline_init
38
- %>
39
- <%= headline(_("Library Index")) %>
38
+ <main>
40
39
  <%
41
40
  headline_push
42
41
  weight = {"Builtin" => "", "" => "\x7f\x7f"}
@@ -75,3 +74,4 @@
75
74
  end
76
75
  headline_pop
77
76
  %>
77
+ </main>
@@ -53,10 +53,11 @@
53
53
  </li>
54
54
  </ol>
55
55
  </nav>
56
- </header>
57
-
58
56
  <% headline_init %>
59
57
  <%= headline("#{entry.type_label} #{entry.label}") %>
58
+ </header>
59
+
60
+ <main>
60
61
  <dl class="methodlist">
61
62
  <%
62
63
  headline_push
@@ -68,3 +69,4 @@
68
69
  headline_pop
69
70
  %>
70
71
  </dl>
72
+ </main>
@@ -210,8 +210,14 @@ module BitClust
210
210
 
211
211
  def ancestors
212
212
  @ancestors ||=
213
+ if self.object? && superclass()
214
+ myself, *ancestors = superclass().ancestors
215
+ [ myself, included().map {|m| m.ancestors },
216
+ ancestors ].flatten
217
+ else
213
218
  [ self, included().map {|m| m.ancestors },
214
219
  superclass() ? superclass().ancestors : [] ].flatten
220
+ end
215
221
  end
216
222
 
217
223
  def included_modules
@@ -19,8 +19,8 @@ module BitClust
19
19
  LIBNAME_RE = %r<[\w\-]+(/[\w\-]+)*>
20
20
  CONST_RE = /[A-Z]\w*/
21
21
  CONST_PATH_RE = /#{CONST_RE}(?:::#{CONST_RE})*/
22
- CLASS_NAME_RE = /(?:#{CONST_RE}(?:::compatible)?|fatal|ARGF.class|main)/
23
- CLASS_PATH_RE = /(?:#{CONST_PATH_RE}(?:::compatible)?|fatal|ARGF.class|main)/
22
+ CLASS_NAME_RE = /(?:#{CONST_RE}(?:::compatible)?|fatal|ARGF\.class|main)/
23
+ CLASS_PATH_RE = /(?:#{CONST_PATH_RE}(?:::compatible)?|fatal|ARGF\.class|main)/
24
24
  METHOD_NAME_RE = /\w+[?!=]?|===|==|=~|<=>|<=|>=|!=|!~|!@|!|\[\]=|\[\]|\*\*|>>|<<|\+@|\-@|[~+\-*\/%&|^<>`]/
25
25
  TYPEMARK_RE = /(?:\.|\#|\.\#|::|\$)/
26
26
  METHOD_SPEC_RE = /#{CLASS_PATH_RE}#{TYPEMARK_RE}#{METHOD_NAME_RE}/
@@ -76,6 +76,11 @@ module BitClust
76
76
  def next_line(f)
77
77
  while line = f.gets
78
78
  case line
79
+ when /\A(?!\#@)/
80
+ if current_cond.processing?
81
+ @buf.push line
82
+ break
83
+ end
79
84
  when /\A\#@\#/ # preprocessor comment
80
85
  ;
81
86
  when /\A\#@todo/i
@@ -107,13 +112,8 @@ module BitClust
107
112
  parse_error "no matching \#@if", line if cond_toplevel?
108
113
  cond_pop
109
114
  end
110
- when /\A\#@/
111
- parse_error "unknown preprocessor directive", line
112
115
  else
113
- if current_cond.processing?
114
- @buf.push line
115
- break
116
- end
116
+ parse_error "unknown preprocessor directive", line
117
117
  end
118
118
  end
119
119
  if @buf.empty?
@@ -120,11 +120,7 @@ module BitClust
120
120
  @context.define_module name
121
121
  read_class_body f
122
122
  when 'object'
123
- if superclass
124
- # FIXME
125
- tty_warn "#{line.location}: singleton object class not implemented yet"
126
- end
127
- @context.define_object name
123
+ @context.define_object name, superclass
128
124
  read_object_body f
129
125
  when 'reopen'
130
126
  @context.reopen_class name
@@ -366,8 +362,9 @@ module BitClust
366
362
  register_class :module, name, nil
367
363
  end
368
364
 
369
- def define_object(name)
370
- register_class :object, name, nil
365
+ def define_object(name, singleton_object_class)
366
+ singleton_object_class = @db.get_class(singleton_object_class) if singleton_object_class
367
+ register_class :object, name, singleton_object_class
371
368
  end
372
369
 
373
370
  def register_class(type, name, superclass)
@@ -216,6 +216,7 @@ module BitClust
216
216
  when token == "::" && [:class, :module].include?(@stack.last)
217
217
  @name_buffer << token
218
218
  else
219
+ @stack.pop if @stack.last == :method_call
219
220
  on_default(:on_op, token, data)
220
221
  end
221
222
  data
@@ -1,3 +1,3 @@
1
1
  module BitClust
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
@@ -70,4 +70,16 @@ class TestSyntaxHighlighter < Test::Unit::TestCase
70
70
  expected = '<span class="nb">puts</span> <span class="sr">/&lt;a&gt;/</span>'
71
71
  assert_equal(expected, highlight(source))
72
72
  end
73
+
74
+ test 'symbol method' do
75
+ source = <<~END
76
+ p 1.!
77
+ p 2
78
+ END
79
+ expected = <<~END
80
+ <span class="nb">p</span> <span class="mi">1</span><span class="p">.</span><span class="o">!</span>
81
+ <span class="nb">p</span> <span class="mi">2</span>
82
+ END
83
+ assert_equal(expected, highlight(source))
84
+ end
73
85
  end
@@ -18,9 +18,8 @@
18
18
  elem.appendChild(copyText)
19
19
 
20
20
  // COPY button
21
- const btn = document.createElement('div')
21
+ const btn = document.createElement('span')
22
22
  btn.setAttribute('class', 'highlight__copy-button')
23
- // btn.textContent = "COPY"
24
23
  elem.insertBefore(btn, elem.firstChild)
25
24
 
26
25
  btn.onclick = function(){
@@ -114,8 +114,8 @@ span.compileerror {
114
114
  }
115
115
 
116
116
  code, pre, tt {
117
- font-size: 90%;
118
- font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
117
+ font-size: 90%;
118
+ font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
119
119
  }
120
120
 
121
121
  pre {
@@ -350,6 +350,22 @@ hr {
350
350
  padding-right: 0.3rem;
351
351
  }
352
352
 
353
+ .class-toc {
354
+ list-style: none;
355
+ margin: 0.5em 0;
356
+ padding: 0;
357
+ column-gap: 1em;
358
+ column-width: 10em;
359
+ column-rule: 1px dotted #BBB;
360
+ }
361
+
362
+ .class-toc > li {
363
+ padding-left: 1em;
364
+ text-indent: -1em;
365
+ word-break: break-all;
366
+ break-inside: avoid;
367
+ }
368
+
353
369
  @media print {
354
370
  body {
355
371
  font-family: osaka,'MS Mincho',serif;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitclust-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/rurema
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-07 00:00:00.000000000 Z
11
+ date: 2020-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -232,7 +232,12 @@ files:
232
232
  - theme/lillia/test.css
233
233
  homepage: https://docs.ruby-lang.org/ja/
234
234
  licenses: []
235
- metadata: {}
235
+ metadata:
236
+ bug_tracker_uri: https://github.com/rurema/bitclust/issues
237
+ documentation_uri: https://github.com/rurema/doctree/wiki
238
+ homepage_uri: https://docs.ruby-lang.org/ja/
239
+ source_code_uri: https://github.com/rurema/bitclust
240
+ wiki_uri: https://github.com/rurema/doctree/wiki
236
241
  post_install_message:
237
242
  rdoc_options: []
238
243
  require_paths:
@@ -248,24 +253,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
253
  - !ruby/object:Gem::Version
249
254
  version: '0'
250
255
  requirements: []
251
- rubygems_version: 3.0.3
256
+ rubygems_version: 3.1.2
252
257
  signing_key:
253
258
  specification_version: 4
254
259
  summary: BitClust is a rurema document processor.
255
260
  test_files:
256
- - test/run_test.rb
257
- - test/test_nameutils.rb
258
- - test/test_functiondatabase.rb
259
- - test/test_bitclust.rb
260
- - test/test_simplesearcher.rb
261
261
  - test/test_functionreferenceparser.rb
262
- - test/test_runner.rb
263
262
  - test/test_refsdatabase.rb
264
- - test/test_methodsignature.rb
265
- - test/test_libraryentry.rb
266
263
  - test/test_rrdparser.rb
267
- - test/test_preprocessor.rb
268
- - test/test_entry.rb
264
+ - test/test_syntax_highlighter.rb
269
265
  - test/test_methoddatabase.rb
266
+ - test/test_simplesearcher.rb
267
+ - test/test_nameutils.rb
268
+ - test/run_test.rb
269
+ - test/test_methodsignature.rb
270
270
  - test/test_rdcompiler.rb
271
- - test/test_syntax_highlighter.rb
271
+ - test/test_functiondatabase.rb
272
+ - test/test_runner.rb
273
+ - test/test_bitclust.rb
274
+ - test/test_entry.rb
275
+ - test/test_preprocessor.rb
276
+ - test/test_libraryentry.rb