open Tokens module T = Qsp_syntax.T let keyword_table = Hashtbl.create 53 (* Thoses ident are considered as variables and not declared here "BACKIMAGE", "$BACKIMAGE", "BCOLOR", "DEBUG", "DISABLESCROLL" "DISABLESUBEX", "FCOLOR", "$FNAME", "FSIZE", "GC", "LCOLOR", "NOSAVE" *) let _ = List.iter (fun (kwd, tok) -> Hashtbl.add keyword_table kwd tok) [ ("ACT", ACT); ("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); ("ARRSIZE", FUNCTION T.Arrsize); ("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"); ("CURLOC", IDENT "CURLOC"); ("$CURLOC", IDENT "$CURLOC"); ("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'); ("DYNAMIC", KEYWORD T.Dynamic); ("DYNEVAL", FUNCTION T.Dyneval); ("$DYNEVAL", FUNCTION T.Dyneval'); ("ELSE", ELSE); ("ELSEIF", ELIF); ("END", END); ("EXEC", KEYWORD T.Exec); ("EXIT", KEYWORD T.Exit); ("FREELIB", KEYWORD T.FreeLib); ("FUNC", FUNCTION T.Func); ("$FUNC", FUNCTION T.Func'); ("GETOBJ", FUNCTION T.Getobj); ("$GETOBJ", FUNCTION T.Getobj'); ("GOSUB", KEYWORD T.Gosub); ("GOTO", KEYWORD T.Goto); ("GS", KEYWORD T.Gosub); ("GT", KEYWORD T.Goto); ("IF", IF); ("IIF", FUNCTION T.Iif); ("$IIF", FUNCTION T.Iif'); ("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 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'); ("LEN", FUNCTION T.Len); ("LET", LET); ("LOC", FUNCTION T.Loc); ("MAINTXT", IDENT "MAINTXT"); ("$MAINTXT", IDENT "$MAINTXT"); ("MAX", FUNCTION T.Max); ("$MAX", FUNCTION T.Max'); ("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 T.Msg); ("NL", KEYWORD T.Nl); ("*NL", KEYWORD T.Nl'); ("NO", NO); ("OBJ", OBJ); ("$ONACTSEL", IDENT "$ONACTSEL"); ("$ONGLOAD", IDENT "$ONGLOAD"); ("$ONGSAVE", IDENT "$ONGSAVE"); ("$ONNEWLOC", IDENT "$ONNEWLOC"); ("$ONOBJADD", IDENT "$ONOBJADD"); ("$ONOBJDEL", IDENT "$ONOBJDEL"); ("$ONOBJSEL", IDENT "$ONOBJSEL"); ("OPENGAME", KEYWORD T.OpenGame); ("OPENQST", KEYWORD T.OpenQst); ("OR", OR); ("P", KEYWORD T.P); ("*P", KEYWORD T.P'); ("PL", KEYWORD T.Pl); ("*PL", KEYWORD T.Pl'); ("PLAY", KEYWORD T.Play); ("$QSPVER", IDENT "$QSPVER"); ("QSPVER", IDENT "$QSPVER"); ("RAND", FUNCTION T.Rand); ("REFINT", KEYWORD T.RefInt); ("REPLACE", FUNCTION T.Replace); ("$REPLACE", FUNCTION T.Replace'); ("RGB", FUNCTION T.Rgb); ("RND", FUNCTION_NOARGS T.Rnd); ("SAVEGAME", KEYWORD T.SaveGame); ("SELACT", FUNCTION T.Selact); ("$SELACT", IDENT "$SELACT"); ("SELOBJ", IDENT "SELOBJ"); ("$SELOBJ", IDENT "$SELOBJ"); ("SET", SET); ("SETTIMER", KEYWORD T.SetTimer); ("SHOWACTS", KEYWORD T.ShowActs); ("SHOWINPUT", KEYWORD T.ShowInput); ("SHOWOBJS", KEYWORD T.ShowObjs); ("SHOWSTAT", KEYWORD T.ShowStat); ("STATTXT", IDENT "STATTXT"); ("$STATTXT", IDENT "$STATTXT"); ("STR", FUNCTION T.Str); ("$STR", FUNCTION T.Str'); ("STRCOMP", FUNCTION T.Strcomp); ("STRFIND", FUNCTION T.Strfind); ("$STRFIND", FUNCTION T.Strfind'); ("STRPOS", FUNCTION T.Strpos); ("TRIM", FUNCTION T.Trim); ("$TRIM", FUNCTION T.Trim'); ("UCASE", FUNCTION T.Ucase); ("$UCASE", FUNCTION T.Ucase'); ("UNSEL", KEYWORD T.Unselect); ("UNSELECT", KEYWORD T.Unselect); ("USEHTML", IDENT "USEHTML"); ("USERCOM", IDENT "USERCOM"); ("$USERCOM", IDENT "$USERCOM"); ("USER_TEXT", IDENT "USER_TEXT"); ("$USER_TEXT", IDENT "USER_TEXT"); ("USRTXT", IDENT "USER_TEXT"); ("$USRTXT", IDENT "USER_TEXT"); ("VAL", FUNCTION T.Val); ("VIEW", KEYWORD T.View); ("WAIT", KEYWORD T.Wait); ("XGOTO", KEYWORD T.XGoto); ("XGT", KEYWORD T.XGoto); ]