Minor changes here and there.
[aesalon.git] / include / config / Parser.h
blob44b54a4baecab1e6c1e6462f20e711e8aff20d4b
1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file include/config/Parser.h
8 */
10 #ifndef AesalonConfig_Parser_H
11 #define AesalonConfig_Parser_H
13 #include <fstream>
15 #include "Vault.h"
17 namespace Config {
19 class Parser {
20 private:
21 std::ifstream *m_stream;
23 enum TokenType {
24 WORD,
25 QUOTED_WORD,
26 SYMBOL,
27 END_OF_FILE
29 public:
30 void parse(Vault *vault, const std::string &configFile);
31 void parseDirectory(Vault *vault, const std::string &directory);
32 private:
33 void openFile(const std::string &configFile);
34 std::string nextToken(TokenType &type);
35 std::string expectNextToken(TokenType expected);
36 void expectNextSymbol(const std::string &symbol);
37 void skipWhitespace();
38 void closeFile();
40 const char *nameOf(TokenType type) const;
43 } // namespace Config
45 #endif