In the latest version R2.7.0 the following command does not work anymore:
x <- eval(parse(prompt = paste("give value for x > ")))
It does give the pompt, but the object x is not created.
We think this is due to a bug in the function parse.
best regards,
Wout Slob
____________________________________________________________________________
DISCLAIMER: http://www.rivm.nl/disclaimer.htm\ ...{{dro...{{dropped:3}}
bug in R 2.7.0 (PR#11497)
5 messages · Wout.Slob at rivm.nl, Peter Dalgaard, Bill Dunlap +1 more
Wout.Slob at rivm.nl wrote:
In the latest version R2.7.0 the following command does not work anymore:
x <- eval(parse(prompt = paste("give value for x > ")))
It does give the pompt, but the object x is not created.
We think this is due to a bug in the function parse.
best regards,
Wout Slob
(A more specific Subject: would have been helpful.) More succinctly, parse() from stdin() seems to be broken:
parse()
?a expression() This was not the case in January (this was the older version I had lying around): R version 2.6.2 alpha (2008-01-29 r44233) ....
parse()
?a expression(a)
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
On Thu, 22 May 2008, Peter Dalgaard wrote:
More succinctly, parse() from stdin() seems to be broken:
parse()
?a expression() This was not the case in January (this was the older version I had lying around): R version 2.6.2 alpha (2008-01-29 r44233) ....
parse()
?a expression(a)
Also, if your input starts with certain errors, parse returns the stuff after the error: > parse() ?err//one expression(one) After the attached change we get > parse() ?one expression(one) > parse(n=2) ?one;two;three expression(one, two) > parse() ?err//one Error in parse() : unexpected '/' in "err//" Index: gram.y =================================================================== --- gram.y (revision 45762) +++ gram.y (working copy) @@ -1389,8 +1389,6 @@ if (c == ';' || c == '\n') break; } - rval = R_Parse1Buffer(buffer, 1, status); - /* Was a call to R_Parse1Buffer, but we don't want to reset xxlineno and xxcolno */ ParseInit(); ParseContextInit();
On Thu, 22 May 2008, Bill Dunlap wrote:
Also, if your input starts with certain errors, parse returns the stuff after the error:
> parse()
?err//one expression(one) After the attached change we get
> parse()
?one expression(one)
> parse(n=2)
?one;two;three expression(one, two)
> parse()
?err//one Error in parse() : unexpected '/' in "err//" Index: gram.y =================================================================== --- gram.y (revision 45762) +++ gram.y (working copy) @@ -1389,8 +1389,6 @@ if (c == ';' || c == '\n') break; } - rval = R_Parse1Buffer(buffer, 1, status); - /* Was a call to R_Parse1Buffer, but we don't want to reset xxlineno and xxcolno */ ParseInit(); ParseContextInit();
The bug arose 2008-02-14, revision 44472, src/main/gram.y,
where it looks like it was intended that the call to
R_Parse1Buffer be replaced by most of the contents of
R_Parse1Buffer, but the the call itself was not removed
(the comment says it was). My change makes the comment
true.
@@ -1400,6 +1406,12 @@
rval = R_Parse1Buffer(buffer, 1, status);
+ /* Was a call to R_Parse1Buffer, but we don't want to reset xxlineno and x
xcolno */
+ ParseInit();
+ ParseContextInit();
+ R_Parse1(status);
+ rval = R_CurrentExpr;
+
switch(*status) {
Thanks for the analysis and fix. I'm not sure how that slipped by. I'll commit your patch. Duncan Murdoch
On 22/05/2008 5:52 PM, Bill Dunlap wrote:
On Thu, 22 May 2008, Bill Dunlap wrote:
Also, if your input starts with certain errors, parse returns the stuff after the error:
> parse()
?err//one expression(one) After the attached change we get
> parse()
?one expression(one)
> parse(n=2)
?one;two;three expression(one, two)
> parse()
?err//one Error in parse() : unexpected '/' in "err//" Index: gram.y =================================================================== --- gram.y (revision 45762) +++ gram.y (working copy) @@ -1389,8 +1389,6 @@ if (c == ';' || c == '\n') break; } - rval = R_Parse1Buffer(buffer, 1, status); - /* Was a call to R_Parse1Buffer, but we don't want to reset xxlineno and xxcolno */ ParseInit(); ParseContextInit();
The bug arose 2008-02-14, revision 44472, src/main/gram.y,
where it looks like it was intended that the call to
R_Parse1Buffer be replaced by most of the contents of
R_Parse1Buffer, but the the call itself was not removed
(the comment says it was). My change makes the comment
true.
@@ -1400,6 +1406,12 @@
rval = R_Parse1Buffer(buffer, 1, status);
+ /* Was a call to R_Parse1Buffer, but we don't want to reset xxlineno and x
xcolno */
+ ParseInit();
+ ParseContextInit();
+ R_Parse1(status);
+ rval = R_CurrentExpr;
+
switch(*status) {
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel