equal
deleted
inserted
replaced
208 fun text_of tok = |
208 fun text_of tok = |
209 if is_semicolon tok then ("terminator", "") |
209 if is_semicolon tok then ("terminator", "") |
210 else |
210 else |
211 let |
211 let |
212 val k = str_of_kind (kind_of tok); |
212 val k = str_of_kind (kind_of tok); |
213 val s = unparse tok |
213 val s = unparse tok; |
214 handle ERROR _ => Symbol.separate_chars (content_of tok); |
|
215 in |
214 in |
216 if s = "" then (k, "") |
215 if s = "" then (k, "") |
217 else if size s < 40 andalso not (exists_string (fn c => c = "\n") s) then (k ^ " " ^ s, "") |
216 else if size s < 40 andalso not (exists_string (fn c => c = "\n") s) then (k ^ " " ^ s, "") |
218 else (k, s) |
217 else (k, s) |
219 end; |
218 end; |
308 |
307 |
309 (* scan comment *) |
308 (* scan comment *) |
310 |
309 |
311 val scan_comment = |
310 val scan_comment = |
312 Symbol_Pos.scan_pos -- (Symbol_Pos.scan_comment_body !!! -- Symbol_Pos.scan_pos); |
311 Symbol_Pos.scan_pos -- (Symbol_Pos.scan_comment_body !!! -- Symbol_Pos.scan_pos); |
313 |
|
314 |
|
315 (* scan malformed symbols *) |
|
316 |
|
317 val scan_malformed = |
|
318 $$$ Symbol.malformed |-- |
|
319 Symbol_Pos.change_prompt (Scan.many (Symbol.is_regular o symbol)) |
|
320 --| Scan.option ($$$ Symbol.end_malformed); |
|
321 |
312 |
322 |
313 |
323 |
314 |
324 (** token sources **) |
315 (** token sources **) |
325 |
316 |
339 (Symbol_Pos.scan_string >> token_range String || |
330 (Symbol_Pos.scan_string >> token_range String || |
340 Symbol_Pos.scan_alt_string >> token_range AltString || |
331 Symbol_Pos.scan_alt_string >> token_range AltString || |
341 scan_verbatim >> token_range Verbatim || |
332 scan_verbatim >> token_range Verbatim || |
342 scan_comment >> token_range Comment || |
333 scan_comment >> token_range Comment || |
343 scan_space >> token Space || |
334 scan_space >> token Space || |
344 scan_malformed >> token Malformed || |
335 Scan.one (Symbol.is_malformed o symbol) >> (token Malformed o single) || |
345 Scan.one (Symbol.is_sync o symbol) >> (token Sync o single) || |
336 Scan.one (Symbol.is_sync o symbol) >> (token Sync o single) || |
346 (Scan.max token_leq |
337 (Scan.max token_leq |
347 (Scan.max token_leq |
338 (Scan.max token_leq |
348 (Scan.literal lex2 >> pair Command) |
339 (Scan.literal lex2 >> pair Command) |
349 (Scan.literal lex1 >> pair Keyword)) |
340 (Scan.literal lex1 >> pair Keyword)) |