Miles McBain
2019-Jul-05 11:31 UTC
[Rd] parse() drops parse data when encountering `` (bug?)
Hi, I've noticed that partial parse data from parse() is irretrivable when it errors due to encountering '``' - two backticks in sequence. The print output also looks more limited than a regular parser error which leads me to suspect this is a bug. If this is the case could someone with the authority please add it to R's bug tracker? My reprex follows. Thanks, Miles ``` r target_text <- "foo = 1 `` {r} foo = 2" tstfile = srcfile(tempfile()) parse(text = target_text, keep.source = TRUE, srcfile = tstfile) #> Error in parse(text = target_text, keep.source = TRUE, srcfile tstfile): attempt to use zero-length variable name getParseData(tstfile) #> NULL target_text2 <- "foo = 1 {r} foo = 2" tstfile = srcfile(tempfile()) parse(text = target_text2, keep.source = TRUE, srcfile = tstfile) #> Error in parse(text = target_text2, keep.source = TRUE, srcfile tstfile): /tmp/RtmpXuGaL1/file5434ebd1f95:1:9: unexpected '{' #> 1: foo = 1 { #> ^ getParseData(tstfile) #> line1 col1 line2 col2 id parent token terminal text #> 8 1 1 1 7 8 0 equal_assign FALSE #> 1 1 1 1 3 1 3 SYMBOL TRUE foo #> 3 1 1 1 3 3 8 expr FALSE #> 2 1 5 1 5 2 8 EQ_ASSIGN TRUE #> 4 1 7 1 7 4 5 NUM_CONST TRUE 1 #> 5 1 7 1 7 5 8 expr FALSE #> 6 1 9 1 9 6 0 '{' TRUE { sessionInfo() #> R version 3.6.0 (2019-04-26) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Pop!_OS 18.10 #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0 #> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0 #> #> locale: #> [1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C #> [3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8 #> [5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8 #> [7] LC_PAPER=en_AU.UTF-8 LC_NAME=C #> [9] LC_ADDRESS=C LC_TELEPHONE=C #> [11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> loaded via a namespace (and not attached): #> [1] compiler_3.6.0 magrittr_1.5 tools_3.6.0 htmltools_0.3.6 #> [5] yaml_2.2.0 Rcpp_1.0.1 stringi_1.4.3 rmarkdown_1.12 #> [9] highr_0.8 knitr_1.23 stringr_1.4.0 xfun_0.8 #> [13] digest_0.6.19 evaluate_0.14 ``` <sup>Created on 2019-07-05 by the [reprex package]( https://reprex.tidyverse.org) (v0.2.1)</sup> [[alternative HTML version deleted]]
Maybe Matching Threads
- [LLVMdev] Encountering flt_rounds_ in llvm3.3 for newlib compilation
- Help with a problem I've been frequently encountering
- Dovecot(-auth) crashes upon encountering a private key in .ssh
- [Bug 10637] New: rsync --link-dest should break hard links when encountering "Too many links"
- CVE-2019-10691: JSON encoder in Dovecot 2.3 incorrecty assert-crashes when encountering invalid UTF-8 characters.