[MacRuby] #1341: StringScanner#scan should not set into Regexp.last_match
#1341: StringScanner#scan should not set into Regexp.last_match ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Test Script: {{{ #!ruby require 'strscan' "hello, world" =~ /hello/ s = StringScanner.new('test string') p s.scan(/\w+/) # -> "test" p $~ # Regexp.last_match }}} Result: {{{ $ ruby19 t.rb "test" #<MatchData "hello"> $ macruby t.rb "test" #<MatchData "test"> }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1341> MacRuby <http://macruby.org/>
#1341: StringScanner#scan should not set into Regexp.last_match ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): Is it the same problem as #939 (maybe)? -- Ticket URL: <http://www.macruby.org/trac/ticket/1341#comment:1> MacRuby <http://macruby.org/>
#1341: StringScanner#scan should not set into Regexp.last_match ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): Unfortunately, this issue is different. Currently, StringScanner#scan invokes a Regexp#match. https://github.com/MacRuby/MacRuby/blob/master/lib/strscan.rb#L639-644 [[BR]] When invoke a Regexp#match, rb_backref_set() in rb_reg_matcher_search_find() would change a value of Regexp.last_match Maybe, I guess that this issue needs new API which does not invoke a rb_backref_set(). -- Ticket URL: <http://www.macruby.org/trac/ticket/1341#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby