zsh-users
 help / color / mirror / code / Atom feed
* Tool to unroll nested parameter expansions
@ 2004-12-04  9:14 Felix Rosencrantz
  2004-12-05 18:09 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Rosencrantz @ 2004-12-04  9:14 UTC (permalink / raw)
  To: zsh-users

Anyone have a tool that can take a nested parameter expression (e.g. 
pats="${(@)${(@M)tmp1:#-g*}#-g}" ) , and break it down into simpler
substeps, so it is easier to read.

Some of the completion code uses complex parameter expansions, that
are difficult to read, and it would be useful if there was something
that could break it down into smaller more understandable steps, like
a line per ${} section.

-FR.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Tool to unroll nested parameter expansions
  2004-12-04  9:14 Tool to unroll nested parameter expansions Felix Rosencrantz
@ 2004-12-05 18:09 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2004-12-05 18:09 UTC (permalink / raw)
  To: zsh-users

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-05 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-04  9:14 Tool to unroll nested parameter expansions Felix Rosencrantz
2004-12-05 18:09 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).