vhdlp: Renamed ExpConditional::else_t to ExpConditional::option_t.
This commit is contained in:
parent
44dfc41004
commit
ea12c0fe23
|
|
@ -288,13 +288,13 @@ void ExpConditional::dump(ostream&out, int indent) const
|
|||
(*cur)->dump(out, indent+4);
|
||||
}
|
||||
|
||||
for (list<else_t*>::const_iterator cur = else_clause_.begin()
|
||||
for (list<option_t*>::const_iterator cur = else_clause_.begin()
|
||||
; cur != else_clause_.end() ; ++cur) {
|
||||
(*cur)->dump(out, indent);
|
||||
}
|
||||
}
|
||||
|
||||
void ExpConditional::else_t::dump(ostream&out, int indent) const
|
||||
void ExpConditional::option_t::dump(ostream&out, int indent) const
|
||||
{
|
||||
out << setw(indent) << "" << "when:" << endl;
|
||||
if (cond_) cond_->dump(out, indent+4);
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ void ExpConcat::visit(ExprVisitor& func)
|
|||
}
|
||||
|
||||
ExpConditional::ExpConditional(Expression*co, list<Expression*>*tru,
|
||||
list<ExpConditional::else_t*>*fal)
|
||||
list<ExpConditional::option_t*>*fal)
|
||||
: cond_(co)
|
||||
{
|
||||
if (tru) true_clause_.splice(true_clause_.end(), *tru);
|
||||
|
|
@ -317,7 +317,7 @@ ExpConditional::~ExpConditional()
|
|||
delete tmp;
|
||||
}
|
||||
while (! else_clause_.empty()) {
|
||||
else_t*tmp = else_clause_.front();
|
||||
option_t*tmp = else_clause_.front();
|
||||
else_clause_.pop_front();
|
||||
delete tmp;
|
||||
}
|
||||
|
|
@ -335,13 +335,13 @@ Expression*ExpConditional::clone() const
|
|||
}
|
||||
}
|
||||
|
||||
std::list<else_t*>*new_else_clause = NULL;
|
||||
std::list<option_t*>*new_else_clause = NULL;
|
||||
if(!else_clause_.empty()) {
|
||||
new_else_clause = new std::list<else_t*>();
|
||||
new_else_clause = new std::list<option_t*>();
|
||||
|
||||
for(std::list<else_t*>::const_iterator it = else_clause_.begin();
|
||||
for(std::list<option_t*>::const_iterator it = else_clause_.begin();
|
||||
it != else_clause_.end(); ++it) {
|
||||
new_else_clause->push_back(new else_t(**it));
|
||||
new_else_clause->push_back(new option_t(**it));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -350,35 +350,26 @@ Expression*ExpConditional::clone() const
|
|||
|
||||
void ExpConditional::visit(ExprVisitor& func)
|
||||
{
|
||||
if(!true_clause_.empty()) {
|
||||
for(std::list<Expression*>::iterator it = true_clause_.begin();
|
||||
it != true_clause_.end(); ++it) {
|
||||
(*it)->visit(func);
|
||||
}
|
||||
for(std::list<Expression*>::iterator it = true_clause_.begin();
|
||||
it != true_clause_.end(); ++it) {
|
||||
(*it)->visit(func);
|
||||
}
|
||||
|
||||
if(!else_clause_.empty()) {
|
||||
for(std::list<else_t*>::iterator it = else_clause_.begin();
|
||||
it != else_clause_.end(); ++it) {
|
||||
std::list<Expression*>& else_clause = (*it)->extract_true_clause();
|
||||
|
||||
for(std::list<Expression*>::iterator jt = else_clause.begin();
|
||||
jt != else_clause.end(); ++jt) {
|
||||
(*jt)->visit(func);
|
||||
}
|
||||
}
|
||||
for(std::list<option_t*>::iterator it = else_clause_.begin();
|
||||
it != else_clause_.end(); ++it) {
|
||||
(*it)->visit(func);
|
||||
}
|
||||
|
||||
func(this);
|
||||
}
|
||||
|
||||
ExpConditional::else_t::else_t(Expression*cond, std::list<Expression*>*tru)
|
||||
ExpConditional::option_t::option_t(Expression*cond, std::list<Expression*>*tru)
|
||||
: cond_(cond)
|
||||
{
|
||||
if (tru) true_clause_.splice(true_clause_.end(), *tru);
|
||||
}
|
||||
|
||||
ExpConditional::else_t::else_t(const else_t&other)
|
||||
ExpConditional::option_t::option_t(const option_t&other)
|
||||
: LineInfo(other)
|
||||
{
|
||||
cond_ = other.cond_->clone();
|
||||
|
|
@ -388,7 +379,7 @@ ExpConditional::else_t::else_t(const else_t&other)
|
|||
}
|
||||
}
|
||||
|
||||
ExpConditional::else_t::~else_t()
|
||||
ExpConditional::option_t::~option_t()
|
||||
{
|
||||
delete cond_;
|
||||
while (! true_clause_.empty()) {
|
||||
|
|
@ -399,6 +390,17 @@ ExpConditional::else_t::~else_t()
|
|||
}
|
||||
|
||||
|
||||
void ExpConditional::option_t::visit(ExprVisitor& func)
|
||||
{
|
||||
if(cond_)
|
||||
func(cond_);
|
||||
|
||||
for(std::list<Expression*>::iterator it = true_clause_.begin();
|
||||
it != true_clause_.end(); ++it) {
|
||||
func(*it);
|
||||
}
|
||||
}
|
||||
|
||||
ExpEdge::ExpEdge(ExpEdge::fun_t typ, Expression*op)
|
||||
: ExpUnary(op), fun_(typ)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -460,17 +460,18 @@ class ExpConcat : public Expression {
|
|||
class ExpConditional : public Expression {
|
||||
|
||||
public:
|
||||
class else_t : public LineInfo {
|
||||
class option_t : public LineInfo {
|
||||
public:
|
||||
else_t(Expression*cond, std::list<Expression*>*tru);
|
||||
else_t(const else_t&other);
|
||||
~else_t();
|
||||
option_t(Expression*cond, std::list<Expression*>*tru);
|
||||
option_t(const option_t&other);
|
||||
~option_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);
|
||||
void dump(ostream&out, int indent = 0) const;
|
||||
std::list<Expression*>& extract_true_clause() { return true_clause_; }
|
||||
void visit(ExprVisitor& func);
|
||||
|
||||
private:
|
||||
Expression*cond_;
|
||||
|
|
@ -479,7 +480,7 @@ class ExpConditional : public Expression {
|
|||
|
||||
public:
|
||||
ExpConditional(Expression*cond, std::list<Expression*>*tru,
|
||||
std::list<else_t*>*fal);
|
||||
std::list<option_t*>*fal);
|
||||
~ExpConditional();
|
||||
|
||||
Expression*clone() const;
|
||||
|
|
@ -494,7 +495,7 @@ class ExpConditional : public Expression {
|
|||
private:
|
||||
Expression*cond_;
|
||||
std::list<Expression*> true_clause_;
|
||||
std::list<else_t*> else_clause_;
|
||||
std::list<option_t*> else_clause_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -721,7 +721,7 @@ int ExpConditional::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltyp
|
|||
errors += (*cur)->elaborate_expr(ent, scope, ltype);
|
||||
}
|
||||
|
||||
for (list<else_t*>::const_iterator cur = else_clause_.begin()
|
||||
for (list<option_t*>::const_iterator cur = else_clause_.begin()
|
||||
; cur != else_clause_.end() ; ++cur) {
|
||||
errors += (*cur)->elaborate_expr(ent, scope, ltype);
|
||||
}
|
||||
|
|
@ -729,7 +729,7 @@ int ExpConditional::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltyp
|
|||
return errors;
|
||||
}
|
||||
|
||||
int ExpConditional::else_t::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype)
|
||||
int ExpConditional::option_t::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype)
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -497,10 +497,10 @@ 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 (else_clause_.size() > 1) {
|
||||
list<else_t*>::iterator last = else_clause_.end();
|
||||
list<option_t*>::iterator last = else_clause_.end();
|
||||
-- last;
|
||||
|
||||
for (list<else_t*>::iterator cur = else_clause_.begin()
|
||||
for (list<option_t*>::iterator cur = else_clause_.begin()
|
||||
; cur != last ; ++cur) {
|
||||
errors += (*cur) ->emit_when_else(out, ent, scope);
|
||||
}
|
||||
|
|
@ -519,7 +519,7 @@ int ExpConditional::emit(ostream&out, Entity*ent, ScopeBase*scope)
|
|||
return errors;
|
||||
}
|
||||
|
||||
int ExpConditional::else_t::emit_when_else(ostream&out, Entity*ent, ScopeBase*scope)
|
||||
int ExpConditional::option_t::emit_when_else(ostream&out, Entity*ent, ScopeBase*scope)
|
||||
{
|
||||
int errors = 0;
|
||||
assert(cond_ != 0);
|
||||
|
|
@ -541,7 +541,7 @@ int ExpConditional::else_t::emit_when_else(ostream&out, Entity*ent, ScopeBase*sc
|
|||
return errors;
|
||||
}
|
||||
|
||||
int ExpConditional::else_t::emit_else(ostream&out, Entity*ent, ScopeBase*scope)
|
||||
int ExpConditional::option_t::emit_else(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::else_t*exp_else;
|
||||
std::list<ExpConditional::else_t*>*exp_else_list;
|
||||
ExpConditional::option_t*exp_else;
|
||||
std::list<ExpConditional::option_t*>*exp_else_list;
|
||||
|
||||
CaseSeqStmt::CaseStmtAlternative* case_alt;
|
||||
std::list<CaseSeqStmt::CaseStmtAlternative*>* case_alt_list;
|
||||
|
|
@ -800,12 +800,12 @@ concurrent_simple_signal_assignment
|
|||
|
||||
else_when_waveforms
|
||||
: else_when_waveforms else_when_waveform
|
||||
{ list<ExpConditional::else_t*>*tmp = $1;
|
||||
{ list<ExpConditional::option_t*>*tmp = $1;
|
||||
tmp ->push_back($2);
|
||||
$$ = tmp;
|
||||
}
|
||||
| else_when_waveform
|
||||
{ list<ExpConditional::else_t*>*tmp = new list<ExpConditional::else_t*>;
|
||||
{ list<ExpConditional::option_t*>*tmp = new list<ExpConditional::option_t*>;
|
||||
tmp->push_back($1);
|
||||
$$ = tmp;
|
||||
}
|
||||
|
|
@ -813,12 +813,12 @@ else_when_waveforms
|
|||
|
||||
else_when_waveform
|
||||
: K_else waveform K_when expression
|
||||
{ ExpConditional::else_t*tmp = new ExpConditional::else_t($4, $2);
|
||||
{ ExpConditional::option_t*tmp = new ExpConditional::option_t($4, $2);
|
||||
FILE_NAME(tmp, @1);
|
||||
$$ = tmp;
|
||||
}
|
||||
| K_else waveform
|
||||
{ ExpConditional::else_t*tmp = new ExpConditional::else_t(0, $2);
|
||||
{ ExpConditional::option_t*tmp = new ExpConditional::option_t(0, $2);
|
||||
FILE_NAME(tmp, @1);
|
||||
$$ = tmp;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue