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

Re: grammar triviality with '&&'



Peter Stephenson wrote on Wed, Mar 04, 2015 at 15:18:30 +0000:
> On Wed, 4 Mar 2015 15:47:56 +0100
> Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > I've found a bug:
> > 
> > % alias '&&=(){ return $? } && '
> > % && echo OK
> > zsh: parse error near `&&'
> 
> (Moved to zsh-workers)
> 
> I was keeping very quiet about this, but it looks like it's not as hairy
> as I thought it might be and the new code is actually slightly cleaner...
> 
> Now waiting for obscure failures elsewhere...
> 
> pws
> 

The commit doesn't include the test part (even though the changelog
entry does mention it).

Daniel

> diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
> index 7121c50..36dfa24 100644
> --- a/Test/A02alias.ztst
> +++ b/Test/A02alias.ztst
> @@ -42,3 +42,18 @@
>    cat <(echo foo | cat)
>  0:Alias expansion works at the end of parsed strings
>  >foo
> +
> +  alias '&&=(){ return $?; } && '
> +  alias not_the_print_command=print
> +  eval 'print This is output
> +  && print And so is this
> +  && { print And this too; false; }
> +  && print But not this
> +  && print Nor this
> +  true
> +  && not_the_print_command And aliases are expanded'
> +0:We can now alias special tokens.  Woo hoo.
> +>This is output
> +>And so is this
> +>And this too
> +>And aliases are expanded



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