diff options
author | c | 2024-02-08 11:15:37 -0500 |
---|---|---|
committer | c | 2024-02-08 11:15:37 -0500 |
commit | 0085a59bbb0a47b3bb920f4be72a127788e7139c (patch) | |
tree | 538f5568801f452fe9d8c1f8373ca0758ceeb9fd /src | |
parent | 7dbec8d29413d62967ed7eb5854dd56b1a2814ab (diff) |
Fixed some grouping logic, I think.
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.c | 2 | ||||
-rw-r--r-- | src/source.c | 14 | ||||
-rw-r--r-- | src/token.c | 3 |
3 files changed, 9 insertions, 10 deletions
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'; } |