* Dotted filenames for package fcl-passrc

This commit is contained in:
Michaël Van Canneyt 2023-03-06 14:57:59 +01:00
parent cad28fa075
commit a9fbc6b9ed
19 changed files with 148 additions and 19 deletions

View File

@ -0,0 +1,3 @@
unit Pascal.Parser;
{$DEFINE FPC_DOTTEDUNITS}
{$i pparser.pp}

View File

@ -0,0 +1,3 @@
unit Pascal.ResolveEval;
{$DEFINE FPC_DOTTEDUNITS}
{$i pasresolveeval.pas}

View File

@ -0,0 +1,3 @@
unit Pascal.Resolver;
{$DEFINE FPC_DOTTEDUNITS}
{$i pasresolver.pp}

View File

@ -0,0 +1,3 @@
unit Pascal.Scanner;
{$DEFINE FPC_DOTTEDUNITS}
{$i pscanner.pp}

View File

@ -0,0 +1,3 @@
unit Pascal.ToUnitTest;
{$DEFINE FPC_DOTTEDUNITS}
{$i pastounittest.pp}

View File

@ -0,0 +1,3 @@
unit Pascal.Tree;
{$DEFINE FPC_DOTTEDUNITS}
{$i pastree.pp}

View File

@ -0,0 +1,3 @@
unit Pascal.UseAnalyzer;
{$DEFINE FPC_DOTTEDUNITS}
{$i pasuseanalyzer.pas}

View File

@ -0,0 +1,3 @@
unit Pascal.Utils;
{$DEFINE FPC_DOTTEDUNITS}
{$i passrcutil.pp}

View File

@ -0,0 +1,3 @@
unit Pascal.Writer;
{$DEFINE FPC_DOTTEDUNITS}
{$i paswrite.pp}

View File

@ -0,0 +1,11 @@
src/pasresolver.pp=namespaced/Pascal.Resolver.pp
{s*:src/}=namespaced/
{i+:src/}
src/pparser.pp=namespaced/Pascal.Parser.pp
src/pasresolveeval.pas=namespaced/Pascal.ResolveEval.pp
src/passrcutil.pp=namespaced/Pascal.Utils.pp
src/pastounittest.pp=namespaced/Pascal.ToUnitTest.pp
src/pscanner.pp=namespaced/Pascal.Scanner.pp
src/pastree.pp=namespaced/Pascal.Tree.pp
src/pasuseanalyzer.pas=namespaced/Pascal.UseAnalyzer.pp
src/paswrite.pp=namespaced/Pascal.Writer.pp

View File

