Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _normal:26: bad math expression: operator expected at `0 '



Peter Stephenson wrote:
> >     octalzeroes

One supposes the following feature of this option, which is causing the
problem, is unintended:

 % setopt octalzeroes
 % print $(( 0 + 0 ))
 zsh: bad math expression: operator expected at `0 '

Index: Src/math.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/math.c,v
retrieving revision 1.12
diff -u -r1.12 math.c
--- Src/math.c	14 Jan 2002 13:46:32 -0000	1.12
+++ Src/math.c	25 Apr 2002 15:40:16 -0000
@@ -383,9 +383,10 @@
 		return NUM;
 	    }
 	    else if (isset(OCTALZEROES) &&
-		    (memchr(ptr, '.', strlen(ptr)) == NULL)) {
+		    (memchr(ptr, '.', strlen(ptr)) == NULL) &&
+		     idigit(*ptr)) {
 	        yyval.u.l = zstrtol(ptr, &ptr, lastbase = 8);
-	        return NUM;
+		return NUM;
 	    }
 	/* Fall through! */
 	default:

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author