debug: add print support for new ast node types

This commit is contained in:
2026-05-12 23:00:03 +01:00
parent 750e3df7d5
commit 34114ca451
+15 -6
View File
@@ -24,6 +24,8 @@ extern void print_lex_token(struct lex_token *tok)
break;
case TOK_INT:
case TOK_DOUBLE:
case TOK_VAR:
case TOK_VAR_SPLAT:
fx_puts("[yellow]");
break;
case TOK_OPERATOR:
@@ -32,16 +34,10 @@ extern void print_lex_token(struct lex_token *tok)
case TOK_WORD:
case TOK_WORD_START:
case TOK_WORD_END:
case TOK_VAR:
case TOK_VAR_SPLAT:
fx_puts("[cyan]");
break;
case TOK_STRING:
fx_puts("[green]");
break;
case TOK_STR_START:
fx_puts("[green]");
break;
case TOK_STR_END:
fx_puts("[green]");
break;
@@ -100,15 +96,28 @@ void print_ast_node(struct ast_node *node)
}
switch (node->n_type) {
case AST_IF:
case AST_IF_BRANCH:
case AST_BLOCK:
case AST_FUNC:
case AST_STMT_LIST:
fx_puts("[magenta]");
break;
case AST_REDIRECTION:
case AST_PIPELINE:
case AST_OP:
case AST_ARRAY:
case AST_HASHTABLE:
case AST_HASHTABLE_ITEM:
fx_puts("[blue]");
break;
case AST_CMDCALL:
case AST_NULL:
fx_puts("[red]");
break;
case AST_INT:
case AST_DOUBLE:
case AST_VAR:
fx_puts("[yellow]");
break;
case AST_WORD: