Skip to content
Snippets Groups Projects
Commit 8fd1e68b authored by Mick Jordan's avatar Mick Jordan
Browse files

Merge pull request #118 in G/fastr from ~MICK.JORDAN_ORACLE.COM/fastr:bugfix/somebug to master

* commit 'dfca6c69':
  fix regexpr/gregexpr bug then fixed=FALSE
parents af4904eb dfca6c69
No related branches found
No related tags found
No related merge requests found
......@@ -574,6 +574,7 @@ public class GrepFunctions {
for (int i = 0; i < vector.getLength(); i++) {
result[i] = findIndex(pattern, vector.getDataAt(i), ignoreCase, fixedL == RRuntime.LOGICAL_TRUE).get(0);
}
// TODO attribute as per spec
return RDataFactory.createIntVector(result, RDataFactory.COMPLETE_VECTOR);
}
......@@ -614,13 +615,15 @@ public class GrepFunctions {
@TruffleBoundary
@Override
protected Object regexp(RAbstractStringVector patternArg, RAbstractStringVector vector, byte ignoreCaseL, byte perlL, byte fixedL, byte useBytesL) {
checkExtraArgs(RRuntime.LOGICAL_FALSE, perlL, fixedL, useBytesL, RRuntime.LOGICAL_FALSE);
checkExtraArgs(RRuntime.LOGICAL_FALSE, perlL, RRuntime.LOGICAL_FALSE, useBytesL, RRuntime.LOGICAL_FALSE);
boolean ignoreCase = RRuntime.fromLogical(ignoreCaseL);
String pattern = RegExp.checkPreDefinedClasses(patternArg.getDataAt(0));
boolean fixed = RRuntime.fromLogical(fixedL);
Object[] result = new Object[vector.getLength()];
for (int i = 0; i < vector.getLength(); i++) {
int[] data = toIntArray(findIndex(pattern, vector.getDataAt(i), ignoreCase, true));
int[] data = toIntArray(findIndex(pattern, vector.getDataAt(i), ignoreCase, fixed));
result[i] = RDataFactory.createIntVector(data, RDataFactory.COMPLETE_VECTOR);
// TODO attributes as per spec
}
return RDataFactory.createList(result);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment