[Rd] R_parseVector and syntax error [was: error messages while parsing with rniParse]

From: Romain Francois <romain.francois_at_dbmail.com>
Date: Thu, 18 Jun 2009 20:02:41 +0200

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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 18 Jun 2009 - 18:12:16 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 Thu 18 Jun 2009 - 23:30:58 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