Diff
Not logged in

Differences From Artifact [e0b542eeef]:

To Artifact [c01b6bb252]:


762
763
764
765
766
767
768




769
770
771
772
773
774
775
		    numSigDigs = 1;
		}
		numTrailZeros = 0;
		state = OCTAL;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */




                under = 1;
                break;
	    }
	    goto endgame;

	    /*
	     * Scanned 0x. If state is HEXADECIMAL, scanned at least one







>
>
>
>







762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
		    numSigDigs = 1;
		}
		numTrailZeros = 0;
		state = OCTAL;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */
		if (under) {
		    // No multiple '_' in a row
		    goto endgame;
		}
                under = 1;
                break;
	    }
	    goto endgame;

	    /*
	     * Scanned 0x. If state is HEXADECIMAL, scanned at least one
797
798
799
800
801
802
803




804
805
806
807
808
809
810
		under = 0;
		d = (c-'A'+10);
	    } else if (c >= 'a' && c <= 'f') {
		under = 0;
		d = (c-'a'+10);
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */




                under = 1;
                break;
	    } else {
		goto endgame;
	    }
	    if (objPtr != NULL) {
		shift = 4 * (numTrailZeros + 1);







>
>
>
>







801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
		under = 0;
		d = (c-'A'+10);
	    } else if (c >= 'a' && c <= 'f') {
		under = 0;
		d = (c-'a'+10);
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */
		if (under) {
		    // No multiple '_' in a row
		    goto endgame;
		}
                under = 1;
                break;
	    } else {
		goto endgame;
	    }
	    if (objPtr != NULL) {
		shift = 4 * (numTrailZeros + 1);
859
860
861
862
863
864
865




866
867
868
869
870
871
872
	    if (c == '0') {
		numTrailZeros++;
		under = 0;
		state = BINARY;
		break;
	    } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
		/* Ignore numeric "white space" */




		under = 1;
		break;
	    } else if (c != '1') {
		goto endgame;
	    } else {
		under = 0;
	    }







>
>
>
>







867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
	    if (c == '0') {
		numTrailZeros++;
		under = 0;
		state = BINARY;
		break;
	    } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
		/* Ignore numeric "white space" */
		if (under) {
		    // No multiple '_' in a row
		    goto endgame;
		}
		under = 1;
		break;
	    } else if (c != '1') {
		goto endgame;
	    } else {
		under = 0;
	    }
916
917
918
919
920
921
922




923
924
925
926
927
928
929
	case ZERO_D:
	    if (c == '0') {
		under = 0;
		numTrailZeros++;
	    } else if ( ! isdigit(UCHAR(c))) {
		if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
		    /* Ignore numeric "white space" */




		    under = 1;
		    break;
		}
		goto endgame;
	    }
	    under = 0;
	    state = DECIMAL;







>
>
>
>







928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
	case ZERO_D:
	    if (c == '0') {
		under = 0;
		numTrailZeros++;
	    } else if ( ! isdigit(UCHAR(c))) {
		if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
		    /* Ignore numeric "white space" */
		    if (under) {
			// No multiple '_' in a row
			goto endgame;
		    }
		    under = 1;
		    break;
		}
		goto endgame;
	    }
	    under = 0;
	    state = DECIMAL;
955
956
957
958
959
960
961




962
963
964
965
966
967



968
969
970
971



