src/Pure/PIDE/markup.scala
author wenzelm
Thu Oct 15 15:06:03 2015 +0200 (2015-10-15 ago)
changeset 61449 4f31f79cf2d1
parent 60882 45bfd18835f1
child 61598 ed4dad8823a4
permissions -rw-r--r--
report Markdown document structure;
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@55553
    57
  class Markup_String(val name: String, prop: String)
wenzelm@55553
    58
  {
wenzelm@55553
    59
    private val Prop = new Properties.String(prop)
wenzelm@55553
    60
wenzelm@55553
    61
    def apply(s: String): Markup = Markup(name, Prop(s))
wenzelm@55553
    62
    def unapply(markup: Markup): Option[String] =
wenzelm@55553
    63
      if (markup.name == name) Prop.unapply(markup.properties) else None
wenzelm@55553
    64
  }
wenzelm@55553
    65
wenzelm@55553
    66
  class Markup_Int(val name: String, prop: String)
wenzelm@55553
    67
  {
wenzelm@55553
    68
    private val Prop = new Properties.Int(prop)
wenzelm@55553
    69
wenzelm@55553
    70
    def apply(i: Int): Markup = Markup(name, Prop(i))
wenzelm@55553
    71
    def unapply(markup: Markup): Option[Int] =
wenzelm@55553
    72
      if (markup.name == name) Prop.unapply(markup.properties) else None
wenzelm@55553
    73
  }
wenzelm@55553
    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@55553
    96
        case Markup(ENTITY, props) =>
wenzelm@55553
    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@55552
   142
  /* embedded languages */
wenzelm@55552
   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@55552
   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@55552
   167
wenzelm@55552
   168
wenzelm@54702
   169
  /* external resources */
wenzelm@50201
   170
wenzelm@50201
   171
  val PATH = "path"
wenzelm@55553
   172
  val Path = new Markup_String(PATH, NAME)
wenzelm@50201
   173
wenzelm@54702
   174
  val URL = "url"
wenzelm@55553
   175
  val Url = new Markup_String(URL, NAME)
wenzelm@54702
   176
wenzelm@50201
   177
wenzelm@50201
   178
  /* pretty printing */
wenzelm@50201
   179
wenzelm@55553
   180
  val Block = new Markup_Int("block", "indent")
wenzelm@55553
   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@55552
   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@61449
   246
  /* Markdown document structure */
wenzelm@61449
   247
wenzelm@61449
   248
  val MARKDOWN_PARAGRAPH = "markdown_paragraph"
wenzelm@61449
   249
  val Markdown_List = new Markup_String("markdown_list", "kind")
wenzelm@61449
   250
  val Markdown_Item = new Markup_Int("markdown_item", "depth")
wenzelm@61449
   251
wenzelm@61449
   252
wenzelm@60744
   253
  /* ML */
wenzelm@50201
   254
wenzelm@55505
   255
  val ML_KEYWORD1 = "ML_keyword1"
wenzelm@55505
   256
  val ML_KEYWORD2 = "ML_keyword2"
wenzelm@55505
   257
  val ML_KEYWORD3 = "ML_keyword3"
wenzelm@50201
   258
  val ML_DELIMITER = "ML_delimiter"
wenzelm@50201
   259
  val ML_TVAR = "ML_tvar"
wenzelm@50201
   260
  val ML_NUMERAL = "ML_numeral"
wenzelm@50201
   261
  val ML_CHAR = "ML_char"
wenzelm@50201
   262
  val ML_STRING = "ML_string"
wenzelm@59112
   263
  val ML_CARTOUCHE = "ML_cartouche"
wenzelm@50201
   264
  val ML_COMMENT = "ML_comment"
wenzelm@56278
   265
  val SML_STRING = "SML_string"
wenzelm@56278
   266
  val SML_COMMENT = "SML_comment"
wenzelm@50201
   267
wenzelm@50201
   268
  val ML_DEF = "ML_def"
wenzelm@50201
   269
  val ML_OPEN = "ML_open"
wenzelm@55837
   270
  val ML_STRUCTURE = "ML_structure"
