Browse Source

Merged revisions 192-195 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@276 -

peter 20 years ago
parent
commit
437410539e
4 changed files with 460 additions and 396 deletions
  1. 207 171
      fcl/passrc/pastree.pp
  2. 12 12
      fcl/passrc/paswrite.pp
  3. 194 166
      fcl/passrc/pparser.pp
  4. 47 47
      fcl/passrc/pscanner.pp

+ 207 - 171
fcl/passrc/pastree.pp

@@ -74,31 +74,31 @@ type
   TPasElement = class
   TPasElement = class
   private
   private
     FRefCount: LongWord;
     FRefCount: LongWord;
-    FName: String;
+    FName: string;
     FParent: TPasElement;
     FParent: TPasElement;
   public
   public
-    SourceFilename: String;
+    SourceFilename: string;
     SourceLinenumber: Integer;
     SourceLinenumber: Integer;
-    constructor Create(const AName: String; AParent: TPasElement); virtual;
+    constructor Create(const AName: string; AParent: TPasElement); virtual;
     procedure AddRef;
     procedure AddRef;
     procedure Release;
     procedure Release;
-    function FullName: String;          // Name including parent's names
-    function PathName: String;          // = Module.Name + FullName
+    function FullName: string;          // Name including parent's names
+    function PathName: string;          // = Module.Name + FullName
     function GetModule: TPasModule;
     function GetModule: TPasModule;
-    function ElementTypeName: String; virtual;
-    function GetDeclaration(full : Boolean) : String; virtual;
+    function ElementTypeName: string; virtual;
+    function GetDeclaration(full : Boolean) : string; virtual;
     Visibility: TPasMemberVisibility;
     Visibility: TPasMemberVisibility;
     property RefCount: LongWord read FRefCount;
     property RefCount: LongWord read FRefCount;
-    property Name: String read FName;
+    property Name: string read FName write Fname;
     property Parent: TPasElement read FParent;
     property Parent: TPasElement read FParent;
   end;
   end;
 
 
   TPasSection = class(TPasElement)
   TPasSection = class(TPasElement)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    procedure AddUnitToUsesList(const AUnitName: String);
+    function ElementTypeName: string; override;
+    procedure AddUnitToUsesList(const AUnitName: string);
     UsesList: TList;            // TPasUnresolvedTypeRef or TPasModule elements
     UsesList: TList;            // TPasUnresolvedTypeRef or TPasModule elements
     Declarations, ResStrings, Types, Consts, Classes,
     Declarations, ResStrings, Types, Consts, Classes,
       Functions, Variables: TList;
       Functions, Variables: TList;
@@ -107,91 +107,91 @@ type
   TPasModule = class(TPasElement)
   TPasModule = class(TPasElement)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
     InterfaceSection, ImplementationSection: TPasSection;
     InterfaceSection, ImplementationSection: TPasSection;
-    PackageName: String;
+    PackageName: string;
   end;
   end;
 
 
   TPasPackage = class(TPasElement)
   TPasPackage = class(TPasElement)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
+    function ElementTypeName: string; override;
     Modules: TList;     // List of TPasModule objects
     Modules: TList;     // List of TPasModule objects
   end;
   end;
 
 
   TPasResString = class(TPasElement)
   TPasResString = class(TPasElement)
   public
   public
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : Boolean) : String; Override;
-    Value: String;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : Boolean) : string; Override;
+    Value: string;
   end;
   end;
 
 
   TPasType = class(TPasElement)
   TPasType = class(TPasElement)
   public
   public
-    function ElementTypeName: String; override;
+    function ElementTypeName: string; override;
   end;
   end;
 
 
   TPasPointerType = class(TPasType)
   TPasPointerType = class(TPasType)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : Boolean): String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : Boolean): string; override;
     DestType: TPasType;
     DestType: TPasType;
   end;
   end;
 
 
   TPasAliasType = class(TPasType)
   TPasAliasType = class(TPasType)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : Boolean): String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : Boolean): string; override;
     DestType: TPasType;
     DestType: TPasType;
   end;
   end;
 
 
   TPasTypeAliasType = class(TPasAliasType)
   TPasTypeAliasType = class(TPasAliasType)
   public
   public
-    function ElementTypeName: String; override;
+    function ElementTypeName: string; override;
   end;
   end;
 
 
   TPasClassOfType = class(TPasAliasType)
   TPasClassOfType = class(TPasAliasType)
   public
   public
-    function ElementTypeName: String; override;
-    function GetDeclaration(full: boolean) : String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full: boolean) : string; override;
   end;
   end;
 
 
 
 
   TPasRangeType = class(TPasType)
   TPasRangeType = class(TPasType)
   public
   public
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
-    RangeStart, RangeEnd: String;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
+    RangeStart, RangeEnd: string;
   end;
   end;
 
 
   TPasArrayType = class(TPasType)
   TPasArrayType = class(TPasType)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
-    IndexRange : String;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
+    IndexRange : string;
     IsPacked : Boolean;          // 12/04/04 - Dave - Added
     IsPacked : Boolean;          // 12/04/04 - Dave - Added
     ElType: TPasType;
     ElType: TPasType;
   end;
   end;
 
 
   TPasEnumValue = class(TPasElement)
   TPasEnumValue = class(TPasElement)
   public
   public
-    function ElementTypeName: String; override;
+    function ElementTypeName: string; override;
     IsValueUsed: Boolean;
     IsValueUsed: Boolean;
     Value: Integer;
     Value: Integer;
-    AssignedValue : String;
+    AssignedValue : string;
   end;
   end;
 
 
   TPasEnumType = class(TPasType)
   TPasEnumType = class(TPasType)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-     function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
+     function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
     Procedure GetEnumNames(Names : TStrings);
     Procedure GetEnumNames(Names : TStrings);
     Values: TList;      // List of TPasEnumValue objects
     Values: TList;      // List of TPasEnumValue objects
   end;
   end;
@@ -199,17 +199,17 @@ type
   TPasSetType = class(TPasType)
   TPasSetType = class(TPasType)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
     EnumType: TPasType;
     EnumType: TPasType;
   end;
   end;
 
 
   TPasRecordType = class(TPasType)
   TPasRecordType = class(TPasType)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
     IsPacked: Boolean;
     IsPacked: Boolean;
     Members: TList;     // array of TPasVariable elements
     Members: TList;     // array of TPasVariable elements
   end;
   end;
@@ -219,9 +219,9 @@ type
 
 
   TPasClassType = class(TPasType)
   TPasClassType = class(TPasType)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
+    function ElementTypeName: string; override;
     ObjKind: TPasObjKind;
     ObjKind: TPasObjKind;
     AncestorType: TPasType;     // TPasClassType or TPasUnresolvedTypeRef
     AncestorType: TPasType;     // TPasClassType or TPasUnresolvedTypeRef
     IsPacked: Boolean;        // 12/04/04 - Dave - Added
     IsPacked: Boolean;        // 12/04/04 - Dave - Added
@@ -233,23 +233,23 @@ type
   TPasArgument = class(TPasElement)
   TPasArgument = class(TPasElement)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
     Access: TArgumentAccess;
     Access: TArgumentAccess;
     ArgType: TPasType;
     ArgType: TPasType;
-    Value: String;
+    Value: string;
   end;
   end;
 
 
   TPasProcedureType = class(TPasType)
   TPasProcedureType = class(TPasType)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    class function TypeName: String; virtual;
-    function ElementTypeName: String; override;
+    class function TypeName: string; virtual;
+    function ElementTypeName: string; override;
     IsOfObject: Boolean;
     IsOfObject: Boolean;
-    function GetDeclaration(full : boolean) : String; override;
+    function GetDeclaration(full : boolean) : string; override;
     procedure GetArguments(List : TStrings);
     procedure GetArguments(List : TStrings);
-    function CreateArgument(const AName, AUnresolvedTypeName: String):
+    function CreateArgument(const AName, AUnresolvedTypeName: string):
       TPasArgument;
       TPasArgument;
     Args: TList;        // List of TPasArgument objects
     Args: TList;        // List of TPasArgument objects
   end;
   end;
@@ -257,80 +257,80 @@ type
   TPasResultElement = class(TPasElement)
   TPasResultElement = class(TPasElement)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName : String; override;
+    function ElementTypeName : string; override;
     ResultType: TPasType;
     ResultType: TPasType;
   end;
   end;
 
 
   TPasFunctionType = class(TPasProcedureType)
   TPasFunctionType = class(TPasProcedureType)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    class function TypeName: String; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(Full : boolean) : String; override;
+    class function TypeName: string; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(Full : boolean) : string; override;
     ResultEl: TPasResultElement;
     ResultEl: TPasResultElement;
   end;
   end;
 
 
   TPasUnresolvedTypeRef = class(TPasType)
   TPasUnresolvedTypeRef = class(TPasType)
   public
   public
     // Typerefs cannot be parented! -> AParent _must_ be NIL
     // Typerefs cannot be parented! -> AParent _must_ be NIL
-    constructor Create(const AName: String; AParent: TPasElement); override;
-    function ElementTypeName: String; override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
+    function ElementTypeName: string; override;
   end;
   end;
 
 
   TPasTypeRef = class(TPasUnresolvedTypeRef)
   TPasTypeRef = class(TPasUnresolvedTypeRef)
   public
   public
-    // function GetDeclaration(full : Boolean): String; override;
+    // function GetDeclaration(full : Boolean): string; override;
     RefType: TPasType;
     RefType: TPasType;
   end;
   end;
 
 
   TPasVariable = class(TPasElement)
   TPasVariable = class(TPasElement)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
     VarType: TPasType;
     VarType: TPasType;
-    Value: String;
+    Value: string;
     Modifiers : string;
     Modifiers : string;
   end;
   end;
 
 
   TPasConst = class(TPasVariable)
   TPasConst = class(TPasVariable)
   public
   public
-    function ElementTypeName: String; override;
+    function ElementTypeName: string; override;
   end;
   end;
 
 
   TPasProperty = class(TPasVariable)
   TPasProperty = class(TPasVariable)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function GetDeclaration(full : boolean) : String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration(full : boolean) : string; override;
     Args: TList;        // List of TPasArgument objects
     Args: TList;        // List of TPasArgument objects
     IndexValue, ReadAccessorName, WriteAccessorName,
     IndexValue, ReadAccessorName, WriteAccessorName,
-      StoredAccessorName, DefaultValue: String;
+      StoredAccessorName, DefaultValue: string;
     IsDefault, IsNodefault: Boolean;
     IsDefault, IsNodefault: Boolean;
   end;
   end;
 
 
   TPasProcedureBase = class(TPasElement)
   TPasProcedureBase = class(TPasElement)
   public
   public
-    function TypeName: String; virtual; abstract;
+    function TypeName: string; virtual; abstract;
   end;
   end;
 
 
   TPasOverloadedProc = class(TPasProcedureBase)
   TPasOverloadedProc = class(TPasProcedureBase)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function TypeName: String; override;
+    function ElementTypeName: string; override;
+    function TypeName: string; override;
     Overloads: TList;           // List of TPasProcedure nodes
     Overloads: TList;           // List of TPasProcedure nodes
   end;
   end;
 
 
   TPasProcedure = class(TPasProcedureBase)
   TPasProcedure = class(TPasProcedureBase)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function TypeName: String; override;
+    function ElementTypeName: string; override;
+    function TypeName: string; override;
     ProcType: TPasProcedureType;
     ProcType: TPasProcedureType;
-    function GetDeclaration(full: Boolean): String; override;
+    function GetDeclaration(full: Boolean): string; override;
     procedure GetModifiers(List: TStrings);
     procedure GetModifiers(List: TStrings);
     IsVirtual, IsDynamic, IsAbstract, IsOverride,
     IsVirtual, IsDynamic, IsAbstract, IsOverride,
       IsOverload, IsMessage: Boolean;
       IsOverload, IsMessage: Boolean;
@@ -338,20 +338,26 @@ type
 
 
   TPasFunction = class(TPasProcedure)
   TPasFunction = class(TPasProcedure)
   public
   public
-    function ElementTypeName: String; override;
-    function GetDeclaration (full : boolean) : String; override;
+    function ElementTypeName: string; override;
+    function GetDeclaration (full : boolean) : string; override;
+  end;
+
+  TPasOperator = class(TPasProcedure)
+  public
+    function ElementTypeName: string; override;
+    function GetDeclaration (full : boolean) : string; override;
   end;
   end;
 
 
   TPasConstructor = class(TPasProcedure)
   TPasConstructor = class(TPasProcedure)
   public
   public
