feat(languages): add code ocaml language (@informal-stripes-condo) (#7000)

### Description

Add Code OCaml Language

### Checks

- [x] Adding a language?
- Make sure to follow the [languages
documentation](https://github.com/monkeytypegame/monkeytype/blob/master/docs/LANGUAGES.md)
  - [x] Add language to `packages/schemas/src/languages.ts`
- [x] Add language to exactly one group in
`frontend/src/ts/constants/languages.ts`
  - [x] Add language json file to `frontend/static/languages` 
- [x] Check if any open issues are related to this PR; if so, be sure to
tag them below.
- [x] Make sure the PR title follows the Conventional Commits standard.
(https://www.conventionalcommits.org for more info)
- [x] Make sure to include your GitHub username prefixed with @ inside
parentheses at the end of the PR title.

<!-- label(optional scope): pull request title (@your_github_username)
-->

<!-- I know I know they seem boring but please do them, they help us and
you will find out it also helps you.-->

<!-- the issue(s) your PR resolves if any (delete if that is not the
case) -->
<!-- please also reference any issues and or PRs related to your pull
request -->
<!-- Also remove it if you are not following any issues. -->

<!-- pro tip: you can mention an issue, PR, or discussion on GitHub by
referencing its hash number e.g:
[#1234](https://github.com/monkeytypegame/monkeytype/pull/1234) -->

<!-- pro tip: you can press . (dot or period) in the code tab of any
GitHub repo to get access to GitHub's VS Code web editor Enjoy! :) -->
This commit is contained in:
informal-stripes-condo 2025-10-15 09:38:03 +01:00 committed by GitHub
parent 00552366b2
commit 820ac7148e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 503 additions and 0 deletions

View file

@ -352,6 +352,7 @@ export const LanguageGroups: Record<string, Language[]> = {
"code_typescript",
"code_cobol",
"code_common_lisp",
"code_ocaml",
"code_odin",
"code_fortran",
"code_abap",

View file

@ -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"
]
}

View file

@ -409,6 +409,7 @@ export const LanguageSchema = z.enum(
"code_v",
"code_ook",
"code_typescript",
"code_ocaml",
"code_odin",
"xhosa",
"xhosa_3k",