mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-20 14:46:15 +02:00
SynEdit: Pas HL, fixes for fold, detecting "else" in "case", when previous if is nested in other commands
git-svn-id: trunk@59300 -
This commit is contained in:
parent
68d6283828
commit
41ff259afe
@ -927,8 +927,9 @@ end;
|
|||||||
function TSynPasSyn.Func15: TtkTokenKind;
|
function TSynPasSyn.Func15: TtkTokenKind;
|
||||||
begin
|
begin
|
||||||
if KeyComp('If') then begin
|
if KeyComp('If') then begin
|
||||||
//TODO: case a of 1: while x do if e then ...
|
// Anything that may be nested in a "case", and does not have an end (like "end", "until",...)
|
||||||
StartPascalCodeFoldBlock(cfbtIfThen, TopPascalCodeFoldBlockType in [cfbtCase, cfbtIfThen]);
|
StartPascalCodeFoldBlock(cfbtIfThen,
|
||||||
|
TopPascalCodeFoldBlockType in [cfbtCase, cfbtIfThen, cfbtIfElse, cfbtForDo, cfbtWhileDo, cfbtWithDo]);
|
||||||
Result := tkKey
|
Result := tkKey
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -1030,6 +1031,8 @@ begin
|
|||||||
EndPascalCodeFoldBlock(True);
|
EndPascalCodeFoldBlock(True);
|
||||||
end;
|
end;
|
||||||
fStringLen := sl;
|
fStringLen := sl;
|
||||||
|
end else if tfb = cfbtProcedure then begin
|
||||||
|
// EndPascalCodeFoldBlock; // wrong source: procedure end, without begin
|
||||||
end else if tfb = cfbtUnitSection then begin
|
end else if tfb = cfbtUnitSection then begin
|
||||||
EndPascalCodeFoldBlockLastLine;
|
EndPascalCodeFoldBlockLastLine;
|
||||||
if TopPascalCodeFoldBlockType = cfbtUnit then // "Unit".."end."
|
if TopPascalCodeFoldBlockType = cfbtUnit then // "Unit".."end."
|
||||||
@ -1276,7 +1279,8 @@ begin
|
|||||||
// in a "case", we need to distinguish a possible follwing "else"
|
// in a "case", we need to distinguish a possible follwing "else"
|
||||||
if (TopPascalCodeFoldBlockType = cfbtIfThen) then
|
if (TopPascalCodeFoldBlockType = cfbtIfThen) then
|
||||||
EndPascalCodeFoldBlock;
|
EndPascalCodeFoldBlock;
|
||||||
StartPascalCodeFoldBlock(cfbtIfThen, TopPascalCodeFoldBlockType in [cfbtCase, cfbtIfThen]);
|
StartPascalCodeFoldBlock(cfbtIfThen,
|
||||||
|
TopPascalCodeFoldBlockType in [cfbtCase, cfbtIfThen, cfbtIfElse, cfbtForDo, cfbtWhileDo, cfbtWithDo]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result := tkIdentifier;
|
Result := tkIdentifier;
|
||||||
|
Loading…
Reference in New Issue
Block a user