@ -57,7 +57,9 @@ ToDo:
- error on: array[1..2] of longint = (1,2,3);
- anonymous enum range: type f=(a,b,c,d); g=b..c;
}
{$IFNDEF FPC_DOTTEDUNITS}
unit PasResolveEval;
{$ENDIF FPC_DOTTEDUNITS}
{$mode objfpc}{$H+}
@ -70,8 +72,13 @@ unit PasResolveEval;
interface
{$IFDEF FPC_DOTTEDUNITS}
uses
System.SysUtils, System.Classes, System.Math, Pascal.Tree, Pascal.Scanner;
{$ELSE FPC_DOTTEDUNITS}
uses
Sysutils, Classes, Math, PasTree, PScanner;
{$ENDIF FPC_DOTTEDUNITS}
// message numbers
const
@ -2567,7 +2574,7 @@ begin
revkUInt:
// int / uint
if TResEvalUInt(RightValue).UInt=0 then
Flo:=DivideByZero(Math.Sign(Int),Sign(TResEvalUInt(RightValue).UInt))
Flo:=DivideByZero({$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.Sign(Int),Sign(TResEvalUInt(RightValue).UInt))
else
Flo:=Int / TResEvalUInt(RightValue).UInt;
revkFloat:
@ -3958,7 +3965,7 @@ begin
// int^^int
try
{$Q+}{$R+}
Int:=trunc(Math.power(TResEvalInt(LeftValue).Int,TResEvalInt(RightValue).Int));
Int:=trunc({$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalInt(LeftValue).Int,TResEvalInt(RightValue).Int));
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalInt.CreateValue(Int);
@ -3969,7 +3976,7 @@ begin
// int^^uint
try
{$Q+}{$R+}
Int:=trunc(Math.power(TResEvalInt(LeftValue).Int,TResEvalUInt(RightValue).UInt));
Int:=trunc({$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalInt(LeftValue).Int,TResEvalUInt(RightValue).UInt));
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalInt.CreateValue(Int);
@ -3980,7 +3987,7 @@ begin
// int^^float
try
{$Q+}{$R+}
Flo:=Math.power(TResEvalInt(LeftValue).Int,TResEvalFloat(RightValue).FloatValue);
Flo:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalInt(LeftValue).Int,TResEvalFloat(RightValue).FloatValue);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalFloat.CreateValue(Flo);
@ -3991,7 +3998,7 @@ begin
// int^^currency
try
{$Q+}{$R+}
Flo:=Math.power(TResEvalInt(LeftValue).Int,TResEvalCurrency(RightValue).Value);
Flo:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalInt(LeftValue).Int,TResEvalCurrency(RightValue).Value);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalFloat.CreateValue(Flo);
@ -4010,7 +4017,7 @@ begin
// uint^^int
try
{$Q+}{$R+}
Int:=trunc(Math.power(TResEvalUInt(LeftValue).UInt,TResEvalInt(RightValue).Int));
Int:=trunc({$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalUInt(LeftValue).UInt,TResEvalInt(RightValue).Int));
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalInt.CreateValue(Int);
@ -4021,7 +4028,7 @@ begin
// uint^^uint
try
{$Q+}{$R+}
Int:=trunc(Math.power(TResEvalUInt(LeftValue).UInt,TResEvalUInt(RightValue).UInt));
Int:=trunc({$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalUInt(LeftValue).UInt,TResEvalUInt(RightValue).UInt));
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalInt.CreateValue(Int);
@ -4032,7 +4039,7 @@ begin
// uint^^float
try
{$Q+}{$R+}
Flo:=Math.power(TResEvalUInt(LeftValue).UInt,TResEvalFloat(RightValue).FloatValue);
Flo:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalUInt(LeftValue).UInt,TResEvalFloat(RightValue).FloatValue);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalFloat.CreateValue(Flo);
@ -4043,7 +4050,7 @@ begin
// uint^^currency
try
{$Q+}{$R+}
Flo:=Math.power(TResEvalUInt(LeftValue).UInt,TResEvalCurrency(RightValue).Value);
Flo:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalUInt(LeftValue).UInt,TResEvalCurrency(RightValue).Value);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalFloat.CreateValue(Flo);
@ -4062,7 +4069,7 @@ begin
// float ^^ int
try
{$Q+}{$R+}
Flo:=Math.power(TResEvalFloat(LeftValue).FloatValue,TResEvalInt(RightValue).Int);
Flo:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalFloat(LeftValue).FloatValue,TResEvalInt(RightValue).Int);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalFloat.CreateValue(Flo);
@ -4073,7 +4080,7 @@ begin
// float ^^ uint
try
{$Q+}{$R+}
Flo:=Math.power(TResEvalFloat(LeftValue).FloatValue,TResEvalUInt(RightValue).UInt);
Flo:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalFloat(LeftValue).FloatValue,TResEvalUInt(RightValue).UInt);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalFloat.CreateValue(Flo);
@ -4084,7 +4091,7 @@ begin
// float ^^ float
try
{$Q+}{$R+}
Flo:=Math.power(TResEvalFloat(LeftValue).FloatValue,TResEvalFloat(RightValue).FloatValue);
Flo:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalFloat(LeftValue).FloatValue,TResEvalFloat(RightValue).FloatValue);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalFloat.CreateValue(Flo);
@ -4095,7 +4102,7 @@ begin
// float ^^ currency
try
{$Q+}{$R+}
Flo:=Math.power(TResEvalFloat(LeftValue).FloatValue,TResEvalCurrency(RightValue).Value);
Flo:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalFloat(LeftValue).FloatValue,TResEvalCurrency(RightValue).Value);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalFloat.CreateValue(Flo);
@ -4109,7 +4116,7 @@ begin
// currency ^^ int
try
{$Q+}{$R+}
aCurrency:=Math.power(TResEvalCurrency(LeftValue).Value,TResEvalInt(RightValue).Int);
aCurrency:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalCurrency(LeftValue).Value,TResEvalInt(RightValue).Int);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalCurrency.CreateValue(aCurrency);
@ -4120,7 +4127,7 @@ begin
// currency ^^ uint
try
{$Q+}{$R+}
aCurrency:=Math.power(TResEvalCurrency(LeftValue).Value,TResEvalUInt(RightValue).UInt);
aCurrency:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalCurrency(LeftValue).Value,TResEvalUInt(RightValue).UInt);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalCurrency.CreateValue(aCurrency);
@ -4131,7 +4138,7 @@ begin
// currency ^^ float
try
{$Q+}{$R+}
aCurrency:=Math.power(TResEvalCurrency(LeftValue).Value,TResEvalFloat(RightValue).FloatValue);
aCurrency:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalCurrency(LeftValue).Value,TResEvalFloat(RightValue).FloatValue);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalCurrency.CreateValue(aCurrency);
@ -4142,7 +4149,7 @@ begin
// currency ^^ currency
try
{$Q+}{$R+}
aCurrency:=Math.power(TResEvalCurrency(LeftValue).Value,TResEvalCurrency(RightValue).Value);
aCurrency:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.power(TResEvalCurrency(LeftValue).Value,TResEvalCurrency(RightValue).Value);
{$IFNDEF OverflowCheckOn}{$Q-}{$ENDIF}
{$IFNDEF RangeCheckOn}{$R-}{$ENDIF}
Result:=TResEvalCurrency.CreateValue(aCurrency);
@ -5650,9 +5657,9 @@ begin
if LeftSign=0 then
Result:=0.0
else if (LeftSign<0)<>(RightSign<0) then
Result:=Math.NegInfinity
Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.NegInfinity
else
Result:=Math.Infinity;
Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Math.Infinity;
end;
{ TResolveData }

