mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-28 20:29:51 +00:00
Ensure array designators are processed at the level with braces.
This commit is contained in:
parent
5df94c953e
commit
aa6b82a136
14
Parser.pas
14
Parser.pas
|
@ -1862,6 +1862,7 @@ var
|
||||||
iPtr,jPtr,kPtr: initializerPtr; {for reversing the list}
|
iPtr,jPtr,kPtr: initializerPtr; {for reversing the list}
|
||||||
ip: identList; {used to place an id in the list}
|
ip: identList; {used to place an id in the list}
|
||||||
luseGlobalPool: boolean; {local copy of useGlobalPool}
|
luseGlobalPool: boolean; {local copy of useGlobalPool}
|
||||||
|
skipComma: boolean; {skip an expected comma}
|
||||||
|
|
||||||
|
|
||||||
procedure InsertInitializerRecord (iPtr: initializerPtr; size: longint);
|
procedure InsertInitializerRecord (iPtr: initializerPtr; size: longint);
|
||||||
|
@ -2506,6 +2507,7 @@ var
|
||||||
if token.kind in [dotch,lbrackch] then
|
if token.kind in [dotch,lbrackch] then
|
||||||
if not (braces or nestedDesignator) then begin
|
if not (braces or nestedDesignator) then begin
|
||||||
{TODO fill?}
|
{TODO fill?}
|
||||||
|
skipComma := true;
|
||||||
goto 1;
|
goto 1;
|
||||||
end; {if}
|
end; {if}
|
||||||
startingDisp := disp;
|
startingDisp := disp;
|
||||||
|
@ -2578,6 +2580,10 @@ var
|
||||||
repeat
|
repeat
|
||||||
skipToNext := false;
|
skipToNext := false;
|
||||||
if token.kind = lbrackch then begin
|
if token.kind = lbrackch then begin
|
||||||
|
if not (braces or nestedDesignator) then begin
|
||||||
|
skipComma := true;
|
||||||
|
goto 1;
|
||||||
|
end; {if}
|
||||||
NextToken;
|
NextToken;
|
||||||
Expression(arrayExpression, [rbrackch]);
|
Expression(arrayExpression, [rbrackch]);
|
||||||
if (expressionValue < 0)
|
if (expressionValue < 0)
|
||||||
|
@ -2603,8 +2609,11 @@ var
|
||||||
count := count+1;
|
count := count+1;
|
||||||
if (count = maxCount) and not braces then
|
if (count = maxCount) and not braces then
|
||||||
done := true
|
done := true
|
||||||
else if token.kind = commach then begin
|
else if (token.kind = commach) or skipComma then begin
|
||||||
NextToken;
|
if skipComma then
|
||||||
|
skipComma := false
|
||||||
|
else
|
||||||
|
NextToken;
|
||||||
done := token.kind = rbracech;
|
done := token.kind = rbracech;
|
||||||
if not done then
|
if not done then
|
||||||
if count = maxCount then
|
if count = maxCount then
|
||||||
|
@ -2735,6 +2744,7 @@ bitcount := 0; {set up for bit fields}
|
||||||
bitvalue := 0;
|
bitvalue := 0;
|
||||||
disp := 0; {start at beginning of the object}
|
disp := 0; {start at beginning of the object}
|
||||||
errorFound := false; {no errors found so far}
|
errorFound := false; {no errors found so far}
|
||||||
|
skipComma := false;
|
||||||
luseGlobalPool := useGlobalPool; {use global memory for global vars}
|
luseGlobalPool := useGlobalPool; {use global memory for global vars}
|
||||||
useGlobalPool := (variable^.storage in [external,global,private])
|
useGlobalPool := (variable^.storage in [external,global,private])
|
||||||
or useGlobalPool;
|
or useGlobalPool;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user