File: caml2html_test2.ml

package info (click to toggle)
caml2html 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 300 kB
  • sloc: ml: 1,996; makefile: 162
file content (25 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (4)
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$ >>