Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Jun 12, 2024
1 parent 27b0344 commit da09308
Show file tree
Hide file tree
Showing 7 changed files with 458 additions and 706 deletions.
22 changes: 2 additions & 20 deletions Source/ide/mpaslex.pas
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ TmwBasePasLex = class(TObject)
fLineNumber: Integer;
fTokenID: TptTokenKind;
fLinePos: Integer;
fExID: TptTokenKind;
fOnCompilerDirective: TDirectiveEvent;
fOnIDEDirective: TDirectiveEvent;
fOnElseDirect: TDirectiveEvent;
Expand Down Expand Up @@ -187,7 +186,6 @@ TmwBasePasLex = class(TObject)
property TokenLen: Integer read GetTokenLen;
property TokenPos: Integer read fTokenPos;
property TokenID: TptTokenKind read FTokenID;
property ExID: TptTokenKind read fExID;

property OnCompilerDirective: TDirectiveEvent read fOnCompilerDirective write fOnCompilerDirective;
property OnIDEDirective: TDirectiveEvent read fOnIDEDirective write fOnIDEDirective;
Expand All @@ -213,7 +211,6 @@ TmwPasLex = class(TmwBasePasLex)
private
fAheadLex: TmwBasePasLex;

function GetAheadExID: TptTokenKind;
function GetAheadToken: string;
function GetAheadTokenID: TptTokenKind;
public
Expand All @@ -224,7 +221,6 @@ TmwPasLex = class(TmwBasePasLex)
property AheadLex: TmwBasePasLex read fAheadLex;
property AheadToken: string read GetAheadToken;
property AheadTokenID: TptTokenKind read GetAheadTokenID;
property AheadExID: TptTokenKind read GetAheadExID;
end;

TLexerStack = specialize TSimbaStack<TmwPasLex>;
Expand Down Expand Up @@ -344,8 +340,6 @@ constructor TmwBasePasLex.Create(Doc: String; AFileName: String = '');
if (fFileName <> '') and FileExists(fFileName) then
fFileAge := SysUtils.FileAge(fFileName);

fExID := tokUnKnown;

FIdentBuffer := GetMem(MaxTokenNameLength + 1);
FIdentBufferUpper := PtrUInt(@FIdentBuffer[MaxTokenNameLength]);

Expand Down Expand Up @@ -727,14 +721,8 @@ procedure TmwBasePasLex.IdentProc;
Ptr^ := #0;

if (fRun - fTokenPos <= MaxTokenNameLength) then
begin
fTokenID := KeywordDictionary[FIdentBuffer];
if (fTokenID in ExTokens) then
begin
fExID := fTokenID;
fTokenID := tokIdentifier;
end;
end else
fTokenID := KeywordDictionary[FIdentBuffer]
else
fTokenID := tokIdentifier;
end;

Expand Down Expand Up @@ -1098,7 +1086,6 @@ procedure TmwBasePasLex.UnknownProc;

procedure TmwBasePasLex.Next;
begin
fExID := tokUnknown;
fTokenPos := fRun;

case fCommentState of
Expand Down Expand Up @@ -1291,11 +1278,6 @@ procedure TmwPasLex.AheadNext;
fAheadLex.NextNoJunk;
end;

function TmwPasLex.GetAheadExID: TptTokenKind;
begin
Result := fAheadLex.ExID;
end;

function TmwPasLex.GetAheadToken: string;
begin
Result := fAheadLex.Token;
Expand Down
12 changes: 2 additions & 10 deletions Source/ide/mpaslextypes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ interface

tokAdd,
tokAddressOp,
tokAmpersand,
tokAnd,
tokAnsiComment,
tokArray,
Expand All @@ -63,14 +62,13 @@ interface
tokBorComment,
tokBraceClose,
tokBraceOpen,
tokBreak,
tokCase,
tokColon,
tokComma,
tokCompilerDirective,
tokConst,
tokConstRef,
tokContinue,

tokCRLF,
tokCRLFCo,
tokDefineDirect,
Expand All @@ -87,7 +85,6 @@ interface
tokEnum,
tokEqual,
tokExcept,
tokExit,
tokExternal,
tokFinally,
tokFloat,
Expand Down Expand Up @@ -121,7 +118,6 @@ interface
tokNull,
tokObject,
tokOf,
tokOn,
tokOperator,
tokOr,
tokOut,
Expand Down Expand Up @@ -210,11 +206,7 @@ TKeywordDictionary = class(TObject)

const
KeywordTokens = [
tokAdd, tokIf, tokDo, tokAnd, tokAs, tokOf, tokAt, tokEnd, tokIn, tokCase, tokIs, tokOn, tokLabel, tokMod, tokOr, tokTo, tokDiv, tokBegin, tokBreak, tokFor, tokShl, tokPacked, tokVar, tokElse, tokSet, tokShr, tokThen, tokNot, tokRaise, tokEnum, tokObject, tokOut, tokWhile, tokXor, tokGoto, tokExit, tokWith, tokArray, tokTry, tokRecord, tokRepeat, tokType, tokConst, tokNative, tokStatic, tokExcept, tokUnion, tokUntil, tokFinally, tokDeprecated, tokForward, tokProgram, tokStrict, tokDownto, tokOverload, tokOverride, tokExternal, tokConstref, tokContinue, tokFunction, tokProcedure, tokOperator, tokProperty
];

ExTokens = [
tokAdd, tokAt, tokOn, tokBreak, tokOut, tokExit, tokDeprecated, tokForward, tokOverload, tokOverride, tokExternal, tokContinue, tokStatic
tokIf, tokDo, tokAnd, tokAs, tokOf, tokEnd, tokIn, tokCase, tokIs, tokLabel, tokMod, tokOr, tokTo, tokDiv, tokBegin, tokFor, tokShl, tokPacked, tokVar, tokElse, tokSet, tokShr, tokThen, tokNot, tokEnum, tokObject, tokOut, tokWhile, tokXor, tokGoto, tokWith, tokArray, tokTry, tokRecord, tokRepeat, tokType, tokConst, tokNative, tokStatic, tokExcept, tokUnion, tokUntil, tokFinally, tokDeprecated, tokForward, tokProgram, tokStrict, tokDownto, tokOverload, tokOverride, tokExternal, tokConstref, tokFunction, tokProcedure, tokOperator, tokProperty, tokRaise
];

JunkTokens = [
Expand Down
Loading

0 comments on commit da09308

Please sign in to comment.