codetools: parsing strict public section

git-svn-id: trunk@22048 -
This commit is contained in:
mattias 2009-10-05 14:28:32 +00:00
parent 1330a70d4e
commit 14f7ff3b26
2 changed files with 16 additions and 3 deletions

View File

@ -498,6 +498,10 @@ var
procedure StartClassSection;
begin
if (LastAtomStart>0) and (CompareIdentifiers('STRICT',@Src[LastAtomStart])=0)
then begin
exit;
end;
if Stack.TopType=bbtClassSection then
EndBlock;
if Stack.TopType=bbtClass then
@ -735,6 +739,9 @@ begin
StartIdentifierSection(bbtResourceStringSection);
end;
end;
'S':
if (CompareIdentifiers('STRICT',r)=0) then
StartClassSection;
'T':
case UpChars[r[1]] of
'H': // TH

View File

@ -446,7 +446,8 @@ begin
end;
end;
'S':
if CompareSrcIdentifiers(p,'STATIC') then exit(KeyWordFuncClassMethod);
if CompareSrcIdentifiers(p,'STATIC') then exit(KeyWordFuncClassMethod)
else if CompareSrcIdentifiers(p,'STRICT') then exit(KeyWordFuncClassSection);
'T':
if CompareSrcIdentifiers(p,'TYPE') then exit(KeyWordFuncClassTypeSection);
'V':
@ -1009,20 +1010,25 @@ end;
function TPascalParserTool.KeyWordFuncClassSection: boolean;
// change section in a class (public, private, protected, published)
var
p: PChar;
begin
// end last section
CurNode.EndPos:=CurPos.StartPos;
EndChildNode;
// start new section
CreateChildNode;
if UpAtomIs('STRICT') then ReadNextAtom;
if UpAtomIs('PUBLIC') then
CurNode.Desc:=ctnClassPublic
else if UpAtomIs('PRIVATE') then
CurNode.Desc:=ctnClassPrivate
else if UpAtomIs('PROTECTED') then
CurNode.Desc:=ctnClassProtected
else if UpAtomIs('PUBLISHED') then
CurNode.Desc:=ctnClassPublished
else
CurNode.Desc:=ctnClassPublished;
RaiseStringExpectedButAtomFound('public');
Result:=true;
end;
@ -1033,7 +1039,6 @@ begin
EndChildNode;
// start new section
CreateChildNode;
CurNode.Desc:=ctnClassTypePublic;
ReadNextAtom;
if UpAtomIs('PUBLIC') then
CurNode.Desc:=ctnClassTypePublic
@ -4345,6 +4350,7 @@ begin
case UpChars[p^] of
'C': if UpAtomIs('CLASS') then exit(true);
'F': if UpAtomIs('FUNCTION') then exit(true);
'S': if UpAtomIs('STRICT') then exit(true);
'P':
case UpChars[p[1]] of
'R':