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

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Thu, 18 Jun 2009 23:02:05 +0200

Romain Francois wrote:
> 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?
>
>

I would oppose that. Suggest ways to reduce the complexity of the parser interface and I'd be interested. It's a nightmare to make any changes there.

You can always call the R function wrapped in try(), so it's not as though this would give you anything that you don't already have access to.

Duncan Murdoch

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



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