fastr icon indicating copy to clipboard operation
fastr copied to clipboard

Accurate report of Syntax error

Open hpb-htw opened this issue 4 years ago • 0 comments

Syntax error is not so accurate reported, if I source a R-Script via source. For example: given a R-Script /tmp/syntax-error.R

ifactor <- function(number){
#' calculate prime factors of an integer.
        n <- number;
        f <- c();
        i <- 2;
        while(i<=n){
                 while(n %% i == 0){
                        f <- c(f,i);
                        n <- n/i;
                 };
                 i <- i+1;
        ; //Error here
        return (f)
}

now I execute

setwd("/tmp/");source("syntax-error.R");

In a GNU-R Shell I got

Error in source("syntax-error.R") : syntax-error.R:12:11: unexpected '/'
11:                  i <- i+1;
12:         ; /

but in a FastR I just got

Error in source("syntax-error.R") : parse error

It is more useful for users if the report has some information about file, error line, any maybe error column.

hpb-htw avatar Jul 14 '20 10:07 hpb-htw