author | wenzelm |
Thu, 01 Dec 2011 11:54:39 +0100 | |
changeset 45702 | 7df60d1aa988 |
parent 45674 | eb65c9d17e2f |
child 46121 | 30a69cd8a9a0 |
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 |
||
72 |
||
33985 | 73 |
/* hidden text */ |
74 |
||
75 |
val HIDDEN = "hidden" |
|
76 |
||
77 |
||
29184 | 78 |
/* logical entities */ |
79 |
||
43551 | 80 |
val CLASS = "class" |
43552 | 81 |
val TYPE = "type" |
29184 | 82 |
val FIXED = "fixed" |
43552 | 83 |
val CONSTANT = "constant" |
84 |
||
29184 | 85 |
val DYNAMIC_FACT = "dynamic_fact" |
86 |
||
87 |
||
88 |
/* inner syntax */ |
|
89 |
||
90 |
val TFREE = "tfree" |
|
91 |
val TVAR = "tvar" |
|
92 |
val FREE = "free" |
|
93 |
val SKOLEM = "skolem" |
|
94 |
val BOUND = "bound" |
|
95 |
val VAR = "var" |
|
45702 | 96 |
val NUMERAL = "numeral" |
29184 | 97 |
val LITERAL = "literal" |
43432
224006e5ac46
inner literal/delimiter corresponds to outer keyword/operator;
wenzelm
parents:
43386
diff
changeset
|
98 |
val DELIMITER = "delimiter" |
43386
4e78dd88c64f
more foreground markup, using actual CSS color names;
wenzelm
parents:
42492
diff
changeset
|
99 |
val INNER_STRING = "inner_string" |
29184 | 100 |
val INNER_COMMENT = "inner_comment" |
101 |
||
39168
e3ac771235f7
report token range after inner parse error -- often provides important clues about misunderstanding concerning lexical phase;
wenzelm
parents:
38887
diff
changeset
|
102 |
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
|
103 |
|
29184 | 104 |
val SORT = "sort" |
105 |
val TYP = "typ" |
|
106 |
val TERM = "term" |
|
107 |
val PROP = "prop" |
|
108 |
||
45445
41e641a870de
pass term positions into check phase, where resulting types are reported accordingly, and eventually shown as tooltips;
wenzelm
parents:
44706
diff
changeset
|
109 |
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
|
110 |
|
29184 | 111 |
val ATTRIBUTE = "attribute" |
112 |
val METHOD = "method" |
|
113 |
||
114 |
||
115 |
/* embedded source text */ |
|
116 |
||
117 |
val ML_SOURCE = "ML_source" |
|
118 |
val DOC_SOURCE = "doc_source" |
|
119 |
||
120 |
val ANTIQ = "antiq" |
|
43560
d1650e3720fd
ML antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
43552
diff
changeset
|
121 |
val ML_ANTIQUOTATION = "ML antiquotation" |
43564
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
43560
diff
changeset
|
122 |
val DOCUMENT_ANTIQUOTATION = "document antiquotation" |
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
43560
diff
changeset
|
123 |
val DOCUMENT_ANTIQUOTATION_OPTION = "document antiquotation option" |
29184 | 124 |
|
125 |
||
30615 | 126 |
/* ML syntax */ |
127 |
||
128 |
val ML_KEYWORD = "ML_keyword" |
|
37195 | 129 |
val ML_DELIMITER = "ML_delimiter" |
30615 | 130 |
val ML_TVAR = "ML_tvar" |
131 |
val ML_NUMERAL = "ML_numeral" |
|
132 |
val ML_CHAR = "ML_char" |
|
133 |
val ML_STRING = "ML_string" |
|
134 |
val ML_COMMENT = "ML_comment" |
|
135 |
val ML_MALFORMED = "ML_malformed" |
|
136 |
||
30702 | 137 |
val ML_DEF = "ML_def" |
31472 | 138 |
val ML_OPEN = "ML_open" |
139 |
val ML_STRUCT = "ML_struct" |
|
30702 | 140 |
val ML_TYPING = "ML_typing" |
141 |
||
30615 | 142 |
|
29184 | 143 |
/* outer syntax */ |
144 |
||
145 |
val KEYWORD_DECL = "keyword_decl" |
|
146 |
val COMMAND_DECL = "command_decl" |
|
147 |
||
148 |
val KEYWORD = "keyword" |
|
37194 | 149 |
val OPERATOR = "operator" |
29184 | 150 |
val COMMAND = "command" |
151 |
val STRING = "string" |
|
152 |
val ALTSTRING = "altstring" |
|
153 |
val VERBATIM = "verbatim" |
|
154 |
val COMMENT = "comment" |
|
155 |
val CONTROL = "control" |
|
156 |
val MALFORMED = "malformed" |
|
157 |
||
29185 | 158 |
val COMMAND_SPAN = "command_span" |
159 |
val IGNORED_SPAN = "ignored_span" |
|
160 |
val MALFORMED_SPAN = "malformed_span" |
|
161 |
||
29184 | 162 |
|
43673
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43593
diff
changeset
|
163 |
/* theory loader */ |
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43593
diff
changeset
|
164 |
|
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43593
diff
changeset
|
165 |
val LOADED_THEORY = "loaded_theory" |
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43593
diff
changeset
|
166 |
|
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43593
diff
changeset
|
167 |
|
45674 | 168 |
/* timing */ |
169 |
||
170 |
val TIMING = "timing" |
|
171 |
val ELAPSED = "elapsed" |
|
172 |
val CPU = "cpu" |
|
173 |
val GC = "gc" |
|
174 |
||
175 |
object Timing |
|
176 |
{ |
|
177 |
def apply(timing: isabelle.Timing): Markup = |
|
178 |
Markup(TIMING, List( |
|
179 |
(ELAPSED, Properties.Value.Double(timing.elapsed.seconds)), |
|
180 |
(CPU, Properties.Value.Double(timing.cpu.seconds)), |
|
181 |
(GC, Properties.Value.Double(timing.gc.seconds)))) |
|
182 |
def unapply(markup: Markup): Option[isabelle.Timing] = |
|
183 |
markup match { |
|
184 |
case Markup(TIMING, List( |
|
185 |
(ELAPSED, Properties.Value.Double(elapsed)), |
|
186 |
(CPU, Properties.Value.Double(cpu)), |
|
187 |
(GC, Properties.Value.Double(gc)))) => |
|
188 |
Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc))) |
|
189 |
case _ => None |
|
190 |
} |
|
191 |
} |
|
192 |
||
193 |
||
29184 | 194 |
/* toplevel */ |
195 |
||
38721
ca8b14fa0d0d
added some proof state markup, notably number of subgoals (e.g. for indentation);
wenzelm
parents:
38474
diff
changeset
|
196 |
val SUBGOALS = "subgoals" |
ca8b14fa0d0d
added some proof state markup, notably number of subgoals (e.g. for indentation);
wenzelm
parents:
38474
diff
changeset
|
197 |
val PROOF_STATE = "proof_state" |
ca8b14fa0d0d
added some proof state markup, notably number of subgoals (e.g. for indentation);
wenzelm
parents:
38474
diff
changeset
|
198 |
|
29184 | 199 |
val STATE = "state" |
200 |
val SUBGOAL = "subgoal" |
|
201 |
val SENDBACK = "sendback" |
|
202 |
val HILITE = "hilite" |
|
203 |
||
204 |
||
205 |
/* command status */ |
|
206 |
||
29417 | 207 |
val TASK = "task" |
208 |
||
37186
349e9223c685
explicit markup for forked goals, as indicated by Goal.fork;
wenzelm
parents:
37121
diff
changeset
|
209 |
val FORKED = "forked" |
349e9223c685
explicit markup for forked goals, as indicated by Goal.fork;
wenzelm
parents:
37121
diff
changeset
|
210 |
val JOINED = "joined" |
29184 | 211 |
val FAILED = "failed" |
212 |
val FINISHED = "finished" |
|
29488 | 213 |
|
214 |
||
215 |
/* interactive documents */ |
|
216 |
||
38414
49f1f657adc2
more basic Markup.parse_int/print_int (using signed_string_of_int) (ML);
wenzelm
parents:
38355
diff
changeset
|
217 |
val VERSION = "version" |
49f1f657adc2
more basic Markup.parse_int/print_int (using signed_string_of_int) (ML);
wenzelm
parents:
38355
diff
changeset
|
218 |
val ASSIGN = "assign" |
29184 | 219 |
|
27970 | 220 |
|
43721
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
221 |
/* prover process */ |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
222 |
|
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
223 |
val PROVER_COMMAND = "prover_command" |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
224 |
val PROVER_ARG = "prover_arg" |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
225 |
|
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
226 |
|
27970 | 227 |
/* messages */ |
228 |
||
43780 | 229 |
val Serial = new Properties.Long("serial") |
27970 | 230 |
|
29195 | 231 |
val MESSAGE = "message" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
232 |
|
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
233 |
val INIT = "init" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
234 |
val STATUS = "status" |
39525 | 235 |
val REPORT = "report" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
236 |
val WRITELN = "writeln" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
237 |
val TRACING = "tracing" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
238 |
val WARNING = "warning" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
239 |
val ERROR = "error" |
43746
a41f618c641d
some support for raw messages, which bypass standard Symbol/YXML decoding;
wenzelm
parents:
43721
diff
changeset
|
240 |
val RAW = "raw" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
241 |
val SYSTEM = "system" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
242 |
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
|
243 |
val STDERR = "stderr" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
244 |
val EXIT = "exit" |
29195 | 245 |
|
44549 | 246 |
val LEGACY = "legacy" |
247 |
||
39439
1c294d150ded
eliminated markup "location" in favour of more explicit "no_report", which is actually deleted from messages;
wenzelm
parents:
39171
diff
changeset
|
248 |
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
|
249 |
|
39171
525a13b9ac74
highlight bad range of nested error (here from inner parsing);
wenzelm
parents:
39168
diff
changeset
|
250 |
val BAD = "bad" |
525a13b9ac74
highlight bad range of nested error (here from inner parsing);
wenzelm
parents:
39168
diff
changeset
|
251 |
|
39591 | 252 |
val READY = "ready" |
31384
ce169bd37fc0
IsabelleProcess: emit status "ready" after initialization and reports;
wenzelm
parents:
30702
diff
changeset
|
253 |
|
27970 | 254 |
|
43748 | 255 |
/* raw message functions */ |
256 |
||
257 |
val FUNCTION = "function" |
|
43780 | 258 |
val Function = new Properties.String(FUNCTION) |
43748 | 259 |
|
44661
383c9d758a56
raw message function "assign_execs" avoids full overhead of decoding and caching message body;
wenzelm
parents:
44549
diff
changeset
|
260 |
val Assign_Execs: Properties.T = List((FUNCTION, "assign_execs")) |
44676 | 261 |
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
|
262 |
|
43748 | 263 |
val INVOKE_SCALA = "invoke_scala" |
264 |
object Invoke_Scala |
|
265 |
{ |
|
43780 | 266 |
def unapply(props: Properties.T): Option[(String, String)] = |
43748 | 267 |
props match { |
45666 | 268 |
case List((FUNCTION, INVOKE_SCALA), (Markup.NAME, name), (ID, id)) => Some((name, id)) |
43748 | 269 |
case _ => None |
270 |
} |
|
271 |
} |
|
272 |
||
44298
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
273 |
val CANCEL_SCALA = "cancel_scala" |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
274 |
object Cancel_Scala |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
275 |
{ |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
276 |
def unapply(props: Properties.T): Option[String] = |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
277 |
props match { |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
278 |
case List((FUNCTION, CANCEL_SCALA), (ID, id)) => Some(id) |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
279 |
case _ => None |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
280 |
} |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
281 |
} |
27958 | 282 |
} |
38230
ed147003de4b
simplified type XML.Tree: embed Markup directly, avoid slightly odd triple;
wenzelm
parents:
37195
diff
changeset
|
283 |