mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 20:13:50 +02:00
codetools: completeblock: fixed closing nested if else
git-svn-id: trunk@20433 -
This commit is contained in:
parent
0ac9217af3
commit
58acb9da65
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -167,6 +167,7 @@ components/codetools/examples/testscompleteblock/ifbegin1.inc svneol=native#text
|
||||
components/codetools/examples/testscompleteblock/procedurebegin1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/procedurebeginend1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/record1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/repeatifelse1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/unit1.pas svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/whilebegin1.inc svneol=native#text/plain
|
||||
components/codetools/expreval.pas svneol=native#text/pascal
|
||||
|
@ -9,7 +9,7 @@
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<LRSInOutputDirectory Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<SessionStorage Value="InIDEConfig"/>
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="completeblock"/>
|
||||
@ -30,35 +30,12 @@
|
||||
<PackageName Value="CodeTools"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="6">
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<Filename Value="completeblock.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CompleteBlock"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="scanexamples/brokenfilenames.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="BrokenFilenames"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="scanexamples/brokenincfiles.inc"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="scanexamples/empty.inc"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="scanexamples/indentation.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="Indentation"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="completeblocktests/unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="unit1"/>
|
||||
</Unit5>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
@ -0,0 +1,22 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
var
|
||||
FileInfo: TSearchRec;
|
||||
begin
|
||||
if FindFirstUTF8(Dir+FileMask,faAnyFile,FileInfo)=0 then begin
|
||||
repeat
|
||||
// check if special file
|
||||
if (FileInfo.Name='.') or (FileInfo.Name='..') or (FileInfo.Name='')
|
||||
then
|
||||
continue;
|
||||
|
||||
if FilenameIsPascalUnit(FileInfo.Name,false) then begin
|
||||
List.Add(Dir+FileInfo.Name);
|
||||
end else if (FileInfo.Attr and faDirectory)>0 then begin
|
||||
CollectUnits(Dir+);
|
||||
end;
|
||||
until FindNextUTF8(FileInfo)<>0;
|
||||
end;
|
||||
FindCloseUTF8(FileInfo);
|
||||
end;
|
||||
|
@ -22,6 +22,8 @@ implementation
|
||||
|
||||
{$IFDEF casecolon} {$I casecolon1.inc} {$ENDIF}
|
||||
|
||||
{$IFDEF repeatifelse} {$I repeatifelse1.inc} {$ENDIF}
|
||||
|
||||
{$IFDEF ifbegin} {$I ifbegin1.inc} {$ENDIF}
|
||||
{$IFDEF beginwithoutindent} {$I beginwithoutindent1.inc} {$ENDIF}
|
||||
|
||||
|
@ -43,7 +43,7 @@ interface
|
||||
|
||||
{ $DEFINE DisableIgnoreErrorAfter}
|
||||
{ $DEFINE VerboseGetStringConstBounds}
|
||||
{ $DEFINE ShowCompleteBlock}
|
||||
{$DEFINE ShowCompleteBlock}
|
||||
|
||||
uses
|
||||
{$IFDEF MEM_CHECK}
|
||||
@ -5397,6 +5397,8 @@ var
|
||||
btCaseColon,btRepeat:
|
||||
begin
|
||||
// missing semicolon or until
|
||||
DebugLn(['ReadStatements CursorBlockLvl=',CursorBlockLvl,' Stack.Top=',Stack.Top,' BehindCursorBlock=',BehindCursorBlock]);
|
||||
DebugLn(['ReadStatements unexpected end at ',CleanPosToStr(CurPos.StartPos),': missing finally ',CleanPosToStr(Stack.Stack[Stack.Top].StartPos)]);
|
||||
if InCursorBlock then begin
|
||||
{$IFDEF ShowCompleteBlock}
|
||||
DebugLn(['ReadStatements NeedCompletion: unexpected end at ',CleanPosToStr(CurPos.StartPos),': missing semicolon or until ',CleanPosToStr(Stack.Stack[Stack.Top].StartPos)]);
|
||||
@ -5449,8 +5451,9 @@ var
|
||||
if TopBlockType(Stack)=btCaseOf then
|
||||
BeginBlock(Stack,btCaseColon,CurPos.StartPos);
|
||||
cafSemicolon:
|
||||
if TopBlockType(Stack) in [btCaseColon,btIf,btIfElse] then
|
||||
while TopBlockType(Stack) in [btCaseColon,btIf,btIfElse] do begin
|
||||
if not EndBlockIsOk then exit;
|
||||
end;
|
||||
cafBegin:
|
||||
BeginBlock(Stack,btBegin,CurPos.StartPos);
|
||||
cafWord:
|
||||
@ -5472,6 +5475,9 @@ var
|
||||
if not EndBlockIsOk then exit;
|
||||
end else begin
|
||||
// until without repeat
|
||||
DebugLn(['ReadStatements CursorBlockLvl=',CursorBlockLvl,' Stack.Top=',Stack.Top,' BehindCursorBlock=',BehindCursorBlock,' Block=',ord(TopBlockType(Stack))]);
|
||||
DebugLn(['ReadStatements unexpected until at ',CleanPosToStr(CurPos.StartPos)]);
|
||||
exit;
|
||||
end;
|
||||
end else if UpAtomIs('ASM') then begin
|
||||
BeginBlock(Stack,btAsm,CurPos.StartPos);
|
||||
|
Loading…
Reference in New Issue
Block a user