rdoc 6.1.0 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -0
  3. data/README.rdoc +0 -1
  4. data/Rakefile +12 -4
  5. data/lib/rdoc.rb +21 -0
  6. data/lib/rdoc/any_method.rb +52 -7
  7. data/lib/rdoc/class_module.rb +1 -1
  8. data/lib/rdoc/comment.rb +12 -1
  9. data/lib/rdoc/context.rb +10 -2
  10. data/lib/rdoc/context/section.rb +0 -13
  11. data/lib/rdoc/cross_reference.rb +4 -4
  12. data/lib/rdoc/erb_partial.rb +1 -1
  13. data/lib/rdoc/erbio.rb +2 -2
  14. data/lib/rdoc/generator/darkfish.rb +9 -9
  15. data/lib/rdoc/generator/pot.rb +3 -3
  16. data/lib/rdoc/generator/template/darkfish/_head.rhtml +9 -7
  17. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +2 -2
  18. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +2 -2
  19. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
  20. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +2 -2
  21. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
  22. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
  23. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +5 -5
  24. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
  25. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +5 -5
  26. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  27. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +4 -4
  28. data/lib/rdoc/generator/template/darkfish/class.rhtml +44 -44
  29. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +35 -6
  30. data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -4
  31. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +22 -99
  32. data/lib/rdoc/generator/template/darkfish/js/search.js +32 -31
  33. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +15 -16
  34. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +16 -16
  35. data/lib/rdoc/generator/template/json_index/js/navigation.js +4 -40
  36. data/lib/rdoc/generator/template/json_index/js/searcher.js +6 -6
  37. data/lib/rdoc/i18n.rb +1 -1
  38. data/lib/rdoc/markdown.kpeg +1 -1
  39. data/lib/rdoc/markdown.rb +16287 -0
  40. data/lib/rdoc/markdown/literals.rb +417 -0
  41. data/lib/rdoc/markup.rb +0 -2
  42. data/lib/rdoc/markup/formatter.rb +1 -1
  43. data/lib/rdoc/markup/parser.rb +58 -42
  44. data/lib/rdoc/markup/pre_process.rb +1 -1
  45. data/lib/rdoc/markup/regexp_handling.rb +41 -0
  46. data/lib/rdoc/markup/to_html.rb +19 -6
  47. data/lib/rdoc/markup/to_html_crossref.rb +18 -6
  48. data/lib/rdoc/options.rb +23 -5
  49. data/lib/rdoc/parser.rb +7 -7
  50. data/lib/rdoc/parser/c.rb +139 -183
  51. data/lib/rdoc/parser/ripper_state_lex.rb +2 -1
  52. data/lib/rdoc/parser/ruby.rb +18 -8
  53. data/lib/rdoc/rd/block_parser.rb +1056 -0
  54. data/lib/rdoc/rd/inline_parser.rb +1208 -0
  55. data/lib/rdoc/rdoc.rb +26 -20
  56. data/lib/rdoc/ri/driver.rb +9 -5
  57. data/lib/rdoc/ri/paths.rb +3 -17
  58. data/lib/rdoc/ri/task.rb +1 -1
  59. data/lib/rdoc/rubygems_hook.rb +2 -2
  60. data/lib/rdoc/servlet.rb +16 -8
  61. data/lib/rdoc/store.rb +6 -14
  62. data/lib/rdoc/task.rb +1 -1
  63. data/lib/rdoc/text.rb +8 -2
  64. data/lib/rdoc/token_stream.rb +8 -3
  65. data/lib/rdoc/tom_doc.rb +6 -7
  66. data/lib/rdoc/version.rb +1 -1
  67. data/man/ri.1 +247 -0
  68. data/rdoc.gemspec +194 -10
  69. metadata +10 -86
  70. data/.document +0 -5
  71. data/.gitignore +0 -14
  72. data/.travis.yml +0 -21
  73. data/appveyor.yml +0 -36
  74. data/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -4
  75. data/lib/rdoc/markup/formatter_test_case.rb +0 -764
  76. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -115
