diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-15 23:38:46 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-15 23:38:46 +0100 |
commit | bd485fb4527a1d171e2afbc94cd092444a67303f (patch) | |
tree | 3f351834922857ac6d9ede34f877185b4edcc47d | |
parent | 48040131e60465c118c6e89161359662d1ddea94 (diff) | |
download | golem-bd485fb4527a1d171e2afbc94cd092444a67303f.tar.gz |
placeholder identify_function
-rw-r--r-- | group.c | 2 | ||||
-rw-r--r-- | identify.c | 10 | ||||
-rw-r--r-- | identify.h | 4 | ||||
-rw-r--r-- | token.c | 6 | ||||
-rw-r--r-- | token.h | 1 |
5 files changed, 22 insertions, 1 deletions
@@ -72,7 +72,7 @@ group_atom(Token **list) { // Recurse in child GROUP_SCOPEs. for (Token *e = *list; e != NULL; e = e->next) - if (e->type == TOK_GROUP && e->group.type == GROUP_SCOPE) + if (token_isgroup(e, GROUP_SCOPE)) if (group_atom(&e->group.tokens)) return 1; diff --git a/identify.c b/identify.c new file mode 100644 index 0000000..2298ad0 --- /dev/null +++ b/identify.c @@ -0,0 +1,10 @@ +#include "identify.h" +#include <stddef.h> + +void +identify_function(Token **list) +{ + for (Token *e = *list; e != NULL; e = e->next) + if (token_isgroup(e, GROUP_ATOM)) + e->group.type = GROUP_FUNCTION; +} diff --git a/identify.h b/identify.h new file mode 100644 index 0000000..4800168 --- /dev/null +++ b/identify.h @@ -0,0 +1,4 @@ +#pragma once +#include "token.h" + +void identify_function(Token **list); @@ -108,3 +108,9 @@ token_print(Token *token, int recurse, int depth) } return tok; } + +int +token_isgroup(Token *token, unsigned int type) +{ + return (token->type == TOK_GROUP && token->group.type == type); +} @@ -43,3 +43,4 @@ void token_delete(Token **list, Token *elem); Token *token_search(Token *list, unsigned int type); Token *token_search_closing(Token *list, unsigned int type, unsigned int opn); Token *token_print(Token *token, int recurse, int depth); +int token_isgroup(Token *token, unsigned int type); |