src/Pure/PIDE/isabelle_markup.scala
author wenzelm
Thu Jan 05 14:15:37 2012 +0100 (2012-01-05 ago)
changeset 46121 30a69cd8a9a0
parent 45702 7df60d1aa988
child 46122 1e9ec1a44dfc
permissions -rw-r--r--
prefer raw_message for protocol implementation;
wenzelm@45670
     1
/*  Title:      Pure/PIDE/isabelle_markup.scala
wenzelm@27958
     2
    Author:     Makarius
wenzelm@27958
     3
wenzelm@45666
     4
Isabelle markup elements.
wenzelm@27958
     5
*/
wenzelm@27958
     6
wenzelm@27958
     7
package isabelle
wenzelm@27958
     8
wenzelm@27970
     9
wenzelm@45666
    10
object Isabelle_Markup
wenzelm@32450
    11
{
wenzelm@33088
    12
  /* formal entities */
wenzelm@33088
    13
wenzelm@38887
    14
  val BINDING = "binding"
wenzelm@33088
    15
  val ENTITY = "entity"
wenzelm@33088
    16
  val DEF = "def"
wenzelm@33088
    17
  val REF = "ref"
wenzelm@33088
    18
wenzelm@42202
    19
  object Entity
wenzelm@42202
    20
  {
wenzelm@42202
    21
    def unapply(markup: Markup): Option[(String, String)] =
wenzelm@42202
    22
      markup match {
wenzelm@45666
    23
        case Markup(ENTITY, props @ Markup.Kind(kind)) =>
wenzelm@42202
    24
          props match {
wenzelm@45666
    25
            case Markup.Name(name) => Some(kind, name)
wenzelm@42202
    26
            case _ => None
wenzelm@42202
    27
          }
wenzelm@42202
    28
        case _ => None
wenzelm@42202
    29
      }
wenzelm@42202
    30
  }
wenzelm@42202
    31
wenzelm@33088
    32
wenzelm@27970
    33
  /* position */
wenzelm@27970
    34
wenzelm@27970
    35
  val LINE = "line"
wenzelm@27970
    36
  val OFFSET = "offset"
wenzelm@27970
    37
  val END_OFFSET = "end_offset"
wenzelm@27970
    38
  val FILE = "file"
wenzelm@27970
    39
  val ID = "id"
wenzelm@27970
    40
wenzelm@42327
    41
  val DEF_LINE = "def_line"
wenzelm@42327
    42
  val DEF_OFFSET = "def_offset"
wenzelm@42327
    43
  val DEF_END_OFFSET = "def_end_offset"
wenzelm@42327
    44
  val DEF_FILE = "def_file"
wenzelm@42327
    45
  val DEF_ID = "def_id"
wenzelm@42327
    46
wenzelm@43710
    47
  val POSITION_PROPERTIES = Set(LINE, OFFSET, END_OFFSET, FILE, ID)
wenzelm@43593
    48
  val POSITION = "position"
wenzelm@29205
    49
wenzelm@43593
    50
wenzelm@43593
    51
  /* path */
wenzelm@43593
    52
wenzelm@43593
    53
  val PATH = "path"
wenzelm@43593
    54
wenzelm@43593
    55
  object Path
wenzelm@43593
    56
  {
wenzelm@43593
    57
    def unapply(markup: Markup): Option[String] =
wenzelm@43593
    58
      markup match {
wenzelm@45666
    59
        case Markup(PATH, Markup.Name(name)) => Some(name)
wenzelm@43593
    60
        case _ => None
wenzelm@43593
    61
      }
wenzelm@43593
    62
  }
wenzelm@29184
    63
wenzelm@29184
    64
wenzelm@36683
    65
  /* pretty printing */
wenzelm@36683
    66
wenzelm@43780
    67
  val Indent = new Properties.Int("indent")
wenzelm@36683
    68
  val BLOCK = "block"
wenzelm@43780
    69
  val Width = new Properties.Int("width")
wenzelm@36683
    70
  val BREAK = "break"
wenzelm@36683
    71
wenzelm@36683
    72
wenzelm@33985
    73
  /* hidden text */
wenzelm@33985
    74
wenzelm@33985
    75
  val HIDDEN = "hidden"
wenzelm@33985
    76
wenzelm@33985
    77
wenzelm@29184
    78
  /* logical entities */
wenzelm@29184
    79
wenzelm@43551
    80
  val CLASS = "class"
wenzelm@43552
    81
  val TYPE = "type"
wenzelm@29184
    82
  val FIXED = "fixed"
wenzelm@43552
    83
  val CONSTANT = "constant"
wenzelm@43552
    84
wenzelm@29184
    85
  val DYNAMIC_FACT = "dynamic_fact"
wenzelm@29184
    86
wenzelm@29184
    87
wenzelm@29184
    88
  /* inner syntax */
wenzelm@29184
    89
wenzelm@29184
    90
  val TFREE = "tfree"
wenzelm@29184
    91
  val TVAR = "tvar"
wenzelm@29184
    92
  val FREE = "free"
wenzelm@29184
    93
  val SKOLEM = "skolem"
wenzelm@29184
    94
  val BOUND = "bound"
wenzelm@29184
    95
  val VAR = "var"
wenzelm@45702
    96
  val NUMERAL = "numeral"
wenzelm@29184
    97
  val LITERAL = "literal"
wenzelm@43432
    98
  val DELIMITER = "delimiter"
wenzelm@43386
    99
  val INNER_STRING = "inner_string"
wenzelm@29184
   100
  val INNER_COMMENT = "inner_comment"
wenzelm@29184
   101
wenzelm@39168
   102
  val TOKEN_RANGE = "token_range"
wenzelm@39168
   103
wenzelm@29184
   104
  val SORT = "sort"
wenzelm@29184
   105
  val TYP = "typ"
wenzelm@29184
   106
  val TERM = "term"
wenzelm@29184
   107
  val PROP = "prop"
wenzelm@29184
   108
wenzelm@45445
   109
  val TYPING = "typing"
wenzelm@45445
   110
wenzelm@29184
   111
  val ATTRIBUTE = "attribute"
wenzelm@29184
   112
  val METHOD = "method"
wenzelm@29184
   113
wenzelm@29184
   114
wenzelm@29184
   115
  /* embedded source text */
wenzelm@29184
   116
wenzelm@29184
   117
  val ML_SOURCE = "ML_source"
wenzelm@29184
   118
  val DOC_SOURCE = "doc_source"
wenzelm@29184
   119
wenzelm@29184
   120
  val ANTIQ = "antiq"
wenzelm@43560
   121
  val ML_ANTIQUOTATION = "ML antiquotation"
wenzelm@43564
   122
  val DOCUMENT_ANTIQUOTATION = "document antiquotation"
wenzelm@43564
   123
  val DOCUMENT_ANTIQUOTATION_OPTION = "document antiquotation option"
wenzelm@29184
   124
wenzelm@29184
   125
wenzelm@30615
   126
  /* ML syntax */
wenzelm@30615
   127
wenzelm@30615
   128
  val ML_KEYWORD = "ML_keyword"
wenzelm@37195
   129
  val ML_DELIMITER = "ML_delimiter"
wenzelm@30615
   130
  val ML_TVAR = "ML_tvar"
wenzelm@30615
   131
  val ML_NUMERAL = "ML_numeral"
wenzelm@30615
   132
  val ML_CHAR = "ML_char"
wenzelm@30615
   133
  val ML_STRING = "ML_string"
wenzelm@30615
   134
  val ML_COMMENT = "ML_comment"
wenzelm@30615
   135
  val ML_MALFORMED = "ML_malformed"
wenzelm@30615
   136
wenzelm@30702
   137
  val ML_DEF = "ML_def"
wenzelm@31472
   138
  val ML_OPEN = "ML_open"
wenzelm@31472
   139
  val ML_STRUCT = "ML_struct"
wenzelm@30702
   140
  val ML_TYPING = "ML_typing"
wenzelm@30702
   141
wenzelm@30615
   142
wenzelm@29184
   143
  /* outer syntax */
wenzelm@29184
   144
wenzelm@29184
   145
  val KEYWORD_DECL = "keyword_decl"
wenzelm@29184
   146
  val COMMAND_DECL = "command_decl"
wenzelm@29184
   147
wenzelm@29184
   148
  val KEYWORD = "keyword"
wenzelm@37194
   149
  val OPERATOR = "operator"
wenzelm@29184
   150
  val COMMAND = "command"
wenzelm@29184
   151
  val STRING = "string"
wenzelm@29184
   152
  val ALTSTRING = "altstring"
wenzelm@29184
   153
  val VERBATIM = "verbatim"
wenzelm@29184
   154
  val COMMENT = "comment"
wenzelm@29184
   155
  val CONTROL = "control"
wenzelm@29184
   156
  val MALFORMED = "malformed"
wenzelm@29184
   157
wenzelm@29185
   158
  val COMMAND_SPAN = "command_span"
wenzelm@29185
   159
  val IGNORED_SPAN = "ignored_span"
wenzelm@29185
   160
  val MALFORMED_SPAN = "malformed_span"
wenzelm@29185
   161
wenzelm@29184
   162
wenzelm@43673
   163
  /* theory loader */
wenzelm@43673
   164
wenzelm@43673
   165
  val LOADED_THEORY = "loaded_theory"
wenzelm@43673
   166
wenzelm@43673
   167
wenzelm@45674
   168
  /* timing */
wenzelm@45674
   169
wenzelm@45674
   170
  val TIMING = "timing"
wenzelm@45674
   171
  val ELAPSED = "elapsed"
wenzelm@45674
   172
  val CPU = "cpu"
wenzelm@45674
   173
  val GC = "gc"
wenzelm@45674
   174
wenzelm@45674
   175
  object Timing
wenzelm@45674
   176
  {
wenzelm@45674
   177
    def apply(timing: isabelle.Timing): Markup =
wenzelm@45674
   178
      Markup(TIMING, List(
wenzelm@45674
   179
        (ELAPSED, Properties.Value.Double(timing.elapsed.seconds)),
wenzelm@45674
   180
        (CPU, Properties.Value.Double(timing.cpu.seconds)),
wenzelm@45674
   181
        (GC, Properties.Value.Double(timing.gc.seconds))))
wenzelm@45674
   182
    def unapply(markup: Markup): Option[isabelle.Timing] =
wenzelm@45674
   183
      markup match {
wenzelm@45674
   184
        case Markup(TIMING, List(
wenzelm@45674
   185
          (ELAPSED, Properties.Value.Double(elapsed)),
wenzelm@45674
   186
          (CPU, Properties.Value.Double(cpu)),
wenzelm@45674
   187
          (GC, Properties.Value.Double(gc)))) =>
wenzelm@45674
   188
            Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc)))
