lang: add colour to internal print functions
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <ivy/lang/internal.h>
|
||||
#include <blue/object/number.h>
|
||||
#include <blue/term/print.h>
|
||||
|
||||
static void print_symbol_node(struct ivy_lexer_symbol_node *node, int depth)
|
||||
{
|
||||
@@ -10,13 +11,13 @@ static void print_symbol_node(struct ivy_lexer_symbol_node *node, int depth)
|
||||
fputs(" ", stdout);
|
||||
}
|
||||
|
||||
printf("%c", node->s_char);
|
||||
b_printf("[cyan]%c[reset]", node->s_char);
|
||||
|
||||
if (node->s_id != IVY_SYM_NONE) {
|
||||
printf(" (%s)", ivy_symbol_to_string(node->s_id));
|
||||
b_printf(" ([magenta]%s[reset])", ivy_symbol_to_string(node->s_id));
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
b_printf("\n");
|
||||
|
||||
b_queue_iterator it;
|
||||
b_queue_foreach (&it, &node->s_children) {
|
||||
@@ -39,6 +40,6 @@ void internal_lexer_print_keyword_dict(struct ivy_lexer* lex)
|
||||
const char *kw_name = it.key;
|
||||
enum ivy_keyword kw_id = b_number_get_int(B_NUMBER(it.value));
|
||||
|
||||
printf("[%s] = '%s'\n", ivy_keyword_to_string(kw_id), kw_name);
|
||||
b_printf("([magenta]%s[reset]) = [green]%s[reset]\n", ivy_keyword_to_string(kw_id), kw_name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user