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

Function parseStatement

jsonpath.js:3204–3287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3202 // 12 Statements
3203
3204 function parseStatement() {
3205 var type = lookahead.type,
3206 expr,
3207 labeledBody,
3208 key,
3209 startToken;
3210
3211 if (type === Token.EOF) {
3212 throwUnexpected(lookahead);
3213 }
3214
3215 if (type === Token.Punctuator && lookahead.value === '{') {
3216 return parseBlock();
3217 }
3218
3219 startToken = lookahead;
3220
3221 if (type === Token.Punctuator) {
3222 switch (lookahead.value) {
3223 case ';':
3224 return delegate.markEnd(parseEmptyStatement(), startToken);
3225 case '(':
3226 return delegate.markEnd(parseExpressionStatement(), startToken);
3227 default:
3228 break;
3229 }
3230 }
3231
3232 if (type === Token.Keyword) {
3233 switch (lookahead.value) {
3234 case 'break':
3235 return delegate.markEnd(parseBreakStatement(), startToken);
3236 case 'continue':
3237 return delegate.markEnd(parseContinueStatement(), startToken);
3238 case 'debugger':
3239 return delegate.markEnd(parseDebuggerStatement(), startToken);
3240 case 'do':
3241 return delegate.markEnd(parseDoWhileStatement(), startToken);
3242 case 'for':
3243 return delegate.markEnd(parseForStatement(), startToken);
3244 case 'function':
3245 return delegate.markEnd(parseFunctionDeclaration(), startToken);
3246 case 'if':
3247 return delegate.markEnd(parseIfStatement(), startToken);
3248 case 'return':
3249 return delegate.markEnd(parseReturnStatement(), startToken);
3250 case 'switch':
3251 return delegate.markEnd(parseSwitchStatement(), startToken);
3252 case 'throw':
3253 return delegate.markEnd(parseThrowStatement(), startToken);
3254 case 'try':
3255 return delegate.markEnd(parseTryStatement(), startToken);
3256 case 'var':
3257 return delegate.markEnd(parseVariableStatement(), startToken);
3258 case 'while':
3259 return delegate.markEnd(parseWhileStatement(), startToken);
3260 case 'with':
3261 return delegate.markEnd(parseWithStatement(), startToken);

Callers 7

parseIfStatementFunction · 0.85
parseDoWhileStatementFunction · 0.85
parseWhileStatementFunction · 0.85
parseForStatementFunction · 0.85
parseWithStatementFunction · 0.85
parseSwitchCaseFunction · 0.85
parseSourceElementFunction · 0.85

Calls 15

throwUnexpectedFunction · 0.85
parseBlockFunction · 0.85
parseEmptyStatementFunction · 0.85
parseExpressionStatementFunction · 0.85
parseBreakStatementFunction · 0.85
parseContinueStatementFunction · 0.85
parseDebuggerStatementFunction · 0.85
parseDoWhileStatementFunction · 0.85
parseForStatementFunction · 0.85
parseFunctionDeclarationFunction · 0.85
parseIfStatementFunction · 0.85
parseReturnStatementFunction · 0.85

Tested by

no test coverage detected