From b9ebca5a3017b2fe1de7442b139239f12dcf876e Mon Sep 17 00:00:00 2001 From: NAITOH Jun Date: Sat, 2 Mar 2024 21:13:56 +0900 Subject: [PATCH] Remove `Source#string=` method ## Why? https://github.com/ruby/rexml/pull/114#discussion_r1501773803 > I want to just change scan pointer (StringScanner#pos=) instead of changing @scanner.string. --- lib/rexml/parsers/baseparser.rb | 19 +++++++++++-------- lib/rexml/source.rb | 8 ++++++-- test/parse/test_notation_declaration.rb | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb index bc59bcdc..d1b9617e 100644 --- a/lib/rexml/parsers/baseparser.rb +++ b/lib/rexml/parsers/baseparser.rb @@ -211,8 +211,9 @@ def pull_event #STDERR.puts @source.encoding #STDERR.puts "BUFFER = #{@source.buffer.inspect}" if @document_status == nil + pos = @source.pos if @source.match("/um, true)[1] ] @@ -224,7 +225,7 @@ def pull_event else message = "#{base_error_message}: invalid name" end - @source.string = "/um, true) @@ -325,7 +327,7 @@ def pull_event else message = "#{base_error_message}: invalid name" end - @source.string = " ]> + ]> DETAIL end