Added $stringify. Remove of editor_plugin folder.

This commit is contained in:
Christoffer Lerno
2022-02-02 15:22:28 +01:00
parent 06917f2e65
commit ee32a5fd47
21 changed files with 169 additions and 707 deletions

View File

@@ -444,6 +444,17 @@ static Expr *parse_typeof_expr(ParseContext *context, Expr *left)
return expr;
}
static Expr *parse_ct_stringify(ParseContext *context, Expr *left)
{
assert(!left && "Unexpected left hand side");
Expr *expr = EXPR_NEW_TOKEN(EXPR_STRINGIFY, context->tok);
advance(context);
CONSUME_OR(TOKEN_LPAREN, poisoned_expr);
ASSIGN_EXPR_ELSE(expr->inner_expr, parse_expr(context), poisoned_expr);
CONSUME_OR(TOKEN_RPAREN, poisoned_expr);
return expr;
}
static Expr *parse_unary_expr(ParseContext *context, Expr *left)
{
@@ -1676,6 +1687,6 @@ ParseRule rules[TOKEN_EOF + 1] = {
[TOKEN_CT_NAMEOF] = { parse_ct_call, NULL, PREC_NONE },
[TOKEN_CT_QNAMEOF] = { parse_ct_call, NULL, PREC_NONE },
[TOKEN_CT_TYPEOF] = { parse_typeof_expr, NULL, PREC_NONE },
[TOKEN_CT_STRINGIFY] = { parse_ct_stringify, NULL, PREC_NONE },
[TOKEN_LBRACE] = { parse_initializer_list, NULL, PREC_NONE },
};