Package org.joni

Examples of org.joni.Region


                RubyMatchData match = rubyRegex.updateBackRef(context, this, frame, matcher);
                match.use();
                if (regex.numberOfCaptures() == 0) {
                    repl = objAsString(context, block.yield(context, substr(matcher.getBegin(), matcher.getEnd() - matcher.getBegin())));
                } else {
                    Region region = matcher.getRegion();
                    repl = objAsString(context, block.yield(context, substr(region.beg[0], region.end[0] - region.beg[0])));
                }
                modifyCheck(bytes, size);
                frozenCheck();
                frame.setBackRef(match);
            } else {
                repl = rubyRegex.regsub(repl, this, matcher);
                rubyRegex.updateBackRef(context, this, frame, matcher);
            }

            final int beg;
            final int plen;
            if (regex.numberOfCaptures() == 0) {
                beg = matcher.getBegin();
                plen = matcher.getEnd() - beg;
            } else {
                Region region = matcher.getRegion();
                beg = region.beg[0];
                plen = region.end[0] - beg;
            }

            ByteList replValue = repl.value;
View Full Code Here


                if (regex.numberOfCaptures() == 0) {
                    begz = matcher.getBegin();
                    endz = matcher.getEnd();
                    val = objAsString(context, block.yield(context, substr(context.getRuntime(), begz, endz - begz)));
                } else {
                    Region region = matcher.getRegion();
                    begz = region.beg[0];
                    endz = region.end[0];
                    val = objAsString(context, block.yield(context, substr(context.getRuntime(), begz, endz - begz)));
                }
                modifyCheck(bytes, size);
                if (bang) {
                    frozenCheck();
                }
            } else {
                val = rubyRegex.regsub((RubyString) repl, this, matcher);
                if (regex.numberOfCaptures() == 0) {
                    begz = matcher.getBegin();
                    endz = matcher.getEnd();
                } else {
                    Region region = matcher.getRegion();
                    begz = region.beg[0];
                    endz = region.end[0];
                }
            }
View Full Code Here

                lastNull = false;
                if (limit && lim <= ++i) break;
            }
        } else {
            while ((end = matcher.search(start, range, Option.NONE)) >= 0) {
                final Region region = matcher.getRegion();
                if (start == end + begin && region.beg[0] == region.end[0]) {
                    if (value.realSize == 0) {                       
                        result.append(newEmptyString(runtime, getMetaClass()));
                        break;
                    } else if (lastNull) {
View Full Code Here

    }
   
    // group version
    private IRubyObject scanOnce(RubyRegexp regex, Matcher matcher, int range) {   
        if (matcher.search(matcher.value + value.begin, range, Option.NONE) >= 0) {
            Region region = matcher.getRegion();
            int end = region.end[0];
            if (region.beg[0] == end) {
                if (value.realSize > end) {
                    matcher.value = end + regex.getPattern().getEncoding().length(value.bytes, value.begin + end, range);
                } else {
View Full Code Here

        return result;
    }


    public RubyString regsub(RubyString str, RubyString src, Matcher matcher) {
        Region regs = matcher.getRegion();
        int mbeg = matcher.getBegin();
        int mend = matcher.getEnd();
       
        int p, s;
        p = s = 0;
View Full Code Here

     
      if(a == -1){
        return null;
      }
     
      Region region = matcher.getEagerRegion();
      return new Match(regex, region, target);

    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
View Full Code Here

  private void updateCharOffset() {
    if (charOffsetUpdated) return;
    int numRegs = region == null ? 1 : region.numRegs;
    if (charOffsets == null || charOffsets.numRegs < numRegs)
      charOffsets = new Region(numRegs);

    Pair[] pairs = new Pair[numRegs * 2];
    for (int i = 0; i < pairs.length; i++) pairs[i] = new Pair();
    int numPos = 0;
View Full Code Here

    private void updateCharOffset() {
        if (charOffsetUpdated) return;

        int numRegs = regs == null ? 1 : regs.numRegs;
        if (charOffsets == null || charOffsets.numRegs < numRegs) charOffsets = new Region(numRegs);

        Pair[]pairs = new Pair[numRegs * 2];
        for (int i = 0; i < pairs.length; i++) pairs[i] = new Pair();

        int numPos = 0;
View Full Code Here

       
        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

        if (val == null) return str;
        return RubyString.newString(str.getRuntime(), val);
    }

    static RubyString regsub19(RubyString str, RubyString src, Matcher matcher, Regex pattern) {
        Region regs = matcher.getRegion();

        int no = -1;
        ByteList bs = str.getByteList();
        int p = bs.getBegin();
        int s = p;
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.