diff --git a/vhdlpp/debug.cc b/vhdlpp/debug.cc index 03164de49..890fe4f35 100644 --- a/vhdlpp/debug.cc +++ b/vhdlpp/debug.cc @@ -280,13 +280,13 @@ void ExpConditional::dump(ostream&out, int indent) const { out << setw(indent) << "" << "Conditional expression at "<< get_fileline() << endl; - for (list::const_iterator cur = options_.begin() + for (list::const_iterator cur = options_.begin() ; cur != options_.end() ; ++cur) { (*cur)->dump(out, indent); } } -void ExpConditional::option_t::dump(ostream&out, int indent) const +void ExpConditional::case_t::dump(ostream&out, int indent) const { out << setw(indent) << "" << "when:" << endl; if (cond_) cond_->dump(out, indent+4); diff --git a/vhdlpp/expression.cc b/vhdlpp/expression.cc index 7124b2532..9caed2296 100644 --- a/vhdlpp/expression.cc +++ b/vhdlpp/expression.cc @@ -301,16 +301,16 @@ void ExpConcat::visit(ExprVisitor& func) } ExpConditional::ExpConditional(Expression*co, list*tru, - list*options) + list*options) { - if(co && tru) options_.push_back(new option_t(co, tru)); + if(co && tru) options_.push_back(new case_t(co, tru)); if(options) options_.splice(options_.end(), *options); } ExpConditional::~ExpConditional() { while (!options_.empty()) { - option_t*tmp = options_.front(); + case_t*tmp = options_.front(); options_.pop_front(); delete tmp; } @@ -318,13 +318,13 @@ ExpConditional::~ExpConditional() Expression*ExpConditional::clone() const { - std::list*new_options = NULL; + std::list*new_options = NULL; if(!options_.empty()) { - new_options = new std::list(); + new_options = new std::list(); - for(std::list::const_iterator it = options_.begin(); + for(std::list::const_iterator it = options_.begin(); it != options_.end(); ++it) { - new_options->push_back(new option_t(**it)); + new_options->push_back(new case_t(**it)); } } @@ -333,26 +333,21 @@ Expression*ExpConditional::clone() const void ExpConditional::visit(ExprVisitor& func) { - for(std::list::iterator it = true_clause_.begin(); - it != true_clause_.end(); ++it) { - (*it)->visit(func); - } - - for(std::list::iterator it = else_clause_.begin(); - it != else_clause_.end(); ++it) { + for(std::list::iterator it = options_.begin(); + it != options_.end(); ++it) { (*it)->visit(func); } func(this); } -ExpConditional::option_t::option_t(Expression*cond, std::list*tru) +ExpConditional::case_t::case_t(Expression*cond, std::list*tru) : cond_(cond) { if (tru) true_clause_.splice(true_clause_.end(), *tru); } -ExpConditional::option_t::option_t(const option_t&other) +ExpConditional::case_t::case_t(const case_t&other) : LineInfo(other) { cond_ = other.cond_->clone(); @@ -362,7 +357,7 @@ ExpConditional::option_t::option_t(const option_t&other) } } -ExpConditional::option_t::~option_t() +ExpConditional::case_t::~case_t() { delete cond_; while (! true_clause_.empty()) { @@ -373,7 +368,7 @@ ExpConditional::option_t::~option_t() } -void ExpConditional::option_t::visit(ExprVisitor& func) +void ExpConditional::case_t::visit(ExprVisitor& func) { if(cond_) func(cond_); diff --git a/vhdlpp/expression.h b/vhdlpp/expression.h index 02ac37ccf..e98ee86e4 100644 --- a/vhdlpp/expression.h +++ b/vhdlpp/expression.h @@ -460,15 +460,15 @@ class ExpConcat : public Expression { class ExpConditional : public Expression { public: - class option_t : public LineInfo { + class case_t : public LineInfo { public: - option_t(Expression*cond, std::list*tru); - option_t(const option_t&other); - ~option_t(); + case_t(Expression*cond, std::list*tru); + case_t(const case_t&other); + ~case_t(); int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*lt); - int emit_when_else(ostream&out, Entity*ent, ScopeBase*scope); - int emit_else(ostream&out, Entity*ent, ScopeBase*scope); + int emit_option(ostream&out, Entity*ent, ScopeBase*scope); + int emit_default(ostream&out, Entity*ent, ScopeBase*scope); void dump(ostream&out, int indent = 0) const; std::list& extract_true_clause() { return true_clause_; } void visit(ExprVisitor& func); @@ -480,7 +480,7 @@ class ExpConditional : public Expression { public: ExpConditional(Expression*cond, std::list*tru, - std::list*options); + std::list*options); ~ExpConditional(); Expression*clone() const; @@ -493,7 +493,7 @@ class ExpConditional : public Expression { void visit(ExprVisitor& func); private: - std::list options_; + std::list options_; }; /* diff --git a/vhdlpp/expression_elaborate.cc b/vhdlpp/expression_elaborate.cc index fd3eaa93e..3da6b94a5 100644 --- a/vhdlpp/expression_elaborate.cc +++ b/vhdlpp/expression_elaborate.cc @@ -715,7 +715,7 @@ int ExpConditional::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltyp /* Note that the type for the condition expression need not have anything to do with the type of this expression. */ - for (list::const_iterator cur = options_.begin() + for (list::const_iterator cur = options_.begin() ; cur != options_.end() ; ++cur) { errors += (*cur)->elaborate_expr(ent, scope, ltype); } @@ -723,7 +723,7 @@ int ExpConditional::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltyp return errors; } -int ExpConditional::option_t::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) +int ExpConditional::case_t::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) { int errors = 0; diff --git a/vhdlpp/expression_emit.cc b/vhdlpp/expression_emit.cc index 895c2a7c7..99b0fc886 100644 --- a/vhdlpp/expression_emit.cc +++ b/vhdlpp/expression_emit.cc @@ -485,19 +485,19 @@ int ExpConditional::emit(ostream&out, Entity*ent, ScopeBase*scope) // Draw out any when-else expressions. These are all the else_ // clauses besides the last. if (options_.size() > 1) { - list::iterator last = options_.end(); + list::iterator last = options_.end(); --last; - for (list::iterator cur = options_.begin() + for (list::iterator cur = options_.begin() ; cur != last ; ++cur) { - errors += (*cur) ->emit_when_else(out, ent, scope); + errors += (*cur)->emit_option(out, ent, scope); } - } + } - errors += options_.back()->emit_else(out, ent, scope); + errors += options_.back()->emit_default(out, ent, scope); out << ")"; - // The emit_when_else() functions do not close the last + // The emit_option() functions do not close the last // parentheses so that the following expression can be // nested. But that means come the end, we have some // expressions to close. @@ -507,7 +507,7 @@ int ExpConditional::emit(ostream&out, Entity*ent, ScopeBase*scope) return errors; } -int ExpConditional::option_t::emit_when_else(ostream&out, Entity*ent, ScopeBase*scope) +int ExpConditional::case_t::emit_option(ostream&out, Entity*ent, ScopeBase*scope) { int errors = 0; assert(cond_ != 0); @@ -529,7 +529,7 @@ int ExpConditional::option_t::emit_when_else(ostream&out, Entity*ent, ScopeBase* return errors; } -int ExpConditional::option_t::emit_else(ostream&out, Entity*ent, ScopeBase*scope) +int ExpConditional::case_t::emit_default(ostream&out, Entity*ent, ScopeBase*scope) { int errors = 0; // Trailing else must have no condition. diff --git a/vhdlpp/parse.y b/vhdlpp/parse.y index 1d481fe10..670304aac 100644 --- a/vhdlpp/parse.y +++ b/vhdlpp/parse.y @@ -228,8 +228,8 @@ static void touchup_interface_for_functions(std::list*ports) IfSequential::Elsif*elsif; std::list*elsif_list; - ExpConditional::option_t*exp_else; - std::list*exp_else_list; + ExpConditional::case_t*exp_options; + std::list*exp_options_list; CaseSeqStmt::CaseStmtAlternative* case_alt; std::list* case_alt_list; @@ -370,8 +370,8 @@ static void touchup_interface_for_functions(std::list*ports) %type if_statement_elsif %type if_statement_elsif_list if_statement_elsif_list_opt -%type else_when_waveform -%type else_when_waveforms +%type else_when_waveform +%type else_when_waveforms %type function_specification subprogram_specification subprogram_body_start %type severity severity_opt @@ -800,12 +800,12 @@ concurrent_simple_signal_assignment else_when_waveforms : else_when_waveforms else_when_waveform - { list*tmp = $1; + { list*tmp = $1; tmp ->push_back($2); $$ = tmp; } | else_when_waveform - { list*tmp = new list; + { list*tmp = new list; tmp->push_back($1); $$ = tmp; } @@ -813,12 +813,12 @@ else_when_waveforms else_when_waveform : K_else waveform K_when expression - { ExpConditional::option_t*tmp = new ExpConditional::option_t($4, $2); + { ExpConditional::case_t*tmp = new ExpConditional::case_t($4, $2); FILE_NAME(tmp, @1); $$ = tmp; } | K_else waveform - { ExpConditional::option_t*tmp = new ExpConditional::option_t(0, $2); + { ExpConditional::case_t*tmp = new ExpConditional::case_t(0, $2); FILE_NAME(tmp, @1); $$ = tmp; }