summaryrefslogtreecommitdiff
path: root/lib/rdoc/parser/ripper_state_lex.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-07 18:45:49 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-07 18:57:58 +0900
commit6566919176834efb47ea717967669ca83eb78347 (patch)
tree6366383ce93112cc60013ce3dc39533f02ec8144 /lib/rdoc/parser/ripper_state_lex.rb
parenta6a26e42b15c46f117f4fce07a2050e9d727355d (diff)
ripper_state_lex.rb: chomp CR
* lib/rdoc/parser/ripper_state_lex.rb (RDoc::Parser::RipperStateLex): chomp newline, including CR, from here document terminator. Closes: ruby/rdoc#694 Closes: ruby/rdoc#697 Closes: ruby/rdoc#705
Diffstat (limited to 'lib/rdoc/parser/ripper_state_lex.rb')
-rw-r--r--lib/rdoc/parser/ripper_state_lex.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb
index cc7a87976c..5492f08726 100644
--- a/lib/rdoc/parser/ripper_state_lex.rb
+++ b/lib/rdoc/parser/ripper_state_lex.rb
@@ -494,7 +494,8 @@ class RDoc::Parser::RipperStateLex
private def heredoc_end?(name, indent, tk)
result = false
if :on_heredoc_end == tk[:kind] then
- tk_name = (indent ? tk[:text].gsub(/^ *(.+)\n?$/, '\1') : tk[:text].gsub(/\n\z/, ''))
+ tk_name = tk[:text].chomp
+ tk_name.lstrip! if indent
if name == tk_name
result = true
end