added in file reading for parsing
This commit is contained in:
parent
39e7403b82
commit
37259a3ac3
2 changed files with 10 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
#include "arc/std/parser.h"
|
#include "arc/std/parser.h"
|
||||||
#include "arc/std/bool.h"
|
#include "arc/std/bool.h"
|
||||||
#include "arc/std/errno.h"
|
#include "arc/std/errno.h"
|
||||||
|
#include "arc/std/io.h"
|
||||||
#include "arc/std/lexer.h"
|
#include "arc/std/lexer.h"
|
||||||
#include "arc/std/vector.h"
|
#include "arc/std/vector.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
@ -342,7 +343,16 @@ void ARC_Parser_Parse(ARC_Parser *parser, ARC_String **data){
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARC_Parser_ParseFile(ARC_Parser *parser, ARC_String *path){
|
void ARC_Parser_ParseFile(ARC_Parser *parser, ARC_String *path){
|
||||||
|
ARC_String *fileString;
|
||||||
|
ARC_IO_FileToStr(path, &fileString);
|
||||||
|
|
||||||
|
if(fileString == NULL){
|
||||||
|
arc_errno = ARC_ERRNO_NULL;
|
||||||
|
ARC_DEBUG_LOG_ERROR_WITH_VARIABLES("ARC_Parser_ParseFile(parser, data), could not read file \"%s\"", path->data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ARC_Parser_Parse(parser, &fileString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARC_Parser_ClearData(ARC_Parser *parser){
|
void ARC_Parser_ClearData(ARC_Parser *parser){
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ void TEST_ParserCSV_DestroyTypeFn(void *data){
|
||||||
free((int32_t *)data);
|
free((int32_t *)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ARC_TEST(Parser_ParserCSV_BasicTest){
|
ARC_TEST(Parser_ParserCSV_BasicTest){
|
||||||
ARC_Parser *parser;
|
ARC_Parser *parser;
|
||||||
ARC_ParserCSV_CreateAsParser(&parser, ARC_False, TEST_ParserCSV_CastTypeFn, TEST_ParserCSV_DestroyTypeFn);
|
ARC_ParserCSV_CreateAsParser(&parser, ARC_False, TEST_ParserCSV_CastTypeFn, TEST_ParserCSV_DestroyTypeFn);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue