diff options
author | Chimrod <> | 2023-10-03 18:19:15 +0200 |
---|---|---|
committer | Chimrod <> | 2023-10-15 19:04:36 +0200 |
commit | 5a18a66763bcc19de117cb83293d7bd25a0ea10c (patch) | |
tree | 1627ae50da1a87e5952b5fab21b7290b0555041e /lib/qparser/idents.ml | |
parent | 49f69c1ab4d3d8716f30d7bd36a66a4241e16d33 (diff) |
Switched the keyword from string to a sum type
Diffstat (limited to 'lib/qparser/idents.ml')
-rw-r--r-- | lib/qparser/idents.ml | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/lib/qparser/idents.ml b/lib/qparser/idents.ml index baf23dc..02fbac2 100644 --- a/lib/qparser/idents.ml +++ b/lib/qparser/idents.ml @@ -8,10 +8,10 @@ let _ = (fun (kwd, tok) -> Hashtbl.add keyword_table kwd tok) [ ("ACT", ACT); - ("ADDLIB", KEYWORD "INCLIB"); - ("ADDOBJ", KEYWORD "ADDOBJ"); - ("ADD OBJ", KEYWORD "ADDOBJ"); - ("ADDQST", KEYWORD "INCLIB"); + ("ADDLIB", KEYWORD T.IncLib); + ("ADDOBJ", KEYWORD T.Addobj); + ("ADD OBJ", KEYWORD T.Addobj); + ("ADDQST", KEYWORD T.IncLib); ("AND", AND); ("ARRCOMP", FUNCTION T.Arrcomp); ("ARRPOS", FUNCTION T.Arrpos); @@ -20,17 +20,17 @@ let _ = ; "BACKIMAGE", KEYWORD "BACKIMAGE" ; "$BACKIMAGE", KEYWORD "BACKIMAGE" ; "BCOLOR", KEYWORD "BCOLOR" *); - ("CLA", KEYWORD "CLA"); - ("CLEAR", KEYWORD "CLEAR"); - ("*CLEAR", KEYWORD "*CLEAR"); - ("CLOSE", KEYWORD "CLOSE"); - ("CLOSE ALL", KEYWORD "CLOSEALL"); - ("CLR", KEYWORD "CLEAR"); - ("*CLR", KEYWORD "*CLEAR"); - ("CLS", KEYWORD "CLS"); - ("CMDCLEAR", KEYWORD "CMDCLEAR"); - ("CMDCLR", KEYWORD "CMDCLEAR"); - ("COPYARR", KEYWORD "COPYARR"); + ("CLA", KEYWORD T.Cla); + ("CLEAR", KEYWORD T.Clear); + ("*CLEAR", KEYWORD T.Clear'); + ("CLOSE", KEYWORD T.Close); + ("CLOSE ALL", KEYWORD T.CloseAll); + ("CLR", KEYWORD T.Clear); + ("*CLR", KEYWORD T.Clear'); + ("CLS", KEYWORD T.Cls); + ("CMDCLEAR", KEYWORD T.CmdClear); + ("CMDCLR", KEYWORD T.CmdClear); + ("COPYARR", KEYWORD T.CopyArr); ("COUNTOBJ", FUNCTION T.Countobj); ("CURACTS", IDENT "CURACTS"); ("$CURACTS", IDENT "$CURACTS"); @@ -39,30 +39,30 @@ let _ = (* ; "DEBUG", KEYWORD "DEBUG" *); - ("DELACT", KEYWORD "DELACT"); - ("DEL ACT", KEYWORD "DELACT"); - ("DELLIB", KEYWORD "FREELIB"); - ("DELOBJ", KEYWORD "DELOBJ"); - ("DEL OBJ", KEYWORD "DELOBJ"); + ("DELACT", KEYWORD T.DelAct); + ("DEL ACT", KEYWORD T.DelAct); + ("DELLIB", KEYWORD T.FreeLib); + ("DELOBJ", KEYWORD T.DelObj); + ("DEL OBJ", KEYWORD T.DelObj); ("DESC", FUNCTION T.Desc); ("$DESC", FUNCTION T.Desc') (* ; "DISABLESCROLL", KEYWORD "DISABLESCROLL" ; "DISABLESUBEX", KEYWORD "DISABLESUBEX" *); - ("DYNAMIC", KEYWORD "DYNAMIC"); + ("DYNAMIC", KEYWORD T.Dynamic); ("DYNEVAL", FUNCTION T.Dyneval); ("$DYNEVAL", FUNCTION T.Dyneval'); ("ELSE", ELSE); ("ELSEIF", ELIF); ("END", END); - ("EXEC", KEYWORD "EXEC"); - ("EXIT", KEYWORD "EXIT") + ("EXEC", KEYWORD T.Exec); + ("EXIT", KEYWORD T.Exit) (* ; "FCOLOR", KEYWORD "FCOLOR" ; "$FNAME", KEYWORD "$FNAME" *); - ("FREELIB", KEYWORD "FREELIB") + ("FREELIB", KEYWORD T.FreeLib) (* ; "FSIZE", KEYWORD "FSIZE" *); @@ -70,26 +70,26 @@ let _ = ("$FUNC", FUNCTION T.Func'); ("GETOBJ", FUNCTION T.Getobj); ("$GETOBJ", FUNCTION T.Getobj'); - ("GOSUB", KEYWORD "GOSUB"); - ("GOTO", KEYWORD "GOTO") (* + ("GOSUB", KEYWORD T.Gosub); + ("GOTO", KEYWORD T.Goto) (* ; "GC", KEYWORD "GC" *); - ("GS", KEYWORD "GOSUB"); - ("GT", KEYWORD "GOTO"); + ("GS", KEYWORD T.Gosub); + ("GT", KEYWORD T.Goto); ("IF", IF); ("IIF", FUNCTION T.Iif); ("$IIF", FUNCTION T.Iif'); - ("INCLIB", KEYWORD "INCLIB"); + ("INCLIB", KEYWORD T.IncLib); ("INPUT", FUNCTION T.Input); ("$INPUT", FUNCTION T.Input'); ("INSTR", FUNCTION T.Instr); ("ISNUM", FUNCTION T.Isnum); ("ISPLAY", FUNCTION T.Isplay); - ("JUMP", KEYWORD "JUMP"); - ("KILLALL", KEYWORD "KILLALL"); - ("KILLOBJ", KEYWORD "KILLOBJ"); - ("KILLQST", KEYWORD "FREELIB"); - ("KILLVAR", KEYWORD "KILLVAR"); + ("JUMP", KEYWORD T.Jump); + ("KILLALL", KEYWORD T.KillAll); + ("KILLOBJ", KEYWORD T.KillObj); + ("KILLQST", KEYWORD T.FreeLib); + ("KILLVAR", KEYWORD T.KillVar); ("LCASE", FUNCTION T.Lcase); ("$LCASE", FUNCTION T.Lcase') (* @@ -99,19 +99,19 @@ let _ = ("LET", LET); ("LOC", FUNCTION T.Loc); ("MAINTXT", IDENT "MAINTXT"); - ("$MAINTXT", IDENT "MAINTXT"); + ("$MAINTXT", IDENT "$MAINTXT"); ("MAX", FUNCTION T.Max); ("$MAX", FUNCTION T.Max'); - ("MENU", KEYWORD "MENU"); + ("MENU", KEYWORD T.Menu); ("MID", FUNCTION T.Mid); ("$MID", FUNCTION T.Mid'); ("MIN", FUNCTION T.Min); ("$MIN", FUNCTION T.Min'); ("MOD", MOD); ("MSECSCOUNT", FUNCTION T.Msecscount); - ("MSG", KEYWORD "MSG"); - ("NL", KEYWORD "NL"); - ("*NL", KEYWORD "*NL"); + ("MSG", KEYWORD T.Msg); + ("NL", KEYWORD T.Nl); + ("*NL", KEYWORD T.Nl'); ("NO", NO) (* ; "NOSAVE", KEYWORD "NOSAVE" *); @@ -123,33 +123,33 @@ let _ = ("$ONOBJADD", IDENT "$ONOBJADD"); ("$ONOBJDEL", IDENT "$ONOBJDEL"); ("$ONOBJSEL", IDENT "$ONOBJSEL"); - ("OPENGAME", KEYWORD "OPENGAME"); - ("OPENQST", KEYWORD "OPENQST"); + ("OPENGAME", KEYWORD T.OpenGame); + ("OPENQST", KEYWORD T.OpenQst); ("OR", OR); - ("P", KEYWORD "P"); - ("*P", KEYWORD "*P"); - ("PL", KEYWORD "PL"); - ("*PL", KEYWORD "*PL"); - ("PLAY", KEYWORD "PLAY"); + ("P", KEYWORD T.P); + ("*P", KEYWORD T.P'); + ("PL", KEYWORD T.Pl); + ("*PL", KEYWORD T.Pl'); + ("PLAY", KEYWORD T.Play); ("QSPVER", FUNCTION T.Qspver); ("$QSPVER", FUNCTION T.Qspver'); ("RAND", FUNCTION T.Rand); - ("REFINT", KEYWORD "REFINT"); + ("REFINT", KEYWORD T.RefInt); ("REPLACE", FUNCTION T.Replace); ("$REPLACE", FUNCTION T.Replace'); ("RGB", FUNCTION T.Rgb); ("RND", FUNCTION T.Rnd); - ("SAVEGAME", KEYWORD "SAVEGAME"); + ("SAVEGAME", KEYWORD T.SaveGame); ("SELACT", FUNCTION T.Selact); ("$SELACT", IDENT "$SELACT"); ("SELOBJ", IDENT "SELOBJ"); ("$SELOBJ", IDENT "$SELOBJ"); ("SET", SET); - ("SETTIMER", KEYWORD "SETTIMER"); - ("SHOWACTS", KEYWORD "SHOWACTS"); - ("SHOWINPUT", KEYWORD "SHOWINPUT"); - ("SHOWOBJS", KEYWORD "SHOWOBJS"); - ("SHOWSTAT", KEYWORD "SHOWSTAT"); + ("SETTIMER", KEYWORD T.SetTimer); + ("SHOWACTS", KEYWORD T.ShowActs); + ("SHOWINPUT", KEYWORD T.ShowInput); + ("SHOWOBJS", KEYWORD T.ShowObjs); + ("SHOWSTAT", KEYWORD T.ShowStat); ("STATTXT", FUNCTION T.Stattxt); ("$STATTXT", FUNCTION T.Stattxt'); ("STR", FUNCTION T.Str); @@ -162,8 +162,8 @@ let _ = ("$TRIM", FUNCTION T.Trim'); ("UCASE", FUNCTION T.Ucase); ("$UCASE", FUNCTION T.Ucase'); - ("UNSEL", KEYWORD "UNSELECT"); - ("UNSELECT", KEYWORD "UNSELECT"); + ("UNSEL", KEYWORD T.Unselect); + ("UNSELECT", KEYWORD T.Unselect); ("USEHTML", IDENT "USEHTML"); ("USERCOM", IDENT "USERCOM"); ("$USERCOM", IDENT "$USERCOM"); @@ -172,8 +172,8 @@ let _ = ("USRTXT", IDENT "USER_TEXT"); ("$USRTXT", IDENT "USER_TEXT"); ("VAL", FUNCTION T.Val); - ("VIEW", KEYWORD "VIEW"); - ("WAIT", KEYWORD "WAIT"); - ("XGOTO", KEYWORD "XGOTO"); - ("XGT", KEYWORD "XGOTO"); + ("VIEW", KEYWORD T.View); + ("WAIT", KEYWORD T.Wait); + ("XGOTO", KEYWORD T.XGoto); + ("XGT", KEYWORD T.XGoto); ] |