private bool ValidateKey(IDictionary container, string key, string file, int errorline)
{
bool validateresult;
// Check if key is an empty string
if(key == "")
{
// ERROR: Missing key name in statement
if(errorline > -1) RaiseError(file, errorline, ERROR_KEYMISSING);
validateresult = false;
}
else
{
// Check if there are spaces in the key
if(key.IndexOfAny(" ".ToCharArray()) > -1)
{
// ERROR: Spaces not allowed in key names
if(errorline > -1) RaiseError(file, errorline, ERROR_KEYSPACES);
validateresult = false;
}
else
{
// Check if we can test existance
if(container != null)
{
/*
// Test if the key exists in this container
if(container.Contains(key) == true)
{
// ERROR: Key is not unique within struct
if(errorline > -1) RaiseError(file, errorline, ERROR_KEYNOTUNQIUE);
validateresult = false;
}
else
*/
{
// Key OK
validateresult = true;
}
}
else
{
// Key OK
validateresult = true;
}
}
}
// Return result
return validateresult;
}