src/Pure/PIDE/markup.scala
author wenzelm
Mon Aug 10 20:42:59 2015 +0200 (2015-08-10)
changeset 60882 45bfd18835f1
parent 60842 5510c8444bc4
child 61449 4f31f79cf2d1
permissions -rw-r--r--
tuned signature;
more rendering;
wenzelm@45670
     1
/*  Title:      Pure/PIDE/markup.scala
wenzelm@45673
     2
    Module:     PIDE
wenzelm@27958
     3
    Author:     Makarius
wenzelm@27958
     4
wenzelm@56743
     5
Quasi-abstract markup elements.
wenzelm@27958
     6
*/
wenzelm@27958
     7
wenzelm@27958
     8
package isabelle
wenzelm@27958
     9
wenzelm@27970
    10
wenzelm@32450
    11
object Markup
wenzelm@32450
    12
{
wenzelm@56743
    13
  /* elements */
wenzelm@56743
    14
wenzelm@56743
    15
  object Elements
wenzelm@56743
    16
  {
wenzelm@56743
    17
    def apply(elems: Set[String]): Elements = new Elements(elems)
wenzelm@56743
    18
    def apply(elems: String*): Elements = apply(Set(elems: _*))
wenzelm@56743
    19
    val empty: Elements = apply()
wenzelm@56743
    20
    val full: Elements =
wenzelm@56743
    21
      new Elements(Set.empty)
wenzelm@56743
    22
      {
wenzelm@56743
    23
        override def apply(elem: String): Boolean = true
wenzelm@56743
    24
        override def toString: String = "Elements.full"
wenzelm@56743
    25
      }
wenzelm@56743
    26
  }
wenzelm@56743
    27
wenzelm@56743
    28
  sealed class Elements private[Markup](private val rep: Set[String])
wenzelm@56743
    29
  {
wenzelm@56743
    30
    def apply(elem: String): Boolean = rep.contains(elem)
wenzelm@56743
    31
    def + (elem: String): Elements = new Elements(rep + elem)
wenzelm@56743
    32
    def ++ (elems: Elements): Elements = new Elements(rep ++ elems.rep)
wenzelm@56743
    33
    override def toString: String = rep.mkString("Elements(", ",", ")")
wenzelm@56743
    34
  }
wenzelm@56743
    35
wenzelm@56743
    36
wenzelm@45666
    37
  /* properties */
wenzelm@29184
    38
wenzelm@29184
    39
  val NAME = "name"
wenzelm@43780
    40
  val Name = new Properties.String(NAME)
wenzelm@42136
    41
wenzelm@29184
    42
  val KIND = "kind"
wenzelm@43780
    43
  val Kind = new Properties.String(KIND)
wenzelm@29184
    44
wenzelm@60744
    45
  val SERIAL = "serial"
wenzelm@60744
    46
  val Serial = new Properties.Long(SERIAL)
wenzelm@60744
    47
wenzelm@52854
    48
  val INSTANCE = "instance"
wenzelm@52854
    49
  val Instance = new Properties.String(INSTANCE)
wenzelm@52854
    50
wenzelm@29184
    51
wenzelm@50201
    52
  /* basic markup */
wenzelm@29184
    53
wenzelm@45666
    54
  val Empty = Markup("", Nil)
wenzelm@45666
    55
  val Broken = Markup("broken", Nil)
wenzelm@50201
    56
wenzelm@55551
    57
  class Markup_String(val name: String, prop: String)
wenzelm@55551
    58
  {
wenzelm@55551
    59
    private val Prop = new Properties.String(prop)
wenzelm@55551
    60
wenzelm@55551
    61
    def apply(s: String): Markup = Markup(name, Prop(s))
wenzelm@55551
    62
    def unapply(markup: Markup): Option[String] =
wenzelm@55551
    63
      if (markup.name == name) Prop.unapply(markup.properties) else None
wenzelm@55551
    64
  }
wenzelm@55551
    65
wenzelm@55551
    66
  class Markup_Int(val name: String, prop: String)
wenzelm@55551
    67
  {
wenzelm@55551
    68
    private val Prop = new Properties.Int(prop)
wenzelm@55551
    69
wenzelm@55551
    70
    def apply(i: Int): Markup = Markup(name, Prop(i))
wenzelm@55551
    71
    def unapply(markup: Markup): Option[Int] =
wenzelm@55551
    72
      if (markup.name == name) Prop.unapply(markup.properties) else None
wenzelm@55551
    73
  }
wenzelm@55551
    74
wenzelm@60744
    75
  class Markup_Long(val name: String, prop: String)
wenzelm@60744
    76
  {
wenzelm@60744
    77
    private val Prop = new Properties.Long(prop)
wenzelm@60744
    78
wenzelm@60744
    79
    def apply(i: Long): Markup = Markup(name, Prop(i))
wenzelm@60744
    80
    def unapply(markup: Markup): Option[Long] =
wenzelm@60744
    81
      if (markup.name == name) Prop.unapply(markup.properties) else None
wenzelm@60744
    82
  }
wenzelm@60744
    83
wenzelm@50201
    84
wenzelm@50201
    85
  /* formal entities */
wenzelm@50201
    86
wenzelm@50201
    87
  val BINDING = "binding"
wenzelm@50201
    88
  val ENTITY = "entity"
wenzelm@50201
    89
  val DEF = "def"
wenzelm@50201
    90
  val REF = "ref"
wenzelm@50201
    91
wenzelm@50201
    92
  object Entity
wenzelm@50201
    93
  {
wenzelm@50201
    94
    def unapply(markup: Markup): Option[(String, String)] =
wenzelm@50201
    95
      markup match {
wenzelm@55551
    96
        case Markup(ENTITY, props) =>
wenzelm@55551
    97
          (props, props) match {
wenzelm@55615
    98
            case (Kind(kind), Name(name)) => Some((kind, name))
wenzelm@50201
    99
            case _ => None
wenzelm@50201
   100
          }
wenzelm@50201
   101
        case _ => None
wenzelm@50201
   102
      }
wenzelm@50201
   103
  }
wenzelm@50201
   104
wenzelm@50201
   105
wenzelm@55672
   106
  /* completion */
wenzelm@55672
   107
wenzelm@55672
   108
  val COMPLETION = "completion"
wenzelm@55914
   109
  val NO_COMPLETION = "no_completion"
wenzelm@55672
   110
wenzelm@55672
   111
wenzelm@50201
   112
  /* position */
wenzelm@50201
   113
wenzelm@50201
   114
  val LINE = "line"
wenzelm@58978
   115
  val END_LINE = "line"
wenzelm@50201
   116
  val OFFSET = "offset"
wenzelm@50201
   117
  val END_OFFSET = "end_offset"
wenzelm@50201
   118
  val FILE = "file"
wenzelm@50201
   119
  val ID = "id"
wenzelm@50201
   120
wenzelm@50201
   121
  val DEF_LINE = "def_line"
wenzelm@50201
   122
  val DEF_OFFSET = "def_offset"
wenzelm@50201
   123
  val DEF_END_OFFSET = "def_end_offset"
wenzelm@50201
   124
  val DEF_FILE = "def_file"
wenzelm@50201
   125
  val DEF_ID = "def_id"
wenzelm@50201
   126
wenzelm@50201
   127
  val POSITION_PROPERTIES = Set(LINE, OFFSET, END_OFFSET, FILE, ID)
wenzelm@50201
   128
  val POSITION = "position"
wenzelm@50201
   129
wenzelm@50201
   130
wenzelm@58464
   131
  /* expression */
wenzelm@58464
   132
wenzelm@58464
   133
  val EXPRESSION = "expression"
wenzelm@58464
   134
wenzelm@58464
   135
wenzelm@58544
   136
  /* citation */
wenzelm@58544
   137
wenzelm@58544
   138
  val CITATION = "citation"
wenzelm@58545
   139
  val Citation = new Markup_String(CITATION, NAME)
wenzelm@58544
   140
wenzelm@58544
   141
wenzelm@55550
   142
  /* embedded languages */
wenzelm@55550
   143
wenzelm@55666
   144
  val Symbols = new Properties.Boolean("symbols")
wenzelm@55666
   145
  val Antiquotes = new Properties.Boolean("antiquotes")
wenzelm@55828
   146
  val Delimited = new Properties.Boolean("delimited")
wenzelm@55615
   147
wenzelm@55550
   148
  val LANGUAGE = "language"
wenzelm@55615
   149
  object Language
wenzelm@55615
   150
  {
wenzelm@55616
   151
    val ML = "ML"
wenzelm@56278
   152
    val SML = "SML"
wenzelm@56843
   153
    val PATH = "path"
wenzelm@55616
   154
    val UNKNOWN = "unknown"
wenzelm@55616
   155
wenzelm@55828
   156
    def unapply(markup: Markup): Option[(String, Boolean, Boolean, Boolean)] =
wenzelm@55615
   157
      markup match {
wenzelm@55615
   158
        case Markup(LANGUAGE, props) =>
wenzelm@55828
   159
          (props, props, props, props) match {
wenzelm@55828
   160
            case (Name(name), Symbols(symbols), Antiquotes(antiquotes), Delimited(delimited)) =>
wenzelm@55828
   161
              Some((name, symbols, antiquotes, delimited))
wenzelm@55615
   162
            case _ => None
wenzelm@55615
   163
          }
wenzelm@55615
   164
        case _ => None
wenzelm@55615
   165
      }
wenzelm@55615
   166
  }
wenzelm@55550
   167
wenzelm@55550
   168
wenzelm@54702
   169
  /* external resources */
wenzelm@50201
   170
wenzelm@50201
   171
  val PATH = "path"
wenzelm@55551
   172
  val Path = new Markup_String(PATH, NAME)
wenzelm@50201
   173
wenzelm@54702
   174
  val URL = "url"
wenzelm@55551
   175
  val Url = new Markup_String(URL, NAME)
wenzelm@54702
   176
wenzelm@50201
   177
wenzelm@50201
   178
  /* pretty printing */
wenzelm@50201
   179
wenzelm@55551
   180
  val Block = new Markup_Int("block", "indent")
wenzelm@55551
   181
  val Break = new Markup_Int("break", "width")
wenzelm@50201
   182
wenzelm@51570
   183
  val ITEM = "item"
wenzelm@51574
   184
  val BULLET = "bullet"
wenzelm@51570
   185
wenzelm@50201
   186
  val SEPARATOR = "separator"
wenzelm@50201
   187
wenzelm@50201
   188
wenzelm@56548
   189
  /* text properties */
wenzelm@56548
   190
wenzelm@56548
   191
  val WORDS = "words"
wenzelm@50201
   192
wenzelm@50201
   193
  val HIDDEN = "hidden"
wenzelm@50201
   194
wenzelm@50201
   195
wenzelm@58048
   196
  /* misc entities */
wenzelm@50201
   197
wenzelm@50201
   198
  val CLASS = "class"
wenzelm@50201
   199
  val TYPE_NAME = "type_name"
wenzelm@50201
   200
  val FIXED = "fixed"
wenzelm@53378
   201
  val CASE = "case"
wenzelm@50201
   202
  val CONSTANT = "constant"
wenzelm@50201
   203
  val DYNAMIC_FACT = "dynamic_fact"
wenzelm@50201
   204
wenzelm@50201
   205
wenzelm@50201
   206
  /* inner syntax */
wenzelm@50201
   207
wenzelm@50201
   208
  val TFREE = "tfree"
wenzelm@50201
   209
  val TVAR = "tvar"
wenzelm@50201
   210
  val FREE = "free"
wenzelm@50201
   211
  val SKOLEM = "skolem"
wenzelm@50201
   212
  val BOUND = "bound"
wenzelm@50201
   213
  val VAR = "var"
wenzelm@50201
   214
  val NUMERAL = "numeral"
wenzelm@50201
   215
  val LITERAL = "literal"
wenzelm@50201
   216
  val DELIMITER = "delimiter"
wenzelm@50201
   217
  val INNER_STRING = "inner_string"
wenzelm@55033
   218
  val INNER_CARTOUCHE = "inner_cartouche"
wenzelm@50201
   219
  val INNER_COMMENT = "inner_comment"
wenzelm@50201
   220
wenzelm@50201
   221
  val TOKEN_RANGE = "token_range"
wenzelm@50201
   222
wenzelm@50201
   223
  val SORTING = "sorting"
wenzelm@50201
   224
  val TYPING = "typing"
wenzelm@50201
   225
wenzelm@50201
   226
  val ATTRIBUTE = "attribute"
wenzelm@50201
   227
  val METHOD = "method"
wenzelm@50201
   228
wenzelm@50201
   229
wenzelm@55550
   230
  /* antiquotations */
wenzelm@50201
   231
wenzelm@55526
   232
  val ANTIQUOTED = "antiquoted"
wenzelm@55526
   233
  val ANTIQUOTE = "antiquote"
wenzelm@55526
   234
wenzelm@50201
   235
  val ML_ANTIQUOTATION = "ML_antiquotation"
wenzelm@50201
   236
  val DOCUMENT_ANTIQUOTATION = "document_antiquotation"
wenzelm@50201
   237
  val DOCUMENT_ANTIQUOTATION_OPTION = "document_antiquotation_option"
wenzelm@50201
   238
wenzelm@50201
   239
wenzelm@50201
   240
  /* text structure */
wenzelm@50201
   241
wenzelm@50201
   242
  val PARAGRAPH = "paragraph"
wenzelm@50545
   243
  val TEXT_FOLD = "text_fold"
wenzelm@50201
   244
wenzelm@50201
   245
wenzelm@60744
   246
  /* ML */
wenzelm@50201
   247
wenzelm@55505
   248
  val ML_KEYWORD1 = "ML_keyword1"
wenzelm@55505
   249
  val ML_KEYWORD2 = "ML_keyword2"
wenzelm@55505
   250
  val ML_KEYWORD3 = "ML_keyword3"
wenzelm@50201
   251
  val ML_DELIMITER = "ML_delimiter"
wenzelm@50201
   252
  val ML_TVAR = "ML_tvar"
wenzelm@50201
   253
  val ML_NUMERAL = "ML_numeral"
wenzelm@50201
   254
  val ML_CHAR = "ML_char"
wenzelm@50201
   255
  val ML_STRING = "ML_string"
wenzelm@59112
   256
  val ML_CARTOUCHE = "ML_cartouche"
wenzelm@50201
   257
  val ML_COMMENT = "ML_comment"
wenzelm@56278
   258
  val SML_STRING = "SML_string"
wenzelm@56278
   259
  val SML_COMMENT = "SML_comment"
wenzelm@50201
   260
wenzelm@50201
   261
  val ML_DEF = "ML_def"
wenzelm@50201
   262
  val ML_OPEN = "ML_open"
wenzelm@55837
   263
  val ML_STRUCTURE = "ML_structure"
wenzelm@50201
   264
  val ML_TYPING = "ML_typing"
wenzelm@50201
   265
wenzelm@60744
   266
  val ML_BREAKPOINT = "ML_breakpoint"
wenzelm@60744
   267
wenzelm@50201
   268
wenzelm@50201
   269
  /* outer syntax */
wenzelm@50201
   270
wenzelm@55744
   271
  val COMMAND = "command"
wenzelm@55744
   272
  val KEYWORD1 = "keyword1"
wenzelm@55744
   273
  val KEYWORD2 = "keyword2"
wenzelm@55765
   274
  val KEYWORD3 = "keyword3"
wenzelm@55919
   275
  val QUASI_KEYWORD = "quasi_keyword"
wenzelm@56202
   276
  val IMPROPER = "improper"
wenzelm@50201
   277
  val OPERATOR = "operator"
wenzelm@50201
   278
  val STRING = "string"
wenzelm@59081
   279
  val ALT_STRING = "alt_string"
wenzelm@50201
   280
  val VERBATIM = "verbatim"
wenzelm@55033
   281
  val CARTOUCHE = "cartouche"
wenzelm@50201
   282
  val COMMENT = "comment"
wenzelm@50201
   283
wenzelm@50201
   284
wenzelm@50201
   285
  /* timing */
wenzelm@50201
   286
wenzelm@50781
   287
  val Elapsed = new Properties.Double("elapsed")
wenzelm@50781
   288
  val CPU = new Properties.Double("cpu")
wenzelm@50781
   289
  val GC = new Properties.Double("gc")
wenzelm@50781
   290
wenzelm@50781
   291
  object Timing_Properties
wenzelm@50781
   292
  {
wenzelm@50781
   293
    def apply(timing: isabelle.Timing): Properties.T =
wenzelm@50781
   294
      Elapsed(timing.elapsed.seconds) ::: CPU(timing.cpu.seconds) ::: GC(timing.gc.seconds)
wenzelm@51662
   295
wenzelm@50781
   296
    def unapply(props: Properties.T): Option[isabelle.Timing] =
wenzelm@50781
   297
      (props, props, props) match {
wenzelm@50781
   298
        case (Elapsed(elapsed), CPU(cpu), GC(gc)) =>
wenzelm@50781
   299
          Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc)))
