working on parsing recursively

This commit is contained in:
herbglitch 2024-10-16 23:46:16 -06:00
parent e4aa4a8b6d
commit 24fd8d6b25
3 changed files with 33 additions and 4 deletions

View file

@ -1,4 +1,5 @@
#include "arc/std/parser.h"
#include "arc/std/errno.h"
#include "arc/std/lexer.h"
#include <stdint.h>
#include <stdlib.h>
@ -43,6 +44,30 @@ void ARC_Parser_Destroy(ARC_Parser *parser){
free(parser);
}
void ARC_Parser_Parse(ARC_Parser *parser, ARC_String *data);
//private recusive function to parse a tag
void ARC_Parser_ParseTag(ARC_Parser *parser, ARC_String *subdata, uint32_t tagId){
//get the current tag
ARC_ParserLanguageTag *tag = NULL;
for(uint32_t index = 0; index < parser->language.size; index++){
ARC_ParserLanguageTag *foundTag = ((ARC_ParserLanguageTag *)parser->language.data) + index;
if(foundTag->tagId == tagId){
tag = foundTag;
break;
}
}
void ARC_Parser_ParseFile(ARC_Parser *parser, ARC_String *path);
//if the tag was not found can't do much, so throw an error
if(tag == NULL){
arc_errno = ARC_ERRNO_NULL;
ARC_DEBUG_LOG_ERROR_WITH_VARIABLES("ARC_Parser_ParseTag(parser, subdata, tagId), could not find tag with id: %u", tagId);
return;
}
}
void ARC_Parser_Parse(ARC_Parser *parser, ARC_String *data){
}
void ARC_Parser_ParseFile(ARC_Parser *parser, ARC_String *path){
}