archeus/src/std/chemical.c

100 lines
3.2 KiB
C
Raw Normal View History

2024-12-23 00:16:32 -07:00
#include "arc/std/chemical.h"
#include "arc/std/parser/helpers.h"
#include "arc/std/bool.h"
2024-12-23 00:16:32 -07:00
#include "arc/std/hashtable.h"
#include "arc/std/parser.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
2024-12-23 00:16:32 -07:00
struct ARC_Chemical {
ARC_Parser *parser;
2024-12-23 00:16:32 -07:00
ARC_Hashtable *groups;
};
2024-12-23 00:16:32 -07:00
void ARC_Chemical_InitLexerRulesFn(ARC_Lexer *lexer){
}
2024-12-23 00:16:32 -07:00
uint32_t ARC_Chemical_GetStringIdFn(ARC_String *string){
if(ARC_String_EqualsCStringWithStrlen(string, "LAMBDA")){
return ARC_PARSER_TAG_LAMBDA;
}
return ~(uint32_t)0;
}
2024-12-23 00:16:32 -07:00
void ARC_ChemicalData_CreateFn(void **data, ARC_ParserTagToken *parsedData, void *userData){
*data = NULL;
if(data == NULL || userData == NULL){
//TODO: error here?
*data = NULL;
return;
}
2024-12-23 00:16:32 -07:00
}
2024-12-23 00:16:32 -07:00
void ARC_Chemical_Create(ARC_Chemical **chemical){
*chemical = (ARC_Chemical *)malloc(sizeof(ARC_Chemical));
2024-12-23 00:16:32 -07:00
/* ~ define the language as a string ~ */
char *languageCString =
"<language> -> <group> <language> | <variableLine> <language> | <whitespace> <language>\n"
2024-12-23 00:16:32 -07:00
"<group> -> <groupName> <whitespace> <variable> <whitespace> LEFT_CURLY_BRACE <whitespace> <variableLine> <whitespace> RIGHT_CURLY_BRACE\n"
2024-12-23 00:16:32 -07:00
"<variableLine> -> <type> <whitespace> <variable> <whitespace> EQUALS <whitespace> value <whitespace> SEMICOLON <whitespace>\n"
2024-12-23 00:16:32 -07:00
"<groupName> -> <variable>\n"
"<type> -> <variable>\n"
"<value> -> <variable> | <number> | <nestedValue>\n"
"<nestedValue> -> OPEN_CURLY_BRACE <whitespace> <valueArgs> <whitespace> CLOSE_CURLY_BRACE\n"
"<valueArgs> -> <value> | <value> COMMA <valueArgs>\n"
2024-12-23 00:16:32 -07:00
"<variable> -> ALPHA_UPPER_CHAR <variableName> | ALPHA_LOWER_CHAR <variableName> | UNDERSCORE <variableName>\n"
"<variableName> -> <charOrNum> <variableName> | LAMBDA\n"
"<charOrNum> -> ALPHA_UPPER_CHAR | ALPHA_LOWER_CHAR | UNDERSCORE | NUM\n"
2024-12-23 00:16:32 -07:00
"<number> -> NUMBER <number> | NUMBER LAMBDA\n"
2024-12-23 00:16:32 -07:00
"<whitespace> -> SPACE <whitespace> | TAB <whitespace> | NEWLINE <whitespace> | LAMBDA\n";
2024-12-23 00:16:32 -07:00
/* ~ define the language as a string ~ */
ARC_String *languageString;
ARC_String_CreateWithStrlen(&languageString, languageCString);
2024-12-23 00:16:32 -07:00
/* ~ init the userdata? ~ */
2024-12-23 00:16:32 -07:00
/* ~ create the language ~ */
//ARC_ParserData_CreateFn createCharFn = ARC_ChemicalData_CreateFn;
//ARC_ParserData_DestroyFn destroyCharFn = ARC_ChemicalData_DestroyFn;
//ARC_Parser_CreateFromString(parser, languageString, ARC_ParserCSV_InitLexerRulesFn, ARC_ParserCSV_GetStringIdFn, &createCharFn, &destroyCharFn, userdata);
2024-12-23 00:16:32 -07:00
//cleanup
ARC_String_Destroy(languageString);
}
2024-12-23 00:16:32 -07:00
void ARC_Chemical_Destroy(ARC_Chemical *chemical){
}
2024-12-23 00:16:32 -07:00
void ARC_Chemical_RegisterType(ARC_Chemical *chemical, ARC_String *typeName, ARC_ChemicalData_CopyToTypeFn *copyToTypeFn, ARC_ParserCSV_DestroyTypeFn destroyTypeFn){
}
2024-12-23 00:16:32 -07:00
void ARC_Chemical_SetGroup(ARC_Chemical *chemical, ARC_String *groupName){
}
2024-12-23 00:16:32 -07:00
void *ARC_Chemical_Get(ARC_Chemical *chemical, ARC_String *element){
return NULL;
}
2024-12-23 00:16:32 -07:00
void ARC_Chemical_LoadFromString(ARC_String *path){
}
2024-12-23 00:16:32 -07:00
void ARC_Chemical_LoadFromFile(ARC_String *path){
}
2024-12-23 00:16:32 -07:00
void ARC_Chemical_UnloadFromString(ARC_String *data){
}
2024-12-23 00:16:32 -07:00
void ARC_Chemical_UnloadFromFile(ARC_String *data){
}