wrote dsl for ast boiler plate generation
This commit is contained in:
parent
b244f7e3b2
commit
e0dd8ff9d5
16 changed files with 915 additions and 60 deletions
|
|
@ -67,7 +67,7 @@ func (p *Parser) parseLeftAssocBinOps(operand operandFunc, tokenTypes ...lexer.T
|
|||
if err != nil {
|
||||
return e, err
|
||||
}
|
||||
e = &ast.BinaryExpr{Left: e, Operator: op, Right: r}
|
||||
e = &ast.BinaryExpr{Left: e, Op: op, Right: r}
|
||||
}
|
||||
|
||||
return e, nil
|
||||
|
|
@ -111,7 +111,7 @@ func (p *Parser) unary() (ast.Expr, error) {
|
|||
if p.match(lexer.TokenTypeBang, lexer.TokenTypeMinus) {
|
||||
op := p.previous()
|
||||
r, err := p.unary()
|
||||
return &ast.UnaryExpr{Operator: op, Right: r}, err
|
||||
return &ast.UnaryExpr{Op: op, Right: r}, err
|
||||
}
|
||||
|
||||
return p.primary()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue