Skip to content

Commit

Permalink
added lexer support for 'Each'
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenVandezande committed Sep 28, 2013
1 parent f740ef5 commit 37f269a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
48 changes: 25 additions & 23 deletions CastaliaPasLex.pas
Expand Up @@ -109,6 +109,7 @@ TmwBasePasLex = class(TObject)
function KeyComp(const aKey: String): Boolean;
function Func9: TptTokenKind;
function Func15: TptTokenKind;
function Func17: TptTokenKind;
function Func19: TptTokenKind;
function Func20: TptTokenKind;
function Func21: TptTokenKind;
Expand Down Expand Up @@ -545,6 +546,7 @@ procedure TmwBasePasLex.InitIdent;
case I of
9: fIdentFuncTable[I] := @Func9;
15: fIdentFuncTable[I] := @Func15;
17: fIdentFuncTable[I] := @Func17;
19: fIdentFuncTable[I] := @Func19;
20: fIdentFuncTable[I] := @Func20;
21: fIdentFuncTable[I] := @Func21;
Expand Down Expand Up @@ -642,10 +644,11 @@ procedure TmwBasePasLex.InitIdent;
9: fIdentFuncTable[I] := Func9;
{$ENDIF}
15: fIdentFuncTable[I] := Func15;
19: fIdentFuncTable[I] := Func19;
17: fIdentFuncTable[I] := Func17;
19: fIdentFuncTable[I] := Func19;
20: fIdentFuncTable[I] := Func20;
21: fIdentFuncTable[I] := Func21;
23: fIdentFuncTable[I] := Func23;
23: fIdentFuncTable[I] := Func23;
25: fIdentFuncTable[I] := Func25;
27: fIdentFuncTable[I] := Func27;
28: fIdentFuncTable[I] := Func28;
Expand All @@ -657,13 +660,13 @@ procedure TmwBasePasLex.InitIdent;
36: fIdentFuncTable[I] := Func36;
37: fIdentFuncTable[I] := Func37;
38: fIdentFuncTable[I] := Func38;
39: fIdentFuncTable[I] := Func39;
39: fIdentFuncTable[I] := Func39;
40: fIdentFuncTable[I] := Func40;
41: fIdentFuncTable[I] := Func41;
{$IFDEF D8_NEWER} //JThurman 2004-03-2003
42: fIdentFuncTable[I] := Func42;
{$ENDIF}
43: fIdentFuncTable[I] := Func43;
41: fIdentFuncTable[I] := Func41;
{$IFDEF D8_NEWER} //JThurman 2004-03-2003
42: fIdentFuncTable[I] := Func42;
{$ENDIF}
43: fIdentFuncTable[I] := Func43;
44: fIdentFuncTable[I] := Func44;
45: fIdentFuncTable[I] := Func45;
46: fIdentFuncTable[I] := Func46;
Expand All @@ -675,12 +678,12 @@ procedure TmwBasePasLex.InitIdent;
56: fIdentFuncTable[I] := Func56;
57: fIdentFuncTable[I] := Func57;
58: fIdentFuncTable[I] := Func58;
59: fIdentFuncTable[I] := Func59;
59: fIdentFuncTable[I] := Func59;
60: fIdentFuncTable[I] := Func60;
61: fIdentFuncTable[I] := Func61;
62: fIdentFuncTable[I] := Func62;
62: fIdentFuncTable[I] := Func62;
63: fIdentFuncTable[I] := Func63;
64: fIdentFuncTable[I] := Func64;
64: fIdentFuncTable[I] := Func64;
65: fIdentFuncTable[I] := Func65;
66: fIdentFuncTable[I] := Func66;
69: fIdentFuncTable[I] := Func69;
Expand All @@ -696,8 +699,8 @@ procedure TmwBasePasLex.InitIdent;
79: fIdentFuncTable[I] := Func79;
81: fIdentFuncTable[I] := Func81;
84: fIdentFuncTable[I] := Func84;
85: fIdentFuncTable[I] := Func85;
86: fIdentFuncTable[I] := Func86;
85: fIdentFuncTable[I] := Func85;
86: fIdentFuncTable[I] := Func86;
87: fIdentFuncTable[I] := Func87;
88: fIdentFuncTable[I] := Func88;
{$IFDEF D8_NEWER} //JThurman 2004-03-03
Expand All @@ -712,12 +715,12 @@ procedure TmwBasePasLex.InitIdent;
98: fIdentFuncTable[I] := Func98;
99: fIdentFuncTable[I] := Func99;
100: fIdentFuncTable[I] := Func100;
101: fIdentFuncTable[I] := Func101;
101: fIdentFuncTable[I] := Func101;
102: fIdentFuncTable[I] := Func102;
103: fIdentFuncTable[I] := Func103;
104: fIdentFuncTable[I] := Func104;
105: fIdentFuncTable[I] := Func105;
106: fIdentFuncTable[I] := Func106;
106: fIdentFuncTable[I] := Func106;
107: fIdentFuncTable[I] := Func107;
108: fIdentFuncTable[I] := Func108;
112: fIdentFuncTable[I] := Func112;
Expand All @@ -726,11 +729,11 @@ procedure TmwBasePasLex.InitIdent;
126: fIdentFuncTable[I] := Func126;
127: fIdentFuncTable[I] := Func127;
128: fIdentFuncTable[I] := Func128;
129: fIdentFuncTable[I] := Func129;
129: fIdentFuncTable[I] := Func129;
130: fIdentFuncTable[I] := Func130;
132: fIdentFuncTable[I] := Func132;
133: fIdentFuncTable[I] := Func133;
136: fIdentFuncTable[I] := Func136;
136: fIdentFuncTable[I] := Func136;
141: fIdentFuncTable[I] := Func141;
143: fIdentFuncTable[I] := Func143;
166: fIdentFuncTable[I] := Func166;
Expand Down Expand Up @@ -796,40 +799,39 @@ function TmwBasePasLex.Func9: TptTokenKind;

