diff --git a/parse.y b/parse.y index 285996075..b7b228592 100644 --- a/parse.y +++ b/parse.y @@ -3506,9 +3506,16 @@ dimensions /* This is used to express the return type of a function. */ function_range_or_type_opt - : range { $$.range = make_range_vector($1); $$.type = PTF_REG; } - | K_signed range { $$.range = make_range_vector($2); $$.type = PTF_REG_S; } - | K_unsigned range { $$.range = make_range_vector($2); $$.type = PTF_REG; } + : unsigned_signed_opt range_opt + { + /* the default type is reg unsigned and no range */ + $$.type = PTF_REG; + $$.range = 0; + if ($1) + $$.type = PTF_REG_S; + if ($2) + $$.range = make_range_vector($2); + } | K_reg unsigned_signed_opt range_opt { /* the default type is reg unsigned and no range */ @@ -3526,7 +3533,6 @@ function_range_or_type_opt | atom2_type { $$.range = make_range_vector($1); $$.type = PTF_ATOM2_S; } | atom2_type K_signed { $$.range = make_range_vector($1); $$.type = PTF_ATOM2_S; } | atom2_type K_unsigned { $$.range = make_range_vector($1); $$.type = PTF_ATOM2; } - | { $$.range = 0; $$.type = PTF_REG; } ; /* The register_variable rule is matched only when I am parsing