fixed real number recognition

git-svn-id: trunk@3861 -
This commit is contained in:
mattias 2003-02-20 11:27:10 +00:00
parent 44c90180a3
commit d6e0b40edc
4 changed files with 28 additions and 45 deletions

View File

@ -552,7 +552,7 @@ begin
if (i<=SrcLen) and (IsNumberChar[Src[i]]) then begin
while (i<=SrcLen) and (IsNumberChar[Src[i]]) do
inc(i);
if (i<=SrcLen) and (Src[i]='.') then
if (i<SrcLen) and (Src[i]='.') and (IsNumberChar[Src[i+1]]) then
Result:=true;
end;
end;

View File

@ -240,7 +240,7 @@ begin
// 2. search all compatible published procs
GetCompatibleMethodsProc:=Proc;
Params.ContextNode:=ClassNode;
Params.Flags:=[fdfCollect,fdfSearchInAncestors,fdfClassPublished];
Params.Flags:=[fdfCollect,fdfSearchInAncestors];
Params.SetIdentifier(Self,nil,@CollectPublishedMethods);
{$IFDEF CTDEBUG}
writeln('[TEventsCodeTool.GetCompatiblePublishedMethods] E Searching ...');
@ -277,9 +277,11 @@ begin
try
Params.ContextNode:=ClassNode;
Params.SetIdentifier(Self,@UpperMethodName[1],nil);
Params.Flags:=[fdfSearchInAncestors,fdfClassPublished];
Params.Flags:=[fdfSearchInAncestors];
if FindIdentifierInContext(Params)
and (Params.NewNode.Desc=ctnProcedure) then begin
and (Params.NewNode.Desc=ctnProcedure)
and (Params.NewNode.Parent<>nil)
and (Params.NewNode.Parent.Desc=ctnClassPublished) then begin
Result:=CreateFindContext(Params);
end;
finally
@ -409,7 +411,7 @@ begin
// first search a published method definition with same name
Params.ContextNode:=ClassNode;
Params.SetIdentifier(Self,@UpperMethodName[1],nil);
Params.Flags:=[fdfSearchInAncestors,fdfClassPublished];
Params.Flags:=[fdfSearchInAncestors];
if FindIdentifierInContext(Params) then begin
IdentIsmethod:=(Params.NewNode.Desc=ctnProcedure);
MethodIsPublished:=(Params.NewNode.Parent.Desc=ctnClassPublished);
@ -642,10 +644,9 @@ begin
Params.Save(OldInput);
Params.SetIdentifier(Self,@CurTypeIdentifier[1],nil);
Params.Flags:=[fdfSearchInParentNodes,
fdfIgnoreCurContextNode,fdfClassPublished]
fdfIgnoreCurContextNode]
+(fdfGlobals*Params.Flags)
-[fdfSearchInAncestors,
fdfClassPublic,fdfClassProtected,fdfClassPrivate];
-[fdfSearchInAncestors];
CurExprType:=GetExpressionTypeOfTypeIdentifier(Params);
{$IFDEF CTDEBUG}
writeln('[TEventsCodeTool.CreateExprListFromMethodTypeData] B ',
@ -672,7 +673,9 @@ var
ParamCompatibility: TTypeCompatibility;
FirstParameterNode: TCodeTreeNode;
begin
if (FoundContext.Node.Desc=ctnProcedure) then begin
if (FoundContext.Node.Desc=ctnProcedure)
and (FoundContext.Node.Parent<>nil)
and (FoundContext.Node.Parent.Desc=ctnClassPublished) then begin
{$IFDEF ShowAllProcs}
writeln('');
writeln('[TEventsCodeTool.CollectPublishedMethods] A ',

View File

@ -145,11 +145,7 @@ type
// is an predefined exception
fdfIgnoreClassVisibility,//find inaccessible private+protected fields
fdfClassPublished,
fdfClassPublic,
fdfClassProtected,
fdfClassPrivate,
fdfIgnoreMissingParams, // found proc fits, even if parameters are missing
fdfOnlyCompatibleProc, // incompatible procs are ignored
fdfIgnoreOverloadedProcs,// ignore param lists and take the first proc found
@ -175,10 +171,6 @@ const
'fdfExceptionOnNotFound',
'fdfExceptionOnPredefinedIdent',
'fdfIgnoreClassVisibility',
'fdfClassPublished',
'fdfClassPublic',
'fdfClassProtected',
'fdfClassPrivate',
'fdfIgnoreMissingParams',
'fdfOnlyCompatibleProc',
'fdfIgnoreOverloadedProcs',
@ -622,15 +614,12 @@ type
end;
const
fdfAllClassVisibilities = [fdfClassPublished,fdfClassPublic,fdfClassProtected,
fdfClassPrivate];
fdfGlobals = [fdfExceptionOnNotFound, fdfIgnoreUsedUnits, fdfTopLvlResolving];
fdfGlobalsSameIdent = fdfGlobals+[fdfExceptionOnPredefinedIdent,
fdfIgnoreMissingParams,
fdfOnlyCompatibleProc, fdfSearchInAncestors, fdfCollect]
+fdfAllClassVisibilities;
fdfOnlyCompatibleProc, fdfSearchInAncestors, fdfCollect];
fdfDefaultForExpressions = [fdfSearchInParentNodes, fdfSearchInAncestors,
fdfExceptionOnNotFound]+fdfAllClassVisibilities;
fdfExceptionOnNotFound];
function ExprTypeToString(const ExprType: TExpressionType): string;
function CreateFindContext(NewTool: TFindDeclarationTool;
@ -961,8 +950,7 @@ begin
Params.SetIdentifier(Self,@Src[CurPos.StartPos],@CheckSrcIdentifier);
Params.Flags:=[fdfSearchInParentNodes,fdfExceptionOnNotFound,
fdfExceptionOnPredefinedIdent,
fdfTopLvlResolving,fdfSearchInAncestors]
+fdfAllClassVisibilities;
fdfTopLvlResolving,fdfSearchInAncestors];
if not DirectSearch then begin
Result:=FindDeclarationOfIdentAtCursor(Params);
end else begin
@ -1467,8 +1455,7 @@ begin
Params.ContextNode:=ContextNode;
Params.SetIdentifier(Self,@Src[IdentAtom.StartPos],nil);
Params.Flags:=[fdfSearchInParentNodes,fdfSearchInAncestors,
fdfTopLvlResolving,fdfFindVariable,fdfIgnoreCurContextNode]
+fdfAllClassVisibilities;
fdfTopLvlResolving,fdfFindVariable,fdfIgnoreCurContextNode];
Result:=FindIdentifierInContext(Params);
end;
@ -1827,10 +1814,10 @@ var
// -> test if class visibility valid
case ContextNode.Desc of
ctnClassPublished:if (fdfClassPublished in Params.Flags) then break;
ctnClassPublic: if (fdfClassPublic in Params.Flags) then break;
ctnClassProtected:if (fdfClassProtected in Params.Flags) then break;
ctnClassPrivate: if (fdfClassPrivate in Params.Flags) then break;
ctnClassPublished: break;
ctnClassPublic: break;
ctnClassProtected: break;
ctnClassPrivate: break;
ctnWithVariable:
begin
// check if StartContextNode is covered by the ContextNode
@ -2508,7 +2495,7 @@ begin
// class context found
// 2. -> search identifier in class
Params.Load(OldInput);
Params.Flags:=[fdfSearchInAncestors]+fdfAllClassVisibilities
Params.Flags:=[fdfSearchInAncestors]
+(fdfGlobalsSameIdent*Params.Flags)
-[fdfExceptionOnNotFound];
Params.ContextNode:=ClassContext.Node;
@ -3744,7 +3731,6 @@ var
// build new param flags for sub identifiers
Params.Flags:=[fdfSearchInAncestors,fdfExceptionOnNotFound]
+fdfAllClassVisibilities
+(fdfGlobals*Params.Flags);
if ExprType.Context.Node=StartContext.Node then begin
// there is no special context -> also search in parent contexts
@ -3929,8 +3915,7 @@ var
// search default property in class
Params.Save(OldInput);
Params.Flags:=[fdfSearchInAncestors,fdfExceptionOnNotFound]
+fdfGlobals*Params.Flags
+fdfAllClassVisibilities*Params.Flags;
+fdfGlobals*Params.Flags;
// special identifier for default property
Params.SetIdentifier(ExprType.Context.Tool,@Src[CurAtom.StartPos],nil);
Params.ContextNode:=ExprType.Context.Node;
@ -4053,8 +4038,7 @@ var
// find class ancestor
Params.Flags:=[fdfSearchInParentNodes,fdfExceptionOnNotFound]
+fdfGlobals*Params.Flags
+fdfAllClassVisibilities*Params.Flags;
+fdfGlobals*Params.Flags;
ClassOfMethodContext.Tool.FindAncestorOfClass(ClassOfMethodContext.Node,
Params,true);
@ -5591,8 +5575,7 @@ begin
Result:='';
Params.ContextNode:=CursorNode;
Params.Flags:=[fdfSearchInParentNodes,fdfSearchInAncestors,
fdfTopLvlResolving,fdfFunctionResult]
+fdfAllClassVisibilities;
fdfTopLvlResolving,fdfFunctionResult];
ExprType:=FindExpressionResultType(Params,TermAtom.StartPos,TermAtom.EndPos);
{$IFDEF CTDEBUG}
writeln('TCodeCompletionCodeTool.FindTermTypeAsString ExprTypeToString=',
@ -5613,8 +5596,7 @@ begin
FindContext.Node:=FindContext.Node.Parent;
end else begin
Params.Flags:=[fdfSearchInParentNodes,fdfSearchInAncestors,
fdfTopLvlResolving,fdfFunctionResult]
+fdfAllClassVisibilities;
fdfTopLvlResolving,fdfFunctionResult];
FindContext:=ExprType.Context.Tool.FindBaseTypeOfNode(Params,
ExprType.Context.Node);
end;

View File

@ -691,8 +691,7 @@ begin
Params.ContextNode:=CursorNode;
Params.SetIdentifier(Self,nil,nil);
Params.Flags:=[fdfExceptionOnNotFound,
fdfSearchInParentNodes,fdfSearchInAncestors]
+fdfAllClassVisibilities;
fdfSearchInParentNodes,fdfSearchInAncestors];
ExprType:=FindExpressionTypeOfVariable(ContextExprStartPos,IdentStartPos,
Params);
if (ExprType.Desc=xtContext) then
@ -709,8 +708,7 @@ begin
Params.ContextNode:=GatherContext.Node;
Params.SetIdentifier(Self,nil,@CollectAllIdentifiers);
Params.Flags:=[fdfSearchInParentNodes,fdfSearchInAncestors,
fdfCollect,fdfFindVariable]
+fdfAllClassVisibilities;
fdfCollect,fdfFindVariable];
if Params.ContextNode.Desc in [ctnClass,ctnClassInterface] then
Exclude(Params.Flags,fdfSearchInParentNodes);
{$IFDEF CTDEBUG}