MCPcopy
hub / github.com/DHTMLX/gantt / statement

Function statement

samples/common/codehighlight/javascript.js:368–416  ·  view source on GitHub ↗
(type, value)

Source from the content-addressed store, hash-verified

366 }
367
368 function statement(type, value) {
369 if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
370 if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
371 if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
372 if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
373 if (type == "debugger") return cont(expect(";"));
374 if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
375 if (type == ";") return cont();
376 if (type == "if") {
377 if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
378 cx.state.cc.pop()();
379 return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
380 }
381 if (type == "function") return cont(functiondef);
382 if (type == "for") return cont(pushlex("form"), pushblockcontext, forspec, statement, popcontext, poplex);
383 if (type == "class" || (isTS && value == "interface")) {
384 cx.marked = "keyword"
385 return cont(pushlex("form", type == "class" ? type : value), className, poplex)
386 }
387 if (type == "variable") {
388 if (isTS && value == "declare") {
389 cx.marked = "keyword"
390 return cont(statement)
391 } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
392 cx.marked = "keyword"
393 if (value == "enum") return cont(enumdef);
394 else if (value == "type") return cont(typename, expect("operator"), typeexpr, expect(";"));
395 else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
396 } else if (isTS && value == "namespace") {
397 cx.marked = "keyword"
398 return cont(pushlex("form"), expression, statement, poplex)
399 } else if (isTS && value == "abstract") {
400 cx.marked = "keyword"
401 return cont(statement)
402 } else {
403 return cont(pushlex("stat"), maybelabel);
404 }
405 }
406 if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
407 block, poplex, poplex, popcontext);
408 if (type == "case") return cont(expression, expect(":"));
409 if (type == "default") return cont(expect(":"));
410 if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
411 if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
412 if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
413 if (type == "async") return cont(statement)
414 if (value == "@") return cont(expression, statement)
415 return pass(pushlex("stat"), expression, expect(";"), poplex);
416 }
417 function maybeCatchBinding(type) {
418 if (type == "(") return cont(funarg, expect(")"))
419 }

Callers

nothing calls this directly

Calls 4

contFunction · 0.85
pushlexFunction · 0.85
expectFunction · 0.85
passFunction · 0.85

Tested by

no test coverage detected