@@ -0,0 +1,417 @@
1
+ # coding: UTF-8
2
+ # frozen_string_literal: true
3
+ # :markup: markdown
4
+
5
+ ##
6
+ #--
7
+ # This set of literals is for Ruby 1.9 regular expressions and gives full
8
+ # unicode support.
9
+ #
10
+ # Unlike peg-markdown, this set of literals recognizes Unicode alphanumeric
11
+ # characters, newlines and spaces.
12
+ class RDoc::Markdown::Literals
13
+ # :stopdoc:
14
+
15
+ # This is distinct from setup_parser so that a standalone parser
16
+ # can redefine #initialize and still have access to the proper
17
+ # parser setup code.
18
+ def initialize(str, debug=false)
19
+ setup_parser(str, debug)
20
+ end
21
+
22
+
23
+
24
+ # Prepares for parsing +str+. If you define a custom initialize you must
25
+ # call this method before #parse
26
+ def setup_parser(str, debug=false)
27
+ set_string str, 0
28
+ @memoizations = Hash.new { |h,k| h[k] = {} }
29
+ @result = nil
30
+ @failed_rule = nil
31
+ @failing_rule_offset = -1
32
+
33
+ setup_foreign_grammar
34
+ end
35
+
36
+ attr_reader :string
37
+ attr_reader :failing_rule_offset
38
+ attr_accessor :result, :pos
39
+
40
+ def current_column(target=pos)
41
+ if c = string.rindex("\n", target-1)
42
+ return target - c - 1
43
+ end
44
+
45
+ target + 1
46
+ end
47
+
48
+ def current_line(target=pos)
49
+ cur_offset = 0
50
+ cur_line = 0
51
+
52
+ string.each_line do |line|
53
+ cur_line += 1
54
+ cur_offset += line.size
55
+ return cur_line if cur_offset >= target
56
+ end
57
+
58
+ -1
59
+ end
60
+
61
+ def lines
62
+ lines = []
63
+ string.each_line { |l| lines << l }
64
+ lines
65
+ end
66
+
67
+
68
+
69
+ def get_text(start)
70
+ @string[start..@pos-1]
71
+ end
72
+
73
+ # Sets the string and current parsing position for the parser.
74
+ def set_string string, pos
75
+ @string = string
76
+ @string_size = string ? string.size : 0
77
+ @pos = pos
78
+ end
79
+
80
+ def show_pos
81
+ width = 10
82
+ if @pos < width
83
+ "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")"
84
+ else
85
+ "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")"
86
+ end
87
+ end
88
+
89
+ def failure_info
90
+ l = current_line @failing_rule_offset
91
+ c = current_column @failing_rule_offset
92
+
93
+ if @failed_rule.kind_of? Symbol
94
+ info = self.class::Rules[@failed_rule]
95
+ "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'"
96
+ else
97
+ "line #{l}, column #{c}: failed rule '#{@failed_rule}'"
98
+ end
99
+ end
100
+
101
+ def failure_caret
102
+ l = current_line @failing_rule_offset
103
+ c = current_column @failing_rule_offset
104
+
105
+ line = lines[l-1]
106
+ "#{line}\n#{' ' * (c - 1)}^"
107
+ end
108
+
109
+ def failure_character
110
+ l = current_line @failing_rule_offset
111
+ c = current_column @failing_rule_offset
112
+ lines[l-1][c-1, 1]
113
+ end
114
+
115
+ def failure_oneline
116
+ l = current_line @failing_rule_offset
117
+ c = current_column @failing_rule_offset
118
+
119
+ char = lines[l-1][c-1, 1]
120
+
121
+ if @failed_rule.kind_of? Symbol
122
+ info = self.class::Rules[@failed_rule]
123
+ "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'"
124
+ else
125
+ "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'"
126
+ end
127
+ end
128
+
129
+ class ParseError < RuntimeError
130
+ end
131
+
132
+ def raise_error
133
+ raise ParseError, failure_oneline
134
+ end
135
+
136
+ def show_error(io=STDOUT)
137
+ error_pos = @failing_rule_offset
138
+ line_no = current_line(error_pos)
139
+ col_no = current_column(error_pos)
140
+
141
+ io.puts "On line #{line_no}, column #{col_no}:"
142
+
143
+ if @failed_rule.kind_of? Symbol
144
+ info = self.class::Rules[@failed_rule]
145
+ io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')"
146
+ else
147
+ io.puts "Failed to match rule '#{@failed_rule}'"
148
+ end
149
+
150
+ io.puts "Got: #{string[error_pos,1].inspect}"
151
+ line = lines[line_no-1]
152
+ io.puts "=> #{line}"
153
+ io.print(" " * (col_no + 3))
154
+ io.puts "^"
155
+ end
156
+
157
+ def set_failed_rule(name)
158
+ if @pos > @failing_rule_offset
159
+ @failed_rule = name
160
+ @failing_rule_offset = @pos
161
+ end
162
+ end
163
+
164
+ attr_reader :failed_rule
165
+
166
+ def match_string(str)
167
+ len = str.size
168
+ if @string[pos,len] == str
169
+ @pos += len
170
+ return str
171
+ end
172
+
173
+ return nil
174
+ end
175
+
176
+ def scan(reg)
177
+ if m = reg.match(@string[@pos..-1])
178
+ width = m.end(0)
179
+ @pos += width
180
+ return true
181
+ end
182
+
183
+ return nil
184
+ end
185
+
186
+ if "".respond_to? :ord
187
+ def get_byte
188
+ if @pos >= @string_size
189
+ return nil
190
+ end
191
+
192
+ s = @string[@pos].ord
193
+ @pos += 1
194
+ s
195
+ end
196
+ else
197
+ def get_byte
198
+ if @pos >= @string_size
199
+ return nil
200
+ end
201
+
202
+ s = @string[@pos]
203
+ @pos += 1
204
+ s
205
+ end
206
+ end
207
+
208
+ def parse(rule=nil)
209
+ # We invoke the rules indirectly via apply
210
+ # instead of by just calling them as methods because
211
+ # if the rules use left recursion, apply needs to
212
+ # manage that.
213
+
214
+ if !rule
215
+ apply(:_root)
216
+ else
217
+ method = rule.gsub("-","_hyphen_")
218
+ apply :"_#{method}"
219
+ end
220
+ end
221
+
222
+ class MemoEntry
223
+ def initialize(ans, pos)
224
+ @ans = ans
225
+ @pos = pos
226
+ @result = nil
227
+ @set = false
228
+ @left_rec = false
229
+ end
230
+
231
+ attr_reader :ans, :pos, :result, :set
232
+ attr_accessor :left_rec
233
+
234
+ def move!(ans, pos, result)
235
+ @ans = ans
236
+ @pos = pos
237
+ @result = result
238
+ @set = true
239
+ @left_rec = false
240
+ end
241
+ end
242
+
243
+ def external_invoke(other, rule, *args)
244
+ old_pos = @pos
245
+ old_string = @string
246
+
247
+ set_string other.string, other.pos
248
+
249
+ begin
250
+ if val = __send__(rule, *args)
251
+ other.pos = @pos
252
+ other.result = @result
253
+ else
254
+ other.set_failed_rule "#{self.class}##{rule}"
255
+ end
256
+ val
257
+ ensure
258
+ set_string old_string, old_pos
259
+ end
260
+ end
261
+
262
+ def apply_with_args(rule, *args)
263
+ memo_key = [rule, args]
264
+ if m = @memoizations[memo_key][@pos]
265
+ @pos = m.pos
266
+ if !m.set
267
+ m.left_rec = true
268
+ return nil
269
+ end
270
+
271
+ @result = m.result
272
+
273
+ return m.ans
274
+ else
275
+ m = MemoEntry.new(nil, @pos)
276
+ @memoizations[memo_key][@pos] = m
277
+ start_pos = @pos
278
+
279
+ ans = __send__ rule, *args
280
+
281
+ lr = m.left_rec
282
+
283
+ m.move! ans, @pos, @result
284
+
285
+ # Don't bother trying to grow the left recursion
286
+ # if it's failing straight away (thus there is no seed)
287
+ if ans and lr
288
+ return grow_lr(rule, args, start_pos, m)
289
+ else
290
+ return ans
291
+ end
292
+ end
293
+ end
294
+
295
+ def apply(rule)
296
+ if m = @memoizations[rule][@pos]
297
+ @pos = m.pos
298
+ if !m.set
299
+ m.left_rec = true
300
+ return nil
301
+ end
302
+
303
+ @result = m.result
304
+
305
+ return m.ans
306
+ else
307
+ m = MemoEntry.new(nil, @pos)
308
+ @memoizations[rule][@pos] = m
309
+ start_pos = @pos
310
+
311
+ ans = __send__ rule
312
+
313
+ lr = m.left_rec
314
+
315
+ m.move! ans, @pos, @result
316
+
317
+ # Don't bother trying to grow the left recursion
318
+ # if it's failing straight away (thus there is no seed)
319
+ if ans and lr
320
+ return grow_lr(rule, nil, start_pos, m)
321
+ else
322
+ return ans
323
+ end
324
+ end
325
+ end
326
+
327
+ def grow_lr(rule, args, start_pos, m)
328
+ while true
329
+ @pos = start_pos
330
+ @result = m.result
331
+
332
+ if args
333
+ ans = __send__ rule, *args
334
+ else
335
+ ans = __send__ rule
336
+ end
337
+ return nil unless ans
338
+
339
+ break if @pos <= m.pos
340
+
341
+ m.move! ans, @pos, @result
342
+ end
343
+
344
+ @result = m.result
345
+ @pos = m.pos
346
+ return m.ans
347
+ end
348
+
349
+ class RuleInfo
350
+ def initialize(name, rendered)
351
+ @name = name
352
+ @rendered = rendered
353
+ end
354
+
355
+ attr_reader :name, :rendered
356
+ end
357
+
358
+ def self.rule_info(name, rendered)
359
+ RuleInfo.new(name, rendered)
360
+ end
361
+
362
+
363
+ # :startdoc:
364
+ # :stopdoc:
365
+ def setup_foreign_grammar; end
366
+
367
+ # Alphanumeric = /\p{Word}/
368
+ def _Alphanumeric
369
+ _tmp = scan(/\A(?-mix:\p{Word})/)
370
+ set_failed_rule :_Alphanumeric unless _tmp
371
+ return _tmp
372
+ end
373
+
374
+ # AlphanumericAscii = /[A-Za-z0-9]/
375
+ def _AlphanumericAscii
376
+ _tmp = scan(/\A(?-mix:[A-Za-z0-9])/)
377
+ set_failed_rule :_AlphanumericAscii unless _tmp
378
+ return _tmp
379
+ end
380
+
381
+ # BOM = "uFEFF"
382
+ def _BOM
383
+ _tmp = match_string("uFEFF")
384
+ set_failed_rule :_BOM unless _tmp
385
+ return _tmp
386
+ end
387
+
388
+ # Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/
389
+ def _Newline
390
+ _tmp = scan(/\A(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/)
391
+ set_failed_rule :_Newline unless _tmp
392
+ return _tmp
393
+ end
394
+
395
+ # NonAlphanumeric = /\p{^Word}/
396
+ def _NonAlphanumeric
397
+ _tmp = scan(/\A(?-mix:\p{^Word})/)
398
+ set_failed_rule :_NonAlphanumeric unless _tmp
399
+ return _tmp
400
+ end
401
+
402
+ # Spacechar = /\t|\p{Zs}/
403
+ def _Spacechar
404
+ _tmp = scan(/\A(?-mix:\t|\p{Zs})/)
405
+ set_failed_rule :_Spacechar unless _tmp
406
+ return _tmp
407
+ end
408
+
409
+ Rules = {}
410
+ Rules[:_Alphanumeric] = rule_info("Alphanumeric", "/\\p{Word}/")
411
+ Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "/[A-Za-z0-9]/")
412
+ Rules[:_BOM] = rule_info("BOM", "\"uFEFF\"")
413
+ Rules[:_Newline] = rule_info("Newline", "/\\n|\\r\\n?|\\p{Zl}|\\p{Zp}/")
414
+ Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "/\\p{^Word}/")
415
+ Rules[:_Spacechar] = rule_info("Spacechar", "/\\t|\\p{Zs}/")
416
+ # :startdoc:
417
+ end
@@ -849,8 +849,6 @@ https://github.com/ruby/rdoc/issues
849
849
 
