@Internal("all.names") public static StringVector allNames(SEXP expr, boolean function, int maxNames, boolean unique) { AllNamesVisitor visitor = new AllNamesVisitor(); visitor.includeFunctionNames = function; visitor.maxNames = maxNames; visitor.unique = unique; expr.accept(visitor); return visitor.names.build(); }
@Override public void visit(FunctionCall call) { if (includeFunctionNames) { call.getFunction().accept(this); } for (SEXP expr : call.getArguments().values()) { expr.accept(this); } }
@Override public void visit(ExpressionVector vector) { for (SEXP expr : vector) { expr.accept(this); } }
private static SEXP substitute(SEXP exp, SubstituteContext context) { SubstitutingVisitor visitor = new SubstitutingVisitor(context); exp.accept(visitor); return visitor.getResult(); }