frontend: compile: print lex token details as they are read
This commit is contained in:
@@ -44,7 +44,24 @@ static int compile_file(const char *path)
|
||||
break;
|
||||
}
|
||||
|
||||
printf("read token!\n");
|
||||
printf("%s", ivy_lex_token_type_to_string(tok->t_type));
|
||||
|
||||
switch (tok->t_type) {
|
||||
case IVY_TOK_IDENT:
|
||||
case IVY_TOK_LABEL:
|
||||
printf("(%s)", tok->t_str);
|
||||
break;
|
||||
case IVY_TOK_SYMBOL:
|
||||
printf("(%s)", ivy_symbol_to_string(tok->t_symbol));
|
||||
break;
|
||||
case IVY_TOK_KEYWORD:
|
||||
printf("(%s)", ivy_keyword_to_string(tok->t_keyword));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int r = (lex.lex_status == IVY_OK || lex.lex_status == IVY_ERR_EOF) ? 0
|
||||
|
||||
Reference in New Issue
Block a user