wenzelm@50201
   271
  val ML_TYPING = "ML_typing"
wenzelm@50201
   272
wenzelm@60744
   273
  val ML_BREAKPOINT = "ML_breakpoint"
wenzelm@60744
   274
wenzelm@50201
   275
wenzelm@50201
   276
  /* outer syntax */
wenzelm@50201
   277
wenzelm@55744
   278
  val COMMAND = "command"
wenzelm@55744
   279
  val KEYWORD1 = "keyword1"
wenzelm@55744
   280
  val KEYWORD2 = "keyword2"
wenzelm@55765
   281
  val KEYWORD3 = "keyword3"
wenzelm@55919
   282
  val QUASI_KEYWORD = "quasi_keyword"
wenzelm@56202
   283
  val IMPROPER = "improper"
wenzelm@50201
   284
  val OPERATOR = "operator"
wenzelm@50201
   285
  val STRING = "string"
wenzelm@59081
   286
  val ALT_STRING = "alt_string"
wenzelm@50201
   287
  val VERBATIM = "verbatim"
wenzelm@55033
   288
  val CARTOUCHE = "cartouche"
wenzelm@50201
   289
  val COMMENT = "comment"
wenzelm@50201
   290
wenzelm@50201
   291
wenzelm@50201
   292
  /* timing */
wenzelm@50201
   293
wenzelm@50781
   294
  val Elapsed = new Properties.Double("elapsed")
wenzelm@50781
   295
  val CPU = new Properties.Double("cpu")
wenzelm@50781
   296
  val GC = new Properties.Double("gc")
wenzelm@50781
   297
wenzelm@50781
   298
  object Timing_Properties
wenzelm@50781
   299
  {
wenzelm@50781
   300
    def apply(timing: isabelle.Timing): Properties.T =
wenzelm@50781
   301
      Elapsed(timing.elapsed.seconds) ::: CPU(timing.cpu.seconds) ::: GC(timing.gc.seconds)
wenzelm@51662
   302
wenzelm@50781
   303
    def unapply(props: Properties.T): Option[isabelle.Timing] =
wenzelm@50781
   304
      (props, props, props) match {
wenzelm@50781
   305
        case (Elapsed(elapsed), CPU(cpu), GC(gc)) =>
wenzelm@50781
   306
          Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc)))
wenzelm@50781
   307
        case _ => None
wenzelm@50781
   308
      }
wenzelm@50781
   309
  }
wenzelm@50781
   310
wenzelm@50201
   311
  val TIMING = "timing"
wenzelm@50201
   312
wenzelm@50201
   313
  object Timing
wenzelm@50201
   314
  {
wenzelm@50781
   315
    def apply(timing: isabelle.Timing): Markup = Markup(TIMING, Timing_Properties(timing))
wenzelm@51662
   316
wenzelm@50201
   317
    def unapply(markup: Markup): Option[isabelle.Timing] =
wenzelm@50201
   318
      markup match {
wenzelm@50781
   319
        case Markup(TIMING, Timing_Properties(timing)) => Some(timing)
wenzelm@50201
   320
        case _ => None
wenzelm@50201
   321
      }
wenzelm@50201
   322
  }
wenzelm@50201
   323
wenzelm@50201
   324
wenzelm@51662
   325
  /* command timing */
wenzelm@51662
   326
wenzelm@51818
   327
  val COMMAND_TIMING = "command_timing"
wenzelm@51662
   328
wenzelm@51662
   329
wenzelm@50201
   330
  /* toplevel */
wenzelm@50201
   331
wenzelm@50201
   332
  val SUBGOALS = "subgoals"
wenzelm@50201
   333
  val PROOF_STATE = "proof_state"
wenzelm@50201
   334
wenzelm@50543
   335
  val GOAL = "goal"
wenzelm@50201
   336
  val SUBGOAL = "subgoal"
wenzelm@50215
   337
wenzelm@50450
   338
wenzelm@50201
   339
  /* command status */
wenzelm@50201
   340
wenzelm@50201
   341
  val TASK = "task"
wenzelm@50201
   342