wenzelm@50781
   300
        case _ => None
wenzelm@50781
   301
      }
wenzelm@50781
   302
  }
wenzelm@50781
   303
wenzelm@50201
   304
  val TIMING = "timing"
wenzelm@50201
   305
wenzelm@50201
   306
  object Timing
wenzelm@50201
   307
  {
wenzelm@50781
   308
    def apply(timing: isabelle.Timing): Markup = Markup(TIMING, Timing_Properties(timing))
wenzelm@51662
   309
wenzelm@50201
   310
    def unapply(markup: Markup): Option[isabelle.Timing] =
wenzelm@50201
   311
      markup match {
wenzelm@50781
   312
        case Markup(TIMING, Timing_Properties(timing)) => Some(timing)
wenzelm@50201
   313
        case _ => None
wenzelm@50201
   314
      }
wenzelm@50201
   315
  }
wenzelm@50201
   316
wenzelm@50201
   317
wenzelm@51662
   318
  /* command timing */
wenzelm@51662
   319
wenzelm@51818
   320
  val COMMAND_TIMING = "command_timing"
wenzelm@51662
   321
wenzelm@51662
   322
wenzelm@50201
   323
  /* toplevel */
wenzelm@50201
   324
wenzelm@50201
   325
  val SUBGOALS = "subgoals"
