|
From: Peter S <pet...@gm...> - 2017-02-15 07:35:47
|
On 14/02/2017, avl <av...@lo...> wrote:
>
> Sounds reasonable. Not sure, if the parse tree allows easy
> recognition of sub-trees that represent parsed quoted strings
> with substitutions like in:
> "arr($key)" = 42
If the whole expression is braced, then the quotes should remain part
of the operand. Since expr already distinguishes quoted operands, it
should be able to recognize them.
If the whole expression is not braced, then the quotes get removed by
the first round of parsing, but that just adds one more weirdness to
unbraced expressions :)
>> “sin”(0) = 1 ;# OK
>
> What's the supposed meaning for this?
My guess, probably: use the quoted part as array name (can contain
unevaluated expressions or non-bareword chars, and also
substitutions), but still calculate the sub-expression inside the
parens (if any), instead of taking them as literal string. And if that
makes sense, then {sin}(0) also makes sense, {...} and "..." differing
whether $, command and \ substitutions take place in the quoted part.
However, this is already equivalent to: "sin(0)", or in case it has a
sub-expression: "sin([expr ...])". So maybe no new syntax necessary
for this (probably rare) case.
|