mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-30 05:43:27 +02:00
codetools: CheckParameterSyntax: fixed ([])
git-svn-id: trunk@41819 -
This commit is contained in:
parent
20a0868daa
commit
ad78656157
@ -9216,6 +9216,8 @@ function TFindDeclarationTool.CheckParameterSyntax(StartPos,
|
||||
function CheckIdentifierAndParameterList: boolean; forward;
|
||||
|
||||
function CheckBrackets: boolean;
|
||||
{ check simple brackets (no identifier in front of brackets)
|
||||
}
|
||||
var
|
||||
BracketAtom: TAtomPosition;
|
||||
begin
|
||||
@ -9250,6 +9252,8 @@ function TFindDeclarationTool.CheckParameterSyntax(StartPos,
|
||||
end;
|
||||
|
||||
function CheckIdentifierAndParameterList: boolean;
|
||||
{ when called: CursorPos is at an identifier followed by a ( or [
|
||||
}
|
||||
var
|
||||
BracketAtom: TAtomPosition;
|
||||
CurProcNameAtom: TAtomPosition;
|
||||
@ -9257,11 +9261,12 @@ function TFindDeclarationTool.CheckParameterSyntax(StartPos,
|
||||
ParameterStart: integer;
|
||||
begin
|
||||
Result:=false;
|
||||
if CurPos.Flag<>cafWord then exit;
|
||||
CurProcNameAtom:=CurPos;
|
||||
CurParameterIndex:=0;
|
||||
{$IFDEF VerboseCPS}DebugLn('CheckIdentifierAndParameterList START "',GetAtom,'" ',dbgs(CurProcNameAtom));{$ENDIF}
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen] then begin
|
||||
if not (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]) then exit;
|
||||
BracketAtom:=CurPos;
|
||||
ParameterStart:=CurPos.EndPos;
|
||||
{$IFDEF VerboseCPS}DebugLn('CheckIdentifierAndParameterList Bracket="',GetAtom,'"');{$ENDIF}
|
||||
@ -9343,11 +9348,11 @@ function TFindDeclarationTool.CheckParameterSyntax(StartPos,
|
||||
{$IFDEF VerboseCPS}DebugLn('CheckIdentifierAndParameterList After parsing atom. atom="',GetAtom,'"');{$ENDIF}
|
||||
until (CurPos.EndPos>CleanCursorPos);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
CommentStart: integer;
|
||||
CommentEnd: integer;
|
||||
CleanPosInFront: Integer;
|
||||
begin
|
||||
Result:=false;
|
||||
ParameterAtom:=CleanAtomPosition;
|
||||
@ -9360,10 +9365,14 @@ begin
|
||||
MoveCursorToCleanPos(StartPos);
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
{$IFDEF VerboseCPS}DebugLn('TFindDeclarationTool.CheckParameterSyntax ',GetAtom,' at ',CleanPosToStr(CurPos.StartPos),' ',dbgs(CurPos.EndPos),'<',dbgs(CleanCursorPos));{$ENDIF}
|
||||
{$IFDEF VerboseCPS}
|
||||
DebugLn('TFindDeclarationTool.CheckParameterSyntax ',GetAtom,' at ',CleanPosToStr(CurPos.StartPos),' ',dbgs(CurPos.EndPos),'<',dbgs(CleanCursorPos));
|
||||
{$ENDIF}
|
||||
if CurPos.EndPos>CleanCursorPos then begin
|
||||
if LastAtoms.Count=0 then exit;
|
||||
if not CleanPosIsInComment(CleanCursorPos,LastAtoms.GetValueAt(0).EndPos,
|
||||
CleanPosInFront:=LastAtoms.GetValueAt(0).EndPos;
|
||||
//debugln(['TFindDeclarationTool.CheckParameterSyntax Cur="',GetAtom,'" Last="',GetAtom(LastAtoms.GetValueAt(0)),'"']);
|
||||
if not CleanPosIsInComment(CleanCursorPos,CleanPosInFront,
|
||||
CommentStart,CommentEnd,false) then exit;
|
||||
// cursor in a comment
|
||||
// => parse within the comment
|
||||
@ -9372,10 +9381,9 @@ begin
|
||||
and (LastAtoms.GetValueAt(0).Flag=cafWord) then begin
|
||||
UndoReadNextAtom;
|
||||
if CheckIdentifierAndParameterList then exit(true);
|
||||
if CurPos.EndPos>CleanCursorPos then exit;
|
||||
end;
|
||||
until false;
|
||||
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TFindDeclarationTool.FindNthParameterNode(Node: TCodeTreeNode;
|
||||
|
Loading…
Reference in New Issue
Block a user