src/Pure/PIDE/isabelle_markup.ML
author wenzelm
Mon Oct 01 16:37:22 2012 +0200 (2012-10-01)
changeset 49674 dbadb4d03cbc
parent 49566 66cbf8bb4693
child 49677 c4e2762a265c
permissions -rw-r--r--
report sort assignment of visible type variables;
wenzelm@45670
     1
(*  Title:      Pure/PIDE/isabelle_markup.ML
wenzelm@23623
     2
    Author:     Makarius
wenzelm@23623
     3
wenzelm@45666
     4
Isabelle markup elements.
wenzelm@23623
     5
*)
wenzelm@23623
     6
wenzelm@45666
     7
signature ISABELLE_MARKUP =
wenzelm@23623
     8
sig
wenzelm@45666
     9
  val bindingN: string val binding: Markup.T
wenzelm@45666
    10
  val entityN: string val entity: string -> string -> Markup.T
wenzelm@45666
    11
  val get_entity_kind: Markup.T -> string option
wenzelm@33088
    12
  val defN: string
wenzelm@33088
    13
  val refN: string
wenzelm@23671
    14
  val lineN: string
wenzelm@27794
    15
  val offsetN: string
wenzelm@27794
    16
  val end_offsetN: string
wenzelm@23671
    17
  val fileN: string
wenzelm@30221
    18
  val idN: string
wenzelm@27748
    19
  val position_properties': string list
wenzelm@26051
    20
  val position_properties: string list
wenzelm@45666
    21
  val positionN: string val position: Markup.T
wenzelm@45666
    22
  val pathN: string val path: string -> Markup.T
wenzelm@23644
    23
  val indentN: string
wenzelm@45666
    24
  val blockN: string val block: int -> Markup.T
aspinall@23695
    25
  val widthN: string
wenzelm@45666
    26
  val breakN: string val break: int -> Markup.T
wenzelm@45666
    27
  val fbreakN: string val fbreak: Markup.T
wenzelm@45666
    28
  val hiddenN: string val hidden: Markup.T
wenzelm@48927
    29
  val theoryN: string
wenzelm@43548
    30
  val classN: string
wenzelm@46649
    31
  val type_nameN: string
wenzelm@43552
    32
  val constantN: string
wenzelm@45666
    33
  val fixedN: string val fixed: string -> Markup.T
wenzelm@45666
    34
  val dynamic_factN: string val dynamic_fact: string -> Markup.T
wenzelm@45666
    35
  val tfreeN: string val tfree: Markup.T
wenzelm@45666
    36
  val tvarN: string val tvar: Markup.T
wenzelm@45666
    37
  val freeN: string val free: Markup.T
wenzelm@45666
    38
  val skolemN: string val skolem: Markup.T
wenzelm@45666
    39
  val boundN: string val bound: Markup.T
wenzelm@45666
    40
  val varN: string val var: Markup.T
wenzelm@45666
    41
  val numeralN: string val numeral: Markup.T
wenzelm@45666
    42
  val literalN: string val literal: Markup.T
wenzelm@45666
    43
  val delimiterN: string val delimiter: Markup.T
wenzelm@45666
    44
  val inner_stringN: string val inner_string: Markup.T
wenzelm@45666
    45
  val inner_commentN: string val inner_comment: Markup.T
wenzelm@45666
    46
  val token_rangeN: string val token_range: Markup.T
wenzelm@45666
    47
  val sortN: string val sort: Markup.T
wenzelm@45666
    48
  val typN: string val typ: Markup.T
wenzelm@45666
    49
  val termN: string val term: Markup.T
wenzelm@45666
    50
  val propN: string val prop: Markup.T
wenzelm@49674
    51
  val sortingN: string val sorting: Markup.T
wenzelm@45666
    52
  val typingN: string val typing: Markup.T
wenzelm@45666
    53
  val ML_keywordN: string val ML_keyword: Markup.T
wenzelm@45666
    54
  val ML_delimiterN: string val ML_delimiter: Markup.T
wenzelm@45666
    55
  val ML_tvarN: string val ML_tvar: Markup.T
