diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-14 18:18:59 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-14 18:18:59 +0100 |
commit | a2222a6e270b38cdb214f5975903fef6699f61f4 (patch) | |
tree | d2a7b4e065a6840e62d625b67edacfdb0eb1441a | |
parent | 6602bdf7c86e0f579588fe25618d00cb7b5cfe5e (diff) | |
download | golem-a2222a6e270b38cdb214f5975903fef6699f61f4.tar.gz |
group type
-rw-r--r-- | group.c | 1 | ||||
-rw-r--r-- | group.h | 8 | ||||
-rw-r--r-- | token.c | 5 |
3 files changed, 8 insertions, 6 deletions
@@ -40,6 +40,7 @@ int group_scope(Token **list) fprintf(stderr, "group_create failed\n"); return 1; } + group->group.type = GROUP_SCOPE; token_delete(&group->group.tokens, begin); token_delete(&group->group.tokens, end); if (group_scope(&group->group.tokens)) { @@ -1,10 +1,10 @@ #pragma once enum { - GROUP_NONE, - GROUP_SCOPE, - GROUP_FUNCTION, - GROUP_ASSIGN, + GROUP_NONE = 0, + GROUP_SCOPE = 's', + GROUP_FUNCTION = 'f', + GROUP_ASSIGN = '=', }; struct Token; @@ -95,10 +95,11 @@ token_print(Token *token, int recurse, int depth) for (int i = 0; i < depth * 2; i++) putchar(' '); if (token->type == TOK_GROUP) { - printf("type: TOK_GROUP\n"); + printf("type: TOK_GROUP group.type: %c\n", + token->group.type); token_print(token->group.tokens, 1, depth + 1); } else { - printf("type: %c slice: ", (char)token->type); + printf("type: %c slice: ", token->type); slice_print(token->slice); } if (!recurse) |