cond = this->expression(PRECEDENCE_NORMAL, false, false, NULL, NULL);
}
+ // Check for the easy error of a newline before starting the block.
+ if (this->peek_token()->is_op(OPERATOR_SEMICOLON))
+ {
+ Location semi_loc = this->location();
+ if (this->advance_token()->is_op(OPERATOR_LCURLY))
+ error_at(semi_loc, "missing %<{%> after if clause");
+ // Otherwise we will get an error when we call this->block
+ // below.
+ }
+
this->gogo_->start_block(this->location());
Location end_loc = this->block();
Block* then_block = this->gogo_->finish_block(end_loc);
Location token_loc = this->location();
if (this->peek_token()->is_op(OPERATOR_SEMICOLON)
&& this->advance_token()->is_op(OPERATOR_LCURLY))
- error_at(token_loc, "unexpected semicolon or newline before %<{%>");
+ error_at(token_loc, "missing %<{%> after switch clause");
else if (this->peek_token()->is_op(OPERATOR_COLONEQ))
{
error_at(token_loc, "invalid variable name");
}
}
+ // Check for the easy error of a newline before starting the block.
+ if (this->peek_token()->is_op(OPERATOR_SEMICOLON))
+ {
+ Location semi_loc = this->location();
+ if (this->advance_token()->is_op(OPERATOR_LCURLY))
+ error_at(semi_loc, "missing %<{%> after for clause");
+ // Otherwise we will get an error when we call this->block
+ // below.
+ }
+
// Build the For_statement and note that it is the current target
// for break and continue statements.
*cond = NULL;
else if (this->peek_token()->is_op(OPERATOR_LCURLY))
{
- error_at(this->location(),
- "unexpected semicolon or newline before %<{%>");
+ error_at(this->location(), "missing %<{%> after for clause");
*cond = NULL;
*post = NULL;
return;