Browse Source

Merged revisions 11050-11052 via svnmerge from
svn+ssh://svn.freepascal.org/FPC/svn/fpc/trunk

........
r11050 | michael | 2008-05-23 14:21:13 +0200 (Fri, 23 May 2008) | 1 line

* Fixed initialized procedural variable parsing
........
r11051 | michael | 2008-05-23 14:43:49 +0200 (Fri, 23 May 2008) | 1 line

* UNdid last 2 revisions
........
r11052 | michael | 2008-05-23 15:04:00 +0200 (Fri, 23 May 2008) | 1 line

* Proper fix for initialized variable (including procedures)
........

git-svn-id: branches/fixes_2_2@11053 -

michael 17 năm trước cách đây
mục cha
commit
8203b71fbe
1 tập tin đã thay đổi với 12 bổ sung8 xóa
  1. 12 8
      packages/fcl-passrc/src/pparser.pp

+ 12 - 8
packages/fcl-passrc/src/pparser.pp

@@ -525,8 +525,7 @@ begin
         Result := TPasProcedureType(CreateElement(TPasProcedureType, '', nil));
         ParseProcedureOrFunctionHeader(Result,
           TPasProcedureType(Result), ptProcedure, True);
-        if CurToken=tkSemicolon then  
-          UngetToken;        // Unget semicolon
+        UngetToken;        // Unget semicolon
       end;
     tkFunction:
       begin
@@ -534,8 +533,7 @@ begin
 	  Scanner.CurFilename, Scanner.CurRow);
         ParseProcedureOrFunctionHeader(Result,
           TPasFunctionType(Result), ptFunction, True);
-        if CurToken=tkSemicolon then  
-          UngetToken;        // Unget semicolon
+        UngetToken;        // Unget semicolon
       end;
     else
     begin
@@ -1221,10 +1219,11 @@ var
   Value, S: String;
   M: string;
   H : TPasMemberHints;
-  
+  LastVar : String;
 begin
   while True do
   begin
+    LastVar:=CurTokenString;
     List.Add(CreateElement(TPasVariable, CurTokenString, Parent));
     NextToken;
     if CurToken = tkColon then
@@ -1240,15 +1239,20 @@ begin
     if i > 0 then
       VarType.AddRef;
   end;
-  NextToken;
+//  Writeln(LastVar,': Parsed complex type: ',CurtokenText);
+  // NextToken;
+  // Writeln(LastVar,': Parsed complex type, next: ',CurtokenText);
   If CurToken=tkEqual then
     begin
+    NextToken;
     Value := ParseExpression;
+  //  Writeln(LastVar,' Value :',Value);
     for i := 0 to List.Count - 1 do
       TPasVariable(List[i]).Value := Value;
+//    Writeln(LastVar,': Parsed expression:',CurTokenText);
     end
-  else
-    UngetToken;
+{  else
+    UngetToken};
 
   NextToken;
   if CurToken = tkAbsolute then