From 6566919176834efb47ea717967669ca83eb78347 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 7 Jun 2019 18:45:49 +0900 Subject: 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 --- lib/rdoc/parser/ripper_state_lex.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/rdoc') 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 -- cgit v1.2.3