View File

@ -304,7 +304,9 @@ Notes:
if f=g then : can implicit resolve each side once
p(f), f as var parameter: can implicit
}
{$IFNDEF FPC_DOTTEDUNITS}
unit PasResolver;
{$ENDIF FPC_DOTTEDUNITS}
{$i fcl-passrc.inc}
@ -313,6 +315,17 @@ unit PasResolver;
interface
{$IFDEF FPC_DOTTEDUNITS}
uses
{$ifdef pas2js}
js,
{$IFDEF NODEJS}
Node.FS,
{$ENDIF}
{$endif}
System.Classes, System.SysUtils, System.Math, System.Types, System.Contnrs,
Pascal.Tree, Pascal.Scanner, Pascal.Parser, Pascal.ResolveEval;
{$ELSE FPC_DOTTEDUNITS}
uses
{$ifdef pas2js}
js,
@ -322,6 +335,7 @@ uses
{$endif}
Classes, SysUtils, Math, Types, contnrs,
PasTree, PScanner, PParser, PasResolveEval;
{$ENDIF FPC_DOTTEDUNITS}
const
ParserMaxEmbeddedColumn = 2048;

View File

@ -1,4 +1,6 @@
{$IFNDEF FPC_DOTTEDUNITS}
unit passrcutil;
{$ENDIF FPC_DOTTEDUNITS}
{
This file is part of the Free Pascal run time library.
Copyright (c) 1999-2022 by Michael van Canney and other members of the
@ -18,8 +20,13 @@ unit passrcutil;
interface
{$IFDEF FPC_DOTTEDUNITS}
uses
System.Classes, System.SysUtils, Pascal.Scanner, Pascal.Parser, Pascal.Tree;
{$ELSE FPC_DOTTEDUNITS}
uses
Classes, SysUtils, pscanner, pparser, pastree;
{$ENDIF FPC_DOTTEDUNITS}
Type

View File

@ -12,14 +12,21 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{$IFNDEF FPC_DOTTEDUNITS}
unit pastounittest;
{$ENDIF FPC_DOTTEDUNITS}
{$mode objfpc}{$H+}
interface
{$IFDEF FPC_DOTTEDUNITS}
uses
System.Classes, System.SysUtils, Pascal.Scanner, Pascal.Parser, Pascal.Tree;
{$ELSE FPC_DOTTEDUNITS}
uses
Classes, SysUtils, PScanner, pparser, pastree;
{$ENDIF FPC_DOTTEDUNITS}
Type

View File

@ -14,13 +14,19 @@
**********************************************************************}
{$IFNDEF FPC_DOTTEDUNITS}
unit PasTree;
{$ENDIF FPC_DOTTEDUNITS}
{$i fcl-passrc.inc}
interface
{$IFDEF FPC_DOTTEDUNITS}
uses System.SysUtils, System.Classes;
{$ELSE FPC_DOTTEDUNITS}
uses SysUtils, Classes;
{$ENDIF FPC_DOTTEDUNITS}
resourcestring
// Parse tree node type names

