src/Pure/ML/ml_compiler.ML
author wenzelm
Wed Jan 16 20:41:29 2013 +0100 (2013-01-16 ago)
changeset 50914 fe4714886d92
parent 44270 3eaad39e520c
child 51285 0859bd338c9b
permissions -rw-r--r--
identify future results more carefully, to avoid odd duplication of error messages, notably from forked goals;
wenzelm@31333
     1
(*  Title:      Pure/ML/ml_compiler.ML
wenzelm@31333
     2
    Author:     Makarius
wenzelm@31333
     3
wenzelm@31333
     4
Runtime compilation -- generic version.
wenzelm@31333
     5
*)
wenzelm@31333
     6
wenzelm@31333
     7
signature ML_COMPILER =
wenzelm@31333
     8
sig
wenzelm@31477
     9
  val exn_position: exn -> Position.T
wenzelm@50914
    10
  val exn_messages_ids: exn -> ((serial * string) * string option) list
wenzelm@44270
    11
  val exn_messages: exn -> (serial * string) list
wenzelm@31477
    12
  val exn_message: exn -> string
wenzelm@31333
    13
  val eval: bool -> Position.T -> ML_Lex.token list -> unit
wenzelm@31333
    14
end
wenzelm@31333
    15
wenzelm@31333
    16
structure ML_Compiler: ML_COMPILER =
wenzelm@31333
    17
struct
wenzelm@31333
    18
wenzelm@31477
    19
fun exn_position _ = Position.none;
wenzelm@50914
    20
val exn_messages_ids = Runtime.exn_messages_ids exn_position;
wenzelm@38874
    21
val exn_messages = Runtime.exn_messages exn_position;
wenzelm@31477
    22
val exn_message = Runtime.exn_message exn_position;
wenzelm@31428
    23
wenzelm@31333
    24
fun eval verbose pos toks =
wenzelm@31333
    25
  let
wenzelm@31333
    26
    val line = the_default 1 (Position.line_of pos);
wenzelm@31333
    27
    val file = the_default "ML" (Position.file_of pos);
wenzelm@31333
    28
    val text = ML_Lex.flatten toks;
wenzelm@31333
    29
  in Secure.use_text ML_Env.local_context (line, file) verbose text end;
wenzelm@31333
    30
wenzelm@31333
    31
end;
wenzelm@31333
    32