|
|
@@ -89,16 +89,21 @@ protected:
|
|
|
|
|
|
private:
|
|
|
friend bool operator==(grammar_base const &, grammar_base const &) = default;
|
|
|
+ friend std::ostream & operator<<(std::ostream &, grammar_base const &);
|
|
|
|
|
|
private:
|
|
|
static rule_store const s_default_rules_;
|
|
|
rule_store rules_;
|
|
|
};
|
|
|
|
|
|
-class grammar : public grammar_base {
|
|
|
+class grammar_group : public grammar_base {
|
|
|
public:
|
|
|
- using rule_store = std::map<std::string, rule, detail::iless>;
|
|
|
+ grammar_group(rule_store rules) : grammar_base(std::move(rules)) {}
|
|
|
+
|
|
|
+ bool satisfies(reference name, std::string_view text) const;
|
|
|
+};
|
|
|
|
|
|
+class grammar : public grammar_base {
|
|
|
public:
|
|
|
grammar(std::string_view name, rule base_rule, rule_store rules = {})
|
|
|
: grammar_base(std::move(rules)), name_(name),
|
|
|
@@ -110,6 +115,7 @@ private:
|
|
|
friend bool operator==(grammar const &, grammar const &) = default;
|
|
|
friend std::ostream & operator<<(std::ostream &, grammar const &);
|
|
|
|
|
|
+private:
|
|
|
std::string name_;
|
|
|
rule base_rule_;
|
|
|
};
|