extended parser for new 1.1 syntax

git-svn-id: trunk@3717 -
This commit is contained in:
mattias 2002-12-20 11:27:26 +00:00
parent f8329f9fc6
commit 23f2a663a1
2 changed files with 41 additions and 21 deletions

View File

@ -541,23 +541,25 @@ begin
IsKeyWordProcedureSpecifier:=TKeyWordFunctionList.Create;
KeyWordLists.Add(IsKeyWordProcedureSpecifier);
with IsKeyWordProcedureSpecifier do begin
Add('STDCALL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('REGISTER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('POPSTACK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('OVERLOAD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INLINE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXTERNAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FORWARD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ASSEMBLER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('STDCALL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('REGISTER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('POPSTACK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('OVERLOAD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INLINE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXTERNAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FORWARD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ASSEMBLER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SAVEREGISTERS',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('NEAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('DEPRECATED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PLATFORM' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LOCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('[' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('NEAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('DEPRECATED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PLATFORM' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LOCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('COMPILERPROC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('IOCHECK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('[' ,{$ifdef FPC}@{$endif}AllwaysTrue);
end;
IsKeyWordProcedureTypeSpecifier:=TKeyWordFunctionList.Create;
KeyWordLists.Add(IsKeyWordProcedureTypeSpecifier);
@ -652,6 +654,7 @@ begin
Add('NOT',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('OBJECT',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('OF',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('OPERATOR',{$ifdef FPC}@{$endif}AllwaysTrue);
//Add('ON',{$ifdef FPC}@{$endif}AllwaysTrue); // not for Delphi
Add('OR',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PACKED',{$ifdef FPC}@{$endif}AllwaysTrue);
@ -673,6 +676,7 @@ begin
Add('UNTIL',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('USES',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('VAR',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('THREADVAR',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('WHILE',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('WITH',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('XOR',{$ifdef FPC}@{$endif}AllwaysTrue);
@ -779,6 +783,7 @@ begin
Add('TYPE',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('UNIT',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('VAR',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('THREADVAR',{$ifdef FPC}@{$endif}AllwaysTrue);
end;
WordIsLogicalBlockStart:=TKeyWordFunctionList.Create;
KeyWordLists.Add(WordIsLogicalBlockStart);

View File

@ -914,7 +914,8 @@ function TPascalParserTool.KeyWordFuncClassMethod: boolean;
function Intf.Method = ImplementingMethodName;
proc specifiers without parameters:
stdcall, virtual, abstract, dynamic, overload, override, cdecl, inline
stdcall, virtual, abstract, dynamic, overload, override, cdecl, inline,
compilerproc
proc specifiers with parameters:
message <id or number>
@ -1213,6 +1214,7 @@ function TPascalParserTool.ReadTilProcedureHeadEnd(
external <id or number> name <id>;
external <id or number> index <id>;
[alias: <string constant>]
[external name <string constant>]
}
procedure RaiseKeyWordExampleExpected;
@ -1313,7 +1315,8 @@ begin
end;
end;
end else if CurPos.Flag=cafEdgedBracketOpen then begin
// read assembler alias [public,alias: 'alternative name']
// read assembler alias [public,alias: 'alternative name'],
// internproc, external
repeat
ReadNextAtom;
if not (CurPos.Flag in AllCommonAtomWords) then
@ -1322,13 +1325,25 @@ begin
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
RaiseKeyWordExampleExpected;
if UpAtomIs('INTERNPROC') or UpAtomIs('EXTERNAL') then
if UpAtomIs('INTERNPROC') then
HasForwardModifier:=true;
ReadNextAtom;
if UpAtomIs('EXTERNAL') then begin
HasForwardModifier:=true;
ReadNextAtom;
if not (CurPos.Flag in [cafComma,cafEdgedBracketClose]) then begin
if not UpAtomIs('NAME') then
ReadConstant(true,false,[]);
if UpAtomIs('NAME') or UpAtomIs('INDEX') then begin
ReadNextAtom;
ReadConstant(true,false,[]);
end;
end;
end else
ReadNextAtom;
if CurPos.Flag in [cafColon,cafEdgedBracketClose] then
break;
if CurPos.Flag<>cafComma then
RaiseCharExpectedButAtomFound(':');
RaiseCharExpectedButAtomFound(']');
until false;
if CurPos.Flag=cafColon then begin
ReadNextAtom;