Allow else-if statements
This commit is contained in:
parent
0ab370b8e4
commit
c170f0c0c6
1 changed files with 6 additions and 1 deletions
|
|
@ -393,7 +393,12 @@ func (p *Parser) statement() (Node, error) {
|
|||
var otherwise Node
|
||||
|
||||
if p.accept(TokenElse) {
|
||||
otherwise, err = p.block(false)
|
||||
// allow else if
|
||||
if p.curr.Type == TokenIf {
|
||||
otherwise, err = p.statement()
|
||||
} else {
|
||||
otherwise, err = p.block(false)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue