]> git.tdb.fi Git - libs/datafile.git/blob - source/parsermode.h
Remove the loaded flag from PackSource files
[libs/datafile.git] / source / parsermode.h
1 #ifndef MSP_DATAFILE_PARSERMODE_H_
2 #define MSP_DATAFILE_PARSERMODE_H_
3
4 #include "statement.h"
5
6 namespace Msp {
7 namespace DataFile {
8
9 class Input;
10 class Loader;
11 class LoaderAction;
12
13 /**
14 Base class for parse modes.
15 */
16 class ParserMode
17 {
18 protected:
19         Input ∈
20         const std::string &src;
21
22         ParserMode(Input &i, const std::string &s): in(i), src(s) { }
23 public:
24         virtual ~ParserMode() { }
25
26         virtual Statement parse() = 0;
27         virtual void process_control_statement(const Statement &) { }
28
29         virtual const StatementKey *peek(unsigned) { return 0; }
30         virtual bool parse_and_load(unsigned, Loader &, const LoaderAction &) { return false; }
31 };
32
33 } // namespace DataFile
34 } // namespace Msp
35
36 #endif