Skip to content
Snippets Groups Projects
Commit 87b2df88 authored by stepan's avatar stepan
Browse files

CharMatch converted to cast pipelines

parent 55d3898e
Branches
No related tags found
No related merge requests found
......@@ -10,12 +10,15 @@
*/
package com.oracle.truffle.r.nodes.builtin.base;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.stringValue;
import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE;
import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.r.nodes.builtin.CastBuilder;
import com.oracle.truffle.r.nodes.builtin.RBuiltinNode;
import com.oracle.truffle.r.runtime.RError;
import com.oracle.truffle.r.runtime.RError.Message;
import com.oracle.truffle.r.runtime.RRuntime;
import com.oracle.truffle.r.runtime.builtins.RBuiltin;
import com.oracle.truffle.r.runtime.data.RDataFactory;
......@@ -27,6 +30,8 @@ public abstract class CharMatch extends RBuiltinNode {
@Override
protected void createCasts(CastBuilder casts) {
casts.arg("x").mustBe(stringValue(), RError.NO_CALLER, Message.ARG_IS_NOT_OF_MODE, "character");
casts.arg("table").mustBe(stringValue(), RError.NO_CALLER, Message.ARG_IS_NOT_OF_MODE, "character");
casts.arg("noMatch").asIntegerVector().findFirst(RRuntime.INT_NA);
}
......
......@@ -694,6 +694,7 @@ public final class RError extends RuntimeException {
ROWSUM_NAMES_NOT_CHAR("row names are not character"),
ROWSUM_NON_NUMERIC("non-numeric matrix in rowsum(): this should not happen"),
ARGUMENTS_REQUIRED_COUNT("%d arguments to '%s' which requires %d"),
ARG_IS_NOT_OF_MODE("argument is not of mode %s"),
ARGUMENT_LENGTH_0("argument of length 0"),
MUST_BE_VECTOR_BUT_WAS("'%s' must be of a vector type, was '%s'"),
SYSTEM_CHAR_ARG("non-empty character argument expected"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment