Hello, [I'm redirecting this here from stats-rosuda-devel] When parsing R code through R_parseVector and the code generates an error (syntax error), is there a way to grab the error. It looks like yyerror populates the buffer "R_ParseErrorMsg", but then the variable is not part of the public api. Would it be possible to add yet another entry point to the parser that would basically wrap R_parseVector so that it would have an extra char* argument that would bring back the error message if there is an error? Romain
Simon Urbanek wrote:
On Jun 15, 2009, at 12:05 , Romain Francois wrote:
Hello, In JRI, is there a way to get the error message that is generated by the parser through rniParse For example, if I have this : long y = re.rniParse( "rnorm( 10 ))", 1 ) ; this obviously generates a parse error, so y will be the same as (R_NilValue) : long null_id = re.rniEval( re.rniParse( "NULL", 1 ), 0 ) ; I guess the underlying question is : "Is R_ParseErrorMsg exposed to JRI".
AFAICT R_ParseErrorMsg and friends are not exposed by the R API - they are not accessible outside, so they cannot be use by JRI. It would be nice if there was a way of accessing that info, but R doesn't currently support that. Cheers, Simon
The reason is I would like to bring back the message as part of an exception generated when the code does not parse. Romain
Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr