| 513 | } |
| 514 | |
| 515 | function statement(type, value) { |
| 516 | if (type == "var") |
| 517 | return cont( |
| 518 | pushlex("vardef", value), |
| 519 | vardef, |
| 520 | expect(";"), |
| 521 | poplex |
| 522 | ); |
| 523 | if (type == "keyword a") |
| 524 | return cont(pushlex("form"), parenExpr, statement, poplex); |
| 525 | if (type == "keyword b") |
| 526 | return cont(pushlex("form"), statement, poplex); |
| 527 | if (type == "keyword d") |
| 528 | return cx.stream.match(/^\s*$/, false) |
| 529 | ? cont() |
| 530 | : cont( |
| 531 | pushlex("stat"), |
| 532 | maybeexpression, |
| 533 | expect(";"), |
| 534 | poplex |
| 535 | ); |
| 536 | if (type == "debugger") return cont(expect(";")); |
| 537 | if (type == "{") |
| 538 | return cont( |
| 539 | pushlex("}"), |
| 540 | pushblockcontext, |
| 541 | block, |
| 542 | poplex, |
| 543 | popcontext |
| 544 | ); |
| 545 | if (type == ";") return cont(); |
| 546 | if (type == "if") { |
| 547 | if ( |
| 548 | cx.state.lexical.info == "else" && |
| 549 | cx.state.cc[cx.state.cc.length - 1] == poplex |
| 550 | ) |
| 551 | cx.state.cc.pop()(); |
| 552 | return cont( |
| 553 | pushlex("form"), |
| 554 | parenExpr, |
| 555 | statement, |
| 556 | poplex, |
| 557 | maybeelse |
| 558 | ); |
| 559 | } |
| 560 | if (type == "function") return cont(functiondef); |
| 561 | if (type == "for") |
| 562 | return cont( |
| 563 | pushlex("form"), |
| 564 | pushblockcontext, |
| 565 | forspec, |
| 566 | statement, |
| 567 | popcontext, |
| 568 | poplex |
| 569 | ); |
| 570 | if (type == "class" || (isTS && value == "interface")) { |
| 571 | cx.marked = "keyword"; |
| 572 | return cont( |