author | wenzelm |
Fri, 31 Aug 2012 14:35:04 +0200 | |
changeset 49037 | d7a1973b063c |
parent 49036 | 4680c4046814 |
child 49040 | e5fc20c93e38 |
permissions | -rw-r--r-- |
45665
129db1416717
renamed Isabelle_Markup to Isabelle_Rendering to emphasize its meaning and make room for Pure Isabelle_Markup module;
wenzelm
parents:
45489
diff
changeset
|
1 |
/* Title: Tools/jEdit/src/isabelle_rendering.scala |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
3 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
4 |
Isabelle specific physical rendering and markup selection. |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
6 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle.jedit |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
8 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
9 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
10 |
import isabelle._ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
11 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
12 |
import java.awt.Color |
46227
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
13 |
import javax.swing.Icon |
48921
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
14 |
import java.io.{File => JFile} |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
15 |
|
43386
4e78dd88c64f
more foreground markup, using actual CSS color names;
wenzelm
parents:
43377
diff
changeset
|
16 |
import org.lobobrowser.util.gui.ColorFactory |
43414 | 17 |
import org.gjt.sp.jedit.syntax.{Token => JEditToken} |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
18 |
|
45460 | 19 |
import scala.collection.immutable.SortedMap |
20 |
||
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
21 |
|
45665
129db1416717
renamed Isabelle_Markup to Isabelle_Rendering to emphasize its meaning and make room for Pure Isabelle_Markup module;
wenzelm
parents:
45489
diff
changeset
|
22 |
object Isabelle_Rendering |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
23 |
{ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
24 |
/* physical rendering */ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
25 |
|
48751 | 26 |
// see http://www.w3schools.com/cssref/css_colornames.asp |
43377 | 27 |
|
43386
4e78dd88c64f
more foreground markup, using actual CSS color names;
wenzelm
parents:
43377
diff
changeset
|
28 |
def get_color(s: String): Color = ColorFactory.getInstance.getColor(s) |
4e78dd88c64f
more foreground markup, using actual CSS color names;
wenzelm
parents:
43377
diff
changeset
|
29 |
|
44579
a9cf2380377d
tuned colors -- more distance between outdated_color and quoted_color;
wenzelm
parents:
44549
diff
changeset
|
30 |
val outdated_color = new Color(238, 227, 227) |
46166 | 31 |
val unprocessed_color = new Color(255, 160, 160) |
32 |
val unprocessed1_color = new Color(255, 160, 160, 50) |
|
44611 | 33 |
val running_color = new Color(97, 0, 97) |
34 |
val running1_color = new Color(97, 0, 97, 100) |
|
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
35 |
|
39690
6c6164b37fef
some attempts to improve visual appearance of bad text;
wenzelm
parents:
39512
diff
changeset
|
36 |
val light_color = new Color(240, 240, 240) |
46227
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
37 |
val writeln_color = new Color(192, 192, 192) |
39692 | 38 |
val warning_color = new Color(255, 140, 0) |
39691 | 39 |
val error_color = new Color(178, 34, 34) |
44866 | 40 |
val error1_color = new Color(178, 34, 34, 50) |
39690
6c6164b37fef
some attempts to improve visual appearance of bad text;
wenzelm
parents:
39512
diff
changeset
|
41 |
val bad_color = new Color(255, 106, 106, 100) |
42171 | 42 |
val hilite_color = new Color(255, 204, 102, 100) |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
43 |
|
44546 | 44 |
val quoted_color = new Color(139, 139, 139, 25) |
44545
3c40007aa031
transparent foreground color for quoted entities;
wenzelm
parents:
44181
diff
changeset
|
45 |
val subexp_color = new Color(80, 80, 80, 50) |
48921
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
46 |
val hyperlink_color = Color.BLACK |
43435
ae6b0c3e58a8
highlight via foreground painter, using alpha channel;
wenzelm
parents:
43434
diff
changeset
|
47 |
|
43388 | 48 |
val keyword1_color = get_color("#006699") |
49 |
val keyword2_color = get_color("#009966") |
|
50 |
||
46227
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
51 |
private val writeln_pri = 1 |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
52 |
private val warning_pri = 2 |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
53 |
private val legacy_pri = 3 |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
54 |
private val error_pri = 4 |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
55 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
56 |
|
46166 | 57 |
/* command overview */ |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
58 |
|
46227
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
59 |
def overview_color(snapshot: Document.Snapshot, range: Text.Range): Option[Color] = |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
60 |
{ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
61 |
if (snapshot.is_outdated) None |
46166 | 62 |
else { |
46227
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
63 |
val results = |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
64 |
snapshot.cumulate_markup[(Protocol.Status, Int)]( |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
65 |
range, (Protocol.Status.init, 0), |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
66 |
Some(Protocol.command_status_markup + Isabelle_Markup.WARNING + Isabelle_Markup.ERROR), |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
67 |
{ |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
68 |
case ((status, pri), Text.Info(_, XML.Elem(markup, _))) => |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
69 |
if (markup.name == Isabelle_Markup.WARNING) (status, pri max warning_pri) |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
70 |
else if (markup.name == Isabelle_Markup.ERROR) (status, pri max error_pri) |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
71 |
else (Protocol.command_status(status, markup), pri) |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
72 |
}) |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
73 |
if (results.isEmpty) None |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
74 |
else { |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
75 |
val (status, pri) = |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
76 |
((Protocol.Status.init, 0) /: results) { |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
77 |
case ((s1, p1), Text.Info(_, (s2, p2))) => (s1 + s2, p1 max p2) } |
46166 | 78 |
|
46227
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
79 |
if (pri == warning_pri) Some(warning_color) |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
80 |
else if (pri == error_pri) Some(error_color) |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
81 |
else if (status.is_unprocessed) Some(unprocessed_color) |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
82 |
else if (status.is_running) Some(running_color) |
4aa84f84d5e8
more precise rendering of overview_color/gutter_message/squiggly_underline based on cumulation of command status and warning/error messages;
wenzelm
parents:
46224
diff
changeset
|
83 |
else if (status.is_failed) Some(error_color) |
46166 | 84 |
else None |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
85 |
} |
46166 | 86 |
} |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
87 |
} |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
88 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
89 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
90 |
/* markup selectors */ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
91 |
|
46234 | 92 |
private val subexp_include = |
93 |
Set(Isabelle_Markup.SORT, Isabelle_Markup.TYP, Isabelle_Markup.TERM, Isabelle_Markup.PROP, |
|
94 |
Isabelle_Markup.ML_TYPING, Isabelle_Markup.TOKEN_RANGE, Isabelle_Markup.ENTITY, |
|
95 |
Isabelle_Markup.TYPING, Isabelle_Markup.FREE, Isabelle_Markup.SKOLEM, Isabelle_Markup.BOUND, |
|
96 |
Isabelle_Markup.VAR, Isabelle_Markup.TFREE, Isabelle_Markup.TVAR, Isabelle_Markup.ML_SOURCE, |
|
97 |
Isabelle_Markup.DOC_SOURCE) |
|
98 |
||
99 |
def subexp(snapshot: Document.Snapshot, range: Text.Range): Option[Text.Info[Color]] = |
|
100 |
{ |
|
101 |
snapshot.select_markup(range, Some(subexp_include), |
|
102 |
{ |
|
48921
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
103 |
case Text.Info(info_range, XML.Elem(Markup(name, _), _)) if subexp_include(name) => |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
104 |
Text.Info(snapshot.convert(info_range), subexp_color) |
46234 | 105 |
}) match { case Text.Info(_, info) #:: _ => Some(info) case _ => None } |
106 |
} |
|
107 |
||
108 |
||
48921
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
109 |
private val hyperlink_include = Set(Isabelle_Markup.ENTITY, Isabelle_Markup.PATH) |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
110 |
|
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
111 |
def hyperlink(snapshot: Document.Snapshot, range: Text.Range): Option[Text.Info[Hyperlink]] = |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
112 |
{ |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
113 |
snapshot.cumulate_markup[List[Text.Info[Hyperlink]]](range, Nil, Some(hyperlink_include), |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
114 |
{ |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
115 |
case (links, Text.Info(info_range, XML.Elem(Isabelle_Markup.Path(name), _))) |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
116 |
if Path.is_ok(name) => |
48923
a2df77fcf1eb
prefer jEdit file name representation (potentially via VFS);
wenzelm
parents:
48922
diff
changeset
|
117 |
val jedit_file = Isabelle.thy_load.append(snapshot.node_name.dir, Path.explode(name)) |
a2df77fcf1eb
prefer jEdit file name representation (potentially via VFS);
wenzelm
parents:
48922
diff
changeset
|
118 |
Text.Info(snapshot.convert(info_range), Hyperlink(jedit_file, 0, 0)) :: links |
48921
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
119 |
|
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
120 |
case (links, Text.Info(info_range, XML.Elem(Markup(Isabelle_Markup.ENTITY, props), _))) |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
121 |
if (props.find( |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
122 |
{ case (Markup.KIND, Isabelle_Markup.ML_OPEN) => true |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
123 |
case (Markup.KIND, Isabelle_Markup.ML_STRUCT) => true |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
124 |
case _ => false }).isEmpty) => |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
125 |
|
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
126 |
props match { |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
127 |
case Position.Line_File(line, name) if Path.is_ok(name) => |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
128 |
Isabelle_System.source_file(Path.explode(name)) match { |
48923
a2df77fcf1eb
prefer jEdit file name representation (potentially via VFS);
wenzelm
parents:
48922
diff
changeset
|
129 |
case Some(path) => |
a2df77fcf1eb
prefer jEdit file name representation (potentially via VFS);
wenzelm
parents:
48922
diff
changeset
|
130 |
val jedit_file = Isabelle_System.platform_path(path) |
a2df77fcf1eb
prefer jEdit file name representation (potentially via VFS);
wenzelm
parents:
48922
diff
changeset
|
131 |
Text.Info(snapshot.convert(info_range), Hyperlink(jedit_file, line, 0)) :: links |
48921
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
132 |
case None => links |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
133 |
} |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
134 |
|
48922 | 135 |
case Position.Id_Offset(id, offset) if !snapshot.is_outdated => |
136 |
snapshot.state.find_command(snapshot.version, id) match { |
|
137 |
case Some((node, command)) => |
|
48921
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
138 |
val sources = |
48922 | 139 |
node.commands.iterator.takeWhile(_ != command).map(_.source) ++ |
140 |
Iterator.single(command.source(Text.Range(0, command.decode(offset)))) |
|
141 |
val (line, column) = ((1, 1) /: sources)(Symbol.advance_line_column) |
|
48923
a2df77fcf1eb
prefer jEdit file name representation (potentially via VFS);
wenzelm
parents:
48922
diff
changeset
|
142 |
Text.Info(snapshot.convert(info_range), |
a2df77fcf1eb
prefer jEdit file name representation (potentially via VFS);
wenzelm
parents:
48922
diff
changeset
|
143 |
Hyperlink(command.node_name.node, line, column)) :: links |
48921
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
144 |
case None => links |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
145 |
} |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
146 |
|
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
147 |
case _ => links |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
148 |
} |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
149 |
}) match { case Text.Info(_, info :: _) #:: _ => Some(info) case _ => None } |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
150 |
} |
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
151 |
|
5d8d409b897e
support for direct hyperlinks, without the Hyperlinks plugin;
wenzelm
parents:
48768
diff
changeset
|
152 |
|
48768
abc45de5bb22
clarified "bad" markup: proper body text, invent missing serial on Scala side (counting backwards);
wenzelm
parents:
48756
diff
changeset
|
153 |
private def tooltip_text(msg: XML.Tree): String = |
abc45de5bb22
clarified "bad" markup: proper body text, invent missing serial on Scala side (counting backwards);
wenzelm
parents:
48756
diff
changeset
|
154 |
Pretty.string_of(List(msg), margin = Isabelle.Int_Property("tooltip-margin")) |
48756
1c843142758e
sneak message into "bad" markup as property -- to be displayed after YXML parsing;
wenzelm
parents:
48754
diff
changeset
|
155 |
|
46178
1c5c88f6feb5
clarified Isabelle_Rendering vs. physical painting;
wenzelm
parents:
46166
diff
changeset
|
156 |
def tooltip_message(snapshot: Document.Snapshot, range: Text.Range): Option[String] = |
46199 | 157 |
{ |
158 |
val msgs = |
|
159 |
snapshot.cumulate_markup[SortedMap[Long, String]](range, SortedMap.empty, |
|
48756
1c843142758e
sneak message into "bad" markup as property -- to be displayed after YXML parsing;
wenzelm
parents:
48754
diff
changeset
|
160 |
Some(Set(Isabelle_Markup.WRITELN, Isabelle_Markup.WARNING, Isabelle_Markup.ERROR, |
1c843142758e
sneak message into "bad" markup as property -- to be displayed after YXML parsing;
wenzelm
parents:
48754
diff
changeset
|
161 |
Isabelle_Markup.BAD)), |
46199 | 162 |
{ |
48756
1c843142758e
sneak message into "bad" markup as property -- to be displayed after YXML parsing;
wenzelm
parents:
48754
diff
changeset
|
163 |
case (msgs, Text.Info(_, msg @ |
1c843142758e
sneak message into "bad" markup as property -- to be displayed after YXML parsing;
wenzelm
parents:
48754
diff
changeset
|
164 |
XML.Elem(Markup(markup, Isabelle_Markup.Serial(serial)), _))) |
46199 | 165 |
if markup == Isabelle_Markup.WRITELN || |
166 |
markup == Isabelle_Markup.WARNING || |
|
167 |
markup == Isabelle_Markup.ERROR => |
|
48768
abc45de5bb22
clarified "bad" markup: proper body text, invent missing serial on Scala side (counting backwards);
wenzelm
parents:
48756
diff
changeset
|
168 |
msgs + (serial -> tooltip_text(msg)) |
abc45de5bb22
clarified "bad" markup: proper body text, invent missing serial on Scala side (counting backwards);
wenzelm
parents:
48756
diff
changeset
|
169 |
case (msgs, Text.Info(_, msg @ XML.Elem(Markup(Isabelle_Markup.BAD, _), _))) => |
abc45de5bb22
clarified "bad" markup: proper body text, invent missing serial on Scala side (counting backwards);
wenzelm
parents:
48756
diff
changeset
|
170 |
msgs + (Document.new_id() -> tooltip_text(msg)) |
46199 | 171 |
}).toList.flatMap(_.info) |
172 |
if (msgs.isEmpty) None else Some(cat_lines(msgs.iterator.map(_._2))) |
|
173 |
} |
|
39740 | 174 |
|
43376
0f6880c1c759
some direct text foreground painting, instead of token marking;
wenzelm
parents:
43282
diff
changeset
|
175 |
|
43431 | 176 |
private val tooltips: Map[String, String] = |
177 |
Map( |
|
45666 | 178 |
Isabelle_Markup.SORT -> "sort", |
179 |
Isabelle_Markup.TYP -> "type", |
|
180 |
Isabelle_Markup.TERM -> "term", |
|
181 |
Isabelle_Markup.PROP -> "proposition", |
|
182 |
Isabelle_Markup.TOKEN_RANGE -> "inner syntax token", |
|
183 |
Isabelle_Markup.FREE -> "free variable", |
|
184 |
Isabelle_Markup.SKOLEM -> "skolem variable", |
|
185 |
Isabelle_Markup.BOUND -> "bound variable", |
|
186 |
Isabelle_Markup.VAR -> "schematic variable", |
|
187 |
Isabelle_Markup.TFREE -> "free type variable", |
|
188 |
Isabelle_Markup.TVAR -> "schematic type variable", |
|
189 |
Isabelle_Markup.ML_SOURCE -> "ML source", |
|
190 |
Isabelle_Markup.DOC_SOURCE -> "document source") |
|
43431 | 191 |
|
46235
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
192 |
private val tooltip_elements = |
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
193 |
Set(Isabelle_Markup.ENTITY, Isabelle_Markup.TYPING, Isabelle_Markup.ML_TYPING) ++ |
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
194 |
tooltips.keys |
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
195 |
|
45445
41e641a870de
pass term positions into check phase, where resulting types are reported accordingly, and eventually shown as tooltips;
wenzelm
parents:
44866
diff
changeset
|
196 |
private def string_of_typing(kind: String, body: XML.Body): String = |
41e641a870de
pass term positions into check phase, where resulting types are reported accordingly, and eventually shown as tooltips;
wenzelm
parents:
44866
diff
changeset
|
197 |
Pretty.string_of(List(Pretty.block(XML.Text(kind) :: Pretty.Break(1) :: body)), |
41e641a870de
pass term positions into check phase, where resulting types are reported accordingly, and eventually shown as tooltips;
wenzelm
parents:
44866
diff
changeset
|
198 |
margin = Isabelle.Int_Property("tooltip-margin")) |
41e641a870de
pass term positions into check phase, where resulting types are reported accordingly, and eventually shown as tooltips;
wenzelm
parents:
44866
diff
changeset
|
199 |
|
46178
1c5c88f6feb5
clarified Isabelle_Rendering vs. physical painting;
wenzelm
parents:
46166
diff
changeset
|
200 |
def tooltip(snapshot: Document.Snapshot, range: Text.Range): Option[String] = |
1c5c88f6feb5
clarified Isabelle_Rendering vs. physical painting;
wenzelm
parents:
46166
diff
changeset
|
201 |
{ |
47540
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
202 |
def add(prev: Text.Info[List[(Boolean, String)]], r: Text.Range, p: (Boolean, String)) = |
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
203 |
if (prev.range == r) Text.Info(r, p :: prev.info) else Text.Info(r, List(p)) |
42302 | 204 |
|
46178
1c5c88f6feb5
clarified Isabelle_Rendering vs. physical painting;
wenzelm
parents:
46166
diff
changeset
|
205 |
val tips = |
47540
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
206 |
snapshot.cumulate_markup[Text.Info[(List[(Boolean, String)])]]( |
46235
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
207 |
range, Text.Info(range, Nil), Some(tooltip_elements), |
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
208 |
{ |
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
209 |
case (prev, Text.Info(r, XML.Elem(Isabelle_Markup.Entity(kind, name), _))) => |
47540
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
210 |
add(prev, r, (true, kind + " " + quote(name))) |
46235
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
211 |
case (prev, Text.Info(r, XML.Elem(Markup(Isabelle_Markup.TYPING, _), body))) => |
47540
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
212 |
add(prev, r, (true, string_of_typing("::", body))) |
46235
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
213 |
case (prev, Text.Info(r, XML.Elem(Markup(Isabelle_Markup.ML_TYPING, _), body))) => |
47540
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
214 |
add(prev, r, (false, string_of_typing("ML:", body))) |
46235
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
215 |
case (prev, Text.Info(r, XML.Elem(Markup(name, _), _))) |
47540
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
216 |
if tooltips.isDefinedAt(name) => add(prev, r, (true, tooltips(name))) |
46235
e4e0b5190f3d
more careful cumulation of tooltips -- ensure uniform range;
wenzelm
parents:
46234
diff
changeset
|
217 |
}).toList.flatMap(_.info.info) |
46178
1c5c88f6feb5
clarified Isabelle_Rendering vs. physical painting;
wenzelm
parents:
46166
diff
changeset
|
218 |
|
47540
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
219 |
val all_tips = |
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
220 |
(tips.filter(_._1) ++ tips.filter(!_._1).lastOption.toList).map(_._2) |
1de8a8b1ae79
render last ML_TYPING only -- relevant for inline antiquotations like @{term};
wenzelm
parents:
46235
diff
changeset
|
221 |
if (all_tips.isEmpty) None else Some(cat_lines(all_tips)) |
46178
1c5c88f6feb5
clarified Isabelle_Rendering vs. physical painting;
wenzelm
parents:
46166
diff
changeset
|
222 |
} |
45460 | 223 |
|
46234 | 224 |
|
225 |
private val gutter_icons = Map( |
|
226 |
warning_pri -> Isabelle.load_icon("16x16/status/dialog-information.png"), |
|
227 |
legacy_pri -> Isabelle.load_icon("16x16/status/dialog-warning.png"), |
|
228 |
error_pri -> Isabelle.load_icon("16x16/status/dialog-error.png")) |
|
229 |
||
230 |
def gutter_message(snapshot: Document.Snapshot, range: Text.Range): Option[Icon] = |
|
231 |
{ |
|
232 |
val results = |
|
233 |
snapshot.cumulate_markup[Int](range, 0, |
|
234 |
Some(Set(Isabelle_Markup.WARNING, Isabelle_Markup.ERROR)), |
|
235 |
{ |
|
236 |
case (pri, Text.Info(_, XML.Elem(Markup(Isabelle_Markup.WARNING, _), body))) => |
|
237 |
body match { |
|
238 |
case List(XML.Elem(Markup(Isabelle_Markup.LEGACY, _), _)) => pri max legacy_pri |
|
239 |
case _ => pri max warning_pri |
|
240 |
} |
|
241 |
case (pri, Text.Info(_, XML.Elem(Markup(Isabelle_Markup.ERROR, _), _))) => |
|
242 |
pri max error_pri |
|
243 |
}) |
|
244 |
val pri = (0 /: results) { case (p1, Text.Info(_, p2)) => p1 max p2 } |
|
245 |
gutter_icons.get(pri) |
|
246 |
} |
|
247 |
||
248 |
||
249 |
private val squiggly_colors = Map( |
|
250 |
writeln_pri -> writeln_color, |
|
251 |
warning_pri -> warning_color, |
|
252 |
error_pri -> error_color) |
|
253 |
||
254 |
def squiggly_underline(snapshot: Document.Snapshot, range: Text.Range): Stream[Text.Info[Color]] = |
|
255 |
{ |
|
256 |
val results = |
|
257 |
snapshot.cumulate_markup[Int](range, 0, |
|
258 |
Some(Set(Isabelle_Markup.WRITELN, Isabelle_Markup.WARNING, Isabelle_Markup.ERROR)), |
|
259 |
{ |
|
260 |
case (pri, Text.Info(_, XML.Elem(Markup(name, _), _))) => |
|
261 |
name match { |
|
262 |
case Isabelle_Markup.WRITELN => pri max writeln_pri |
|
263 |
case Isabelle_Markup.WARNING => pri max warning_pri |
|
264 |
case Isabelle_Markup.ERROR => pri max error_pri |
|
265 |
case _ => pri |
|
266 |
} |
|
267 |
}) |
|
268 |
for { |
|
269 |
Text.Info(r, pri) <- results |
|
270 |
color <- squiggly_colors.get(pri) |
|
271 |
} yield Text.Info(r, color) |
|
272 |
} |
|
273 |
||
42302 | 274 |
|
46234 | 275 |
def background1(snapshot: Document.Snapshot, range: Text.Range): Stream[Text.Info[Color]] = |
46178
1c5c88f6feb5
clarified Isabelle_Rendering vs. physical painting;
wenzelm
parents:
46166
diff
changeset
|
276 |
{ |
46234 | 277 |
if (snapshot.is_outdated) Stream(Text.Info(range, outdated_color)) |
278 |
else |
|
279 |
for { |
|
280 |
Text.Info(r, result) <- |
|
281 |
snapshot.cumulate_markup[(Option[Protocol.Status], Option[Color])]( |
|
282 |
range, (Some(Protocol.Status.init), None), |
|
283 |
Some(Protocol.command_status_markup + Isabelle_Markup.BAD + Isabelle_Markup.HILITE), |
|
284 |
{ |
|
285 |
case (((Some(status), color), Text.Info(_, XML.Elem(markup, _)))) |
|
286 |
if (Protocol.command_status_markup(markup.name)) => |
|
287 |
(Some(Protocol.command_status(status, markup)), color) |
|
288 |
case (_, Text.Info(_, XML.Elem(Markup(Isabelle_Markup.BAD, _), _))) => |
|
289 |
(None, Some(bad_color)) |
|
290 |
case (_, Text.Info(_, XML.Elem(Markup(Isabelle_Markup.HILITE, _), _))) => |
|
291 |
(None, Some(hilite_color)) |
|
292 |
}) |
|
293 |
color <- |
|
294 |
(result match { |
|
49037
d7a1973b063c
more markup for failed goal forks, reusing "bad";
wenzelm
parents:
49036
diff
changeset
|
295 |
case (Some(status), opt_color) => |
49036
4680c4046814
further refinement of command status, to accomodate forked proofs;
wenzelm
parents:
48923
diff
changeset
|
296 |
if (status.is_unprocessed) Some(unprocessed1_color) |
4680c4046814
further refinement of command status, to accomodate forked proofs;
wenzelm
parents:
48923
diff
changeset
|
297 |
else if (status.is_running) Some(running1_color) |
49037
d7a1973b063c
more markup for failed goal forks, reusing "bad";
wenzelm
parents:
49036
diff
changeset
|
298 |
else opt_color |
46234 | 299 |
case (_, opt_color) => opt_color |
300 |
}) |
|
301 |
} yield Text.Info(r, color) |
|
46178
1c5c88f6feb5
clarified Isabelle_Rendering vs. physical painting;
wenzelm
parents:
46166
diff
changeset
|
302 |
} |
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
303 |
|
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
304 |
|
46234 | 305 |
def background2(snapshot: Document.Snapshot, range: Text.Range): Stream[Text.Info[Color]] = |
306 |
snapshot.select_markup(range, |
|
307 |
Some(Set(Isabelle_Markup.TOKEN_RANGE)), |
|
308 |
{ |
|
309 |
case Text.Info(_, XML.Elem(Markup(Isabelle_Markup.TOKEN_RANGE, _), _)) => light_color |
|
310 |
}) |
|
311 |
||
312 |
||
313 |
def foreground(snapshot: Document.Snapshot, range: Text.Range): Stream[Text.Info[Color]] = |
|
314 |
snapshot.select_markup(range, |
|
315 |
Some(Set(Isabelle_Markup.STRING, Isabelle_Markup.ALTSTRING, Isabelle_Markup.VERBATIM)), |
|
316 |
{ |
|
317 |
case Text.Info(_, XML.Elem(Markup(Isabelle_Markup.STRING, _), _)) => quoted_color |
|
318 |
case Text.Info(_, XML.Elem(Markup(Isabelle_Markup.ALTSTRING, _), _)) => quoted_color |
|
319 |
case Text.Info(_, XML.Elem(Markup(Isabelle_Markup.VERBATIM, _), _)) => quoted_color |
|
320 |
}) |
|
321 |
||
322 |
||
323 |
private val text_colors: Map[String, Color] = |
|
324 |
Map( |
|
325 |
Isabelle_Markup.STRING -> get_color("black"), |
|
326 |
Isabelle_Markup.ALTSTRING -> get_color("black"), |
|
327 |
Isabelle_Markup.VERBATIM -> get_color("black"), |
|
328 |
Isabelle_Markup.LITERAL -> keyword1_color, |
|
329 |
Isabelle_Markup.DELIMITER -> get_color("black"), |
|
330 |
Isabelle_Markup.TFREE -> get_color("#A020F0"), |
|
331 |
Isabelle_Markup.TVAR -> get_color("#A020F0"), |
|
332 |
Isabelle_Markup.FREE -> get_color("blue"), |
|
333 |
Isabelle_Markup.SKOLEM -> get_color("#D2691E"), |
|
334 |
Isabelle_Markup.BOUND -> get_color("green"), |
|
335 |
Isabelle_Markup.VAR -> get_color("#00009B"), |
|
336 |
Isabelle_Markup.INNER_STRING -> get_color("#D2691E"), |
|
337 |
Isabelle_Markup.INNER_COMMENT -> get_color("#8B0000"), |
|
338 |
Isabelle_Markup.DYNAMIC_FACT -> get_color("#7BA428"), |
|
339 |
Isabelle_Markup.ML_KEYWORD -> keyword1_color, |
|
340 |
Isabelle_Markup.ML_DELIMITER -> get_color("black"), |
|
341 |
Isabelle_Markup.ML_NUMERAL -> get_color("red"), |
|
342 |
Isabelle_Markup.ML_CHAR -> get_color("#D2691E"), |
|
343 |
Isabelle_Markup.ML_STRING -> get_color("#D2691E"), |
|
344 |
Isabelle_Markup.ML_COMMENT -> get_color("#8B0000"), |
|
345 |
Isabelle_Markup.ANTIQ -> get_color("blue")) |
|
346 |
||
347 |
private val text_color_elements = Set.empty[String] ++ text_colors.keys |
|
348 |
||
349 |
def text_color(snapshot: Document.Snapshot, range: Text.Range, color: Color) |
|
350 |
: Stream[Text.Info[Color]] = |
|
351 |
snapshot.cumulate_markup(range, color, Some(text_color_elements), |
|
352 |
{ |
|
353 |
case (_, Text.Info(_, XML.Elem(Markup(m, _), _))) |
|
354 |
if text_colors.isDefinedAt(m) => text_colors(m) |
|
355 |
}) |
|
356 |
||
357 |
||
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
358 |
/* token markup -- text styles */ |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
359 |
|
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
360 |
private val command_style: Map[String, Byte] = |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
361 |
{ |
43414 | 362 |
import JEditToken._ |
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
363 |
Map[String, Byte]( |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
364 |
Keyword.THY_END -> KEYWORD2, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
365 |
Keyword.THY_SCRIPT -> LABEL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
366 |
Keyword.PRF_SCRIPT -> LABEL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
367 |
Keyword.PRF_ASM -> KEYWORD3, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
368 |
Keyword.PRF_ASM_GOAL -> KEYWORD3 |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
369 |
).withDefaultValue(KEYWORD1) |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
370 |
} |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
371 |
|
43414 | 372 |
private val token_style: Map[Token.Kind.Value, Byte] = |
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
373 |
{ |
43414 | 374 |
import JEditToken._ |
375 |
Map[Token.Kind.Value, Byte]( |
|
376 |
Token.Kind.KEYWORD -> KEYWORD2, |
|
377 |
Token.Kind.IDENT -> NULL, |
|
378 |
Token.Kind.LONG_IDENT -> NULL, |
|
379 |
Token.Kind.SYM_IDENT -> NULL, |
|
380 |
Token.Kind.VAR -> NULL, |
|
381 |
Token.Kind.TYPE_IDENT -> NULL, |
|
382 |
Token.Kind.TYPE_VAR -> NULL, |
|
383 |
Token.Kind.NAT -> NULL, |
|
384 |
Token.Kind.FLOAT -> NULL, |
|
43431 | 385 |
Token.Kind.STRING -> LITERAL1, |
386 |
Token.Kind.ALT_STRING -> LITERAL2, |
|
43414 | 387 |
Token.Kind.VERBATIM -> COMMENT3, |
388 |
Token.Kind.SPACE -> NULL, |
|
389 |
Token.Kind.COMMENT -> COMMENT1, |
|
48754
c2c1e5944536
clarified undefined, unparsed, unfinished command spans;
wenzelm
parents:
48751
diff
changeset
|
390 |
Token.Kind.ERROR -> INVALID |
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
391 |
).withDefaultValue(NULL) |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
392 |
} |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
393 |
|
43414 | 394 |
def token_markup(syntax: Outer_Syntax, token: Token): Byte = |
43430
1ed88ddf1268
more uniform treatment of "keyword" vs. "operator";
wenzelm
parents:
43418
diff
changeset
|
395 |
if (token.is_command) command_style(syntax.keyword_kind(token.content).getOrElse("")) |
1ed88ddf1268
more uniform treatment of "keyword" vs. "operator";
wenzelm
parents:
43418
diff
changeset
|
396 |
else if (token.is_operator) JEditToken.OPERATOR |
43414 | 397 |
else token_style(token.kind) |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
398 |
} |