| 349 | } |
| 350 | |
| 351 | function statement(type, value) { |
| 352 | if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex); |
| 353 | if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex); |
| 354 | if (type == "keyword b") return cont(pushlex("form"), statement, poplex); |
| 355 | if (type == "{") return cont(pushlex("}"), block, poplex); |
| 356 | if (type == ";") return cont(); |
| 357 | if (type == "if") { |
| 358 | if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex) |
| 359 | cx.state.cc.pop()(); |
| 360 | return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); |
| 361 | } |
| 362 | if (type == "function") return cont(functiondef); |
| 363 | if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); |
| 364 | if (type == "variable") return cont(pushlex("stat"), maybelabel); |
| 365 | if (type == "switch") return cont(pushlex("form"), parenExpr, pushlex("}", "switch"), expect("{"), |
| 366 | block, poplex, poplex); |
| 367 | if (type == "case") return cont(expression, expect(":")); |
| 368 | if (type == "default") return cont(expect(":")); |
| 369 | if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), |
| 370 | statement, poplex, popcontext); |
| 371 | if (type == "class") return cont(pushlex("form"), className, poplex); |
| 372 | if (type == "export") return cont(pushlex("stat"), afterExport, poplex); |
| 373 | if (type == "import") return cont(pushlex("stat"), afterImport, poplex); |
| 374 | if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex) |
| 375 | if (type == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";")); |
| 376 | if (type == "async") return cont(statement) |
| 377 | return pass(pushlex("stat"), expression, expect(";"), poplex); |
| 378 | } |
| 379 | function expression(type) { |
| 380 | return expressionInner(type, false); |
| 381 | } |