850
850
  # Formatters
851
851
  autoload :Formatter, 'rdoc/markup/formatter'
852
- autoload :FormatterTestCase, 'rdoc/markup/formatter_test_case'
853
- autoload :TextFormatterTestCase, 'rdoc/markup/text_formatter_test_case'
854
852
 
855
853
  autoload :ToAnsi, 'rdoc/markup/to_ansi'
856
854
  autoload :ToBs, 'rdoc/markup/to_bs'
@@ -156,7 +156,7 @@ class RDoc::Markup::Formatter
156
156
  method_name = "handle_regexp_#{name}"
157
157
 
158
158
  if respond_to? method_name then
159
- target.text = send method_name, target
159
+ target.text = public_send method_name, target
160
160
  handled = true
161
161
  end
162
162
  end
@@ -80,10 +80,6 @@ class RDoc::Markup::Parser
80
80
  @binary_input = nil
81
81
  @current_token = nil
82
82
  @debug = false
83
- @input = nil
84
- @input_encoding = nil
85
- @line = 0
86
- @line_pos = 0
87
83
  @s = nil
88
84
  @tokens = []
89
85
  end
@@ -319,13 +315,6 @@ class RDoc::Markup::Parser
319
315
  verbatim
320
316
  end
321
317
 
322
- ##
323
- # The character offset for the input string at the given +byte_offset+
324
-
325
- def char_pos byte_offset
326
- @input.byteslice(0, byte_offset).length
327
- end
328
-
329
318
  ##
