summaryrefslogtreecommitdiffstats
path: root/generic/tclStrToD.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-06-14 07:54:51 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-06-14 07:54:51 (GMT)
commitb7a1ba3ba40ba71b65cefedc057bbccf0323f4a5 (patch)
treefd3f725641f7ff06608e6e77394d4bcefb5ef3ec /generic/tclStrToD.c
parentf019737860823b97cfde68d64a5175fa21c3a967 (diff)
parent78e17f7f0cce0233cc1009b3f7c3aa2ea32763d7 (diff)
downloadtcl-b7a1ba3ba40ba71b65cefedc057bbccf0323f4a5.zip
tcl-b7a1ba3ba40ba71b65cefedc057bbccf0323f4a5.tar.gz
tcl-b7a1ba3ba40ba71b65cefedc057bbccf0323f4a5.tar.bz2
Rebase to core-8-6-branch (who told that fossil doesn't know how to rebase ....)
Diffstat (limited to 'generic/tclStrToD.c')
-rw-r--r--generic/tclStrToD.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 67b6482..4377832 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -489,7 +489,7 @@ TclParseNumber(
{
enum State {
INITIAL, SIGNUM, ZERO, ZERO_X,
- ZERO_O, ZERO_B, BINARY,
+ ZERO_O, ZERO_B, ZERO_D, BINARY,
HEXADECIMAL, OCTAL, BAD_OCTAL, DECIMAL,
LEADING_RADIX_POINT, FRACTION,
EXPONENT_START, EXPONENT_SIGNUM, EXPONENT,
@@ -657,6 +657,10 @@ TclParseNumber(
state = ZERO_O;
break;
}
+ if (c == 'd' || c == 'D') {
+ state = ZERO_D;
+ break;
+ }
#ifdef KILL_OCTAL
goto decimal;
#endif
@@ -873,6 +877,16 @@ TclParseNumber(
state = BINARY;
break;
+ case ZERO_D:
+ if (c == '0') {
+ numTrailZeros++;
+ } else if ( ! isdigit(UCHAR(c))) {
+ goto endgame;
+ }
+ state = DECIMAL;
+ flags |= TCL_PARSE_INTEGER_ONLY;
+ /* FALLTHROUGH */
+
case DECIMAL:
/*
* Scanned an optional + or - followed by a string of decimal