MCPcopy Index your code
hub / github.com/BloombergGraphics/whatiscode / parseScriptBody

Function parseScriptBody

scripts/libs/esprima.js:4253–4290  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4251 // 14 Program
4252
4253 function parseScriptBody() {
4254 var statement, body = [], token, directive, firstRestricted;
4255
4256 while (startIndex < length) {
4257 token = lookahead;
4258 if (token.type !== Token.StringLiteral) {
4259 break;
4260 }
4261
4262 statement = parseStatementListItem();
4263 body.push(statement);
4264 if (statement.expression.type !== Syntax.Literal) {
4265 // this is not directive
4266 break;
4267 }
4268 directive = source.slice(token.start + 1, token.end - 1);
4269 if (directive === 'use strict') {
4270 strict = true;
4271 if (firstRestricted) {
4272 tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
4273 }
4274 } else {
4275 if (!firstRestricted && token.octal) {
4276 firstRestricted = token;
4277 }
4278 }
4279 }
4280
4281 while (startIndex < length) {
4282 statement = parseStatementListItem();
4283 /* istanbul ignore if */
4284 if (typeof statement === 'undefined') {
4285 break;
4286 }
4287 body.push(statement);
4288 }
4289 return body;
4290 }
4291
4292 function parseProgram() {
4293 var body, node;

Callers 1

parseProgramFunction · 0.85

Calls 2

parseStatementListItemFunction · 0.85
tolerateUnexpectedTokenFunction · 0.85

Tested by

no test coverage detected