wenzelm@50201
   343
  val ACCEPTED = "accepted"
wenzelm@50201
   344
  val FORKED = "forked"
wenzelm@50201
   345
  val JOINED = "joined"
wenzelm@50201
   346
  val RUNNING = "running"
wenzelm@50201
   347
  val FINISHED = "finished"
wenzelm@50201
   348
  val FAILED = "failed"
wenzelm@50201
   349
wenzelm@50201
   350
wenzelm@50201
   351
  /* interactive documents */
wenzelm@50201
   352
wenzelm@50201
   353
  val VERSION = "version"
wenzelm@50201
   354
  val ASSIGN = "assign"
wenzelm@50201
   355
wenzelm@50201
   356
wenzelm@50201
   357
  /* prover process */
wenzelm@50201
   358
wenzelm@50201
   359
  val PROVER_COMMAND = "prover_command"
wenzelm@50201
   360
  val PROVER_ARG = "prover_arg"
wenzelm@50201
   361
wenzelm@50201
   362
wenzelm@50201
   363
  /* messages */
wenzelm@50201
   364
wenzelm@50201
   365
  val INIT = "init"
wenzelm@50201
   366
  val STATUS = "status"
wenzelm@50201
   367
  val REPORT = "report"
wenzelm@50500
   368
  val RESULT = "result"
wenzelm@50201
   369
  val WRITELN = "writeln"
wenzelm@59184
   370
  val STATE = "state"
wenzelm@59184
   371
  val INFORMATION = "information"
wenzelm@50201
   372
  val TRACING = "tracing"
wenzelm@50201
   373
  val WARNING = "warning"
wenzelm@59203
   374
  val LEGACY = "legacy"
wenzelm@50201
   375
  val ERROR = "error"
wenzelm@50201
   376
  val PROTOCOL = "protocol"
wenzelm@50201
   377
  val SYSTEM = "system"
wenzelm@50201
   378
  val STDOUT = "stdout"
wenzelm@50201
   379
  val STDERR = "stderr"
wenzelm@50201
   380
  val EXIT = "exit"
wenzelm@50201
   381
wenzelm@50201
   382
  val WRITELN_MESSAGE = "writeln_message"
wenzelm@59184
   383
  val STATE_MESSAGE = "state_message"
wenzelm@59184
   384
  val INFORMATION_MESSAGE = "information_message"
wenzelm@50201
   385
  val TRACING_MESSAGE = "tracing_message"
wenzelm@50201
   386
  val WARNING_MESSAGE = "warning_message"
wenzelm@59203
   387
  val LEGACY_MESSAGE = "legacy_message"
wenzelm@50201
   388
  val ERROR_MESSAGE = "error_message"
wenzelm@50201
   389
wenzelm@59184
   390
  val messages = Map(
wenzelm@59184
   391
    WRITELN -> WRITELN_MESSAGE,
wenzelm@59184
   392
    STATE -> STATE_MESSAGE,
wenzelm@59184
   393
    INFORMATION -> INFORMATION_MESSAGE,
wenzelm@59184
   394
    TRACING -> TRACING_MESSAGE,
wenzelm@59184
   395
    WARNING -> WARNING_MESSAGE,
wenzelm@59203
   396
    LEGACY -> LEGACY_MESSAGE,
wenzelm@59184
   397
    ERROR -> ERROR_MESSAGE)
wenzelm@59184
   398
wenzelm@52876
   399
  val message: String => String = messages.withDefault((s: String) => s)
wenzelm@50201
   400
wenzelm@50201
   401
  val Return_Code = new Properties.Int("return_code")
wenzelm@50201
   402
wenzelm@50201
   403
  val NO_REPORT = "no_report"
wenzelm@50201
   404
wenzelm@50201
   405
  val BAD = "bad"
wenzelm@50201
   406
wenzelm@50500
   407
  val INTENSIFY = "intensify"
wenzelm@50500
   408
wenzelm@50500
   409
wenzelm@50500
   410
  /* active areas */
wenzelm@50500
   411
wenzelm@50715
   412
  val BROWSER = "browser"