View File

@ -37,12 +37,24 @@ Working:
- TPasArgument: compute the effective Access
- calls: use the effective Access of arguments
}
{$IFNDEF FPC_DOTTEDUNITS}
unit PasUseAnalyzer;
{$ENDIF FPC_DOTTEDUNITS}
{$i fcl-passrc.inc}
interface
{$IFDEF FPC_DOTTEDUNITS}
uses
{$ifdef pas2js}
js,
{$else}
Fcl.AVLTree,
{$endif}
System.Classes, System.SysUtils, System.Types, System.Contnrs,
Pascal.Tree, Pascal.Scanner, Pascal.ResolveEval, Pascal.Resolver;
{$ELSE FPC_DOTTEDUNITS}
uses
{$ifdef pas2js}
js,
@ -51,6 +63,7 @@ uses
{$endif}
Classes, SysUtils, Types, contnrs,
PasTree, PScanner, PasResolveEval, PasResolver;
{$ENDIF FPC_DOTTEDUNITS}
const
// non fpc hints

View File

@ -18,11 +18,17 @@
{$h+}
{$inline on}
{$IFNDEF FPC_DOTTEDUNITS}
unit PasWrite;
{$ENDIF FPC_DOTTEDUNITS}
interface
{$IFDEF FPC_DOTTEDUNITS}
uses System.StrUtils, System.SysUtils, System.Classes, Pascal.Tree;
{$ELSE FPC_DOTTEDUNITS}
uses StrUtils, SysUtils, Classes, PasTree;
{$ENDIF FPC_DOTTEDUNITS}
type
EPasWriter = Class(Exception);

View File

@ -14,7 +14,9 @@
**********************************************************************}
{$IFNDEF FPC_DOTTEDUNITS}
unit PParser;
{$ENDIF FPC_DOTTEDUNITS}
{$i fcl-passrc.inc}
{$modeswitch advancedrecords}
@ -33,11 +35,19 @@ unit PParser;
interface
{$IFDEF FPC_DOTTEDUNITS}
uses
{$ifdef NODEJS}
Node.FS,
{$endif}
System.SysUtils, System.Classes, System.Types, Pascal.Tree, Pascal.Scanner;
{$ELSE FPC_DOTTEDUNITS}
uses
{$ifdef NODEJS}
Node.FS,
{$endif}
SysUtils, Classes, Types, PasTree, PScanner;
{$ENDIF FPC_DOTTEDUNITS}
// message numbers
const
@ -613,7 +623,13 @@ Function TokenToAssignKind( tk : TToken) : TAssignKind;
implementation
{$IF FPC_FULLVERSION>=30301}
{$IFDEF FPC_DOTTEDUNITS}
uses System.StrUtils;
{$ELSE FPC_DOTTEDUNITS}
uses strutils;
{$ENDIF FPC_DOTTEDUNITS}
{$ENDIF}
const

View File

@ -14,12 +14,25 @@
**********************************************************************}
{$IFNDEF FPC_DOTTEDUNITS}
unit PScanner;
{$ENDIF FPC_DOTTEDUNITS}
{$i fcl-passrc.inc}
interface
{$IFDEF FPC_DOTTEDUNITS}
uses
{$ifdef pas2js}
js,
{$IFDEF NODEJS}
Node.FS,
{$ENDIF}
System.Types,
{$endif}
System.SysUtils, System.Classes;
{$ELSE FPC_DOTTEDUNITS}
uses
{$ifdef pas2js}
js,
@ -29,6 +42,7 @@ uses
Types,
{$endif}
SysUtils, Classes;
{$ENDIF FPC_DOTTEDUNITS}
// message numbers
const
@ -1297,6 +1311,7 @@ const
Digits = ['0'..'9'];
Letters = ['a'..'z','A'..'Z'];
HexDigits = ['0'..'9','a'..'f','A'..'F'];
Var
SortedTokens : array of TToken;
LowerCaseTokens : Array[ttoken] of TPasScannerString;