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:
parent
5c0fb00970
commit
63dfb98aad
1 changed files with 5 additions and 3 deletions
|
|
@ -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
|
//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]);
|
ARC_Bool isToken = ARC_Lexer_IsTokenId(parser->lexer, tag->tokensOrTags[orIndex][tokenOrTagIndex]);
|
||||||
if(isToken == ARC_False){
|
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
|
//check if the tag works if not break to continue checking next or
|
||||||
uint32_t nextTagId = tag->tokensOrTags[orIndex][tokenOrTagIndex];
|
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){
|
if(foundRule == ARC_False){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//increase the lexer check index as a recursed rule was found
|
//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
|
//this will probably never be called as lambda is usually the last instruction, but just in case we can continue instead of break
|
||||||
continue;
|
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 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]){
|
if(token.rule != tag->tokensOrTags[orIndex][tokenOrTagIndex]){
|
||||||
foundRule = ARC_False;
|
foundRule = ARC_False;
|
||||||
printf("%u ", token.rule);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue