work in progess

This commit is contained in:
Олег Бородин
2025-10-19 09:50:19 +02:00
parent a9541628be
commit 3e978a685f
9 changed files with 48 additions and 72 deletions

View File

@@ -102,7 +102,7 @@ int clcomp_parse(clcomp_t * comp) {
case 3:{
if (toktype == TOKEN_WORD) {
comp->pos = 0;
printf("pos %d: TOKEN_WORD %s\n", comp->pos, token);
DPRINTF("pos %d: TOKEN_WORD %s\n", comp->pos, token);
val = strcopy(token);
DPRINTF("keyval = [%s], [%s]\n", key, val);
vmapper_set(comp->vmapper, key, val);

View File

@@ -4,8 +4,6 @@
*
*/
#define DEBUG 1
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>

View File

@@ -21,19 +21,15 @@ int main(void) {
char* src = "key1 = var1 # comment 1\nkey2 = var2 # comment 2 and 3\n# comment 4\nkey3 = var3";
bstream_t stream;
bstream_init(&stream);
tclexer_t lexer;
tclexer_init(&lexer, &stream);
vmapper_t vmapper;
vmapper_init(&vmapper);
tccomp_t comp;
tccomp_init(&comp, &lexer, &vmapper);
bstream_write(&stream, src, strlen(src));
@@ -51,7 +47,6 @@ int main(void) {
vmapper_set(&vmapper, "flag", "true");
int res = tccomp_parse(&comp);
if (res < 0) {
printf("parsing error pos %d line %d\n", comp.pos, comp.lnum);
}