wenzelm@50201
   326
  val PROOF_STATE = "proof_state"
wenzelm@50201
   327
wenzelm@50543
   328
  val GOAL = "goal"
wenzelm@50201
   329
  val SUBGOAL = "subgoal"
wenzelm@50215
   330
wenzelm@50450
   331
wenzelm@50201
   332
  /* command status */
wenzelm@50201
   333
wenzelm@50201
   334
  val TASK = "task"
wenzelm@50201
   335
wenzelm@50201
   336
  val ACCEPTED = "accepted"
wenzelm@50201
   337
  val FORKED = "forked"
wenzelm@50201
   338
  val JOINED = "joined"
wenzelm@50201
   339
  val RUNNING = "running"
wenzelm@50201
   340
  val FINISHED = "finished"
wenzelm@50201
   341
  val FAILED = "failed"
wenzelm@50201
   342
wenzelm@50201
   343
wenzelm@50201
   344
  /* interactive documents */
wenzelm@50201
   345
wenzelm@50201
   346
  val VERSION = "version"
wenzelm@50201
   347
  val ASSIGN = "assign"
wenzelm@50201
   348
wenzelm@50201
   349
wenzelm@50201
   350
  /* prover process */
wenzelm@50201
   351
wenzelm@50201
   352
  val PROVER_COMMAND = "prover_command"
