File: pa_string_list.ml

package info (click to toggle)
ocaml-estring 20130822-5
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 152 kB
  • ctags: 81
  • sloc: ml: 347; makefile: 58; sh: 15
file content (20 lines) | stat: -rw-r--r-- 563 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
(*
 * pa_string_list.ml
 * -----------------
 * Copyright : (c) 2009, Jeremie Dimino <jeremie@dimino.org>
 * Licence   : BSD3
 *
 * This file is a part of estring.
 *)

(* Sample syntax extension for replacing strings by list of
   characters *)

open Camlp4.PreCast
open Pa_estring

let _ =
  register_expr_specifier "l"
    (fun ctx loc str -> llist_expr (fun _loc ch -> <:expr< $chr:Char.escaped ch$ >>) (unescape loc str));
  register_patt_specifier "l"
    (fun ctx loc str -> llist_patt (fun _loc ch -> <:patt< $chr:Char.escaped ch$ >>) (unescape loc str))