Fix for newRegexp() on JRuby 1.6.7

This commit is contained in:
Kyle Banker 2012-02-27 18:10:21 -05:00
parent 4da27036cf
commit 349d37f3db
3 changed files with 7 additions and 5 deletions

Binary file not shown.

Binary file not shown.

View File

@ -9,6 +9,7 @@ import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.Block; import org.jruby.runtime.Block;
import org.jruby.runtime.CallType; import org.jruby.runtime.CallType;
import org.jruby.runtime.callsite.CacheEntry; import org.jruby.runtime.callsite.CacheEntry;
import org.jruby.util.RegexpOptions;
import org.jruby.javasupport.JavaEmbedUtils; import org.jruby.javasupport.JavaEmbedUtils;
import org.jruby.javasupport.JavaUtil; import org.jruby.javasupport.JavaUtil;
@ -226,22 +227,23 @@ public class RubyBSONCallback implements BSONCallback {
public void gotRegex( String name , String pattern , String flags ){ public void gotRegex( String name , String pattern , String flags ){
int f = 0; int f = 0;
RegexpOptions opts = new RegexpOptions();
ByteList b = new ByteList(pattern.getBytes()); ByteList b = new ByteList(pattern.getBytes());
if(flags.contains("i")) { if(flags.contains("i")) {
f = f | ReOptions.RE_OPTION_IGNORECASE; opts.setIgnorecase(true);
} }
if(flags.contains("m")) { if(flags.contains("m")) {
f = f | ReOptions.RE_OPTION_MULTILINE; opts.setMultiline(true);
} }
if(flags.contains("s")) { if(flags.contains("s")) {
f = f | ReOptions.RE_OPTION_MULTILINE; opts.setMultiline(true);
} }
if(flags.contains("x")) { if(flags.contains("x")) {
f = f | ReOptions.RE_OPTION_EXTENDED; opts.setExtended(true);
} }
_put( name , RubyRegexp.newRegexp(_runtime, b, f) ); _put( name , RubyRegexp.newRegexp(_runtime, b, opts) );
} }
public void gotString( String name , String v ){ public void gotString( String name , String v ){