stage1 重构词法分析
This commit is contained in:
@@ -58,6 +58,7 @@ static inline spl_ast_node_t *node_at(spl_ast_t *ast, spl_ast_node_ref_t ref) {
|
||||
static spl_ast_node_ref_t new_node(parser_t *p, spl_ast_node_kind_t kind, const spl_tok_t *tok) {
|
||||
spl_ast_node_t n = {0};
|
||||
n.kind = kind;
|
||||
n.resolved_def_id = 0;
|
||||
if (tok) {
|
||||
n.dbg.dbg_name = spl_ast_kind_name(kind);
|
||||
n.dbg.fname = tok->fname;
|
||||
@@ -1833,6 +1834,7 @@ void spl_ast_dump(spl_ast_t *ast, spl_ast_node_ref_t node) {
|
||||
return;
|
||||
dump_stack_t stack;
|
||||
vec_init(stack);
|
||||
printf("AST:\n");
|
||||
dump_node(ast, node, &stack, 1);
|
||||
}
|
||||
|
||||
@@ -2109,6 +2111,7 @@ static void dump_node(spl_ast_t *ast, spl_ast_node_ref_t node_ref, dump_stack_t
|
||||
case SPL_AST_TYPE_STRUCT:
|
||||
case SPL_AST_TYPE_UNION:
|
||||
case SPL_AST_TYPE_ENUM:
|
||||
case SPL_AST_TYPE_SHAPE:
|
||||
dump_vec(ast, node->type_expr.attr_list, stack);
|
||||
dump_vec(ast, node->type_expr.aggregate_list, stack);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user