mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 16:31:40 +02:00
codetools: added "is nested" procedure modifier, bug #17310
git-svn-id: trunk@27312 -
This commit is contained in:
parent
2940387350
commit
1e799a4678
@ -843,6 +843,7 @@ begin
|
||||
Add('VARARGS' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('EXPERIMENTAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('LIBRARY' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('IS' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
end;
|
||||
|
||||
IsKeyWordCallingConvention:=TKeyWordFunctionList.Create;
|
||||
@ -854,7 +855,7 @@ begin
|
||||
Add('EXTDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MWPASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('POPSTACK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
// Note: inline is not a calling specifier
|
||||
// Note: 'inline' and 'is nested' are not a calling specifiers
|
||||
end;
|
||||
|
||||
IsKeyWordProcedureBracketSpecifier:=TKeyWordFunctionList.Create;
|
||||
|
@ -148,7 +148,8 @@ type
|
||||
cmsDefault_inline,
|
||||
cmsExcept,
|
||||
cmsObjectiveC1,
|
||||
cmsObjectiveC2
|
||||
cmsObjectiveC2,
|
||||
cmsNestedProcVars
|
||||
);
|
||||
|
||||
TPascalCompiler = (pcFPC, pcDelphi);
|
||||
@ -521,7 +522,7 @@ const
|
||||
'POINTERTOPROCVAR', 'AUTODEREF', 'INITFINAL', 'POINTERARITHMETICS',
|
||||
'ANSISTRINGS', 'OUT', 'DEFAULTPARAMETERS', 'HINTDIRECTIVE',
|
||||
'DUPLICATELOCALS', 'PROPERTIES', 'ALLOWINLINE', 'EXCEPTIONS',
|
||||
'OBJECTIVEC1', 'OBJECTIVEC2');
|
||||
'OBJECTIVEC1', 'OBJECTIVEC2', 'NESTEDPROCVARS');
|
||||
|
||||
PascalCompilerNames: array[TPascalCompiler] of shortstring=(
|
||||
'FPC', 'DELPHI'
|
||||
|
@ -1677,6 +1677,9 @@ begin
|
||||
if (pphIsMethod in ParseAttr) then
|
||||
IsSpecifier:=IsKeyWordMethodSpecifier.DoItCaseInsensitive(Src,
|
||||
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
|
||||
else if pphIsType in ParseAttr then
|
||||
IsSpecifier:=IsKeyWordProcedureTypeSpecifier.DoItCaseInsensitive(Src,
|
||||
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
|
||||
else
|
||||
IsSpecifier:=IsKeyWordProcedureSpecifier.DoItCaseInsensitive(Src,
|
||||
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
|
||||
@ -1688,6 +1691,11 @@ begin
|
||||
ReadNextAtom;
|
||||
if not (CurPos.Flag in [cafSemicolon,cafEND]) then
|
||||
ReadConstant(true,false,[]);
|
||||
end else if UpAtomIs('IS') then begin
|
||||
ReadNextAtom;
|
||||
if not UpAtomIs('NESTED') then
|
||||
RaiseStringExpectedButAtomFound('nested');
|
||||
ReadNextAtom;
|
||||
end else if UpAtomIs('EXTERNAL') or UpAtomIs('WEAKEXTERNAL') or UpAtomIs('PUBLIC') then begin
|
||||
HasForwardModifier:=UpAtomIs('EXTERNAL') or UpAtomIs('WEAKEXTERNAL');
|
||||
ReadNextAtom;
|
||||
@ -4040,20 +4048,28 @@ begin
|
||||
begin
|
||||
UndoReadNextAtom;
|
||||
break;
|
||||
end else begin
|
||||
end;
|
||||
if UpAtomIs('IS') then begin
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafSemicolon then begin
|
||||
if (CurPos.Flag=cafEqual) then begin
|
||||
break;
|
||||
end;
|
||||
// delphi/fpc allow proc modifiers without semicolons
|
||||
if not IsKeyWordProcedureTypeSpecifier.DoItCaseInsensitive(Src,
|
||||
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then
|
||||
begin
|
||||
RaiseCharExpectedButAtomFound(';');
|
||||
end;
|
||||
UndoReadNextAtom;
|
||||
if not UpAtomIs('NESTED') then
|
||||
RaiseStringExpectedButAtomFound('nested');
|
||||
end else if UpAtomIs('OF') then begin
|
||||
ReadNextAtom;
|
||||
if not UpAtomIs('OBJECT') then
|
||||
RaiseStringExpectedButAtomFound('object');
|
||||
end;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafSemicolon then begin
|
||||
if (CurPos.Flag=cafEqual) then begin
|
||||
break;
|
||||
end;
|
||||
// delphi/fpc allow proc modifiers without semicolons
|
||||
if not IsKeyWordProcedureTypeSpecifier.DoItCaseInsensitive(Src,
|
||||
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then
|
||||
begin
|
||||
RaiseCharExpectedButAtomFound(';');
|
||||
end;
|
||||
UndoReadNextAtom;
|
||||
end;
|
||||
ReadNextAtom;
|
||||
until false;
|
||||
|
Loading…
Reference in New Issue
Block a user