summaryrefslogtreecommitdiffstats
path: root/src/generator.hpp
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-04-02 01:43:43 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-04-02 01:43:43 +0200
commitab2d315aa2daf404bc6abab2f8f20f72803b8898 (patch)
treec8f0e3eb20b4ec3c80e5dc02e2bb82833066a901 /src/generator.hpp
parent531a4de1fcea1df2b2b0d9303d82aa23c6285fb0 (diff)
downloadsolar-ab2d315aa2daf404bc6abab2f8f20f72803b8898.tar
solar-ab2d315aa2daf404bc6abab2f8f20f72803b8898.zip
generator: remove printing, add some getters
Diffstat (limited to 'src/generator.hpp')
-rw-r--r--src/generator.hpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/generator.hpp b/src/generator.hpp
index 715dd98..5396d3e 100644
--- a/src/generator.hpp
+++ b/src/generator.hpp
@@ -45,9 +45,9 @@ private:
std::multimap<symbol_t, item_t> items;
std::map<std::set<item_t>, size_t> itemsets;
- std::map<std::pair<unsigned, symbol_t>, unsigned> shifts;
- std::map<unsigned, unsigned> reductions;
- std::map<std::pair<unsigned, symbol_t>, unsigned> gotos;
+ std::map<std::pair<size_t, symbol_t>, size_t> shifts;
+ std::map<size_t, size_t> reductions;
+ std::map<std::pair<size_t, symbol_t>, size_t> gotos;
void close_set(std::set<item_t> *set);
std::set<item_t> get_set(const std::string &nonterm);
@@ -58,11 +58,15 @@ private:
void generate_itemsets();
- static void print_symbol(const symbol_t &sym);
- static void print_item(const item_t &item, bool point);
- static void print_set(const std::set<item_t> &set);
-
public:
+ const std::set<symbol_t> & get_terminals() const {
+ return terminals;
+ }
+
+ size_t get_state_count() const {
+ return itemsets.size();
+ }
+
generator_t(const std::vector<item_t> &rules0);
};