summaryrefslogtreecommitdiffstats
path: root/generic/tclStrToD.c
diff options
context:
space:
mode:
authorgriffin <brian_griffin@mentor.com>2017-05-27 22:17:21 (GMT)
committergriffin <brian_griffin@mentor.com>2017-05-27 22:17:21 (GMT)
commit7aab6826d8c0c63f62a1d8a8c42d514d5559e420 (patch)
tree5d2ff7f366eb483fd5c185c41bc9c45f070cbff1 /generic/tclStrToD.c
parent4f1a584c9cab2b4579a23077b1f9fda6834ab54c (diff)
downloadtcl-7aab6826d8c0c63f62a1d8a8c42d514d5559e420.zip
tcl-7aab6826d8c0c63f62a1d8a8c42d514d5559e420.tar.gz
tcl-7aab6826d8c0c63f62a1d8a8c42d514d5559e420.tar.bz2
Implement proposed 0d decimal radix prefix to compliment 0x,0b,0o.
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 c7fdc5a..cbdc3a0 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -482,7 +482,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,
@@ -664,6 +664,10 @@ TclParseNumber(
state = ZERO_O;
break;
}
+ if (c == 'd' || c == 'D') {
+ state = ZERO_D;
+ break;
+ }
#ifdef TCL_NO_DEPRECATED
goto decimal;
#endif
@@ -880,6 +884,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