From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4407 invoked by alias); 29 Oct 2014 16:08:20 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33567 Received: (qmail 29735 invoked from network); 29 Oct 2014 16:08:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Authority-Analysis: v=2.1 cv=HYUtEE08 c=1 sm=1 tr=0 a=2jL3GXh5vjVzptu3UUvHtQ==:117 a=2jL3GXh5vjVzptu3UUvHtQ==:17 a=gmhVCtT3eHoA:10 a=N659UExz7-8A:10 a=Vz1Nwm_FdNygdD4UqwMA:9 a=pILNOxqGKmIA:10 Message-id: <54510A96.20009@eastlink.ca> Date: Wed, 29 Oct 2014 08:41:10 -0700 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.1.2 MIME-version: 1.0 To: zsh-workers@zsh.org Subject: Re: first adventures References: <544D2D6F.8030505@eastlink.ca> <20141026175257.2611487b@pws-pc.ntlworld.com> <544FD6DD.7010806@eastlink.ca> <141028210510.ZM10784@torch.brasslantern.com> In-reply-to: <141028210510.ZM10784@torch.brasslantern.com> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit On 10/28/2014 09:05 PM, Bart Schaefer wrote: > } ... so, I finally have my gloriously, deliciously unexpanded, plain > } vanilla command, exactly as I > > Well, you think so, but really it just happens that nothing you typed > needed to be metafied. Deo volente! For now I don't even want to think about metafying, my head would explode. > History is expanded by the lexer as each word is consumed, because as > I mentioned in private email, the expansion has to be re-analyzed to > correctly tokenize it. So the previously-discussed point in input.c > where VERBOSE is handled, is the line with history expanded. Yeah, that's the right form, but at that point, it's so generous, it prints everything the shell does, like preexec(), and the whole init of the shell. > > When prog is non-NULL (the else branch of that if), it contains the > compiled form of the input code, which is already broken up into the > set of commands that will be executed. There is no human-readable > decomposed form of the individual commands that make up a finished > input event; getpermtext(prog) returns the readable form of the entire > thing, which is the closest you get. Right, it looks good, and each command is on it's own line; $ ls init.c*; ls $PWD/main.* > /tmp/junk FILE: init.c LINE: 185 ls init.c* ls $PWD/main.* > /tmp/junk (output) It's proof against expansion of glob, variables and redirection ... pretty much all I'm thinking of. bangchar/history is expanded, and so are aliases, but that's good. So, if there was just some way of matching each line of that output from getpermtext() with the appropriate command, then I'd be close to the finish line. if, in: $ ls main.c; ls init.c; ls version.h ... 'ls init.c' could 'know' that it is command #2 of 3, then I could grab line #2 from getpermtext(), and if I could then assign that to a shell variable, I'd have exactly what I want: each command would have access to the verbatim command line 'segment' that called it (that is, between the semicolons).