From 92efb5d0d7ba0c2b49cf189d5055bc0d9b09994c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 31 Oct 2009 14:05:02 -0400 Subject: Implement dmnsn_print_astree_sexpr(). --- dimension/tokenize.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'dimension/tokenize.c') diff --git a/dimension/tokenize.c b/dimension/tokenize.c index acd48f5..94543f1 100644 --- a/dimension/tokenize.c +++ b/dimension/tokenize.c @@ -1043,19 +1043,19 @@ dmnsn_delete_tokens(dmnsn_array *tokens) } static void -dmnsn_print_token(FILE *file, const dmnsn_token *token) +dmnsn_print_token(FILE *file, dmnsn_token token) { const char *tname; - if (token->type == DMNSN_T_LPAREN) { + if (token.type == DMNSN_T_LPAREN) { tname = "\\("; - } else if (token->type == DMNSN_T_RPAREN) { + } else if (token.type == DMNSN_T_RPAREN) { tname = "\\)"; } else { - tname = dmnsn_token_name(token->type); + tname = dmnsn_token_string(token.type); } - if (token->value) { - fprintf(file, "(%s \"%s\")", tname, token->value); + if (token.value) { + fprintf(file, "(%s \"%s\")", tname, token.value); } else { fprintf(file, "%s", tname); } @@ -1072,12 +1072,12 @@ dmnsn_print_token_sexpr(FILE *file, const dmnsn_array *tokens) } else { fprintf(file, "("); dmnsn_array_get(tokens, 0, &token); - dmnsn_print_token(file, &token); + dmnsn_print_token(file, token); for (i = 1; i < dmnsn_array_size(tokens); ++i) { fprintf(file, " "); dmnsn_array_get(tokens, i, &token); - dmnsn_print_token(file, &token); + dmnsn_print_token(file, token); } fprintf(file, ")"); @@ -1087,7 +1087,7 @@ dmnsn_print_token_sexpr(FILE *file, const dmnsn_array *tokens) } const char * -dmnsn_token_name(dmnsn_token_type token_type) +dmnsn_token_string(dmnsn_token_type token_type) { switch (token_type) { /* Macro to shorten this huge switch */ -- cgit v1.2.3