330
319
  # Pulls the next token from the stream.
331
320
 
@@ -424,15 +413,53 @@ class RDoc::Markup::Parser
424
413
  token
425
414
  end
426
415
 
416
+ ##
417
+ # A simple wrapper of StringScanner that is aware of the current column and lineno
418
+
419
+ class MyStringScanner
420
+ def initialize(input)
421
+ @line = @column = 0
422
+ @s = StringScanner.new input
423
+ end
424
+
425
+ def scan(re)
426
+ ret = @s.scan(re)
427
+ @column += ret.length if ret
428
+ ret
429
+ end
430
+
431
+ def unscan(s)
432
+ @s.pos -= s.bytesize
433
+ @column -= s.length
434
+ end
435
+
436
+ def pos
437
+ [@column, @line]
438
+ end
439
+
440
+ def newline!
441
+ @column = 0
442
+ @line += 1
443
+ end
444
+
445
+ def eos?
446
+ @s.eos?
447
+ end
448
+
449
+ def matched
450
+ @s.matched
451
+ end
452
+
453
+ def [](i)
454
+ @s[i]
455
+ end
456
+ end
457
+
427
458
  ##
428
459
  # Creates the StringScanner
429
460
 
430
461
  def setup_scanner input
431
- @line = 0
432
- @line_pos = 0
433
- @input = input.dup
434
-
435
- @s = StringScanner.new input
462
+ @s = MyStringScanner.new input
436
463
  end
