diff options
author | Peter Stephenson <pws@zsh.org> | 2013-11-14 11:49:22 +0000 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2013-11-14 11:49:22 +0000 |
commit | 4c611f9323a516b95c3da19065e3f9040074de7e (patch) | |
tree | c289d8059a1faca14795c1345e6c31f2642e3369 | |
parent | 7a94960957e37c198e93dfbd7af864799b01650d (diff) | |
download | zsh-4c611f9323a516b95c3da19065e3f9040074de7e.tar.gz zsh-4c611f9323a516b95c3da19065e3f9040074de7e.tar.xz zsh-4c611f9323a516b95c3da19065e3f9040074de7e.zip |
31982: detection of floating point constants was problematic.
Remove the cause and fix the original problem with floating point numbers with leading zeros (users/17445) a different way.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Src/math.c | 11 | ||||
-rw-r--r-- | Test/C01arith.ztst | 8 |
3 files changed, 17 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog index 63eca13a0..c22054372 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-14 Peter Stephenson <p.stephenson@samsung.com> + + * 31982: Src/math.c, Test/C01arith.ztst: detection of floating + point constants had run rampant in users/17445. Fix the original + problem another way. + 2013-11-13 Peter Stephenson <p.w.stephenson@ntlworld.com> * 31977: Src/module.c: no error if autoloading a feature that diff --git a/Src/math.c b/Src/math.c index b21a3adee..42355f885 100644 --- a/Src/math.c +++ b/Src/math.c @@ -448,9 +448,7 @@ lexconstant(void) if (*nptr == '-') nptr++; - if (*nptr == '0' && - (memchr(nptr, '.', strlen(nptr)) == NULL)) - { + if (*nptr == '0') { nptr++; if (*nptr == 'x' || *nptr == 'X') { /* Let zstrtol parse number with base */ @@ -491,11 +489,8 @@ lexconstant(void) nptr = ptr2; } } - else - { - while (idigit(*nptr) || *nptr == '_') - nptr++; - } + while (idigit(*nptr) || *nptr == '_') + nptr++; if (*nptr == '.' || *nptr == 'e' || *nptr == 'E') { char *ptr2; diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst index c19135ce6..7b005c2ab 100644 --- a/Test/C01arith.ztst +++ b/Test/C01arith.ztst @@ -258,3 +258,11 @@ >0.5 >3 >3. + + print $(( 0x30 + 0.5 )) + print $(( 077 + 0.5 )) + (setopt octalzeroes; print $(( 077 + 0.5 )) ) +0:Mixed float and non-decimal integer constants +>48.5 +>77.5 +>63.5 |