From: Harald van Dijk <harald@gigawatt.nl>
To: Robert Elz <kre@munnari.OZ.AU>, Steffen Nurpmeso <steffen@sdaoden.eu>
Cc: DASH shell mailing list <dash@vger.kernel.org>
Subject: Re: $(()) pre/postfix bug
Date: Sat, 2 Jul 2022 09:20:30 +0100 [thread overview]
Message-ID: <cf3a9ac8-9cf8-ad57-bb33-2a5c5a93e532@gigawatt.nl> (raw)
In-Reply-To: <3508.1656721712@jacaranda.noi.kre.to>
On 02/07/2022 01:28, Robert Elz wrote:
> | FreeBSD 13.1
> | #|f-1301-x86:~$ sh -c '(i=10; echo $((++-+++i)))'
> | sh: arithmetic expression: expecting primary: "++-+++i"
>
> We used to do that as well (our arith parser is derived from
> theirs, which is derived from dash's with extensions) but no-one ever
> understood what a "primary" was (relates to internal implementation
> function names) so I altered the err msg.
While there is a function called primary, I actually think that may not
be what the error message refers to, not directly. The grammar is
supposed to be the C grammar with unsupported constructs removed, the C
grammar defines a "primary-expression", and the error message in dash
shows up where a straightforward parser directly based on the C grammar
would result in an error where the grammar demands a primary-expression.
The function called primary ended up doing more than parse a
primary-expression, but that does not change which cases result in that
error.
Cheers,
Harald van Dijk
prev parent reply other threads:[~2022-07-02 8:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-01 23:14 $(()) pre/postfix bug Steffen Nurpmeso
2022-07-01 23:36 ` Steffen Nurpmeso
2022-07-02 0:28 ` Robert Elz
2022-07-02 8:20 ` Harald van Dijk [this message]
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=cf3a9ac8-9cf8-ad57-bb33-2a5c5a93e532@gigawatt.nl \
--to=harald@gigawatt.nl \
--cc=dash@vger.kernel.org \
--cc=kre@munnari.OZ.AU \
--cc=steffen@sdaoden.eu \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).