lang: ast: use fancy index manipulation to reduce the size of ast_node_type

This commit is contained in:
2024-11-28 10:56:43 +00:00
parent f04c858d9a
commit fc76fe6ad4
10 changed files with 80 additions and 64 deletions

View File

@@ -164,15 +164,15 @@ struct ast_node_type class_node_ops = {
.n_state_size = sizeof(struct class_parser_state),
.n_node_size = sizeof(struct ivy_ast_class_node),
.n_symbol_parsers = {
[IVY_SYM_DOLLAR] = parse_dollar,
[IVY_SYM_HYPHEN] = parse_hyphen,
[IVY_SYM_PLUS] = parse_plus,
SYM_PARSER(DOLLAR, parse_dollar),
SYM_PARSER(HYPHEN, parse_hyphen),
SYM_PARSER(PLUS, parse_plus),
},
.n_token_parsers = {
[IVY_TOK_IDENT] = parse_ident,
[IVY_TOK_LINEFEED] = parse_linefeed,
TOK_PARSER(IDENT, parse_ident),
TOK_PARSER(LINEFEED, parse_linefeed),
},
.n_keyword_parsers = {
[IVY_KW_END] = parse_end,
KW_PARSER(END, parse_end),
},
};