diff --git a/frontend/src/ts/constants/languages.ts b/frontend/src/ts/constants/languages.ts index 776821762..9826154ff 100644 --- a/frontend/src/ts/constants/languages.ts +++ b/frontend/src/ts/constants/languages.ts @@ -352,6 +352,7 @@ export const LanguageGroups: Record = { "code_typescript", "code_cobol", "code_common_lisp", + "code_ocaml", "code_odin", "code_fortran", "code_abap", diff --git a/frontend/static/languages/code_ocaml.json b/frontend/static/languages/code_ocaml.json new file mode 100644 index 000000000..4b049d26e --- /dev/null +++ b/frontend/static/languages/code_ocaml.json @@ -0,0 +1,501 @@ +{ + "name": "code_ocaml", + "noLazyMode": true, + "words": [ + "!", + "#", + "&", + "&&", + "'", + "(*", + "*)", + "(**", + "(", + ")", + "*", + "*.", + "**", + "+", + "+.", + ",", + "-", + "-.", + "->", + ".", + ".field", + "..", + "/", + "/.", + ":", + "::", + ":=", + ":>", + ";", + ";;", + "<", + "<-", + "<=", + "<>", + "=", + "==", + ">", + ">=", + ">>", + ">>=", + ">>|", + ">|", + ">>?", + ">|?", + "@@", + "@@@", + "@", + "[", + "[|", + "]", + "^", + "_", + "`", + "`Ok", + "`Error", + "`Left", + "`Right", + "`Some", + "`None", + "{", + "{ field =", + "; field =", + "{ record with", + "{<", + "{|", + "|}", + "|}]", + "|", + "|>", + "|> fun x ->", + "|> List.map ~f:", + "||", + "|]", + "}", + "~", + "~f:", + "~f:(fun", + "~key:", + "~data:", + "~init:", + "~compare:", + "~equal:", + "~hash:", + "~sexp_of:", + "~of_sexp:", + "?exn", + "?exn:", + "?(exn", + "?timeout", + "?timeout:", + "?(timeout", + "?buffer_size", + "?buffer_size:", + "?(buffer_size", + "?pos", + "?pos:", + "?(pos", + "?len", + "?len:", + "?(len", + "?default", + "?default:", + "?(default", + "\"%s\"", + "\"%d\"", + "\"%f\"", + "\"%b\"", + "\"%i\"", + "\"%ld\"", + "\"%Ld\"", + "and", + "as", + "assert", + "assert (", + "assert false", + "asr", + "begin", + "class", + "constraint", + "do", + "done", + "downto", + "else", + "end", + "exception", + "external", + "false", + "for", + "fun", + "function", + "functor", + "if", + "in", + "include", + "include module type of", + "inherit", + "initializer", + "land", + "lazy", + "let", + "let%bind", + "let%map", + "let%map2", + "let%map3", + "let%mapn", + "let%sub", + "let%arr", + "let%pattern_bind", + "let%tydi", + "let%expect_test", + "let%test", + "let%test_unit", + "let%test_module", + "let%bench", + "let%bench_fun", + "let%bench_module", + "match%bind", + "match%map", + "if%bind", + "if%map", + "while%bind", + "for%bind", + "lor", + "lsl", + "lsr", + "lxor", + "match", + "method", + "mod", + "module", + "module Make", + "module Make (", + ") =", + ") : S =", + "module type", + "module type S =", + "mutable", + "new", + "nonrec", + "not", + "object", + "of", + "open", + "open!", + "or", + "private", + "rec", + "sig", + "struct", + "then", + "to", + "true", + "try", + "type", + "type t =", + "type 'a t =", + "val", + "virtual", + "when", + "while", + "with", + "[@@deriving sexp]", + "[@@deriving compare]", + "[@@deriving equal]", + "[@@deriving hash]", + "[@@deriving yojson]", + "[@@deriving show]", + "[@@deriving ord]", + "[@@deriving enum]", + "[@default", + "[@key", + "[@tailcall]", + "[@inline]", + "[@cold]", + "[@warning", + "[@alert", + "[@sexp.option]", + "[@sexp.list]", + "[@sexp.opaque]", + "[%sexp", + "[%compare:", + "[%equal:", + "[%hash:", + "[%sexp_of:", + "[%of_sexp:", + "[%message", + "[%log.debug", + "[%log.info", + "[%log.error", + "[%log", + "[%log.global.debug", + "[%log.global.info", + "[%log.global.error", + "[%string", + "[%expr", + "[%type:", + "[%pat?", + "[%expect {|", + "[%test", + "[%test_result:", + "[%test_eq:", + "[%test_pred", + "int", + "float", + "bool", + "char", + "string", + "unit", + "list", + "array", + "option", + "ref", + "exn", + "int32", + "int64", + "nativeint", + "bytes", + "result", + "Or_error.t", + "Sexp.t", + "Error.t", + "String.t", + "Int.t", + "Float.t", + "'a", + "'b", + "'c", + "'key", + "'value", + "'data", + "'msg", + "'error", + "Some", + "None", + "Ok", + "Error", + "[]", + "()", + "(fun", + "(fun x ->", + "(fun () ->", + "(fun ~key ~data ->", + "(function", + "| [] ->", + "| h :: t ->", + "| Some x ->", + "| None ->", + "| Ok x ->", + "| Error e ->", + "| 0 ->", + "| n ->", + "| _ ->", + "| exception", + "x ->", + "y ->", + "acc ->", + "~f:( fun", + "~init:0", + "~init:[]", + "~init:\"\"", + "~compare:String.compare", + "~compare:Int.compare", + "~equal:String.equal", + "~equal:Int.equal", + ": int =", + ": string =", + ": bool =", + ": unit =", + ": 'a list =", + ": 'a option =", + ": ('a, 'b) result =", + "int ->", + "string ->", + "bool ->", + "unit ->", + "'a ->", + "'a list ->", + "'a option ->", + "?exn:exn ->", + "List.map", + "List.filter", + "List.fold", + "List.fold_left", + "List.fold_right", + "List.iter", + "List.length", + "List.rev", + "List.append", + "List.concat", + "List.hd", + "List.tl", + "List.nth", + "List.mem", + "List.find", + "List.find_opt", + "List.find_map", + "List.exists", + "List.for_all", + "List.sort", + "List.partition", + "List.flatten", + "Array.make", + "Array.init", + "Array.get", + "Array.set", + "Array.length", + "Array.map", + "Array.iter", + "Array.fold_left", + "Array.fold_right", + "Array.sort", + "String.length", + "String.get", + "String.sub", + "String.concat", + "String.split_on_char", + "String.uppercase_ascii", + "String.lowercase_ascii", + "String.trim", + "String.map", + "String.iter", + "String.index_opt", + "String.contains", + "String.starts_with", + "String.ends_with", + "Option.map", + "Option.bind", + "Option.value", + "Option.get", + "Option.is_some", + "Option.is_none", + "Option.value_exn", + "Option.join", + "Result.map", + "Result.bind", + "Result.map_error", + "Result.is_ok", + "Result.is_error", + "Result.get_ok", + "Result.get_error", + "Hashtbl.create", + "Hashtbl.add", + "Hashtbl.find", + "Hashtbl.find_opt", + "Hashtbl.mem", + "Hashtbl.remove", + "Hashtbl.iter", + "Map.empty", + "Map.add", + "Map.find", + "Map.find_opt", + "Map.mem", + "Map.remove", + "Map.iter", + "Map.fold", + "Set.empty", + "Set.add", + "Set.mem", + "Set.remove", + "Set.union", + "Set.inter", + "Set.diff", + "Set.iter", + "Queue.create", + "Queue.add", + "Queue.take", + "Queue.peek", + "Queue.is_empty", + "Stack.create", + "Stack.push", + "Stack.pop", + "Stack.top", + "Stack.is_empty", + "Sys.argv", + "Sys.file_exists", + "Sys.is_directory", + "Sys.remove", + "Sys.rename", + "Sys.getenv", + "Sys.getenv_opt", + "abs", + "abs_float", + "acos", + "asin", + "atan", + "ceil", + "cos", + "exp", + "floor", + "fst", + "snd", + "ignore", + "incr", + "decr", + "max", + "min", + "max_int", + "min_int", + "mod_float", + "nan", + "infinity", + "neg_infinity", + "pred", + "succ", + "sqrt", + "sin", + "tan", + "log", + "log10", + "print_string", + "print_int", + "print_float", + "print_endline", + "print_newline", + "prerr_string", + "prerr_int", + "prerr_endline", + "read_line", + "read_int", + "read_float", + "open_in", + "open_out", + "close_in", + "close_out", + "input_line", + "output_string", + "flush", + "raise", + "failwith", + "invalid_arg", + "compare", + "Printf.printf", + "Printf.sprintf", + "Printf.fprintf", + "Printf.eprintf", + "Format.printf", + "Format.sprintf", + "Format.fprintf", + "Format.eprintf", + "Lwt.return", + "Lwt.bind", + "Lwt.map", + "Lwt.catch", + "Lwt.async", + "Lwt.pick", + "Lwt.choose", + "Lwt.join", + "Lwt_main.run", + "Async.return", + "Async.bind", + "Async.map", + "Deferred.return", + "Deferred.bind", + "Deferred.map", + "Deferred.all" + ] +} diff --git a/packages/schemas/src/languages.ts b/packages/schemas/src/languages.ts index afa1134e2..a54594a46 100644 --- a/packages/schemas/src/languages.ts +++ b/packages/schemas/src/languages.ts @@ -409,6 +409,7 @@ export const LanguageSchema = z.enum( "code_v", "code_ook", "code_typescript", + "code_ocaml", "code_odin", "xhosa", "xhosa_3k",