DE-labtory / koa

The koa is a high-level language that has more expressions than the bitcoin script and is simpler and easy to analyze
Apache License 2.0
74 stars 18 forks source link

[parser] apply scope to block statements #269

Closed zeroFruit closed 5 years ago

zeroFruit commented 5 years ago

Detail

func parseBlockStatement(buf TokenBuffer) (*ast.BlockStatement, error) {
    if err := expectNext(buf, Lbrace); err != nil {
        return nil, err
    }

    // TODO: enter scope

    for curToken.Type != Rbrace && curToken.Type != Eof {
        ...
    }

    if curTokenIs(buf, Rbrace) {
        buf.Read()
    }

    // TODO: leave scope

    return block, nil
}