MCPcopy
hub / github.com/inlife/nexrender / scanNumericLiteral

Function scanNumericLiteral

packages/nexrender-action-lottie/lib/jsx/esprima.jsx:880–955  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

878 }
879
880 function scanNumericLiteral() {
881 var number, start, ch;
882
883 ch = source[index];
884 assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
885 'Numeric literal must start with a decimal digit or a decimal point');
886
887 start = index;
888 number = '';
889 if (ch !== '.') {
890 number = source[index++];
891 ch = source[index];
892
893 if (number === '0') {
894 if (ch === 'x' || ch === 'X') {
895 ++index;
896 return scanHexLiteral(start);
897 }
898 if (ch === 'b' || ch === 'B') {
899 ++index;
900 return scanBinaryLiteral(start);
901 }
902 if (ch === 'o' || ch === 'O') {
903 return scanOctalLiteral(ch, start);
904 }
905
906 if (isOctalDigit(ch)) {
907 if (isImplicitOctalLiteral()) {
908 return scanOctalLiteral(ch, start);
909 }
910 }
911 }
912
913 while (isDecimalDigit(source.charCodeAt(index))) {
914 number += source[index++];
915 }
916 ch = source[index];
917 }
918
919 if (ch === '.') {
920 number += source[index++];
921 while (isDecimalDigit(source.charCodeAt(index))) {
922 number += source[index++];
923 }
924 ch = source[index];
925 }
926
927 if (ch === 'e' || ch === 'E') {
928 number += source[index++];
929
930 ch = source[index];
931 if (ch === '+' || ch === '-') {
932 number += source[index++];
933 }
934 if (isDecimalDigit(source.charCodeAt(index))) {
935 while (isDecimalDigit(source.charCodeAt(index))) {
936 number += source[index++];
937 }

Callers 1

advanceFunction · 0.85

Calls 9

assertFunction · 0.85
isDecimalDigitFunction · 0.85
scanHexLiteralFunction · 0.85
scanBinaryLiteralFunction · 0.85
scanOctalLiteralFunction · 0.85
isOctalDigitFunction · 0.85
isImplicitOctalLiteralFunction · 0.85
throwUnexpectedTokenFunction · 0.85
isIdentifierStartFunction · 0.85

Tested by

no test coverage detected