#include "Parsodus/lrtables/SLR1Itemset.h" #include namespace pds { namespace lr { SLR1Itemset::SLR1Itemset() : LR0ItemsetBase() {} SLR1Itemset::SLR1Itemset(std::shared_ptr start) : LR0ItemsetBase(start) {} bool SLR1Itemset::needsFollow() { return true; } std::set SLR1Itemset::getReduces(const Grammar& g, std::string lookahead) const { std::set res; for (auto& item : m_items) { if (item.dotIdx >= item.rule->tail.size() && (*g.follow)(item.rule->head).count(lookahead)) { res.insert(std::find(g.rules.begin(), g.rules.end(), item.rule) - g.rules.begin()); } } return res; } } /* lr */ } /* pds */