wenzelm@50201
   353
  val PROVER_ARG = "prover_arg"
wenzelm@50201
   354
wenzelm@50201
   355
wenzelm@50201
   356
  /* messages */
wenzelm@50201
   357
wenzelm@50201
   358
  val INIT = "init"
wenzelm@50201
   359
  val STATUS = "status"
wenzelm@50201
   360
  val REPORT = "report"
wenzelm@50500
   361
  val RESULT = "result"
wenzelm@50201
   362
  val WRITELN = "writeln"
wenzelm@59184
   363
  val STATE = "state"
wenzelm@59184
   364
  val INFORMATION = "information"
wenzelm@50201
   365
  val TRACING = "tracing"
wenzelm@50201
   366
  val WARNING = "warning"
wenzelm@59203
   367
  val LEGACY = "legacy"
wenzelm@50201
   368
  val ERROR = "error"
wenzelm@50201
   369
  val PROTOCOL = "protocol"
wenzelm@50201
   370
  val SYSTEM = "system"
wenzelm@50201
   371
  val STDOUT = "stdout"
wenzelm@50201
   372
  val STDERR = "stderr"
wenzelm@50201
   373
  val EXIT = "exit"
wenzelm@50201
   374
wenzelm@50201
   375
  val WRITELN_MESSAGE = "writeln_message"
