Files
tinyblocks/libraries/tinyblocks-xml/include/ast.h
T
mguinhos 1199d2d7c7 Adiciona tinyblocks-blueprint e libraries json/xml/csv; abrir/salvar/exportar projeto
- tinyblocks-blueprint: dona do estado de edicao (abas, pool de blocos,
  vinculos parent/prel/next/sub/args, blocos compostos e variaveis) e da
  serializacao. JSON nativo (to/from) usando a AST JSON do core e export
  JSON/XML/CSV. Testado com round-trip (test-blueprint).
- tinyblocks-json: lexer + parser + emissor JSON independentes.
- tinyblocks-xml: lexer + parser de XML -> AST JSON do core + emissor.
- tinyblocks-csv: divisor de linhas/campos + parser/emissor sobre a AST JSON.
- Editor: botoes Abrir / Salvar / Exportar JSON XML CSV no menu; converte
  Ed <-> TbBlueprint; barra de caminho com modo; .json pode ser arrastado.
- Variaveis: tb_variables_clear e tb_variables_set_text.
- Harness: teste de salvar/abrir projeto; tests/blueprint_test.c.
2026-10-20 19:51:48 -03:00

27 lines
863 B
C

/*
* TinyBlocks - tinyblocks-xml / include/ast.h
*
* A AST do XML e a arvore JSON do core (TinyBlocks_JsonValue), usando uma
* convencao explicita e sem perdas:
*
* elemento -> { "tag": "nome",
* "attrs": { "k": "v", ... },
* "children": [ "texto", {elemento}, ... ] }
*
* Assim o XML pode ser convertido de/para JSON e reemitido.
*/
#ifndef TB_XML_AST_H
#define TB_XML_AST_H
#include <stddef.h>
#include <stdbool.h>
#include <tinyblocks/tb_json_block.h>
#include "lexeme.h"
TinyBlocks_JsonValue* xml_parse(const char* text, char* err, size_t errcap);
TinyBlocks_JsonValue* xml_parse_file(const char* path, char* err, size_t errcap);
char* xml_to_string(const TinyBlocks_JsonValue* root, bool pretty);
bool xml_write_file(const TinyBlocks_JsonValue* root, const char* path, bool pretty);
#endif /* TB_XML_AST_H */