wenzelm@45674
   189
        case _ => None
wenzelm@45674
   190
      }
wenzelm@45674
   191
  }
wenzelm@45674
   192
wenzelm@45674
   193
wenzelm@29184
   194
  /* toplevel */
wenzelm@29184
   195
wenzelm@38721
   196
  val SUBGOALS = "subgoals"
wenzelm@38721
   197
  val PROOF_STATE = "proof_state"
wenzelm@38721
   198
wenzelm@29184
   199
  val STATE = "state"
wenzelm@29184
   200
  val SUBGOAL = "subgoal"
wenzelm@29184
   201
  val SENDBACK = "sendback"
wenzelm@29184
   202
  val HILITE = "hilite"
wenzelm@29184
   203
wenzelm@29184
   204
wenzelm@29184
   205
  /* command status */
wenzelm@29184
   206
wenzelm@29417
   207
  val TASK = "task"
wenzelm@29417
   208
wenzelm@37186
   209
  val FORKED = "forked"
wenzelm@37186
   210
  val JOINED = "joined"
wenzelm@29184
   211
  val FAILED = "failed"
wenzelm@29184
   212
  val FINISHED = "finished"
wenzelm@29488
   213
wenzelm@29488
   214
wenzelm@29488
   215
  /* interactive documents */
