creation and destruction in parser, also added some stuff to gitingore
This commit is contained in:
parent
5842197142
commit
60acfd075a
6 changed files with 151 additions and 4 deletions
45
tests/std/parser.c
Normal file
45
tests/std/parser.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include "../test.h"
|
||||
#include "arc/std/parser.h"
|
||||
|
||||
#define LAMBDA 0
|
||||
#define CHAR 1
|
||||
#define NUM 2
|
||||
#define CHAR_OR_NUM 3
|
||||
#define VARIABLE_NAME 4
|
||||
#define VARIABLE 5
|
||||
|
||||
ARC_TEST(Lexer_Char_Match){
|
||||
ARC_Parser *parser;
|
||||
|
||||
uint32_t *charOrNumTokens[] = { (uint32_t[]){ 1, CHAR }, (uint32_t[]){ 1, NUM } };
|
||||
uint32_t *variableNameTags[] = { (uint32_t[]){ 2, CHAR_OR_NUM, VARIABLE_NAME }, (uint32_t[]){ 1, LAMBDA } };
|
||||
uint32_t *variableTokensOrTags[] = { (uint32_t[]){ 2, CHAR, VARIABLE_NAME } };
|
||||
ARC_ParserLanguageTag testTags[3] = {
|
||||
{
|
||||
CHAR_OR_NUM, //tagId
|
||||
charOrNumTokens, //tokensOrTags
|
||||
2 //tokenOrTagsSize
|
||||
},
|
||||
{
|
||||
VARIABLE_NAME, //tagId
|
||||
variableNameTags, //tokensOrTags
|
||||
2 //tokenOrTagsSize
|
||||
},
|
||||
{
|
||||
VARIABLE, //tagId
|
||||
variableTokensOrTags, //tokensOrTags
|
||||
1 //tokenOrTagsSize
|
||||
}
|
||||
};
|
||||
|
||||
ARC_Array languageArray = {
|
||||
3, //size
|
||||
testTags //data
|
||||
};
|
||||
|
||||
ARC_Parser_Create(&parser, &languageArray);
|
||||
|
||||
ARC_Parser_Destroy(parser);
|
||||
|
||||
ARC_CHECK(1 == 1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue