Skip to content

Commit 0dbf40c

Browse files
committed
[symbols] Cleanup notations entry a bit to remove \' symbols
1 parent fe95d6a commit 0dbf40c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

coq/ast.ml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,17 @@ let mk_name ~lines (id : Names.lname) : Lang.Ast.Name.t Lang.With_range.t =
233233
let mk_id ~lines (id : Names.lident) =
234234
CAst.map (fun id -> Names.Name id) id |> mk_name ~lines
235235

236-
let mk_string ~lines (id : Names.lstring) =
237-
CAst.map (fun id -> Names.(Name (Id.of_string_soft id))) id |> mk_name ~lines
236+
(* Cleanup ntn_decl *)
237+
let mk_from_ntn_decl ~lines (id : Names.lstring) =
238+
CAst.with_loc_val
239+
(fun ?loc str ->
240+
let loc = Option.get loc in
241+
let range = Utils.to_range ~lines loc in
242+
(* Notation cleanup *)
243+
let strs = String.split_on_char '\'' str in
244+
let v = Some (String.concat "" strs) in
245+
Lang.With_range.{ range; v })
246+
id
238247

239248
let constructor_info ~lines ((_, (id, _typ)) : constructor_expr) =
240249
let range = Option.get id.loc in
@@ -348,7 +357,7 @@ let make_info ~st:_ ~lines CAst.{ loc; v } : Lang.Ast.Info.t list option =
348357
let detail = "Rewrite Rule" in
349358
Some [ Lang.Ast.Info.make ~range ~name ~kind ~detail () ]
350359
| VernacSynterp (VernacNotation (_infix, { ntn_decl_string; _ })) ->
351-
let name = mk_string ~lines ntn_decl_string in
360+
let name = mk_from_ntn_decl ~lines ntn_decl_string in
352361
let kind = Kinds.operator in
353362
let detail = "Notation" in
354363
Some [ Lang.Ast.Info.make ~range ~name ~kind ~detail () ]

0 commit comments

Comments
 (0)