wenzelm@59184
   376
  val STATE_MESSAGE = "state_message"
wenzelm@59184
   377
  val INFORMATION_MESSAGE = "information_message"
wenzelm@50201
   378
  val TRACING_MESSAGE = "tracing_message"
wenzelm@50201
   379
  val WARNING_MESSAGE = "warning_message"
wenzelm@59203
   380
  val LEGACY_MESSAGE = "legacy_message"
wenzelm@50201
   381
  val ERROR_MESSAGE = "error_message"
wenzelm@50201
   382
wenzelm@59184
   383
  val messages = Map(
wenzelm@59184
   384
    WRITELN -> WRITELN_MESSAGE,
wenzelm@59184
   385
    STATE -> STATE_MESSAGE,
wenzelm@59184
   386
    INFORMATION -> INFORMATION_MESSAGE,
wenzelm@59184
   387
    TRACING -> TRACING_MESSAGE,
wenzelm@59184
   388
    WARNING -> WARNING_MESSAGE,
wenzelm@59203
   389
    LEGACY -> LEGACY_MESSAGE,
wenzelm@59184
   390
    ERROR -> ERROR_MESSAGE)
wenzelm@59184
   391
wenzelm@52876
   392
  val message: String => String = messages.withDefault((s: String) => s)
wenzelm@50201
   393
