search for: r_parse1buffer

Displaying 7 results from an estimated 7 matches for "r_parse1buffer".

2008 Sep 03
8
suggestion of new API function for embedded programming.
While doing some embedded programming and trying to figure out how to generate a hand coded SEXP equivalent of the line "t.test(x,conf.level=(1-p))$conf.int[2]" I had an idea for an addition to the embedded API. There are a number of hidden or static parse functions (R_ParseBuffer, R_Parse1Buffer, etc.) which take an IoBuffer* and returns a parsed tree. If one or more of these functions were exported to the Rembedded.h API we could do something like the following: R_Expr = R_Parse1Buffer(&R_ConsoleIob, 0, &status); if (PARSE_OK==status) { ... value = eval(R_CurrentExpr...
2006 Jun 29
3
Continuation and parse
Hi gurus, After an unsuccessful scrabble through the documentation and Jon's excellent search facility, I am no wiser as to how R recognizes an incomplete command line and politely raises its hand for more. The help page for parse gives no indication that it does anything more than spit the dummy when fed an incomplete command line, but something in there must recognize such ellipsis.
2006 Jun 29
3
Continuation and parse
Hi gurus, After an unsuccessful scrabble through the documentation and Jon's excellent search facility, I am no wiser as to how R recognizes an incomplete command line and politely raises its hand for more. The help page for parse gives no indication that it does anything more than spit the dummy when fed an incomplete command line, but something in there must recognize such ellipsis.
2007 Jan 18
0
Emulating a REPL in frontends
...level_callbacks) { int c; ParseStatus status; SEXP value; SEXP rho = R_GlobalEnv; Rboolean wasDisplayed = FALSE; while((c = *buffer++)) { R_IoBufferPutc(c, &R_ConsoleIob); if(c == ';' || c == '\n') break; } R_PPStackTop = 0; R_CurrentExpr = R_Parse1Buffer(&R_ConsoleIob, 0, &status); if(parse_status) *parse_status = status; switch(status) { case PARSE_NULL: R_IoBufferWriteReset(&R_ConsoleIob); break; case PARSE_OK: R_IoBufferReadReset(&R_ConsoleIob); R_CurrentExpr = R_Parse1Buffer(&R_ConsoleIob, 1, &status...
2000 Oct 03
0
FW: Parse Errors
...ion that is based on Baier's function R_Proxy_evaluate contained in proxy_impl.c -- when I issue an invalid command to R such as "plo(x)" the program crashes. There is code in R_Proxy_evaluate to test for a parse error before actually generating code and issuing the command - He calls R_Parse1Buffer(&lBuffer,0,&lStatus) and then tests the value of lStatus for parse error. The trouble is that lStatus == PARSE_OK even though the command is invalid, so the evaluation continues until eval() is called, at which point R terminates and crashes the program. (It does write an error message to...
2000 Oct 03
2
Parse Errors
...ion that is based on Baier's function R_Proxy_evaluate contained in proxy_impl.c -- when I issue an invalid command to R such as "plo(x)" the program crashes. There is code in R_Proxy_evaluate to test for a parse error before actually generating code and issuing the command - He calls R_Parse1Buffer(&lBuffer,0,&lStatus) and then tests the value of lStatus for parse error. The trouble is that lStatus == PARSE_OK even though the command is invalid, so the evaluation continues until eval() is called, at which point R terminates and crashes the program. (It does write an error message to...
2000 Oct 03
2
Parse Errors
...ion that is based on Baier's function R_Proxy_evaluate contained in proxy_impl.c -- when I issue an invalid command to R such as "plo(x)" the program crashes. There is code in R_Proxy_evaluate to test for a parse error before actually generating code and issuing the command - He calls R_Parse1Buffer(&lBuffer,0,&lStatus) and then tests the value of lStatus for parse error. The trouble is that lStatus == PARSE_OK even though the command is invalid, so the evaluation continues until eval() is called, at which point R terminates and crashes the program. (It does write an error message to...