zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] Re: Parser issues and and [[ $var ]]
Date: Tue, 13 May 2014 10:10:32 +0100	[thread overview]
Message-ID: <20140513101032.5d2377f8@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <140512220112.ZM20283@torch.brasslantern.com>

On Mon, 12 May 2014 22:01:12 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> This problem already exists -- infix operators that aren't tokens like
> && and || are already lower prececence than prefix operators.  E.g.:
> 
> zsh% [[ -n 1 -eq 1 ]]
> zsh: unknown condition: -n
> 
> So I don't think the patch below changes any of that.

While this sort of thing and the problems with modular conditions are a
real headache for parsing, I don't think the actual practical problems
are anything like as bad.  Almost always real tests use parameters or
quoted expressions (you don't need to know if the literal string -n has
non-zero length), and since [[, unlike [, is parsed before expansion
such tests work fine.  About the only likely exception I can think of is
where someone's used an eval to get an extra level of expansion --- but
that's always a bit hairy.

So having addressed the compatibility issues, perhaps we should restrict
ourselves to tweaking the documentation to mention the problems and how
to keep them at bay.

pws


  reply	other threads:[~2014-05-13  9:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAH_OBicpVKS-URnd-Gq=gj+qc6OhDCqf0mgDfVcda27mEEfUKg@mail.gmail.com>
     [not found] ` <140416102727.ZM19090@torch.brasslantern.com>
     [not found]   ` <CAH_OBic7sX1Oc4VWn2KvX40smbRB6A7w8QGXLvPfZLD=CHMddQ@mail.gmail.com>
     [not found]     ` <534FE710.3020601@eastlink.ca>
     [not found]       ` <140417123722.ZM22179@torch.brasslantern.com>
     [not found]         ` <20140423165024.1480528a@pws-pc.ntlworld.com>
     [not found]           ` <lj984r$6uo$1@ger.gmane.org>
     [not found]             ` <CAHYJk3QOZTnicq+Nqg4BXNANa_c6_j5mhyQNK1f8YNtDhxixgA@mail.gmail.com>
     [not found]               ` <slrnlll0kq.v0i.martin@lounge.imp.fu-berlin.de>
     [not found]                 ` <20140425172112.7bf50606@pwslap01u.europe.root.pri>
     [not found]                   ` <slrnlln1bj.a9l.martin@epidot.math.uni-rostock.de>
2014-04-26 20:30                     ` Bart Schaefer
2014-05-10 21:09                       ` Bart Schaefer
2014-05-11  1:01                         ` Bart Schaefer
2014-05-11 17:01                           ` Peter Stephenson
2014-05-11 18:12                             ` Bart Schaefer
2014-05-13  5:01                               ` [PATCH] " Bart Schaefer
2014-05-13  9:10                                 ` Peter Stephenson [this message]
2014-05-13 15:03                                   ` Bart Schaefer
     [not found]                     ` <20140426212126.58b0ff26@pws-pc.ntlworld.com>
2014-04-26 21:23                       ` More [[ $var ]] (Re: zsh-newuser-install) Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140513101032.5d2377f8@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).