aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/token.h
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-29 21:25:03 +0900
committernsfisis <nsfisis@gmail.com>2025-08-29 21:49:56 +0900
commitb678465c11517a5342b1ec5aa4fe21570f13a3ed (patch)
tree6ef19e02b1cf18f5ac451e6104f6e20b475a6f52 /src/token.h
parent8f352553faec69a6f29854898b93be47604aff28 (diff)
downloadducc-b678465c11517a5342b1ec5aa4fe21570f13a3ed.tar.gz
ducc-b678465c11517a5342b1ec5aa4fe21570f13a3ed.tar.zst
ducc-b678465c11517a5342b1ec5aa4fe21570f13a3ed.zip
feat: add utility function to dump any internal object as JSON
Diffstat (limited to 'src/token.h')
-rw-r--r--src/token.h5
1 files changed, 4 insertions, 1 deletions
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