diff --git a/vhdlpp/parse.y b/vhdlpp/parse.y index e9ac90604..0372d4925 100644 --- a/vhdlpp/parse.y +++ b/vhdlpp/parse.y @@ -684,8 +684,8 @@ composite_type_definition /* unbounded_array_definition IEEE 1076-2008 P5.3.2.1 */ | K_array '(' index_subtype_definition_list ')' K_of subtype_indication - { sorrymsg(@1, "unbounded_array_definition not supported.\n"); - std::list r; + { std::list r; + r.push_back(new prange_t(NULL, NULL, true)); // NULL boundaries indicate unbounded array type VTypeArray*tmp = new VTypeArray($6, &r); $$ = tmp; } diff --git a/vhdlpp/parse_misc.cc b/vhdlpp/parse_misc.cc index 0049388bf..3956b4a1a 100644 --- a/vhdlpp/parse_misc.cc +++ b/vhdlpp/parse_misc.cc @@ -82,6 +82,12 @@ static const VType* calculate_subtype_array(const YYLTYPE&loc, const char*base_n assert(array_left==0 || array_right!=0); + // unfold typedef, if it is the case + const VTypeDef*type_def = dynamic_cast (base_type); + if (type_def) { + base_type = type_def->peek_definition(); + } + const VTypeArray*base_array = dynamic_cast (base_type); if (base_array) { assert(array_left && array_right); diff --git a/vhdlpp/vtype_emit.cc b/vhdlpp/vtype_emit.cc index d5f8b32da..baea99a3d 100644 --- a/vhdlpp/vtype_emit.cc +++ b/vhdlpp/vtype_emit.cc @@ -88,16 +88,14 @@ int VTypeArray::emit_def(ostream&out) const while (! dims.empty()) { cur = dims.front(); dims.pop_front(); + out << "["; - if (cur->dimension(0).msb()) + if (cur->dimension(0).msb() && cur->dimension(0).lsb()) { + // bounded array, unbounded arrays have msb() & lsb() nullified errors += cur->dimension(0).msb()->emit(out, 0, 0); - else - out << "?error?"; - out << ":"; - if (cur->dimension(0).lsb()) + out << ":"; errors += cur->dimension(0).lsb()->emit(out, 0, 0); - else - out << "?error?"; + } out << "]"; }