Browse Source

* Support for Is Nested procedure declarations (Bug ID 21992)

git-svn-id: trunk@21851 -
michael 13 years ago
parent
commit
abaff904a1
2 changed files with 22 additions and 10 deletions
  1. 1 0
      packages/fcl-passrc/src/pastree.pp
  2. 21 10
      packages/fcl-passrc/src/pparser.pp

+ 1 - 0
packages/fcl-passrc/src/pastree.pp

@@ -525,6 +525,7 @@ type
     function CreateArgument(const AName, AUnresolvedTypeName: string):TPasArgument;
   public
     IsOfObject: Boolean;
+    IsNested : Boolean;
     Args: TFPList;        // List of TPasArgument objects
     CallingConvention : TCallingConvention;
   end;

+ 21 - 10
packages/fcl-passrc/src/pparser.pp

@@ -42,6 +42,7 @@ resourcestring
   SParserExpectedColonSemicolon = 'Expected ":" or ";"';
   SParserExpectedSemiColonEnd = 'Expected ";" or "End"';
   SParserExpectedConstVarID = 'Expected "const", "var" or identifier';
+  SParserExpectedNested = 'Expected nested keyword';
   SParserExpectedColonID = 'Expected ":" or identifier';
   SParserSyntaxError = 'Syntax error';
   SParserTypeSyntaxError = 'Syntax error in type';
@@ -2492,7 +2493,7 @@ begin
       begin
       NextToken;
       if (CurToken = tkSemicolon) or IsCurtokenHint
-        or (OfObjectPossible and (CurToken in [tkOf,tkEqual]))
+        or (OfObjectPossible and (CurToken in [tkOf,tkis,tkEqual]))
       then
         UngetToken
       else
@@ -2517,15 +2518,25 @@ begin
           ParseType(nil);
       end;
   end;
-
-  NextToken;
-  if OfObjectPossible and (CurToken = tkOf) then
-  begin
-    ExpectToken(tkObject);
-    Element.IsOfObject := True;
-  end else
-    UngetToken;
-
+  
+  if OfObjectPossible then
+    begin
+    NextToken;
+    if (curToken =tkOf) then
+      begin
+      ExpectToken(tkObject);
+      Element.IsOfObject := True;
+      end 
+    else if (curToken = tkIs) then
+      begin
+      expectToken(tkIdentifier);
+      if (lowerCase(CurTokenString)<>'nested') then
+        ParseExc(SParserExpectedNested);
+      Element.isNested:=True;
+      end
+    else
+      UnGetToken;  
+    end;  
   NextToken;
   if CurToken = tkEqual then
   begin