vhdlpp: More renaming in ExpConditional.
This commit is contained in:
parent
49efe6573c
commit
5a0d967682
|
|
@ -280,13 +280,13 @@ void ExpConditional::dump(ostream&out, int indent) const
|
|||
{
|
||||
out << setw(indent) << "" << "Conditional expression at "<< get_fileline() << endl;
|
||||
|
||||
for (list<option_t*>::const_iterator cur = options_.begin()
|
||||
for (list<case_t*>::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);
|
||||
|
|
|
|||
|
|
@ -301,16 +301,16 @@ void ExpConcat::visit(ExprVisitor& func)
|
|||
}
|
||||
|
||||
ExpConditional::ExpConditional(Expression*co, list<Expression*>*tru,
|
||||
list<ExpConditional::option_t*>*options)
|
||||
list<ExpConditional::case_t*>*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<option_t*>*new_options = NULL;
|
||||
std::list<case_t*>*new_options = NULL;
|
||||
if(!options_.empty()) {
|
||||
new_options = new std::list<option_t*>();
|
||||
new_options = new std::list<case_t*>();
|
||||
|
||||
for(std::list<option_t*>::const_iterator it = options_.begin();
|
||||
for(std::list<case_t*>::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<Expression*>::iterator it = true_clause_.begin();
|
||||
it != true_clause_.end(); ++it) {
|
||||
(*it)->visit(func);
|
||||
}
|
||||
|
||||
for(std::list<option_t*>::iterator it = else_clause_.begin();
|
||||
it != else_clause_.end(); ++it) {
|
||||
for(std::list<case_t*>::iterator it = options_.begin();
|
||||
it != options_.end(); ++it) {
|
||||
(*it)->visit(func);
|
||||
}
|
||||
|
||||
func(this);
|
||||
}
|
||||
|
||||
ExpConditional::option_t::option_t(Expression*cond, std::list<Expression*>*tru)
|
||||
ExpConditional::case_t::case_t(Expression*cond, std::list<Expression*>*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_);
|
||||
|
|
|
|||
|
|
@ -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<Expression*>*tru);
|
||||
option_t(const option_t&other);
|
||||
~option_t();
|
||||
case_t(Expression*cond, std::list<Expression*>*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<Expression*>& extract_true_clause() { return true_clause_; }
|
||||
void visit(ExprVisitor& func);
|
||||
|
|
@ -480,7 +480,7 @@ class ExpConditional : public Expression {
|
|||
|
||||
public:
|
||||
ExpConditional(Expression*cond, std::list<Expression*>*tru,
|
||||
std::list<option_t*>*options);
|
||||
std::list<case_t*>*options);
|
||||
~ExpConditional();
|
||||
|
||||
Expression*clone() const;
|
||||
|
|
@ -493,7 +493,7 @@ class ExpConditional : public Expression {
|
|||
void visit(ExprVisitor& func);
|
||||
|
||||
private:
|
||||
std::list<option_t*> options_;
|
||||
std::list<case_t*> options_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -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<option_t*>::const_iterator cur = options_.begin()
|
||||
for (list<case_t*>::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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<option_t*>::iterator last = options_.end();
|
||||
list<case_t*>::iterator last = options_.end();
|
||||
--last;
|
||||
|
||||
for (list<option_t*>::iterator cur = options_.begin()
|
||||
for (list<case_t*>::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.
|
||||
|
|
|
|||
|
|
@ -228,8 +228,8 @@ static void touchup_interface_for_functions(std::list<InterfacePort*>*ports)
|
|||
IfSequential::Elsif*elsif;
|
||||
std::list<IfSequential::Elsif*>*elsif_list;
|
||||
|
||||
ExpConditional::option_t*exp_else;
|
||||
std::list<ExpConditional::option_t*>*exp_else_list;
|
||||
ExpConditional::case_t*exp_options;
|
||||
std::list<ExpConditional::case_t*>*exp_options_list;
|
||||
|
||||
CaseSeqStmt::CaseStmtAlternative* case_alt;
|
||||
std::list<CaseSeqStmt::CaseStmtAlternative*>* case_alt_list;
|
||||
|
|
@ -370,8 +370,8 @@ static void touchup_interface_for_functions(std::list<InterfacePort*>*ports)
|
|||
%type <elsif> if_statement_elsif
|
||||
%type <elsif_list> if_statement_elsif_list if_statement_elsif_list_opt
|
||||
|
||||
%type <exp_else> else_when_waveform
|
||||
%type <exp_else_list> else_when_waveforms
|
||||
%type <exp_options> else_when_waveform
|
||||
%type <exp_options_list> else_when_waveforms
|
||||
|
||||
%type <subprogram> function_specification subprogram_specification subprogram_body_start
|
||||
%type <severity> severity severity_opt
|
||||
|
|
@ -800,12 +800,12 @@ concurrent_simple_signal_assignment
|
|||
|
||||
else_when_waveforms
|
||||
: else_when_waveforms else_when_waveform
|
||||
{ list<ExpConditional::option_t*>*tmp = $1;
|
||||
{ list<ExpConditional::case_t*>*tmp = $1;
|
||||
tmp ->push_back($2);
|
||||
$$ = tmp;
|
||||
}
|
||||
| else_when_waveform
|
||||
{ list<ExpConditional::option_t*>*tmp = new list<ExpConditional::option_t*>;
|
||||
{ list<ExpConditional::case_t*>*tmp = new list<ExpConditional::case_t*>;
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue