Initial check in rtl
This commit is contained in:
@@ -0,0 +1,258 @@
|
||||
unit dpgrtl.exception;
|
||||
|
||||
interface
|
||||
uses
|
||||
dpgrtl.types,
|
||||
System.SysUtils;
|
||||
|
||||
type
|
||||
EException = class(Exception)
|
||||
strict protected
|
||||
fFileName : string;
|
||||
fLine : integer;
|
||||
fColumn : integer;
|
||||
|
||||
public
|
||||
constructor Create( AFileName : string;
|
||||
ALine : integer;
|
||||
AColumn : integer);
|
||||
|
||||
public
|
||||
property FileName : string read fFileName;
|
||||
property Line : integer read fLine;
|
||||
property Column : integer read fColumn;
|
||||
|
||||
end;
|
||||
|
||||
EMismatchedChar = class( EException)
|
||||
strict protected
|
||||
fCharSet : TCharSet;
|
||||
fString : AnsiString;
|
||||
|
||||
fFoundChar : AnsiChar;
|
||||
fFoundString: AnsiString;
|
||||
|
||||
fInverted : boolean;
|
||||
|
||||
public
|
||||
function ToString: string; override;
|
||||
|
||||
public
|
||||
constructor Create( AFoundChar : AnsiChar;
|
||||
ACharSet : TCharSet;
|
||||
AFileName : string;
|
||||
ALine : integer;
|
||||
AColumn : integer;
|
||||
AInverted : boolean=false); overload;
|
||||
|
||||
constructor Create( AFoundString : AnsiString;
|
||||
AExpectedString : AnsiString;
|
||||
AFileName : string;
|
||||
ALine : integer;
|
||||
AColumn : integer); overload;
|
||||
|
||||
|
||||
|
||||
public
|
||||
property FoundChar : AnsiChar read fFoundChar;
|
||||
property FoundString : AnsiString read fFoundString;
|
||||
property CharSet : TCharSet read fCharSet;
|
||||
property Str : AnsiString read fString;
|
||||
property Inverted : boolean read fInverted;
|
||||
end;
|
||||
|
||||
EMismatchedToken = class (EException)
|
||||
strict protected
|
||||
fToken : IToken;
|
||||
fTokenSet : TByteSet;
|
||||
fFoundToken : IToken;
|
||||
fInverted : boolean;
|
||||
|
||||
public
|
||||
constructor Create( AFoundToken : IToken;
|
||||
ATokenType : byte;
|
||||
AFileName : string;
|
||||
AInverted : boolean=false); overload;
|
||||
|
||||
constructor Create( AFoundToken : IToken;
|
||||
ATokenSet : TByteSet;
|
||||
AFileName : string;
|
||||
AInverted : boolean=false); overload;
|
||||
|
||||
procedure BeforeDestruction; override;
|
||||
|
||||
public
|
||||
property FoundToken : IToken read fFoundToken;
|
||||
property TokenSet : TByteSet read fTokenSet;
|
||||
property Inverted : boolean read fInverted;
|
||||
end;
|
||||
|
||||
ESemantic = class (EException)
|
||||
strict protected
|
||||
fAssert : AnsiString;
|
||||
|
||||
public
|
||||
constructor Create( ASemPred : AnsiString;
|
||||
AFileName : string;
|
||||
ALine : integer=0;
|
||||
AColumn : integer=0);
|
||||
|
||||
public
|
||||
property Assert: AnsiString read fAssert;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ EException }
|
||||
|
||||
// @@@: EException ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//
|
||||
// EException
|
||||
//
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ================================================================================================
|
||||
// constructor
|
||||
// ================================================================================================
|
||||
constructor EException.Create(AFileName: string; ALine, AColumn: integer);
|
||||
begin
|
||||
fFileName := AFileName;
|
||||
fLine := ALine;
|
||||
fColumn := AColumn;
|
||||
end;
|
||||
|
||||
{ EMismatchedChar }
|
||||
|
||||
// @@@: EMismatchedChar +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//
|
||||
// EMismatchedChar
|
||||
//
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ================================================================================================
|
||||
// constructor([char..char])
|
||||
// ================================================================================================
|
||||
constructor EMismatchedChar.Create( AFoundChar : AnsiChar;
|
||||
ACharSet : TCharSet;
|
||||
AFileName : string;
|
||||
ALine : integer;
|
||||
AColumn : integer;
|
||||
AInverted : boolean=false);
|
||||
begin
|
||||
inherited Create( AFileName, ALine, AColumn);
|
||||
|
||||
fCharSet := ACharSet;
|
||||
fString := '';
|
||||
|
||||
fFoundChar := AFoundChar;
|
||||
fFoundString := '';
|
||||
|
||||
fInverted := AInverted
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// constructor(string)
|
||||
// ================================================================================================
|
||||
constructor EMismatchedChar.Create( AFoundString : AnsiString;
|
||||
AExpectedString : AnsiString;
|
||||
AFileName : string;
|
||||
ALine : integer;
|
||||
AColumn : integer);
|
||||
begin
|
||||
inherited Create( AFileName, ALine, AColumn);
|
||||
|
||||
fCharSet := [];
|
||||
fString := AExpectedString;
|
||||
|
||||
fFoundChar := #0;
|
||||
fFoundString := AFoundString;
|
||||
|
||||
fInverted := false
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// ToString
|
||||
// ================================================================================================
|
||||
function EMismatchedChar.ToString: string;
|
||||
begin
|
||||
result := '?'
|
||||
end;
|
||||
|
||||
{ EMismatchedToken }
|
||||
|
||||
// @@@: EMismatchedToken ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//
|
||||
// EMismatchedToken
|
||||
//
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ================================================================================================
|
||||
// constructor
|
||||
// ================================================================================================
|
||||
constructor EMismatchedToken.Create(AFoundToken : IToken;
|
||||
ATokenType : byte;
|
||||
AFileName : string;
|
||||
AInverted : boolean=false);
|
||||
begin
|
||||
inherited Create(AFileName, AFoundToken.TokenLine, AFoundToken.TokenColumn);
|
||||
|
||||
fFoundToken := AFoundToken;
|
||||
fTokenSet := [ATokenType];
|
||||
fInverted := AInverted
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// constructor
|
||||
// ================================================================================================
|
||||
constructor EMismatchedToken.Create(AFoundToken : IToken;
|
||||
ATokenSet : TByteSet;
|
||||
AFileName : string;
|
||||
AInverted : boolean=false);
|
||||
begin
|
||||
inherited Create(AFileName, AFoundToken.TokenLine, AFoundToken.TokenColumn);
|
||||
|
||||
fFoundToken := AFoundToken;
|
||||
fTokenSet := ATokenSet;
|
||||
fInverted := AInverted
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// Before Destruction
|
||||
// ================================================================================================
|
||||
procedure EMismatchedToken.BeforeDestruction;
|
||||
begin
|
||||
fFoundToken := nil;
|
||||
inherited
|
||||
end;
|
||||
|
||||
{ ESemantic }
|
||||
|
||||
// @@@: ESemantic +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//
|
||||
// ESemantic
|
||||
//
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ================================================================================================
|
||||
// constructor
|
||||
// ================================================================================================
|
||||
constructor ESemantic.Create(ASemPred: AnsiString; AFileName: string; ALine, AColumn: integer);
|
||||
begin
|
||||
inherited Create( AFileName, ALine, AColumn);
|
||||
fAssert := ASemPred
|
||||
end;
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user