From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mimir.eigenstate.org ([206.124.132.107]) by ewsd; Sun Aug 2 00:51:46 EDT 2020 Received: from abbatoir.fios-router.home (pool-74-101-2-6.nycmny.fios.verizon.net [74.101.2.6]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 019442ad (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Sat, 1 Aug 2020 21:51:36 -0700 (PDT) Message-ID: To: 9front@9front.org Subject: Re: [9front] Patch to fix test(1) expression parsing Date: Sat, 01 Aug 2020 21:51:35 -0700 From: ori@eigenstate.org In-Reply-To: <8155F03D042A477BCB2881C5C2FD20E1@musolino.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: extended property event-based framework >> This comment seems outdated -- we can use the nice idea and >> error out appropriately now. > > Yeah, I did this in an updated patch I sent in a subsequent email. Oops. Had the old email open. looking at it again, I'm wondering if we can split the unary and binary ops up, and then instead of adding if(EQ(a, '-?')) { b = nxtarg(0); return(eval && ...); } we could do: /* special case ops */ if(EQ(a, "special)) ... /* common case binary ops */ b = nxtarg(0); if(!eval) return 0; if(EQ(a, "-?") return(...) if(eq(a, "-!") return(...) It looks like there'd only be a few special cases that don't fit.