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

Function parseSourceElements

jsonpath.js:3512–3549  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3510 }
3511
3512 function parseSourceElements() {
3513 var sourceElement, sourceElements = [], token, directive, firstRestricted;
3514
3515 while (index < length) {
3516 token = lookahead;
3517 if (token.type !== Token.StringLiteral) {
3518 break;
3519 }
3520
3521 sourceElement = parseSourceElement();
3522 sourceElements.push(sourceElement);
3523 if (sourceElement.expression.type !== Syntax.Literal) {
3524 // this is not directive
3525 break;
3526 }
3527 directive = source.slice(token.start + 1, token.end - 1);
3528 if (directive === 'use strict') {
3529 strict = true;
3530 if (firstRestricted) {
3531 throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
3532 }
3533 } else {
3534 if (!firstRestricted && token.octal) {
3535 firstRestricted = token;
3536 }
3537 }
3538 }
3539
3540 while (index < length) {
3541 sourceElement = parseSourceElement();
3542 /* istanbul ignore if */
3543 if (typeof sourceElement === 'undefined') {
3544 break;
3545 }
3546 sourceElements.push(sourceElement);
3547 }
3548 return sourceElements;
3549 }
3550
3551 function parseProgram() {
3552 var body, startToken;

Callers 1

parseProgramFunction · 0.85

Calls 2

parseSourceElementFunction · 0.85
throwErrorTolerantFunction · 0.85

Tested by

no test coverage detected