From 360a3bdbc9cf7084d9f1f1af09ea99831edffd34 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 15 Dec 2021 21:11:26 +0800 Subject: ... --- include/cru/parse/ParsingAlgorithm.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 include/cru/parse/ParsingAlgorithm.hpp (limited to 'include/cru/parse/ParsingAlgorithm.hpp') 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 -- cgit v1.2.3