Unify handling of quoted strings in pass args #5385
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the reasons/motivation for this change?
https://yosyshq.discourse.group/t/quoted-strings-in-pass-arguments/83
Explain how this is achieved.
std::quoted()
from<iomanip>
to quote/unquote pass arguments. In order to maintain handling of (unquoted) comments and semicolons this occurs when adding the token to the arg list, rather than in the tokenization itself. Passes no longer receive tokenized-but-raw arguments and are instead pre-unquoted. Should resolve Support quoted strings as arguments to passes #4511.logger -expect
regexps (e.g."\\\""
->'\"'
).echo on
, arguments which require quoting will automatically quote (arguments which were quoted but didn't need to be will not be quoted in the echo). Single quotes are used by default, unless the arg contains a single quote and then it will usestd::quoted()
(which uses double quotes and can escape with backslash).setattr
which rely on arguments having quotation marks for disambiguation.If applicable, please suggest to reviewers how they can test the change.
PR includes tests (though I don't think they're currently being picked up by CI) for checking behavior of arg parsing in
tests/scripts
. Many of which utilize a plugin that gets compiled during testing and provides thetest_args
pass, which is basically justlog
but each argument is separated by a newline.