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

Re: Tool to unroll nested parameter expansions



On Sat, 4 Dec 2004, Felix Rosencrantz wrote:

> Anyone have a tool that can take a nested parameter expression [...] and
> break it down into simpler substeps, so it is easier to read.

Unfortunately a tool to do this has to contain the equivalent of the 
entire shell parser, because a parameter expansion can contain $(...)
which can in turn contain arbitrary shell code (including other parameter
expansions, which would confuse any attempt to simplify the parse).

The "obvious" thing would be to instrument paramsubst() so you could see 
the dissection as the shell parses it (perhaps when both VERBOSE and 
XTRACE are set, or some such) but paramsubst() is already 1900 lines of 
subst.c, so that prospect is not appealing.



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