Package org.joni

Examples of org.joni.Region


       
        return nth_match(i, match);
    }

    static RubyString regsub(RubyString str, RubyString src, Matcher matcher, Encoding enc) {
        Region regs = matcher.getRegion();
       
        int no = -1;
        ByteList bs = str.getByteList();
        int p = bs.getBegin();
        int s = p;
View Full Code Here


        int no = 0, clen[] = {0};
        Encoding strEnc = EncodingUtils.encGet(context, str);
        Encoding srcEnc = EncodingUtils.encGet(context, src);
        boolean acompat = EncodingUtils.encAsciicompat(strEnc);

        Region regs = matcher.getRegion();
        ByteList bs = str.getByteList();
        ByteList srcbs = src.getByteList();
        byte[] sBytes = bs.getUnsafeBytes();

        p = s = bs.getBegin();
View Full Code Here

            p = q;
        }
    }

    private void updateCharOffsetOnlyOneReg(ByteList value, Encoding encoding) {
        if (charOffsets == null || charOffsets.numRegs < 1) charOffsets = new Region(1);
       
        if (encoding.maxLength() == 1) {
            charOffsets.beg[0] = begin;
            charOffsets.end[0] = end;
            charOffsetUpdated = true;
View Full Code Here

    }

    private void updateCharOffsetManyRegs(ByteList value, Encoding encoding) {
        int numRegs = regs.numRegs;

        if (charOffsets == null || charOffsets.numRegs < numRegs) charOffsets = new Region(numRegs);
       
        if (encoding.maxLength() == 1) {
            for (int i = 0; i < numRegs; i++) {
                charOffsets.beg[i] = regs.beg[i];
                charOffsets.end[i] = regs.end[i];
View Full Code Here

    public RubyArray split(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
        return split19(context, arg0, arg1);
    }

    private void populateCapturesForSplit(Ruby runtime, RubyArray result, Matcher matcher, boolean is19) {
        Region region = matcher.getRegion();
        for (int i = 1; i < region.numRegs; i++) {
            int beg = region.beg[i];
            if (beg == -1) continue;
            result.append(is19 ? makeShared19(runtime, beg, region.end[i] - beg) : makeShared(runtime, beg, region.end[i] - beg));
        }
View Full Code Here

            return end;
        }
    }

    private IRubyObject populateCapturesForScan(Ruby runtime, Matcher matcher, int range, int tuFlags, boolean is19) {
        Region region = matcher.getRegion();
        RubyArray result = getRuntime().newArray(region.numRegs);
        for (int i=1; i<region.numRegs; i++) {
            int beg = region.beg[i];
            if (beg == -1) {
                result.append(runtime.getNil());
View Full Code Here

            nerror++;
            return Matcher.FAILED;
        }

        Matcher m = reg.matcher(str, 0, length(str));
        Region region;

        int r = 0;
        try {
            r = m.search(0, length(str), Option.NONE);
            region = m.getEagerRegion();
View Full Code Here

            nerror++;
            return;
        }

        Matcher m = reg.matcher(str, 0, length(str));
        Region region;

        int r = 0;
        try {
            r = m.searchInterruptible(0, length(str), Option.NONE);
            region = m.getEagerRegion();
View Full Code Here

TOP

Related Classes of org.joni.Region

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.