Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [Feature Request] Adding option to support triple quotes



2019-08-16 22:31:11 -0700, Bart Schaefer:
[...]
> So if you really want to make progress with this, start looking for
> something more akin to perl's q{} and qq{} as already mentioned.
[...]

q{} would be a non-starter since it's already valid syntax.

q(...)    for '...'
qq(...)   for "..."
qqq(...)  for $'...'
qqqq(...) and more q's reserved for future extensions like
          ksh93's $"..."

may be workable. (and \qq(...) or 'q'q(...) would be a literal q
followed by q(...)). 

perl allows \( and \) to escape ( and ) (and as a result \\ to
escape \) inside even the q(...) form, I'm not sure I like that:

$ perl -le 'print q( \\ \(\) () )'
 \ () ()

'...' can quote anything that doesn't contain '. q(...) could
quote anything except unmatched (...) pairs.

I'm sure everyone will have wished for a kind of quotes (à la
TCL {...} or perl q(...)) that can nest when writing things
like:

ssh host 'find . -exec sh -c '\''for i do sed '\'\\\'\'s/... '

Which you wished you could write:

ssh host q(find . -exec zsh -c q(for i do sed q(s...)...) zsh {} +)

That's the same kind of reason we got $(...) to replace `...`

On a related note, I really wish the glob*(e'(code $(...))')
worked, as in the code that looks for the closing ) for the e
glob qualifier would find the matching ")" as opposed to the
first one (same in the s/j... parameter expansion flags, etc.)

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author