437
464
 
438
465
  ##
@@ -467,31 +494,30 @@ class RDoc::Markup::Parser
467
494
  @tokens << case
468
495
  # [CR]LF => :NEWLINE
469
496
  when @s.scan(/\r?\n/) then
470
- token = [:NEWLINE, @s.matched, *token_pos(pos)]
471
- @line_pos = char_pos @s.pos
472
- @line += 1
497
+ token = [:NEWLINE, @s.matched, *pos]
498
+ @s.newline!
473
499
  token
474
500
  # === text => :HEADER then :TEXT
475
501
  when @s.scan(/(=+)(\s*)/) then
476
502
  level = @s[1].length
477
- header = [:HEADER, level, *token_pos(pos)]
503
+ header = [:HEADER, level, *pos]
478
504
 
479
505
  if @s[2] =~ /^\r?\n/ then
480
- @s.pos -= @s[2].length
506
+ @s.unscan(@s[2])
481
507
  header
482
508
  else
483
509
  pos = @s.pos
484
510
  @s.scan(/.*/)
485
511
  @tokens << header
486
- [:TEXT, @s.matched.sub(/\r$/, ''), *token_pos(pos)]
512
+ [:TEXT, @s.matched.sub(/\r$/, ''), *pos]
487
513
  end
488
514
  # --- (at least 3) and nothing else on the line => :RULE
489
515
  when @s.scan(/(-{3,}) *\r?$/) then
490
- [:RULE, @s[1].length - 2, *token_pos(pos)]
516
+ [:RULE, @s[1].length - 2, *pos]
491
517
  # * or - followed by white space and text => :BULLET
492
518
  when @s.scan(/([*-]) +(\S)/) then
493
- @s.pos -= @s[2].bytesize # unget \S
494
- [:BULLET, @s[1], *token_pos(pos)]
519
+ @s.unscan(@s[2])
520
+ [:BULLET, @s[1], *pos]
495
521
  # A. text, a. text, 12. text => :UALPHA, :LALPHA, :NUMBER
496
522
  when @s.scan(/([a-z]|\d+)\. +(\S)/i) then
497
523
  # FIXME if tab(s), the column will be wrong
@@ -500,7 +526,7 @@ class RDoc::Markup::Parser
500
526
  # before (and provide a check for that at least in debug
501
527
  # mode)
502
528
  list_label = @s[1]
503
- @s.pos -= @s[2].bytesize # unget \S
529
+ @s.unscan(@s[2])
504
530
  list_type =
505
531
  case list_label
506
532
  when /[a-z]/ then :LALPHA
@@ -509,24 +535,24 @@ class RDoc::Markup::Parser
509
535
  else
510
536
  raise ParseError, "BUG token #{list_label}"
511
537
  end
512
- [list_type, list_label, *token_pos(pos)]
538
+ [list_type, list_label, *pos]
513
539
  # [text] followed by spaces or end of line => :LABEL
514
540
  when @s.scan(/\[(.*?)\]( +|\r?$)/) then
515
- [:LABEL, @s[1], *token_pos(pos)]
541
+ [:LABEL, @s[1], *pos]
516
542
  # text:: followed by spaces or end of line => :NOTE
517
543
  when @s.scan(/(.*?)::( +|\r?$)/) then
518
- [:NOTE, @s[1], *token_pos(pos)]
544
+ [:NOTE, @s[1], *pos]
519
545
  # >>> followed by end of line => :BLOCKQUOTE
520
546
  when @s.scan(/>>> *(\w+)?$/) then
521
- [:BLOCKQUOTE, @s[1], *token_pos(pos)]
547
+ [:BLOCKQUOTE, @s[1], *pos]
522
548
  # anything else: :TEXT
523
549
  else
524
550
  @s.scan(/(.*?)( )?\r?$/)
525
- token = [:TEXT, @s[1], *token_pos(pos)]
551
+ token = [:TEXT, @s[1], *pos]
526
552
 
527
553
  if @s[2] then
528
554
  @tokens << token
529
- [:BREAK, @s[2], *token_pos(pos + @s[1].length)]
555
+ [:BREAK, @s[2], pos[0] + @s[1].length, pos[1]]
530
556
  else
531
557
  token
532
558
  end
@@ -536,16 +562,6 @@ class RDoc::Markup::Parser
536
562
  self
537
563
  end
538
564
 
539
- ##
540
- # Calculates the column (by character) and line of the current token based
541
- # on +byte_offset+.
542
-
543
- def token_pos byte_offset
544
- offset = char_pos byte_offset
545
-
546
- [offset - @line_pos, @line]
547
- end
548
-
549
565
  ##
550
566
  # Returns the current token to the token stream
551
567