added parserlang though it is throwing error when it should be good in testing, need to fix
This commit is contained in:
parent
9221d1e33e
commit
b702431c88
5 changed files with 152 additions and 94 deletions
|
|
@ -176,11 +176,6 @@ void ARC_Lexer_LexString(ARC_Lexer *lexer, ARC_String **data){
|
|||
//check if the token rule is found
|
||||
ARC_LexerTokenRule *tokenRule = ARC_Vector_Get(lexer->tokenRules, index);
|
||||
|
||||
//set the last token length if the last token had a length
|
||||
if(tokenLength > 0){
|
||||
lastTokenLength = tokenLength;
|
||||
}
|
||||
|
||||
//tokenData should only exist if tokenLength is ARC_True as stated in the header
|
||||
ARC_String *tokenData;
|
||||
tokenLength = tokenRule->automataFn(&tokenData, *data, tokenRule->automataData);
|
||||
|
|
@ -201,6 +196,9 @@ void ARC_Lexer_LexString(ARC_Lexer *lexer, ARC_String **data){
|
|||
token = (ARC_LexerToken *)malloc(sizeof(ARC_LexerToken));
|
||||
token->rule = tokenRule->id;
|
||||
token->data = tokenData;
|
||||
|
||||
//update the last found tokenLength to the max length
|
||||
lastTokenLength = tokenLength;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -415,6 +413,7 @@ ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchCharOrBetween(uint32_t
|
|||
//return the created tokenRule
|
||||
return tokenRule;
|
||||
}
|
||||
|
||||
//private function to free automataData stored as an ARC_String
|
||||
void ARC_LexerTokenRule_DestroyStringAutomataDataFn(void *automataData){
|
||||
ARC_String_Destroy((ARC_String *)automataData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue