Displaying 20 results from an estimated 4000 matches similar to: "getParseData() for imaginary numbers"
2013 Jul 05
3
should the text for RIGHT_ASSIGN be -> in getParseData()?
Hi,
The text column for '->' becomes '<-' in the data frame returned by
getParseData():
> getParseData(parse(text='1->x'))
line1 col1 line2 col2 id parent token terminal text
7 1 1 1 4 7 0 expr FALSE
1 1 1 1 1 1 2 NUM_CONST TRUE 1
2 1 1 1 1 2 7 expr FALSE
3
2014 Jun 12
1
regression bug with getParseData and/or parse in R-3.1.0
Hi,
With R-3.1.0 I get:
> getParseData(parse(text = "{1}", keep.source = TRUE))
line1 col1 line2 col2 id parent token terminal text
7 1 1 1 3 7 9 expr FALSE
1 1 1 1 1 1 7 '{' TRUE {
2 1 2 1 2 2 3 NUM_CONST TRUE 1
3 1 2 1 2 3 5 expr FALSE
4 1 3 1
2020 Jan 15
4
A bug understanding F relative to FALSE?
Hi all,
Is the next behaviour suitable?
identical(F,FALSE)
## [1] TRUE
utils::getParseData(parse(text = "c(F,FALSE)", keep.so=rce = TRUE))
## line1 col1 line2 col2 id parent token terminal text
## 14 1 1 1 10 14 0 expr FALSE
## 1 1 1 1 1 1 3 SYMBOL_FUNCTION_CALL TRUE c
## 3 1 1 1 1 3
2015 Jul 29
3
Mapping parse tree elements to tokens
Probably need a generic tree based on "ParseNode" objects that
associate the line information with the symbol (for leaf nodes). As
Duncan notes, it should be possible to gather that from the table.
But it would be nice if there was an "expr" column in the parse data
column in addition to "text". It would contain the parsed object.
Otherwise, to use the table, one is
2012 Jul 18
1
Changes to parser in R-devel
I have just committed (in r59883) some changes to the R parser based on
Romain Francois' parser package. Packages that made use of parser will
hopefully find that the information in base R gives them what they need
to work with, but the data is not identical to
what parser recorded (since it was not consistent with some things
already in R). One reason for the change was that the parser
2014 Jan 25
0
interpreting the output of getParseData()
Hi,
I'm trying to make sense of the output of getParseData(). The "parent" column is supposed to refer to the "id" of the parent of the given item, but there are numbers in the parent column that do not exist in the id column. Example:
> p <- parse(text="f<-function(){if(TRUE)1 else 2}")
> df <- getParseData(p)
> df
line1 col1 line2 col2 id
2015 Jul 29
2
Mapping parse tree elements to tokens
I would like to map the parsed tokens obtained from utils::getParseData()
to the parse tree and elements obtained by base::parse().
It looks like back when this code was in the parser package the parse()
function annotated the elements in the tree with their id, which would
allow you to perform this mapping. However when the code was included in R
this functionality was removed.
?getParseData
2015 Jul 29
2
Mapping parse tree elements to tokens
I have two use cases in mind:
1) Code indexing/searching, where the table gets me almost all of the
way there, except I ask for all of the text (including the calls) and
then parse that, because it's nice to get back an actual code object
when you are searching code (in addition to where the code lives). The
extra parsing step is just a minor inconvenience.
2) Code analysis, which I'm
2015 Jul 29
1
Mapping parse tree elements to tokens
As Michael guessed my main use cases was code analysis. A concrete example
where this would help is with my test code coverage tool covr. There is
currently a bug when tracking coverage for if / else statements when the
clauses do not contain brackets (https://github.com/jimhester/covr/issues/39).
Because only one source reference is generated in this case (because it is
parsed as a single
2018 Jul 30
2
Problem with parseData
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 <-
2018 Oct 02
1
Problem with parseData
The fix is now in R-devel, 75386. I have not ported to R-patched,
because the fix breaks two packages which are working around this bug
(and to my knowledge without having reported it before). So thanks again
for the report!
Best
Tomas
On 08/16/2018 10:06 AM, Tomas Kalibera wrote:
> Dear Barbara,
>
> thank you for the report. This is something to be fixed in R - I am
> now
2011 Mar 05
1
file mode lost in file.copy()?
Hi,
Recently I noticed file.copy() would discard the file mode
information. Is this the expected behaviour or a bug for file.copy()?
> file.create('testfile')
[1] TRUE
> file.info('testfile')
size isdir mode mtime ctime
testfile 0 FALSE 644 2011-03-05 17:06:39 2011-03-05 17:06:39
atime uid gid uname grname
2011 Mar 05
1
file mode lost in file.copy()?
Hi,
Recently I noticed file.copy() would discard the file mode
information. Is this the expected behaviour or a bug for file.copy()?
> file.create('testfile')
[1] TRUE
> file.info('testfile')
size isdir mode mtime ctime
testfile 0 FALSE 644 2011-03-05 17:06:39 2011-03-05 17:06:39
atime uid gid uname grname
2013 Jan 04
1
Bug in R CMD check for \ in Rd?
Hi,
I have a function knit_expand() and its source/Rd are below:
https://github.com/yihui/knitr/blob/master/R/template.R#L43-L44
https://github.com/yihui/knitr/blob/master/man/knit_expand.Rd
When I run R CMD check on the package I get this warning (with both R
2.15.2 and R-devel):
* checking for code/documentation mismatches ... WARNING
Codoc mismatches from documentation object
2015 Jul 29
0
Mapping parse tree elements to tokens
On 29/07/2015 12:13 PM, Jim Hester wrote:
> I would like to map the parsed tokens obtained from utils::getParseData()
> to the parse tree and elements obtained by base::parse().
>
> It looks like back when this code was in the parser package the parse()
> function annotated the elements in the tree with their id, which would
> allow you to perform this mapping. However when the
2011 Jan 05
2
convert expressions to characters
Hi,
Suppose I have
x = parse(text = "
{y=50+50+50#'asfasf'
}
")
now x is an expression with some src attributes.
> x
expression({y=50+50+50#'asfasf'
})
attr(,"srcfile")
<text>
attr(,"wholeSrcref")
{y=50+50+50#'asfasf'
}
My question is, how can I get my string back (the string passed to
parse() as the text argument)?
>
2010 Sep 18
1
Check for updates under Windows (Was: a reliable way to check the latest version of R on CRAN?)
Dear R developers,
I asked this question in r-help list but have not got a definite
solution yet, and I think it might be more appropriate to ask
developers or CRAN maintainers directly. Many software packages often
have a menu item like "Check for updates" under the "Help" menu, e.g.
Filezilla and Firefox, and I believe it is also necessary for R (at
least for R GUI under
2020 Apr 22
1
[External] parse data wrong for R 4.0. raw strings
I don't know, maybe it would make sense to keep the whole expression,
that's the text of the tag after all.
Also, if we don't keep the whole expression, then it is not a valid
string literal any more, because it does not have quoting.
I can try to look into a patch. This is for 4.1 I believe, so in some
sense it is not urgent?
Gabor
On Wed, Apr 22, 2020 at 3:31 PM <luke-tierney
2015 Jul 29
0
Mapping parse tree elements to tokens
On 29/07/2015 2:30 PM, Michael Lawrence wrote:
> Probably need a generic tree based on "ParseNode" objects that
> associate the line information with the symbol (for leaf nodes). As
> Duncan notes, it should be possible to gather that from the table.
>
> But it would be nice if there was an "expr" column in the parse data
> column in addition to
2020 Apr 22
2
parse data wrong for R 4.0. raw strings
This seems like a bug to me:
code <- 'x <- r"(hello, "world")"'
getParseData(parse(text = code))
#> line1 col1 line2 col2 id parent token terminal text
#> 7 1 1 1 24 7 0 expr FALSE
#> 1 1 1 1 1 1 3 SYMBOL TRUE x
#> 3 1 1 1 1 3 7 expr