MCPcopy Index your code
hub / github.com/reactjs/react-rails / scanOctalLiteral

Function scanOctalLiteral

lib/assets/javascripts/JSXTransformer.js:3362–3398  ·  view source on GitHub ↗
(prefix, start)

Source from the content-addressed store, hash-verified

3360 }
3361
3362 function scanOctalLiteral(prefix, start) {
3363 var number, octal;
3364
3365 if (isOctalDigit(prefix)) {
3366 octal = true;
3367 number = '0' + source[index++];
3368 } else {
3369 octal = false;
3370 ++index;
3371 number = '';
3372 }
3373
3374 while (index < length) {
3375 if (!isOctalDigit(source[index])) {
3376 break;
3377 }
3378 number += source[index++];
3379 }
3380
3381 if (!octal && number.length === 0) {
3382 // only 0o or 0O
3383 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3384 }
3385
3386 if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
3387 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3388 }
3389
3390 return {
3391 type: Token.NumericLiteral,
3392 value: parseInt(number, 8),
3393 octal: octal,
3394 lineNumber: lineNumber,
3395 lineStart: lineStart,
3396 range: [start, index]
3397 };
3398 }
3399
3400 function scanNumericLiteral() {
3401 var number, start, ch;

Callers 1

scanNumericLiteralFunction · 0.85

Calls 4

isOctalDigitFunction · 0.85
throwErrorFunction · 0.85
isIdentifierStartFunction · 0.85
isDecimalDigitFunction · 0.85

Tested by

no test coverage detected