Adiciona libraries toml/fs, metadados .toml e build por library
- tinyblocks-toml: lexer + parser TOML (include/lexeme.h, include/ast.h, src/lexer.c, src/parser.c) e bloco Toml.Get. - tinyblocks-fs: categoria "Arquivos" com FS.Open/Read/Write/Append/Tell/Close. - library.toml em cada library com metadados (categoria, cor, descricao) e receita de build, sem precisar embutir isso no .so. - Makefiles proprios por library com build/ local; Makefile raiz delega. - Palco (tb_stage) movido para o core; pen deixa de depender do editor, o que torna os .so arrastaveis. - Editor linka com -rdynamic para resolver simbolos do core em .so via dlopen. - Testes: test-toml (parser) e test-plugin (dlopen de .so standalone).
This commit is contained in:
1 parent
90d47bf8a0
commit
dc23b92d15
48 files changed
+2405
-744
No files matched your search
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* TinyBlocks - tinyblocks-toml
|
||||
* lexeme.h: tipos de token e lexer de TOML.
|
||||
*/
|
||||
#ifndef TB_TOML_LEXEME_H
|
||||
#define TB_TOML_LEXEME_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TL_EOF = 0,
|
||||
TL_ERROR,
|
||||
TL_NEWLINE,
|
||||
TL_LBRACKET, /* [ */
|
||||
TL_RBRACKET, /* ] */
|
||||
TL_LBRACE, /* { */
|
||||
TL_RBRACE, /* } */
|
||||
TL_EQUALS, /* = */
|
||||
TL_COMMA, /* , */
|
||||
TL_DOT, /* . */
|
||||
TL_BARE, /* chave simples */
|
||||
TL_STRING, /* string (basica/literal) */
|
||||
TL_INTEGER,
|
||||
TL_FLOAT,
|
||||
TL_BOOL,
|
||||
TL_DATETIME
|
||||
} TomlLexKind;
|
||||
|
||||
typedef struct {
|
||||
TomlLexKind kind;
|
||||
const char* start; /* inicio no fonte (nao NUL-terminado) */
|
||||
size_t len; /* tamanho no fonte */
|
||||
int line, col;
|
||||
char* text; /* string decodificada (TL_STRING), malloc */
|
||||
long long ival;
|
||||
double fval;
|
||||
bool bval;
|
||||
} Lexeme;
|
||||
|
||||
typedef struct {
|
||||
Lexeme* items;
|
||||
size_t count, cap;
|
||||
} LexemeList;
|
||||
|
||||
typedef struct {
|
||||
bool ok;
|
||||
char msg[256];
|
||||
int line, col;
|
||||
} TomlLexError;
|
||||
|
||||
/* Tokeniza o texto inteiro. Em erro retorna false e preenche *err. */
|
||||
bool toml_lex(const char* src, LexemeList* out, TomlLexError* err);
|
||||
|
||||
/* Libera a lista e os textos decodificados */
|
||||
void toml_lexemes_free(LexemeList* list);
|
||||
|
||||
const char* toml_lexeme_kind_name(TomlLexKind kind);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TB_TOML_LEXEME_H */
|
||||
Reference in new issue
Block a user