added CONFIG_SYNTAX errors
This commit is contained in:
parent
a51f61683f
commit
1a66b58fcb
1 changed files with 29 additions and 4 deletions
|
|
@ -190,6 +190,7 @@ lumiera_configitem_parse (LumieraConfigitem self, const char* line)
|
|||
* */
|
||||
|
||||
char* itr = self->line;
|
||||
bool faultless = true;
|
||||
|
||||
/*skip leading whitespaces*/
|
||||
while (*itr && isspace (*itr))
|
||||
|
|
@ -199,6 +200,9 @@ lumiera_configitem_parse (LumieraConfigitem self, const char* line)
|
|||
if (!*itr || *itr == '#' )
|
||||
{
|
||||
/*this is an empty line or a a comment*/
|
||||
self->key = NULL;
|
||||
self->keysize = 0;
|
||||
self->delim = NULL;
|
||||
}
|
||||
else if (*itr == '@' )
|
||||
{
|
||||
|
|
@ -218,7 +222,17 @@ lumiera_configitem_parse (LumieraConfigitem self, const char* line)
|
|||
/*now look for the end of the key and set the keysize*/
|
||||
self->key_size = strspn (itr, LUMIERA_CONFIG_KEY_CHARS);
|
||||
|
||||
TODO ("if(self->keysize==0) then key_syntax_error");
|
||||
if ( self->keysize==0 )
|
||||
{
|
||||
/*Obviously a malformed "key"; treat this line like a comment*/
|
||||
self->key = NULL;
|
||||
self->keysize = 0;
|
||||
self->delim = NULL;
|
||||
|
||||
LUMIERA_ERROR_SET (config_item, CONFIG_SYNTAX);
|
||||
|
||||
faultless = false;
|
||||
}
|
||||
|
||||
/* skip blanks */
|
||||
itr += self->key_size;
|
||||
|
|
@ -234,10 +248,21 @@ lumiera_configitem_parse (LumieraConfigitem self, const char* line)
|
|||
self->delim = itr;
|
||||
}
|
||||
else
|
||||
TODO ("syntax error");
|
||||
{
|
||||
/*this is not a valid configentry; treat this line like a comment*/
|
||||
self->key = NULL;
|
||||
self->keysize = 0;
|
||||
self->delim = NULL;
|
||||
|
||||
/* TODO only if still everything ok */
|
||||
self->vtable = &lumiera_configentry_funcs; // MOCKUP pretend this is a configentry
|
||||
LUMIERA_ERROR_SET (config_item, CONFIG_SYNTAX);
|
||||
faultless = false;
|
||||
}
|
||||
|
||||
/*just set vtable if we are sure we had no syntax-error*/
|
||||
if (faultless)
|
||||
{
|
||||
self->vtable = &lumiera_configentry_funcs; // MOCKUP pretend this is a configentry
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue