aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-19 00:00:01 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-19 00:00:01 +0000
commite0030bd99de02ba97dcce9f57ad00a1b59f7cb6e (patch)
treeb4cb72ef30ea61122f1bb91d8da4de3cf2ce032f /lib/rdoc
parentdf7dac9174a31e71b58be6184e23bfe6b742a494 (diff)
downloadruby-e0030bd99de02ba97dcce9f57ad00a1b59f7cb6e.tar.gz
* lib/rdoc/markdown/literals_1_9.rb: Fix trailing whitespace.
Previously kpeg (which generates this file) added trailing whitespace, but this bug is now fixed. * lib/rdoc/markdown.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/markdown.rb1
-rw-r--r--lib/rdoc/markdown/literals_1_9.rb25
2 files changed, 14 insertions, 12 deletions
diff --git a/lib/rdoc/markdown.rb b/lib/rdoc/markdown.rb
index ed04191ffc..8140fdb383 100644
--- a/lib/rdoc/markdown.rb
+++ b/lib/rdoc/markdown.rb
@@ -194,7 +194,6 @@ class RDoc::Markdown
attr_reader :failing_rule_offset
attr_accessor :result, :pos
-
def current_column(target=pos)
if c = string.rindex("\n", target-1)
return target - c - 1
diff --git a/lib/rdoc/markdown/literals_1_9.rb b/lib/rdoc/markdown/literals_1_9.rb
index 6782eb7910..f7bfbe27a1 100644
--- a/lib/rdoc/markdown/literals_1_9.rb
+++ b/lib/rdoc/markdown/literals_1_9.rb
@@ -23,8 +23,7 @@ class RDoc::Markdown::Literals
# Prepares for parsing +str+. If you define a custom initialize you must
# call this method before #parse
def setup_parser(str, debug=false)
- @string = str
- @pos = 0
+ set_string str, 0
@memoizations = Hash.new { |h,k| h[k] = {} }
@result = nil
@failed_rule = nil
@@ -37,7 +36,6 @@ class RDoc::Markdown::Literals
attr_reader :failing_rule_offset
attr_accessor :result, :pos
-
def current_column(target=pos)
if c = string.rindex("\n", target-1)
return target - c - 1
@@ -71,6 +69,13 @@ class RDoc::Markdown::Literals
@string[start..@pos-1]
end
+ # Sets the string and current parsing position for the parser.
+ def set_string string, pos
+ @string = string
+ @string_size = string ? string.size : 0
+ @pos = pos
+ end
+
def show_pos
width = 10
if @pos < width
@@ -177,19 +182,19 @@ class RDoc::Markdown::Literals
return nil
end
- if "".respond_to? :getbyte
+ if "".respond_to? :ord
def get_byte
- if @pos >= @string.size
+ if @pos >= @string_size
return nil
end
- s = @string.getbyte @pos
+ s = @string[@pos].ord
@pos += 1
s
end
else
def get_byte
- if @pos >= @string.size
+ if @pos >= @string_size
return nil
end
@@ -238,8 +243,7 @@ class RDoc::Markdown::Literals
old_pos = @pos
old_string = @string
- @pos = other.pos
- @string = other.string
+ set_string other.string, other.pos
begin
if val = __send__(rule, *args)
@@ -250,8 +254,7 @@ class RDoc::Markdown::Literals
end
val
ensure
- @pos = old_pos
- @string = old_string
+ set_string old_string, old_pos
end
end