zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Arith expansion accepts extra closing parenthesis
Date: Tue, 2 Jun 2015 10:58:22 -0700	[thread overview]
Message-ID: <150602105822.ZM4076@torch.brasslantern.com> (raw)
In-Reply-To: <556C890E.80506@inlv.org>

On Jun 1,  6:32pm, Martijn Dekker wrote:
} Subject: Arith expansion accepts extra closing parenthesis
}
} I just found some more arithmetic parsing strangeness. zsh 5.0.8 and
} 4.3.11 both happily accept and ignore one (1) extra closing parenthesis
} 
} % X='1)'
} % echo $((X))
} 1

Easier way to see this:

% let "1)"
%

It appears mathparse() around lines 1566-1568 of math.c consumes one
token of lookahead with zzlex() and inadvertently discards it when it
turns out to be a close-paren.  This is partly because of the pseuedo-
precedence assigned to M_OUTPAR "for convenience".

I'm not sure what the correct fix is; maybe checkunary() should throw
an error on M_OUTPAR?


  parent reply	other threads:[~2015-06-02 17:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 16:32 Martijn Dekker
2015-06-02  8:56 ` Peter Stephenson
2015-06-02  9:14   ` Peter Stephenson
2015-06-02 17:58 ` Bart Schaefer [this message]
2015-06-02 18:10   ` 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=150602105822.ZM4076@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).