wenzelm@45666
    56
  val ML_numeralN: string val ML_numeral: Markup.T
wenzelm@45666
    57
  val ML_charN: string val ML_char: Markup.T
wenzelm@45666
    58
  val ML_stringN: string val ML_string: Markup.T
wenzelm@45666
    59
  val ML_commentN: string val ML_comment: Markup.T
wenzelm@42327
    60
  val ML_defN: string
wenzelm@42327
    61
  val ML_openN: string
wenzelm@42327
    62
  val ML_structN: string
wenzelm@45666
    63
  val ML_typingN: string val ML_typing: Markup.T
wenzelm@45666
    64
  val ML_sourceN: string val ML_source: Markup.T
wenzelm@45666
    65
  val doc_sourceN: string val doc_source: Markup.T
wenzelm@45666
    66
  val antiqN: string val antiq: Markup.T
wenzelm@43560
    67
  val ML_antiquotationN: string
wenzelm@49321
    68
  val document_antiquotationN: string
wenzelm@49321
    69
  val document_antiquotation_optionN: string
wenzelm@45666
    70
  val keywordN: string val keyword: Markup.T
wenzelm@45666
    71
  val operatorN: string val operator: Markup.T
wenzelm@45666
    72
  val commandN: string val command: Markup.T
wenzelm@45666
    73
  val stringN: string val string: Markup.T
wenzelm@45666
    74
  val altstringN: string val altstring: Markup.T
wenzelm@45666
    75
  val verbatimN: string val verbatim: Markup.T
wenzelm@45666
    76
  val commentN: string val comment: Markup.T
wenzelm@45666
    77
  val controlN: string val control: Markup.T
wenzelm@45666
    78
  val tokenN: string val token: Properties.T -> Markup.T
wenzelm@49554
    79
  val keyword1N: string val keyword1: Markup.T
wenzelm@49554
    80
  val keyword2N: string val keyword2: Markup.T
wenzelm@45674
    81
  val elapsedN: string
wenzelm@45674
    82
  val cpuN: string
wenzelm@45674
    83
  val gcN: string
wenzelm@45674
    84
  val timingN: string val timing: Timing.timing -> Markup.T
wenzelm@38721
    85
  val subgoalsN: string
wenzelm@45666
    86
  val proof_stateN: string val proof_state: int -> Markup.T
wenzelm@45666
    87
  val stateN: string val state: Markup.T
wenzelm@45666
    88
  val subgoalN: string val subgoal: Markup.T
wenzelm@45666
    89
  val sendbackN: string val sendback: Markup.T
wenzelm@49358
    90
  val intensifyN: string val intensify: Markup.T
wenzelm@29417
    91
  val taskN: string
wenzelm@47395
    92
  val acceptedN: string val accepted: Markup.T
wenzelm@45666
    93
  val forkedN: string val forked: Markup.T
wenzelm@45666
    94
  val joinedN: string val joined: Markup.T
wenzelm@49036
    95
  val runningN: string val running: Markup.T
wenzelm@49036
    96
  val finishedN: string val finished: Markup.T
wenzelm@45666
    97
  val failedN: string val failed: Markup.T
wenzelm@38871
    98
  val serialN: string
wenzelm@45666
    99
  val legacyN: string val legacy: Markup.T
wenzelm@45666
   100
  val promptN: string val prompt: Markup.T
wenzelm@45666
   101
  val reportN: string val report: Markup.T
wenzelm@45666
   102
  val no_reportN: string val no_report: Markup.T
wenzelm@48768
   103
  val badN: string val bad: Markup.T
wenzelm@49566
   104
  val graphviewN: string
wenzelm@43748
   105
  val functionN: string
wenzelm@44661
   106
  val assign_execs: Properties.T
wenzelm@44676
   107
  val removed_versions: Properties.T
wenzelm@43748
   108
  val invoke_scala: string -> string -> Properties.T
wenzelm@44298
   109
  val cancel_scala: string -> Properties.T
wenzelm@23623
   110
end;
wenzelm@23623
   111
wenzelm@45666
   112
structure Isabelle_Markup: ISABELLE_MARKUP =
wenzelm@23623
   113
