From 74bb9cd27242b9320f99ff4d2b50c3051576cc14 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 8 Feb 2022 16:53:51 +0800 Subject: ... --- include/cru/parse/ParsingAlgorithm.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 include/cru/parse/ParsingAlgorithm.h (limited to 'include/cru/parse/ParsingAlgorithm.h') diff --git a/include/cru/parse/ParsingAlgorithm.h b/include/cru/parse/ParsingAlgorithm.h new file mode 100644 index 00000000..ae2dd0b5 --- /dev/null +++ b/include/cru/parse/ParsingAlgorithm.h @@ -0,0 +1,22 @@ +#pragma once +#include "Grammar.h" + +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 CRU_PARSE_API ParsingAlgorithm { + public: + ParsingAlgorithm() = default; + + CRU_DELETE_COPY(ParsingAlgorithm) + CRU_DELETE_MOVE(ParsingAlgorithm) + + virtual ~ParsingAlgorithm() = default; + + virtual bool CanHandle(Grammar* grammar) const = 0; + virtual ParsingAlgorithmContext* CreateContext(Grammar* grammar) const = 0; +}; +} // namespace cru::parse -- cgit v1.2.3