dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: allow $(())
@ 2021-01-29 19:49 Vladimir N. Oleynik
  2021-01-31  9:29 ` [PATCH]: allow recursive variable inderection in arith Vladimir N. Oleynik
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir N. Oleynik @ 2021-01-29 19:49 UTC (permalink / raw)
  To: dash

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-31  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-29 19:49 [PATCH]: allow $(()) Vladimir N. Oleynik
2021-01-31  9:29 ` [PATCH]: allow recursive variable inderection in arith Vladimir N. Oleynik

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).