dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir N. Oleynik" <dzo@simtreas.ru>
To: dash@vger.kernel.org
Subject: [PATCH]: allow $(())
Date: Fri, 29 Jan 2021 23:49:20 +0400	[thread overview]
Message-ID: <08178d03-1912-76e7-0733-75e8f1d691af@simtreas.ru> (raw)

Hello.

My micro patch for allow $(( )) as 0

--- arith_yacc.orig.c   2020-12-23 11:58:12.000000000 +0400
+++ arith_yacc.c        2021-01-29 23:47:01.854997852 +0400
@@ -292,10 +292,17 @@
  intmax_t arith(const char *s)
  {
         intmax_t result;
+       int l0;

         arith_buf = arith_startbuf = s;

-       result = assignment(yylex(), 0);
+       l0 = yylex();
+       if (l0 == 0) {
+               /* $(( )) */
+               yylval.val = 0;
+               l0 = ARITH_NUM;
+       }
+       result = assignment(l0, 0);

         if (last_token)
                 yyerror("expecting EOF");


--w
vodz

             reply	other threads:[~2021-01-29 19:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 19:49 Vladimir N. Oleynik [this message]
2021-01-31  9:29 ` [PATCH]: allow recursive variable inderection in arith Vladimir N. Oleynik
2024-04-05  8:37   ` Herbert Xu
2024-04-05  8:36 ` [PATCH]: allow $(()) Herbert Xu

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=08178d03-1912-76e7-0733-75e8f1d691af@simtreas.ru \
    --to=dzo@simtreas.ru \
    --cc=dash@vger.kernel.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.
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).