Travis Vitek wrote:
Martin Sebor wrote:

Travis Vitek wrote:
[...]
I'm honestly leaning toward implementing the behavior of
either csh or
ksh, and adding support for bash style sequences.
This sounds perfectly reasonable to me. IMO, these are all corner
cases that I suspect we're unlikely to run into in our limited uses
of the function. (As much fun as they are to talk about.)

The one question that we do need to decide is how the function should
deal with whitespace. I.e., whether <pcs-char> in the grammar includes
the set of whitespace characters or whether they are treated as special
delimiters.

Martin


Unless there are objections, I'm leaving rw_brace_expand() as-is. That
means that <pcs-char> includes all whitespace. I plan on adding a new
function rw_shell_expand() that will tokenize the input string on
whitespace and apply rw_brace_expand() to each whitespace delimited
token and gather the results into a single buffer.

I agree. I just realized that the shell also allows spaces in brace
expansions, they just need to be escaped:

    $ echo a{b,  }c " | " x{y,'  '}z
    a{b, }c  |  xyz x  z


At some point in the future, I'd expect to see us implement
rw_variable_expand() that would do bash shell variable expansion on an
input string. When that happens, rw_shell_expand() would be augmented to
apply variable expansion to the brace expanded string.

This allows for easy seperation of concerns, and should make testing and
maintenance a bit simpler.

Sounds good.

Martin

Reply via email to