Skip to content

Commit

Permalink
Showing 8 changed files with 659 additions and 19 deletions.
1 change: 1 addition & 0 deletions spec/truffle/tags/core/matchdata/eql_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:MatchData#eql? returns true if both operands have equal target strings, patterns, and match positions
fails:MatchData#eql? returns false if the operands have different patterns
1 change: 1 addition & 0 deletions spec/truffle/tags/core/matchdata/equal_value_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:MatchData#== returns true if both operands have equal target strings, patterns, and match positions
fails:MatchData#== returns false if the operands have different patterns
1 change: 0 additions & 1 deletion spec/truffle/tags/core/regexp/match_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:Regexp#=~ returns the index too, when argument is a Symbol
fails:Regexp#match resets $~ if passed nil
fails:Regexp#match with [string, position] when given a positive position matches the input at a given position
fails:Regexp#match with [string, position] when given a positive position uses the start as a character offset
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/regexp/named_captures_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fails:Regexp#named_captures returns a Hash
fails:Regexp#named_captures returns an empty Hash when there are no capture groups
fails:Regexp#named_captures sets the keys of the Hash to the names of the capture groups
fails:Regexp#named_captures sets the values of the Hash to Arrays
fails:Regexp#named_captures sets each element of the Array to the corresponding group's index
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/regexp/names_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fails:Regexp#names returns an Array
fails:Regexp#names returns an empty Array if there are no named captures
fails:Regexp#names returns each named capture as a String
fails:Regexp#names returns all of the named captures
fails:Regexp#names works with nested named captures
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/regexp/try_convert_tags.txt

This file was deleted.

31 changes: 31 additions & 0 deletions truffle/src/main/ruby/core/rubinius/bootstrap/regexp.rb
Original file line number Diff line number Diff line change
@@ -51,6 +51,28 @@ def search_region(str, start, finish, forward) # equiv to MRI's re_search
raise PrimitiveFailure, "Regexp#search_region primitive failed"
end

def match_start(str, offset) # equiv to MRI's re_match
Rubinius.primitive :regexp_match_start
raise PrimitiveFailure, "Regexp#match_start primitive failed"
end

def search_from(str, offset) # equiv to MRI's rb_reg_search
Rubinius.primitive :regexp_search_from
raise PrimitiveFailure, "Regexp#search_from primitive failed"
end

def options
Rubinius.primitive :regexp_options
raise PrimitiveFailure, "Regexp#options primitive failed"
end

def self.last_match(field=nil)
Rubinius.primitive :regexp_last_match

return last_match(Integer(field)) if field
raise PrimitiveFailure, "Regexp#last_match primitive failed"
end

def self.last_match=(match)
Rubinius.primitive :regexp_set_last_match

@@ -61,9 +83,18 @@ def self.last_match=(match)
raise PrimitiveFailure, "Regexp#set_last_match primitive failed"
end

def self.propagate_last_match
Rubinius.primitive :regexp_propagate_last_match
raise PrimitiveFailure, "Regexp#propagate_last_match primitive failed"
end

def self.set_block_last_match
Rubinius.primitive :regexp_set_block_last_match
raise PrimitiveFailure, "Regexp#set_block_last_match primitive failed"
end

def fixed_encoding?
Rubinius.primitive :regexp_fixed_encoding_p
raise PrimitiveFailure, "Regexp.fixed_encoding? primitive failed"
end
end
637 changes: 626 additions & 11 deletions truffle/src/main/ruby/core/rubinius/common/regexp.rb

Large diffs are not rendered by default.

0 comments on commit 7e20916

Please sign in to comment.