fixed a lot of the lexer and parser (the segfault, and now can do char ranges)
This commit is contained in:
parent
050f7a8452
commit
b10f9b9123
4 changed files with 115 additions and 47 deletions
|
|
@ -2,12 +2,13 @@
|
|||
#include "arc/std/errno.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
|
||||
//TODO: fix lambda
|
||||
#define LAMBDA 20
|
||||
#define CHAR ARC_LEXER_TOKEN_ALPHALOWERCHAR
|
||||
#define NUM ARC_LEXER_TOKEN_NUMBER
|
||||
#define CHAR_OR_NUM 23
|
||||
#define VARIABLE_NAME 24
|
||||
#define VARIABLE 25
|
||||
|
||||
void TEST_Parser_InitLexerRulesFn(ARC_Lexer *lexer){
|
||||
ARC_Lexer_InitBasicTokenRules(lexer);
|
||||
|
|
@ -21,9 +22,9 @@ ARC_TEST(Parser_Init){
|
|||
uint32_t *variableTokensOrTags[] = { (uint32_t[]){ 2, CHAR, VARIABLE_NAME } };
|
||||
ARC_ParserLanguageTag testTags[3] = {
|
||||
{
|
||||
CHAR_OR_NUM, //tagId
|
||||
charOrNumTokens, //tokensOrTags
|
||||
2 //tokenOrTagsSize
|
||||
VARIABLE, //tagId
|
||||
variableTokensOrTags, //tokensOrTags
|
||||
1 //tokenOrTagsSize
|
||||
},
|
||||
{
|
||||
VARIABLE_NAME, //tagId
|
||||
|
|
@ -31,9 +32,9 @@ ARC_TEST(Parser_Init){
|
|||
2 //tokenOrTagsSize
|
||||
},
|
||||
{
|
||||
VARIABLE, //tagId
|
||||
variableTokensOrTags, //tokensOrTags
|
||||
1 //tokenOrTagsSize
|
||||
CHAR_OR_NUM, //tagId
|
||||
charOrNumTokens, //tokensOrTags
|
||||
2 //tokenOrTagsSize
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -57,9 +58,9 @@ ARC_TEST(Parser_Basic_Parse){
|
|||
uint32_t *variableTokensOrTags[] = { (uint32_t[]){ 2, CHAR, VARIABLE_NAME } };
|
||||
ARC_ParserLanguageTag testTags[3] = {
|
||||
{
|
||||
CHAR_OR_NUM, //tagId
|
||||
charOrNumTokens, //tokensOrTags
|
||||
2 //tokenOrTagsSize
|
||||
VARIABLE, //tagId
|
||||
variableTokensOrTags, //tokensOrTags
|
||||
1 //tokenOrTagsSize
|
||||
},
|
||||
{
|
||||
VARIABLE_NAME, //tagId
|
||||
|
|
@ -67,9 +68,9 @@ ARC_TEST(Parser_Basic_Parse){
|
|||
2 //tokenOrTagsSize
|
||||
},
|
||||
{
|
||||
VARIABLE, //tagId
|
||||
variableTokensOrTags, //tokensOrTags
|
||||
1 //tokenOrTagsSize
|
||||
CHAR_OR_NUM, //tagId
|
||||
charOrNumTokens, //tokensOrTags
|
||||
2 //tokenOrTagsSize
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -97,9 +98,9 @@ ARC_TEST(Parser_Basic_ParseError){
|
|||
uint32_t *variableTokensOrTags[] = { (uint32_t[]){ 2, CHAR, VARIABLE_NAME } };
|
||||
ARC_ParserLanguageTag testTags[3] = {
|
||||
{
|
||||
CHAR_OR_NUM, //tagId
|
||||
charOrNumTokens, //tokensOrTags
|
||||
2 //tokenOrTagsSize
|
||||
VARIABLE, //tagId
|
||||
variableTokensOrTags, //tokensOrTags
|
||||
1 //tokenOrTagsSize
|
||||
},
|
||||
{
|
||||
VARIABLE_NAME, //tagId
|
||||
|
|
@ -107,9 +108,9 @@ ARC_TEST(Parser_Basic_ParseError){
|
|||
2 //tokenOrTagsSize
|
||||
},
|
||||
{
|
||||
VARIABLE, //tagId
|
||||
variableTokensOrTags, //tokensOrTags
|
||||
1 //tokenOrTagsSize
|
||||
CHAR_OR_NUM, //tagId
|
||||
charOrNumTokens, //tokensOrTags
|
||||
2 //tokenOrTagsSize
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue