X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Flexer%2Ftoken.c;h=9fa5bbb6ba81804534c809f4a2b90bb552c607cf;hb=refs%2Fheads%2Fdev5;hp=454bd518684154ee7a6f8bbad6ac972e913d5fae;hpb=a5f6c8f299c416a9cd0ad778b3988435b66fae33;p=pspp diff --git a/src/language/lexer/token.c b/src/language/lexer/token.c index 454bd51868..9fa5bbb6ba 100644 --- a/src/language/lexer/token.c +++ b/src/language/lexer/token.c @@ -176,7 +176,7 @@ token_to_string (const struct token *token) return string_representation (token->string); default: - return xstrdup_if_nonnull (token_type_to_name (token->type)); + return xstrdup_if_nonnull (token_type_to_string (token->type)); } } @@ -216,7 +216,7 @@ void tokens_uninit (struct tokens *tokens) { for (size_t i = 0; i < tokens->n; i++) - token_destroy (&tokens->tokens[i]); + token_uninit (&tokens->tokens[i]); free (tokens->tokens); } @@ -229,3 +229,10 @@ tokens_add (struct tokens *tokens, const struct token *t) token_copy (&tokens->tokens[tokens->n++], t); } + +void +tokens_print (const struct tokens *tokens, FILE *stream) +{ + for (size_t i = 0; i < tokens->n; i++) + token_print (&tokens->tokens[i], stream); +}