Skip to content

Commit

Permalink
parseIf start wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoiron committed Jul 4, 2014
1 parent 878dd3c commit bc0fd20
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions parse.go
Expand Up @@ -400,6 +400,8 @@ func (t *Tree) parseBlock() Node {
switch blockType.val {
case "for":
case "if":
t.backup2(start)
return t.parseIf()
case "block":
case "extends":
case "print":
Expand Down Expand Up @@ -430,6 +432,18 @@ func (t *Tree) parseSet() Node {
return newSet(start.pos, name, val)
}

func (t *Tree) parseIf() Node {
t.expect(tokenBlockBegin)
iftok := t.nextNonSpace()
if iftok.val != "if" {
t.unexpected(iftok, "if")
}
t.parseSingleExpr(nil, tokenBlockEnd)
// we need some kind of parseBody here

return nil
}

// parse a single expression simple expression. This is a lookup, literal, or
// index expression.
func (t *Tree) parseSingleExpr(stack *nodeStack, terminator itemType) Node {
Expand Down

0 comments on commit bc0fd20

Please sign in to comment.