mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/rdoc] Update generated files
This commit is contained in:
parent
5348a34504
commit
e95ad70079
3 changed files with 26 additions and 10 deletions
|
@ -29,6 +29,7 @@ class RDoc::Markdown::Literals
|
|||
@result = nil
|
||||
@failed_rule = nil
|
||||
@failing_rule_offset = -1
|
||||
@line_offsets = nil
|
||||
|
||||
setup_foreign_grammar
|
||||
end
|
||||
|
@ -45,17 +46,32 @@ class RDoc::Markdown::Literals
|
|||
target + 1
|
||||
end
|
||||
|
||||
def current_line(target=pos)
|
||||
cur_offset = 0
|
||||
cur_line = 0
|
||||
if [].respond_to? :bsearch_index
|
||||
def current_line(target=pos)
|
||||
unless @line_offsets
|
||||
@line_offsets = []
|
||||
total = 0
|
||||
string.each_line do |line|
|
||||
total += line.size
|
||||
@line_offsets << total
|
||||
end
|
||||
end
|
||||
|
||||
string.each_line do |line|
|
||||
cur_line += 1
|
||||
cur_offset += line.size
|
||||
return cur_line if cur_offset >= target
|
||||
@line_offsets.bsearch_index {|x| x >= target } + 1 || -1
|
||||
end
|
||||
else
|
||||
def current_line(target=pos)
|
||||
cur_offset = 0
|
||||
cur_line = 0
|
||||
|
||||
-1
|
||||
string.each_line do |line|
|
||||
cur_line += 1
|
||||
cur_offset += line.size
|
||||
return cur_line if cur_offset >= target
|
||||
end
|
||||
|
||||
-1
|
||||
end
|
||||
end
|
||||
|
||||
def lines
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
#
|
||||
# DO NOT MODIFY!!!!
|
||||
# This file is automatically generated by Racc 1.5.2
|
||||
# This file is automatically generated by Racc 1.6.0
|
||||
# from Racc grammar file "".
|
||||
#
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
#
|
||||
# DO NOT MODIFY!!!!
|
||||
# This file is automatically generated by Racc 1.5.2
|
||||
# This file is automatically generated by Racc 1.6.0
|
||||
# from Racc grammar file "".
|
||||
#
|
||||
|
||||
|
|
Loading…
Reference in a new issue