authorgravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2017-04-02 12:46:18-07:00
committergravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2017-04-02 12:46:18-07:00
log136a9a9d6b657e29680ca53f158f46eb5b92e9e7
tree08dbb09049745d9b2529dd5bf33394632b3b3eb0
parent4b9e782d37a334740a04190e3b3dd375f41ef3fe

variable declarations must be followed by semicolon


1 files changed, 6 insertions(+), 4 deletions(-)

src/parser.cpp+6-4
......@@ -1598,8 +1598,6 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to
15981598 *token_index += 1;
15991599 if (eq_or_colon->id == TokenIdEq) {
16001600 node->data.variable_declaration.expr = ast_parse_expression(pc, token_index, true);
1601
1602 return node;
16031601 } else if (eq_or_colon->id == TokenIdColon) {
16041602 node->data.variable_declaration.type = ast_parse_type_expr(pc, token_index, true);
16051603 Token *eq_token = &pc->tokens->at(*token_index);
......@@ -1608,11 +1606,15 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to
16081606
16091607 node->data.variable_declaration.expr = ast_parse_expression(pc, token_index, true);
16101608 }
1611
1612 return node;
16131609 } else {
16141610 ast_invalid_token_error(pc, eq_or_colon);
16151611 }
1612
1613 // peek ahead and ensure that all variable declarations are followed by a semicolon
1614 Token *semicolon_token = &pc->tokens->at(*token_index);
1615 ast_expect_token(pc, semicolon_token, TokenIdSemicolon);
1616
1617 return node;
16161618}
16171619
16181620/*