mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 02:30:41 +01:00
* Parsing of unit-wide properties
git-svn-id: trunk@11054 -
This commit is contained in:
parent
4d4554a303
commit
bf482b2a13
@ -109,7 +109,7 @@ type
|
||||
public
|
||||
UsesList: TList; // TPasUnresolvedTypeRef or TPasModule elements
|
||||
Declarations, ResStrings, Types, Consts, Classes,
|
||||
Functions, Variables: TList;
|
||||
Functions, Variables, Properties: TList;
|
||||
end;
|
||||
|
||||
TPasModule = class(TPasElement)
|
||||
@ -645,6 +645,7 @@ begin
|
||||
Classes := TList.Create;
|
||||
Functions := TList.Create;
|
||||
Variables := TList.Create;
|
||||
Properties := TList.Create;
|
||||
end;
|
||||
|
||||
destructor TPasSection.Destroy;
|
||||
|
||||
@ -88,7 +88,7 @@ uses Classes;
|
||||
|
||||
type
|
||||
|
||||
TDeclType = (declNone, declConst, declResourcestring, declType, declVar, declThreadvar);
|
||||
TDeclType = (declNone, declConst, declResourcestring, declType, declVar, declThreadvar, declProperty);
|
||||
|
||||
TProcType = (ptProcedure, ptFunction, ptOperator);
|
||||
|
||||
@ -728,6 +728,8 @@ var
|
||||
List: TList;
|
||||
i,j: Integer;
|
||||
VarEl: TPasVariable;
|
||||
PropEl : TPasProperty;
|
||||
|
||||
begin
|
||||
Module := nil;
|
||||
Module := TPasModule(CreateElement(TPasModule, ExpectIdentifier,
|
||||
@ -760,6 +762,8 @@ begin
|
||||
CurBlock := declVar;
|
||||
tkThreadVar:
|
||||
CurBlock := declThreadVar;
|
||||
tkProperty:
|
||||
CurBlock := declProperty;
|
||||
tkProcedure:
|
||||
begin
|
||||
AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, ptProcedure));
|
||||
@ -770,11 +774,6 @@ begin
|
||||
AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, ptFunction));
|
||||
CurBlock := declNone;
|
||||
end;
|
||||
tkProperty:
|
||||
begin
|
||||
ExpectIdentifier;
|
||||
ParseProperty(CreateElement(TPasProperty, CurTokenString, Section));
|
||||
end;
|
||||
tkOperator:
|
||||
begin
|
||||
AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, ptOperator));
|
||||
@ -848,6 +847,18 @@ begin
|
||||
List.Free;
|
||||
end;
|
||||
end;
|
||||
declProperty:
|
||||
begin
|
||||
PropEl:=TPasProperty(CreateElement(TPasProperty, CurTokenString, Section));
|
||||
Try
|
||||
ParseProperty(PropEl)
|
||||
except
|
||||
Propel.Free;
|
||||
Raise;
|
||||
end;
|
||||
Section.Declarations.Add(PropEl);
|
||||
Section.properties.add(PropEl);
|
||||
end;
|
||||
else
|
||||
ParseExc(SParserSyntaxError);
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user