function TmwBasePasLex.Func15: TptTokenKind;
begin
result := TptTokenKind.ptIdentifier;
if KeyComp('If') then result := TptTokenKind.ptIf;
end;

function TmwBasePasLex.Func17: TptTokenKind;
begin
if KeyComp('Each') then result := TptTokenKind.ptEach;
end;

function TmwBasePasLex.Func19: TptTokenKind;
begin
result := TptTokenKind.ptIdentifier;
if KeyComp('Do') then result := TptTokenKind.ptDo else
if KeyComp('And') then result := TptTokenKind.ptAnd;
end;

function TmwBasePasLex.Func20: TptTokenKind;
begin
result := TptTokenKind.ptIdentifier;
if KeyComp('As') then result := TptTokenKind.ptAs;
end;

function TmwBasePasLex.Func21: TptTokenKind;
begin
Result := TptTokenKind.ptIdentifier;
if KeyComp('Of') then Result := TptTokenKind.ptOf else
if KeyComp('At') then fExID := TptTokenKind.ptAt;
end;

function TmwBasePasLex.Func23: TptTokenKind;
begin
Result := TptTokenKind.ptIdentifier;
if KeyComp('End') then Result := TptTokenKind.ptEnd else
if KeyComp('In') then Result := TptTokenKind.ptIn;
end;

function TmwBasePasLex.Func25: TptTokenKind;
begin
Result := TptTokenKind.ptIdentifier;
if KeyComp('Far') then fExID := TptTokenKind.ptFar;
end;

Expand Down
3 changes: 2 additions & 1 deletion CastaliaPasLexTypes.pas
Expand Up @@ -45,6 +45,7 @@ interface
{$ELSE}
TptTokenKind = (
{$ENDIF}
ptIdentifier, //default value so it does not need to be set in each lookup method
ptAbort, //JThurman 2004-11-8 (flow control routines)
ptAbsolute,
ptAbstract,
Expand Down Expand Up @@ -104,6 +105,7 @@ interface
ptDownto,
ptDWORD,
ptDynamic,
ptEach,
ptElse,
ptElseDirect,
ptEnd,
Expand Down Expand Up @@ -134,7 +136,6 @@ interface
{$IFDEF D8_NEWER} //JThurman 2004-04-06
ptHelper,
{$ENDIF}
ptIdentifier,
ptIf,
ptIfDirect,
ptIfEndDirect,
Expand Down

0 comments on commit 37f269a

Please sign in to comment.