From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8360 invoked from network); 5 Dec 2004 18:10:43 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Dec 2004 18:10:43 -0000 Received: (qmail 55866 invoked from network); 5 Dec 2004 18:10:37 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Dec 2004 18:10:37 -0000 Received: (qmail 12523 invoked by alias); 5 Dec 2004 18:10:28 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8268 Received: (qmail 12507 invoked from network); 5 Dec 2004 18:10:27 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Dec 2004 18:10:27 -0000 Received: (qmail 53365 invoked from network); 5 Dec 2004 18:09:28 -0000 Received: from moonbase.zanshin.com (64.84.47.139) by a.mx.sunsite.dk with SMTP; 5 Dec 2004 18:09:25 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.13.1/8.13.1) with ESMTP id iB5I9N4I019617 for ; Sun, 5 Dec 2004 10:09:23 -0800 Date: Sun, 5 Dec 2004 10:09:23 -0800 (PST) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk Subject: Re: Tool to unroll nested parameter expansions In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 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.