* Parsing of unit-wide properties

git-svn-id: trunk@11054 -
This commit is contained in:
michael 2008-05-23 13:28:56 +00:00
parent 4d4554a303
commit bf482b2a13
2 changed files with 19 additions and 7 deletions

View File

@ -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;

View File

@ -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;