From 64c7a18b2572c509dc7b21b0c726a736515482e3 Mon Sep 17 00:00:00 2001 From: ferrieux Date: Wed, 31 Aug 2011 17:49:47 +0000 Subject: Detect trailers after Nan, Inf, etc. --- generic/tclStrToD.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index a55ee83..f98f8c3 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1029,31 +1029,31 @@ TclParseNumber( state = sINFI; break; } - goto endgame; + goto checktrail; case sINFI: if (c == 'n' || c == 'N') { state = sINFIN; break; } - goto endgame; + goto checktrail; case sINFIN: if (c == 'i' || c == 'I') { state = sINFINI; break; } - goto endgame; + goto checktrail; case sINFINI: if (c == 't' || c == 'T') { state = sINFINIT; break; } - goto endgame; + goto checktrail; case sINFINIT: if (c == 'y' || c == 'Y') { state = sINFINITY; break; } - goto endgame; + goto checktrail; /* * Parse NaN's. @@ -1079,7 +1079,7 @@ TclParseNumber( state = sNANPAREN; break; } - goto endgame; + goto checktrail; /* * Parse NaN(hexdigits) @@ -1114,13 +1114,23 @@ TclParseNumber( acceptState = state; acceptPoint = p; acceptLen = len; - goto endgame; + goto checktrail; } p++; len--; + + while(0) { + checktrail: + if ((c>='0')&&(c<='9')||(c>='A')&&(c<='Z')||(c>='a')&&(c<='z')||(c=='_')) { + /* bareword prefixed by Nan, Inf, etc. */ + acceptState = INITIAL; + } + goto endgame; + } } - endgame: + + endgame: if (acceptState == INITIAL) { /* * No numeric string at all found. -- cgit v0.12