diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-10-31 14:05:02 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-10-31 14:05:02 -0400 |
commit | 92efb5d0d7ba0c2b49cf189d5055bc0d9b09994c (patch) | |
tree | 8634a495a71efac721e1fae8fd2b61461fbcdea9 /dimension/tokenize.c | |
parent | ff94c67ce80d6baf4677c4564796e163b8d6b5aa (diff) | |
download | dimension-92efb5d0d7ba0c2b49cf189d5055bc0d9b09994c.tar.xz |
Implement dmnsn_print_astree_sexpr().
Diffstat (limited to 'dimension/tokenize.c')
-rw-r--r-- | dimension/tokenize.c | 18 |
1 files changed, 9 insertions, 9 deletions
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 */ |