Adiciona tinyblocks-syntax, tinyblocks-regex e tinyblocks-markdown (com testes)

This commit is contained in:
mguinhos committed 2026-10-20 22:04:09 -03:00
1 parent c75d4be1c2
commit a921f6574d
16 files changed
+1846 -4

No files matched your search

@@ -0,0 +1,40 @@
/*
* TinyBlocks - tb_regex.h
* Library tinyblocks-regex: expressoes regulares (POSIX ERE) para busca,
* substituicao e divisao de texto. Independente do editor.
*/
#ifndef TINYBLOCKS_REGEX_H
#define TINYBLOCKS_REGEX_H
#include <tinyblocks/tinyblocks.h>
TB_API const TinyBlocks_LibraryDescriptor* tb_regex_get_library(void);
/* -- API C --------------------------------------------------------------- */
/* Verdadeiro se o padrao casa em algum ponto do texto. */
TB_API bool tb_regex_test(const char* text, const char* pattern);
/* Verdadeiro se o padrao casa o texto inteiro (ancorado). */
TB_API bool tb_regex_match(const char* text, const char* pattern);
/* Primeiro casamento (malloc; libere com free) ou NULL. */
TB_API char* tb_regex_find(const char* text, const char* pattern);
/* Grupo i do primeiro casamento (0 = casamento inteiro). */
TB_API char* tb_regex_group(const char* text, const char* pattern, int group);
/* Quantidade de grupos de captura do padrao (-1 em erro). */
TB_API int tb_regex_group_count(const char* text, const char* pattern);
/* Numero de casamentos. */
TB_API int tb_regex_count(const char* text, const char* pattern);
/* Substitui todas as ocorrencias. Em `repl`, $0..$9 inserem os grupos e
* $$ insere um '$'. Devolve texto (malloc). */
TB_API char* tb_regex_replace(const char* text, const char* pattern, const char* repl);
/* Divide o texto pelos casamentos; devolve vetor de strings terminado por
* NULL (libere cada item e o vetor). */
TB_API char** tb_regex_split(const char* text, const char* pattern, int* out_count);
TB_API void tb_regex_free_list(char** list);
TB_API const char* tb_regex_last_error(void);
#endif /* TINYBLOCKS_REGEX_H */