MCPcopy Create free account
hub / github.com/dchester/jsonpath / scanHexLiteral

Function scanHexLiteral

jsonpath.js:790–816  ·  view source on GitHub ↗
(start)

Source from the content-addressed store, hash-verified

788 // 7.8.3 Numeric Literals
789
790 function scanHexLiteral(start) {
791 var number = '';
792
793 while (index < length) {
794 if (!isHexDigit(source[index])) {
795 break;
796 }
797 number += source[index++];
798 }
799
800 if (number.length === 0) {
801 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
802 }
803
804 if (isIdentifierStart(source.charCodeAt(index))) {
805 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
806 }
807
808 return {
809 type: Token.NumericLiteral,
810 value: parseInt('0x' + number, 16),
811 lineNumber: lineNumber,
812 lineStart: lineStart,
813 start: start,
814 end: index
815 };
816 }
817
818 function scanOctalLiteral(start) {
819 var number = '0' + source[index++];

Callers 1

scanNumericLiteralFunction · 0.85

Calls 3

isHexDigitFunction · 0.85
throwErrorFunction · 0.85
isIdentifierStartFunction · 0.85

Tested by

no test coverage detected