-    function ElementTypeName: String; override;
-    function TypeName: String; override;
+    function ElementTypeName: string; override;
+    function TypeName: string; override;
   end;
   end;
 
 
   TPasDestructor = class(TPasProcedure)
   TPasDestructor = class(TPasProcedure)
   public
   public
-    function ElementTypeName: String; override;
-    function TypeName: String; override;
+    function ElementTypeName: string; override;
+    function TypeName: string; override;
   end;
   end;
 
 
 
 
@@ -359,10 +365,10 @@ type
 
 
   TPasProcedureImpl = class(TPasElement)
   TPasProcedureImpl = class(TPasElement)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    function ElementTypeName: String; override;
-    function TypeName: String; virtual;
+    function ElementTypeName: string; override;
+    function TypeName: string; virtual;
     ProcType: TPasProcedureType;
     ProcType: TPasProcedureType;
     Locals: TList;
     Locals: TList;
     Body: TPasImplBlock;
     Body: TPasImplBlock;
@@ -370,14 +376,14 @@ type
 
 
   TPasConstructorImpl = class(TPasProcedureImpl)
   TPasConstructorImpl = class(TPasProcedureImpl)
   public
   public
-    function ElementTypeName: String; override;
-    function TypeName: String; override;
+    function ElementTypeName: string; override;
+    function TypeName: string; override;
   end;
   end;
 
 
   TPasDestructorImpl = class(TPasProcedureImpl)
   TPasDestructorImpl = class(TPasProcedureImpl)
   public
   public
-    function ElementTypeName: String; override;
-    function TypeName: String; override;
+    function ElementTypeName: string; override;
+    function TypeName: string; override;
   end;
   end;
 
 
   TPasImplElement = class(TPasElement)
   TPasImplElement = class(TPasElement)
@@ -385,12 +391,12 @@ type
 
 
   TPasImplCommand = class(TPasImplElement)
   TPasImplCommand = class(TPasImplElement)
   public
   public
-    Command: String;
+    Command: string;
   end;
   end;
 
 
   TPasImplCommands = class(TPasImplElement)
   TPasImplCommands = class(TPasImplElement)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
     Commands: TStrings;
     Commands: TStrings;
   end;
   end;
@@ -398,7 +404,7 @@ type
   TPasImplIfElse = class(TPasImplElement)
   TPasImplIfElse = class(TPasImplElement)
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    Condition: String;
+    Condition: string;
     IfBranch, ElseBranch: TPasImplElement;
     IfBranch, ElseBranch: TPasImplElement;
   end;
   end;
 
 
@@ -406,33 +412,33 @@ type
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
     Variable: TPasVariable;
     Variable: TPasVariable;
-    StartValue, EndValue: String;
+    StartValue, EndValue: string;
     Body: TPasImplElement;
     Body: TPasImplElement;
   end;
   end;
 
 
   TPasImplBlock = class(TPasImplElement)
   TPasImplBlock = class(TPasImplElement)
   public
   public
-    constructor Create(const AName: String; AParent: TPasElement); override;
+    constructor Create(const AName: string; AParent: TPasElement); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    function AddCommand(const ACommand: String): TPasImplCommand;
+    function AddCommand(const ACommand: string): TPasImplCommand;
     function AddCommands: TPasImplCommands;
     function AddCommands: TPasImplCommands;
-    function AddIfElse(const ACondition: String): TPasImplIfElse;
+    function AddIfElse(const ACondition: string): TPasImplIfElse;
     function AddForLoop(AVar: TPasVariable;
     function AddForLoop(AVar: TPasVariable;
-      const AStartValue, AEndValue: String): TPasImplForLoop;
+      const AStartValue, AEndValue: string): TPasImplForLoop;
     Elements: TList;    // TPasImplElement objects
     Elements: TList;    // TPasImplElement objects
   end;
   end;
 
 
 
 
 const
 const
-  AccessNames: array[TArgumentAccess] of String[6] = ('', 'const ', 'var ', 'out ');
+  AccessNames: array[TArgumentAccess] of string[6] = ('', 'const ', 'var ', 'out ');
   AllVisibilities: TPasMemberVisibilities =
   AllVisibilities: TPasMemberVisibilities =
      [visDefault, visPrivate, visProtected, visPublic,
      [visDefault, visPrivate, visProtected, visPublic,
       visPublished, visAutomated];
       visPublished, visAutomated];
 
 
-  VisibilityNames: array[TPasMemberVisibility] of String = (
+  VisibilityNames: array[TPasMemberVisibility] of string = (
     'default', 'private', 'protected', 'public', 'published', 'automated');
     'default', 'private', 'protected', 'public', 'published', 'automated');
 
 
-  ObjKindNames: array[TPasObjKind] of String = (
+  ObjKindNames: array[TPasObjKind] of string = (
     'object', 'class', 'interface');
     'object', 'class', 'interface');
 
 
 
 
@@ -443,40 +449,41 @@ uses SysUtils;
 
 
 { Parse tree element type name functions }
 { Parse tree element type name functions }
 
 
-function TPasElement.ElementTypeName: String; begin Result := SPasTreeElement end;
-function TPasSection.ElementTypeName: String; begin Result := SPasTreeSection end;
-function TPasModule.ElementTypeName: String; begin Result := SPasTreeModule end;
-function TPasPackage.ElementTypeName: String; begin Result := SPasTreePackage end;
-function TPasResString.ElementTypeName: String; begin Result := SPasTreeResString end;
-function TPasType.ElementTypeName: String; begin Result := SPasTreeType end;
-function TPasPointerType.ElementTypeName: String; begin Result := SPasTreePointerType end;
-function TPasAliasType.ElementTypeName: String; begin Result := SPasTreeAliasType end;
-function TPasTypeAliasType.ElementTypeName: String; begin Result := SPasTreeTypeAliasType end;
-function TPasClassOfType.ElementTypeName: String; begin Result := SPasTreeClassOfType end;
-function TPasRangeType.ElementTypeName: String; begin Result := SPasTreeRangeType end;
-function TPasArrayType.ElementTypeName: String; begin Result := SPasTreeArrayType end;
-function TPasEnumValue.ElementTypeName: String; begin Result := SPasTreeEnumValue end;
-function TPasEnumType.ElementTypeName: String; begin Result := SPasTreeEnumType end;
-function TPasSetType.ElementTypeName: String; begin Result := SPasTreeSetType end;
-function TPasRecordType.ElementTypeName: String; begin Result := SPasTreeRecordType end;
-function TPasArgument.ElementTypeName: String; begin Result := SPasTreeArgument end;
-function TPasProcedureType.ElementTypeName: String; begin Result := SPasTreeProcedureType end;
-function TPasResultElement.ElementTypeName: String; begin Result := SPasTreeResultElement end;
-function TPasFunctionType.ElementTypeName: String; begin Result := SPasTreeFunctionType end;
-function TPasUnresolvedTypeRef.ElementTypeName: String; begin Result := SPasTreeUnresolvedTypeRef end;
-function TPasVariable.ElementTypeName: String; begin Result := SPasTreeVariable end;
-function TPasConst.ElementTypeName: String; begin Result := SPasTreeConst end;
-function TPasProperty.ElementTypeName: String; begin Result := SPasTreeProperty end;
-function TPasOverloadedProc.ElementTypeName: String; begin Result := SPasTreeOverloadedProcedure end;
-function TPasProcedure.ElementTypeName: String; begin Result := SPasTreeProcedure end;
-function TPasFunction.ElementTypeName: String; begin Result := SPasTreeFunction end;
-function TPasConstructor.ElementTypeName: String; begin Result := SPasTreeConstructor end;
-function TPasDestructor.ElementTypeName: String; begin Result := SPasTreeDestructor end;
-function TPasProcedureImpl.ElementTypeName: String; begin Result := SPasTreeProcedureImpl end;
-function TPasConstructorImpl.ElementTypeName: String; begin Result := SPasTreeConstructorImpl end;
-function TPasDestructorImpl.ElementTypeName: String; begin Result := SPasTreeDestructorImpl end;
-
-function TPasClassType.ElementTypeName: String;
+function TPasElement.ElementTypeName: string; begin Result := SPasTreeElement end;
+function TPasSection.ElementTypeName: string; begin Result := SPasTreeSection end;
+function TPasModule.ElementTypeName: string; begin Result := SPasTreeModule end;
+function TPasPackage.ElementTypeName: string; begin Result := SPasTreePackage end;
+function TPasResString.ElementTypeName: string; begin Result := SPasTreeResString end;
+function TPasType.ElementTypeName: string; begin Result := SPasTreeType end;
+function TPasPointerType.ElementTypeName: string; begin Result := SPasTreePointerType end;
+function TPasAliasType.ElementTypeName: string; begin Result := SPasTreeAliasType end;
+function TPasTypeAliasType.ElementTypeName: string; begin Result := SPasTreeTypeAliasType end;
+function TPasClassOfType.ElementTypeName: string; begin Result := SPasTreeClassOfType end;
+function TPasRangeType.ElementTypeName: string; begin Result := SPasTreeRangeType end;
+function TPasArrayType.ElementTypeName: string; begin Result := SPasTreeArrayType end;
+function TPasEnumValue.ElementTypeName: string; begin Result := SPasTreeEnumValue end;
+function TPasEnumType.ElementTypeName: string; begin Result := SPasTreeEnumType end;
+function TPasSetType.ElementTypeName: string; begin Result := SPasTreeSetType end;
+function TPasRecordType.ElementTypeName: string; begin Result := SPasTreeRecordType end;
+function TPasArgument.ElementTypeName: string; begin Result := SPasTreeArgument end;
+function TPasProcedureType.ElementTypeName: string; begin Result := SPasTreeProcedureType end;
+function TPasResultElement.ElementTypeName: string; begin Result := SPasTreeResultElement end;
+function TPasFunctionType.ElementTypeName: string; begin Result := SPasTreeFunctionType end;
+function TPasUnresolvedTypeRef.ElementTypeName: string; begin Result := SPasTreeUnresolvedTypeRef end;
+function TPasVariable.ElementTypeName: string; begin Result := SPasTreeVariable end;
+function TPasConst.ElementTypeName: string; begin Result := SPasTreeConst end;
+function TPasProperty.ElementTypeName: string; begin Result := SPasTreeProperty end;
+function TPasOverloadedProc.ElementTypeName: string; begin Result := SPasTreeOverloadedProcedure end;
+function TPasProcedure.ElementTypeName: string; begin Result := SPasTreeProcedure end;
+function TPasFunction.ElementTypeName: string; begin Result := SPasTreeFunction end;
+function TPasOperator.ElementTypeName: string; begin Result := SPasTreeFunction end;
+function TPasConstructor.ElementTypeName: string; begin Result := SPasTreeConstructor end;
+function TPasDestructor.ElementTypeName: string; begin Result := SPasTreeDestructor end;
+function TPasProcedureImpl.ElementTypeName: string; begin Result := SPasTreeProcedureImpl end;
+function TPasConstructorImpl.ElementTypeName: string; begin Result := SPasTreeConstructorImpl end;
+function TPasDestructorImpl.ElementTypeName: string; begin Result := SPasTreeDestructorImpl end;
+
+function TPasClassType.ElementTypeName: string;
 begin
 begin
   case ObjKind of
   case ObjKind of
     okObject: Result := SPasTreeObjectType;
     okObject: Result := SPasTreeObjectType;
@@ -489,7 +496,7 @@ end;
 { All other stuff: }
 { All other stuff: }
 
 
 
 
-constructor TPasElement.Create(const AName: String; AParent: TPasElement);
+constructor TPasElement.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create;
   inherited Create;
   FName := AName;
   FName := AName;
@@ -509,7 +516,7 @@ begin
     Dec(FRefCount);
     Dec(FRefCount);
 end;
 end;
 
 
-function TPasElement.FullName: String;
+function TPasElement.FullName: string;
 var
 var
   p: TPasElement;
   p: TPasElement;
 begin
 begin
@@ -526,7 +533,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TPasElement.PathName: String;
+function TPasElement.PathName: string;
 var
 var
   p: TPasElement;
   p: TPasElement;
 begin
 begin
@@ -555,7 +562,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TPasElement.GetDeclaration (full : boolean): String;
+function TPasElement.GetDeclaration (full : boolean): string;
 
 
 begin
 begin
   if Full then
   if Full then
@@ -564,7 +571,7 @@ begin
     Result := '';
     Result := '';
 end;
 end;
 
 
-constructor TPasSection.Create(const AName: String; AParent: TPasElement);
+constructor TPasSection.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   UsesList := TList.Create;
   UsesList := TList.Create;
