diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-03 15:01:23 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-03 15:01:23 -0400 |
| commit | cedae3039c8d67568b5ac35833c10cbfc1c7cb23 (patch) | |
| tree | 1b1ff363a3c2be77d26acfb1a55dd267ec073f3e /src/ast.c | |
| parent | 59993b85301071540a90a0e97df27e83000f77f7 (diff) | |
Fix textual representation of table types
Diffstat (limited to 'src/ast.c')
| -rw-r--r-- | src/ast.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -171,11 +171,21 @@ CORD ast_to_xml(ast_t *ast) } } -const char *ast_to_str(ast_t *ast) +const char *ast_to_xml_str(ast_t *ast) { return CORD_to_const_char_star(ast_to_xml(ast)); } +const char *ast_source(ast_t *ast) +{ + if (!ast) return NULL; + size_t len = (size_t)(ast->end - ast->start); + char *source = GC_MALLOC_ATOMIC(len + 1); + memcpy(source, ast->start, len); + source[len] = '\0'; + return source; +} + CORD type_ast_to_xml(type_ast_t *t) { if (!t) return "NULL"; |
