diff --git a/src/LR0.cpp b/src/LR0.cpp index 4d643bea..a1c15ebc 100644 --- a/src/LR0.cpp +++ b/src/LR0.cpp @@ -286,7 +286,7 @@ LR0::Item::Item (const std::vector & rule) : _rule (rule) , _cursor (2) , _grammarRule (-1) -, _reducesTo (-1) +, _transitionsTo (-1) { if (_rule.size () == 3 && _rule[2] == "є") _rule.pop_back (); @@ -295,10 +295,10 @@ LR0::Item::Item (const std::vector & rule) //////////////////////////////////////////////////////////////////////////////// bool LR0::Item::operator== (const Item& other) { - if (_cursor != other._cursor || - _grammarRule != other._grammarRule || - _reducesTo != other._reducesTo || - _rule.size () != other._rule.size ()) + if (_cursor != other._cursor || + _grammarRule != other._grammarRule || + _transitionsTo != other._transitionsTo || + _rule.size () != other._rule.size ()) return false; for (unsigned int i = 0; i < _rule.size () - 1; ++i) @@ -315,9 +315,9 @@ void LR0::Item::setGrammarRuleIndex (const int rule) } //////////////////////////////////////////////////////////////////////////////// -void LR0::Item::setReductionRule (const int rule) +void LR0::Item::setTransition (const int state) { - _reducesTo = rule; + _transitionsTo = state; } //////////////////////////////////////////////////////////////////////////////// @@ -364,8 +364,8 @@ std::string LR0::Item::dump () const if (_grammarRule != -1) out << " [g" << _grammarRule << "]"; - if (_reducesTo != -1) - out << " [r" << _reducesTo << "]"; + if (_transitionsTo != -1) + out << " [s" << _transitionsTo << "]"; return out.str (); } diff --git a/src/LR0.h b/src/LR0.h index d2590b85..40e05dc8 100644 --- a/src/LR0.h +++ b/src/LR0.h @@ -47,7 +47,7 @@ public: Item (const std::vector &); bool operator== (const LR0::Item&); void setGrammarRuleIndex (const int); - void setReductionRule (const int); + void setTransition (const int); bool advance (); bool done () const; std::string next () const; @@ -57,7 +57,7 @@ public: std::vector _rule; unsigned int _cursor; int _grammarRule; - int _reducesTo; + int _transitionsTo; }; class Closure : public std::vector