struct
wenzelm@23623
   114
wenzelm@30221
   115
(** markup elements **)
wenzelm@30221
   116
wenzelm@45666
   117
fun markup_elem elem = (elem, (elem, []): Markup.T);
wenzelm@45666
   118
fun markup_string elem prop = (elem, fn s => (elem, [(prop, s)]): Markup.T);
wenzelm@45666
   119
fun markup_int elem prop = (elem, fn i => (elem, [(prop, Markup.print_int i)]): Markup.T);
wenzelm@23671
   120
wenzelm@23658
   121
wenzelm@33088
   122
(* formal entities *)
wenzelm@33088
   123
wenzelm@43547
   124
val (bindingN, binding) = markup_elem "binding";
wenzelm@42135
   125
wenzelm@42135
   126
val entityN = "entity";
wenzelm@45666
   127
fun entity kind name = (entityN, [(Markup.nameN, name), (Markup.kindN, kind)]);
wenzelm@33088
   128
wenzelm@43548
   129
fun get_entity_kind (name, props) =
wenzelm@45666
   130
  if name = entityN then AList.lookup (op =) props Markup.kindN
wenzelm@43548
   131
  else NONE;
wenzelm@43548
   132
wenzelm@33088
   133
val defN = "def";
wenzelm@33088
   134
val refN = "ref";
wenzelm@33088
   135
wenzelm@33088
   136
wenzelm@23671
   137
(* position *)
wenzelm@23671
   138
wenzelm@23671
   139
val lineN = "line";
wenzelm@27794
   140
val offsetN = "offset";
wenzelm@27794
   141
val end_offsetN = "end_offset";
wenzelm@23671
   142
val fileN = "file";
wenzelm@25816
   143
val idN = "id";
wenzelm@23671
   144
wenzelm@41484
   145
val position_properties' = [fileN, idN];
wenzelm@43710
   146
val position_properties = [lineN, offsetN, end_offsetN] @ position_properties';
wenzelm@27748
   147
wenzelm@25552
   148
val (positionN, position) = markup_elem "position";
wenzelm@26255
   149
wenzelm@23644
   150
wenzelm@43593
   151
(* path *)
wenzelm@43593
   152
wenzelm@45666
   153
val (pathN, path) = markup_string "path" Markup.nameN;
wenzelm@43593
   154
wenzelm@43593
   155
wenzelm@23644
   156
(* pretty printing *)
wenzelm@23644
   157
wenzelm@23644
   158
val indentN = "indent";
wenzelm@23644
   159
val (blockN, block) = markup_int "block" indentN;
wenzelm@23644
   160
wenzelm@23644
   161
val widthN = "width";
wenzelm@23644
   162
val (breakN, break) = markup_int "break" widthN;
wenzelm@23644
   163
wenzelm@25552
   164
val (fbreakN, fbreak) = markup_elem "fbreak";
wenzelm@23637
   165
wenzelm@23637
   166
wenzelm@33985
   167
(* hidden text *)
wenzelm@33985
   168
wenzelm@33985
   169
val (hiddenN, hidden) = markup_elem "hidden";
wenzelm@33985
   170
wenzelm@33985
   171
wenzelm@23623
   172
(* logical entities *)
wenzelm@23623
   173
wenzelm@48927
   174
val theoryN = "theory";
wenzelm@43548
   175
val classN = "class";
wenzelm@49321
   176
val type_nameN = "type_name";
wenzelm@43552
   177
val constantN = "constant";
wenzelm@43552
   178
wenzelm@45666
   179
val (fixedN, fixed) = markup_string "fixed" Markup.nameN;
wenzelm@45666
   180
val (dynamic_factN, dynamic_fact) = markup_string "dynamic_fact" Markup.nameN;
wenzelm@23623
   181
wenzelm@23623
   182
wenzelm@23623
   183
(* inner syntax *)
wenzelm@23623
   184
wenzelm@25552
   185
val (tfreeN, tfree) = markup_elem "tfree";
wenzelm@25552
   186
val (tvarN, tvar) = markup_elem "tvar";
wenzelm@25552
   187
val (freeN, free) = markup_elem "free";
wenzelm@25552
   188
