mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Simplify expect_semicolon_newline_error rule
This commit is contained in:
+13
-18
@@ -1536,25 +1536,20 @@ bool is_semicolon_optional_for_node(AstFile *f, Ast *s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void expect_semicolon_newline_error(AstFile *f, Token const &token, Ast *s) {
|
void expect_semicolon_newline_error(AstFile *f, Token const &token, Ast *s) {
|
||||||
if (build_context.strict_style) {
|
if (build_context.strict_style && token.string == "\n") {
|
||||||
if (f->curr_proc != nullptr && token.string == "\n") {
|
switch (token.kind) {
|
||||||
switch (token.kind) {
|
case Token_CloseBrace:
|
||||||
case Token_CloseBrace:
|
case Token_CloseParen:
|
||||||
case Token_CloseParen:
|
case Token_else:
|
||||||
case Token_else:
|
return;
|
||||||
case Token_EOF:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (s != nullptr) {
|
|
||||||
if (is_semicolon_optional_for_node(f, s)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Token tok = token;
|
|
||||||
tok.pos.column -= 1;
|
|
||||||
syntax_error(tok, "Expected ';', got newline");
|
|
||||||
}
|
}
|
||||||
|
if (is_semicolon_optional_for_node(f, s)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Token tok = token;
|
||||||
|
tok.pos.column -= 1;
|
||||||
|
syntax_error(tok, "Expected ';', got newline");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user