@@ -599,7 +606,7 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-procedure TPasSection.AddUnitToUsesList(const AUnitName: String);
+procedure TPasSection.AddUnitToUsesList(const AUnitName: string);
 begin
 begin
   UsesList.Add(TPasUnresolvedTypeRef.Create(AUnitName, Self));
   UsesList.Add(TPasUnresolvedTypeRef.Create(AUnitName, Self));
 end;
 end;
@@ -615,7 +622,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TPasPackage.Create(const AName: String; AParent: TPasElement);
+constructor TPasPackage.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   if (Length(AName) > 0) and (AName[1] <> '#') then
   if (Length(AName) > 0) and (AName[1] <> '#') then
     inherited Create('#' + AName, AParent)
     inherited Create('#' + AName, AParent)
@@ -659,7 +666,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TPasEnumType.Create(const AName: String; AParent: TPasElement);
+constructor TPasEnumType.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   Values := TList.Create;
   Values := TList.Create;
@@ -697,7 +704,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TPasRecordType.Create(const AName: String; AParent: TPasElement);
+constructor TPasRecordType.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   Members := TList.Create;
   Members := TList.Create;
@@ -714,7 +721,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TPasClassType.Create(const AName: String; AParent: TPasElement);
+constructor TPasClassType.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   IsPacked := False;                     // 12/04/04 - Dave - Added
   IsPacked := False;                     // 12/04/04 - Dave - Added
@@ -742,7 +749,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TPasProcedureType.Create(const AName: String; AParent: TPasElement);
+constructor TPasProcedureType.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   Args := TList.Create;
   Args := TList.Create;
@@ -758,13 +765,13 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-function TPasProcedureType.TypeName: String;
+function TPasProcedureType.TypeName: string;
 begin
 begin
   Result := 'procedure';
   Result := 'procedure';
 end;
 end;
 
 
 function TPasProcedureType.CreateArgument(const AName,
 function TPasProcedureType.CreateArgument(const AName,
-  AUnresolvedTypeName: String): TPasArgument;
+  AUnresolvedTypeName: string): TPasArgument;
 begin
 begin
   Result := TPasArgument.Create(AName, Self);
   Result := TPasArgument.Create(AName, Self);
   Args.Add(Result);
   Args.Add(Result);
@@ -787,13 +794,13 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-function TPasFunctionType.TypeName: String;
+function TPasFunctionType.TypeName: string;
 begin
 begin
   Result := 'function';
   Result := 'function';
 end;
 end;
 
 
 
 
-constructor TPasUnresolvedTypeRef.Create(const AName: String; AParent: TPasElement);
+constructor TPasUnresolvedTypeRef.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, nil);
   inherited Create(AName, nil);
 end;
 end;
@@ -809,7 +816,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TPasProperty.Create(const AName: String; AParent: TPasElement);
+constructor TPasProperty.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   Args := TList.Create;
   Args := TList.Create;
@@ -826,7 +833,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TPasOverloadedProc.Create(const AName: String; AParent: TPasElement);
+constructor TPasOverloadedProc.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   Overloads := TList.Create;
   Overloads := TList.Create;
@@ -842,7 +849,7 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-function TPasOverloadedProc.TypeName: String;
+function TPasOverloadedProc.TypeName: string;
 begin
 begin
   if Assigned(TPasProcedure(Overloads[0]).ProcType) then
   if Assigned(TPasProcedure(Overloads[0]).ProcType) then
     Result := TPasProcedure(Overloads[0]).ProcType.TypeName
     Result := TPasProcedure(Overloads[0]).ProcType.TypeName
@@ -858,25 +865,25 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-function TPasProcedure.TypeName: String;
+function TPasProcedure.TypeName: string;
 begin
 begin
   Result := ProcType.TypeName;
   Result := ProcType.TypeName;
 end;
 end;
 
 
 
 
-function TPasConstructor.TypeName: String;
+function TPasConstructor.TypeName: string;
 begin
 begin
   Result := 'constructor';
   Result := 'constructor';
 end;
 end;
 
 
 
 
-function TPasDestructor.TypeName: String;
+function TPasDestructor.TypeName: string;
 begin
 begin
   Result := 'destructor';
   Result := 'destructor';
 end;
 end;
 
 
 
 
-constructor TPasProcedureImpl.Create(const AName: String; AParent: TPasElement);
+constructor TPasProcedureImpl.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   Locals := TList.Create;
   Locals := TList.Create;
@@ -899,24 +906,24 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-function TPasProcedureImpl.TypeName: String;
+function TPasProcedureImpl.TypeName: string;
 begin
 begin
   Result := ProcType.TypeName;
   Result := ProcType.TypeName;
 end;
 end;
 
 
 
 
-function TPasConstructorImpl.TypeName: String;
+function TPasConstructorImpl.TypeName: string;
 begin
 begin
   Result := 'constructor';
   Result := 'constructor';
 end;
 end;
 
 
-function TPasDestructorImpl.TypeName: String;
+function TPasDestructorImpl.TypeName: string;
 begin
 begin
   Result := 'destructor';
   Result := 'destructor';
 end;
 end;
 
 
 
 
-constructor TPasImplCommands.Create(const AName: String; AParent: TPasElement);
+constructor TPasImplCommands.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   Commands := TStringList.Create;
   Commands := TStringList.Create;
@@ -949,7 +956,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TPasImplBlock.Create(const AName: String; AParent: TPasElement);
+constructor TPasImplBlock.Create(const AName: string; AParent: TPasElement);
 begin
 begin
   inherited Create(AName, AParent);
   inherited Create(AName, AParent);
   Elements := TList.Create;
   Elements := TList.Create;
@@ -965,7 +972,7 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-function TPasImplBlock.AddCommand(const ACommand: String): TPasImplCommand;
+function TPasImplBlock.AddCommand(const ACommand: string): TPasImplCommand;
 begin
 begin
   Result := TPasImplCommand.Create('', Self);
   Result := TPasImplCommand.Create('', Self);
   Elements.Add(Result);
   Elements.Add(Result);
@@ -978,7 +985,7 @@ begin
   Elements.Add(Result);
   Elements.Add(Result);
 end;
 end;
 
 
-function TPasImplBlock.AddIfElse(const ACondition: String): TPasImplIfElse;
+function TPasImplBlock.AddIfElse(const ACondition: string): TPasImplIfElse;
 begin
 begin
   Result := TPasImplIfElse.Create('', Self);
   Result := TPasImplIfElse.Create('', Self);
   Elements.Add(Result);
   Elements.Add(Result);
@@ -986,7 +993,7 @@ begin
 end;
 end;
 
 
 function TPasImplBlock.AddForLoop(AVar: TPasVariable; const AStartValue,
 function TPasImplBlock.AddForLoop(AVar: TPasVariable; const AStartValue,
-  AEndValue: String): TPasImplForLoop;
+  AEndValue: string): TPasImplForLoop;
 begin
 begin
   Result := TPasImplForLoop.Create('', Self);
   Result := TPasImplForLoop.Create('', Self);
   Elements.Add(Result);
   Elements.Add(Result);
@@ -1001,7 +1008,7 @@ end;
 
 
   ---------------------------------------------------------------------}
   ---------------------------------------------------------------------}
 
 
-function TPasModule.GetDeclaration(full : boolean): String;
+function TPasModule.GetDeclaration(full : boolean): string;
 begin
 begin
   Result := 'Unit ' + Name;
   Result := 'Unit ' + Name;
 end;
 end;
@@ -1062,7 +1069,7 @@ begin
     Result:=Name+' = '+Result;
     Result:=Name+' = '+Result;
 end;
 end;
 
 
-Function IndentStrings(S : TStrings; indent : Integer) : String;
+Function IndentStrings(S : TStrings; indent : Integer) : string;
 
 
 Var
 Var
   I,CurrLen,CurrPos : Integer;
   I,CurrLen,CurrPos : Integer;
@@ -1144,7 +1151,7 @@ function TPasRecordType.GetDeclaration (full : boolean) : string;
 
 
 Var
 Var
   S,T : TStringList;
   S,T : TStringList;
-  temp : String;
+  temp : string;
   I,J : integer;
   I,J : integer;
 
 
 begin
 begin
@@ -1183,7 +1190,7 @@ end;
 procedure TPasProcedureType.GetArguments(List : TStrings);
 procedure TPasProcedureType.GetArguments(List : TStrings);
 
 
 Var
 Var
-  T : String;
+  T : string;
   I : Integer;
   I : Integer;
 
 
 begin
 begin
@@ -1227,7 +1234,7 @@ function TPasFunctionType.GetDeclaration (full : boolean) : string;
 
 
 Var
 Var
   S : TStringList;
   S : TStringList;
-  T : String;
+  T : string;
 
 
 begin
 begin
   S:=TStringList.Create;
   S:=TStringList.Create;
@@ -1281,7 +1288,7 @@ end;
 function TPasProperty.GetDeclaration (full : boolean) : string;
 function TPasProperty.GetDeclaration (full : boolean) : string;
 
 
 Var
 Var
-  S : String;
+  S : string;
   I : Integer;
   I : Integer;
 
 
 begin
 begin
@@ -1316,7 +1323,7 @@ end;
 
 
 Procedure TPasProcedure.GetModifiers(List : TStrings);
 Procedure TPasProcedure.GetModifiers(List : TStrings);
 
 
-  Procedure DoAdd(B : Boolean; S : String);
+  Procedure DoAdd(B : Boolean; S : string);
 
 
   begin
   begin
     if B then
     if B then
@@ -1354,7 +1361,36 @@ function TPasFunction.GetDeclaration (full : boolean) : string;
 
 
 Var
 Var
   S : TStringList;
   S : TStringList;
-  T : String;
+  T : string;
+
+begin
+  S:=TStringList.Create;
+  try
+    If Full then
+      S.Add(TypeName+' '+Name);
+    ProcType.GetArguments(S);
+    If Assigned((Proctype as TPasFunctionType).ResultEl) then
+      With TPasFunctionType(ProcType).ResultEl.ResultType do
+        begin
+        T:=' : ';
+        If (Name<>'') then
+          T:=T+Name
+        else
+          T:=T+GetDeclaration(False);
+        S.Add(T);
+        end;
+    GetModifiers(S);
+    Result:=IndentStrings(S,Length(S[0]));
+  finally
+    S.Free;
+  end;
+end;
+
+function TPasOperator.GetDeclaration (full : boolean) : string;
+
+Var
+  S : TStringList;
+  T : string;
 
 
 begin
 begin
   S:=TStringList.Create;
   S:=TStringList.Create;

+ 12 - 12
fcl/passrc/paswrite.pp

@@ -26,18 +26,18 @@ type
   private
   private
     FStream: TStream;
     FStream: TStream;
     IsStartOfLine: Boolean;
     IsStartOfLine: Boolean;
-    Indent, CurDeclSection: String;
+    Indent, CurDeclSection: string;
     DeclSectionStack: TList;
     DeclSectionStack: TList;
     procedure IncIndent;
     procedure IncIndent;
     procedure DecIndent;
     procedure DecIndent;
     procedure IncDeclSectionLevel;
     procedure IncDeclSectionLevel;
     procedure DecDeclSectionLevel;
     procedure DecDeclSectionLevel;
-    procedure PrepareDeclSection(const ADeclSection: String);
+    procedure PrepareDeclSection(const ADeclSection: string);
   public
   public
     constructor Create(AStream: TStream);
     constructor Create(AStream: TStream);
     destructor Destroy; override;
     destructor Destroy; override;
-    procedure wrt(const s: String);
-    procedure wrtln(const s: String);
+    procedure wrt(const s: string);
+    procedure wrtln(const s: string);
     procedure wrtln;
     procedure wrtln;
 
 
     procedure WriteElement(AElement: TPasElement);
     procedure WriteElement(AElement: TPasElement);
@@ -60,7 +60,7 @@ type
   end;
   end;
 
 
 
 
-procedure WritePasFile(AElement: TPasElement; const AFilename: String);
+procedure WritePasFile(AElement: TPasElement; const AFilename: string);
 procedure WritePasFile(AElement: TPasElement; AStream: TStream);
 procedure WritePasFile(AElement: TPasElement; AStream: TStream);
 
 
 
 
@@ -72,7 +72,7 @@ uses SysUtils;
 type
 type
   PDeclSectionStackElement = ^TDeclSectionStackElement;
   PDeclSectionStackElement = ^TDeclSectionStackElement;
   TDeclSectionStackElement = record
   TDeclSectionStackElement = record
-    LastDeclSection, LastIndent: String;
+    LastDeclSection, LastIndent: string;
   end;
   end;
 
 
 constructor TPasWriter.Create(AStream: TStream);
 constructor TPasWriter.Create(AStream: TStream);
