added Delphi7 source template and language features

git-svn-id: trunk@4657 -
This commit is contained in:
mattias 2003-09-21 14:13:36 +00:00
parent 429de108cf
commit 55c9353c30
2 changed files with 38 additions and 10 deletions

View File

@ -113,7 +113,8 @@ var
WordIsNumberOperator,
WordIsPredefinedFPCIdentifier,
WordIsPredefinedDelphiIdentifier,
UnexpectedKeyWordInBeginBlock: TKeyWordFunctionList;
UnexpectedKeyWordInBeginBlock,
UnexpectedKeyWordInAsmBlock: TKeyWordFunctionList;
UpChars: array[char] of char;
function UpperCaseStr(const s: string): string;
@ -963,6 +964,29 @@ begin
Add('VAR',{$ifdef FPC}@{$endif}AllwaysTrue);
end;
UnexpectedKeyWordInAsmBlock:=TKeyWordFunctionList.Create;
KeyWordLists.Add(UnexpectedKeyWordInAsmBlock);
with UnexpectedKeyWordInAsmBlock do begin
Add('CLASS',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CONST',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CONSTRUCTOR',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('DESTRUCTOR',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FINALIZATION',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FUNCTION',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('IMPLEMENTATION',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INITIALIZATION',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INTERFACE',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LIBRARY',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PROCEDURE',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PROGRAM',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('RECORD',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('RESOURCESTRING',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SET',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('THREADVAR',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('UNIT',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('VAR',{$ifdef FPC}@{$endif}AllwaysTrue);
end;
WordIsLogicalBlockStart:=TKeyWordFunctionList.Create;
KeyWordLists.Add(WordIsLogicalBlockStart);
with WordIsLogicalBlockStart do begin

View File

@ -1337,14 +1337,13 @@ begin
exit;
end;
end;
if CurPos.Flag<>cafSemicolon then begin
// check semicolon
if CurPos.Flag=cafSemicolon then begin
ReadNextAtom;
end else begin
// Delphi allows procs without ending semicolon
if (Scanner.CompilerMode<>cmDelphi) then
RaiseCharExpectedButAtomFound(';');
// Delphi allows procs without ending semicolon
UndoReadNextAtom; // unread unknown atom
if CurPos.Flag=cafSemicolon then
UndoReadNextAtom; // unread semicolon
break;
end;
end else begin
// current atom does not belong to procedure/method declaration
@ -1353,7 +1352,6 @@ begin
UndoReadNextAtom; // unread semicolon
break;
end;
ReadNextAtom;
until false;
end;
@ -1903,12 +1901,18 @@ begin
// check for unexpected keywords
case BlockType of
ebtBegin,ebtAsm,ebtTry,ebtCase,ebtRepeat:
ebtBegin,ebtTry,ebtCase,ebtRepeat:
if UnexpectedKeyWordInBeginBlock.DoItUppercase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
RaiseUnexpectedKeyWordInBeginEndBlock;
ebtAsm:
if UnexpectedKeyWordInAsmBlock.DoItUppercase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
RaiseUnexpectedKeyWordInBeginEndBlock;
end;
end;
until false;
@ -3014,7 +3018,7 @@ begin
CurNode.EndPos:=CurPos.EndPos;
EndChildNode; // close record
ReadNextAtom;
if UpAtomIs('PLATFORM') then ReadNextAtom;
if UpAtomIs('PLATFORM') or UpAtomIs('DEPRECATED') then ReadNextAtom;
Result:=true;
end;