bool str_to_bool(const string &s)
{
+ if(s.empty())
+ throw LexicalError("Empty input in boolean conversion");
+
if(s=="1" || s=="true" || s=="yes" || s=="on")
return true;
else if(s=="0" || s=="false" || s=="no" || s=="off")
- return true;
+ return false;
+
throw LexicalError("Invalid input in boolean conversion");
}