Handle numeric literals with no digits.
This commit is contained in:
parent
027e060865
commit
8803eb3288
|
|
@ -862,6 +862,14 @@ verinum*make_unsized_binary(const char*txt)
|
|||
for (const char*idx = ptr ; *idx ; idx += 1)
|
||||
if (*idx != '_') size += 1;
|
||||
|
||||
if (size == 0) {
|
||||
VLerror(yylloc, "Numeric literal has no digits in it.");
|
||||
verinum*out = new verinum();
|
||||
out->has_sign(sign_flag);
|
||||
out->is_single(single_flag);
|
||||
return out;
|
||||
}
|
||||
|
||||
if ((based_size > 0) && (size > based_size)) yywarn(yylloc,
|
||||
"extra digits given for sized binary constant.");
|
||||
|
||||
|
|
|
|||
23
pform.cc
23
pform.cc
|
|
@ -1087,16 +1087,21 @@ verinum* pform_verinum_with_size(verinum*siz, verinum*val,
|
|||
|
||||
verinum::V pad;
|
||||
|
||||
switch (val->get(val->len()-1)) {
|
||||
case verinum::Vz:
|
||||
pad = verinum::Vz;
|
||||
break;
|
||||
case verinum::Vx:
|
||||
if (val->len() == 0) {
|
||||
pad = verinum::Vx;
|
||||
break;
|
||||
default:
|
||||
pad = verinum::V0;
|
||||
break;
|
||||
} else {
|
||||
|
||||
switch (val->get(val->len()-1)) {
|
||||
case verinum::Vz:
|
||||
pad = verinum::Vz;
|
||||
break;
|
||||
case verinum::Vx:
|
||||
pad = verinum::Vx;
|
||||
break;
|
||||
default:
|
||||
pad = verinum::V0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
verinum*res = new verinum(pad, size, true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue