package ppx_css

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file preprocess_arguments.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
34
open! Core

type t =
  { dont_hash_prefixes : String.Set.t
  ; dont_hash : String.Set.t
  ; rewrite : string String.Map.t
  }

let singleton =
  ref
    { dont_hash_prefixes = String.Set.empty
    ; dont_hash = String.Set.empty
    ; rewrite = String.Map.empty
    }
;;

let get () = !singleton
let add ~get ~set new_ = singleton := set !singleton (Set.add (get !singleton) new_)

let add_dont_hash new_ =
  add ~get:(fun t -> t.dont_hash) ~set:(fun t dont_hash -> { t with dont_hash }) new_
;;

let add_dont_hash_prefixes new_ =
  add
    ~get:(fun t -> t.dont_hash_prefixes)
    ~set:(fun t dont_hash_prefixes -> { t with dont_hash_prefixes })
    new_
;;

let add_rewrite ~from ~to_ =
  singleton
    := { !singleton with rewrite = Map.set !singleton.rewrite ~key:from ~data:to_ }
;;
OCaml

Innovation. Community. Security.