Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using dolmen printer to display quoted identifiers #972

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions src/lib/structures/symbols.ml
Original file line number Diff line number Diff line change
@@ -277,29 +277,8 @@ let string_of_bound b =

let print_bound fmt b = Format.fprintf fmt "%s" (string_of_bound b)

let pp_name ppf =
let no_need_to_quote s =
String.length s > 0 &&
(match s.[0] with | '0'..'9' -> false | _ -> true) &&
try
String.iter
(function
| 'a' .. 'z'
| 'A' .. 'Z'
| '0' .. '9'
| '~' | '!' | '@' | '$' | '%' | '^' | '&'
| '*' | '_' | '-' | '+' | '=' | '<' | '>'
| '.' | '?' | '/' -> ()
| _ -> raise Exit
) s;
true
with Exit -> false
in
fun s ->
if no_need_to_quote s then
Fmt.string ppf s
else
Fmt.pf ppf "|%s|" s
let pp_name ppf s =
Dolmen.Smtlib2.Script.Poly.Print.id ppf (Dolmen.Std.Name.simple s)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a mouthful 🤣


module AEPrinter = struct
let pp_operator ppf op =