Package org.jruby

Examples of org.jruby.RubyRegexp$SearchMatchTask


    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        if (once && onceRegexp != null) return onceRegexp;

        RubyString string = DStrNode.buildDynamicString(runtime, context, self, aBlock, this);

        RubyRegexp regexp = createRegexp(runtime, string);
       
        if (once) setOnceRegexp(regexp);

        return regexp;
    }
View Full Code Here


    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        if (getOnce() && onceRegexp != null) return onceRegexp;

        RubyString string = (RubyString) super.interpret(runtime, context, self, aBlock);
        RubyRegexp regexp = RubyRegexp.newDRegexp(runtime, string, options);
       
        if (getOnce() && onceRegexp == null) onceRegexp = regexp;

        return regexp;
    }
View Full Code Here

        return isConstant() ? this : new Regexp(regexp.cloneForInlining(ii), options);
    }

    @Override
    public Object retrieve(InterpreterContext interp) {
        RubyRegexp reg = RubyRegexp.newRegexp(interp.getRuntime(),
                ((RubyString) regexp.retrieve(interp)).getByteList(), options);

        reg.setLiteral();

        return reg;
    }
View Full Code Here

        }
        return flote;
    }

    public final RubyRegexp getRegexp(Ruby runtime, int index, ByteList pattern, int options) {
        RubyRegexp regexp = regexps[index];
        if (regexp == null || runtime.getKCode() != regexp.getKCode()) {
            regexp = RubyRegexp.newRegexp(runtime, pattern, RegexpOptions.fromEmbeddedOptions(options));
            regexp.setLiteral();
            regexps[index] = regexp;
        }
        return regexp;
    }
View Full Code Here

    public final RubyRegexp getRegexp(int index) {
        return regexps[index];
    }

    public final RubyRegexp cacheRegexp(int index, RubyString pattern, int options) {
        RubyRegexp regexp = regexps[index];
        Ruby runtime = pattern.getRuntime();
        if (regexp == null || runtime.getKCode() != regexp.getKCode()) {
            regexp = RubyRegexp.newRegexp(runtime, pattern.getByteList(), RegexpOptions.fromEmbeddedOptions(options));
            regexps[index] = regexp;
        }
        return regexp;
    }
View Full Code Here

    @Override
    public Object retrieve(ThreadContext context, IRubyObject self, DynamicScope currDynScope, Object[] temp) {
        // FIXME (from RegexpNode.java): 1.9 should care about internal or external encoding and not kcode.
        // If we have a constant regexp string or if the regexp patterns asks for caching, cache the regexp
        if ((!regexp.hasKnownValue() && !options.isOnce()) || (rubyRegexp == null) || context.runtime.getKCode() != rubyRegexp.getKCode()) {
            RubyRegexp re;
            if (regexp instanceof CompoundString) {
                if (context.runtime.is1_9()) {
                    RubyString[] pieces  = ((CompoundString)regexp).retrievePieces(context, self, currDynScope, temp);
                    RubyString   pattern = RubyRegexp.preprocessDRegexp(context.runtime, pieces, options);
                    re = RubyRegexp.newDRegexp(context.runtime, pattern, options);
                } else {
                    RubyString pattern = (RubyString) regexp.retrieve(context, self, currDynScope, temp);
                    re = RubyRegexp.newDRegexp(context.runtime, pattern, options);
                }
            } else {
                RubyString pattern = (RubyString) regexp.retrieve(context, self, currDynScope, temp);
                re = RubyRegexp.newRegexp(context.runtime, pattern.getByteList(), options);
            }
            re.setLiteral();
            rubyRegexp = re;
        }

        return rubyRegexp;
    }
View Full Code Here

        }
        return flote;
    }

    public final RubyRegexp getRegexp(ThreadContext context, int index, ByteList pattern, int options) {
        RubyRegexp regexp = regexps[index];
        if (regexp == null || context.runtime.getKCode() != regexp.getKCode()) {
            regexp = RubyRegexp.newRegexp(context.runtime, pattern, RegexpOptions.fromEmbeddedOptions(options));
            regexp.setLiteral();
            regexps[index] = regexp;
        }
        return regexp;
    }
View Full Code Here

    public final RubyRegexp getRegexp(int index) {
        return regexps[index];
    }

    public final RubyRegexp cacheRegexp(int index, RubyString pattern, int options) {
        RubyRegexp regexp = regexps[index];
        Ruby runtime = pattern.getRuntime();
        if (regexp == null || runtime.getKCode() != regexp.getKCode()) {
            regexp = RubyRegexp.newRegexp(runtime, pattern.getByteList(), RegexpOptions.fromEmbeddedOptions(options));
            regexps[index] = regexp;
        }
        return regexp;
    }
View Full Code Here

                receiver.cloneForInlining(ii), arg.cloneForInlining(ii));
    }

    @Override
    public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) {
        RubyRegexp regexp = (RubyRegexp) receiver.retrieve(context, self, currDynScope, temp);
        IRubyObject argValue = (IRubyObject) arg.retrieve(context, self, currDynScope, temp);
       
        if (argValue instanceof RubyString) {
            return context.runtime.is1_9() ?
                    regexp.op_match19(context, argValue) :
                    regexp.op_match(context, argValue);
        } else {
            return argValue.callMethod(context, "=~", regexp);
        }
    }
View Full Code Here

        return createList(regexpNode);
    }
   
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
       RubyRegexp pattern = ((RubyRegexp) regexpNode.interpret(runtime, context, self, aBlock));
        return runtime.is1_9() ?
                pattern.op_match2_19(context) :
                pattern.op_match2(context);
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubyRegexp$SearchMatchTask

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.