fixed basic parse test, by updated lexer check index after successful recurse
This commit is contained in:
parent
5f34dbfeca
commit
fcc41aa576
2 changed files with 36 additions and 4 deletions
|
|
@ -118,6 +118,9 @@ ARC_Bool ARC_Parser_ParseTag(ARC_Parser *parser, uint32_t *lexerIndex, uint32_t
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//increase the lexer check index as a recursed rule was found
|
||||||
|
lexerCheckIndex = *lexerIndex;
|
||||||
|
|
||||||
//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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,17 +80,46 @@ ARC_TEST(Parser_Basic_Parse){
|
||||||
};
|
};
|
||||||
|
|
||||||
ARC_Parser_Create(&parser, &languageArray, TEST_Parser_InitLexerRulesFn);
|
ARC_Parser_Create(&parser, &languageArray, TEST_Parser_InitLexerRulesFn);
|
||||||
|
|
||||||
ARC_String *tempString;
|
ARC_String *tempString;
|
||||||
//ARC_String_CreateWithStrlen(&tempString, "myvar1");
|
|
||||||
ARC_String_CreateWithStrlen(&tempString, "m");
|
|
||||||
|
//first variable test
|
||||||
|
ARC_String_CreateWithStrlen(&tempString, "myvar1");
|
||||||
|
|
||||||
//this destroys string, so no need for cleanup
|
//this destroys string, so no need for cleanup
|
||||||
ARC_Parser_Parse(parser, &tempString);
|
ARC_Parser_Parse(parser, &tempString);
|
||||||
|
|
||||||
ARC_Parser_Destroy(parser);
|
ARC_CHECK(arc_errno == 0);
|
||||||
|
|
||||||
|
|
||||||
|
//second variable test
|
||||||
|
ARC_String_CreateWithStrlen(&tempString, "z1xwvq");
|
||||||
|
|
||||||
|
//this destroys string, so no need for cleanup
|
||||||
|
ARC_Parser_Parse(parser, &tempString);
|
||||||
|
|
||||||
ARC_CHECK(arc_errno == 0);
|
ARC_CHECK(arc_errno == 0);
|
||||||
|
|
||||||
|
|
||||||
|
//third variable test
|
||||||
|
ARC_String_CreateWithStrlen(&tempString, "z1234");
|
||||||
|
|
||||||
|
//this destroys string, so no need for cleanup
|
||||||
|
ARC_Parser_Parse(parser, &tempString);
|
||||||
|
|
||||||
|
ARC_CHECK(arc_errno == 0);
|
||||||
|
|
||||||
|
|
||||||
|
//fourth variable test
|
||||||
|
ARC_String_CreateWithStrlen(&tempString, "aaaaa");
|
||||||
|
|
||||||
|
//this destroys string, so no need for cleanup
|
||||||
|
ARC_Parser_Parse(parser, &tempString);
|
||||||
|
|
||||||
|
ARC_CHECK(arc_errno == 0);
|
||||||
|
|
||||||
|
|
||||||
|
ARC_Parser_Destroy(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
ARC_TEST(Parser_Basic_ParseError){
|
ARC_TEST(Parser_Basic_ParseError){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue