/usr/lib/mlton/sml/mllpt-lib/repair.sml is in mlton-basis 20130715-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | (* repair.sml
*
* COPYRIGHT (c) 2006
* John Reppy (http://www.cs.uchicago.edu/~jhr)
* Aaron Turon (http://www.cs.uchicago.edu/~adrassi)
* All rights reserved.
*
* Representation and pretty-printing of ml-antlr repair actions
*)
structure AntlrRepair :> sig
datatype 'tok repair_action
= Insert of 'tok list
| Delete of 'tok list
| Subst of {
old : 'tok list,
new : 'tok list
}
| FailureAt of 'tok
type 'tok repair = AntlrStreamPos.pos * 'tok repair_action
val actionToString : ('tok -> string) -> 'tok repair_action -> string
val repairToString : ('tok -> string) -> AntlrStreamPos.sourcemap -> 'tok repair -> string
end = struct
datatype 'a repair_action
= Insert of 'a list
| Delete of 'a list
| Subst of {
old : 'a list,
new : 'a list
}
| FailureAt of 'a
type 'a repair = AntlrStreamPos.pos * 'a repair_action
fun actionToString tokToString repair = let
val toksToString = (String.concatWith " ") o (map tokToString)
in
case repair
of Insert toks => "try inserting " ^ toksToString toks
| Delete toks => "try deleting " ^ toksToString toks
| Subst {old, new} => concat[
"try substituting ", toksToString new, " for ", toksToString old
]
| FailureAt tok => "syntax error at " ^ tokToString tok
(* end case *)
end
fun repairToString tokToString sm (pos, repair) =
(AntlrStreamPos.toString sm pos ^ ": " ^ actionToString tokToString repair)
end
|