From 11624e8eb120e442345c2b9efc131d2ef2c5fd07 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 18 May 2021 22:54:01 +0200 Subject: [PATCH] Remove old cast syntax. --- src/compiler/enums.h | 1 - src/compiler/parse_expr.c | 13 ------------- src/compiler/parse_stmt.c | 1 - src/compiler/tokens.c | 2 -- src/version.h | 2 +- 5 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/compiler/enums.h b/src/compiler/enums.h index a7ebc4f09..113b7c943 100644 --- a/src/compiler/enums.h +++ b/src/compiler/enums.h @@ -403,7 +403,6 @@ typedef enum TOKEN_ATTRIBUTE, TOKEN_BREAK, TOKEN_CASE, - TOKEN_CAST, TOKEN_CATCH, TOKEN_CONST, TOKEN_CONTINUE, diff --git a/src/compiler/parse_expr.c b/src/compiler/parse_expr.c index a5d9f5cf3..3f2b02d8f 100644 --- a/src/compiler/parse_expr.c +++ b/src/compiler/parse_expr.c @@ -238,18 +238,6 @@ static Expr *parse_type_identifier(Context *context, Expr *left) return parse_type_expression_with_path(context, NULL); } -static Expr *parse_cast_expr(Context *context, Expr *left) -{ - assert(!left && "Unexpected left hand side"); - Expr *expr = EXPR_NEW_TOKEN(EXPR_CAST, context->tok); - advance_and_verify(context, TOKEN_CAST); - CONSUME_OR(TOKEN_LPAREN, poisoned_expr); - expr->cast_expr.expr = TRY_EXPR_OR(parse_expr(context), poisoned_expr); - CONSUME_OR(TOKEN_AS, poisoned_expr); - expr->cast_expr.type_info = TRY_TYPE_OR(parse_type(context), poisoned_expr); - CONSUME_OR(TOKEN_RPAREN, poisoned_expr); - return expr; -} static Expr *parse_typeof_expr(Context *context, Expr *left) { assert(!left && "Unexpected left hand side"); @@ -1046,7 +1034,6 @@ ParseRule rules[TOKEN_EOF + 1] = { [TOKEN_MINUSMINUS] = { parse_unary_expr, parse_post_unary, PREC_CALL }, [TOKEN_LPAREN] = { parse_grouping_expr, parse_call_expr, PREC_CALL }, [TOKEN_LBRAPIPE] = { parse_expr_block, NULL, PREC_NONE }, - [TOKEN_CAST] = { parse_cast_expr, NULL, PREC_NONE }, [TOKEN_TYPEOF] = { parse_typeof_expr, NULL, PREC_NONE }, [TOKEN_TRY] = { parse_try_expr, NULL, PREC_NONE }, [TOKEN_CATCH] = { parse_try_expr, NULL, PREC_NONE }, diff --git a/src/compiler/parse_stmt.c b/src/compiler/parse_stmt.c index 11f5b5333..c39555eea 100644 --- a/src/compiler/parse_stmt.c +++ b/src/compiler/parse_stmt.c @@ -1091,7 +1091,6 @@ Ast *parse_stmt(Context *context) case TOKEN_CT_IDENT: case TOKEN_STRING: case TOKEN_REAL: - case TOKEN_CAST: case TOKEN_FALSE: case TOKEN_NULL: case TOKEN_TRUE: diff --git a/src/compiler/tokens.c b/src/compiler/tokens.c index 9b95752a0..8382bc357 100644 --- a/src/compiler/tokens.c +++ b/src/compiler/tokens.c @@ -186,8 +186,6 @@ const char *token_type_to_string(TokenType type) return "break"; case TOKEN_CASE: return "case"; - case TOKEN_CAST: - return "cast"; case TOKEN_CATCH: return "catch"; case TOKEN_CONST: diff --git a/src/version.h b/src/version.h index c1882b43a..d31f00a96 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "A221" \ No newline at end of file +#define COMPILER_VERSION "A222" \ No newline at end of file