Parse (to "sorry") arrays of named types.

This commit is contained in:
Stephen Williams 2012-05-13 17:05:09 -07:00
parent 621c09105c
commit ceaa60d2f4
3 changed files with 20 additions and 2 deletions

View File

@ -884,8 +884,10 @@ data_type /* IEEE1800-2005: A.2.2.1 */
FILE_NAME(tmp, @1);
$$ = tmp;
}
| TYPE_IDENTIFIER
{ $$ = $1; }
| TYPE_IDENTIFIER range_opt
{ if ($2) $$ = new array_type_t($1, $2);
else $$ = $1;
}
| K_string
{ yyerror(@1, "sorry: String data type not supported.");
$$ = 0;

View File

@ -2770,6 +2770,11 @@ void pform_set_data_type(const struct vlltype&li, data_type_t*data_type, list<pe
return;
}
if (/*array_type_t*array_type = */ dynamic_cast<array_type_t*> (data_type)) {
VLerror(li, "sorry: General array types not supported.");
return;
}
assert(0);
}

View File

@ -139,6 +139,17 @@ struct vector_type_t : public data_type_t {
std::auto_ptr< list<pform_range_t> > pdims;
};
/*
* The array_type_t is a generalization of the vector_type_t in that
* the base type is another general data type.
*/
struct array_type_t : public data_type_t {
inline explicit array_type_t(data_type_t*btype, std::list<pform_range_t>*pd)
: base_type(btype), packed_dims(pd) { }
data_type_t*base_type;
std::auto_ptr< list<pform_range_t> > packed_dims;
};
struct real_type_t : public data_type_t {
enum type_t { REAL, SHORTREAL };
inline explicit real_type_t(type_t tc) : type_code(tc) { }