blob: fe46c4d22549d7b6dc23ccdef32d5bfca73d2d0d (
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.h"
#include "cru/parse/ParsingTreeNode.h"
#include "cru/parse/Terminal.h"
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 CRU_PARSE_API 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
|