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

Function parseSwitchCase

jsonpath.js:3058–3080  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3056 // 12.10 The swith statement
3057
3058 function parseSwitchCase() {
3059 var test, consequent = [], statement, startToken;
3060
3061 startToken = lookahead;
3062 if (matchKeyword('default')) {
3063 lex();
3064 test = null;
3065 } else {
3066 expectKeyword('case');
3067 test = parseExpression();
3068 }
3069 expect(':');
3070
3071 while (index < length) {
3072 if (match('}') || matchKeyword('default') || matchKeyword('case')) {
3073 break;
3074 }
3075 statement = parseStatement();
3076 consequent.push(statement);
3077 }
3078
3079 return delegate.markEnd(delegate.createSwitchCase(test, consequent), startToken);
3080 }
3081
3082 function parseSwitchStatement() {
3083 var discriminant, cases, clause, oldInSwitch, defaultFound;

Callers 1

parseSwitchStatementFunction · 0.85

Calls 7

matchKeywordFunction · 0.85
expectKeywordFunction · 0.85
parseExpressionFunction · 0.85
expectFunction · 0.85
matchFunction · 0.85
parseStatementFunction · 0.85
lexFunction · 0.70

Tested by

no test coverage detected