From 63dfb98aad89f3bea51bc74b7164fa9090395deb Mon Sep 17 00:00:00 2001 From: herbglitch Date: Fri, 15 Nov 2024 04:45:06 -0700 Subject: [PATCH] hopefully fixed parsing to now match the languages, had to increase the temp lexer index instead of the index itself --- src/std/parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/std/parser.c b/src/std/parser.c index d12d8fc..4b97778 100644 --- a/src/std/parser.c +++ b/src/std/parser.c @@ -111,15 +111,18 @@ ARC_Bool ARC_Parser_ParseTag(ARC_Parser *parser, uint32_t *lexerIndex, uint32_t //if the value isn't a token it is a tag, so recurs if it isn't a token ARC_Bool isToken = ARC_Lexer_IsTokenId(parser->lexer, tag->tokensOrTags[orIndex][tokenOrTagIndex]); if(isToken == ARC_False){ + //create a temporary lexer index in case the rule does not exist + uint32_t tempLexerCheckIndex = lexerCheckIndex; + //check if the tag works if not break to continue checking next or uint32_t nextTagId = tag->tokensOrTags[orIndex][tokenOrTagIndex]; - foundRule = ARC_Parser_ParseTag(parser, lexerIndex, nextTagId); + foundRule = ARC_Parser_ParseTag(parser, &tempLexerCheckIndex, nextTagId); if(foundRule == ARC_False){ break; } //increase the lexer check index as a recursed rule was found - lexerCheckIndex = *lexerIndex; + lexerCheckIndex = tempLexerCheckIndex; //this will probably never be called as lambda is usually the last instruction, but just in case we can continue instead of break continue; @@ -139,7 +142,6 @@ ARC_Bool ARC_Parser_ParseTag(ARC_Parser *parser, uint32_t *lexerIndex, uint32_t //if the token rule does not match the current token in the current or statement the token rule could not be found for the current or index so break if(token.rule != tag->tokensOrTags[orIndex][tokenOrTagIndex]){ foundRule = ARC_False; - printf("%u ", token.rule); break; } }