wenzelm@50201
   394
  val Return_Code = new Properties.Int("return_code")
wenzelm@50201
   395
wenzelm@50201
   396
  val NO_REPORT = "no_report"
wenzelm@50201
   397
wenzelm@50201
   398
  val BAD = "bad"
wenzelm@50201
   399
wenzelm@50500
   400
  val INTENSIFY = "intensify"
wenzelm@50500
   401
wenzelm@50500
   402
wenzelm@50500
   403
  /* active areas */
wenzelm@50500
   404
wenzelm@50715
   405
  val BROWSER = "browser"
wenzelm@50500
   406
  val GRAPHVIEW = "graphview"
wenzelm@50500
   407
wenzelm@50500
   408
  val SENDBACK = "sendback"
wenzelm@50500
   409
  val PADDING = "padding"
wenzelm@52697
   410
  val PADDING_LINE = (PADDING, "line")
wenzelm@52697
   411
  val PADDING_COMMAND = (PADDING, "command")
wenzelm@50500
   412
wenzelm@50500
   413
  val DIALOG = "dialog"
wenzelm@50503
   414
  val Result = new Properties.String(RESULT)
wenzelm@50500
   415
wenzelm@50201
   416
wenzelm@50201
   417
  /* protocol message functions */
wenzelm@50201
   418
