Use a constructor rather than aggregate initialization for Production
This commit is contained in:
parent
f3e3e6193b
commit
947c161c2f
5 changed files with 32 additions and 36 deletions
|
|
@ -74,13 +74,7 @@ class ParseTableBuilder {
|
|||
Symbol::terminal(0) :
|
||||
Symbol::non_terminal(0);
|
||||
|
||||
Production start_production;
|
||||
start_production.steps.push_back({
|
||||
start_symbol,
|
||||
0,
|
||||
rules::AssociativityNone,
|
||||
rules::Alias{}
|
||||
});
|
||||
Production start_production({{start_symbol, 0, rules::AssociativityNone, rules::Alias{}}}, 0);
|
||||
|
||||
add_parse_state({}, ParseItemSet{{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -207,10 +207,7 @@ const vector<Production> &ParseItemSetBuilder::inline_production(const ParseItem
|
|||
auto begin = item.production->steps.begin();
|
||||
auto end = item.production->steps.end();
|
||||
auto step = begin + item.step_index;
|
||||
|
||||
Production production;
|
||||
production.steps.assign(begin, step);
|
||||
production.dynamic_precedence = item.production->dynamic_precedence;
|
||||
Production production({begin, step}, item.production->dynamic_precedence);
|
||||
|
||||
for (auto &step : *production_to_insert) {
|
||||
production.steps.push_back(step);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,12 @@ struct ProductionStep {
|
|||
|
||||
struct Production {
|
||||
std::vector<ProductionStep> steps;
|
||||
int dynamic_precedence = 0;
|
||||
int dynamic_precedence;
|
||||
|
||||
inline Production() : dynamic_precedence(0) {}
|
||||
|
||||
inline Production(std::vector<ProductionStep> &&steps, int dynamic_precedence = 0) :
|
||||
steps(move(steps)), dynamic_precedence(dynamic_precedence) {}
|
||||
|
||||
bool operator==(const Production &) const;
|
||||
inline ProductionStep &back() { return steps.back(); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue