Implemented else blocks
This commit is contained in:
@ -7,19 +7,19 @@ import (
|
||||
|
||||
// Parse generates an AST from a list of tokens.
|
||||
func Parse(tokens []token.Token, source []byte) (AST, error) {
|
||||
tree := make(AST, 0, len(tokens)/64)
|
||||
nodes := make(AST, 0, len(tokens)/64)
|
||||
|
||||
err := EachInstruction(tokens, func(instruction token.List) error {
|
||||
node, err := parseNode(instruction, source)
|
||||
node, err := parseNode(instruction, source, nodes)
|
||||
|
||||
if err == nil && node != nil {
|
||||
tree = append(tree, node)
|
||||
nodes = append(nodes, node)
|
||||
}
|
||||
|
||||
return err
|
||||
})
|
||||
|
||||
return tree, err
|
||||
return nodes, err
|
||||
}
|
||||
|
||||
// IsAssignment returns true if the expression is an assignment.
|
||||
|
Reference in New Issue
Block a user