blob: f67ccbbc6c83780d1260871de24b8b258c782416 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#pragma once
#include <vector>
#include "Grammar.hpp"
#include "cru/parse/ParsingTreeNode.hpp"
#include "cru/parse/Terminal.hpp"
namespace cru::parse {
class ParsingAlgorithm;
// A parsing algorithm context contains all data a parsing algorithm needs to
// parse for a grammar. It does not relate to any input. For example, it can
// contain any state machine.
class ParsingAlgorithmContext {
public:
ParsingAlgorithmContext(Grammar* grammar, const ParsingAlgorithm* algorithm);
CRU_DELETE_COPY(ParsingAlgorithmContext)
CRU_DELETE_MOVE(ParsingAlgorithmContext)
virtual ~ParsingAlgorithmContext();
virtual ParsingTreeNode* Parse(const std::vector<Terminal*>& input) = 0;
private:
Grammar* grammar_;
const ParsingAlgorithm* algorithm_;
};
} // namespace cru::parse
|