wenzelm@50500
   413
  val GRAPHVIEW = "graphview"
wenzelm@50500
   414
wenzelm@50500
   415
  val SENDBACK = "sendback"
wenzelm@50500
   416
  val PADDING = "padding"
wenzelm@52697
   417
  val PADDING_LINE = (PADDING, "line")
wenzelm@52697
   418
  val PADDING_COMMAND = (PADDING, "command")
wenzelm@50500
   419
wenzelm@50500
   420
  val DIALOG = "dialog"
wenzelm@50503
   421
  val Result = new Properties.String(RESULT)
wenzelm@50500
   422
wenzelm@50201
   423
wenzelm@50201
   424
  /* protocol message functions */
wenzelm@50201
   425
wenzelm@50201
   426
  val FUNCTION = "function"
wenzelm@50201
   427
  val Function = new Properties.String(FUNCTION)
wenzelm@50201
   428
wenzelm@52563
   429
  val Assign_Update: Properties.T = List((FUNCTION, "assign_update"))
wenzelm@50201
   430
  val Removed_Versions: Properties.T = List((FUNCTION, "removed_versions"))
wenzelm@50201
   431
wenzelm@52111
   432
  object Protocol_Handler
wenzelm@52111
   433
  {
wenzelm@52111
   434
    def unapply(props: Properties.T): Option[(String)] =
wenzelm@52111
   435
      props match {
wenzelm@52111
   436
        case List((FUNCTION, "protocol_handler"), (NAME, name)) => Some(name)
wenzelm@52111
   437
        case _ => None
wenzelm@52111
   438
      }
wenzelm@52111
   439
  }
wenzelm@52111
   440
wenzelm@52111
   441
  val INVOKE_SCALA = "invoke_scala"
wenzelm@50201
   442
  object Invoke_Scala
wenzelm@50201
   443
  {
wenzelm@50201
   444
    def unapply(props: Properties.T): Option[(String, String)] =
wenzelm@50201
   445
      props match {
wenzelm@52111
   446
        case List((FUNCTION, INVOKE_SCALA), (NAME, name), (ID, id)) => Some((name, id))
wenzelm@50201
   447
        case _ => None
wenzelm@50201
   448
      }
wenzelm@50201
   449
  }
wenzelm@52111
   450
wenzelm@52111
   451
  val CANCEL_SCALA = "cancel_scala"
wenzelm@50201
   452
  object Cancel_Scala
wenzelm@50201
   453
  {
wenzelm@50201
   454
    def unapply(props: Properties.T): Option[String] =
wenzelm@50201
   455
      props match {
wenzelm@52111
   456
        case List((FUNCTION, CANCEL_SCALA), (ID, id)) => Some(id)
wenzelm@50201
   457
        case _ => None
wenzelm@50201
   458
      }
wenzelm@50201
   459
  }
wenzelm@50255
   460
wenzelm@50255
   461
  object ML_Statistics
wenzelm@50255
   462
  {
wenzelm@50255
   463
    def unapply(props: Properties.T): Option[Properties.T] =
wenzelm@50255
   464
      props match {
wenzelm@50255
   465
        case (FUNCTION, "ML_statistics") :: stats => Some(stats)
wenzelm@50255
   466
        case _ => None
wenzelm@50255
   467
      }
wenzelm@50255
   468
  }
wenzelm@50975
   469
wenzelm@50975
   470
  object Task_Statistics
wenzelm@50975
   471
  {
wenzelm@50975
   472
    def unapply(props: Properties.T): Option[Properties.T] =
wenzelm@50975
   473
      props match {
wenzelm@50975
   474
        case (FUNCTION, "task_statistics") :: stats => Some(stats)
wenzelm@50975
   475
        case _ => None
wenzelm@50975
   476
      }
wenzelm@50975
   477
  }
lars@55316
   478
wenzelm@59367
   479
  val LOADING_THEORY = "loading_theory"
wenzelm@56616
   480
  object Loading_Theory
