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

Allow parenthesis and backslash characters inside default values #977

Conversation

@pkrog
Copy link
Contributor

commented Jul 18, 2019

Solves #975
The argument parser method SourceFileAttributesParser::parseArguments() has been modified in order to allow the use of parenthesis and backslash characters inside quoted strings and character values.

pkrog added some commits Jul 18, 2019

Correct parsing of default values in fct parsing.
Now we can use parenthesis characters inside quoted strings for default
values, without disturbing the arguments parser.
@eddelbuettel

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

Thanks for the PR -- we will take a good look. I was about to roll up 1.0.2 but this may still fit in.

@jjallaire

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

This change looks correct to me. @kevinushey Could you also take a look?

case ')':
parenCount--; // #nocov
break; // #nocov
endOfArg = true;

This comment has been minimized.

Copy link
@kevinushey

kevinushey Jul 18, 2019

Contributor

This looks correct to me but IMHO the endOfArg flag is a bit more confusing than just using continue to bypass adding characters to the current argument. Is there a reason why you made that switch (perhaps I'm missing a nuance)? Or just style?

This comment has been minimized.

Copy link
@pkrog

pkrog Jul 19, 2019

Author Contributor

Hi, I used it when the escape character was still handled with a char prevChar variable that was set at the end of the loop. So for consistency, I preferred to replace the continue with endOfArg in order for prevChar to be set even when a comma was met (it was not the case with the continue statement, prevChar was not updated).
Since I've now changed prevChar with the boolean variable escaped and escaped is set before testing for a comma that marks the end of an argument, we can go back to the continue statement. I will make the change.

This comment has been minimized.

Copy link
@pkrog

pkrog Jul 19, 2019

Author Contributor

Thanks for pointing this you, by the way.

@kevinushey
Copy link
Contributor

left a comment

LGTM!

@eddelbuettel eddelbuettel merged commit ec214d0 into RcppCore:master Jul 19, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.