mirror of https://github.com/mpv-player/mpv
input: argument custom quotes: use ` instead of !
Custom quotes were added in 4f129a3e
and began with !, however, this
required quoting "!reverse" (used for the cycle-values command), which
is inconvenient, and was not taken into account when ! was chosen for
custom quotes. Also, ` is more natural for quoting than !.
This does break backward compatibility with the earlier form of custom
quotes, but at least we didn't make a release yet since custom quotes
were added (the last release - 0.33[.1] doesn't support it).
This commit is contained in:
parent
3f0e8bd506
commit
73c9509720
|
@ -162,7 +162,7 @@ a number of other places.
|
||||||
|
|
||||||
|
|
|
|
||||||
| ``<command> ::= [<prefixes>] <command_name> (<argument>)*``
|
| ``<command> ::= [<prefixes>] <command_name> (<argument>)*``
|
||||||
| ``<argument> ::= (<unquoted> | " <double_quoted> " | !X <custom_quoted> X!)``
|
| ``<argument> ::= (<unquoted> | " <double_quoted> " | `X <custom_quoted> X`)``
|
||||||
|
|
||||||
``command_name`` is an unquoted string with the command name itself. See
|
``command_name`` is an unquoted string with the command name itself. See
|
||||||
`List of Input Commands`_ for a list.
|
`List of Input Commands`_ for a list.
|
||||||
|
@ -171,10 +171,10 @@ Arguments are separated by whitespaces even if the command expects only one
|
||||||
argument. Arguments with whitespaces or other special characters must be quoted,
|
argument. Arguments with whitespaces or other special characters must be quoted,
|
||||||
or the command cannot be parsed correctly.
|
or the command cannot be parsed correctly.
|
||||||
|
|
||||||
Double quoted arguments start and end with ``"``. Custom quotes start with ``!``
|
Double quoted arguments start and end with ``"``. Custom quotes start with `````
|
||||||
(exclamation mark) followed by any ASCII character, and end in the same pair in
|
(back-quote) followed by any ASCII character, and end in the same pair in
|
||||||
reverse order, e.g. ``!'foo'!`` or ``!-bar-!``. The final pair sequence is not
|
reverse order, e.g. ```-foo-``` or ````bar````. The final pair sequence is not
|
||||||
allowed inside the string - in these examples ``'!`` and ``-!`` respectively.
|
allowed inside the string - in these examples ``-``` and `````` respectively.
|
||||||
|
|
||||||
Custom quotes take their content literally, while inside double quotes
|
Custom quotes take their content literally, while inside double quotes
|
||||||
JSON/C-style escaping can be used. JSON escapes according to RFC 8259, minus
|
JSON/C-style escaping can be used. JSON escapes according to RFC 8259, minus
|
||||||
|
|
|
@ -341,8 +341,8 @@ static int pctx_read_token(struct parse_ctx *ctx, bstr *out)
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (ctx->start.len > 1 && bstr_eatstart0(&ctx->str, "!")) {
|
if (ctx->start.len > 1 && bstr_eatstart0(&ctx->str, "`")) {
|
||||||
char endquote[2] = {ctx->str.start[0], '!'};
|
char endquote[2] = {ctx->str.start[0], '`'};
|
||||||
ctx->str = bstr_cut(ctx->str, 1);
|
ctx->str = bstr_cut(ctx->str, 1);
|
||||||
int next = bstr_find(ctx->str, (bstr){endquote, 2});
|
int next = bstr_find(ctx->str, (bstr){endquote, 2});
|
||||||
if (next < 0) {
|
if (next < 0) {
|
||||||
|
|
Loading…
Reference in New Issue