@@ -96,7 +96,7 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-procedure TPasWriter.wrt(const s: String);
+procedure TPasWriter.wrt(const s: string);
 begin
 begin
   if IsStartOfLine then
   if IsStartOfLine then
   begin
   begin
@@ -108,9 +108,9 @@ begin
 end;
 end;
 
 
 const
 const
-  LF: String = #10;
+  LF: string = #10;
 
 
-procedure TPasWriter.wrtln(const s: String);
+procedure TPasWriter.wrtln(const s: string);
 begin
 begin
   wrt(s);
   wrt(s);
   Stream.Write(LF[1], 1);
   Stream.Write(LF[1], 1);
@@ -468,7 +468,7 @@ end;
 procedure TPasWriter.WriteImplCommands(ACommands: TPasImplCommands);
 procedure TPasWriter.WriteImplCommands(ACommands: TPasImplCommands);
 var
 var
   i: Integer;
   i: Integer;
-  s: String;
+  s: string;
 begin
 begin
   for i := 0 to ACommands.Commands.Count - 1 do
   for i := 0 to ACommands.Commands.Count - 1 do
   begin
   begin
@@ -572,7 +572,7 @@ begin
   Dispose(El);
   Dispose(El);
 end;
 end;
 
 
-procedure TPasWriter.PrepareDeclSection(const ADeclSection: String);
+procedure TPasWriter.PrepareDeclSection(const ADeclSection: string);
 begin
 begin
   if ADeclSection <> CurDeclSection then
   if ADeclSection <> CurDeclSection then
   begin
   begin
@@ -588,7 +588,7 @@ begin
 end;
 end;
 
 
 
 
-procedure WritePasFile(AElement: TPasElement; const AFilename: String);
+procedure WritePasFile(AElement: TPasElement; const AFilename: string);
 var
 var
   Stream: TFileStream;
   Stream: TFileStream;
 begin
 begin

+ 194 - 166
fcl/passrc/pparser.pp

@@ -47,36 +47,36 @@ type
   protected
   protected
     FPackage: TPasPackage;
     FPackage: TPasPackage;
   public
   public
-    function CreateElement(AClass: TPTreeElement; const AName: String;
-      AParent: TPasElement; const ASourceFilename: String;
+    function CreateElement(AClass: TPTreeElement; const AName: string;
+      AParent: TPasElement; const ASourceFilename: string;
       ASourceLinenumber: Integer): TPasElement;
       ASourceLinenumber: Integer): TPasElement;
-    function CreateElement(AClass: TPTreeElement; const AName: String;
+    function CreateElement(AClass: TPTreeElement; const AName: string;
       AParent: TPasElement; AVisibility: TPasMemberVisibility;
       AParent: TPasElement; AVisibility: TPasMemberVisibility;
-      const ASourceFilename: String; ASourceLinenumber: Integer): TPasElement;
+      const ASourceFilename: string; ASourceLinenumber: Integer): TPasElement;
       virtual; abstract;
       virtual; abstract;
-    function CreateFunctionType(const AName: String; AParent: TPasElement;
-      UseParentAsResultParent: Boolean; const ASourceFilename: String;
+    function CreateFunctionType(const AName,resultname: string; AParent: TPasElement;
+      UseParentAsResultParent: Boolean; const ASourceFilename: string;
       ASourceLinenumber: Integer): TPasFunctionType;
       ASourceLinenumber: Integer): TPasFunctionType;
-    function FindElement(const AName: String): TPasElement; virtual; abstract;
-    function FindModule(const AName: String): TPasModule; virtual;
+    function FindElement(const AName: string): TPasElement; virtual; abstract;
+    function FindModule(const AName: string): TPasModule; virtual;
     property Package: TPasPackage read FPackage;
     property Package: TPasPackage read FPackage;
   end;
   end;
 
 
   EParserError = class(Exception)
   EParserError = class(Exception)
   private
   private
-    FFilename: String;
+    FFilename: string;
     FRow, FColumn: Integer;
     FRow, FColumn: Integer;
   public
   public
-    constructor Create(const AReason, AFilename: String;
+    constructor Create(const AReason, AFilename: string;
       ARow, AColumn: Integer);
       ARow, AColumn: Integer);
-    property Filename: String read FFilename;
+    property Filename: string read FFilename;
     property Row: Integer read FRow;
     property Row: Integer read FRow;
     property Column: Integer read FColumn;
     property Column: Integer read FColumn;
   end;
   end;
 
 
 
 
 function ParseSource(AEngine: TPasTreeContainer;
 function ParseSource(AEngine: TPasTreeContainer;
-  const FPCCommandLine, OSTarget, CPUTarget: String): TPasModule;
+  const FPCCommandLine, OSTarget, CPUTarget: string): TPasModule;
 
 
 
 
 implementation
 implementation
@@ -87,42 +87,44 @@ type
 
 
   TDeclType = (declNone, declConst, declResourcestring, declType, declVar);
   TDeclType = (declNone, declConst, declResourcestring, declType, declVar);
 
 
+  Tproctype = (pt_procedure,pt_function,pt_operator);
+
   TPasParser = class
   TPasParser = class
   private
   private
     FFileResolver: TFileResolver;
     FFileResolver: TFileResolver;
     FScanner: TPascalScanner;
     FScanner: TPascalScanner;
     FEngine: TPasTreeContainer;
     FEngine: TPasTreeContainer;
     FCurToken: TToken;
     FCurToken: TToken;
-    FCurTokenString: String;
+    FCurTokenString: string;
     // UngetToken support:
     // UngetToken support:
     FTokenBuffer: array[0..1] of TToken;
     FTokenBuffer: array[0..1] of TToken;
-    FTokenStringBuffer: array[0..1] of String;
+    FTokenStringBuffer: array[0..1] of string;
     FTokenBufferIndex, FTokenBufferSize: Integer;
     FTokenBufferIndex, FTokenBufferSize: Integer;
 
 
-    procedure ParseExc(const Msg: String);
+    procedure ParseExc(const Msg: string);
   protected
   protected
-    function CreateElement(AClass: TPTreeElement; const AName: String;
+    function CreateElement(AClass: TPTreeElement; const AName: string;
       AParent: TPasElement): TPasElement;
       AParent: TPasElement): TPasElement;
-    function CreateElement(AClass: TPTreeElement; const AName: String;
+    function CreateElement(AClass: TPTreeElement; const AName: string;
       AParent: TPasElement; AVisibility: TPasMemberVisibility): TPasElement;
       AParent: TPasElement; AVisibility: TPasMemberVisibility): TPasElement;
   public
   public
     constructor Create(AScanner: TPascalScanner; AFileResolver: TFileResolver;
     constructor Create(AScanner: TPascalScanner; AFileResolver: TFileResolver;
       AEngine: TPasTreeContainer);
       AEngine: TPasTreeContainer);
-    function CurTokenName: String;
-    function CurTokenText: String;
+    function CurTokenName: string;
+    function CurTokenText: string;
     procedure NextToken;
     procedure NextToken;
     procedure UngetToken;
     procedure UngetToken;
     procedure ExpectToken(tk: TToken);
     procedure ExpectToken(tk: TToken);
-    function ExpectIdentifier: String;
+    function ExpectIdentifier: string;
 
 
-    function ParseType(Parent: TPasElement; Prefix : String): TPasType;
+    function ParseType(Parent: TPasElement; Prefix : string): TPasType;
     function ParseType(Parent: TPasElement): TPasType;
     function ParseType(Parent: TPasElement): TPasType;
     function ParseComplexType: TPasType;
     function ParseComplexType: TPasType;
     procedure ParseArrayType(Element: TPasArrayType);
     procedure ParseArrayType(Element: TPasArrayType);
-    function ParseExpression: String;
+    function ParseExpression: string;
     procedure AddProcOrFunction(ASection: TPasSection; AProc: TPasProcedure);
     procedure AddProcOrFunction(ASection: TPasSection; AProc: TPasProcedure);
     function CheckIfOverloaded(AOwner: TPasClassType;
     function CheckIfOverloaded(AOwner: TPasClassType;
-      const AName: String): TPasElement;
+      const AName: string): TPasElement;
 
 
     procedure ParseMain(var Module: TPasModule);
     procedure ParseMain(var Module: TPasModule);
     procedure ParseUnit(var Module: TPasModule);
     procedure ParseUnit(var Module: TPasModule);
@@ -136,11 +138,11 @@ type
     procedure ParseVarDecl(Parent: TPasElement; List: TList);
     procedure ParseVarDecl(Parent: TPasElement; List: TList);
     procedure ParseArgList(Parent: TPasElement; Args: TList; EndToken: TToken);
     procedure ParseArgList(Parent: TPasElement; Args: TList; EndToken: TToken);
     procedure ParseProcedureOrFunctionHeader(Parent: TPasElement;
     procedure ParseProcedureOrFunctionHeader(Parent: TPasElement;
-      Element: TPasProcedureType; IsFunction, OfObjectPossible: Boolean);
+      Element: TPasProcedureType; proctype:Tproctype; OfObjectPossible: Boolean);
     function ParseProcedureOrFunctionDecl(Parent: TPasElement;
     function ParseProcedureOrFunctionDecl(Parent: TPasElement;
-      IsFunction: Boolean): TPasProcedure;
+      proctype:Tproctype): TPasProcedure;
     procedure ParseRecordDecl(Parent: TPasRecordType);
     procedure ParseRecordDecl(Parent: TPasRecordType);
-    function ParseClassDecl(Parent: TPasElement; const AClassName: String;
+    function ParseClassDecl(Parent: TPasElement; const AClassName: string;
       AObjKind: TPasObjKind): TPasType;
       AObjKind: TPasObjKind): TPasType;
     procedure ParseProperty(Element:TPasElement);
     procedure ParseProperty(Element:TPasElement);
 
 
@@ -149,21 +151,21 @@ type
     property Engine: TPasTreeContainer read FEngine;
     property Engine: TPasTreeContainer read FEngine;
 
 
     property CurToken: TToken read FCurToken;
     property CurToken: TToken read FCurToken;
-    property CurTokenString: String read FCurTokenString;
+    property CurTokenString: string read FCurTokenString;
   end;
   end;
 
 
 
 
 function TPasTreeContainer.CreateElement(AClass: TPTreeElement;
 function TPasTreeContainer.CreateElement(AClass: TPTreeElement;
-  const AName: String; AParent: TPasElement; const ASourceFilename: String;
+  const AName: string; AParent: TPasElement; const ASourceFilename: string;
   ASourceLinenumber: Integer): TPasElement;
   ASourceLinenumber: Integer): TPasElement;
 begin
 begin
   Result := CreateElement(AClass, AName, AParent, visDefault, ASourceFilename,
   Result := CreateElement(AClass, AName, AParent, visDefault, ASourceFilename,
     ASourceLinenumber);
     ASourceLinenumber);
 end;
 end;
 
 
-function TPasTreeContainer.CreateFunctionType(const AName: String;
+function TPasTreeContainer.CreateFunctionType(const AName,resultname: string;
   AParent: TPasElement; UseParentAsResultParent: Boolean;
   AParent: TPasElement; UseParentAsResultParent: Boolean;
-  const ASourceFilename: String; ASourceLinenumber: Integer): TPasFunctionType;
+  const ASourceFilename: string; ASourceLinenumber: Integer): TPasFunctionType;
 var
 var
   ResultParent: TPasElement;
   ResultParent: TPasElement;
 begin
 begin
@@ -176,16 +178,16 @@ begin
     ResultParent := Result;
     ResultParent := Result;
 
 
   TPasFunctionType(Result).ResultEl :=
   TPasFunctionType(Result).ResultEl :=
-    TPasResultElement(CreateElement(TPasResultElement, 'Result', ResultParent,
+    TPasResultElement(CreateElement(TPasResultElement, resultname, ResultParent,
     ASourceFilename, ASourceLinenumber));
     ASourceFilename, ASourceLinenumber));
 end;
 end;
 
 
-function TPasTreeContainer.FindModule(const AName: String): TPasModule;
+function TPasTreeContainer.FindModule(const AName: string): TPasModule;
 begin
 begin
   Result := nil;
   Result := nil;
 end;
 end;
 
 
-constructor EParserError.Create(const AReason, AFilename: String;
+constructor EParserError.Create(const AReason, AFilename: string;
   ARow, AColumn: Integer);
   ARow, AColumn: Integer);
 begin
 begin
   inherited Create(AReason);
   inherited Create(AReason);
@@ -194,7 +196,7 @@ begin
   FColumn := AColumn;
   FColumn := AColumn;
 end;
 end;
 
 
