Skip to content

Conversation

@pkrog
Copy link
Contributor

@pkrog pkrog 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 3 commits July 18, 2019 12:19
Now we can use parenthesis characters inside quoted strings for default
values, without disturbing the arguments parser.
@eddelbuettel
Copy link
Member

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
Copy link
Member

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this you, by the way.

Copy link
Contributor

@kevinushey kevinushey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@eddelbuettel eddelbuettel merged commit ec214d0 into RcppCore:master Jul 19, 2019
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

Successfully merging this pull request may close these issues.

4 participants