[OCaml] Mobile-friendly clone of cgit.
refactor remove dead exports from highlight_grammars.ml
- Remove find_grammar: never called (highlight.ml uses registry + scope_of_lang directly) - Remove supported_languages: never referenced from any module - Remove elixir/erlang entries from scope_of_lang: no grammar files shipped for these - Clarify docstring: only languages with bundled grammars are listed
lib/highlight_grammars.ml
@@ -63,7 +63,11 @@
63
63
t)
64
64
65
65
(** Map from the canonical language name (as returned by {!Syntax.detect}) to
66
Removed:
the scopeName used by the grammar file. This bridges the naming gap. *)
66
Added:
the scopeName used by the grammar file. This bridges the naming gap.
67
Added:
68
Added:
Only languages for which a grammar JSON is actually bundled appear here.
69
Added:
Languages detected by {!Syntax} but without a shipped grammar (e.g. elixir,
70
Added:
erlang, lisp, awk) gracefully degrade to plain text in {!Highlight}. *)
67
71
let scope_of_lang = function
68
72
| "c" -> Some "source.c"
69
73
| "cpp" -> Some "source.cpp"
@@ -71,8 +75,6 @@
71
75
| "css" -> Some "source.css"
72
76
| "diff" -> Some "source.diff"
73
77
| "dockerfile" -> Some "source.dockerfile"
74
Removed:
| "elixir" -> Some "source.elixir"
75
Removed:
| "erlang" -> Some "source.erlang"
76
78
| "go" -> Some "source.go"
77
79
| "haskell" -> Some "source.haskell"
78
80
| "html" | "xml" -> Some "text.html.basic"
@@ -100,19 +102,3 @@
100
102
| "yaml" -> Some "source.yaml"
101
103
| "zig" -> Some "source.zig"
102
104
| _ -> None
103
Removed:
104
Removed:
(** Find a grammar for the given language name. *)
105
Removed:
let find_grammar lang =
106
Removed:
let t = Lazy.force registry in
107
Removed:
match scope_of_lang lang with
108
Removed:
| None -> None
109
Removed:
| Some scope -> TmLanguage.find_by_scope_name t scope
110
Removed:
111
Removed:
(** List of all supported language names. *)
112
Removed:
let supported_languages =
113
Removed:
[
114
Removed:
"c"; "cpp"; "csharp"; "css"; "diff"; "dockerfile"; "go"; "haskell"; "html";
115
Removed:
"java"; "javascript"; "json"; "kotlin"; "lua"; "makefile"; "markdown"; "nix";
116
Removed:
"ocaml"; "perl"; "php"; "python"; "r"; "ruby"; "rust"; "scala"; "bash";
117
Removed:
"sql"; "swift"; "toml"; "typescript"; "xml"; "yaml"; "zig";
118
Removed:
]