-procedure TPasParser.ParseExc(const Msg: String);
+procedure TPasParser.ParseExc(const Msg: string);
 begin
 begin
   raise EParserError.Create(Format(SParserErrorAtToken, [Msg, CurTokenName]),
   raise EParserError.Create(Format(SParserErrorAtToken, [Msg, CurTokenName]),
     Scanner.CurFilename, Scanner.CurRow, Scanner.CurColumn);
     Scanner.CurFilename, Scanner.CurRow, Scanner.CurColumn);
@@ -209,7 +211,7 @@ begin
   FEngine := AEngine;
   FEngine := AEngine;
 end;
 end;
 
 
-function TPasParser.CurTokenName: String;
+function TPasParser.CurTokenName: string;
 begin
 begin
   if CurToken = tkIdentifier then
   if CurToken = tkIdentifier then
     Result := 'Identifier ' + Scanner.CurTokenString
     Result := 'Identifier ' + Scanner.CurTokenString
@@ -217,7 +219,7 @@ begin
     Result := TokenInfos[CurToken];
     Result := TokenInfos[CurToken];
 end;
 end;
 
 
-function TPasParser.CurTokenText: String;
+function TPasParser.CurTokenText: string;
 begin
 begin
   case CurToken of
   case CurToken of
     tkIdentifier, tkString, tkNumber, tkChar:
     tkIdentifier, tkString, tkNumber, tkChar:
@@ -281,7 +283,7 @@ begin
     ParseExc(Format(SParserExpectTokenError, [TokenInfos[tk]]));
     ParseExc(Format(SParserExpectTokenError, [TokenInfos[tk]]));
 end;
 end;
 
 
-function TPasParser.ExpectIdentifier: String;
+function TPasParser.ExpectIdentifier: string;
 begin
 begin
   ExpectToken(tkIdentifier);
   ExpectToken(tkIdentifier);
   Result := CurTokenString;
   Result := CurTokenString;
@@ -293,7 +295,7 @@ begin
   Result:=ParseType(Parent,'');
   Result:=ParseType(Parent,'');
 end;
 end;
 
 
-function TPasParser.ParseType(Parent: TPasElement; Prefix : String): TPasType;
+function TPasParser.ParseType(Parent: TPasElement; Prefix : string): TPasType;
 
 
   procedure ParseRange;
   procedure ParseRange;
   begin
   begin
@@ -309,7 +311,7 @@ function TPasParser.ParseType(Parent: TPasElement; Prefix : String): TPasType;
   end;
   end;
 
 
 var
 var
-  Name, s: String;
+  Name, s: string;
   EnumValue: TPasEnumValue;
   EnumValue: TPasEnumValue;
   Ref: TPasElement;
   Ref: TPasElement;
 begin
 begin
@@ -339,7 +341,7 @@ begin
         else if s = 'LONGWORD' then Name := 'LongWord'
         else if s = 'LONGWORD' then Name := 'LongWord'
         else if s = 'SHORTINT' then Name := 'ShortInt'
         else if s = 'SHORTINT' then Name := 'ShortInt'
         else if s = 'SMALLINT' then Name := 'SmallInt'
         else if s = 'SMALLINT' then Name := 'SmallInt'
-        else if s = 'STRING' then Name := 'String'
+        else if s = 'string' then Name := 'string'
         else if s = 'WORD' then Name := 'Word'
         else if s = 'WORD' then Name := 'Word'
         else
         else
           Ref := Engine.FindElement(Name);
           Ref := Engine.FindElement(Name);
@@ -353,7 +355,7 @@ begin
           Result := TPasUnresolvedTypeRef(CreateElement(TPasUnresolvedTypeRef, Name, nil));
           Result := TPasUnresolvedTypeRef(CreateElement(TPasUnresolvedTypeRef, Name, nil));
 
 
         // !!!: Doesn't make sense for resolved types
         // !!!: Doesn't make sense for resolved types
-        if Name = 'String' then
+        if Name = 'string' then
         begin
         begin
           NextToken;
           NextToken;
           if CurToken = tkSquaredBraceOpen then
           if CurToken = tkSquaredBraceOpen then
@@ -379,7 +381,7 @@ begin
     tkBraceOpen:
     tkBraceOpen:
       begin
       begin
         Result := TPasEnumType(CreateElement(TPasEnumType, '', Parent));
         Result := TPasEnumType(CreateElement(TPasEnumType, '', Parent));
-        while True do
+        while true do
         begin
         begin
           NextToken;
           NextToken;
           EnumValue := TPasEnumValue(CreateElement(TPasEnumValue,
           EnumValue := TPasEnumValue(CreateElement(TPasEnumValue,
@@ -418,8 +420,8 @@ begin
         Result := TPasProcedureType(
         Result := TPasProcedureType(
           CreateElement(TPasProcedureType, '', Parent));
           CreateElement(TPasProcedureType, '', Parent));
         try
         try
-          ParseProcedureOrFunctionHeader(Result,
-            TPasProcedureType(Result), False, True);
+          ParseProcedureOrFunctionHeader(Result,TPasProcedureType(Result),
+                                         pt_procedure, true);
         except
         except
           Result.Free;
           Result.Free;
           raise;
           raise;
@@ -427,11 +429,11 @@ begin
       end;
       end;
     tkFunction:
     tkFunction:
       begin
       begin
-        Result := Engine.CreateFunctionType('', Parent, False,
+        Result := Engine.CreateFunctionType('','result', Parent, false,
           Scanner.CurFilename, Scanner.CurRow);
           Scanner.CurFilename, Scanner.CurRow);
         try
         try
-          ParseProcedureOrFunctionHeader(Result,
-            TPasFunctionType(Result), True, True);
+          ParseProcedureOrFunctionHeader(Result,TPasFunctionType(Result),
+                                         pt_function, true);
         except
         except
           Result.Free;
           Result.Free;
           raise;
           raise;
@@ -453,16 +455,16 @@ begin
     tkProcedure:
     tkProcedure:
       begin
       begin
         Result := TPasProcedureType(CreateElement(TPasProcedureType, '', nil));
         Result := TPasProcedureType(CreateElement(TPasProcedureType, '', nil));
-        ParseProcedureOrFunctionHeader(Result,
-          TPasProcedureType(Result), False, True);
+        ParseProcedureOrFunctionHeader(Result, TPasProcedureType(Result),
+                                       pt_procedure, true);
         UngetToken;        // Unget semicolon
         UngetToken;        // Unget semicolon
       end;
       end;
     tkFunction:
     tkFunction:
       begin
       begin
-        Result := Engine.CreateFunctionType('', nil, False, Scanner.CurFilename,
+        Result := Engine.CreateFunctionType('','result', nil, false, Scanner.CurFilename,
           Scanner.CurRow);
           Scanner.CurRow);
-        ParseProcedureOrFunctionHeader(Result,
-          TPasFunctionType(Result), True, True);
+        ParseProcedureOrFunctionHeader(Result, TPasFunctionType(Result),
+                                       pt_function, true);
         UngetToken;        // Unget semicolon
         UngetToken;        // Unget semicolon
       end;
       end;
     else
     else
@@ -477,7 +479,7 @@ end;
 procedure TPasParser.ParseArrayType(Element: TPasArrayType);
 procedure TPasParser.ParseArrayType(Element: TPasArrayType);
 
 
 Var
 Var
-  S : String;
+  S : string;
 
 
 begin
 begin
   NextToken;
   NextToken;
@@ -510,16 +512,16 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TPasParser.ParseExpression: String;
+function TPasParser.ParseExpression: string;
 var
 var
   BracketLevel: Integer;
   BracketLevel: Integer;
   MayAppendSpace, AppendSpace, NextAppendSpace: Boolean;
   MayAppendSpace, AppendSpace, NextAppendSpace: Boolean;
 begin
 begin
   SetLength(Result, 0);
   SetLength(Result, 0);
   BracketLevel := 0;
   BracketLevel := 0;
-  MayAppendSpace := False;
-  AppendSpace := False;
-  while True do
+  MayAppendSpace := false;
+  AppendSpace := false;
+  while true do
   begin
   begin
     NextToken;
     NextToken;
     { !!!: Does not detect when normal brackets and square brackets are mixed
     { !!!: Does not detect when normal brackets and square brackets are mixed
@@ -537,7 +539,7 @@ begin
 
 
     if MayAppendSpace then
     if MayAppendSpace then
     begin
     begin
-      NextAppendSpace := False;
+      NextAppendSpace := false;
       case CurToken of
       case CurToken of
         tkBraceOpen, tkBraceClose, tkDivision, tkEqual, tkCaret, tkAnd, tkAs,
         tkBraceOpen, tkBraceClose, tkDivision, tkEqual, tkCaret, tkAnd, tkAs,
           tkDiv, tkIn, tkIs, tkMinus, tkMod, tkMul, tkNot, tkOf, tkOn,
           tkDiv, tkIn, tkIs, tkMinus, tkMod, tkMul, tkNot, tkOf, tkOn,
@@ -545,15 +547,15 @@ begin
 {        tkPlus.._ASSIGNMENT, _UNEQUAL, tkPlusASN.._XORASN, _AS, _AT, _IN, _IS,
 {        tkPlus.._ASSIGNMENT, _UNEQUAL, tkPlusASN.._XORASN, _AS, _AT, _IN, _IS,
           tkOf, _ON, _OR, _AND, _DIV, _MOD, _NOT, _SHL, _SHR, _XOR:}
           tkOf, _ON, _OR, _AND, _DIV, _MOD, _NOT, _SHL, _SHR, _XOR:}
           begin
           begin
-            AppendSpace := True;
-            NextAppendSpace := True;
+            AppendSpace := true;
+            NextAppendSpace := true;
           end;
           end;
       end;
       end;
       if AppendSpace then
       if AppendSpace then
         Result := Result + ' ';
         Result := Result + ' ';
       AppendSpace := NextAppendSpace;
       AppendSpace := NextAppendSpace;
     end else
     end else
-      MayAppendSpace := True;
+      MayAppendSpace := true;
     if CurToken=tkString then
     if CurToken=tkString then
       begin
       begin
       If (Length(CurTokenText)>0) and (CurTokenText[1]=#0) then
       If (Length(CurTokenText)>0) and (CurTokenText[1]=#0) then
@@ -601,7 +603,7 @@ end;
 
 
 // Returns the parent for an element which is to be created
 // Returns the parent for an element which is to be created
 function TPasParser.CheckIfOverloaded(AOwner: TPasClassType;
 function TPasParser.CheckIfOverloaded(AOwner: TPasClassType;
-  const AName: String): TPasElement;
+  const AName: string): TPasElement;
 var
 var
   i: Integer;
   i: Integer;
   Member: TPasElement;
   Member: TPasElement;
@@ -663,7 +665,7 @@ begin
   Section := TPasSection(CreateElement(TPasSection, '', Module));
   Section := TPasSection(CreateElement(TPasSection, '', Module));
   Module.InterfaceSection := Section;
   Module.InterfaceSection := Section;
   CurBlock := declNone;
   CurBlock := declNone;
-  while True do
+  while true do
   begin
   begin
     NextToken;
     NextToken;
     if CurToken = tkImplementation then
     if CurToken = tkImplementation then
@@ -681,12 +683,12 @@ begin
         CurBlock := declVar;
         CurBlock := declVar;
       tkProcedure:
       tkProcedure:
         begin
         begin
-          AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, False));
+          AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, pt_procedure));
           CurBlock := declNone;
           CurBlock := declNone;
         end;
         end;
       tkFunction:
       tkFunction:
         begin
         begin
-          AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, True));
+          AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, pt_function));
           CurBlock := declNone;
           CurBlock := declNone;
         end;
         end;
       tkProperty:
       tkProperty:
@@ -696,15 +698,7 @@ begin
         end;
         end;
       tkOperator:
       tkOperator:
         begin
         begin
-          // !!!: Not supported yet
-          i := 0;
-          repeat
-            NextToken;
-            if CurToken = tkBraceOpen then
-              Inc(i)
-            else if CurToken = tkBraceClose then
-              Dec(i);
-          until (CurToken = tkSemicolon) and (i = 0);
+          AddProcOrFunction(Section, ParseProcedureOrFunctionDecl(Section, pt_operator));
           CurBlock := declNone;
           CurBlock := declNone;
         end;
         end;
       tkIdentifier:
       tkIdentifier:
@@ -788,10 +782,10 @@ end;
 // Starts after the "uses" token
 // Starts after the "uses" token
 procedure TPasParser.ParseUsesList(ASection: TPasSection);
 procedure TPasParser.ParseUsesList(ASection: TPasSection);
 var
 var
-  UnitName: String;
+  UnitName: string;
   Element: TPasElement;
   Element: TPasElement;
 begin
 begin
-  while True do
+  while true do
   begin
   begin
     UnitName := ExpectIdentifier;
     UnitName := ExpectIdentifier;
 
 
