From a2a80bb473be611c8bb3e8f9d296ed510fb74ba8 Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 27 Mar 2003 19:16:39 +0000 Subject: [PATCH] added ipdefine.inc git-svn-id: trunk@3976 - --- components/codetools/definetemplates.pas | 8 +++++++ components/codetools/finddeclarationtool.pas | 3 ++- components/codetools/identcompletiontool.pas | 2 +- components/codetools/methodjumptool.pas | 2 +- components/codetools/pascalparsertool.pas | 22 ++++++++++++++------ components/codetools/stdcodetools.pas | 16 +++++++------- 6 files changed, 36 insertions(+), 17 deletions(-) diff --git a/components/codetools/definetemplates.pas b/components/codetools/definetemplates.pas index 1efb1a4847..4b6e477d0f 100644 --- a/components/codetools/definetemplates.pas +++ b/components/codetools/definetemplates.pas @@ -2751,6 +2751,14 @@ begin 'Define HL_LAZARUS','HL_LAZARUS','',da_DefineRecurse)); DirTempl.AddChild(SubDirTempl); + // components/turbopower_ipro + SubDirTempl:=TDefineTemplate.Create('TurboPower InternetPro', + 'TurboPower InternetPro components', + '','turbopower_ipro',da_Directory); + SubDirTempl.AddChild(TDefineTemplate.Create('IP_LAZARUS', + 'Define IP_LAZARUS','IP_LAZARUS','',da_DefineRecurse)); + DirTempl.AddChild(SubDirTempl); + // components/custom SubDirTempl:=TDefineTemplate.Create('Custom Components', ctsCustomComponentsDirectory, diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 4d46f57d25..2590413005 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -904,7 +904,8 @@ begin writeln(DebugPrefix,'TFindDeclarationTool.FindDeclaration A CursorPos=',CursorPos.X,',',CursorPos.Y); {$ENDIF} BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos, - [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}]); + [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}], + false); {$IFDEF CTDEBUG} writeln(DebugPrefix,'TFindDeclarationTool.FindDeclaration C CleanCursorPos=',CleanCursorPos); {$ENDIF} diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 471cccba6d..cea54d9bb6 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -715,7 +715,7 @@ begin writeln('TIdentCompletionTool.GatherIdentifiers A CursorPos=',CursorPos.X,',',CursorPos.Y); {$ENDIF} BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos, - [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}]); + [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}],true); // find node at position CursorNode:=FindDeepestExpandedNodeAtPos(CleanCursorPos,true); diff --git a/components/codetools/methodjumptool.pas b/components/codetools/methodjumptool.pas index e1a983735a..cb7aea18a0 100644 --- a/components/codetools/methodjumptool.pas +++ b/components/codetools/methodjumptool.pas @@ -323,7 +323,7 @@ begin {$IFDEF CTDEBUG} writeln('TMethodJumpingCodeTool.FindJumpPoint A CursorPos=',CursorPos.X,',',CursorPos.Y); {$ENDIF} - BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); + BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true); GetLineInfo(CleanCursorPos,LineStart,LineEnd,FirstAtomStart,LastAtomEnd); if CleanCursorPos=LastAtomEnd then CleanCursorPos:=LastAtomEnd-1; diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index 39fa79229b..8fc5d26b71 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -99,7 +99,10 @@ type TTreeRange = (trInterface, trAll, trTillCursor); - TBuildTreeFlag = (btSetIgnoreErrorPos,btKeepIgnoreErrorPos); + TBuildTreeFlag = ( + btSetIgnoreErrorPos, + btKeepIgnoreErrorPos + ); TBuildTreeFlags = set of TBuildTreeFlag; TPascalParserTool = class(TMultiKeyWordListCodeTool) @@ -203,7 +206,7 @@ type procedure BuildTree(OnlyInterfaceNeeded: boolean); virtual; procedure BuildTreeAndGetCleanPos(TreeRange: TTreeRange; const CursorPos: TCodeXYPosition; var CleanCursorPos: integer; - BuildTreeFlags: TBuildTreeFlags); + BuildTreeFlags: TBuildTreeFlags; ExceptionOnCursorPosOut: boolean); procedure BuildSubTreeForClass(ClassNode: TCodeTreeNode); virtual; procedure BuildSubTreeForBeginBlock(BeginNode: TCodeTreeNode); virtual; procedure BuildSubTreeForProcHead(ProcNode: TCodeTreeNode); virtual; @@ -3938,7 +3941,8 @@ end; procedure TPascalParserTool.BuildTreeAndGetCleanPos( TreeRange: TTreeRange; const CursorPos: TCodeXYPosition; - var CleanCursorPos: integer; BuildTreeFlags: TBuildTreeFlags); + var CleanCursorPos: integer; BuildTreeFlags: TBuildTreeFlags; + ExceptionOnCursorPosOut: boolean); var Dummy: integer; IgnorePos: TCodePosition; @@ -3954,7 +3958,6 @@ begin end else if (btKeepIgnoreErrorPos in BuildTreeFlags) then ClearIgnoreErrorAfter; - if (TreeRange=trTillCursor) and (not UpdateNeeded(true)) then begin // interface tree is valid // -> if there was an error, raise it again @@ -3969,7 +3972,10 @@ begin BuildSubTree(CleanCursorPos); exit; end; + // cursor is not in partially parsed code -> parse complete code end; + + // parse code BuildTree(TreeRange=trInterface); if (not IgnoreErrorAfterValid) and (not EndOfSourceFound) then SaveRaiseException(ctsEndOfSourceNotFound); @@ -3979,7 +3985,10 @@ begin BuildSubTree(CleanCursorPos); exit; end; - RaiseException(ctsCursorPosOutsideOfCode); + if (Dummy=-2) or ExceptionOnCursorPosOut then + RaiseException(ctsCursorPosOutsideOfCode); + // cursor outside of clean code + CleanCursorPos:=-1; end; function TPascalParserTool.FindTypeNodeOfDefinition( @@ -4437,7 +4446,8 @@ procedure TPascalParserTool.BuildSubTree(CleanCursorPos: integer); var ANode: TCodeTreeNode; begin - ANode:=FindDeepestNodeAtPos(CleanCursorPos,true); + ANode:=FindDeepestNodeAtPos(CleanCursorPos,false); + if ANode=nil then exit; case ANode.Desc of ctnClass,ctnClassInterface: BuildSubTreeForClass(ANode); diff --git a/components/codetools/stdcodetools.pas b/components/codetools/stdcodetools.pas index f9b302d7e5..1a5facccf2 100644 --- a/components/codetools/stdcodetools.pas +++ b/components/codetools/stdcodetools.pas @@ -1264,7 +1264,7 @@ begin StartPos:=CursorPos; EndPos:=CursorPos; Result:=true; - BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); + BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true); //writeln('TStandardCodeTool.GetStringConstBounds A ',CleanCursorPos,' "',copy(Src,CleanCursorPos-5,5),'" | "',copy(Src,CleanCursorPos,5),'"'); GetCleanPosInfo(-1,CleanCursorPos,ResolveComments,SameArea); //writeln('TStandardCodeTool.GetStringConstBounds B ',SameArea.StartPos,'-',SameArea.EndPos,' "',copy(Src,SameArea.StartPos,SameArea.EndPos-SameArea.StartPos),'"'); @@ -1430,7 +1430,7 @@ var begin Result:=false; //writeln('TStandardCodeTool.GatherResourceStringSections A '); - BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); + BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true); CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true); PositionList.Clear; ANode:=CursorNode; @@ -1470,7 +1470,7 @@ begin Result:=false; if ResStrIdentifier='' then exit; // parse source and find clean positions - BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); + BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true); // find resource string section ANode:=FindDeepestNodeAtPos(CleanCursorPos,true); if (ANode=nil) then exit; @@ -1499,7 +1499,7 @@ begin Result:=false; if MaxLen<=0 then exit; // parse source and find clean positions - BuildTreeAndGetCleanPos(trAll,StartCursorPos,StartPos,[]); + BuildTreeAndGetCleanPos(trAll,StartCursorPos,StartPos,[],true); Dummy:=CaretToCleanPos(EndCursorPos, EndPos); if (Dummy<>0) and (Dummy<>-1) then exit; // read string constants and extract identifier characters @@ -1635,7 +1635,7 @@ var begin Result:=false; // parse source and find clean positions - BuildTreeAndGetCleanPos(trAll,StartCursorPos,StartPos,[]); + BuildTreeAndGetCleanPos(trAll,StartCursorPos,StartPos,[],true); Dummy:=CaretToCleanPos(EndCursorPos, EndPos); if (Dummy<>0) and (Dummy<>-1) then exit; // read string constants and convert it @@ -1693,7 +1693,7 @@ begin Result:=false; if PositionList=nil then exit; // parse source and find clean positions - BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); + BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true); // find resource string section ANode:=FindDeepestNodeAtPos(CleanCursorPos,true); if (ANode=nil) then exit; @@ -1725,7 +1725,7 @@ begin if SourceChangeCache=nil then exit; SourceChangeCache.MainScanner:=Scanner; // parse source and find clean positions - BuildTreeAndGetCleanPos(trAll,SectionPos,CleanSectionPos,[]); + BuildTreeAndGetCleanPos(trAll,SectionPos,CleanSectionPos,[],true); // find resource string section SectionNode:=FindDeepestNodeAtPos(CleanSectionPos,true); if (SectionNode=nil) then exit; @@ -2096,7 +2096,7 @@ begin Result:=false; try BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos, - [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}]); + [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}],true); LinkIndex:=Scanner.LinkIndexAtCleanPos(CleanCursorPos); LinkIndex:=Scanner.FindParentLink(LinkIndex); if LinkIndex<0 then