aboutsummaryrefslogtreecommitdiff
path: root/include/cru/parse/ParsingAlgorithm.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-12-15 21:11:26 +0800
committercrupest <crupest@outlook.com>2021-12-15 21:11:26 +0800
commit360a3bdbc9cf7084d9f1f1af09ea99831edffd34 (patch)
tree616f684c1602b1aba55f9427106b34cbc727f5e2 /include/cru/parse/ParsingAlgorithm.hpp
parentfa3794469430b4ddfe0b0ca62850e9911c99b558 (diff)
downloadcru-360a3bdbc9cf7084d9f1f1af09ea99831edffd34.tar.gz
cru-360a3bdbc9cf7084d9f1f1af09ea99831edffd34.tar.bz2
cru-360a3bdbc9cf7084d9f1f1af09ea99831edffd34.zip
...
Diffstat (limited to 'include/cru/parse/ParsingAlgorithm.hpp')
-rw-r--r--include/cru/parse/ParsingAlgorithm.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/cru/parse/ParsingAlgorithm.hpp b/include/cru/parse/ParsingAlgorithm.hpp
new file mode 100644
index 00000000..1ea30a80
--- /dev/null
+++ b/include/cru/parse/ParsingAlgorithm.hpp
@@ -0,0 +1,22 @@
+#pragma once
+#include "Grammar.hpp"
+
+namespace cru::parse {
+class ParsingAlgorithmContext;
+
+// Represents a parsing algorithm.
+// It does not relate to any specific grammar.
+// It is used to validate a grammar and create a parsing algorithm context.
+class ParsingAlgorithm {
+ public:
+ ParsingAlgorithm() = default;
+
+ CRU_DELETE_COPY(ParsingAlgorithm)
+ CRU_DELETE_MOVE(ParsingAlgorithm)
+
+ ~ParsingAlgorithm() = default;
+
+ virtual bool CanHandle(Grammar* grammar) const = 0;
+ virtual ParsingAlgorithmContext* CreateContext(Grammar* grammar) const = 0;
+};
+} // namespace cru::parse