| 6 | : m_tree(tree), m_path(path) {} |
| 7 |
| 8 | const Grammar* GrammarPtr::operator->() const { return get(); } |
| 9 |
| 10 | const Grammar* GrammarPtr::get() const { |
| 11 | const auto tree = m_tree.lock(); |
| 12 | return tree ? tree->resolveGrammar(m_path) : nullptr; |
| 13 | } |
| 14 |
| 15 | PatternPtr::PatternPtr(std::shared_ptr<LanguageTree> tree, size_t path) |
| 16 | : m_tree(tree), m_path(path) {} |
| 17 |
| 18 | const Pattern* PatternPtr::get() const { |
| 19 | const auto tree = m_tree.lock(); |
| 20 | return tree ? tree->resolvePattern(m_path) : nullptr; |
| 21 | } |
| 22 |
| 23 | std::shared_ptr<Pattern> PatternRaw::realize() { |
| 24 | return std::make_shared<Pattern>(m_regex, m_flags, m_lookbehind, m_greedy, m_alias, m_inside); |
| 25 | } |
| 26 |
| 27 | const Grammar* Pattern::inside() const { |
| 28 | if (m_inside) { |
| 29 | return m_inside->get(); |
| 30 | } |
| 31 |
| 32 | return nullptr; |
| 33 | } |
| 34 |