Skip to content

Commit

Permalink
Closes #106. Fixed bug in parsing members.
Browse files Browse the repository at this point in the history
  • Loading branch information
AZHenley committed Apr 14, 2019
1 parent 564f00c commit b82dedd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions examples/classes.knox
@@ -1,6 +1,5 @@
class foobar {
//var hungry : bool = false;
var t : int = 0;
var hungry : bool = false;
func alive() void {
}
}
Expand Down
4 changes: 4 additions & 0 deletions parser/parser.go
Expand Up @@ -124,9 +124,13 @@ func (p *Parser) classBlock() ast.Node {
for !p.curTokenIs(token.RBRACE) {
if p.curTokenIs(token.VAR) {
blockNode.Children = append(blockNode.Children, p.varDecl())
p.consume(token.SEMICOLON)
} else if p.curTokenIs(token.FUNCTION) {
blockNode.Children = append(blockNode.Children, p.funcDecl())
} else {
p.abortMsg("Unexpected token in class block.")
}

}
p.consume(token.RBRACE)

Expand Down

0 comments on commit b82dedd

Please sign in to comment.