author | wenzelm |
Fri, 06 Apr 2012 12:02:24 +0200 | |
changeset 47347 | af937661e4a1 |
parent 46910 | 3e068ef04b42 |
child 47395 | e6261a493f04 |
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" |
46649
bb185c45037e
clarifed name space "type name", which covers logical and non-logical types, and often occurs inside outer syntax "type" markup;
wenzelm
parents:
46123
diff
changeset
|
81 |
val TYPE_NAME = "type name" |
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 = "keyword" |
|
37194 | 146 |
val OPERATOR = "operator" |
29184 | 147 |
val COMMAND = "command" |
148 |
val STRING = "string" |
|
149 |
val ALTSTRING = "altstring" |
|
150 |
val VERBATIM = "verbatim" |
|
151 |
val COMMENT = "comment" |
|
152 |
val CONTROL = "control" |
|
153 |
val MALFORMED = "malformed" |
|
154 |
||
29185 | 155 |
val COMMAND_SPAN = "command_span" |
156 |
val IGNORED_SPAN = "ignored_span" |
|
157 |
val MALFORMED_SPAN = "malformed_span" |
|
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" |
|
194 |
val HILITE = "hilite" |
|
195 |
||
196 |
||
197 |
/* command status */ |
|
198 |
||
29417 | 199 |
val TASK = "task" |
200 |
||
46910
3e068ef04b42
clarified command state -- markup within proper_range, excluding trailing whitespace;
wenzelm
parents:
46774
diff
changeset
|
201 |
val PARSED = "parsed" |
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" |
29184 | 204 |
val FAILED = "failed" |
205 |
val FINISHED = "finished" |
|
29488 | 206 |
|
207 |
||
208 |
/* interactive documents */ |
|
209 |
||
38414
49f1f657adc2
more basic Markup.parse_int/print_int (using signed_string_of_int) (ML);
wenzelm
parents:
38355
diff
changeset
|
210 |
val VERSION = "version" |
49f1f657adc2
more basic Markup.parse_int/print_int (using signed_string_of_int) (ML);
wenzelm
parents:
38355
diff
changeset
|
211 |
val ASSIGN = "assign" |
29184 | 212 |
|
27970 | 213 |
|
43721
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
214 |
/* prover process */ |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
215 |
|
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
216 |
val PROVER_COMMAND = "prover_command" |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
217 |
val PROVER_ARG = "prover_arg" |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
218 |
|
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43710
diff
changeset
|
219 |
|
27970 | 220 |
/* messages */ |
221 |
||
43780 | 222 |
val Serial = new Properties.Long("serial") |
27970 | 223 |
|
29195 | 224 |
val MESSAGE = "message" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
225 |
|
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
226 |
val INIT = "init" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
227 |
val STATUS = "status" |
39525 | 228 |
val REPORT = "report" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
229 |
val WRITELN = "writeln" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
230 |
val TRACING = "tracing" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
231 |
val WARNING = "warning" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
232 |
val ERROR = "error" |
46774 | 233 |
val PROTOCOL = "protocol" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
234 |
val SYSTEM = "system" |
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
235 |
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
|
236 |
val STDERR = "stderr" |
29522
793766d4c1b5
moved message markup into Scala layer -- reduced redundancy;
wenzelm
parents:
29488
diff
changeset
|
237 |
val EXIT = "exit" |
29195 | 238 |
|
44549 | 239 |
val LEGACY = "legacy" |
240 |
||
39439
1c294d150ded
eliminated markup "location" in favour of more explicit "no_report", which is actually deleted from messages;
wenzelm
parents:
39171
diff
changeset
|
241 |
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
|
242 |
|
39171
525a13b9ac74
highlight bad range of nested error (here from inner parsing);
wenzelm
parents:
39168
diff
changeset
|
243 |
val BAD = "bad" |
525a13b9ac74
highlight bad range of nested error (here from inner parsing);
wenzelm
parents:
39168
diff
changeset
|
244 |
|
27970 | 245 |
|
46774 | 246 |
/* protocol message functions */ |
43748 | 247 |
|
248 |
val FUNCTION = "function" |
|
43780 | 249 |
val Function = new Properties.String(FUNCTION) |
43748 | 250 |
|
46121 | 251 |
val Ready: Properties.T = List((FUNCTION, "ready")) |
252 |
||
46122 | 253 |
object Loaded_Theory |
254 |
{ |
|
255 |
def unapply(props: Properties.T): Option[String] = |
|
256 |
props match { |
|
257 |
case List((FUNCTION, "loaded_theory"), (Markup.NAME, name)) => Some(name) |
|
258 |
case _ => None |
|
259 |
} |
|
260 |
} |
|
261 |
||
46123 | 262 |
object Keyword_Decl |
263 |
{ |
|
264 |
def unapply(props: Properties.T): Option[String] = |
|
265 |
props match { |
|
266 |
case List((FUNCTION, "keyword_decl"), (Markup.NAME, name)) => Some(name) |
|
267 |
case _ => None |
|
268 |
} |
|
269 |
} |
|
270 |
object Command_Decl |
|
271 |
{ |
|
272 |
def unapply(props: Properties.T): Option[(String, String)] = |
|
273 |
props match { |
|
274 |
case List((FUNCTION, "command_decl"), (Markup.NAME, name), (Markup.KIND, kind)) => |
|
275 |
Some((name, kind)) |
|
276 |
case _ => None |
|
277 |
} |
|
278 |
} |
|
279 |
||
44661
383c9d758a56
raw message function "assign_execs" avoids full overhead of decoding and caching message body;
wenzelm
parents:
44549
diff
changeset
|
280 |
val Assign_Execs: Properties.T = List((FUNCTION, "assign_execs")) |
44676 | 281 |
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
|
282 |
|
43748 | 283 |
object Invoke_Scala |
284 |
{ |
|
43780 | 285 |
def unapply(props: Properties.T): Option[(String, String)] = |
43748 | 286 |
props match { |
46122 | 287 |
case List((FUNCTION, "invoke_scala"), (Markup.NAME, name), (ID, id)) => Some((name, id)) |
43748 | 288 |
case _ => None |
289 |
} |
|
290 |
} |
|
44298
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
291 |
object Cancel_Scala |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
292 |
{ |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
293 |
def unapply(props: Properties.T): Option[String] = |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
294 |
props match { |
46122 | 295 |
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
|
296 |
case _ => None |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
297 |
} |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
43780
diff
changeset
|
298 |
} |
27958 | 299 |
} |
38230
ed147003de4b
simplified type XML.Tree: embed Markup directly, avoid slightly odd triple;
wenzelm
parents:
37195
diff
changeset
|
300 |