Dear List,

When I try to parse code containing newline characters with R_ParseVector, I
get a compilation error. How can I compile code that includes comments and
newlines?

I am using the following:

void* my_compile(char *code)
{
    SEXP cmdSexp, cmdExpr = R_NilValue;
    ParseStatus status;

    PROTECT (cmdSexp = allocVector (STRSXP, 1));
    SET_STRING_ELT (cmdSexp, 0, mkChar (code));
    PROTECT (cmdExpr = R_ParseVector (cmdSexp,-1,&status,
        R_NilValue));
    UNPROTECT_PTR (cmdSexp);

    if (status != PARSE_OK) {
        return (void*)0;
    } else {
        return (void*)cmdExpr;
    }
}

Regards,
Peter

	[[alternative HTML version deleted]]

