Răsfoiți Sursa

Merged revisions 11049,11054-11056,11650 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r11049 | michael | 2008-05-23 10:05:58 +0200 (Fri, 23 May 2008) | 1 line

* File searching now as in compiler, using lower and uppercase filenames if needed
........
r11054 | michael | 2008-05-23 15:28:56 +0200 (Fri, 23 May 2008) | 1 line

* Parsing of unit-wide properties
........
r11055 | michael | 2008-05-23 15:30:14 +0200 (Fri, 23 May 2008) | 1 line

* Fixed memory leak
........
r11056 | michael | 2008-05-23 15:45:32 +0200 (Fri, 23 May 2008) | 1 line

* Skip unknown tokens when skipping due to conditional compiling
........
r11650 | michael | 2008-08-25 15:50:26 +0200 (Mon, 25 Aug 2008) | 1 line

* Added IsForward define to class declaration type
........

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

marco 17 ani în urmă
părinte
comite
8d81d44166

+ 4 - 2
packages/fcl-passrc/src/pastree.pp

@@ -109,7 +109,7 @@ type
   public
     UsesList: TList;            // TPasUnresolvedTypeRef or TPasModule elements
     Declarations, ResStrings, Types, Consts, Classes,
-      Functions, Variables: TList;
+    Functions, Variables, Properties: TList;
   end;
 
   TPasModule = class(TPasElement)
@@ -269,6 +269,7 @@ type
     ObjKind: TPasObjKind;
     AncestorType: TPasType;     // TPasClassType or TPasUnresolvedTypeRef
     IsPacked: Boolean;        // 12/04/04 - Dave - Added
+    IsForward : Boolean;
     Members: TList;     // array of TPasElement objects
     InterfaceGUID : string; // 15/06/07 - Inoussa
   end;
@@ -645,6 +646,7 @@ begin
   Classes := TList.Create;
   Functions := TList.Create;
   Variables := TList.Create;
+  Properties := TList.Create;
 end;
 
 destructor TPasSection.Destroy;
@@ -657,7 +659,7 @@ begin
   Consts.Free;
   Types.Free;
   ResStrings.Free;
-
+  Properties.Free;
   for i := 0 to Declarations.Count - 1 do
     TPasElement(Declarations[i]).Release;
   Declarations.Free;

+ 20 - 7
packages/fcl-passrc/src/pparser.pp

@@ -88,7 +88,7 @@ uses Classes;
 
 type
 
-  TDeclType = (declNone, declConst, declResourcestring, declType, declVar, declThreadvar);
+  TDeclType = (declNone, declConst, declResourcestring, declType, declVar, declThreadvar, declProperty);
 
   TProcType = (ptProcedure, ptFunction, ptOperator);
 
@@ -728,6 +728,8 @@ var
   List: TList;
   i,j: Integer;
   VarEl: TPasVariable;
+  PropEl : TPasProperty;
+  
 begin
   Module := nil;
   Module := TPasModule(CreateElement(TPasModule, ExpectIdentifier,
@@ -760,6 +762,8 @@ begin
         CurBlock := declVar;
       tkThreadVar:
         CurBlock := declThreadVar;
+      tkProperty:
+        CurBlock := declProperty;  
       tkProcedure:
         begin
           AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, ptProcedure));
@@ -770,11 +774,6 @@ begin
           AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, ptFunction));
           CurBlock := declNone;
         end;
-      tkProperty:
-        begin
-          ExpectIdentifier;
-          ParseProperty(CreateElement(TPasProperty, CurTokenString, Section));
-        end;
       tkOperator:
         begin
           AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, ptOperator));
@@ -848,6 +847,18 @@ begin
                   List.Free;
                 end;
               end;
+            declProperty:
+              begin
+              PropEl:=TPasProperty(CreateElement(TPasProperty, CurTokenString, Section));
+              Try
+                ParseProperty(PropEl)
+              except
+                Propel.Free;
+                Raise;
+              end;    
+              Section.Declarations.Add(PropEl);
+              Section.properties.add(PropEl);
+              end;
           else
             ParseExc(SParserSyntaxError);
           end;
@@ -2095,7 +2106,9 @@ begin
         // !!!: Store interface name
       end;
       NextToken;
-    end;
+    end
+    else
+      TPasClassType(Result).isForward:=CurToken=tkSemicolon;
 
     if CurToken <> tkSemicolon then
     begin

+ 21 - 3
packages/fcl-passrc/src/pscanner.pp

@@ -159,12 +159,14 @@ type
   TFileResolver = class
   private
     FIncludePaths: TStringList;
+    FStrictFileCase : Boolean;
   public
     constructor Create;
     destructor Destroy; override;
     procedure AddIncludePath(const APath: string);
     function FindSourceFile(const AName: string): TLineReader;
     function FindIncludeFile(const AName: string): TLineReader;
+    Property StrictFileCase : Boolean Read FStrictFileCase Write FStrictFileCase;
   end;
 
   EScannerError       = class(Exception);
@@ -413,7 +415,20 @@ begin
       begin
       Try
         FN:=FIncludePaths[i]+AName;
-        If FileExists(FN) then
+        If not FileExists(FN) then
+          If StrictFileCase then
+            FN:=''
+          else
+            begin 
+            fn:=LowerCase(FN);
+            If not FileExists(Fn) then
+              begin
+              FN:=uppercase(Fn);
+              If not FileExists(FN) then
+                FN:='';
+              end;    
+            end;  
+        If (FN<>'') then
           Result := TFileLineReader.Create(FN);
       except
         Result:=Nil;
@@ -1056,8 +1071,11 @@ begin
 
         Result := tkIdentifier;
       end;
-  else
-    Error(SErrInvalidCharacter, [TokenStr[0]]);
+  else 
+    if PPIsSkipping then
+      Inc(TokenStr)
+    else  
+      Error(SErrInvalidCharacter, [TokenStr[0]]);
   end;
 
   FCurToken := Result;