From 0085a59bbb0a47b3bb920f4be72a127788e7139c Mon Sep 17 00:00:00 2001 From: c Date: Thu, 8 Feb 2024 11:15:37 -0500 Subject: Fixed some grouping logic, I think. --- src/parser.c | 2 -- src/source.c | 14 +++++++------- src/token.c | 3 ++- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/parser.c b/src/parser.c index f7ababe..ac08a16 100644 --- a/src/parser.c +++ b/src/parser.c @@ -87,9 +87,7 @@ tree_t* parser_parse_carg(parser_t* parser) { tree_t* carg; carg = tree_init(TREE_TYPE_CARG); - carg->data.carg.val = parser_parse_expr(parser); - carg->data.carg.nxt = NULL; return carg; diff --git a/src/source.c b/src/source.c index bf6655c..26bbad2 100644 --- a/src/source.c +++ b/src/source.c @@ -35,16 +35,16 @@ char* source_get_from_stdin() { size_t l; #if 0 - l = 0; + l = 0; - src = ecalloc(16, sizeof(char)); + src = ecalloc(16, sizeof(char)); - while ((s = fgets(src + l, 20, stdin))) { - l = MIN(15, l + strlen(src + l)); - } + while ((s = fgets(src + l, 20, stdin))) { + l = MIN(15, l + strlen(src + l)); + } - /* This works, I guess. */ - s && src[l - 1] == '\n' && (src[l - 1] = '\0'); + /* This works, I guess. */ + s && src[l - 1] == '\n' && (src[l - 1] = '\0'); #endif src = ecalloc(256, sizeof(char)); diff --git a/src/token.c b/src/token.c index 6ae0eae..5092190 100644 --- a/src/token.c +++ b/src/token.c @@ -42,7 +42,8 @@ void token_add_char(token_t* token, char c) { orig = strlen(token->val); - token->val = erealloc(token->val, orig + sizeof c + 1); + /* [...] c+1 [...] */ + token->val = erealloc(token->val, orig + sizeof c+1); token->val[orig] = c; token->val[orig + 1] = '\0'; } -- cgit v1.2.3