author | wenzelm |
Mon, 01 Oct 2012 16:37:22 +0200 | |
changeset 49674 | dbadb4d03cbc |
parent 49566 | 66cbf8bb4693 |
child 50162 | e06eabc421e7 |
permissions | -rw-r--r-- |
45670 | 1 |
/* Title: Pure/PIDE/isabelle_markup.scala |
27958 | 2 |
Author: Makarius |
3 |
||
45666 | 4 |
Isabelle markup elements. |
27958 | 5 |
*/ |
6 |
||
7 |
package isabelle |
|
8 |
||
27970 | 9 |
|
45666 | 10 |
object Isabelle_Markup |
32450 | 11 |
{ |
33088
757d7787b10c
markup for formal entities, with "def" or "ref" occurrences;
wenzelm
parents:
32450
diff
changeset
|
12 |
/* formal entities */ |
757d7787b10c
markup for formal entities, with "def" or "ref" occurrences;
wenzelm
parents:
32450
diff
changeset
|
13 |
|
38887
1261481ef5e5
Command.State: add reported positions to markup tree, according main message position or Markup.binding/entity/report occurrences in body;
wenzelm
parents:
38872
diff
changeset
|
14 |
val BINDING = "binding" |
33088
757d7787b10c
markup for formal entities, with "def" or "ref" occurrences;
wenzelm
parents:
32450
diff
changeset
|
15 |
val ENTITY = "entity" |
757d7787b10c
markup for formal entities, with "def" or "ref" occurrences;
wenzelm
parents:
32450
diff
changeset
|
16 |
val DEF = "def" |
757d7787b10c
markup for formal entities, with "def" or "ref" occurrences;
wenzelm
parents:
32450
diff
changeset
|
17 |
val REF = "ref" |
757d7787b10c
markup for formal entities, with "def" or "ref" occurrences;
wenzelm
parents:
32450
diff
changeset
|
18 |
|
42202 | 19 |
object Entity |
20 |
{ |
|
21 |
def unapply(markup: Markup): Option[(String, String)] = |
|
22 |
markup match { |
|
45666 | 23 |
case Markup(ENTITY, props @ Markup.Kind(kind)) => |
42202 | 24 |
props match { |
45666 | 25 |
case Markup.Name(name) => Some(kind, name) |
42202 | 26 |
case _ => None |
27 |
} |
|
28 |
case _ => None |
|
29 |
} |
|
30 |
} |
|
31 |
||
33088
757d7787b10c
markup for formal entities, with "def" or "ref" occurrences;
wenzelm
parents:
32450
diff
changeset
|
32 |
|
27970 | 33 |
/* position */ |
34 |
||
35 |
val LINE = "line" |
|
36 |
val OFFSET = "offset" |
|
37 |
val END_OFFSET = "end_offset" |
|
38 |
val FILE = "file" |
|
39 |
val ID = "id" |
|
40 |
||
42327
7c7cc7590eb3
Name_Space.entry_markup: keep def position as separate properties;
wenzelm
parents:
42202
diff
changeset
|
41 |
val DEF_LINE = "def_line" |
7c7cc7590eb3
Name_Space.entry_markup: keep def position as separate properties;
wenzelm
parents:
42202
diff
changeset
|
42 |
val DEF_OFFSET = "def_offset" |
7c7cc7590eb3
Name_Space.entry_markup: keep def position as separate properties;
wenzelm
parents:
42202
diff
changeset
|
43 |
val DEF_END_OFFSET = "def_end_offset" |
7c7cc7590eb3
Name_Space.entry_markup: keep def position as separate properties;
wenzelm
parents:
42202
diff
changeset
|
44 |
val DEF_FILE = "def_file" |
7c7cc7590eb3
Name_Space.entry_markup: keep def position as separate properties;
wenzelm
parents:
42202
diff
changeset
|
45 |
val DEF_ID = "def_id" |
7c7cc7590eb3
Name_Space.entry_markup: keep def position as separate properties;
wenzelm
parents:
42202
diff
changeset
|
46 |
|
43710
7270ae921cf2
discontinued odd Position.column -- left-over from attempts at PGIP implementation;
wenzelm
parents:
43673
diff
changeset
|
47 |
val POSITION_PROPERTIES = Set(LINE, OFFSET, END_OFFSET, FILE, ID) |
43593 | 48 |
val POSITION = "position" |
29205 | 49 |
|
43593 | 50 |
|
51 |
/* path */ |
|
52 |
||
53 |
val PATH = "path" |
|
54 |
||
55 |
object Path |
|
56 |
{ |
|
57 |
def unapply(markup: Markup): Option[String] = |
|
58 |
markup match { |
|
45666 | 59 |
case Markup(PATH, Markup.Name(name)) => Some(name) |
43593 | 60 |
case _ => None |
61 |
} |
|
62 |
} |
|
29184 | 63 |
|
64 |
||
36683 | 65 |
/* pretty printing */ |
66 |
||
43780 | 67 |
val Indent = new Properties.Int("indent") |
36683 | 68 |
val BLOCK = "block" |
43780 | 69 |
val Width = new Properties.Int("width") |
36683 | 70 |
val BREAK = "break" |
71 |
||
49473 | 72 |
val SEPARATOR = "separator" |
73 |
||
36683 | 74 |
|
33985 | 75 |
/* hidden text */ |
76 |
||
77 |
val HIDDEN = "hidden" |
|
78 |
||
79 |
||
29184 | 80 |
/* logical entities */ |
81 |
||
43551 | 82 |
val CLASS = "class" |
49321
a48f9bbbe720
avoid spaces in markup names, which might cause problems in boundary situations (e.g. HTML class);
wenzelm
parents:
49036
diff
changeset
|
83 |
val TYPE_NAME = "type_name" |
29184 | 84 |
val FIXED = "fixed" |
43552 | 85 |
val CONSTANT = "constant" |
86 |
||
29184 | 87 |
val DYNAMIC_FACT = "dynamic_fact" |
88 |
||
89 |
||
90 |
/* inner syntax */ |
|
91 |
||
92 |
val TFREE = "tfree" |
|
93 |
val TVAR = "tvar" |
|
94 |
val FREE = "free" |
|
95 |
val SKOLEM = "skolem" |
|
96 |
val BOUND = "bound" |
|
97 |
val VAR = "var" |
|
45702 | 98 |
val NUMERAL = "numeral" |
29184 | 99 |
val LITERAL = "literal" |
43432
224006e5ac46
inner literal/delimiter corresponds to outer keyword/operator;
wenzelm
parents:
43386
diff
changeset
|
100 |
val DELIMITER = "delimiter" |
43386
4e78dd88c64f
more foreground markup, using actual CSS color names;
wenzelm
parents:
42492
diff
changeset
|
101 |
val INNER_STRING = "inner_string" |
29184 | 102 |
val INNER_COMMENT = "inner_comment" |
103 |
||
39168
e3ac771235f7
report token range after inner parse error -- often provides important clues about misunderstanding concerning lexical phase;
wenzelm
parents:
38887
diff
changeset
|
104 |
val TOKEN_RANGE = "token_range" |
e3ac771235f7
report token range after inner parse error -- often provides important clues about misunderstanding concerning lexical phase;
wenzelm
parents:
38887
diff
changeset
|
105 |
|
29184 | 106 |
val SORT = "sort" |
107 |
val TYP = "typ" |
|
108 |
val TERM = "term" |
|
109 |
val PROP = "prop" |
|
110 |
||
49674
dbadb4d03cbc
report sort assignment of visible type variables;
wenzelm
parents:
49566
diff
changeset
|
111 |
val SORTING = "sorting" |
45445
41e641a870de
pass term positions into check phase, where resulting types are reported accordingly, and eventually shown as tooltips;
wenzelm
parents:
44706
diff
changeset
|
112 |
val TYPING = "typing" |
41e641a870de
pass term positions into check phase, where resulting types are reported accordingly, and eventually shown as tooltips;
wenzelm
parents:
44706
diff
changeset
|
113 |
|
29184 | 114 |
val ATTRIBUTE = "attribute" |
115 |
val METHOD = "method" |
|
116 |
||
117 |
||
118 |
/* embedded source text */ |
|
119 |
||
120 |
val ML_SOURCE = "ML_source" |
|
49321
a48f9bbbe720
avoid spaces in markup names, which might cause problems in boundary situations (e.g. HTML class);
wenzelm
parents:
49036
diff
changeset
|
121 |
val DOCUMENT_SOURCE = "document_source" |
29184 | 122 |
|
123 |
val ANTIQ = "antiq" |
|
49321
a48f9bbbe720
avoid spaces in markup names, which might cause problems in boundary situations (e.g. HTML class);
wenzelm
parents:
49036
diff
changeset
|
124 |
val ML_ANTIQUOTATION = "ML_antiquotation" |
a48f9bbbe720
avoid spaces in markup names, which might cause problems in boundary situations (e.g. HTML class);
wenzelm
parents:
49036
diff
changeset
|
125 |
val DOCUMENT_ANTIQUOTATION = "document_antiquotation" |
a48f9bbbe720
avoid spaces in markup names, which might cause problems in boundary situations (e.g. HTML class);
wenzelm
parents:
49036
diff
changeset
|
126 |
val DOCUMENT_ANTIQUOTATION_OPTION = "document_antiquotation_option" |
29184 | 127 |
|
128 |
||
30615 | 129 |
/* ML syntax */ |
130 |
||
131 |
val ML_KEYWORD = "ML_keyword" |
|
37195 | 132 |
val ML_DELIMITER = "ML_delimiter" |
30615 | 133 |
val ML_TVAR = "ML_tvar" |
134 |
val ML_NUMERAL = "ML_numeral" |
|
135 |
val ML_CHAR = "ML_char" |
|
136 |
val ML_STRING = "ML_string" |
|
137 |
val ML_COMMENT = "ML_comment" |
|
138 |
||
30702 | 139 |
val ML_DEF = "ML_def" |
31472 | 140 |
val ML_OPEN = "ML_open" |
141 |
val ML_STRUCT = "ML_struct" |
|
30702 | 142 |
val ML_TYPING = "ML_typing" |
143 |
||
30615 | 144 |
|
29184 | 145 |
/* outer syntax */ |
146 |
||
147 |
val KEYWORD = "keyword" |
|
37194 | 148 |
val OPERATOR = "operator" |
29184 | 149 |
val COMMAND = "command" |
150 |
val STRING = "string" |
|
151 |
val ALTSTRING = "altstring" |
|
152 |
val VERBATIM = "verbatim" |
|
153 |
val COMMENT = "comment" |
|
154 |
val CONTROL = "control" |
|
155 |
||
49554
7b7bd2d7661d
more explicit keyword1/keyword2 markup -- avoid potential conflict with input token markup produced by Token_Marker;
wenzelm
parents:
49473
diff
changeset
|
156 |
val KEYWORD1 = "keyword1" |
7b7bd2d7661d
more explicit keyword1/keyword2 markup -- avoid potential conflict with input token markup produced by Token_Marker;
wenzelm
parents:
49473
diff
changeset
|
157 |
val KEYWORD2 = "keyword2" |
7b7bd2d7661d
more explicit keyword1/keyword2 markup -- avoid potential conflict with input token markup produced by Token_Marker;
wenzelm
parents:
49473
diff
changeset
|
158 |
|
29184 | 159 |
|
45674 | 160 |
/* timing */ |
161 |
||
162 |
val TIMING = "timing" |
|
163 |
val ELAPSED = "elapsed" |
|
164 |
val CPU = "cpu" |
|
165 |
val GC = "gc" |
|
166 |
||
167 |
object Timing |
|
168 |
{ |
|
169 |
def apply(timing: isabelle.Timing): Markup = |
|
170 |
Markup(TIMING, List( |
|
171 |
(ELAPSED, Properties.Value.Double(timing.elapsed.seconds)), |
|
172 |
(CPU, Properties.Value.Double(timing.cpu.seconds)), |
|
173 |
(GC, Properties.Value.Double(timing.gc.seconds)))) |
|
174 |
def unapply(markup: Markup): Option[isabelle.Timing] = |
|
175 |
markup match { |
|
176 |
case Markup(TIMING, List( |
|
177 |
(ELAPSED, Properties.Value.Double(elapsed)), |
|
178 |
(CPU, Properties.Value.Double(cpu)), |
|
179 |
(GC, Properties.Value.Double(gc)))) => |
|
180 |
Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc))) |
|
181 |
case _ => None |
|
182 |
} |
|
183 |
} |
|
184 |
||
185 |
||
29184 | 186 |
/* toplevel */ |
187 |
||
38721
ca8b14fa0d0d
added some proof state markup, notably number of subgoals (e.g. for indentation);
wenzelm
parents:
38474
diff
changeset
|
188 |
val SUBGOALS = "subgoals" |
ca8b14fa0d0d
added some proof state markup, notably number of subgoals (e.g. for indentation);
wenzelm
parents:
38474
diff
changeset
|
189 |
val PROOF_STATE = "proof_state" |
ca8b14fa0d0d
added some proof state markup, notably number of subgoals (e.g. for indentation);
wenzelm
parents:
38474
diff
changeset
|
190 |
|
29184 | 191 |
val STATE = "state" |
192 |
val SUBGOAL = "subgoal" |
|
193 |
val SENDBACK = "sendback" |
|
49358 | 194 |
val INTENSIFY = "intensify" |
29184 | 195 |
|
196 |
||
197 |
/* command status */ |
|
198 |
||
29417 | 199 |
val TASK = "task" |
200 |
||
47395
e6261a493f04
added static command status markup, to emphasize accepted but unassigned/unparsed commands (notably in overview panel);
wenzelm
parents:
46910
diff
changeset
|
201 |
val ACCEPTED = "accepted" |
37186
349e9223c685
explicit markup for forked goals, as indicated by Goal.fork;
wenzelm
parents:
37121
diff
changeset
|
202 |
val FORKED = "forked" |
349e9223c685
explicit markup for forked goals, as indicated by Goal.fork;
wenzelm
parents:
37121
diff
changeset
|
203 |
val JOINED = "joined" |
49036
4680c4046814
further refinement of command status, to accomodate forked proofs;
wenzelm
parents:
49009
diff
changeset
|
204 |
val RUNNING = "running" |
4680c4046814
further refinement of command status, to accomodate forked proofs;
wenzelm
parents:
49009
diff
changeset
|
205 |
val FINISHED = "finished" |
29184 | 206 |
val FAILED = "failed" |
29488 | 207 |
|
208 |
||
209 |
/* interactive documents */ |
|
210 |
||
38414
49f1f657adc2
more basic Markup.parse_int/print_int (using signed_string_of_int) (ML);
wenzelm
parents:
38355
diff
changeset
|
211 |
val VERSION = "version" |
49f1f657adc2
more basic Markup.parse_int/print_int (using signed_string_of_int) (ML);
wenzelm
parents:
38355
diff
changeset
|
212 |
val ASSIGN = "assign" |
29184 | 213 |
|
27970 | 214 |
|
43721
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
215 |
/* prover process */ |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
216 |
|
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
217 |
val PROVER_COMMAND = "prover_command" |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
218 |
val PROVER_ARG = "prover_arg" |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
219 |
|
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
220 |
|
27970 | 221 |
/* messages */ |
222 |
||
43780 | 223 |
val Serial = new Properties.Long("serial") |
27970 | 224 |
|
29195 | 225 |
val MESSAGE = "message" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
226 |
|
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
227 |
val INIT = "init" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
228 |
val STATUS = "status" |
39525 | 229 |
val REPORT = "report" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
230 |
val WRITELN = "writeln" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
231 |
val TRACING = "tracing" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
232 |
val WARNING = "warning" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
233 |
val ERROR = "error" |
46774 | 234 |
val PROTOCOL = "protocol" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
235 |
val SYSTEM = "system" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
236 |
val STDOUT = "stdout" |
45633
2cb7e34f6096
retain stderr and include it in syslog, which is buffered and thus increases the chance that users see remains from crashes etc.;
wenzelm
parents:
45445
diff
changeset
|
237 |
val STDERR = "stderr" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
238 |
val EXIT = "exit" |
29195 | 239 |
|
49418 | 240 |
val WRITELN_MESSAGE = "writeln_message" |
241 |
val TRACING_MESSAGE = "tracing_message" |
|
242 |
val WARNING_MESSAGE = "warning_message" |
|
243 |
val ERROR_MESSAGE = "error_message" |
|
244 |
||
245 |
val message: String => String = |
|
246 |
Map(WRITELN -> WRITELN_MESSAGE, TRACING -> TRACING_MESSAGE, |
|
247 |
WARNING -> WARNING_MESSAGE, ERROR -> ERROR_MESSAGE) |
|
248 |
.withDefault((name: String) => name + "_message") |
|
249 |
||
48016
edbc8e8accd9
more explicit treatment of return code vs. session phase;
wenzelm
parents:
47395
diff
changeset
|
250 |
val Return_Code = new Properties.Int("return_code") |
edbc8e8accd9
more explicit treatment of return code vs. session phase;
wenzelm
parents:
47395
diff
changeset
|
251 |
|
44549 | 252 |
val LEGACY = "legacy" |
253 |
||
39439
1c294d150ded
eliminated markup "location" in favour of more explicit "no_report", which is actually deleted from messages;
wenzelm
parents:
39171
diff
changeset
|
254 |
val NO_REPORT = "no_report" |
1c294d150ded
eliminated markup "location" in favour of more explicit "no_report", which is actually deleted from messages;
wenzelm
parents:
39171
diff
changeset
|
255 |
|
39171
525a13b9ac74
highlight bad range of nested error (here from inner parsing);
wenzelm
parents:
39168
diff
changeset
|
256 |
val BAD = "bad" |
525a13b9ac74
highlight bad range of nested error (here from inner parsing);
wenzelm
parents:
39168
diff
changeset
|
257 |
|
49566
66cbf8bb4693
basic integration of graphview into document model;
wenzelm
parents:
49554
diff
changeset
|
258 |
val GRAPHVIEW = "graphview" |
66cbf8bb4693
basic integration of graphview into document model;
wenzelm
parents:
49554
diff
changeset
|
259 |
|
27970 | 260 |
|
46774 | 261 |
/* protocol message functions */ |
43748 | 262 |
|
263 |
val FUNCTION = "function" |
|
43780 | 264 |
val Function = new Properties.String(FUNCTION) |
43748 | 265 |
|
44661
383c9d758a56
raw message function "assign_execs" avoids full overhead of decoding and caching message body;
wenzelm
parents:
44549
diff
changeset
|
266 |
val Assign_Execs: Properties.T = List((FUNCTION, "assign_execs")) |
44676 | 267 |
val Removed_Versions: Properties.T = List((FUNCTION, "removed_versions")) |
44661
383c9d758a56
raw message function "assign_execs" avoids full overhead of decoding and caching message body;
wenzelm
parents:
44549
diff
changeset
|
268 |
|
43748 | 269 |
object Invoke_Scala |
270 |
{ |
|
43780 | 271 |
def unapply(props: Properties.T): Option[(String, String)] = |
43748 | 272 |
props match { |
46122 | 273 |
case List((FUNCTION, "invoke_scala"), (Markup.NAME, name), (ID, id)) => Some((name, id)) |
43748 | 274 |
case _ => None |
275 |
} |
|
276 |
} |
|
44298
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
277 |
object Cancel_Scala |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
278 |
{ |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
279 |
def unapply(props: Properties.T): Option[String] = |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
280 |
props match { |
46122 | 281 |
case List((FUNCTION, "cancel_scala"), (ID, id)) => Some(id) |
44298
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
282 |
case _ => None |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
283 |
} |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
284 |
} |
27958 | 285 |
} |
38230
ed147003de4b
simplified type XML.Tree: embed Markup directly, avoid slightly odd triple;
wenzelm
parents:
37195
diff
changeset
|
286 |