Skip to content

Commit 7bfe2a5

Browse files
committed
[GR-37242] Support atomic groups in TRegex's backtracker.
PullRequest: truffleruby/3232
2 parents bb42392 + af96e64 commit 7bfe2a5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

spec/truffle/options/warn_truffle_regex_compile_fallback_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
describe "The --warn-truffle-regex-compile-fallback option" do
1212
it "works" do
13-
out = ruby_exe('2.times { /a*+/ =~ "a" }', options: "--experimental-options --warn-truffle-regex-compile-fallback", args: "2>&1")
13+
out = ruby_exe('2.times { /(?<loop>a\g<loop>|)/ =~ "aaa" }', options: "--experimental-options --warn-truffle-regex-compile-fallback", args: "2>&1")
1414
out = out.gsub(/^.+: warning/, 'warning')
1515
out.should == <<~OUT
16-
warning: Regexp /a*+/ at_start=false encoding=US-ASCII cannot be compiled to a Truffle regexp and fell back to Joni
16+
warning: Regexp /(?<loop>a\\g<loop>|)/ at_start=false encoding=US-ASCII cannot be compiled to a Truffle regexp and fell back to Joni
1717
OUT
1818
end
1919
end

spec/truffle/options/warn_truffle_regex_match_fallback_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
describe "The --warn-truffle-regex-match-fallback option" do
1212
it "works" do
13-
out = ruby_exe('2.times { /a*+/ =~ "a" }', options: "--experimental-options --warn-truffle-regex-match-fallback", args: "2>&1")
13+
out = ruby_exe('2.times { /(?<loop>a\g<loop>|)/ =~ "aaa" }', options: "--experimental-options --warn-truffle-regex-match-fallback", args: "2>&1")
1414
out = out.gsub(/^.+: warning/, 'warning')
1515
out.should == <<~OUT
16-
warning: match_in_region(/a*+/, "a"@UTF-8, 0, 1, false, 0) enc=US-ASCII cannot be run as a Truffle regexp and fell back to Joni
17-
warning: match_in_region(/a*+/, "a"@UTF-8, 0, 1, false, 0) enc=US-ASCII cannot be run as a Truffle regexp and fell back to Joni
16+
warning: match_in_region(/(?<loop>a\\g<loop>|)/, "aaa"@UTF-8, 0, 3, false, 0) enc=US-ASCII cannot be run as a Truffle regexp and fell back to Joni
17+
warning: match_in_region(/(?<loop>a\\g<loop>|)/, "aaa"@UTF-8, 0, 3, false, 0) enc=US-ASCII cannot be run as a Truffle regexp and fell back to Joni
1818
OUT
1919
end
2020
end

0 commit comments

Comments
 (0)