File: cString.mli

package info (click to toggle)
coq 8.20.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 44,116 kB
  • sloc: ml: 234,160; sh: 4,301; python: 3,270; ansic: 2,644; makefile: 882; lisp: 172; javascript: 63; xml: 24; sed: 2
file content (94 lines) | stat: -rw-r--r-- 3,347 bytes parent folder | download | duplicates (2)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)

(** Module type [S] is the one from OCaml Stdlib. *)
module type S = module type of String

module type ExtS =
sig
  include S
  (** We include the standard library *)

  (** Equality on strings *)

  val hash : string -> int
  (** Hashing on strings. Should be compatible with generic one. *)

  val is_empty : string -> bool
  (** Test whether a string is empty. *)

  val explode : string -> string list
  (** [explode "x1...xn"] returns [["x1"; ...; "xn"]] *)

  val implode : string list -> string
  (** [implode [s1; ...; sn]] returns [s1 ^ ... ^ sn] *)

  val drop_simple_quotes : string -> string
  (** Remove the eventual first surrounding simple quotes of a string. *)

  val quote_coq_string : string -> string
  (** Quote a string according to Coq conventions (i.e. doubling
      double quotes and surrounding by double quotes) *)

  val unquote_coq_string : string -> string option
  (** Unquote a quoted string according to Coq conventions
      (i.e. removing surrounding double quotes and undoubling double
      quotes); returns [None] if not a quoted string *)

  val html_escape : string -> string
  (** replace HTML reserved characters with escape sequences,
      e.g. `&` -> "&#38;" *)

  val string_index_from : string -> int -> string -> int
  (** As [index_from], but takes a string instead of a char as pattern argument *)

  val string_contains : where:string -> what:string -> bool
  (** As [contains], but takes a string instead of a char as pattern argument *)

  val plural : int -> string -> string
  (** [plural n s] adds a optional 's' to the [s] when [2 <= n]. *)

  val lplural : _ list -> string -> string
  (** [lplural l s] is [plural (List.length l) s]. *)

  val conjugate_verb_to_be : int -> string
  (** [conjugate_verb_to_be] returns "is" when [n=1] and "are" otherwise *)

  val ordinal : int -> string
  (** Generate the ordinal number in English. *)

  val is_sub : string -> string -> int -> bool
  (** [is_sub p s off] tests whether [s] contains [p] at offset [off]. *)

  val is_prefix : string -> string -> bool
  (** [is_prefix p s] tests whether [p] is a prefix of [s]. *)

  val is_suffix : string -> string -> bool
  (** [is_suffix suf s] tests whether [suf] is a suffix of [s]. *)

  (** {6 Generic operations} **)

  module Set : Set.S with type elt = t
  (** Finite sets on [string] *)

  module Map : CMap.ExtS with type key = t and module Set := Set
  (** Finite maps on [string] *)

  module Pred : Predicate.S with type elt = t

  module List : CList.MonoS with type elt = t
  (** Association lists with [string] as keys *)

  val hcons : string -> string
  (** Hashconsing on [string] *)

end

include ExtS