stmt()

in lib/parser.js [2245:2289]


  stmt() {
    if (this.look.tag === Tag.IF) {
      return this.ifStmt();
    }

    if (this.look.tag === Tag.WHILE) {
      return this.whileStmt();
    }

    if (this.look.tag === Tag.FOR) {
      return this.forStmt();
    }

    if (this.look.tag === Tag.TRY) {
      return this.tryStmt();
    }

    if (this.isWord(Tag.ID, 'retry')) {
      return this.retryStmt();
    }

    if (this.look.tag === Tag.BREAK) {
      return this.breakStmt();
    }

    if (this.look.tag === Tag.RETURN) {
      return this.returnStmt();
    }

    if (this.look.tag === Tag.YIELD) {
      return this.yieldStmt();
    }

    if (this.look.tag === Tag.THROW) {
      return this.throwStmt();
    }

    if (this.look.tag === Tag.VAR) {
      return this.declare();
    }

    let expr = this.expr();
    this.match(';');
    return expr;
  }