Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions CastaliaPasLex.pas
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TDefineRec = record
TmwBasePasLex = class(TObject)
private
fCommentState: TCommentState;
fOrigin: PChar;
fOrigin: PAnsiChar;
fProcTable: array[#0..#255] of procedure of object;
Run: Integer;
RunAhead: Integer;
Expand All @@ -92,7 +92,7 @@ TmwBasePasLex = class(TObject)
fOnIfEndDirect: TDirectiveEvent;
fOnElseIfDirect: TDirectiveEvent;
fOnUnDefDirect: TDirectiveEvent;
FDirectiveParamOrigin: PChar;
FDirectiveParamOrigin: PAnsiChar;

fAsmCode : Boolean; // DR 2002-01-14

Expand Down Expand Up @@ -268,12 +268,12 @@ TmwBasePasLex = class(TObject)
procedure ExitDefineBlock;
procedure CloneDefinesFrom(ALexer: TmwBasePasLex);

procedure DoProcTable(AChar: Char);
function IsIdentifiers(AChar: Char): Boolean;
function HashValue(AChar: Char): Integer;
procedure DoProcTable(AChar: AnsiChar);
function IsIdentifiers(AChar: AnsiChar): Boolean;
function HashValue(AChar: AnsiChar): Integer;
protected
procedure SetLine(const Value: string); virtual;
procedure SetOrigin(NewValue: PChar); virtual;
procedure SetOrigin(NewValue: PAnsiChar); virtual;
procedure SetOnCompDirect(const Value: TDirectiveEvent); virtual;
procedure SetOnDefineDirect(const Value: TDirectiveEvent); virtual;
procedure SetOnElseDirect(const Value: TDirectiveEvent); virtual;
Expand All @@ -290,7 +290,7 @@ TmwBasePasLex = class(TObject)
public
constructor Create;
destructor Destroy; override;
function CharAhead: Char;
function CharAhead: AnsiChar;
procedure Next;
procedure NextID(ID: TptTokenKind);
procedure NextNoJunk;
Expand All @@ -313,7 +313,7 @@ TmwBasePasLex = class(TObject)
//Note: setting the following two properties does not GO to that line, it just sets the internal counters
property LineNumber: Integer read fLineNumber write fLineNumber;
property LinePos: Integer read fLinePos write fLinePos;
property Origin: PChar read fOrigin write SetOrigin;
property Origin: PAnsiChar read fOrigin write SetOrigin;
property PosXY: TTokenPoint read GetPosXY; // !! changed to TokenPoint //jdj 7/18/1999
property RunPos: Integer read Run write SetRunPos;
property Token: string read GetToken;
Expand Down Expand Up @@ -350,7 +350,7 @@ TmwBasePasLex = class(TObject)
property OnUnDefDirect: TDirectiveEvent read fOnUnDefDirect write SetOnUnDefDirect;

property AsmCode : Boolean read fAsmCode write fAsmCode; // DR 2002-01-14
property DirectiveParamOrigin: pchar read FDirectiveParamOrigin;
property DirectiveParamOrigin: PAnsiChar read FDirectiveParamOrigin;

property UseDefines: Boolean read FUseDefines write FUseDefines;

Expand All @@ -367,7 +367,7 @@ TmwPasLex = class(TmwBasePasLex)
procedure SetStatus(const Value: TmwPasLexStatus);
protected
procedure SetLine(const Value: string); override;
procedure SetOrigin(NewValue: PChar); override;
procedure SetOrigin(NewValue: PAnsiChar); override;
procedure SetOnCompDirect(const Value: TDirectiveEvent); override;
procedure SetOnDefineDirect(const Value: TDirectiveEvent); override;
procedure SetOnElseDirect(const Value: TDirectiveEvent); override;
Expand Down Expand Up @@ -397,7 +397,7 @@ implementation

procedure MakeIdentTable;
var
I, J: Char;
I, J: AnsiChar;
begin
for I := #0 to #255 do
begin
Expand All @@ -408,12 +408,12 @@ procedure MakeIdentTable;
J := UpperCase(I)[1];
case I of
'a'..'z', 'A'..'Z', '_': mHashTable[I] := Ord(J) - 64;
else mHashTable[Char(I)] := 0;
else mHashTable[AnsiChar(I)] := 0;
end;
end;
end;

function TmwBasePasLex.CharAhead: Char;
function TmwBasePasLex.CharAhead: AnsiChar;
begin
RunAhead := Run;
// while fOrigin[RunAhead] in [#1..#32] do
Expand Down Expand Up @@ -602,7 +602,7 @@ function TmwBasePasLex.KeyHash: Integer;
function TmwBasePasLex.KeyComp(const aKey: string): Boolean;
var
I: Integer;
Temp: PChar;
Temp: PAnsiChar;
begin
if Length(aKey) = TokenLen then
begin
Expand Down Expand Up @@ -690,7 +690,7 @@ function TmwBasePasLex.Func29: TptTokenKind;
function TmwBasePasLex.Func30: TptTokenKind;
begin
Result := ptIdentifier;
if KeyComp('Char') then fExID := ptChar;
if KeyComp('AnsiChar') then fExID := ptChar;
end;

function TmwBasePasLex.Func32: TptTokenKind;
Expand Down Expand Up @@ -790,7 +790,7 @@ function TmwBasePasLex.Func45: TptTokenKind;
function TmwBasePasLex.Func46: TptTokenKind;
begin
Result := ptIdentifier;
if KeyComp('PChar') then fExId := ptPChar
if KeyComp('PAnsiChar') then fExId := ptPChar
{$IFDEF D8_NEWER} //JThurman 2004-03-19
else
if KeyComp('Sealed') then Result := ptSealed;
Expand Down Expand Up @@ -1276,7 +1276,7 @@ function TmwBasePasLex.IdentKind: TptTokenKind;

procedure TmwBasePasLex.MakeMethodTables;
var
I: Char;
I: AnsiChar;
begin
for I := #0 to #255 do
case I of
Expand Down Expand Up @@ -1346,7 +1346,7 @@ destructor TmwBasePasLex.Destroy;
inherited Destroy;
end;

procedure TmwBasePasLex.DoProcTable(AChar: Char);
procedure TmwBasePasLex.DoProcTable(AChar: AnsiChar);
begin
if AChar <= #255 then
fProcTable[AChar]
Expand All @@ -1358,7 +1358,7 @@ procedure TmwBasePasLex.DoProcTable(AChar: Char);

{ Destroy }

procedure TmwBasePasLex.SetOrigin(NewValue: PChar);
procedure TmwBasePasLex.SetOrigin(NewValue: PAnsiChar);
begin
fOrigin := NewValue;
Init;
Expand Down Expand Up @@ -1716,7 +1716,7 @@ procedure TmwBasePasLex.GreaterProc;
end;
end;

function TmwBasePasLex.HashValue(AChar: Char): Integer;
function TmwBasePasLex.HashValue(AChar: AnsiChar): Integer;
begin
if AChar <= #255 then
Result := mHashTable[fOrigin[Run]]
Expand All @@ -1742,7 +1742,7 @@ function TmwBasePasLex.IsDefined(const ADefine: string): Boolean;
Result := FDefines.IndexOf(ADefine) > -1;
end;

function TmwBasePasLex.IsIdentifiers(AChar: Char): Boolean;
function TmwBasePasLex.IsIdentifiers(AChar: AnsiChar): Boolean;
begin
if AChar <= #255 then
Result := Identifiers[AChar]
Expand Down Expand Up @@ -1822,7 +1822,7 @@ procedure TmwBasePasLex.PointerSymbolProc;
fTokenID := ptPointerSymbol;

//This is a wierd Pascal construct that rarely appears, but needs to be
//supported. ^M is a valid char reference (#13, in this case)
//supported. ^M is a valid AnsiChar reference (#13, in this case)
if FOrigin[Run] in ['a'..'z','A'..'Z'] then
begin
inc(Run);
Expand Down Expand Up @@ -2138,7 +2138,7 @@ procedure TmwBasePasLex.Next;
(*{$IFDEF D10_NEWER}
if fOrigin[Run] < #256 then
fProcTable[fOrigin[Run]]
else //non-ASCII unicode char
else //non-ASCII unicode AnsiChar
IdentProc;
{$ELSE}
fProcTable[fOrigin[Run]];
Expand Down Expand Up @@ -2440,7 +2440,7 @@ procedure TmwBasePasLex.SetCommentState(const Value: Pointer);

procedure TmwBasePasLex.SetLine(const Value: string);
begin
fOrigin := PChar(Value);
fOrigin := PAnsiChar(AnsiString(Value));
InitLine;
Next;
end;
Expand Down Expand Up @@ -2545,7 +2545,7 @@ destructor TmwPasLex.Destroy;
inherited Destroy;
end;

procedure TmwPasLex.SetOrigin(NewValue: PChar);
procedure TmwPasLex.SetOrigin(NewValue: PAnsiChar);
begin
inherited SetOrigin(NewValue);
fAheadLex.SetOrigin(NewValue);
Expand Down
2 changes: 1 addition & 1 deletion CastaliaPasLexTypes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ TmwPasLexStatus = record
ExID: TptTokenKind;
LineNumber: Integer;
LinePos: Integer;
Origin: PChar;
Origin: PAnsiChar;
RunPos: Integer;
TokenPos: Integer;
TokenID: TptTokenKind;
Expand Down
24 changes: 9 additions & 15 deletions CastaliaSimplePasPar.pas
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ TmwSimplePasPar = class(TObject)


FTopDefineRec: PDefineRec;
procedure EnterDefineBlock(ADefined: Boolean);
procedure ExitDefineBlock;
//procedure EnterDefineBlock(ADefined: Boolean);
//procedure ExitDefineBlock;
procedure ClearDefines;

procedure InitAhead;
//procedure InitAhead;

protected
FDefineStack: Integer;
Expand Down Expand Up @@ -801,9 +801,6 @@ procedure TmwSimplePasPar.HandlePtElseDirect(Sender: TmwBasePasLex);
end;

procedure TmwSimplePasPar.HandlePtElseIfDirect(Sender: TmwBasePasLex);
var
Param: string;
Def: string;
begin
// if FUseDefines then
// begin
Expand Down Expand Up @@ -869,9 +866,6 @@ procedure TmwSimplePasPar.HandlePtIfDefDirect(Sender: TmwBasePasLex);
end;

procedure TmwSimplePasPar.HandlePtIfDirect(Sender: TmwBasePasLex);
var
Def: string;
Param: string;
begin
// Param := Sender.DirectiveParam;
// if FUseDefines then
Expand Down Expand Up @@ -5930,12 +5924,12 @@ procedure TmwSimplePasPar.ClearDefines;
end;
end;

procedure TmwSimplePasPar.InitAhead;
{procedure TmwSimplePasPar.InitAhead;
begin
if AheadParse = nil then
AheadParse := TmwSimplePasPar.Create;
AheadParse.Lexer.InitFrom(Lexer);
end;
end;}

procedure TmwSimplePasPar.InitDefines;
begin
Expand Down Expand Up @@ -5985,7 +5979,7 @@ procedure TmwSimplePasPar.InitDefines;
// {$ENDIF}
end;

procedure TmwSimplePasPar.EnterDefineBlock(ADefined: Boolean);
{procedure TmwSimplePasPar.EnterDefineBlock(ADefined: Boolean);
var
StackFrame: PDefineRec;
begin
Expand Down Expand Up @@ -6015,9 +6009,9 @@ procedure TmwSimplePasPar.EnterDefineBlock(ADefined: Boolean);
// if TokenID = ptNull then
// Break;
// end;
end;
end;}

procedure TmwSimplePasPar.ExitDefineBlock;
{procedure TmwSimplePasPar.ExitDefineBlock;
var
StackFrame: PDefineRec;
begin
Expand All @@ -6029,7 +6023,7 @@ procedure TmwSimplePasPar.ExitDefineBlock;
FTopDefineRec := StackFrame^.Next;
Dispose(StackFrame);
end;
end;
end;}

{$IFDEF D8_NEWER} //JThurman 2004-03-03

Expand Down
1 change: 1 addition & 0 deletions __history/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.~*