equal
deleted
inserted
replaced
24 val source: (Symbol.symbol, 'a) Source.source -> |
24 val source: (Symbol.symbol, 'a) Source.source -> |
25 (token, (Symbol_Pos.T, Position.T * (Symbol.symbol, 'a) Source.source) |
25 (token, (Symbol_Pos.T, Position.T * (Symbol.symbol, 'a) Source.source) |
26 Source.source) Source.source |
26 Source.source) Source.source |
27 val tokenize: string -> token list |
27 val tokenize: string -> token list |
28 val read: Position.T -> Symbol_Pos.text -> token Antiquote.antiquote list |
28 val read: Position.T -> Symbol_Pos.text -> token Antiquote.antiquote list |
|
29 val read_source: Symbol_Pos.source -> token Antiquote.antiquote list |
29 end; |
30 end; |
30 |
31 |
31 structure ML_Lex: ML_LEX = |
32 structure ML_Lex: ML_LEX = |
32 struct |
33 struct |
33 |
34 |
296 Symbol_Pos.source (Position.line 1) src |
297 Symbol_Pos.source (Position.line 1) src |
297 |> Source.source Symbol_Pos.stopper (Scan.bulk (!!! "bad input" scan_ml)) (SOME (false, recover)); |
298 |> Source.source Symbol_Pos.stopper (Scan.bulk (!!! "bad input" scan_ml)) (SOME (false, recover)); |
298 |
299 |
299 val tokenize = Source.of_string #> Symbol.source #> source #> Source.exhaust; |
300 val tokenize = Source.of_string #> Symbol.source #> source #> Source.exhaust; |
300 |
301 |
301 fun read pos txt = |
302 fun read pos text = |
302 let |
303 let |
303 val _ = Position.report pos Markup.language_ML; |
304 val syms = Symbol_Pos.explode (text, pos); |
304 val syms = Symbol_Pos.explode (txt, pos); |
|
305 val termination = |
305 val termination = |
306 if null syms then [] |
306 if null syms then [] |
307 else |
307 else |
308 let |
308 let |
309 val pos1 = List.last syms |-> Position.advance; |
309 val pos1 = List.last syms |-> Position.advance; |
316 |> Source.exhaust |
316 |> Source.exhaust |
317 |> tap (Position.reports_text o Antiquote.antiquote_reports (single o report_of_token)) |
317 |> tap (Position.reports_text o Antiquote.antiquote_reports (single o report_of_token)) |
318 |> tap (List.app (fn Antiquote.Text tok => (check_content_of tok; warn tok) | _ => ()))); |
318 |> tap (List.app (fn Antiquote.Text tok => (check_content_of tok; warn tok) | _ => ()))); |
319 in input @ termination end; |
319 in input @ termination end; |
320 |
320 |
321 end; |
321 fun read_source {delimited, text, pos} = |
322 |
322 (Position.report pos (Markup.language_ML delimited); read pos text); |
323 end; |
323 |
324 |
324 end; |
|
325 |
|
326 end; |
|
327 |