()
| 888 | } |
| 889 | |
| 890 | function scanNumericLiteral() { |
| 891 | var number, start, ch; |
| 892 | |
| 893 | ch = source[index]; |
| 894 | assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), |
| 895 | 'Numeric literal must start with a decimal digit or a decimal point'); |
| 896 | |
| 897 | start = index; |
| 898 | number = ''; |
| 899 | if (ch !== '.') { |
| 900 | number = source[index++]; |
| 901 | ch = source[index]; |
| 902 | |
| 903 | // Hex number starts with '0x'. |
| 904 | // Octal number starts with '0'. |
| 905 | // Octal number in ES6 starts with '0o'. |
| 906 | // Binary number in ES6 starts with '0b'. |
| 907 | if (number === '0') { |
| 908 | if (ch === 'x' || ch === 'X') { |
| 909 | ++index; |
| 910 | return scanHexLiteral(start); |
| 911 | } |
| 912 | if (ch === 'b' || ch === 'B') { |
| 913 | ++index; |
| 914 | return scanBinaryLiteral(start); |
| 915 | } |
| 916 | if (ch === 'o' || ch === 'O') { |
| 917 | return scanOctalLiteral(ch, start); |
| 918 | } |
| 919 | |
| 920 | if (isOctalDigit(ch)) { |
| 921 | if (isImplicitOctalLiteral()) { |
| 922 | return scanOctalLiteral(ch, start); |
| 923 | } |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | while (isDecimalDigit(source.charCodeAt(index))) { |
| 928 | number += source[index++]; |
| 929 | } |
| 930 | ch = source[index]; |
| 931 | } |
| 932 | |
| 933 | if (ch === '.') { |
| 934 | number += source[index++]; |
| 935 | while (isDecimalDigit(source.charCodeAt(index))) { |
| 936 | number += source[index++]; |
| 937 | } |
| 938 | ch = source[index]; |
| 939 | } |
| 940 | |
| 941 | if (ch === 'e' || ch === 'E') { |
| 942 | number += source[index++]; |
| 943 | |
| 944 | ch = source[index]; |
| 945 | if (ch === '+' || ch === '-') { |
| 946 | number += source[index++]; |
| 947 | } |
no test coverage detected