codetools: parsing objccategory

git-svn-id: trunk@22611 -
This commit is contained in:
mattias 2009-11-16 00:39:35 +00:00
parent bc85444eab
commit b64abcbd7a
10 changed files with 43 additions and 26 deletions

View File

@ -4102,7 +4102,7 @@ function TCodeCompletionCodeTool.BuildUnitDefinitionGraph(out
end;
ctnRecordType, ctnClassInterface, ctnClass, ctnObject,
ctnObjCClass, ctnObjCProtocol, ctnCPPClass:
ctnObjCClass, ctnObjCCategory, ctnObjCProtocol, ctnCPPClass:
begin
ChildNode:=SubNode.FirstChild;
while (ChildNode<>nil) and (ChildNode.HasAsParent(SubNode)) do begin

View File

@ -84,8 +84,9 @@ const
ctnClassInterface = 31;
ctnObject = 32;
ctnObjCClass = 33;
ctnObjCProtocol = 34;
ctnCPPClass = 35;
ctnObjCCategory = 34;
ctnObjCProtocol = 35;
ctnCPPClass = 36;
ctnClassAbstract = 40;
ctnClassSealed = 41;
@ -164,10 +165,11 @@ const
AllClassSections =
AllClassBaseSections+AllClassTypeSections+AllClassVarSections;
AllClasses =
[ctnClass,ctnClassInterface,ctnObject,ctnObjCClass,ctnObjCProtocol,
[ctnClass,ctnClassInterface,ctnObject,
ctnObjCClass,ctnObjCCategory,ctnObjCProtocol,
ctnCPPClass];
AllClassInterfaces = [ctnClassInterface,ctnObjCProtocol];
AllClassObjects = [ctnClass,ctnObject,ctnObjCClass,ctnCPPClass];
AllClassObjects = [ctnClass,ctnObject,ctnObjCClass,ctnObjCCategory,ctnCPPClass];
AllClassModifiers = [ctnClassAbstract, ctnClassSealed];
AllDefinitionSections =
[ctnTypeSection,ctnVarSection,ctnConstSection,ctnResStrSection,
@ -367,6 +369,7 @@ begin
ctnClassInterface: Result:='Class Interface';
ctnObject: Result:='Object';
ctnObjCClass: Result:='ObjCClass';
ctnObjCCategory: Result:='ObjCCategory';
ctnObjCProtocol: Result:='ObjCProtocol';
ctnCPPClass: Result:='CPPClass';

View File

@ -539,7 +539,8 @@ begin
begin
if (SubDesc and ctnsNeedJITParsing)>0 then Result:=ctsUnparsed;
end;
ctnClass,ctnObject,ctnObjCClass,ctnClassInterface,ctnObjCProtocol,ctnCPPClass:
ctnClass,ctnObject,ctnObjCClass,ctnObjCCategory,ctnObjCProtocol,
ctnCPPClass,ctnClassInterface:
begin
Result:='';
if (SubDesc and ctnsForwardDeclaration)>0 then Result:=ctsForward;

View File

@ -2107,7 +2107,7 @@ begin
if TypeNode<>nil then begin
case TypeNode.Desc of
ctnIdentifier, ctnClass, ctnClassInterface, ctnObject,
ctnObjCClass, ctnObjCProtocol, ctnCPPClass:
ctnObjCClass, ctnObjCCategory, ctnObjCProtocol, ctnCPPClass:
begin
NewTool.MoveCursorToNodeStart(TypeNode);
NewTool.ReadNextAtom;
@ -2866,7 +2866,7 @@ var
;
ctnClass, ctnClassInterface, ctnObject,
ctnObjCClass, ctnObjCProtocol, ctnCPPClass,
ctnObjCClass, ctnObjCCategory, ctnObjCProtocol, ctnCPPClass,
ctnRecordType, ctnRecordCase:
// do not search again in this node, go on ...
;
@ -2976,7 +2976,7 @@ begin
ctnClassTypePublished,ctnClassTypePublic,ctnClassTypeProtected,ctnClassTypePrivate,
ctnClassVarPublished,ctnClassVarPublic,ctnClassVarProtected,ctnClassVarPrivate,
ctnClass, ctnClassInterface, ctnObject,
ctnObjCClass, ctnObjCProtocol, ctnCPPClass,
ctnObjCClass, ctnObjCCategory, ctnObjCProtocol, ctnCPPClass,
ctnRecordType, ctnRecordVariant,
ctnParameterList:
// these nodes build a parent-child relationship. But in pascal
@ -4350,7 +4350,7 @@ begin
Result:=InNodeIdentifier(CurPos.StartPos);
end;
ctnBeginBlock,ctnClass,ctnObject,ctnObjCClass,ctnCPPClass:
ctnBeginBlock,ctnClass,ctnObject,ctnObjCClass,ctnObjCCategory,ctnCPPClass:
if (Node.SubDesc and ctnsForwardDeclaration)>0 then
RaiseException('TFindDeclarationTool.CleanPosIsDeclarationIdentifier Node not expanded');
@ -6497,7 +6497,7 @@ var
ExprType.Context.Node.FirstChild);
ctnClass, ctnClassInterface, ctnObject,
ctnObjCClass, ctnObjCProtocol, ctnCPPClass,
ctnObjCClass, ctnObjCCategory, ctnObjCProtocol, ctnCPPClass,
ctnProperty, ctnGlobalProperty:
begin
if ExprType.Context.Node.Desc in AllClasses then begin
@ -7991,7 +7991,7 @@ begin
case ExprNode.Desc of
ctnClass,ctnClassInterface, ctnObject,
ctnObjCClass, ctnObjCProtocol, ctnCPPClass:
ctnObjCClass, ctnObjCCategory, ctnObjCProtocol, ctnCPPClass:
// check, if ExpressionType.Context is descend of TargetContext
if ContextIsDescendOf(ExpressionType.Context,
TargetType.Context,Params)
@ -9525,7 +9525,7 @@ begin
end;
ctnClass, ctnClassInterface, ctnObject,
ctnObjCClass, ctnObjCProtocol, ctnCPPClass:
ctnObjCClass, ctnObjCCategory, ctnObjCProtocol, ctnCPPClass:
if (FindContext.Node.Parent<>nil)
and (FindContext.Node.Parent.Desc in [ctnTypeDefinition,ctnGenericType])
then

View File

@ -1260,7 +1260,7 @@ begin
CurrentIdentifierList.Add(NewItem);
end;
if (UpAtomIs('READ') or UpAtomIs('WRITE'))
and (Context.Node.GetNodeOfTypes([ctnClass,ctnObject,ctnObjCClass,ctnCPPClass])<>nil)
and (Context.Tool.FindClassOrInterfaceNode(Context.Node)<>nil)
then begin
// add the default class completion 'read'/'write' specifier variable
NewItem:=TIdentifierListItem.Create(
@ -1421,7 +1421,7 @@ var
begin
Node:=Context.Node;
case Node.Desc of
ctnClass,ctnObject,ctnObjCClass,
ctnClass,ctnObject,ctnObjCCategory,ctnObjCClass,
ctnClassPrivate,ctnClassProtected,ctnClassPublic,ctnClassPublished:
begin
Add('public');

View File

@ -351,7 +351,8 @@ begin
DebugLn('TMethodJumpingCodeTool.FindJumpPoint C ',NodeDescriptionAsString(CursorNode.Desc));
{$ENDIF}
// first test if in a class
ClassNode:=CursorNode.GetNodeOfTypes([ctnClass,ctnObject,ctnObjCClass,ctnCPPClass]);
ClassNode:=CursorNode.GetNodeOfTypes([ctnClass,ctnObject,
ctnObjCClass,ctnObjCCategory,ctnCPPClass]);
if ClassNode<>nil then begin
// cursor is in class/object definition
// search in all implemented class procedures for the body
@ -796,7 +797,8 @@ begin
cmp:=false;
end;
if cmp and (phpIgnoreMethods in Attr) then begin
if (ANode.GetNodeOfTypes([ctnClass,ctnObject,ctnObjCClass,ctnCPPClass])<>nil)
if (ANode.GetNodeOfTypes([ctnClass,ctnObject,
ctnObjCClass,ctnObjCCategory,ctnCPPClass])<>nil)
or (ExtractClassNameOfProcNode(ANode)<>'')
then
cmp:=false;

View File

@ -389,7 +389,8 @@ begin
if CompareSrcIdentifiers('LABEL',p) then exit(KeyWordFuncTypeLabel);
'O':
if CompareSrcIdentifiers('OBJECT',p)
or CompareSrcIdentifiers('OBJCCLASS',p) then exit(KeyWordFuncClass);
or CompareSrcIdentifiers('OBJCCLASS',p)
or CompareSrcIdentifiers('OBJCCATEGORY',p) then exit(KeyWordFuncClass);
'P':
case UpChars[p[1]] of
'A': if CompareSrcIdentifiers('PACKED',p) then exit(KeyWordFuncTypePacked);
@ -701,7 +702,8 @@ begin
ReadNextAtom;
if UpAtomIs('PACKED') or (UpAtomIs('BITPACKED')) then ReadNextAtom;
if not (UpAtomIs('CLASS') or UpAtomIs('OBJECT') or UpAtomIs('OBJCCLASS')
or UpAtomIs('CPPCLASS') or UpAtomIs('INTERFACE'))
or UpAtomIs('OBJCCATEGORY') or UpAtomIs('CPPCLASS')
or UpAtomIs('INTERFACE') or UpAtomIs('OBJCPROTOCOL'))
then
RaiseClassKeyWordExpected;
ReadNextAtom;
@ -3399,6 +3401,8 @@ begin
ClassDesc:=ctnObject
else if UpAtomIs('OBJCCLASS') then
ClassDesc:=ctnObjCClass
else if UpAtomIs('OBJCCATEGORY') then
ClassDesc:=ctnObjCCategory
else if UpAtomIs('CPPCLASS') then
ClassDesc:=ctnCPPClass
else
@ -4572,7 +4576,8 @@ procedure TPascalParserTool.BuildSubTree(ANode: TCodeTreeNode);
begin
if ANode=nil then exit;
case ANode.Desc of
ctnClass,ctnClassInterface,ctnObject,ctnObjCClass,ctnObjCProtocol,ctnCPPClass:
ctnClass,ctnClassInterface,ctnObject,
ctnObjCClass,ctnObjCCategory,ctnObjCProtocol,ctnCPPClass:
BuildSubTreeForClass(ANode);
ctnProcedure,ctnProcedureHead:
BuildSubTreeForProcHead(ANode);

View File

@ -6587,7 +6587,8 @@ begin
Node:=Tree.Root;
while Node<>nil do begin
case Node.Desc of
ctnClass,ctnClassInterface,ctnObject,ctnObjCClass,ctnObjCProtocol,ctnCPPClass:
ctnClass,ctnClassInterface,ctnObject,
ctnObjCClass,ctnObjCCategory,ctnObjCProtocol,ctnCPPClass:
BuildSubTreeForClass(Node);
ctnProcedure,ctnProcedureHead:
BuildSubTreeForProcHead(Node);

View File

@ -1901,7 +1901,8 @@ var
Description:='type '+Identifier;
if CTNode.FirstChild<>nil then begin
case CTNode.FirstChild.Desc of
ctnClass,ctnClassInterface,ctnObject,ctnObjCClass,ctnObjCProtocol,
ctnClass,ctnClassInterface,ctnObject,
ctnObjCClass,ctnObjCCategory,ctnObjCProtocol,
ctnCPPClass:
begin
case CTNode.FirstChild.Desc of
@ -1911,6 +1912,8 @@ var
Description:=Description+' = object';
ctnObjCClass:
Description:=Description+' = objcclass';
ctnObjCCategory:
Description:=Description+' = objccategory';
ctnObjCProtocol:
Description:=Description+' = objcprotocol';
ctnCPPClass:
@ -2403,7 +2406,7 @@ begin
Result:=ImgIDProgramCode;
ctnUnit:
Result:=ImgIDUnitCode;
ctnInterface,ctnObjCProtocol:
ctnInterface:
Result:=ImgIDInterfaceSection;
ctnImplementation:
Result:=ImgIDImplementation;
@ -2423,7 +2426,7 @@ begin
Result:=ImgIDConstSection;
ctnConstDefinition:
Result:=ImgIDConst;
ctnClass,ctnObject,ctnObjCClass,ctnCPPClass:
ctnClass,ctnObject,ctnObjCClass,ctnObjCCategory,ctnObjCProtocol,ctnCPPClass:
Result:=ImgIDClass;
ctnProcedure:
Result:=ImgIDProc;

View File

@ -529,7 +529,8 @@ begin
ctnTypeDefinition,ctnVarDefinition,ctnConstDefinition,ctnUseUnit:
Result:=ACodeTool.ExtractIdentifier(CodeNode.StartPos);
ctnClass,ctnObject,ctnObjCClass,ctnObjCProtocol,ctnInterface,ctnCPPClass:
ctnClass,ctnObject,ctnObjCClass,ctnObjCCategory,ctnObjCProtocol,
ctnInterface,ctnCPPClass:
Result:='('+ACodeTool.ExtractClassInheritance(CodeNode,[])+')';
ctnEnumIdentifier:
@ -604,7 +605,8 @@ begin
ctnVarDefinition: Result:=ImgIDVariable;
ctnConstSection,ctnResStrSection: Result:=ImgIDSection;
ctnConstDefinition: Result:=ImgIDConst;
ctnClass,ctnClassInterface,ctnObject,ctnObjCClass,ctnObjCProtocol,ctnCPPClass:
ctnClass,ctnClassInterface,ctnObject,
ctnObjCClass,ctnObjCProtocol,ctnObjCCategory,ctnCPPClass:
Result:=ImgIDClass;
ctnProcedure: if Tool.NodeIsFunction(CodeNode) then
Result:=ImgIDFunction