From 68c2fc7afba79789e6ed8fb090cce6fa72343b48 Mon Sep 17 00:00:00 2001 From: herbglitch Date: Fri, 29 Nov 2024 13:38:32 -0700 Subject: [PATCH] testing some ideas for the parser --- include/arc/std/parser.h | 15 +++++++++++---- src/std/parser.c | 9 --------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/arc/std/parser.h b/include/arc/std/parser.h index 6708619..3d05d9d 100644 --- a/include/arc/std/parser.h +++ b/include/arc/std/parser.h @@ -37,12 +37,19 @@ typedef struct ARC_ParserTag { uint32_t tagId; uint32_t **tokensOrTags; - uint32_t tokensOrTagsSize; - - ARC_ParserTag_AddDataFn *addDataFn; - void *addUserData; + uint32_t tokensOrTagsSize; } ARC_ParserTag; +/* + * @brief +*/ +typedef struct ARC_ParserTagToken { + uint32_t id; + + ARC_LexerToken *token; + ARC_Vector *tagTokens; +} ARC_ParserTagToken; + /** * @brief a callback function to initialize the lexer the parser uses with rules * diff --git a/src/std/parser.c b/src/std/parser.c index 221d1b0..48088cb 100644 --- a/src/std/parser.c +++ b/src/std/parser.c @@ -220,15 +220,6 @@ ARC_Bool ARC_Parser_ParseTag(ARC_Parser *parser, uint32_t *lexerIndex, uint32_t if(foundRule == ARC_True){ *lexerIndex = lexerCheckIndex; - //if there is an addDataFunction for the tag, add the tokens - if(tag->addDataFn != NULL){ - //iterate through the tokens with the add callback - for(uint32_t index = 0; index < ARC_Vector_GetSize(foundTokens); index++){ - ARC_LexerToken *token = (ARC_LexerToken *)ARC_Vector_Get(foundTokens, index); - (*(tag->addDataFn))(&(parser->data), tagId, index, token, tag->addUserData); - } - } - //free the found tokens vector ARC_Vector_Destroy(foundTokens);