val (skolemN, skolem) = markup_elem "skolem";
wenzelm@25552
   189
val (boundN, bound) = markup_elem "bound";
wenzelm@25552
   190
val (varN, var) = markup_elem "var";
wenzelm@29318
   191
val (numeralN, numeral) = markup_elem "numeral";
wenzelm@27804
   192
val (literalN, literal) = markup_elem "literal";
wenzelm@43432
   193
val (delimiterN, delimiter) = markup_elem "delimiter";
wenzelm@29318
   194
val (inner_stringN, inner_string) = markup_elem "inner_string";
wenzelm@27883
   195
val (inner_commentN, inner_comment) = markup_elem "inner_comment";
wenzelm@23719
   196
wenzelm@39168
   197
val (token_rangeN, token_range) = markup_elem "token_range";
wenzelm@39168
   198
wenzelm@25552
   199
val (sortN, sort) = markup_elem "sort";
wenzelm@25552
   200
val (typN, typ) = markup_elem "typ";
wenzelm@25552
   201
val (termN, term) = markup_elem "term";
wenzelm@27818
   202
val (propN, prop) = markup_elem "prop";
wenzelm@27748
   203
wenzelm@49674
   204
val (sortingN, sorting) = markup_elem "sorting";
wenzelm@45445
   205
val (typingN, typing) = markup_elem "typing";
wenzelm@45445
   206
wenzelm@23623
   207
wenzelm@30614
   208
(* ML syntax *)
wenzelm@30614
   209
wenzelm@30614
   210
val (ML_keywordN, ML_keyword) = markup_elem "ML_keyword";
wenzelm@37195
   211
val (ML_delimiterN, ML_delimiter) = markup_elem "ML_delimiter";
wenzelm@30614
   212
val (ML_tvarN, ML_tvar) = markup_elem "ML_tvar";
wenzelm@30614
   213
val (ML_numeralN, ML_numeral) = markup_elem "ML_numeral";
wenzelm@30614
   214
val (ML_charN, ML_char) = markup_elem "ML_char";
wenzelm@30614
   215
val (ML_stringN, ML_string) = markup_elem "ML_string";
wenzelm@30614
   216
val (ML_commentN, ML_comment) = markup_elem "ML_comment";
wenzelm@30614
   217
wenzelm@42327
   218
val ML_defN = "ML_def";
wenzelm@42327
   219
val ML_openN = "ML_open";
wenzelm@42327
   220
val ML_structN = "ML_struct";
wenzelm@30702
   221
val (ML_typingN, ML_typing) = markup_elem "ML_typing";
wenzelm@30702
   222
wenzelm@30614
   223
wenzelm@27875
   224
(* embedded source text *)
wenzelm@27875
   225
wenzelm@27875
   226
val (ML_sourceN, ML_source) = markup_elem "ML_source";
wenzelm@27875
   227
val (doc_sourceN, doc_source) = markup_elem "doc_source";
wenzelm@27875
   228
wenzelm@27879
   229
val (antiqN, antiq) = markup_elem "antiq";
wenzelm@49321
   230
val ML_antiquotationN = "ML_antiquotation";
wenzelm@49321
   231
val document_antiquotationN = "document_antiquotation";
wenzelm@49321
   232
val document_antiquotation_optionN = "document_antiquotation_option";
wenzelm@27879
   233
wenzelm@27875
   234
wenzelm@23623
   235
(* outer syntax *)
wenzelm@23623
   236
wenzelm@37193
   237
val (keywordN, keyword) = markup_elem "keyword";
wenzelm@37192
   238
val (operatorN, operator) = markup_elem "operator";
wenzelm@37193
   239
val (commandN, command) = markup_elem "command";
wenzelm@25552
   240
val (stringN, string) = markup_elem "string";
wenzelm@25552
   241
val (altstringN, altstring) = markup_elem "altstring";
wenzelm@25552
   242
val (verbatimN, verbatim) = markup_elem "verbatim";
wenzelm@25552
   243
val (commentN, comment) = markup_elem "comment";
wenzelm@25552
   244
