let is_keyword =
              let keywords =
                List.fold_right StringSet.add
                  [ "and"; "as"; "assert"; "begin"; "class"; "constraint";
                    "do"; "done"; "downto"; "else"; "end"; "exception";
                    "external"; "false"; "for"; "fun"; "function"; "functor";
                    "if"; "in"; "include"; "inherit"; "initializer"; "lazy";
                    "let"; "match"; "method"; "module"; "mutable"; "new";
                    "object"; "of"; "open"; "parser"; "private"; "rec";
                    "sig"; "struct"; "then"; "to"; "true"; "try"; "type";
                    "val"; "virtual"; "when"; "while"; "with" ]
                  StringSet.empty
              in fun s -> StringSet.mem s keywords