package kkmarkdown

  1. Overview
  2. Docs

Source file AllBlockRules.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(** List of all block rules in descending order *)
let all : (module BlockRule.S) list =
  [
    (module BlockRuleHr);
    (module BlockRuleHeader.Sharp);
    (module BlockRuleHeader.H1);
    (module BlockRuleHeader.H2);
    (module BlockRuleList.Ol);
    (module BlockRuleList.UlStar);
    (module BlockRuleList.UlPlus);
    (module BlockRuleList.UlMinus);
    (module BlockRuleCode.Backquote);
    (module BlockRuleCode.Tilde);
    (module BlockRuleCode.UnsafeBackquote);
    (module BlockRuleCode.UnsafeTilde);
    (module BlockRuleCode.Indent);
    (module BlockRuleQuote);
    (module BlockRuleInlineHTML.Div);
    (module BlockRuleInlineHTML.Script);
    (module BlockRuleImg);
    (module BlockRuleP);
  ]

module Map = FirstChar.Map (struct
  module type Rule = BlockRule.S

  let first_char rule =
    let module Rule = (val rule : BlockRule.S) in
    Rule.first_char
end)

let first_char_map, any = Map.init all
let find c = Map.find c first_char_map
OCaml

Innovation. Community. Security.