SynPasSyn: fixed smart closing of repeat nodes

git-svn-id: trunk@35612 -
This commit is contained in:
martin 2012-02-27 19:42:05 +00:00
parent a595df99d1
commit 3ee12b8bbf

View File

@ -1360,7 +1360,6 @@ function TSynPasSyn.Func65: TtkTokenKind;
begin begin
if KeyComp('Repeat') then begin if KeyComp('Repeat') then begin
Result := tkKey; Result := tkKey;
SmartCloseBeginEndBlocks(cfbtRepeat);
StartPascalCodeFoldBlock(cfbtRepeat); StartPascalCodeFoldBlock(cfbtRepeat);
end end
else Result := tkIdentifier; else Result := tkIdentifier;
@ -1469,6 +1468,7 @@ function TSynPasSyn.Func76: TtkTokenKind;
begin begin
if KeyComp('Until') then begin if KeyComp('Until') then begin
Result := tkKey; Result := tkKey;
SmartCloseBeginEndBlocks(cfbtRepeat);
if TopPascalCodeFoldBlockType = cfbtRepeat then EndPascalCodeFoldBlock; if TopPascalCodeFoldBlockType = cfbtRepeat then EndPascalCodeFoldBlock;
end end
else Result := tkIdentifier; else Result := tkIdentifier;
@ -3676,7 +3676,7 @@ end;
procedure TSynPasSyn.SmartCloseBeginEndBlocks(SearchFor: TPascalCodeFoldBlockType); procedure TSynPasSyn.SmartCloseBeginEndBlocks(SearchFor: TPascalCodeFoldBlockType);
var var
i, nc: Integer; i: Integer;
t: TPascalCodeFoldBlockType; t: TPascalCodeFoldBlockType;
begin begin
// Close unfinished blocks, IF the expected type is found // Close unfinished blocks, IF the expected type is found
@ -3696,9 +3696,8 @@ begin
while i > 0 do begin while i > 0 do begin
EndPascalCodeFoldBlockLastLine; EndPascalCodeFoldBlockLastLine;
// Todo: FCatchNodeInfoList.CountAll > nc can not happen // Todo: FCatchNodeInfoList.CountAll > nc can not happen
nc := FCatchNodeInfoList.CountAll; //if FCatchNodeInfo and (FCatchNodeInfoList.CountAll > FCatchNodeInfoList.CountAll) then
if FCatchNodeInfo and (FCatchNodeInfoList.CountAll > nc) then // exclude(FCatchNodeInfoList.LastItemPointer^.FoldAction, sfaMarkup);
exclude(FCatchNodeInfoList.LastItemPointer^.FoldAction, sfaMarkup);
dec(i); dec(i);
end; end;
end; end;