@@ -849,7 +843,7 @@ end;
 // Starts after the type name
 // Starts after the type name
 function TPasParser.ParseTypeDecl(Parent: TPasElement): TPasType;
 function TPasParser.ParseTypeDecl(Parent: TPasElement): TPasType;
 var
 var
-  TypeName: String;
+  TypeName: string;
 
 
   procedure ParseRange;
   procedure ParseRange;
   begin
   begin
@@ -867,19 +861,19 @@ var
 
 
 var
 var
   EnumValue: TPasEnumValue;
   EnumValue: TPasEnumValue;
-  Prefix : String;
+  Prefix : string;
   HadPackedModifier : Boolean;           // 12/04/04 - Dave - Added
   HadPackedModifier : Boolean;           // 12/04/04 - Dave - Added
 
 
 begin
 begin
   TypeName := CurTokenString;
   TypeName := CurTokenString;
   ExpectToken(tkEqual);
   ExpectToken(tkEqual);
   NextToken;
   NextToken;
-  HadPackedModifier := False;     { Assume not present }
+  HadPackedModifier := false;     { Assume not present }
   if CurToken = tkPacked then     { If PACKED modifier }
   if CurToken = tkPacked then     { If PACKED modifier }
      begin                        { Handle PACKED modifier for all situations }
      begin                        { Handle PACKED modifier for all situations }
      NextToken;                   { Move to next token for rest of parse }
      NextToken;                   { Move to next token for rest of parse }
      if CurToken in [tkArray, tkRecord, tkObject, tkClass] then  { If allowed }
      if CurToken in [tkArray, tkRecord, tkObject, tkClass] then  { If allowed }
-       HadPackedModifier := True  { rememeber for later }
+       HadPackedModifier := true  { rememeber for later }
      else                         { otherwise, syntax error }
      else                         { otherwise, syntax error }
        ParseExc(Format(SParserExpectTokenError,['ARRAY, RECORD, OBJECT or CLASS']))
        ParseExc(Format(SParserExpectTokenError,['ARRAY, RECORD, OBJECT or CLASS']))
      end;
      end;
@@ -968,7 +962,7 @@ begin
           ParseRange;
           ParseRange;
         end;
         end;
       end;
       end;
