From f658c5d35c2a901dda032d692519b148c0f7781c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 2 Jan 2016 14:27:00 -0500 Subject: [PATCH] LR0: Added ::getExpected to ::closure --- src/LR0.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/LR0.cpp b/src/LR0.cpp index 7a8e7252..bb095da3 100644 --- a/src/LR0.cpp +++ b/src/LR0.cpp @@ -97,10 +97,20 @@ void LR0::initialize (const Grammar& grammar) LR0::Closure LR0::getClosure (const Closure& items) { LR0::Closure closure; - - for (auto & item : items) + for (auto& item : items) + { + // closure(I) includes I. closure.push_back (item); + // Obtain all the expected symbols. + auto expected = getExpectations (items); + for (auto& exp : expected) + { + std::cout << "# Expecting " << exp << "\n"; + std::cout << "# Add expansion of " << exp << "\n"; + } + } + return closure; }