When an operand is missing, synthesize a "0" operand for post-error processing.

This ensures consistent behavior and avoids null-pointer dereferences in some cases.
This commit is contained in:
Stephen Heumann 2019-12-23 14:12:44 -06:00
parent b0b2b3fa91
commit 13a14d9389
1 changed files with 11 additions and 6 deletions

View File

@ -874,12 +874,17 @@ var
if stack = nil then begin
Error(36);
errorFound := true;
Pop := nil;
end {if}
else begin
Pop := stack;
stack := stack^.next;
end; {else}
new(stack); {synthesize the missing token}
stack^.token.class := intConstant;
stack^.token.kind := intconst;
stack^.token.ival := 0;
stack^.next := nil;
stack^.left := nil;
stack^.middle := nil;
stack^.right := nil;
end; {if}
Pop := stack;
stack := stack^.next;
end; {Pop}