mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 21:58:29 +02:00
extended parser for new 1.1 syntax
git-svn-id: trunk@3717 -
This commit is contained in:
parent
f8329f9fc6
commit
23f2a663a1
@ -541,23 +541,25 @@ begin
|
|||||||
IsKeyWordProcedureSpecifier:=TKeyWordFunctionList.Create;
|
IsKeyWordProcedureSpecifier:=TKeyWordFunctionList.Create;
|
||||||
KeyWordLists.Add(IsKeyWordProcedureSpecifier);
|
KeyWordLists.Add(IsKeyWordProcedureSpecifier);
|
||||||
with IsKeyWordProcedureSpecifier do begin
|
with IsKeyWordProcedureSpecifier do begin
|
||||||
Add('STDCALL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('STDCALL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('REGISTER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('REGISTER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('POPSTACK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('POPSTACK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('OVERLOAD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('OVERLOAD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('INLINE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('INLINE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('EXTERNAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('EXTERNAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('FORWARD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('FORWARD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('PASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('PASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('ASSEMBLER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('ASSEMBLER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('SAVEREGISTERS',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('SAVEREGISTERS',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('FAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('FAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('NEAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('NEAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('DEPRECATED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('DEPRECATED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('PLATFORM' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('PLATFORM' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('LOCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('LOCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('[' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('COMPILERPROC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
|
Add('IOCHECK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
|
Add('[' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
end;
|
end;
|
||||||
IsKeyWordProcedureTypeSpecifier:=TKeyWordFunctionList.Create;
|
IsKeyWordProcedureTypeSpecifier:=TKeyWordFunctionList.Create;
|
||||||
KeyWordLists.Add(IsKeyWordProcedureTypeSpecifier);
|
KeyWordLists.Add(IsKeyWordProcedureTypeSpecifier);
|
||||||
@ -652,6 +654,7 @@ begin
|
|||||||
Add('NOT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('NOT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('OBJECT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('OBJECT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('OF',{$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('ON',{$ifdef FPC}@{$endif}AllwaysTrue); // not for Delphi
|
||||||
Add('OR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('OR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('PACKED',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('PACKED',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
@ -673,6 +676,7 @@ begin
|
|||||||
Add('UNTIL',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('UNTIL',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('USES',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('USES',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('VAR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('VAR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
|
Add('THREADVAR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('WHILE',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('WHILE',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('WITH',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('WITH',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('XOR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('XOR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
@ -779,6 +783,7 @@ begin
|
|||||||
Add('TYPE',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('TYPE',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('UNIT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('UNIT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('VAR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('VAR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
|
Add('THREADVAR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
end;
|
end;
|
||||||
WordIsLogicalBlockStart:=TKeyWordFunctionList.Create;
|
WordIsLogicalBlockStart:=TKeyWordFunctionList.Create;
|
||||||
KeyWordLists.Add(WordIsLogicalBlockStart);
|
KeyWordLists.Add(WordIsLogicalBlockStart);
|
||||||
|
@ -914,7 +914,8 @@ function TPascalParserTool.KeyWordFuncClassMethod: boolean;
|
|||||||
function Intf.Method = ImplementingMethodName;
|
function Intf.Method = ImplementingMethodName;
|
||||||
|
|
||||||
proc specifiers without parameters:
|
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:
|
proc specifiers with parameters:
|
||||||
message <id or number>
|
message <id or number>
|
||||||
@ -1213,6 +1214,7 @@ function TPascalParserTool.ReadTilProcedureHeadEnd(
|
|||||||
external <id or number> name <id>;
|
external <id or number> name <id>;
|
||||||
external <id or number> index <id>;
|
external <id or number> index <id>;
|
||||||
[alias: <string constant>]
|
[alias: <string constant>]
|
||||||
|
[external name <string constant>]
|
||||||
}
|
}
|
||||||
|
|
||||||
procedure RaiseKeyWordExampleExpected;
|
procedure RaiseKeyWordExampleExpected;
|
||||||
@ -1313,7 +1315,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end else if CurPos.Flag=cafEdgedBracketOpen then begin
|
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
|
repeat
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if not (CurPos.Flag in AllCommonAtomWords) then
|
if not (CurPos.Flag in AllCommonAtomWords) then
|
||||||
@ -1322,13 +1325,25 @@ begin
|
|||||||
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
|
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
|
||||||
then
|
then
|
||||||
RaiseKeyWordExampleExpected;
|
RaiseKeyWordExampleExpected;
|
||||||
if UpAtomIs('INTERNPROC') or UpAtomIs('EXTERNAL') then
|
if UpAtomIs('INTERNPROC') then
|
||||||
HasForwardModifier:=true;
|
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
|
if CurPos.Flag in [cafColon,cafEdgedBracketClose] then
|
||||||
break;
|
break;
|
||||||
if CurPos.Flag<>cafComma then
|
if CurPos.Flag<>cafComma then
|
||||||
RaiseCharExpectedButAtomFound(':');
|
RaiseCharExpectedButAtomFound(']');
|
||||||
until false;
|
until false;
|
||||||
if CurPos.Flag=cafColon then begin
|
if CurPos.Flag=cafColon then begin
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
|
Loading…
Reference in New Issue
Block a user