fixed guess unclosed block for identifier = class ();

git-svn-id: trunk@8005 -
This commit is contained in:
mattias 2005-10-30 16:07:54 +00:00
parent 88a48665d5
commit c3ae0b99dc
4 changed files with 41 additions and 8 deletions

View File

@ -815,7 +815,11 @@ begin
while true do begin
case Src[CurPos.StartPos] of
#0: if CurPos.StartPos>SrcLen then break;
'{': if Scanner.NestedComments then inc(CommentLvl);
'{': if Scanner.NestedComments then
begin
//debugln('TCustomCodeTool.ReadNextAtom ',copy(Src,CurPos.StartPos,CurPos.StartPos-CurPos.EndPos));
inc(CommentLvl);
end;
'}':
begin
dec(CommentLvl);

View File

@ -511,7 +511,7 @@ begin
if UpAtomIs('USES') then
ReadUsesSection(true);
repeat
//DebugLn('[TPascalParserTool.BuildTree] ALL '+GetAtom);
//DebugLn('[TPascalParserTool.BuildTree] ALL ',GetAtom);
if not DoAtom then break;
if CurSection=ctnNone then begin
EndOfSourceFound:=true;

View File

@ -4214,17 +4214,42 @@ begin
bkwClass, bkwObject, bkwInterface, bkwDispInterface:
begin
ReadNextAtom;
if AtomIsChar(';')
or ((CurBlockWord=bkwClass) and UpAtomIs('OF'))
if AtomIsChar(';') // forward class
or ((CurBlockWord=bkwClass) and UpAtomIs('OF')) // 'class of'
or ((CurBlockWord=bkwClass)
and (UpAtomIs('FUNCTION') or UpAtomIs('PROCEDURE')))
and (UpAtomIs('FUNCTION') or UpAtomIs('PROCEDURE'))) // 'class procedure'
or ((CurBlockWord=bkwObject) and LastUpAtomIs(0,'OF')) then
begin
// forward class or 'class of' or class method or 'of object'
end else begin
UndoReadNextAtom;
BlockType:=CurBlockWord;
BlockStart:=CurPos.StartPos;
// read ancestor list class(...)
if CurPos.Flag=cafRoundBracketOpen then begin
repeat
ReadNextAtom;
if AtomIsIdentifier(false) then begin
ReadNextAtom;
if CurPos.Flag=cafPoint then begin
ReadNextAtom;
AtomIsIdentifier(true);
end;
end;
if CurPos.Flag=cafRoundBracketClose then break;
if CurPos.Flag<>cafComma then begin
exit(false);
end;
until false;
end;
ReadNextAtom;
// a semicolon directly behind the ancestor list ends the class
if (CurPos.Flag in [cafEnd,cafSemicolon]) then begin
// class ends
BlockType:=bkwNone;
end else begin
// class continues
UndoReadNextAtom;
end;
end;
end;

View File

@ -10541,8 +10541,12 @@ begin
begin
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
NewSource, NewX, NewY, NewTopLine, true);
end else
DoJumpToCodeToolBossError;
end else begin
if CodeToolBoss.ErrorMessage='' then begin
MessageDlg('Success','All blocks looks ok.',mtInformation,[mbOk],0);
end else
DoJumpToCodeToolBossError;
end;
end;
procedure TMainIDE.DoJumpToGuessedMisplacedIFDEF(FindNext: boolean);