File: caml2html_test2.ml

package info (click to toggle)
caml2html 1.4.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 300 kB
  • sloc: ml: 1,929; makefile: 165
file content (25 lines) | stat: -rw-r--r-- 533 bytes parent folder | download
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
let add_operator ~name ~level ~value =
  EXTEND
    Pcaml.expr: LEVEL $level$ [
      [ x = SELF; $name$; y = SELF ->
          <:expr< $value$ $x$ $y$ >> ]
    ];
  END

EXTEND
  Pcaml.str_item: [
    [ "OPERATOR"; name = STRING; "LEVEL"; level = STRING;
      "VALUE"; value = Pcaml.expr; "END" ->
        add_operator
          ~name:(Token.eval_string _loc name)
          ~level:(Token.eval_string _loc level)
          ~value;
        <:str_item< declare end >> ]
  ];
END



let expand _loc e =
  <:expr< 1 +
          $e$ >>