summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/generator.cpp10
-rw-r--r--src/generator.hpp8
-rw-r--r--src/output.cpp8
-rw-r--r--src/parser_state.cpp4
4 files changed, 15 insertions, 15 deletions
diff --git a/src/generator.cpp b/src/generator.cpp
index 5b9766e..9350f40 100644
--- a/src/generator.cpp
+++ b/src/generator.cpp
@@ -87,7 +87,7 @@ void generator_t::generate_itemsets() {
item_t shifted = item;
shifted.shift();
- std::set<item_t> &set = new_sets.emplace(sym, empty_set).first->second;
+ std::set<item_t> &set = new_sets.insert(std::make_pair(sym, empty_set)).first->second;
set.insert(std::move(shifted));
}
@@ -124,12 +124,12 @@ generator_t::generator_t(const std::vector<std::tuple<item_t, std::vector<std::s
for (size_t i = 0; i < rules.size(); i++) {
item_t rule = std::get<0>(rules[i]);
- nonterminals.emplace(rule.get_lhs());
- nonterms.emplace(rule.get_lhs(), i);
+ nonterminals.insert(rule.get_lhs());
+ nonterms.insert(std::make_pair(rule.get_lhs(), i));
while (rule.has_next()) {
const symbol_t &sym = rule.get_next_symbol();
- items.emplace(sym, rule);
+ items.insert(std::make_pair(sym, rule));
if (sym.get_type() != SYMBOL_TYPE_NONTERM)
terminals.insert(sym);
@@ -137,7 +137,7 @@ generator_t::generator_t(const std::vector<std::tuple<item_t, std::vector<std::s
rule.shift();
}
- rule_ids.emplace(rule, i);
+ rule_ids.insert(std::make_pair(rule, i));
}
generate_itemsets();
diff --git a/src/generator.hpp b/src/generator.hpp
index bed048f..5f2cb22 100644
--- a/src/generator.hpp
+++ b/src/generator.hpp
@@ -67,7 +67,7 @@ private:
std::set<item_t> get_set(const std::string &nonterm);
std::pair<std::map<std::set<item_t>, size_t>::iterator, bool> add_set(const std::set<item_t> &set) {
- return itemsets.emplace(set, itemsets.size());
+ return itemsets.insert(std::make_pair(set, itemsets.size()));
}
void add_reduction(size_t from, size_t to) {
@@ -76,7 +76,7 @@ private:
if (shift_conflicts.count(from))
throw conflict_error("shift/reduce conflict");
- reductions.emplace(from, to);
+ reductions.insert(std::make_pair(from, to));
}
void add_shift(size_t from, const symbol_t &sym, size_t to) {
@@ -84,11 +84,11 @@ private:
throw conflict_error("shift/reduce conflict");
shift_conflicts.insert(from);
- shifts.emplace(std::make_pair(from, sym), to);
+ shifts.insert(std::make_pair(std::make_pair(from, sym), to));
}
void add_goto(size_t from, const std::string &nonterm, size_t to) {
- gotos.emplace(std::make_pair(from, nonterm), to);
+ gotos.insert(std::make_pair(std::make_pair(from, nonterm), to));
}
void generate_itemsets();
diff --git a/src/output.cpp b/src/output.cpp
index 4d9efaf..72e9a6e 100644
--- a/src/output.cpp
+++ b/src/output.cpp
@@ -48,13 +48,13 @@ output_t::output_t(const generator_t *generator0, const char *header, const char
throw std::system_error(errno, std::generic_category(), "unable to open source output file for writing");
for (const std::string &nonterm : generator->get_nonterminals())
- symbol_values.emplace(symbol_t::make_nonterm(nonterm.c_str()), "symbol_" + nonterm);
+ symbol_values.insert(std::make_pair(symbol_t::make_nonterm(nonterm.c_str()), "symbol_" + nonterm));
for (const symbol_t &term : generator->get_terminals()) {
if (term.get_type() == SYMBOL_TYPE_TERM)
- tokens.emplace(term.get_value(), tokens.size());
+ tokens.insert(std::make_pair(term.get_value(), tokens.size()));
- symbol_values.emplace(term, "token." + generator->get_term_type(term).second);
+ symbol_values.insert(std::make_pair(term, "token." + generator->get_term_type(term).second));
}
}
@@ -78,7 +78,7 @@ void output_t::emit_token_value() {
for (const auto &term : generator->get_terminals()) {
const auto &type = generator->get_term_type(term);
if (!type.first.empty())
- token_values.emplace(type.second, type.first);
+ token_values.insert(std::make_pair(type.second, type.first));
}
for (const auto &value : token_values)
diff --git a/src/parser_state.cpp b/src/parser_state.cpp
index dfbe8a5..5ec8d08 100644
--- a/src/parser_state.cpp
+++ b/src/parser_state.cpp
@@ -72,7 +72,7 @@ void parser_state_t::add_type_terminal(const char *term) {
}
void parser_state_t::set_type_nonterminal(const char *type) {
- nonterm_types.emplace(current_var, type);
+ nonterm_types.insert(std::make_pair(current_var, type));
}
void parser_state_t::set_type_terminal(const char *type) {
@@ -80,7 +80,7 @@ void parser_state_t::set_type_terminal(const char *type) {
}
void parser_state_t::set_type_terminal_name(const char *name) {
- term_types.emplace(symbol_t::make_term(current_var.c_str()), std::make_pair(current_type, name));
+ term_types.insert(std::make_pair(symbol_t::make_term(current_var.c_str()), std::make_pair(current_type, name)));
}
}