diff --git a/jasspa/macros/r.eaf b/jasspa/macros/r.eaf index e8177e1..d0e77b1 100644 --- a/jasspa/macros/r.eaf +++ b/jasspa/macros/r.eaf @@ -5,7 +5,7 @@ elif "elseif (\p) {\r\r}\P" " elif" else "else {\r\p}\r\P" " else" while "while (\p) {\r\r}\P" " while" func "\p <- function (...) {\r\r}\P" " func" -main "main <- function (argv) {\r\r}\rif (sys.nframe() == 0L && !interactive()) {\r main(commandArgs(trailingOnly=TRUE))\r}" " main" +main "main <- function (argv) {\r \p\r\B}\rif (sys.nframe() == 0L && !interactive()) {\r binname=gsub(\"--file=\",\"\",grep(\"--file\",commandArgs(),value=TRUE)[1])\rmain(c(binname,commandArgs(trailingOnly=TRUE)))\r\B}\r\P" " main" openw "fout = file(\"\pfilename\",'w')\rcat(\"hello line\\n\",file=fout)\rclose(fout)\r\P" " openw" openr "fin = file(\"\pfilename\", \"r\")\rwhile(length((line = readLines(fin,n=1)))>0) {\r print(line)\r}\rclose(fin)" " openr" "" ""