wenzelm@56616
   481
  {
wenzelm@56616
   482
    def unapply(props: Properties.T): Option[String] =
wenzelm@56616
   483
      props match {
wenzelm@59367
   484
        case List((FUNCTION, LOADING_THEORY), (NAME, name)) => Some(name)
wenzelm@56616
   485
        case _ => None
wenzelm@56616
   486
      }
wenzelm@56616
   487
  }
wenzelm@56616
   488
wenzelm@59366
   489
  val BUILD_THEORIES_RESULT = "build_theories_result"
wenzelm@59364
   490
  object Build_Theories_Result
wenzelm@56616
   491
  {
wenzelm@59369
   492
    def unapply(props: Properties.T): Option[String] =
wenzelm@56616
   493
      props match {
wenzelm@60831
   494
        case List((FUNCTION, BUILD_THEORIES_RESULT), (ID, id)) => Some(id)
wenzelm@56616
   495
        case _ => None
wenzelm@56616
   496
      }
wenzelm@56616
   497
  }
wenzelm@56616
   498
wenzelm@56864
   499
  val PRINT_OPERATIONS = "print_operations"
wenzelm@56864
   500
wenzelm@55555
   501
wenzelm@60830
   502
  /* debugger output */
wenzelm@60830
   503
wenzelm@60842
   504
  val DEBUGGER_STATE = "debugger_state"
wenzelm@60842
   505
  object Debugger_State
wenzelm@60842
   506
  {
wenzelm@60842
   507
    def unapply(props: Properties.T): Option[String] =
wenzelm@60842
   508
      props match {
wenzelm@60842
   509
        case List((FUNCTION, DEBUGGER_STATE), (NAME, name)) => Some(name)
wenzelm@60842
   510
        case _ => None
wenzelm@60842
   511
      }
wenzelm@60842
   512
  }
wenzelm@60842
   513
wenzelm@60830
   514
  val DEBUGGER_OUTPUT = "debugger_output"
wenzelm@60830
   515
  object Debugger_Output
wenzelm@60830
   516
  {
wenzelm@60834
   517
    def unapply(props: Properties.T): Option[String] =
wenzelm@60830
   518
      props match {
wenzelm@60834
   519
        case List((FUNCTION, DEBUGGER_OUTPUT), (NAME, name)) => Some(name)
wenzelm@60830
   520
        case _ => None
wenzelm@60830
   521
      }
wenzelm@60830
   522
  }
wenzelm@60830
   523
wenzelm@60830
   524
lars@55316
   525
  /* simplifier trace */
lars@55316
   526
wenzelm@57597
   527
  val SIMP_TRACE_PANEL = "simp_trace_panel"
lars@55316
   528
wenzelm@55555
   529
  val SIMP_TRACE_LOG = "simp_trace_log"
wenzelm@55555
   530
  val SIMP_TRACE_STEP = "simp_trace_step"
wenzelm@55555
   531
  val SIMP_TRACE_RECURSE = "simp_trace_recurse"
wenzelm@55555
   532
  val SIMP_TRACE_HINT = "simp_trace_hint"
wenzelm@55555
   533
  val SIMP_TRACE_IGNORE = "simp_trace_ignore"
lars@55316
   534
wenzelm@55555
   535
  val SIMP_TRACE_CANCEL = "simp_trace_cancel"
wenzelm@55555
   536
  object Simp_Trace_Cancel
lars@55316
   537
  {
lars@55316
   538
    def unapply(props: Properties.T): Option[Long] =
lars@55316
   539
      props match {
wenzelm@55555
   540
        case (FUNCTION, SIMP_TRACE_CANCEL) :: Serial(i) => Some(i)
lars@55316
   541
        case _ => None
lars@55316
   542
      }
lars@55316
   543
  }
wenzelm@45666
   544
}
wenzelm@43721
   545
wenzelm@43721
   546
wenzelm@45666
   547
sealed case class Markup(name: String, properties: Properties.T)
wenzelm@59709
   548
{
wenzelm@59709
   549
  def markup(s: String): String =
wenzelm@59709
   550
    YXML.string_of_tree(XML.Elem(this, List(XML.Text(s))))
wenzelm@59709
   551
}