hopefully fixed parsing to now match the languages, had to increase the temp lexer index instead of the index itself

This commit is contained in:
herbglitch 2024-11-15 04:45:06 -07:00
parent 5c0fb00970
commit 63dfb98aad

View file

@ -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;
}
}