-{    _STRING, _FILE:
+{    _string, _FILE:
       begin
       begin
         Result := TPasAliasType(CreateElement(TPasAliasType, TypeName, Parent));
         Result := TPasAliasType(CreateElement(TPasAliasType, TypeName, Parent));
         UngetToken;
         UngetToken;
@@ -1003,7 +997,7 @@ begin
       begin
       begin
         Result := TPasEnumType(CreateElement(TPasEnumType, TypeName, Parent));
         Result := TPasEnumType(CreateElement(TPasEnumType, TypeName, Parent));
         try
         try
-          while True do
+          while true do
           begin
           begin
             NextToken;
             NextToken;
             EnumValue := TPasEnumValue(CreateElement(TPasEnumValue,
             EnumValue := TPasEnumValue(CreateElement(TPasEnumValue,
@@ -1035,8 +1029,8 @@ begin
         Result := TPasProcedureType(CreateElement(TPasProcedureType, TypeName,
         Result := TPasProcedureType(CreateElement(TPasProcedureType, TypeName,
           Parent));
           Parent));
         try
         try
-          ParseProcedureOrFunctionHeader(Result,
-            TPasProcedureType(Result), False, True);
+          ParseProcedureOrFunctionHeader(Result,TPasProcedureType(Result),
+                                         pt_procedure, true);
         except
         except
           Result.Free;
           Result.Free;
           raise;
           raise;
@@ -1044,11 +1038,11 @@ begin
       end;
       end;
     tkFunction:
     tkFunction:
       begin
       begin
-        Result := Engine.CreateFunctionType(TypeName, Parent, False,
+        Result := Engine.CreateFunctionType(TypeName, 'result', Parent, false,
           Scanner.CurFilename, Scanner.CurRow);
           Scanner.CurFilename, Scanner.CurRow);
         try
         try
-          ParseProcedureOrFunctionHeader(Result,
-            TPasFunctionType(Result), True, True);
+          ParseProcedureOrFunctionHeader(Result, TPasFunctionType(Result),
+                                         pt_function, true);
         except
         except
           Result.Free;
           Result.Free;
           raise;
           raise;
@@ -1091,7 +1085,7 @@ var
 begin
 begin
   VarNames := TStringList.Create;
   VarNames := TStringList.Create;
   try
   try
-    while True do
+    while true do
     begin
     begin
       VarNames.Add(CurTokenString);
       VarNames.Add(CurTokenString);
       NextToken;
       NextToken;
@@ -1128,10 +1122,10 @@ procedure TPasParser.ParseVarDecl(Parent: TPasElement; List: TList);
 var
 var
   i: Integer;
   i: Integer;
   VarType: TPasType;
   VarType: TPasType;
-  Value, S: String;
+  Value, S: string;
   M: string;
   M: string;
 begin
 begin
-  while True do
+  while true do
   begin
   begin
     List.Add(CreateElement(TPasVariable, CurTokenString, Parent));
     List.Add(CreateElement(TPasVariable, CurTokenString, Parent));
     NextToken;
     NextToken;
@@ -1168,7 +1162,7 @@ begin
 
 
   ExpectToken(tkSemicolon);
   ExpectToken(tkSemicolon);
   M := '';
   M := '';
-  while True do
+  while true do
   begin
   begin
     NextToken;
     NextToken;
     if CurToken = tkIdentifier then
     if CurToken = tkIdentifier then
@@ -1229,19 +1223,19 @@ procedure TPasParser.ParseArgList(Parent: TPasElement; Args: TList; EndToken: TT
 var
 var
   ArgNames: TStringList;
   ArgNames: TStringList;
   IsUntyped: Boolean;
   IsUntyped: Boolean;
-  Name, Value: String;
+  Name, Value: string;
   i: Integer;
   i: Integer;
   Arg: TPasArgument;
   Arg: TPasArgument;
   Access: TArgumentAccess;
   Access: TArgumentAccess;
   ArgType: TPasType;
   ArgType: TPasType;
 begin
 begin
-  while True do
+  while true do
   begin
   begin
     ArgNames := TStringList.Create;
     ArgNames := TStringList.Create;
     Access := argDefault;
     Access := argDefault;
-    IsUntyped := False;
+    IsUntyped := false;
     ArgType := nil;
     ArgType := nil;
-    while True do
+    while true do
     begin
     begin
       NextToken;
       NextToken;
       if CurToken = tkConst then
       if CurToken = tkConst then
@@ -1269,7 +1263,7 @@ begin
       begin
       begin
         // found an untyped const or var argument
         // found an untyped const or var argument
         UngetToken;
         UngetToken;
-        IsUntyped := True;
+        IsUntyped := true;
         break
         break
       end
       end
       else if CurToken <> tkComma then
       else if CurToken <> tkComma then
@@ -1308,37 +1302,54 @@ end;
 // Next token is expected to be a "(", ";" or for a function ":". The caller
 // Next token is expected to be a "(", ";" or for a function ":". The caller
 // will get the token after the final ";" as next token.
 // will get the token after the final ";" as next token.
 procedure TPasParser.ParseProcedureOrFunctionHeader(Parent: TPasElement;
 procedure TPasParser.ParseProcedureOrFunctionHeader(Parent: TPasElement;
-  Element: TPasProcedureType; IsFunction, OfObjectPossible: Boolean);
+  Element: TPasProcedureType; proctype:Tproctype; OfObjectPossible: Boolean);
+
 begin
 begin
   NextToken;
   NextToken;
-  if IsFunction then
-  begin
-    if CurToken = tkBraceOpen then
-    begin
-      ParseArgList(Parent, Element.Args, tkBraceClose);
-      ExpectToken(tkColon);
-    end else if CurToken <> tkColon then
-      ParseExc(SParserExpectedLBracketColon);
-    if Assigned(Element) then        // !!!
-      TPasFunctionType(Element).ResultEl.ResultType := ParseType(Parent)
-    else
-      ParseType(nil);
-  end else
-  begin
-    if CurToken = tkBraceOpen then
-    begin
-      ParseArgList(Element, Element.Args, tkBraceClose);
-    end else if (CurToken = tkSemicolon) or (OfObjectPossible and (CurToken = tkOf)) then
-      UngetToken
-    else
-      ParseExc(SParserExpectedLBracketSemicolon);
+  case proctype of
+    pt_function:
+      begin
+        if CurToken = tkBraceOpen then
+        begin
+          ParseArgList(Parent, Element.Args, tkBraceClose);
+          ExpectToken(tkColon);
+        end else if CurToken <> tkColon then
+          ParseExc(SParserExpectedLBracketColon);
+        if Assigned(Element) then        // !!!
+          TPasFunctionType(Element).ResultEl.ResultType := ParseType(Parent)
+        else
+          ParseType(nil);
+      end;
+    pt_procedure:
+      begin
+        if CurToken = tkBraceOpen then
+        begin
+          ParseArgList(Element, Element.Args, tkBraceClose);
+        end else if (CurToken = tkSemicolon) or (OfObjectPossible and (CurToken = tkOf)) then
+          UngetToken
+        else
+          ParseExc(SParserExpectedLBracketSemicolon);
+      end;
+    pt_operator:
+      begin
+        ParseArgList(Parent, Element.Args, tkBraceClose);
+        
+        TPasFunctionType(Element).ResultEl.name := ExpectIdentifier;
+            
+        if CurToken <> tkColon then
+          ParseExc(SParserExpectedLBracketColon);
+        if Assigned(Element) then        // !!!
+          TPasFunctionType(Element).ResultEl.ResultType := ParseType(Parent)
+        else
+          ParseType(nil);
+      end;
   end;
   end;
 
 
   NextToken;
   NextToken;
   if OfObjectPossible and (CurToken = tkOf) then
   if OfObjectPossible and (CurToken = tkOf) then
   begin
   begin
     ExpectToken(tkObject);
     ExpectToken(tkObject);
-    Element.IsOfObject := True;
+    Element.IsOfObject := true;
   end else
   end else
     UngetToken;
     UngetToken;
 
 
@@ -1352,7 +1363,7 @@ begin
 
 
   ExpectToken(tkSemicolon);
   ExpectToken(tkSemicolon);
 
 
-  while True do
+  while true do
   begin
   begin
     NextToken;
     NextToken;
     if (CurToken = tkIdentifier) and (UpperCase(CurTokenString) = 'CDECL') then
     if (CurToken = tkIdentifier) and (UpperCase(CurTokenString) = 'CDECL') then
@@ -1375,7 +1386,7 @@ begin
     end else if Parent.InheritsFrom(TPasProcedure) and
     end else if Parent.InheritsFrom(TPasProcedure) and
       (CurToken = tkIdentifier) and (UpperCase(CurTokenString) = 'OVERLOAD') then
       (CurToken = tkIdentifier) and (UpperCase(CurTokenString) = 'OVERLOAD') then
     begin
     begin
-      TPasProcedure(Parent).IsOverload := True;
+      TPasProcedure(Parent).IsOverload := true;
       ExpectToken(tkSemicolon);
       ExpectToken(tkSemicolon);
     end else
     end else
     begin
     begin
@@ -1388,11 +1399,11 @@ end;
 
 
 procedure TPasParser.ParseProperty(Element:TPasElement);
 procedure TPasParser.ParseProperty(Element:TPasElement);
 
 
-  function GetAccessorName: String;
+  function GetAccessorName: string;
   begin
   begin
     ExpectIdentifier;
     ExpectIdentifier;
     Result := CurTokenString;
     Result := CurTokenString;
-    while True do
+    while true do
     begin
     begin
       NextToken;
       NextToken;
       if CurToken = tkDot then
       if CurToken = tkDot then
@@ -1454,9 +1465,9 @@ begin
   begin
   begin
           NextToken;
           NextToken;
           if CurToken = tkTrue then
           if CurToken = tkTrue then
-          TPasProperty(Element).StoredAccessorName := 'True'
+          TPasProperty(Element).StoredAccessorName := 'true'
           else if CurToken = tkFalse then
           else if CurToken = tkFalse then
-          TPasProperty(Element).StoredAccessorName := 'False'
+          TPasProperty(Element).StoredAccessorName := 'false'
           else if CurToken = tkIdentifier then
           else if CurToken = tkIdentifier then
           TPasProperty(Element).StoredAccessorName := CurTokenString
           TPasProperty(Element).StoredAccessorName := CurTokenString
           else
           else
@@ -1493,8 +1504,8 @@ begin
   NextToken;
   NextToken;
   if CurToken = tkSemicolon then
   if CurToken = tkSemicolon then
   begin
   begin
-          TPasProperty(Element).IsDefault := True;
-          UngetToken;
+  TPasProperty(Element).IsDefault := true;
+  UngetToken;
   end else
   end else
   begin
   begin
           UngetToken;
           UngetToken;
@@ -1507,24 +1518,35 @@ end;
 
 
 // Starts after the "procedure" or "function" token
 // Starts after the "procedure" or "function" token
 function TPasParser.ParseProcedureOrFunctionDecl(Parent: TPasElement;
 function TPasParser.ParseProcedureOrFunctionDecl(Parent: TPasElement;
-  IsFunction: Boolean): TPasProcedure;
+  proctype: Tproctype): TPasProcedure;
 var
 var
-  Name: String;
+  Name: string;
 begin
 begin
-  Name := ExpectIdentifier;
-  if IsFunction then
-  begin
-    Result := TPasFunction(CreateElement(TPasFunction, Name, Parent));
-    Result.ProcType := Engine.CreateFunctionType('', Result, True,
-      Scanner.CurFilename, Scanner.CurRow);
-  end else
-  begin
-    Result := TPasProcedure(CreateElement(TPasProcedure, Name, Parent));
-    Result.ProcType := TPasProcedureType(CreateElement(TPasProcedureType, '',
-      Result));
+  case proctype of
+    pt_function:
+      begin
+        Name := ExpectIdentifier;
+        Result := TPasFunction(CreateElement(TPasFunction, Name, Parent));
+        Result.ProcType := Engine.CreateFunctionType('', 'result', Result, true,
+           Scanner.CurFilename, Scanner.CurRow);
+      end;
+    pt_procedure:
+      begin
+        Name := ExpectIdentifier;
+        Result := TPasProcedure(CreateElement(TPasProcedure, Name, Parent));
+        Result.ProcType := TPasProcedureType(CreateElement(TPasProcedureType, '',
+           Result));
+      end;
+    pt_operator:
+      begin
+        name := tokeninfos[curtoken];
+        Result := TPasOperator(CreateElement(TPasOperator, Name, Parent));
+        Result.ProcType := Engine.CreateFunctionType('', '__INVALID__', Result, true,
+           Scanner.CurFilename, Scanner.CurRow);
+      end;
   end;
   end;
 
 
-  ParseProcedureOrFunctionHeader(Result, Result.ProcType, IsFunction, False);
+  ParseProcedureOrFunctionHeader(Result, Result.ProcType, proctype, false);
 end;
 end;
 
 
 // Starts after the "record" token
 // Starts after the "record" token
@@ -1535,7 +1557,7 @@ Var
   CCount : Integer;
   CCount : Integer;
 
 
 begin
 begin
-  while True do
+  while true do
   begin
   begin
     if CurToken = tkEnd then
     if CurToken = tkEnd then
       break;
       break;
@@ -1562,15 +1584,16 @@ end;
 
 
 // Starts after the "class" token
 // Starts after the "class" token
 function TPasParser.ParseClassDecl(Parent: TPasElement;
 function TPasParser.ParseClassDecl(Parent: TPasElement;
-  const AClassName: String; AObjKind: TPasObjKind): TPasType;
+  const AClassName: string; AObjKind: TPasObjKind): TPasType;
 var
 var
   CurVisibility: TPasMemberVisibility;
   CurVisibility: TPasMemberVisibility;
+  pt: Tproctype;
 
 
-  procedure ProcessMethod(const MethodTypeName: String; HasReturnValue: Boolean);
+  procedure ProcessMethod(const MethodTypeName: string; HasReturnValue: Boolean);
   var
   var
     Owner: TPasElement;
     Owner: TPasElement;
     Proc: TPasProcedure;
     Proc: TPasProcedure;
-    s: String;
+    s: string;
   begin
   begin
     ExpectIdentifier;
     ExpectIdentifier;
     Owner := CheckIfOverloaded(TPasClassType(Result), CurTokenString);
     Owner := CheckIfOverloaded(TPasClassType(Result), CurTokenString);
@@ -1578,7 +1601,7 @@ var
     begin
     begin
       Proc := TPasFunction(CreateElement(TPasFunction, CurTokenString, Owner,
       Proc := TPasFunction(CreateElement(TPasFunction, CurTokenString, Owner,
         CurVisibility));
         CurVisibility));
-      Proc.ProcType := Engine.CreateFunctionType( '', Proc, True,
+      Proc.ProcType := Engine.CreateFunctionType( '', 'result', Proc, true,
         Scanner.CurFilename, Scanner.CurRow);
         Scanner.CurFilename, Scanner.CurRow);
     end else
     end else
     begin
     begin
@@ -1600,27 +1623,32 @@ var
     else
     else
       TPasClassType(Result).Members.Add(Proc);
       TPasClassType(Result).Members.Add(Proc);
 
 
-    ParseProcedureOrFunctionHeader(Proc, Proc.ProcType, HasReturnValue, False);
+    if hasreturnvalue then
+      pt:=pt_function
+    else
+      pt:=pt_procedure;
+
+    ParseProcedureOrFunctionHeader(Proc, Proc.ProcType, pt, false);
 
 
-    while True do
+    while true do
     begin
     begin
       NextToken;
       NextToken;
       if CurToken = tkIdentifier then
       if CurToken = tkIdentifier then
       begin
       begin
         s := UpperCase(CurTokenString);
         s := UpperCase(CurTokenString);
         if s = 'VIRTUAL' then
         if s = 'VIRTUAL' then
-          Proc.IsVirtual := True
+          Proc.IsVirtual := true
         else if s = 'DYNAMIC' then
         else if s = 'DYNAMIC' then
-          Proc.IsDynamic := True
+          Proc.IsDynamic := true
         else if s = 'ABSTRACT' then
         else if s = 'ABSTRACT' then
-          Proc.IsAbstract := True
+          Proc.IsAbstract := true
         else if s = 'OVERRIDE' then
         else if s = 'OVERRIDE' then
-          Proc.IsOverride := True
+          Proc.IsOverride := true
         else if s = 'OVERLOAD' then
         else if s = 'OVERLOAD' then
-          Proc.IsOverload := True
+          Proc.IsOverload := true
         else if s = 'MESSAGE' then
         else if s = 'MESSAGE' then
         begin
         begin
-          Proc.IsMessage := True;
+          Proc.IsMessage := true;
           repeat
           repeat
             NextToken;
             NextToken;
           until CurToken = tkSemicolon;
           until CurToken = tkSemicolon;
@@ -1644,7 +1672,7 @@ var
   end;
   end;
 
 
 var
 var
-  s, SourceFilename: String;
+  s, SourceFilename: string;
   i, SourceLinenumber: Integer;
   i, SourceLinenumber: Integer;
   VarList: TList;
   VarList: TList;
   Element: TPasElement;
   Element: TPasElement;
@@ -1677,7 +1705,7 @@ begin
     if CurToken = tkBraceOpen then
     if CurToken = tkBraceOpen then
     begin
     begin
       TPasClassType(Result).AncestorType := ParseType(nil);
       TPasClassType(Result).AncestorType := ParseType(nil);
-      while True do
+      while true do
       begin
       begin
         NextToken;
         NextToken;
         if CurToken = tkBraceClose then
         if CurToken = tkBraceClose then
@@ -1726,13 +1754,13 @@ begin
               end;
               end;
             end;
             end;
           tkProcedure:
           tkProcedure:
-            ProcessMethod('procedure', False);
+            ProcessMethod('procedure', false);
           tkFunction:
           tkFunction:
-            ProcessMethod('function', True);
+            ProcessMethod('function', true);
           tkConstructor:
           tkConstructor:
-            ProcessMethod('constructor', False);
+            ProcessMethod('constructor', false);
           tkDestructor:
           tkDestructor:
-            ProcessMethod('destructor', False);
+            ProcessMethod('destructor', false);
           tkProperty:
           tkProperty:
             begin
             begin
               ExpectIdentifier;
               ExpectIdentifier;
@@ -1752,14 +1780,14 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TPasParser.CreateElement(AClass: TPTreeElement; const AName: String;
+function TPasParser.CreateElement(AClass: TPTreeElement; const AName: string;
   AParent: TPasElement): TPasElement;
   AParent: TPasElement): TPasElement;
 begin
 begin
   Result := Engine.CreateElement(AClass, AName, AParent,
   Result := Engine.CreateElement(AClass, AName, AParent,
     Scanner.CurFilename, Scanner.CurRow);
     Scanner.CurFilename, Scanner.CurRow);
 end;
 end;
 
 
-function TPasParser.CreateElement(AClass: TPTreeElement; const AName: String;
+function TPasParser.CreateElement(AClass: TPTreeElement; const AName: string;
   AParent: TPasElement; AVisibility: TPasMemberVisibility): TPasElement;
   AParent: TPasElement; AVisibility: TPasMemberVisibility): TPasElement;
 begin
 begin
   Result := Engine.CreateElement(AClass, AName, AParent, AVisibility,
   Result := Engine.CreateElement(AClass, AName, AParent, AVisibility,
@@ -1768,18 +1796,18 @@ end;
 
 
 
 
 function ParseSource(AEngine: TPasTreeContainer;
 function ParseSource(AEngine: TPasTreeContainer;
-  const FPCCommandLine, OSTarget, CPUTarget: String): TPasModule;
+  const FPCCommandLine, OSTarget, CPUTarget: string): TPasModule;
 var
 var
   FileResolver: TFileResolver;
   FileResolver: TFileResolver;
   Parser: TPasParser;
   Parser: TPasParser;
   Start, CurPos: PChar;
   Start, CurPos: PChar;
-  Filename: String;
+  Filename: string;
   Scanner: TPascalScanner;
   Scanner: TPascalScanner;
 
 
   procedure ProcessCmdLinePart;
   procedure ProcessCmdLinePart;
   var
   var
     l: Integer;
     l: Integer;
-    s: String;
+    s: string;
   begin
   begin
     l := CurPos - Start;
     l := CurPos - Start;
     SetLength(s, l);
     SetLength(s, l);
@@ -1804,7 +1832,7 @@ var
   end;
   end;
 
 
 var
 var
-  s: String;
+  s: string;
 begin
 begin
   Result := nil;
   Result := nil;
   FileResolver := nil;
   FileResolver := nil;

+ 47 - 47
fcl/passrc/pscanner.pp

@@ -23,7 +23,7 @@ uses SysUtils, Classes;
 
 
 resourcestring
 resourcestring
   SErrInvalidCharacter = 'Invalid character ''%s''';
   SErrInvalidCharacter = 'Invalid character ''%s''';
-  SErrOpenString = 'String exceeds end of line';
+  SErrOpenString = 'string exceeds end of line';
   SErrIncludeFileNotFound = 'Could not find include file ''%s''';
   SErrIncludeFileNotFound = 'Could not find include file ''%s''';
   SErrIfXXXNestingLimitReached = 'Nesting of $IFxxx too deep';
   SErrIfXXXNestingLimitReached = 'Nesting of $IFxxx too deep';
   SErrInvalidPPElse = '$ELSE without matching $IFxxx';
   SErrInvalidPPElse = '$ELSE without matching $IFxxx';
@@ -133,7 +133,7 @@ type
   TLineReader = class
   TLineReader = class
   public
   public
     function IsEOF: Boolean; virtual; abstract;
     function IsEOF: Boolean; virtual; abstract;
-    function ReadLine: String; virtual; abstract;
+    function ReadLine: string; virtual; abstract;
   end;
   end;
 
 
   TFileLineReader = class(TLineReader)
   TFileLineReader = class(TLineReader)
@@ -141,10 +141,10 @@ type
     FTextFile: Text;
     FTextFile: Text;
     FileOpened: Boolean;
     FileOpened: Boolean;
   public
   public
-    constructor Create(const AFilename: String);
+    constructor Create(const AFilename: string);
     destructor Destroy; override;
     destructor Destroy; override;
     function IsEOF: Boolean; override;
     function IsEOF: Boolean; override;
-    function ReadLine: String; override;
+    function ReadLine: string; override;
   end;
   end;
 
 
   TFileResolver = class
   TFileResolver = class
@@ -153,9 +153,9 @@ type
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
-    procedure AddIncludePath(const APath: String);
-    function FindSourceFile(const AName: String): TLineReader;
-    function FindIncludeFile(const AName: String): TLineReader;
+    procedure AddIncludePath(const APath: string);
+    function FindSourceFile(const AName: string): TLineReader;
+    function FindIncludeFile(const AName: string): TLineReader;
   end;
   end;
 
 
   EScannerError       = class(Exception);
   EScannerError       = class(Exception);
@@ -168,11 +168,11 @@ type
   private
   private
     FFileResolver: TFileResolver;
     FFileResolver: TFileResolver;
     FCurSourceFile: TLineReader;
     FCurSourceFile: TLineReader;
-    FCurFilename: String;
+    FCurFilename: string;
     FCurRow: Integer;
     FCurRow: Integer;
     FCurToken: TToken;
     FCurToken: TToken;
-    FCurTokenString: String;
-    FCurLine: String;
+    FCurTokenString: string;
+    FCurLine: string;
     FDefines: TStrings;
     FDefines: TStrings;
     TokenStr: PChar;
     TokenStr: PChar;
     FIncludeStack: TList;
     FIncludeStack: TList;
@@ -186,36 +186,36 @@ type
 
 
     function GetCurColumn: Integer;
     function GetCurColumn: Integer;
   protected
   protected
-    procedure Error(const Msg: String);
-    procedure Error(const Msg: String; Args: array of Const);
+    procedure Error(const Msg: string);
+    procedure Error(const Msg: string; Args: array of Const);
     function DoFetchToken: TToken;
     function DoFetchToken: TToken;
   public
   public
     constructor Create(AFileResolver: TFileResolver);
     constructor Create(AFileResolver: TFileResolver);
     destructor Destroy; override;
     destructor Destroy; override;
-    procedure OpenFile(const AFilename: String);
+    procedure OpenFile(const AFilename: string);
     function FetchToken: TToken;
     function FetchToken: TToken;
 
 
     property FileResolver: TFileResolver read FFileResolver;
     property FileResolver: TFileResolver read FFileResolver;
     property CurSourceFile: TLineReader read FCurSourceFile;
     property CurSourceFile: TLineReader read FCurSourceFile;
-    property CurFilename: String read FCurFilename;
+    property CurFilename: string read FCurFilename;
 
 
-    property CurLine: String read FCurLine;
+    property CurLine: string read FCurLine;
     property CurRow: Integer read FCurRow;
     property CurRow: Integer read FCurRow;
     property CurColumn: Integer read GetCurColumn;
     property CurColumn: Integer read GetCurColumn;
 
 
     property CurToken: TToken read FCurToken;
     property CurToken: TToken read FCurToken;
-    property CurTokenString: String read FCurTokenString;
+    property CurTokenString: string read FCurTokenString;
 
 
     property Defines: TStrings read FDefines;
     property Defines: TStrings read FDefines;
   end;
   end;
 
 
 const
 const
-  TokenInfos: array[TToken] of String = (
+  TokenInfos: array[TToken] of string = (
     'EOF',
     'EOF',
     'Whitespace',
     'Whitespace',
     'Comment',
     'Comment',
     'Identifier',
     'Identifier',
-    'String',
+    'string',
     'Number',
     'Number',
     'Character',
     'Character',
     '(',
     '(',
@@ -314,21 +314,21 @@ implementation
 type
 type
   TIncludeStackItem = class
   TIncludeStackItem = class
     SourceFile: TLineReader;
     SourceFile: TLineReader;
-    Filename: String;
+    Filename: string;
     Token: TToken;
     Token: TToken;
-    TokenString: String;
-    Line: String;
+    TokenString: string;
+    Line: string;
     Row: Integer;
     Row: Integer;
     TokenStr: PChar;
     TokenStr: PChar;
   end;
   end;
 
 
 
 
-constructor TFileLineReader.Create(const AFilename: String);
+constructor TFileLineReader.Create(const AFilename: string);
 begin
 begin
   inherited Create;
   inherited Create;
   Assign(FTextFile, AFilename);
   Assign(FTextFile, AFilename);
   Reset(FTextFile);
   Reset(FTextFile);
-  FileOpened := True;
+  FileOpened := true;
 end;
 end;
 
 
 destructor TFileLineReader.Destroy;
 destructor TFileLineReader.Destroy;
@@ -343,7 +343,7 @@ begin
   Result := EOF(FTextFile);
   Result := EOF(FTextFile);
 end;
 end;
 
 
-function TFileLineReader.ReadLine: String;
+function TFileLineReader.ReadLine: string;
 begin
 begin
   ReadLn(FTextFile, Result);
   ReadLn(FTextFile, Result);
 end;
 end;
@@ -361,12 +361,12 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-procedure TFileResolver.AddIncludePath(const APath: String);
+procedure TFileResolver.AddIncludePath(const APath: string);
 begin
 begin
   FIncludePaths.Add(IncludeTrailingPathDelimiter(ExpandFileName(APath)));
   FIncludePaths.Add(IncludeTrailingPathDelimiter(ExpandFileName(APath)));
 end;
 end;
 
 
-function TFileResolver.FindSourceFile(const AName: String): TLineReader;
+function TFileResolver.FindSourceFile(const AName: string): TLineReader;
 begin
 begin
   if not FileExists(AName) then
   if not FileExists(AName) then
     Raise EFileNotFoundError.create(Aname)
     Raise EFileNotFoundError.create(Aname)
@@ -378,10 +378,10 @@ begin
     end;
     end;
 end;
 end;
 
 
-function TFileResolver.FindIncludeFile(const AName: String): TLineReader;
+function TFileResolver.FindIncludeFile(const AName: string): TLineReader;
 var
 var
   i: Integer;
   i: Integer;
-  FN : String;
+  FN : string;
 
 
 begin
 begin
   Result := nil;
   Result := nil;
@@ -428,7 +428,7 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-procedure TPascalScanner.OpenFile(const AFilename: String);
+procedure TPascalScanner.OpenFile(const AFilename: string);
 begin
 begin
   FCurSourceFile := FileResolver.FindSourceFile(AFilename);
   FCurSourceFile := FileResolver.FindSourceFile(AFilename);
   FCurFilename := AFilename;
   FCurFilename := AFilename;
@@ -438,7 +438,7 @@ function TPascalScanner.FetchToken: TToken;
 var
 var
   IncludeStackItem: TIncludeStackItem;
   IncludeStackItem: TIncludeStackItem;
 begin
 begin
-  while True do
+  while true do
   begin
   begin
     Result := DoFetchToken;
     Result := DoFetchToken;
     if FCurToken = tkEOF then
     if FCurToken = tkEOF then
@@ -465,12 +465,12 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TPascalScanner.Error(const Msg: String);
+procedure TPascalScanner.Error(const Msg: string);
 begin
 begin
   raise EScannerError.Create(Msg);
   raise EScannerError.Create(Msg);
 end;
 end;
 
 
-procedure TPascalScanner.Error(const Msg: String; Args: array of Const);
+procedure TPascalScanner.Error(const Msg: string; Args: array of Const);
 begin
 begin
   raise EScannerError.CreateFmt(Msg, Args);
   raise EScannerError.CreateFmt(Msg, Args);
 end;
 end;
@@ -483,12 +483,12 @@ function TPascalScanner.DoFetchToken: TToken;
     begin
     begin
       FCurLine := '';
       FCurLine := '';
       TokenStr := nil;
       TokenStr := nil;
-      Result := False;
+      Result := false;
     end else
     end else
     begin
     begin
       FCurLine := CurSourceFile.ReadLine;
       FCurLine := CurSourceFile.ReadLine;
       TokenStr := PChar(CurLine);
       TokenStr := PChar(CurLine);
-      Result := True;
+      Result := true;
       Inc(FCurRow);
       Inc(FCurRow);
     end;
     end;
   end;
   end;
@@ -497,7 +497,7 @@ var
   TokenStart, CurPos: PChar;
   TokenStart, CurPos: PChar;
   i: TToken;
   i: TToken;
   OldLength, SectionLength, NestingLevel, Index: Integer;
   OldLength, SectionLength, NestingLevel, Index: Integer;
-  Directive, Param: String;
+  Directive, Param: string;
   IncludeStackItem: TIncludeStackItem;
   IncludeStackItem: TIncludeStackItem;
 begin
 begin
   if TokenStr = nil then
   if TokenStr = nil then
@@ -581,7 +581,7 @@ begin
         OldLength := 0;
         OldLength := 0;
         FCurTokenString := '';
         FCurTokenString := '';
 
 
-        while True do
+        while true do
         begin
         begin
           if TokenStr[0] = '''' then
           if TokenStr[0] = '''' then
             if TokenStr[1] = '''' then
             if TokenStr[1] = '''' then
@@ -692,7 +692,7 @@ begin
     '0'..'9':
     '0'..'9':
       begin
       begin
         TokenStart := TokenStr;
         TokenStart := TokenStr;
-        while True do
+        while true do
         begin
         begin
           Inc(TokenStr);
           Inc(TokenStr);
           case TokenStr[0] of
           case TokenStr[0] of
@@ -894,7 +894,7 @@ begin
               if PPIsSkipping then
               if PPIsSkipping then
               begin
               begin
                 PPSkipMode := ppSkipAll;
                 PPSkipMode := ppSkipAll;
-                PPIsSkipping := True;
+                PPIsSkipping := true;
               end else
               end else
               begin
               begin
                 Param := UpperCase(Param);
                 Param := UpperCase(Param);
@@ -902,7 +902,7 @@ begin
                 if Index < 0 then
                 if Index < 0 then
                 begin
                 begin
                   PPSkipMode := ppSkipIfBranch;
                   PPSkipMode := ppSkipIfBranch;
-                  PPIsSkipping := True;
+                  PPIsSkipping := true;
                 end else
                 end else
                   PPSkipMode := ppSkipElseBranch;
                   PPSkipMode := ppSkipElseBranch;
               end;
               end;
@@ -916,7 +916,7 @@ begin
               if PPIsSkipping then
               if PPIsSkipping then
               begin
               begin
                 PPSkipMode := ppSkipAll;
                 PPSkipMode := ppSkipAll;
-                PPIsSkipping := True;
+                PPIsSkipping := true;
               end else
               end else
               begin
               begin
                 Param := UpperCase(Param);
                 Param := UpperCase(Param);
@@ -924,7 +924,7 @@ begin
                 if Index >= 0 then
                 if Index >= 0 then
                 begin
                 begin
                   PPSkipMode := ppSkipIfBranch;
                   PPSkipMode := ppSkipIfBranch;
-                  PPIsSkipping := True;
+                  PPIsSkipping := true;
                 end else
                 end else
                   PPSkipMode := ppSkipElseBranch;
                   PPSkipMode := ppSkipElseBranch;
               end;
               end;
@@ -938,13 +938,13 @@ begin
               if PPIsSkipping then
               if PPIsSkipping then
               begin
               begin
                 PPSkipMode := ppSkipAll;
                 PPSkipMode := ppSkipAll;
-                PPIsSkipping := True;
+                PPIsSkipping := true;
               end else
               end else
               begin
               begin
                 { !!!: Currently, options are not supported, so they are just
                 { !!!: Currently, options are not supported, so they are just
                   assumed as not being set. }
                   assumed as not being set. }
                 PPSkipMode := ppSkipIfBranch;
                 PPSkipMode := ppSkipIfBranch;
-                PPIsSkipping := True;
+                PPIsSkipping := true;
               end;
               end;
             end else if Directive = 'IF' then
             end else if Directive = 'IF' then
             begin
             begin
@@ -956,22 +956,22 @@ begin
               if PPIsSkipping then
               if PPIsSkipping then
               begin
               begin
                 PPSkipMode := ppSkipAll;
                 PPSkipMode := ppSkipAll;
-                PPIsSkipping := True;
+                PPIsSkipping := true;
               end else
               end else
               begin
               begin
                 { !!!: Currently, expressions are not supported, so they are
                 { !!!: Currently, expressions are not supported, so they are
                   just assumed as evaluating to false. }
                   just assumed as evaluating to false. }
                 PPSkipMode := ppSkipIfBranch;
                 PPSkipMode := ppSkipIfBranch;
-                PPIsSkipping := True;
+                PPIsSkipping := true;
               end;
               end;
             end else if Directive = 'ELSE' then
             end else if Directive = 'ELSE' then
             begin
             begin
               if PPSkipStackIndex = 0 then
               if PPSkipStackIndex = 0 then
                 Error(SErrInvalidPPElse);
                 Error(SErrInvalidPPElse);
               if PPSkipMode = ppSkipIfBranch then
               if PPSkipMode = ppSkipIfBranch then
-                PPIsSkipping := False
+                PPIsSkipping := false
               else if PPSkipMode = ppSkipElseBranch then
               else if PPSkipMode = ppSkipElseBranch then
-                PPIsSkipping := True;
+                PPIsSkipping := true;
             end else if Directive = 'ENDIF' then
             end else if Directive = 'ENDIF' then
             begin
             begin
               if PPSkipStackIndex = 0 then
               if PPSkipStackIndex = 0 then