I'm trying to get quoting interpolation to work, which means I first have to
understand it a little better.
In Perl 5, as far as I can see, the delimiter of quoting constructs (whether
it's "", '' or qq <delim>) is searched for before the string is parsed. This
means that, for example,
which is a syntax error.
Current behaviour in Pugs is to read anything that interpolates until its
logical conclusion, so that for example
is 'a', and not a syntax error. I think this behaviour is more useful than the
old behaviour when it's not ambiguous. (By the way, this behaviour is my
fault, so it's not authoritative in any way)
My suggestion is to check for delimiters only when it's ambiguous: Inside a
variable name (qq x$varxy -> "$var"y), and at the beginning of every
subscript of a scalar, and every subscript after the first one of an array,
hash of sub (because in these cases the first subscript is mandatory).
By the way, maybe it's not even an issue: Is it possible for the closing
delimiter of a string to be an opening bracket or brace? In Perl 5, if a
quote is opened by a closing brace it must be closed by the same closing
brace, while in current Pugs an opening closing brace is closed by a closing
Perl5: q]a] Pugs: q]a[
both mean 'a'. If the Perl 5 behaviour is maintained, then there is no chance
at all of ever mistaking a subscript for a closing delimiter, which makes the
only special case qq x$varxy.
Sorry for being long-winded; does this make any sense at all?
[ http://www.hackerkey.com ]