comments added to config
This commit is contained in:
parent
0918b6f225
commit
44f0acecf7
2 changed files with 81 additions and 46 deletions
|
|
@ -197,16 +197,23 @@ void ARC_Config_UnloadFromFile(ARC_Config *config, ARC_String *data);
|
|||
#define ARC_CONFIG_VALUE 0x2F
|
||||
#define ARC_CONFIG_NESTED_VALUE 0x30
|
||||
#define ARC_CONFIG_VALUE_ARGS 0x31
|
||||
#define ARC_CONFIG_VARIABLE 0x32
|
||||
#define ARC_CONFIG_VARIABLE_NAME 0x33
|
||||
#define ARC_CONFIG_VARIABLE_CHAR 0x34
|
||||
#define ARC_CONFIG_STRING 0x35
|
||||
#define ARC_CONFIG_STRING_CHARS 0x36
|
||||
#define ARC_CONFIG_STRING_CHAR 0x37
|
||||
#define ARC_CONFIG_ESCAPE_CHAR 0x38
|
||||
#define ARC_CONFIG_NUMBER_SIGN 0x39
|
||||
#define ARC_CONFIG_NUMBER_TAG 0x3A
|
||||
#define ARC_CONFIG_WHITESPACE 0x3B
|
||||
#define ARC_CONFIG_ARRAY 0x32
|
||||
#define ARC_CONFIG_VARIABLE 0x33
|
||||
#define ARC_CONFIG_VARIABLE_NAME 0x34
|
||||
#define ARC_CONFIG_VARIABLE_CHAR 0x35
|
||||
#define ARC_CONFIG_STRING 0x36
|
||||
#define ARC_CONFIG_STRING_CHARS 0x37
|
||||
#define ARC_CONFIG_STRING_CHAR 0x38
|
||||
#define ARC_CONFIG_ESCAPE_CHAR 0x39
|
||||
#define ARC_CONFIG_NUMBER_SIGN 0x3A
|
||||
#define ARC_CONFIG_NUMBER_TAG 0x3B
|
||||
#define ARC_CONFIG_WHITESPACE 0x3C
|
||||
#define ARC_CONFIG_COMMENT 0x3D
|
||||
#define ARC_CONFIG_LINE_COMMENT 0x3E
|
||||
#define ARC_CONFIG_MULTI_LINE_COMMENT 0x3F
|
||||
#define ARC_CONFIG_LINE_CHARS 0x40
|
||||
#define ARC_CONFIG_MULTI_LINE_CHARS 0x41
|
||||
#define ARC_CONFIG_COMMENT_CHAR 0x42
|
||||
|
||||
/**
|
||||
* @brief TODO: write this
|
||||
|
|
|
|||
|
|
@ -229,6 +229,9 @@ uint32_t ARC_Config_GetStringIdFn(ARC_String *string){
|
|||
if(ARC_String_EqualsCStringWithStrlen(string, "<valueArgs>")){
|
||||
return ARC_CONFIG_VALUE_ARGS;
|
||||
}
|
||||
if(ARC_String_EqualsCStringWithStrlen(string, "<array>")){
|
||||
return ARC_CONFIG_ARRAY;
|
||||
}
|
||||
if(ARC_String_EqualsCStringWithStrlen(string, "<variable>")){
|
||||
return ARC_CONFIG_VARIABLE;
|
||||
}
|
||||
|
|
@ -259,7 +262,24 @@ uint32_t ARC_Config_GetStringIdFn(ARC_String *string){
|
|||
if(ARC_String_EqualsCStringWithStrlen(string, "<whitespace>")){
|
||||
return ARC_CONFIG_WHITESPACE;
|
||||
}
|
||||
|
||||
if(ARC_String_EqualsCStringWithStrlen(string, "<comment>")){
|
||||
return ARC_CONFIG_COMMENT;
|
||||
}
|
||||
if(ARC_String_EqualsCStringWithStrlen(string, "<lineComment>")){
|
||||
return ARC_CONFIG_LINE_COMMENT;
|
||||
}
|
||||
if(ARC_String_EqualsCStringWithStrlen(string, "<multiLineComment>")){
|
||||
return ARC_CONFIG_MULTI_LINE_COMMENT;
|
||||
}
|
||||
if(ARC_String_EqualsCStringWithStrlen(string, "<lineChars>")){
|
||||
return ARC_CONFIG_LINE_CHARS;
|
||||
}
|
||||
if(ARC_String_EqualsCStringWithStrlen(string, "<multiLineChars>")){
|
||||
return ARC_CONFIG_MULTI_LINE_CHARS;
|
||||
}
|
||||
if(ARC_String_EqualsCStringWithStrlen(string, "<commentChar>")){
|
||||
return ARC_CONFIG_COMMENT_CHAR;
|
||||
}
|
||||
return ~(uint32_t)0;
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +309,7 @@ void ARC_Config_GroupDataHashtableDestroyKeyValueFn(void *key, void *value){
|
|||
free(typeData);
|
||||
}
|
||||
|
||||
//<variableLine> -> <whitespace> <type> <whitespace> <variable> <whitespace> EQUAL <whitespace> <value> <whitespace> SEMICOLON
|
||||
//<variableLine> -> <whitespace> <type> <whitespace> <variable> <whitespace> <array> <whitespace> EQUAL <whitespace> <value> <whitespace> SEMICOLON
|
||||
void ARC_ConfigData_RunVariableLineTag(ARC_ParserTagToken *tagToken, ARC_Config *config){
|
||||
//skip whitespace and check for group name
|
||||
ARC_ParserTagToken *childTagToken = (ARC_ParserTagToken *)ARC_Vector_Get(tagToken->tagTokens, 1);
|
||||
|
|
@ -342,7 +362,7 @@ void ARC_ConfigData_RunVariableLineTag(ARC_ParserTagToken *tagToken, ARC_Config
|
|||
ARC_String_Destroy(variableString);
|
||||
|
||||
//get <value>
|
||||
childTagToken = (ARC_ParserTagToken *)ARC_Vector_Get(tagToken->tagTokens, 7);
|
||||
childTagToken = (ARC_ParserTagToken *)ARC_Vector_Get(tagToken->tagTokens, 9);
|
||||
|
||||
//check if <value> is a reference
|
||||
ARC_String *valueString;
|
||||
|
|
@ -526,7 +546,7 @@ void ARC_ConfigData_RunLanguageTag(ARC_ParserTagToken *tagToken, ARC_Config *con
|
|||
}
|
||||
continue;
|
||||
|
||||
//this is for whitespace and any oddities
|
||||
//this is for whitespace, comments, and any oddities
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
|
@ -559,15 +579,16 @@ void ARC_Config_Create(ARC_Config **config){
|
|||
"<groupName> -> <variable>\n"
|
||||
"<groupArgs> -> <whitespace> <variableLines> | LAMBDA\n"
|
||||
|
||||
"<variableLines> -> <variableLine> <whitespace> <variableLines> | <variableLine>\n"
|
||||
"<variableLine> -> <whitespace> <type> <whitespace> <variable> <whitespace> EQUAL <whitespace> <value> <whitespace> SEMICOLON\n"
|
||||
"<variableLines> -> <comment> <variableLines> | <variableLine> <whitespace> <variableLines> | <variableLine>\n"
|
||||
"<variableLine> -> <whitespace> <type> <whitespace> <variable> <whitespace> <array> <whitespace> EQUAL <whitespace> <value> <whitespace> SEMICOLON\n"
|
||||
"<allowSpace> -> SPACE <allowSpace> | TAB <allowSpace> | LAMBDA\n"
|
||||
|
||||
"<type> -> <variable>\n"
|
||||
"<type> -> <variable> | <variable> <whitespace> <array>\n"
|
||||
"<value> -> <variable> | <numberSign> | <string> | <nestedValue>\n"
|
||||
"<nestedValue> -> OPEN_CURLY_BRACE <whitespace> <valueArgs> <whitespace> CLOSE_CURLY_BRACE\n"
|
||||
"<valueArgs> -> <value> <whitespace> COMMA <whitespace> <valueArgs> | <value>\n"
|
||||
|
||||
"<array> -> OPEN_BRACKET <whitespace> CLOSE_BRACKET | LAMBDA\n"
|
||||
"<variable> -> ALPHA_UPPER_CHAR <variableName> | ALPHA_LOWER_CHAR <variableName> | UNDERSCORE <variableName>\n"
|
||||
"<variableName> -> <variableChar> <variableName> | LAMBDA\n"
|
||||
"<variableChar> -> ALPHA_UPPER_CHAR | ALPHA_LOWER_CHAR | UNDERSCORE | NUMBER\n"
|
||||
|
|
@ -580,7 +601,14 @@ void ARC_Config_Create(ARC_Config **config){
|
|||
"<numberSign> -> MINUS <number> | <number>\n"
|
||||
"<number> -> NUMBER <number> | NUMBER\n"
|
||||
|
||||
"<whitespace> -> SPACE <whitespace> | TAB <whitespace> | NEWLINE <whitespace> | LAMBDA\n";
|
||||
"<whitespace> -> SPACE <whitespace> | TAB <whitespace> | NEWLINE <whitespace> | LAMBDA\n"
|
||||
|
||||
"<comment> -> <whitespace> <lineComment> | <whitespace> <multiLineComment>\n"
|
||||
"<lineComment> -> SLASH SLASH <lineChars> NEWLINE\n"
|
||||
"<multiLineComment> -> SLASH ASTERISK <multiLineChars>\n"
|
||||
"<lineChars> -> <commentChar> <lineChars> | LAMBDA\n"
|
||||
"<multiLineChars> -> ASTERISK SLASH | NEWLINE <multiLineChars> | <commentChar> <multiLineChars>\n"
|
||||
"<commentChar> -> TAB | SPACE | BANG | QUOTE | HASH | DOLLAR | PERCENT | AMPERSAND | SINGLE_QUOTE | OPEN_PAREN | CLOSE_PAREN | ASTERISK | PLUS | COMMA | MINUS | PERIOD | SLASH | NUMBER | COLON | SEMICOLON | LESS_THAN | GREATER_THAN | EQUAL | QUESTION_MARK | AT | ALPHA_UPPER_CHAR | OPEN_BRACKET | BACKSLASH | CLOSE_BRACKET | CARET | UNDERSCORE | GRAVE | ALPHA_LOWER_CHAR | OPEN_CURLY_BRACE | VERTICAL_LINE | CLOSE_CURLY_BRACE | TILDE\n";
|
||||
|
||||
/* ~ define the language as a string ~ */
|
||||
ARC_String *languageString;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue