/* -*- C++ -*- * Copyright ©2004 Hugo Mills * * This software is distributed under the terms of the GNU GPL v3 * For more information on the GPL, see the file COPYING or * visit http://www.gnu.org/ * * This software is distributed without warranty */ #include "magellan/parsertools.h" bool readbooleanvalue(ConfigLexer* lex, const char* key, bool* var) { if(lex->type() != TOKEN) { // Syntax error -- not a token std::cerr << "Syntax error -- not a token: '" << lex->value() << "' (parser.cc " << __LINE__ << ")" << std::endl; return false; } if(lex->value() != key) return false; *var = true; // Read the terminating ; if(lex->next()->type() != CHAR || lex->value() != ";") { // Syntax error -- missing semicolon? std::cerr << "Syntax error -- missing semicolon? (parser.cc " << __LINE__ << ")" << std::endl; return false; } lex->next(); return true; }