wenzelm@50201
   419
  val FUNCTION = "function"
wenzelm@50201
   420
  val Function = new Properties.String(FUNCTION)
wenzelm@50201
   421
wenzelm@52563
   422
  val Assign_Update: Properties.T = List((FUNCTION, "assign_update"))
wenzelm@50201
   423
  val Removed_Versions: Properties.T = List((FUNCTION, "removed_versions"))
wenzelm@50201
   424
wenzelm@52111
   425
  object Protocol_Handler
wenzelm@52111
   426
  {
wenzelm@52111
   427
    def unapply(props: Properties.T): Option[(String)] =
wenzelm@52111
   428
      props match {
wenzelm@52111
   429
        case List((FUNCTION, "protocol_handler"), (NAME, name)) => Some(name)
wenzelm@52111
   430
        case _ => None
wenzelm@52111
   431
      }
wenzelm@52111
   432
  }
wenzelm@52111
   433
wenzelm@52111
   434
  val INVOKE_SCALA = "invoke_scala"
wenzelm@50201
   435
  object Invoke_Scala
wenzelm@50201
   436
  {
wenzelm@50201
   437
    def unapply(props: Properties.T): Option[(String, String)] =
wenzelm@50201
   438
      props match {
wenzelm@52111
   439
        case List((FUNCTION, INVOKE_SCALA), (NAME, name), (ID, id)) => Some((name, id))
wenzelm@50201
   440
        case _ => None
wenzelm@50201
   441
      }
wenzelm@50201
   442
  }
wenzelm@52111
   443
wenzelm@52111
   444
  val CANCEL_SCALA = "cancel_scala"
wenzelm@50201
   445
  object Cancel_Scala
wenzelm@50201
   446
  {
wenzelm@50201
   447
    def unapply(props: Properties.T): Option[String] =
wenzelm@50201
   448
      props match {
wenzelm@52111
   449
        case List((FUNCTION, CANCEL_SCALA), (ID, id)) => Some(id)
wenzelm@50201
   450
        case _ => None
wenzelm@50201
   451
      }
wenzelm@50201
   452
  }
wenzelm@50255
   453
wenzelm@50255
   454
  object ML_Statistics
wenzelm@50255
   455
  {
wenzelm@50255
   456
    def unapply(props: Properties.T): Option[Properties.T] =
wenzelm@50255
   457
      props match {
wenzelm@50255
   458
        case (FUNCTION, "ML_statistics") :: stats => Some(stats)
wenzelm@50255
   459
        case _ => None
wenzelm@50255
   460
      }
wenzelm@50255
   461
  }
wenzelm@50975
   462
wenzelm@50975
   463
  object Task_Statistics
wenzelm@50975
   464
  {
wenzelm@50975
   465
    def unapply(props: Properties.T): Option[Properties.T] =
wenzelm@50975
   466
      props match {
wenzelm@50975
   467
        case (FUNCTION, "task_statistics") :: stats => Some(stats)
wenzelm@50975
   468
        case _ => None
wenzelm@50975
   469
      }
wenzelm@50975
   470
  }
lars@55316
   471
wenzelm@59367
   472
  val LOADING_THEORY = "loading_theory"
wenzelm@56616
   473
  object Loading_Theory
wenzelm@56616
   474
  {
wenzelm@56616
   475
    def unapply(props: Properties.T): Option[String] =
wenzelm@56616
   476
      props match {
wenzelm@59367
   477
        case List((FUNCTION, LOADING_THEORY), (NAME, name)) => Some(name)
wenzelm@56616
   478
        case _ => None
wenzelm@56616
   479
      }
wenzelm@56616
   480
  }
