mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Added ::initializeFirstState
This commit is contained in:
parent
1f9826a07e
commit
7126046049
2 changed files with 15 additions and 0 deletions
14
src/LR0.cpp
14
src/LR0.cpp
|
@ -128,6 +128,20 @@ LR0::Closure LR0::getClosure (const std::string& symbol) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void LR0::initializeFirstState (States& states) const
|
||||||
|
{
|
||||||
|
LR0::Closure result;
|
||||||
|
for (unsigned int r = 0; r < _augmented.size (); ++r)
|
||||||
|
{
|
||||||
|
Item item (_augmented[r]);
|
||||||
|
item.setGrammarRuleIndex (r);
|
||||||
|
result.push_back (item);
|
||||||
|
}
|
||||||
|
|
||||||
|
states.push_back (result);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void LR0::closeState (States& states, const int state) const
|
void LR0::closeState (States& states, const int state) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,7 @@ public:
|
||||||
private:
|
private:
|
||||||
std::set <std::string> getExpectedSymbols (const Closure&) const;
|
std::set <std::string> getExpectedSymbols (const Closure&) const;
|
||||||
Closure getClosure (const std::string&) const;
|
Closure getClosure (const std::string&) const;
|
||||||
|
void initializeFirstState (States&) const;
|
||||||
void closeState (States&, const int) const;
|
void closeState (States&, const int) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue