Hi, I discovered the following strange behavior in parse () on syntactically incorrect statements. This is on R 2.3.0 (linux). It may or may not have been present earlier than 2.3.0, but I only discovered it recently. I can see no mention of it in the NEWS file from trunk.
Consider these statements (the output I get is shown commented below each statement): bad.syntax <- ")\nprint (\"hello\")\nprint (\"world\")" try (parse (text=bad.syntax, n=-1)) # OK # Error in parse(file, n, text, prompt) : syntax error in ")" try (parse (text=bad.syntax, n=1)) # OK # Error in parse(file, n, text, prompt) : syntax error in ")" try (parse (text=bad.syntax, n=2)) # No error! # NULL try (parse (text=bad.syntax, n=3)) # No error! # NULL try (parse (text=bad.syntax, n=4)) # Misleading message # Error in parse(file, n, text, prompt) : syntax error in: # "print ("hello") # print ("world")" Probably there are not too many use cases of parse (n=x) with x not either -1 or 1, so it should not be a grave problem, but it just doesn't look right. Regards Thomas
pgpe609NxvQLc.pgp
Description: PGP signature
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel