author | wenzelm |
Wed, 08 Jun 2011 17:42:07 +0200 | |
changeset 43282 | 5d294220ca43 |
parent 42492 | src/Tools/jEdit/src/jedit/isabelle_markup.scala@83c57d850049 |
child 43376 | 0f6880c1c759 |
permissions | -rw-r--r-- |
43282
5d294220ca43
moved sources -- eliminated Netbeans artifact of jedit package directory;
wenzelm
parents:
42492
diff
changeset
|
1 |
/* Title: Tools/jEdit/src/isabelle_markup.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 |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
13 |
|
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
14 |
import org.gjt.sp.jedit.syntax.Token |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
15 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
16 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
17 |
object Isabelle_Markup |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
18 |
{ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
19 |
/* physical rendering */ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
20 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
21 |
val outdated_color = new Color(240, 240, 240) |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
22 |
val unfinished_color = new Color(255, 228, 225) |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
23 |
|
39690
6c6164b37fef
some attempts to improve visual appearance of bad text;
wenzelm
parents:
39512
diff
changeset
|
24 |
val light_color = new Color(240, 240, 240) |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
25 |
val regular_color = new Color(192, 192, 192) |
39692 | 26 |
val warning_color = new Color(255, 140, 0) |
39691 | 27 |
val error_color = new Color(178, 34, 34) |
39690
6c6164b37fef
some attempts to improve visual appearance of bad text;
wenzelm
parents:
39512
diff
changeset
|
28 |
val bad_color = new Color(255, 106, 106, 100) |
42171 | 29 |
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
|
30 |
|
39181
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
31 |
class Icon(val priority: Int, val icon: javax.swing.Icon) |
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
32 |
{ |
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
33 |
def >= (that: Icon): Boolean = this.priority >= that.priority |
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
34 |
} |
39241 | 35 |
val warning_icon = new Icon(1, Isabelle.load_icon("16x16/status/dialog-warning.png")) |
36 |
val error_icon = new Icon(2, Isabelle.load_icon("16x16/status/dialog-error.png")) |
|
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
37 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
38 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
39 |
/* command status */ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
40 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
41 |
def status_color(snapshot: Document.Snapshot, command: Command): Option[Color] = |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
42 |
{ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
43 |
val state = snapshot.state(command) |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
44 |
if (snapshot.is_outdated) Some(outdated_color) |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
45 |
else |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
46 |
Isar_Document.command_status(state.status) match { |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
47 |
case Isar_Document.Forked(i) if i > 0 => Some(unfinished_color) |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
48 |
case Isar_Document.Unprocessed => Some(unfinished_color) |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
49 |
case _ => None |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
50 |
} |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
51 |
} |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
52 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
53 |
def overview_color(snapshot: Document.Snapshot, command: Command): Option[Color] = |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
54 |
{ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
55 |
val state = snapshot.state(command) |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
56 |
if (snapshot.is_outdated) None |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
57 |
else |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
58 |
Isar_Document.command_status(state.status) match { |
39512
31290f54be19
Isabelle_Markup.overview_color: indicate error / warning messages;
wenzelm
parents:
39244
diff
changeset
|
59 |
case Isar_Document.Forked(i) => if (i > 0) Some(unfinished_color) else None |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
60 |
case Isar_Document.Unprocessed => Some(unfinished_color) |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
61 |
case Isar_Document.Failed => Some(error_color) |
39512
31290f54be19
Isabelle_Markup.overview_color: indicate error / warning messages;
wenzelm
parents:
39244
diff
changeset
|
62 |
case Isar_Document.Finished => |
31290f54be19
Isabelle_Markup.overview_color: indicate error / warning messages;
wenzelm
parents:
39244
diff
changeset
|
63 |
if (state.results.exists(r => Isar_Document.is_error(r._2))) Some(error_color) |
31290f54be19
Isabelle_Markup.overview_color: indicate error / warning messages;
wenzelm
parents:
39244
diff
changeset
|
64 |
else if (state.results.exists(r => Isar_Document.is_warning(r._2))) Some(warning_color) |
31290f54be19
Isabelle_Markup.overview_color: indicate error / warning messages;
wenzelm
parents:
39244
diff
changeset
|
65 |
else None |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
66 |
} |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
67 |
} |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
68 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
69 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
70 |
/* markup selectors */ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
71 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
72 |
val message: Markup_Tree.Select[Color] = |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
73 |
{ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
74 |
case Text.Info(_, XML.Elem(Markup(Markup.WRITELN, _), _)) => regular_color |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
75 |
case Text.Info(_, XML.Elem(Markup(Markup.WARNING, _), _)) => warning_color |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
76 |
case Text.Info(_, XML.Elem(Markup(Markup.ERROR, _), _)) => error_color |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
77 |
} |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
78 |
|
40338
e2f03de2b3c7
clarified tooltips: message output by default, extra info via control/command;
wenzelm
parents:
39740
diff
changeset
|
79 |
val popup: Markup_Tree.Select[String] = |
39740 | 80 |
{ |
81 |
case Text.Info(_, msg @ XML.Elem(Markup(markup, _), _)) |
|
40338
e2f03de2b3c7
clarified tooltips: message output by default, extra info via control/command;
wenzelm
parents:
39740
diff
changeset
|
82 |
if markup == Markup.WRITELN || markup == Markup.WARNING || markup == Markup.ERROR => |
40339 | 83 |
Pretty.string_of(List(msg), margin = Isabelle.Int_Property("tooltip-margin")) |
39740 | 84 |
} |
85 |
||
39181
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
86 |
val gutter_message: Markup_Tree.Select[Icon] = |
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
87 |
{ |
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
88 |
case Text.Info(_, XML.Elem(Markup(Markup.WARNING, _), _)) => warning_icon |
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
89 |
case Text.Info(_, XML.Elem(Markup(Markup.ERROR, _), _)) => error_icon |
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
90 |
} |
2257eded8323
Document_View: select gutter message icons from markup over line range, not full range results;
wenzelm
parents:
39179
diff
changeset
|
91 |
|
39700
fa55cf2c1ae4
more precise treatment of backgrounds vs. rectangles;
wenzelm
parents:
39692
diff
changeset
|
92 |
val background1: Markup_Tree.Select[Color] = |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
93 |
{ |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
94 |
case Text.Info(_, XML.Elem(Markup(Markup.BAD, _), _)) => bad_color |
42171 | 95 |
case Text.Info(_, XML.Elem(Markup(Markup.HILITE, _), _)) => hilite_color |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
96 |
} |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
97 |
|
39700
fa55cf2c1ae4
more precise treatment of backgrounds vs. rectangles;
wenzelm
parents:
39692
diff
changeset
|
98 |
val background2: Markup_Tree.Select[Color] = |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
99 |
{ |
39690
6c6164b37fef
some attempts to improve visual appearance of bad text;
wenzelm
parents:
39512
diff
changeset
|
100 |
case Text.Info(_, XML.Elem(Markup(Markup.TOKEN_RANGE, _), _)) => light_color |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
101 |
} |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
102 |
|
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
103 |
val tooltip: Markup_Tree.Select[String] = |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
104 |
{ |
42283 | 105 |
case Text.Info(_, XML.Elem(Markup.Entity(kind, name), _)) => kind + " \"" + name + "\"" |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
106 |
case Text.Info(_, XML.Elem(Markup(Markup.ML_TYPING, _), body)) => |
40339 | 107 |
Pretty.string_of(List(Pretty.block(XML.Text("ML:") :: Pretty.Break(1) :: body)), |
108 |
margin = Isabelle.Int_Property("tooltip-margin")) |
|
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
109 |
case Text.Info(_, XML.Elem(Markup(Markup.SORT, _), _)) => "sort" |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
110 |
case Text.Info(_, XML.Elem(Markup(Markup.TYP, _), _)) => "type" |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
111 |
case Text.Info(_, XML.Elem(Markup(Markup.TERM, _), _)) => "term" |
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
112 |
case Text.Info(_, XML.Elem(Markup(Markup.PROP, _), _)) => "proposition" |
39704 | 113 |
case Text.Info(_, XML.Elem(Markup(Markup.TOKEN_RANGE, _), _)) => "inner syntax token" |
42203 | 114 |
case Text.Info(_, XML.Elem(Markup(Markup.FREE, _), _)) => "free variable (globally fixed)" |
115 |
case Text.Info(_, XML.Elem(Markup(Markup.SKOLEM, _), _)) => "skolem variable (locally fixed)" |
|
116 |
case Text.Info(_, XML.Elem(Markup(Markup.BOUND, _), _)) => "bound variable (internally fixed)" |
|
117 |
case Text.Info(_, XML.Elem(Markup(Markup.VAR, _), _)) => "schematic variable" |
|
42302 | 118 |
case Text.Info(_, XML.Elem(Markup(Markup.TFREE, _), _)) => "free type variable" |
119 |
case Text.Info(_, XML.Elem(Markup(Markup.TVAR, _), _)) => "schematic type variable" |
|
120 |
} |
|
121 |
||
122 |
private val subexp_include = |
|
123 |
Set(Markup.SORT, Markup.TYP, Markup.TERM, Markup.PROP, Markup.ML_TYPING, Markup.TOKEN_RANGE, |
|
124 |
Markup.ENTITY, Markup.FREE, Markup.SKOLEM, Markup.BOUND, Markup.VAR, |
|
125 |
Markup.TFREE, Markup.TVAR) |
|
126 |
||
127 |
val subexp: Markup_Tree.Select[(Text.Range, Color)] = |
|
128 |
{ |
|
129 |
case Text.Info(range, XML.Elem(Markup(name, _), _)) if subexp_include(name) => |
|
130 |
(range, Color.black) |
|
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
131 |
} |
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
132 |
|
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
133 |
|
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
134 |
/* token markup -- text styles */ |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
135 |
|
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
136 |
private val command_style: Map[String, Byte] = |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
137 |
{ |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
138 |
import Token._ |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
139 |
Map[String, Byte]( |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
140 |
Keyword.THY_END -> KEYWORD2, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
141 |
Keyword.THY_SCRIPT -> LABEL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
142 |
Keyword.PRF_SCRIPT -> LABEL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
143 |
Keyword.PRF_ASM -> KEYWORD3, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
144 |
Keyword.PRF_ASM_GOAL -> KEYWORD3 |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
145 |
).withDefaultValue(KEYWORD1) |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
146 |
} |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
147 |
|
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
148 |
private val token_style: Map[String, Byte] = |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
149 |
{ |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
150 |
import Token._ |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
151 |
Map[String, Byte]( |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
152 |
// logical entities |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
153 |
Markup.TCLASS -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
154 |
Markup.TYCON -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
155 |
Markup.FIXED -> NULL, |
42136 | 156 |
Markup.CONST -> LITERAL2, |
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
157 |
Markup.DYNAMIC_FACT -> LABEL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
158 |
// inner syntax |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
159 |
Markup.TFREE -> NULL, |
42132 | 160 |
Markup.FREE -> MARKUP, |
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
161 |
Markup.TVAR -> NULL, |
42171 | 162 |
Markup.SKOLEM -> COMMENT2, |
42132 | 163 |
Markup.BOUND -> LABEL, |
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
164 |
Markup.VAR -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
165 |
Markup.NUM -> DIGIT, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
166 |
Markup.FLOAT -> DIGIT, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
167 |
Markup.XNUM -> DIGIT, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
168 |
Markup.XSTR -> LITERAL4, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
169 |
Markup.LITERAL -> OPERATOR, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
170 |
Markup.INNER_COMMENT -> COMMENT1, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
171 |
Markup.SORT -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
172 |
Markup.TYP -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
173 |
Markup.TERM -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
174 |
Markup.PROP -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
175 |
// ML syntax |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
176 |
Markup.ML_KEYWORD -> KEYWORD1, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
177 |
Markup.ML_DELIMITER -> OPERATOR, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
178 |
Markup.ML_IDENT -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
179 |
Markup.ML_TVAR -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
180 |
Markup.ML_NUMERAL -> DIGIT, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
181 |
Markup.ML_CHAR -> LITERAL1, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
182 |
Markup.ML_STRING -> LITERAL1, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
183 |
Markup.ML_COMMENT -> COMMENT1, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
184 |
Markup.ML_MALFORMED -> INVALID, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
185 |
// embedded source text |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
186 |
Markup.ML_SOURCE -> COMMENT3, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
187 |
Markup.DOC_SOURCE -> COMMENT3, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
188 |
Markup.ANTIQ -> COMMENT4, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
189 |
Markup.ML_ANTIQ -> COMMENT4, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
190 |
Markup.DOC_ANTIQ -> COMMENT4, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
191 |
// outer syntax |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
192 |
Markup.KEYWORD -> KEYWORD2, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
193 |
Markup.OPERATOR -> OPERATOR, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
194 |
Markup.COMMAND -> KEYWORD1, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
195 |
Markup.IDENT -> NULL, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
196 |
Markup.VERBATIM -> COMMENT3, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
197 |
Markup.COMMENT -> COMMENT1, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
198 |
Markup.CONTROL -> COMMENT3, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
199 |
Markup.MALFORMED -> INVALID, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
200 |
Markup.STRING -> LITERAL3, |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
201 |
Markup.ALTSTRING -> LITERAL1 |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
202 |
).withDefaultValue(NULL) |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
203 |
} |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
204 |
|
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
205 |
def tokens(syntax: Outer_Syntax): Markup_Tree.Select[Byte] = |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
206 |
{ |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
207 |
case Text.Info(_, XML.Elem(Markup(Markup.COMMAND, List((Markup.NAME, name))), _)) |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
208 |
if syntax.keyword_kind(name).isDefined => command_style(syntax.keyword_kind(name).get) |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
209 |
|
42136 | 210 |
case Text.Info(_, XML.Elem(Markup(Markup.ENTITY, Markup.Kind(kind)), _)) |
211 |
if token_style(kind) != Token.NULL => token_style(kind) |
|
212 |
||
39179
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
213 |
case Text.Info(_, XML.Elem(Markup(name, _), _)) |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
214 |
if token_style(name) != Token.NULL => token_style(name) |
591bbab9ef59
moved token markup tables to isabelle_markup.scala;
wenzelm
parents:
39178
diff
changeset
|
215 |
} |
39178
83e9f3ccea9f
concentrate Isabelle specific physical rendering markup selection in isabelle_markup.scala;
wenzelm
parents:
diff
changeset
|
216 |
} |