src/Pure/Thy/rail.ML
changeset 48992 0518bf89c777
parent 48911 5debc3e4fa81
child 53171 a5e54d4d9081
equal deleted inserted replaced
48991:0350245dec1c 48992:0518bf89c777
    33   | Antiq _ => "antiquotation"
    33   | Antiq _ => "antiquotation"
    34   | EOF => "end-of-input";
    34   | EOF => "end-of-input";
    35 
    35 
    36 fun print (Token ((pos, _), (k, x))) =
    36 fun print (Token ((pos, _), (k, x))) =
    37   (if k = EOF then print_kind k else print_kind k ^ " " ^ quote x) ^
    37   (if k = EOF then print_kind k else print_kind k ^ " " ^ quote x) ^
    38   Position.str_of pos;
    38   Position.here pos;
    39 
    39 
    40 fun print_keyword x = print_kind Keyword ^ " " ^ quote x;
    40 fun print_keyword x = print_kind Keyword ^ " " ^ quote x;
    41 
    41 
    42 
    42 
    43 (* stopper *)
    43 (* stopper *)
    90 fun !!! scan =
    90 fun !!! scan =
    91   let
    91   let
    92     val prefix = "Rail syntax error";
    92     val prefix = "Rail syntax error";
    93 
    93 
    94     fun get_pos [] = " (end-of-input)"
    94     fun get_pos [] = " (end-of-input)"
    95       | get_pos (tok :: _) = Position.str_of (pos_of tok);
    95       | get_pos (tok :: _) = Position.here (pos_of tok);
    96 
    96 
    97     fun err (toks, NONE) = (fn () => prefix ^ get_pos toks)
    97     fun err (toks, NONE) = (fn () => prefix ^ get_pos toks)
    98       | err (toks, SOME msg) =
    98       | err (toks, SOME msg) =
    99           (fn () =>
    99           (fn () =>
   100             let val s = msg () in
   100             let val s = msg () in