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

Process multiple args in \Sexpr{} #738

Merged
merged 3 commits into from Jun 20, 2018

Conversation

Projects
None yet
2 participants
@jayhesselberth
Copy link
Collaborator

jayhesselberth commented Jun 20, 2018

Sexpr with multiple args like \Sexpr[results=rd,stage=build] were not parsed correctly. Changing commas to semicolons (i.e., results=rd;stage=build) enables rlang::parse_exprs() to parse multiple args.

Closes #720

Process multiple args in \Sexpr{}
Sexpr with multiple args \Sexpr[results=rd,stage=build] were not parsed correctly

Closes #720
@jayhesselberth

This comment has been minimized.

Copy link
Collaborator Author

jayhesselberth commented Jun 20, 2018

rlang::parse_exprs("results=rd,stage=build")
#> Error in parse(text = x): <text>:1:11: unexpected ','
#> 1: results=rd,
#>               ^

rlang::parse_exprs("results=rd;stage=build")
#> [[1]]
#> results = rd
#> 
#> [[2]]
#> stage = build

Created on 2018-06-19 by the reprex package (v0.2.0).

@hadley

This comment has been minimized.

Copy link
Member

hadley commented Jun 20, 2018

Can you please include a more direct test as well?

This doesn’t feel like the right fix to me — maybe we should be mapping parse_expr instead.

@jayhesselberth

This comment has been minimized.

Copy link
Collaborator Author

jayhesselberth commented Jun 20, 2018

Hmm parse_expr() just calls parse_exprs(), so it would still fail to parse comma-separated expressions (only handles semicolon and newlines).

https://github.com/r-lib/rlang/blob/194d541feac3c4111c05d85b1312d8357738ea4c/R/parse.R#L55-L66

@hadley

This comment has been minimized.

Copy link
Member

hadley commented Jun 20, 2018

Previously we were splitting the string into pieces

@jayhesselberth jayhesselberth merged commit a12358c into master Jun 20, 2018

6 checks passed

codecov/patch 100% of diff hit (target 85.24%)
Details
codecov/project 85.28% (+0.03%) compared to 67f9e83
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jayhesselberth jayhesselberth deleted the proc-sexpr branch Jun 24, 2018

krlmlr added a commit to r-dbi/DBI that referenced this pull request Sep 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment