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

Re: Arith expansion accepts extra closing parenthesis



On Jun 1,  6:32pm, Martijn Dekker wrote:
} Subject: Arith expansion accepts extra closing parenthesis
}
} I just found some more arithmetic parsing strangeness. zsh 5.0.8 and
} 4.3.11 both happily accept and ignore one (1) extra closing parenthesis
} 
} % X='1)'
} % echo $((X))
} 1

Easier way to see this:

% let "1)"
%

It appears mathparse() around lines 1566-1568 of math.c consumes one
token of lookahead with zzlex() and inadvertently discards it when it
turns out to be a close-paren.  This is partly because of the pseuedo-
precedence assigned to M_OUTPAR "for convenience".

I'm not sure what the correct fix is; maybe checkunary() should throw
an error on M_OUTPAR?



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