972
973
974
975
976
977
978
		numSigDigs += numTrailZeros+1;
		numTrailZeros = 0;
		under = 0;
		state = DECIMAL;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */




                under = 1;
                break;
	    } else if (flags & TCL_PARSE_INTEGER_ONLY) {
		goto endgame;
	    } else if (c == '.') {
		under = 0;



		state = FRACTION;
		break;
	    } else if (c == 'E' || c == 'e') {
		under = 0;



		state = EXPONENT_START;
		break;
	    }
	    goto endgame;

	    /*
	     * Found a decimal point. If no digits have yet been scanned, E is







>
>
>
>





|
>
>
>



|
>
>
>







971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
		numSigDigs += numTrailZeros+1;
		numTrailZeros = 0;
		under = 0;
		state = DECIMAL;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */
		if (under) {
		    // No multiple '_' in a row
		    goto endgame;
		}
                under = 1;
                break;
	    } else if (flags & TCL_PARSE_INTEGER_ONLY) {
		goto endgame;
	    } else if (c == '.') {
		if (under) {
		    // Must be a digit before and after '_'
		    goto endgame;
		}
		state = FRACTION;
		break;
	    } else if (c == 'E' || c == 'e') {
		if (under) {
		    // Must be a digit before and after '_'
		    goto endgame;
		}
		state = EXPONENT_START;
		break;
	    }
	    goto endgame;

	    /*
	     * Found a decimal point. If no digits have yet been scanned, E is
1012
1013
1014
1015
1016
1017
1018




1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032



1033
1034
1035
1036
1037



1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055




1056
1057
1058
1059
1060
1061
1062
		}
		numTrailZeros = 0;
		under = 0;
		state = FRACTION;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */




                under = 1;
                break;
	    }
	    goto endgame;

	case EXPONENT_START:
	    /*
	     * Scanned the E at the start of an exponent. Make sure a legal
	     * character follows before using the C library strtol routine,
	     * which allows whitespace.
	     */

	    if (c == '+') {
		under = 0;



		state = EXPONENT_SIGNUM;
		break;
	    } else if (c == '-') {
		exponentSignum = 1;
		under = 0;



		state = EXPONENT_SIGNUM;
		break;
	    }
	    /* FALLTHROUGH */

	case EXPONENT_SIGNUM:
	    /*
	     * Found the E at the start of the exponent, followed by a sign
	     * character.
	     */

	    if (isdigit(UCHAR(c))) {
		exponent = c - '0';
		under = 0;
		state = EXPONENT;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */




                under = 1;
                break;
	    }
	    goto endgame;

	case EXPONENT:
	    /*







>
>
>
>













|
>
>
>




|
>
>
>


















>
>
>
>







1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
		}
		numTrailZeros = 0;
		under = 0;
		state = FRACTION;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */
		if (under) {
		    // No multiple '_' in a row
		    goto endgame;
		}
                under = 1;
                break;
	    }
	    goto endgame;

	case EXPONENT_START:
	    /*
	     * Scanned the E at the start of an exponent. Make sure a legal
	     * character follows before using the C library strtol routine,
	     * which allows whitespace.
	     */

	    if (c == '+') {
		if (under) {
		    // Must be a digit before and after '_'
		    goto endgame;
		}
		state = EXPONENT_SIGNUM;
		break;
	    } else if (c == '-') {
		exponentSignum = 1;
		if (under) {
		    // Must be a digit before and after '_'
		    goto endgame;
		}
		state = EXPONENT_SIGNUM;
		break;
	    }
	    /* FALLTHROUGH */

	case EXPONENT_SIGNUM:
	    /*
	     * Found the E at the start of the exponent, followed by a sign
	     * character.
	     */

	    if (isdigit(UCHAR(c))) {
		exponent = c - '0';
		under = 0;
		state = EXPONENT;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */
		if (under) {
		    // No multiple '_' in a row
		    goto endgame;
		}
                under = 1;
                break;
	    }
	    goto endgame;

	case EXPONENT:
	    /*
1074
1075
1076
1077
1078
1079
1080




1081
1082
1083
1084
1085
1086
1087
		    exponent = LONG_MAX;
		}
		under = 0;
		state = EXPONENT;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */




                under = 1;
                break;
	    }
	    goto endgame;

	    /*
	     * Parse out INFINITY by simply spelling it out. INF is accepted







>
>
>
>







1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
		    exponent = LONG_MAX;
		}
		under = 0;
		state = EXPONENT;
		break;
            } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
                /* Ignore numeric "white space" */
		if (under) {
		    // No multiple '_' in a row
		    goto endgame;
		}
                under = 1;
                break;
	    }
	    goto endgame;

	    /*
	     * Parse out INFINITY by simply spelling it out. INF is accepted
1231
1232
1233
1234
1235
1236
1237



1238
1239
1240
1241
1242
1243
1244
	 * If the last char seen is the numeric whitespace character '_',
	 * backup to that.
	 */

	p = under ? acceptPoint-1 : acceptPoint;
	len = under ? acceptLen-1 : acceptLen;




	if (!(flags & TCL_PARSE_NO_WHITESPACE)) {
	    /*
	     * Accept trailing whitespace.
	     */

	    while (len != 0 && TclIsSpaceProcM(*p)) {
		p++;







>
>
>







1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
	 * If the last char seen is the numeric whitespace character '_',
	 * backup to that.
	 */

	p = under ? acceptPoint-1 : acceptPoint;
	len = under ? acceptLen-1 : acceptLen;

	// No trailing '_' allowed
	status = under ? TCL_ERROR : TCL_OK;

	if (!(flags & TCL_PARSE_NO_WHITESPACE)) {
	    /*
	     * Accept trailing whitespace.
	     */

	    while (len != 0 && TclIsSpaceProcM(*p)) {
		p++;