From tom@@@k@liber@ @ending from gm@il@com  Thu Aug 16 10:06:55 2018
From: tom@@@k@liber@ @ending from gm@il@com (Tomas Kalibera)
Date: Thu, 16 Aug 2018 10:06:55 +0200
Subject: [Rd] Problem with parseData
In-Reply-To: <fda485ef-3ca1-6507-f227-51a5cb8af4a3@mtholyoke.edu>
References: <fda485ef-3ca1-6507-f227-51a5cb8af4a3@mtholyoke.edu>
Message-ID: <d4cdfe7e-10c1-eceb-b0c4-88c2ebfb000f@gmail.com>

Dear Barbara,

thank you for the report. This is something to be fixed in R - I am now 
testing a patch that adds the extra node for the equality assignment 
expression.

Best,
Tomas

On 07/30/2018 05:35 PM, Barbara Lerner wrote:
> Hi,
>
> I have run into a problem with parseData from the utils package.? When
> an assignment is done with = instead of <-, the information provided by
> parseData does not include an entry for the assignment.
>
> For this input, stored in file "BadPosition.R":
>
> y <- 5
> foo = 7
>
> And running this code:
>
> parsed <- parse("BadPosition.R", keep.source=TRUE)
> parsedData <- utils::getParseData (parsed, includeText=TRUE)
> print(paste("parseData =", parsedData))
>
> I get the following output:
>
> [1] "parseData = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2)"
> [2] "parseData = c(1, 1, 1, 3, 6, 6, 1, 1, 5, 7, 7)"
> [3] "parseData = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2)"
> [4] "parseData = c(6, 1, 1, 4, 6, 6, 3, 3, 5, 7, 7)"
> [5] "parseData = c(7, 1, 3, 2, 4, 5, 10, 12, 11, 13, 14)"
> [6] "parseData = c(0, 3, 7, 7, 5, 7, 12, 0, 0, 14, 0)"
> [7] "parseData = c(\"expr\", \"SYMBOL\", \"expr\", \"LEFT_ASSIGN\",
> \"NUM_CONST\", \"expr\", \"SYMBOL\", \"expr\", \"EQ_ASSIGN\",
> \"NUM_CONST\", \"expr\")"
> [8] "parseData = c(FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE,
> TRUE, TRUE, FALSE)"
> [9] "parseData = c(\"y <- 5\", \"y\", \"y\", \"<-\", \"5\", \"5\",
> \"foo\", \"foo\", \"=\", \"7\", \"7\")"
>
> Notice how there is an entry for "y <- 5" beginning on line 1, column 1,
> ending at line 1, column 6, but there is no analogous entry for "foo = 7".
>
> I am running R 3.5.0 on a Mac running 10.12.6.
>
> Thanks for your help and please let me know if you need any further
> information.
>
> Barbara
>



[Rd] Problem with parseData
Tomas Kalibera