Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/common/error.sml
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/common/error.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2682, Mon Aug 25 17:20:56 2014 UTC revision 2683, Mon Aug 25 18:56:17 2014 UTC
# Line 31  Line 31 
31      val warningAt : err_stream * span * string list -> unit      val warningAt : err_stream * span * string list -> unit
32    
33    (* add an ml-antlr parse error to the error stream *)    (* add an ml-antlr parse error to the error stream *)
34      val parseError : ('tok -> string)      val parseError : (AntlrRepair.add_or_delete -> 'tok -> string)
35            -> err_stream            -> err_stream
36              -> (pos * 'tok AntlrRepair.repair_action)              -> (pos * 'tok AntlrRepair.repair_action)
37                -> unit                -> unit
# Line 104  Line 104 
104            errors := {kind=WARN, pos=pos, msg=msg} :: !errors)            errors := {kind=WARN, pos=pos, msg=msg} :: !errors)
105    
106      fun parseError tok2str es (pos, repair) = let      fun parseError tok2str es (pos, repair) = let
107            val toksToStr = (String.concatWith " ") o (List.map tok2str)            val addToksToStr = (String.concatWith " ") o (List.map (tok2str AntlrRepair.ADD))
108              val delToksToStr = (String.concatWith " ") o (List.map (tok2str AntlrRepair.DEL))
109            val msg = (case repair            val msg = (case repair
110                   of Repair.Insert toks => ["syntax error; try inserting \"", toksToStr toks, "\""]                   of Repair.Insert toks => ["syntax error; try inserting \"", addToksToStr toks, "\""]
111                    | Repair.Delete toks => ["syntax error; try deleting \"", toksToStr toks, "\""]                    | Repair.Delete toks => ["syntax error; try deleting \"", delToksToStr toks, "\""]
112                    | Repair.Subst{old, new} => [                    | Repair.Subst{old, new} => [
113                          "syntax error; try substituting \"", toksToStr new, "\" for \"",                          "syntax error; try substituting \"", addToksToStr new, "\" for \"",
114                          toksToStr old, "\""                          delToksToStr old, "\""
115                        ]                        ]
116                    | Repair.FailureAt tok => ["syntax error at ", tok2str tok]                    | Repair.FailureAt tok => ["syntax error at ", tok2str AntlrRepair.DEL tok]
117                  (* end case *))                  (* end case *))
118            in            in
119              addErr (es, SOME(pos, pos), String.concat msg)              addErr (es, SOME(pos, pos), String.concat msg)

Legend:
Removed from v.2682  
changed lines
  Added in v.2683

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0