See coq/coq#17252 (comment)
Relevant code:
|
if |
|
List.mem ~equal:String.equal ["sh"; "bash"] |
|
(String.lowercase quote_kind) |
|
|| String.is_prefix ~prefix:"#!" body |
|
then body |
|
else |
|
(* assume body is a .v file *) |
|
let fname = "thebug.v" in |
|
f "#!/usr/bin/env bash\ncat > %s <<'EOF'\n%s\nEOF\ncoqc -q %s" fname |
|
body fname |
and
|
let coqbot_minimize_text_of_body body = |
|
if |
|
string_match |
|
~regexp: |
|
( f |
|
"@%s:? [Mm]inimize\\([^`]*\\)```\\([^\n\ |
|
]*\\)\n\ |
|
\\(\\(.\\|\n\ |
|
\\)+\\)" |
|
@@ Str.quote bot_name ) |
|
body |
|
then |
|
(* avoid internal server errors from unclear execution order *) |
|
let options, quote_kind, body = |
|
( Str.matched_group 1 body |
|
, Str.matched_group 2 body |
|
, Str.matched_group 3 body ) |
|
in |
|
Some |
|
( options |
|
, MinimizeScript {quote_kind; body= body |> extract_minimize_file} ) |
|
else if |
|
string_match |
|
~regexp: |
|
( f "@%s? [Mm]inimize\\([^`]*\\)\\[\\([^]]*\\)\\] *(\\([^)]*\\))" |
|
@@ Str.quote bot_name ) |
|
body |
|
then |
|
(* avoid internal server errors from unclear execution order *) |
|
let options, description, url = |
|
( Str.matched_group 1 body |
|
, Str.matched_group 2 body |
|
, Str.matched_group 3 body ) |
|
in |
|
Some (options, MinimizeAttachment {description; url}) |
|
else None |
|
in |