Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse_exprs() fails with empty strings #954

Closed
DavisVaughan opened this issue Mar 27, 2020 · 1 comment
Closed

parse_exprs() fails with empty strings #954

DavisVaughan opened this issue Mar 27, 2020 · 1 comment

Comments

@DavisVaughan
Copy link
Member

DavisVaughan commented Mar 27, 2020

Should \n be used to collapse character vectors rather than ;?

library(rlang)

x <- c("1 + 1", "", "1 + 2")

parse_exprs(x)
#> Error in parse(text = x): <text>:1:8: unexpected ';'
#> 1: 1 + 1; ;
#>            ^

xx <- paste0(x, collapse = "\n")

parse(text = xx)
#> expression(1 + 1, 1 + 2)

as.list(parse(text = xx))
#> [[1]]
#> 1 + 1
#> 
#> [[2]]
#> 1 + 2
@lionel-
Copy link
Member

lionel- commented Mar 27, 2020

Ah yes that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants