MG: parser enhanced for delphis sysutils

git-svn-id: trunk@1499 -
This commit is contained in:
lazarus 2002-03-10 22:59:29 +00:00
parent 4cd162b064
commit 81dc7d308e
3 changed files with 29 additions and 14 deletions

View File

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

View File

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

View File

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