From b678465c11517a5342b1ec5aa4fe21570f13a3ed Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 29 Aug 2025 21:25:03 +0900 Subject: feat: add utility function to dump any internal object as JSON --- src/token.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/token.h') diff --git a/src/token.h b/src/token.h index 7e78dfa..7a624fb 100644 --- a/src/token.h +++ b/src/token.h @@ -2,6 +2,7 @@ #define DUCC_TOKEN_H #include "io.h" +#include "json.h" enum TokenKind { TokenKind_eof, @@ -162,7 +163,8 @@ struct Token { }; typedef struct Token Token; -const char* token_stringify(Token* t); +const char* token_stringify(Token* tok); +void token_build_json(JsonBuilder* builder, Token* tok); struct TokenArray { size_t len; @@ -175,5 +177,6 @@ void tokens_init(TokenArray* tokens, size_t capacity); void tokens_reserve(TokenArray* tokens, size_t size); Token* tokens_push_new(TokenArray* tokens); Token* tokens_pop(TokenArray* tokens); +void tokens_build_json(JsonBuilder* builder, TokenArray* tokens); #endif -- cgit v1.2.3-70-g09d2