Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d19ab4631e76^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7956a28161b0
Choose a head ref

Commits on Mar 25, 2015

  1. Copy the full SHA
    d19ab46 View commit details
  2. Copy the full SHA
    87b100f View commit details
  3. Tweaks for String#rindex.

    headius committed Mar 25, 2015
    Copy the full SHA
    44146c4 View commit details
  4. Copy the full SHA
    88f0db2 View commit details

Commits on Mar 26, 2015

  1. Copy the full SHA
    3469f15 View commit details
  2. Port missing bits of String#scan that do simple search with string.

    rb_memsearch renamed to something a bit less C-like.
    headius committed Mar 26, 2015
    Copy the full SHA
    b91937a View commit details
  3. Remove unused import.

    headius committed Mar 26, 2015
    Copy the full SHA
    2499c77 View commit details
  4. Copy the full SHA
    c9a868d View commit details
  5. MRI does not have this check.

    headius committed Mar 26, 2015
    Copy the full SHA
    4c32db8 View commit details
  6. IDE reformatted.

    headius committed Mar 26, 2015
    Copy the full SHA
    5b9c9ed View commit details
  7. Copy the full SHA
    0bf7559 View commit details
  8. Copy the full SHA
    1dc6fa6 View commit details
  9. Copy the full SHA
    a1b39e7 View commit details
  10. Botched this part.

    headius committed Mar 26, 2015
    Copy the full SHA
    ebf7836 View commit details
  11. Copy the full SHA
    c765b8a View commit details
  12. Copy the full SHA
    9526ae7 View commit details
  13. Wrong value for len.

    headius committed Mar 26, 2015
    Copy the full SHA
    7c87bbd View commit details

Commits on Mar 27, 2015

  1. Revert to version that doesn't handle exception.

    We need to fix these to return the values in MRI, since much of
    our logic depends on making decisions based on these retvals.
    headius committed Mar 27, 2015
    Copy the full SHA
    07f2d97 View commit details
  2. Fixes for each_line.

    * Properly get *current* default separator, not default default.
    * Pass separator to Enumerator.
    headius committed Mar 27, 2015
    Copy the full SHA
    980d946 View commit details
  3. Minor reformat.

    headius committed Mar 27, 2015
    Copy the full SHA
    ec79402 View commit details
  4. These all pass now.

    headius committed Mar 27, 2015
    Copy the full SHA
    4fad41c View commit details
  5. Copy the full SHA
    7956a28 View commit details
39 changes: 39 additions & 0 deletions core/src/main/java/org/jruby/RubyMatchData.java
Original file line number Diff line number Diff line change
@@ -642,4 +642,43 @@ public RubyFixnum hash() {
return getRuntime().newFixnum(pattern.hashCode() ^ str.hashCode());
}

/**
* Get the begin offset of the given region, or -1 if the region does not exist.
*
* @param i the region for which to fetch the begin offset
* @return the begin offset for the region
*/
public int begin(int i) {
if (regs == null) {
if (i > 1) return -1;
return begin;
}
if (i > regs.numRegs) return -1;
return regs.beg[i];
}

/**
* Get the end offset of the given region, or -1 if the region does not exist.
*
* @param i the region for which to fetch the end offset
* @return the end offset for the region
*/
public int end(int i) {
if (regs == null) {
if (i > 1) return -1;
return end;
}
if (i > regs.numRegs) return -1;
return regs.end[i];
}

/**
* Fetch the number of regions in this match.
*
* @return the number of regions in this match
*/
public int numRegs() {
return regs == null ? 1 : regs.numRegs;
}

}
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/RubyRegexp.java
Original file line number Diff line number Diff line change
@@ -1574,8 +1574,8 @@ public final int search19(ThreadContext context, RubyString str, int pos, boolea
int result = -1;
IRubyObject match;
// Region regs = null;
ByteList rangeBL = str.getByteList();
int range = rangeBL.begin();
ByteList strBL = str.getByteList();
int range = strBL.begin();
Regex reg;
boolean tmpreg;

@@ -1603,10 +1603,10 @@ public final int search19(ThreadContext context, RubyString str, int pos, boolea
if (!reverse) {
range += str.size();
}
Matcher matcher = reg.matcher(rangeBL.unsafeBytes(), rangeBL.begin(), rangeBL.begin() + rangeBL.realSize());
Matcher matcher = reg.matcher(strBL.unsafeBytes(), strBL.begin(), strBL.begin() + strBL.realSize());
JOniException exception = null;
try {
result = matcherSearch(runtime, matcher, rangeBL.begin() + pos, range, RE_OPTION_NONE);
result = matcherSearch(runtime, matcher, strBL.begin() + pos, range, RE_OPTION_NONE);
} catch (JOniException je) {
exception = je;
}
Loading