wenzelm@29488
   216
wenzelm@38414
   217
  val VERSION = "version"
wenzelm@38414
   218
  val ASSIGN = "assign"
wenzelm@29184
   219
wenzelm@27970
   220
wenzelm@43721
   221
  /* prover process */
wenzelm@43721
   222
wenzelm@43721
   223
  val PROVER_COMMAND = "prover_command"
wenzelm@43721
   224
  val PROVER_ARG = "prover_arg"
wenzelm@43721
   225
wenzelm@43721
   226
wenzelm@27970
   227
  /* messages */
wenzelm@27970
   228
wenzelm@43780
   229
  val Serial = new Properties.Long("serial")
wenzelm@27970
   230
wenzelm@29195
   231
  val MESSAGE = "message"
wenzelm@29522
   232
wenzelm@29522
   233
  val INIT = "init"
wenzelm@29522
   234
  val STATUS = "status"
wenzelm@39525
   235
  val REPORT = "report"
wenzelm@29522
   236
  val WRITELN = "writeln"
wenzelm@29522
   237
  val TRACING = "tracing"
wenzelm@29522
   238
  val WARNING = "warning"
wenzelm@29522
   239
  val ERROR = "error"
wenzelm@43746
   240
  val RAW = "raw"
wenzelm@29522
   241
  val SYSTEM = "system"
