Initial check in rtl
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
unit dpgrtl.parserstate;
|
||||
|
||||
interface
|
||||
uses
|
||||
dpgrtl.types;
|
||||
|
||||
type
|
||||
TParserState = class( TInterfacedObject, IParserState)
|
||||
protected
|
||||
fFileName : string;
|
||||
fGuessing : integer;
|
||||
fInputBuffer : ITokenBuffer;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// IParserState
|
||||
// ----------------------------------------------------------------------
|
||||
protected
|
||||
function GetInputBuffer : ITokenBuffer;
|
||||
function GetFileName : string;
|
||||
function GetGuessing : integer;
|
||||
|
||||
procedure SetFileName( Value: string);
|
||||
procedure SetGuessing( Value: integer);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Construction/destruction
|
||||
// ----------------------------------------------------------------------
|
||||
public
|
||||
constructor Create( ABuffer: ITokenBuffer);
|
||||
|
||||
procedure AfterConstruction; override;
|
||||
procedure BeforeDestruction; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TParserState }
|
||||
|
||||
// @@@: Construction/destruction ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//
|
||||
// Construction/destruction
|
||||
//
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ================================================================================================
|
||||
// Constructor
|
||||
// ================================================================================================
|
||||
constructor TParserState.Create(ABuffer: ITokenBuffer);
|
||||
begin
|
||||
inherited Create;
|
||||
fInputBuffer := ABuffer
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// After Construction
|
||||
// ================================================================================================
|
||||
procedure TParserState.AfterConstruction;
|
||||
begin
|
||||
inherited;
|
||||
fFileName := '';
|
||||
fGuessing := 0
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// Before Destruction
|
||||
// ================================================================================================
|
||||
procedure TParserState.BeforeDestruction;
|
||||
begin
|
||||
fInputBuffer := nil;
|
||||
inherited
|
||||
end;
|
||||
|
||||
// @@@: IParserState implementation +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//
|
||||
// IParserState implementation
|
||||
//
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ================================================================================================
|
||||
// Get File Name
|
||||
// ================================================================================================
|
||||
function TParserState.GetFileName: string;
|
||||
begin
|
||||
result := fFileName
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// Get Guessing
|
||||
// ================================================================================================
|
||||
function TParserState.GetGuessing: integer;
|
||||
begin
|
||||
result := fGuessing
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// Get Input Buffer
|
||||
// ================================================================================================
|
||||
function TParserState.GetInputBuffer: ITokenBuffer;
|
||||
begin
|
||||
result := fInputBuffer
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// Set File Name
|
||||
// ================================================================================================
|
||||
procedure TParserState.SetFileName(Value: string);
|
||||
begin
|
||||
fFileName := Value
|
||||
end;
|
||||
|
||||
// ================================================================================================
|
||||
// Set Guessing
|
||||
// ================================================================================================
|
||||
procedure TParserState.SetGuessing(Value: integer);
|
||||
begin
|
||||
fGuessing := Value
|
||||
end;
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user