Re: [PATCHv2] gdb: Rewrite argument handling for user-defined commands

Eli Zaretskii
2018-09-08T06:27:39Z

> Date: Fri, 7 Sep 2018 23:47:21 +0100
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: gdb-patches@sourceware.org, Philippe Waroquiers <philippe.waroquiers@skynet.be>
>
> 1. Arguments are separated by whitespace,
>
> 2. Everything within matched single or double quotes is a single
> argument.
>
> 3. After a quoted region you still need whitespace to split the
> arguments, so >>'abc'def<< will be a single argument, >>abcdef<<.
>
> 4. Within double quotes, a backslash can be used to escape a double
> quotes, so >>"\"this is one\""<< will give >>"this is one"<<.
>
> 5. Within single quotes backslash does NOT escape a single quote, so
> a single quote always ends a quoted block, so >>'this is\'<< will
> pass the argument >>this is\<<. I'm not 100% committed to this idea,
> and can make this like double quotes if that is preferred.

Why did you decide on this exception for single quotes? Are there any
downsides to having \' mean a literal ' inside '..' quoted arguments?

If there is no downside, I think it would be a better UX to have both
kinds of quotes behave identically wrt escapes.

Thanks.