equal
deleted
inserted
replaced
52 | Token.AltString => Isabelle_Markup.altstring |
52 | Token.AltString => Isabelle_Markup.altstring |
53 | Token.Verbatim => Isabelle_Markup.verbatim |
53 | Token.Verbatim => Isabelle_Markup.verbatim |
54 | Token.Space => Markup.empty |
54 | Token.Space => Markup.empty |
55 | Token.Comment => Isabelle_Markup.comment |
55 | Token.Comment => Isabelle_Markup.comment |
56 | Token.InternalValue => Markup.empty |
56 | Token.InternalValue => Markup.empty |
57 | Token.Error _ => Isabelle_Markup.bad |
57 | Token.Error msg => Isabelle_Markup.bad msg |
58 | Token.Sync => Isabelle_Markup.control |
58 | Token.Sync => Isabelle_Markup.control |
59 | Token.EOF => Isabelle_Markup.control; |
59 | Token.EOF => Isabelle_Markup.control; |
60 |
60 |
61 fun token_markup tok = |
61 fun token_markup tok = |
62 if Token.keyword_with (not o Lexicon.is_ascii_identifier) tok then Isabelle_Markup.operator |
62 if Token.keyword_with (not o Lexicon.is_ascii_identifier) tok then Isabelle_Markup.operator |
72 fun reports_of_token tok = |
72 fun reports_of_token tok = |
73 let |
73 let |
74 val malformed_symbols = |
74 val malformed_symbols = |
75 Symbol_Pos.explode (Token.source_position_of tok) |
75 Symbol_Pos.explode (Token.source_position_of tok) |
76 |> map_filter (fn (sym, pos) => |
76 |> map_filter (fn (sym, pos) => |
77 if Symbol.is_malformed sym then SOME (pos, Isabelle_Markup.bad) else NONE); |
77 if Symbol.is_malformed sym |
|
78 then SOME (pos, Isabelle_Markup.bad "Malformed symbol") else NONE); |
78 val is_malformed = Token.is_error tok orelse not (null malformed_symbols); |
79 val is_malformed = Token.is_error tok orelse not (null malformed_symbols); |
79 val reports = (Token.position_of tok, token_markup tok) :: malformed_symbols; |
80 val reports = (Token.position_of tok, token_markup tok) :: malformed_symbols; |
80 in (is_malformed, reports) end; |
81 in (is_malformed, reports) end; |
81 |
82 |
82 in |
83 in |