Package org.jruby

Examples of org.jruby.RubyRegexp


            string = buildDRegexpString19(runtime, context, self, aBlock);
        } else {
            string = buildDynamicString(runtime, context, self, aBlock);
        }

        RubyRegexp regexp = RubyRegexp.newDRegexp(runtime, string, options);
       
        if (getOnce() && onceRegexp == null) onceRegexp = 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);
        return context.runtime.is1_9() ?
                regexp.op_match19(context, argValue) :
                regexp.op_match(context, argValue);
    }
View Full Code Here

        return new MatchInstr((Variable) result.cloneForInlining(ii), receiver.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);
        return context.runtime.is1_9() ?
                regexp.op_match2_19(context) :
                regexp.op_match2(context);
    }
View Full Code Here

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

    @Override
    public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
        RubyRegexp regexp = (RubyRegexp) receiver.retrieve(context, self, currScope, currDynScope, temp);
        IRubyObject argValue = (IRubyObject) arg.retrieve(context, self, currScope, currDynScope, temp);

        return IRRuntimeHelpers.match3(context, regexp, argValue);
    }
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

    public void regexpFragmentCheck(RegexpNode end, ByteList value) {
        setRegexpEncoding(end, value);
        RubyRegexp.preprocessCheck(configuration.getRuntime(), value);
    }        // 1.9 mode overrides to do extra checking...
    private List<Integer> allocateNamedLocals(RegexpNode regexpNode) {
        RubyRegexp pattern = RubyRegexp.newRegexp(configuration.getRuntime(), regexpNode.getValue(), regexpNode.getOptions());
        pattern.setLiteral();
        String[] names = pattern.getNames();
        int length = names.length;
        List<Integer> locals = new ArrayList<Integer>();
        StaticScope scope = getCurrentScope();

        for (int i = 0; i < length; i++) {
View Full Code Here

        // 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 ((rubyRegexp == null) || !options.isOnce() || context.runtime.getKCode() != rubyRegexp.getKCode()) {
            RubyString[] pieces  = retrievePieces(context, self, currScope, currDynScope, temp);
            RubyString   pattern = RubyRegexp.preprocessDRegexp(context.runtime, pieces, options);
            RubyRegexp re = RubyRegexp.newDRegexp(context.runtime, pattern, options);
            re.setLiteral();
            rubyRegexp = re;
        }

        return rubyRegexp;
    }
View Full Code Here

    }

    // dynamic regexp
    public RubyRegexp construct(ThreadContext context, RubyString[] pieces) {
        RubyString pattern = RubyRegexp.preprocessDRegexp(context.runtime, pieces, options);
        RubyRegexp re = RubyRegexp.newDRegexp(context.runtime, pattern, options);
        re.setLiteral();

        return re;
    }
View Full Code Here

        return new RegexpObjectSite(type, options).bootstrap(lookup);
    }

    // normal regexp
    public IRubyObject construct(ThreadContext context, RubyString pattern) {
        RubyRegexp regexp = IRRuntimeHelpers.constructRubyRegexp(context, pattern, options);
        regexp.setLiteral();

        return regexp;
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubyRegexp

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.