codetools: parsing function+property modifier enumerator

git-svn-id: trunk@22425 -
This commit is contained in:
mattias 2009-11-04 12:02:23 +00:00
parent 0d866967e5
commit 51babfb160
2 changed files with 19 additions and 8 deletions

View File

@ -778,6 +778,7 @@ begin
Add('EXPERIMENTAL' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('EXPERIMENTAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LIBRARY' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('LIBRARY' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FINAL' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('FINAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ENUMERATOR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
end; end;
IsKeyWordProcedureSpecifier:=TKeyWordFunctionList.Create; IsKeyWordProcedureSpecifier:=TKeyWordFunctionList.Create;

View File

@ -1113,7 +1113,8 @@ function TPascalParserTool.KeyWordFuncClassMethod: boolean;
proc specifiers with parameters: proc specifiers with parameters:
message <id or number> message <id or number>
dispid <id> dispid <id>
} enumerator <id>
}
var IsFunction, HasForwardModifier: boolean; var IsFunction, HasForwardModifier: boolean;
ParseAttr: TParseProcHeadAttributes; ParseAttr: TParseProcHeadAttributes;
begin begin
@ -1493,6 +1494,7 @@ function TPascalParserTool.ReadTilProcedureHeadEnd(
[external name <string constant>] [external name <string constant>]
[internconst:in_const_round, external name 'FPC_ROUND']; [internconst:in_const_round, external name 'FPC_ROUND'];
dispid <id>; dispid <id>;
enumerator <id>
} }
procedure RaiseKeyWordExampleExpected; procedure RaiseKeyWordExampleExpected;
@ -1590,7 +1592,8 @@ begin
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
if IsSpecifier then begin if IsSpecifier then begin
// read specifier // read specifier
if UpAtomIs('MESSAGE') or UpAtomIs('DISPID') then begin if UpAtomIs('MESSAGE') or UpAtomIs('DISPID') or UpAtomIs('ENUMERATOR')
then begin
ReadNextAtom; ReadNextAtom;
ReadConstant(true,false,[]); ReadConstant(true,false,[]);
end else if UpAtomIs('EXTERNAL') or UpAtomIs('PUBLIC') then begin end else if UpAtomIs('EXTERNAL') or UpAtomIs('PUBLIC') then begin
@ -1960,13 +1963,13 @@ function TPascalParserTool.KeyWordFuncClassProperty: boolean;
property Items[Index1, Index2: integer]: integer read GetItems; default; property Items[Index1, Index2: integer]: integer read GetItems; default;
property X: integer index 1 read GetCoords write SetCoords stored IsStored; deprecated; property X: integer index 1 read GetCoords write SetCoords stored IsStored; deprecated;
property Col8: ICol8 read FCol8 write FCol8 implements ICol8, IColor; property Col8: ICol8 read FCol8 write FCol8 implements ICol8, IColor;
property Value: Integer read FCurrent; enumerator Current;
property specifiers without parameters: property specifiers before semicolon:
default, nodefault index <id or number>, read <id>, write <id>, stored <id>, default <constant>,
implements <id>[,<id>...], nodefault
property specifiers with parameters: property modifiers after semicolon:
index <id or number>, read <id>, write <id>, stored <id>, default <constant>, default, deprecated, enumerator <id>
implements <id>[,<id>...]
} }
procedure RaiseSemicolonAfterPropSpecMissing(const s: string); procedure RaiseSemicolonAfterPropSpecMissing(const s: string);
@ -1998,6 +2001,7 @@ begin
ReadNextAtom; ReadNextAtom;
end; end;
if CurPos.Flag=cafSemicolon then begin if CurPos.Flag=cafSemicolon then begin
// read modifiers
ReadNextAtom; ReadNextAtom;
if UpAtomIs('DEFAULT') then begin if UpAtomIs('DEFAULT') then begin
ReadNextAtom; ReadNextAtom;
@ -2011,6 +2015,12 @@ begin
ReadNextAtom; ReadNextAtom;
if CurPos.Flag<>cafSemicolon then if CurPos.Flag<>cafSemicolon then
RaiseSemicolonAfterPropSpecMissing('deprecated'); RaiseSemicolonAfterPropSpecMissing('deprecated');
end else if UpAtomIs('ENUMERATOR') then begin
ReadNextAtom;
AtomIsIdentifier(true);
ReadNextAtom;
if CurPos.Flag<>cafSemicolon then
RaiseSemicolonAfterPropSpecMissing('enumerator');
end else end else
UndoReadNextAtom; UndoReadNextAtom;
end else end else