frontend: add debug-print support for ATOM and STRING nodes; add colour to several node types
This commit is contained in:
@@ -144,6 +144,9 @@ extern enum ivy_status print_ast_node(
|
|||||||
case IVY_AST_UNIT_PACKAGE:
|
case IVY_AST_UNIT_PACKAGE:
|
||||||
case IVY_AST_UNIT_IMPORT:
|
case IVY_AST_UNIT_IMPORT:
|
||||||
case IVY_AST_COND_GROUP:
|
case IVY_AST_COND_GROUP:
|
||||||
|
case IVY_AST_WHILE_LOOP:
|
||||||
|
case IVY_AST_FOR_LOOP:
|
||||||
|
case IVY_AST_RETURN:
|
||||||
b_puts("[magenta]");
|
b_puts("[magenta]");
|
||||||
break;
|
break;
|
||||||
case IVY_AST_OP:
|
case IVY_AST_OP:
|
||||||
@@ -154,6 +157,7 @@ extern enum ivy_status print_ast_node(
|
|||||||
break;
|
break;
|
||||||
case IVY_AST_INT:
|
case IVY_AST_INT:
|
||||||
case IVY_AST_DOUBLE:
|
case IVY_AST_DOUBLE:
|
||||||
|
case IVY_AST_ATOM:
|
||||||
b_puts("[yellow]");
|
b_puts("[yellow]");
|
||||||
break;
|
break;
|
||||||
case IVY_AST_COND:
|
case IVY_AST_COND:
|
||||||
@@ -168,6 +172,9 @@ extern enum ivy_status print_ast_node(
|
|||||||
case IVY_AST_FSTRING:
|
case IVY_AST_FSTRING:
|
||||||
b_puts("[green]");
|
b_puts("[green]");
|
||||||
break;
|
break;
|
||||||
|
case IVY_AST_DISCARD:
|
||||||
|
b_puts("[dark_grey]");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -190,6 +197,16 @@ extern enum ivy_status print_ast_node(
|
|||||||
b_printf(" (%s)", v->n_content->t_str);
|
b_printf(" (%s)", v->n_content->t_str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case IVY_AST_STRING: {
|
||||||
|
struct ivy_ast_string_node *v = (struct ivy_ast_string_node *)node;
|
||||||
|
b_printf(" (\"%s\")", v->n_value->t_str);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IVY_AST_ATOM: {
|
||||||
|
struct ivy_ast_atom_node *v = (struct ivy_ast_atom_node *)node;
|
||||||
|
b_printf(" (%s)", v->n_content->t_str);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case IVY_AST_SELECTOR: {
|
case IVY_AST_SELECTOR: {
|
||||||
struct ivy_ast_selector_node *v
|
struct ivy_ast_selector_node *v
|
||||||
= (struct ivy_ast_selector_node *)node;
|
= (struct ivy_ast_selector_node *)node;
|
||||||
|
|||||||
Reference in New Issue
Block a user