mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Simplify expect_semicolon_newline_error rule
This commit is contained in:
+1
-6
@@ -1536,26 +1536,21 @@ 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:
|
||||||
case Token_EOF:
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (s != nullptr) {
|
|
||||||
if (is_semicolon_optional_for_node(f, s)) {
|
if (is_semicolon_optional_for_node(f, s)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Token tok = token;
|
Token tok = token;
|
||||||
tok.pos.column -= 1;
|
tok.pos.column -= 1;
|
||||||
syntax_error(tok, "Expected ';', got newline");
|
syntax_error(tok, "Expected ';', got newline");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void expect_semicolon(AstFile *f, Ast *s) {
|
void expect_semicolon(AstFile *f, Ast *s) {
|
||||||
|
|||||||
Reference in New Issue
Block a user