mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 18:49:30 +02:00
codetools: parsing objcclass external name
git-svn-id: trunk@29293 -
This commit is contained in:
parent
29a1093583
commit
a7c6e1a13f
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -472,6 +472,7 @@ components/codetools/examples/scanexamples/methodjump1.pas svneol=native#text/pl
|
||||
components/codetools/examples/scanexamples/missingh2pasdirectives.pas svneol=native#text/plain
|
||||
components/codetools/examples/scanexamples/modemacpas.pas svneol=native#text/plain
|
||||
components/codetools/examples/scanexamples/nestedclasses.pas svneol=native#text/plain
|
||||
components/codetools/examples/scanexamples/objctest1.pas svneol=native#text/plain
|
||||
components/codetools/examples/scanexamples/overloadedfunction.pas svneol=native#text/plain
|
||||
components/codetools/examples/scanexamples/publishedvars.pas svneol=native#text/plain
|
||||
components/codetools/examples/scanexamples/resourcetest1.pas svneol=native#text/plain
|
||||
|
@ -93,18 +93,19 @@ const
|
||||
|
||||
ctnClassAbstract = 40;
|
||||
ctnClassSealed = 41;
|
||||
ctnClassInheritance = 42;
|
||||
ctnClassGUID = 43;
|
||||
ctnClassConst = 44;
|
||||
ctnClassType = 45;
|
||||
ctnClassVar = 46;
|
||||
ctnClassClassVar = 47;
|
||||
ctnClassPrivate = 48;
|
||||
ctnClassProtected = 49;
|
||||
ctnClassPublic = 50;
|
||||
ctnClassPublished = 51;
|
||||
ctnProperty = 52;
|
||||
ctnMethodMap = 53;
|
||||
ctnClassExternal = 42;
|
||||
ctnClassInheritance = 43;
|
||||
ctnClassGUID = 44;
|
||||
ctnClassConst = 45;
|
||||
ctnClassType = 46;
|
||||
ctnClassVar = 47;
|
||||
ctnClassClassVar = 48;
|
||||
ctnClassPrivate = 49;
|
||||
ctnClassProtected = 50;
|
||||
ctnClassPublic = 51;
|
||||
ctnClassPublished = 52;
|
||||
ctnProperty = 53;
|
||||
ctnMethodMap = 54;
|
||||
|
||||
ctnProcedure = 60; // childs: ctnProcedureHead, sections, ctnBeginBlock/ctnAsmBlock
|
||||
ctnProcedureHead = 61; // childs: ctnParameterList, operator: ctnVarDefinition, operator/function: ctnResultType
|
||||
@ -163,7 +164,7 @@ const
|
||||
ctnCPPClass];
|
||||
AllClassInterfaces = [ctnClassInterface,ctnDispinterface,ctnObjCProtocol];
|
||||
AllClassObjects = [ctnClass,ctnObject,ctnObjCClass,ctnObjCCategory,ctnCPPClass];
|
||||
AllClassModifiers = [ctnClassAbstract, ctnClassSealed];
|
||||
AllClassModifiers = [ctnClassAbstract, ctnClassSealed, ctnClassExternal];
|
||||
AllDefinitionSections =
|
||||
[ctnTypeSection,ctnVarSection,ctnConstSection,ctnResStrSection,
|
||||
ctnLabelSection];
|
||||
@ -382,6 +383,7 @@ begin
|
||||
ctnClassClassVar: Result:='Class Var';
|
||||
ctnClassAbstract: Result:='abstract';
|
||||
ctnClassSealed: Result:='sealed';
|
||||
ctnClassExternal: Result:='external';
|
||||
|
||||
ctnProcedure: Result:='Procedure';
|
||||
ctnProcedureHead: Result:='ProcedureHead';
|
||||
|
41
components/codetools/examples/scanexamples/objctest1.pas
Normal file
41
components/codetools/examples/scanexamples/objctest1.pas
Normal file
@ -0,0 +1,41 @@
|
||||
unit objctest1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$modeswitch objectivec2}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
NSSomeObject = objcclass(NSObject)
|
||||
procedure method_(params: Integer); message 'method:';
|
||||
class procedure classmethod_(para: char); override; // "message 'classmethod:'" not required, compiler will get this from the parent class
|
||||
end;
|
||||
|
||||
type
|
||||
ObjCClassName1 = objcclass
|
||||
private
|
||||
end;
|
||||
|
||||
ObjCClassName2 = objcclass external name 'ExternalClassName' (ObjCSuperClassName, ProtocolName)
|
||||
private
|
||||
end;
|
||||
|
||||
ObjCClassName3 = objcclass external (ObjCSuperClassName)
|
||||
private
|
||||
end;
|
||||
|
||||
ObjCClassName4 = objcclass external
|
||||
private
|
||||
end;
|
||||
|
||||
ObjCClassName5 = objcclass (ObjCSuperClassName)
|
||||
private
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
@ -744,7 +744,7 @@ begin
|
||||
// set CursorPos after class head
|
||||
MoveCursorToNodeStart(ClassNode);
|
||||
// parse
|
||||
// - sealed, abstract
|
||||
// - sealed, abstract, external
|
||||
// - inheritage
|
||||
// - class sections (GUID, type, var, public, published, private, protected)
|
||||
// - methods (procedures, functions, constructors, destructors)
|
||||
@ -776,6 +776,18 @@ begin
|
||||
EndChildNode;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end
|
||||
else if UpAtomIs('EXTERNAL') and (ClassNode.Desc in [ctnObjCClass]) then
|
||||
begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnClassExternal;
|
||||
ReadNextAtom;
|
||||
if UpAtomIs('NAME') then begin
|
||||
ReadNextAtom;
|
||||
ReadConstant(true,false,[]);
|
||||
end;
|
||||
CurNode.EndPos:=CurPos.StartPos;
|
||||
EndChildNode;
|
||||
end;
|
||||
end;
|
||||
// parse the inheritage
|
||||
@ -3794,10 +3806,12 @@ begin
|
||||
IsForward:=false;
|
||||
while UpAtomIs('ABSTRACT') do
|
||||
ReadNextAtom;
|
||||
end else if UpAtomIs('EXTERNAL') then begin
|
||||
end else if (ClassDesc in [ctnObjCClass]) and UpAtomIs('EXTERNAL') then begin
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafSemicolon then
|
||||
RaiseCharExpectedButAtomFound(';');
|
||||
if UpAtomIs('NAME') then begin
|
||||
ReadNextAtom;
|
||||
ReadConstant(true,false,[]);
|
||||
end;
|
||||
end;
|
||||
if (CurPos.Flag=cafRoundBracketOpen) then begin
|
||||
// read inheritage brackets
|
||||
|
Loading…
Reference in New Issue
Block a user