src/Pure/ML/ml_lex.ML
changeset 58864 505a8150368a
parent 58863 64e571275b36
child 58933 6585e59aee3e
equal deleted inserted replaced
58863:64e571275b36 58864:505a8150368a
   305     val scan = if SML then scan_ml >> Antiquote.Text else scan_antiq;
   305     val scan = if SML then scan_ml >> Antiquote.Text else scan_antiq;
   306     fun check (Antiquote.Text tok) = (check_content_of tok; if SML then () else warn tok)
   306     fun check (Antiquote.Text tok) = (check_content_of tok; if SML then () else warn tok)
   307       | check _ = ();
   307       | check _ = ();
   308     val input =
   308     val input =
   309       Source.of_list syms
   309       Source.of_list syms
   310       |> Source.source Symbol_Pos.stopper (Scan.bulk (!!! "bad input" scan))
   310       |> Source.source Symbol_Pos.stopper
   311         (SOME (fn msg => recover msg >> map Antiquote.Text))
   311         (Scan.recover (Scan.bulk (!!! "bad input" scan))
       
   312           (fn msg => recover msg >> map Antiquote.Text))
   312       |> Source.exhaust
   313       |> Source.exhaust
   313       |> tap (Position.reports_text o Antiquote.antiquote_reports (single o report_of_token SML))
   314       |> tap (Position.reports_text o Antiquote.antiquote_reports (single o report_of_token SML))
   314       |> tap (List.app check);
   315       |> tap (List.app check);
   315   in input @ termination end;
   316   in input @ termination end;
   316 
   317 
   317 in
   318 in
   318 
   319 
   319 fun source src =
   320 fun source src =
   320   Symbol_Pos.source (Position.line 1) src
   321   Symbol_Pos.source (Position.line 1) src
   321   |> Source.source Symbol_Pos.stopper (Scan.bulk (!!! "bad input" scan_ml)) (SOME recover);
   322   |> Source.source Symbol_Pos.stopper (Scan.recover (Scan.bulk (!!! "bad input" scan_ml)) recover);
   322 
   323 
   323 val tokenize = Source.of_string #> Symbol.source #> source #> Source.exhaust;
   324 val tokenize = Source.of_string #> Symbol.source #> source #> Source.exhaust;
   324 
   325 
   325 val read = gen_read false;
   326 val read = gen_read false;
   326 
   327