wenzelm@56616
   481
wenzelm@59366
   482
  val BUILD_THEORIES_RESULT = "build_theories_result"
wenzelm@59364
   483
  object Build_Theories_Result
wenzelm@56616
   484
  {
wenzelm@59369
   485
    def unapply(props: Properties.T): Option[String] =
wenzelm@56616
   486
      props match {
wenzelm@60831
   487
        case List((FUNCTION, BUILD_THEORIES_RESULT), (ID, id)) => Some(id)
wenzelm@56616
   488
        case _ => None
wenzelm@56616
   489
      }
wenzelm@56616
   490
  }
wenzelm@56616
   491
wenzelm@56864
   492
  val PRINT_OPERATIONS = "print_operations"
wenzelm@56864
   493
wenzelm@55553
   494
wenzelm@60830
   495
  /* debugger output */
wenzelm@60830
   496
wenzelm@60842
   497
  val DEBUGGER_STATE = "debugger_state"
wenzelm@60842
   498
  object Debugger_State
wenzelm@60842
   499
  {
wenzelm@60842
   500
    def unapply(props: Properties.T): Option[String] =
wenzelm@60842
   501
      props match {
wenzelm@60842
   502
        case List((FUNCTION, DEBUGGER_STATE), (NAME, name)) => Some(name)
wenzelm@60842
   503
        case _ => None
wenzelm@60842
   504
      }
wenzelm@60842
   505
  }
wenzelm@60842
   506
wenzelm@60830
   507
  val DEBUGGER_OUTPUT = "debugger_output"
wenzelm@60830
   508
  object Debugger_Output
wenzelm@60830
   509
  {
wenzelm@60834
   510
    def unapply(props: Properties.T): Option[String] =
wenzelm@60830
   511
      props match {
wenzelm@60834
   512
        case List((FUNCTION, DEBUGGER_OUTPUT), (NAME, name)) => Some(name)
wenzelm@60830
   513
        case _ => None
wenzelm@60830
   514
      }
wenzelm@60830
   515
  }
wenzelm@60830
   516
wenzelm@60830
   517
lars@55316
   518
  /* simplifier trace */
lars@55316
   519
wenzelm@57594
   520
  val SIMP_TRACE_PANEL = "simp_trace_panel"
lars@55316
   521
wenzelm@55553
   522
  val SIMP_TRACE_LOG = "simp_trace_log"
wenzelm@55553
   523
  val SIMP_TRACE_STEP = "simp_trace_step"
wenzelm@55553
   524
  val SIMP_TRACE_RECURSE = "simp_trace_recurse"
wenzelm@55553
   525
  val SIMP_TRACE_HINT = "simp_trace_hint"
wenzelm@55553
   526
  val SIMP_TRACE_IGNORE = "simp_trace_ignore"
lars@55316
   527
wenzelm@55553
   528
  val SIMP_TRACE_CANCEL = "simp_trace_cancel"
wenzelm@55553
   529
  object Simp_Trace_Cancel
lars@55316
   530
  {
lars@55316
   531
    def unapply(props: Properties.T): Option[Long] =
lars@55316
   532
      props match {
wenzelm@55553
   533
        case (FUNCTION, SIMP_TRACE_CANCEL) :: Serial(i) => Some(i)
lars@55316
   534
        case _ => None
lars@55316
   535
      }
lars@55316
   536
  }
wenzelm@45666
   537
}
wenzelm@43721
   538
wenzelm@43721
   539
wenzelm@45666
   540
sealed case class Markup(name: String, properties: Properties.T)
wenzelm@59707
   541
{
wenzelm@59707
   542
  def markup(s: String): String =
wenzelm@59707
   543
    YXML.string_of_tree(XML.Elem(this, List(XML.Text(s))))
wenzelm@59707
   544
}