<commit_before>(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(* File created around Apr 1994 for CiC V5.10.5 by <NAME> collecting
   parts of file initial.ml from CoC V4.8, Dec 1988, by <NAME>,
   <NAME> and <NAME> *)
(* Hash-consing by <NAME> in Feb 1998 *)
(* Extra functions for splitting/generation of identifiers by <NAME> *)
(* Restructuration by <NAME> as part of the implementation of
   the module system, Aug 2002 *)
(* Abstraction over the type of constant for module inlining by <NAME>, Nov 2004 *)
(* Miscellaneous features or improvements by <NAME>, 
   <NAME>, ... *)

open Pp
open Util

(** {6 Identifiers } *)

(** Representation and operations on identifiers. *)
module Id =
struct
  type t = string

  let equal = String.equal

  let compare = String.compare

  let hash = String.hash

  let check_soft ?(warn = true) x =
    let iter (fatal, x) =
      if fatal then CErrors.error x else if warn then Feedback.msg_warning (str x)
    in
    Option.iter iter (Unicode.ident_refutation x)
<commit_msg>Fix #5242 - Dubious unsilenceable warning on invalid identifier<commit_after>(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(* File created around Apr 1994 for CiC V5.10.5 by <NAME> collecting
   parts of file initial.ml from CoC V4.8, Dec 1988, by <NAME>,
   <NAME> and <NAME> *)
(* Hash-consing by <NAME> in Feb 1998 *)
(* Extra functions for splitting/generation of identifiers by <NAME> *)
(* Restructuration by <NAME> as part of the implementation of
   the module system, Aug 2002 *)
(* Abstraction over the type of constant for module inlining by <NAME>, Nov 2004 *)
(* Miscellaneous features or improvements by <NAME>, 
   <NAME>, ... *)

open Pp
open Util

(** {6 Identifiers } *)

(** Representation and operations on identifiers. *)
module Id =
struct
  type t = string

  let equal = String.equal

  let compare = String.compare

  let hash = String.hash

  let warn_invalid_identifier =
    CWarnings.create ~name:"invalid-identifier" ~category:"parsing"
                     ~default:CWarnings.Disabled
                     (fun s -> str s)

  let check_soft ?(warn = true) x =
    let iter (fatal, x) =
      if fatal then CErrors.error x else
        if warn then warn_invalid_identifier x
    in
    Option.iter iter (Unicode.ident_refutation x)

{'fraction_non_alphanumeric': 0.22061092255476705, 'fraction_numerical': 0.02406664609688368, 'mean_word_length': 3.1940491591203104, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5582427', 'n_tokens_mistral': 955, 'n_tokens_neox': 842, 'n_words': 336}