val (controlN, control) = markup_elem "control";
wenzelm@23719
   245
wenzelm@38229
   246
val tokenN = "token";
wenzelm@38229
   247
fun token props = (tokenN, props);
wenzelm@27851
   248
wenzelm@49554
   249
val (keyword1N, keyword1) = markup_elem "keyword1";
wenzelm@49554
   250
val (keyword2N, keyword2) = markup_elem "keyword2";
wenzelm@49554
   251
wenzelm@23623
   252
wenzelm@45674
   253
(* timing *)
wenzelm@45674
   254
wenzelm@45674
   255
val timingN = "timing";
wenzelm@45674
   256
val elapsedN = "elapsed";
wenzelm@45674
   257
val cpuN = "cpu";
wenzelm@45674
   258
val gcN = "gc";
wenzelm@45674
   259
wenzelm@45674
   260
fun timing {elapsed, cpu, gc} =
wenzelm@45674
   261
  (timingN,
wenzelm@45674
   262
   [(elapsedN, Time.toString elapsed),
wenzelm@45674
   263
    (cpuN, Time.toString cpu),
wenzelm@45674
   264
    (gcN, Time.toString gc)]);
wenzelm@45674
   265
wenzelm@45674
   266
wenzelm@40394
   267
(* toplevel *)
wenzelm@40391
   268
wenzelm@38721
   269
val subgoalsN = "subgoals";
wenzelm@38721
   270
val (proof_stateN, proof_state) = markup_int "proof_state" subgoalsN;
wenzelm@38721
   271
wenzelm@25552
   272
val (stateN, state) = markup_elem "state";
wenzelm@25552
   273
val (subgoalN, subgoal) = markup_elem "subgoal";
wenzelm@25552
   274
val (sendbackN, sendback) = markup_elem "sendback";
wenzelm@49358
   275
val (intensifyN, intensify) = markup_elem "intensify";
wenzelm@25552
   276
wenzelm@25552
   277
wenzelm@27606
   278
(* command status *)
wenzelm@27606
   279
wenzelm@29417
   280
val taskN = "task";
wenzelm@29417
   281
wenzelm@47395
   282
val (acceptedN, accepted) = markup_elem "accepted";
wenzelm@37186
   283
val (forkedN, forked) = markup_elem "forked";
wenzelm@37186
   284
val (joinedN, joined) = markup_elem "joined";
wenzelm@49036
   285
val (runningN, running) = markup_elem "running";
wenzelm@49036
   286
val (finishedN, finished) = markup_elem "finished";
wenzelm@27615
   287
val (failedN, failed) = markup_elem "failed";
wenzelm@27606
   288
wenzelm@29488
   289
wenzelm@27969
   290
(* messages *)
wenzelm@27969
   291
wenzelm@38871
   292
val serialN = "serial";
wenzelm@27969
   293
wenzelm@44549
   294
val (legacyN, legacy) = markup_elem "legacy";
wenzelm@27969
   295
val (promptN, prompt) = markup_elem "prompt";
wenzelm@27969
   296
wenzelm@38887
   297
val (reportN, report) = markup_elem "report";
wenzelm@39439
   298
val (no_reportN, no_report) = markup_elem "no_report";
wenzelm@38887
   299
wenzelm@48768
   300
val (badN, bad) = markup_elem "bad";
wenzelm@39171
   301
wenzelm@49566
   302
val graphviewN = "graphview";
wenzelm@49566
   303
wenzelm@27969
   304
wenzelm@46774
   305
(* protocol message functions *)
wenzelm@43748
   306
wenzelm@43748
   307
val functionN = "function"
wenzelm@43748
   308
wenzelm@44661
   309
val assign_execs = [(functionN, "assign_execs")];
wenzelm@44676
   310
val removed_versions = [(functionN, "removed_versions")];
wenzelm@44661
   311
wenzelm@45666
   312
fun invoke_scala name id = [(functionN, "invoke_scala"), (Markup.nameN, name), (idN, id)];
wenzelm@44298
   313
fun cancel_scala id = [(functionN, "cancel_scala"), (idN, id)];
wenzelm@43748
   314
wenzelm@23623
   315
end;