mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 09:33:47 +02:00
MG: parser enhanced for delphis sysutils
git-svn-id: trunk@1499 -
This commit is contained in:
parent
4cd162b064
commit
81dc7d308e
components/codetools
@ -544,6 +544,8 @@ begin
|
||||
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('[' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
end;
|
||||
IsKeyWordProcedureBracketSpecifier:=TKeyWordFunctionList.Create;
|
||||
@ -564,6 +566,8 @@ begin
|
||||
Add('POPSTACK',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('PASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('FAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('NEAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
end;
|
||||
IsKeyWordSection:=TKeyWordFunctionList.Create;
|
||||
KeyWordLists.Add(IsKeyWordSection);
|
||||
|
@ -1038,9 +1038,12 @@ begin
|
||||
Values.Variables[FDirectiveName]:='0'
|
||||
else if (ValueStr='PRELOAD') and (FDirectiveName='ASSERTIONS') then
|
||||
Values.Variables[FDirectiveName]:=ValueStr
|
||||
else
|
||||
else if (FDirectiveName='LOCALSYMBOLS') then
|
||||
// ignore link object directive
|
||||
else begin
|
||||
RaiseException(
|
||||
'invalid flag value "'+ValueStr+'" for directive '+FDirectiveName);
|
||||
end;
|
||||
Result:=ReadNextSwitchDirective;
|
||||
end;
|
||||
|
||||
|
@ -1086,9 +1086,11 @@ function TPascalParserTool.ReadTilProcedureHeadEnd(
|
||||
stdcall, virtual, abstract, dynamic, overload, override, cdecl, inline
|
||||
|
||||
proc specifiers with parameters:
|
||||
message <id or number>
|
||||
external <id or number> name <id>
|
||||
external <id or number> index <id>
|
||||
message <id or number>;
|
||||
external;
|
||||
external name <id>;
|
||||
external <id or number> name <id>;
|
||||
external <id or number> index <id>;
|
||||
[alias: <string constant>]
|
||||
}
|
||||
var IsSpecifier: boolean;
|
||||
@ -1166,13 +1168,15 @@ begin
|
||||
end else if UpAtomIs('EXTERNAL') then begin
|
||||
HasForwardModifier:=true;
|
||||
ReadNextAtom;
|
||||
if not UpAtomIs('NAME') then
|
||||
ReadConstant(true,false,[]);
|
||||
if UpAtomIs('NAME') or UpAtomIs('INDEX') then begin
|
||||
ReadNextAtom;
|
||||
ReadConstant(true,false,[]);
|
||||
end else begin
|
||||
RaiseException('"name" expected, but '+GetAtom+' found');
|
||||
if not AtomIsChar(';') then begin
|
||||
if not UpAtomIs('NAME') then
|
||||
ReadConstant(true,false,[]);
|
||||
if UpAtomIs('NAME') or UpAtomIs('INDEX') then begin
|
||||
ReadNextAtom;
|
||||
ReadConstant(true,false,[]);
|
||||
end else begin
|
||||
RaiseException('"name" expected, but '+GetAtom+' found');
|
||||
end;
|
||||
end;
|
||||
end else if AtomIsChar('[') then begin
|
||||
// read assembler alias [public,alias: 'alternative name']
|
||||
@ -2456,8 +2460,8 @@ begin
|
||||
'''object'' expected, but '+GetAtom+' found');
|
||||
ReadNextAtom;
|
||||
end;
|
||||
if AtomIsChar('=') and NodeHasParentOfType(CurNode,ctnConstDefinition) then
|
||||
begin
|
||||
if AtomIsChar('=')
|
||||
and (CurNode.Parent.Desc in [ctnConstDefinition,ctnVarDefinition]) then begin
|
||||
// for example 'const f: procedure = nil;'
|
||||
end else begin
|
||||
if AtomIsChar(';') then begin
|
||||
@ -2465,7 +2469,8 @@ begin
|
||||
EqualFound:=false;
|
||||
end else if AtomIsChar('=') then begin
|
||||
EqualFound:=true;
|
||||
end;
|
||||
end else
|
||||
EqualFound:=false;
|
||||
if not EqualFound then begin
|
||||
// read modifiers
|
||||
repeat
|
||||
@ -2478,6 +2483,9 @@ begin
|
||||
break;
|
||||
end else begin
|
||||
if not ReadNextAtomIsChar(';') then begin
|
||||
if AtomIsChar('=') then begin
|
||||
break;
|
||||
end;
|
||||
if Scanner.CompilerMode<>cmDelphi then begin
|
||||
RaiseException('; expected, but '+GetAtom+' found');
|
||||
end else begin
|
||||
|
Loading…
Reference in New Issue
Block a user