wenzelm@29522
   242
  val STDOUT = "stdout"
wenzelm@45633
   243
  val STDERR = "stderr"
wenzelm@29522
   244
  val EXIT = "exit"
wenzelm@29195
   245
wenzelm@44549
   246
  val LEGACY = "legacy"
wenzelm@44549
   247
wenzelm@39439
   248
  val NO_REPORT = "no_report"
wenzelm@39439
   249
wenzelm@39171
   250
  val BAD = "bad"
wenzelm@39171
   251
wenzelm@27970
   252
wenzelm@43748
   253
  /* raw message functions */
wenzelm@43748
   254
wenzelm@43748
   255
  val FUNCTION = "function"
wenzelm@43780
   256
  val Function = new Properties.String(FUNCTION)
wenzelm@43748
   257
wenzelm@46121
   258
  val Ready: Properties.T = List((FUNCTION, "ready"))
wenzelm@46121
   259
wenzelm@44661
   260
  val Assign_Execs: Properties.T = List((FUNCTION, "assign_execs"))
wenzelm@44676
   261
  val Removed_Versions: Properties.T = List((FUNCTION, "removed_versions"))
wenzelm@44661
   262
wenzelm@43748
   263
  val INVOKE_SCALA = "invoke_scala"
wenzelm@43748
   264
  object Invoke_Scala
wenzelm@43748
   265
  {
wenzelm@43780
   266
    def unapply(props: Properties.T): Option[(String, String)] =
wenzelm@43748
   267
      props match {
wenzelm@45666
   268
        case List((FUNCTION, INVOKE_SCALA), (Markup.NAME, name), (ID, id)) => Some((name, id))
wenzelm@43748
   269
        case _ => None
wenzelm@43748
   270
      }
wenzelm@43748
   271
  }
wenzelm@43748
   272
wenzelm@44298
   273
  val CANCEL_SCALA = "cancel_scala"
wenzelm@44298
   274
  object Cancel_Scala
wenzelm@44298
   275
  {
wenzelm@44298
   276
    def unapply(props: Properties.T): Option[String] =
wenzelm@44298
   277
      props match {
wenzelm@44298
   278
        case List((FUNCTION, CANCEL_SCALA), (ID, id)) => Some(id)
wenzelm@44298
   279
        case _ => None
wenzelm@44298
   280
      }
wenzelm@44298
   281
  }
wenzelm@27958
   282
}
wenzelm@38230
   283