From aa2dbbefae52f22803136d96232cf616bbbd1f27 Mon Sep 17 00:00:00 2001 From: Robin Jadoul Date: Wed, 11 Jan 2017 17:24:54 +0100 Subject: [PATCH] Cleanup for LR0 itemsets --- include/Parsodus/lrtables/LR0Item.h | 6 +++--- include/Parsodus/lrtables/LR0Itemset.h | 2 -- include/Parsodus/lrtables/LR0ItemsetBase.h | 6 +++--- src/lrtables/LR0Itemset.cpp | 16 ---------------- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/include/Parsodus/lrtables/LR0Item.h b/include/Parsodus/lrtables/LR0Item.h index a6cf4e0..6c9029a 100644 --- a/include/Parsodus/lrtables/LR0Item.h +++ b/include/Parsodus/lrtables/LR0Item.h @@ -1,6 +1,6 @@ #pragma once -#ifndef LRTABLES_LR0ITEM_H_3RNST1YA -#define LRTABLES_LR0ITEM_H_3RNST1YA +#ifndef PARSODUS_LRTABLES_LR0ITEM_H_3RNST1YA +#define PARSODUS_LRTABLES_LR0ITEM_H_3RNST1YA #include "Parsodus/grammar.h" @@ -20,4 +20,4 @@ struct LR0Item { } /* lr */ } /* pds */ -#endif /* LRTABLES_LR0ITEM_H_3RNST1YA */ +#endif /* PARSODUS_LRTABLES_LR0ITEM_H_3RNST1YA */ diff --git a/include/Parsodus/lrtables/LR0Itemset.h b/include/Parsodus/lrtables/LR0Itemset.h index b7e485b..ec2be29 100644 --- a/include/Parsodus/lrtables/LR0Itemset.h +++ b/include/Parsodus/lrtables/LR0Itemset.h @@ -20,8 +20,6 @@ public: static bool needsFollow(); std::set getReduces(const Grammar& g, std::string lookahead) const; - - void print() const; ///TODO remove me }; } /* lr */ diff --git a/include/Parsodus/lrtables/LR0ItemsetBase.h b/include/Parsodus/lrtables/LR0ItemsetBase.h index 354f437..7b0f0b3 100644 --- a/include/Parsodus/lrtables/LR0ItemsetBase.h +++ b/include/Parsodus/lrtables/LR0ItemsetBase.h @@ -1,6 +1,6 @@ #pragma once -#ifndef LRTABLES_LR0ITEMSETBASE_H_GGIPISTD -#define LRTABLES_LR0ITEMSETBASE_H_GGIPISTD +#ifndef PARSODUS_LRTABLES_LR0ITEMSETBASE_H_GGIPISTD +#define PARSODUS_LRTABLES_LR0ITEMSETBASE_H_GGIPISTD #include "Parsodus/lrtables/LR0Item.h" @@ -102,4 +102,4 @@ bool LR0ItemsetBase::empty() const { } /* lr */ } /* pds */ -#endif /* LRTABLES_LR0ITEMSETBASE_H_GGIPISTD */ +#endif /* PARSODUS_LRTABLES_LR0ITEMSETBASE_H_GGIPISTD */ diff --git a/src/lrtables/LR0Itemset.cpp b/src/lrtables/LR0Itemset.cpp index 20e4dea..0365e1a 100644 --- a/src/lrtables/LR0Itemset.cpp +++ b/src/lrtables/LR0Itemset.cpp @@ -1,24 +1,8 @@ #include "Parsodus/lrtables/LR0Itemset.h" -#include ///TODO remove me - namespace pds { namespace lr { -void LR0Itemset::print() const { - for (auto& item : m_items) { - std::cout << item.rule->head << " -> "; - for (std::size_t i = 0; i < item.rule->tail.size(); i++) { - if (i == item.dotIdx) - std::cout << " ·"; - std::cout << " " << item.rule->tail[i]; - } - if (item.dotIdx == item.rule->tail.size()) - std::cout << " ·"; - std::cout << std::endl; - } -} - LR0Itemset::LR0Itemset() : LR0ItemsetBase() {}