[Rd] Parsing code with newlines

From: Peter Jaeger <pcovariant_at_googlemail.com>
Date: Mon, 04 Aug 2008 14:50:05 +0200


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]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 04 Aug 2008 - 12:57:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 04 Aug 2008 - 15:35:48 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive