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
Allow parenthesis and backslash characters inside default values #977
Conversation
Now we can use parenthesis characters inside quoted strings for default values, without disturbing the arguments parser.
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. |
This change looks correct to me. @kevinushey Could you also take a look? |
src/attributes.cpp
Outdated
case ')': | ||
parenCount--; // #nocov | ||
break; // #nocov | ||
endOfArg = true; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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.