diff --git a/src/LR0.cpp b/src/LR0.cpp index d3134a7c..7951a342 100644 --- a/src/LR0.cpp +++ b/src/LR0.cpp @@ -132,14 +132,10 @@ void LR0::closeState (States& states, const int state) const if (! item.done () && item.next () == expected) { - Item advanced (item); advanced.advance (); closure.push_back (advanced); - if (! advanced.done ()) - item.setTransition ((int)states.size ()); - if (! advanced.done ()) { auto nextSymbol = advanced.next (); @@ -306,7 +302,6 @@ LR0::Item::Item (const std::vector & rule) : _rule (rule) , _cursor (2) , _grammarRule (-1) -, _transitionsTo (-1) { if (_rule.size () == 3 && _rule[2] == "є") _rule.pop_back (); @@ -315,7 +310,6 @@ LR0::Item::Item (const std::vector & rule) //////////////////////////////////////////////////////////////////////////////// bool LR0::Item::operator== (const Item& other) { - // Deliberately ignores _transitionsTo. if (_cursor != other._cursor || _grammarRule != other._grammarRule || _rule.size () != other._rule.size ()) @@ -334,12 +328,6 @@ void LR0::Item::setGrammarRuleIndex (const int rule) _grammarRule = rule; } -//////////////////////////////////////////////////////////////////////////////// -void LR0::Item::setTransition (const int state) -{ - _transitionsTo = state; -} - //////////////////////////////////////////////////////////////////////////////// bool LR0::Item::advance () { @@ -384,9 +372,6 @@ std::string LR0::Item::dump () const if (_grammarRule != -1) out << " [g" << _grammarRule << "]"; - if (_transitionsTo != -1) - out << " [s" << _transitionsTo << "]"; - return out.str (); } diff --git a/src/LR0.h b/src/LR0.h index 9a2e0fc8..b2065083 100644 --- a/src/LR0.h +++ b/src/LR0.h @@ -46,7 +46,6 @@ public: Item (const std::vector &); bool operator== (const LR0::Item&); void setGrammarRuleIndex (const int); - void setTransition (const int); bool advance (); bool done () const; std::string next () const; @@ -56,7 +55,6 @@ public: std::vector _rule; unsigned int _cursor; int _grammarRule; - int _transitionsTo; }; class Closure : public std::vector