src/Pure/General/markup.scala
changeset 45666 d83797ef0d2d
parent 45633 2cb7e34f6096
child 45667 546d78f0d81f
     1.1 --- a/src/Pure/General/markup.scala	Mon Nov 28 20:39:08 2011 +0100
     1.2 +++ b/src/Pure/General/markup.scala	Mon Nov 28 22:05:32 2011 +0100
     1.3 @@ -1,7 +1,7 @@
     1.4  /*  Title:      Pure/General/markup.scala
     1.5      Author:     Makarius
     1.6  
     1.7 -Common markup elements.
     1.8 +Generic markup elements.
     1.9  */
    1.10  
    1.11  package isabelle
    1.12 @@ -9,12 +9,7 @@
    1.13  
    1.14  object Markup
    1.15  {
    1.16 -  /* empty */
    1.17 -
    1.18 -  val Empty = Markup("", Nil)
    1.19 -
    1.20 -
    1.21 -  /* misc properties */
    1.22 +  /* properties */
    1.23  
    1.24    val NAME = "name"
    1.25    val Name = new Properties.String(NAME)
    1.26 @@ -23,163 +18,11 @@
    1.27    val Kind = new Properties.String(KIND)
    1.28  
    1.29  
    1.30 -  /* formal entities */
    1.31 -
    1.32 -  val BINDING = "binding"
    1.33 -  val ENTITY = "entity"
    1.34 -  val DEF = "def"
    1.35 -  val REF = "ref"
    1.36 -
    1.37 -  object Entity
    1.38 -  {
    1.39 -    def unapply(markup: Markup): Option[(String, String)] =
    1.40 -      markup match {
    1.41 -        case Markup(ENTITY, props @ Kind(kind)) =>
    1.42 -          props match {
    1.43 -            case Name(name) => Some(kind, name)
    1.44 -            case _ => None
    1.45 -          }
    1.46 -        case _ => None
    1.47 -      }
    1.48 -  }
    1.49 -
    1.50 -
    1.51 -  /* position */
    1.52 -
    1.53 -  val LINE = "line"
    1.54 -  val OFFSET = "offset"
    1.55 -  val END_OFFSET = "end_offset"
    1.56 -  val FILE = "file"
    1.57 -  val ID = "id"
    1.58 -
    1.59 -  val DEF_LINE = "def_line"
    1.60 -  val DEF_OFFSET = "def_offset"
    1.61 -  val DEF_END_OFFSET = "def_end_offset"
    1.62 -  val DEF_FILE = "def_file"
    1.63 -  val DEF_ID = "def_id"
    1.64 -
    1.65 -  val POSITION_PROPERTIES = Set(LINE, OFFSET, END_OFFSET, FILE, ID)
    1.66 -  val POSITION = "position"
    1.67 -
    1.68 -
    1.69 -  /* path */
    1.70 -
    1.71 -  val PATH = "path"
    1.72 -
    1.73 -  object Path
    1.74 -  {
    1.75 -    def unapply(markup: Markup): Option[String] =
    1.76 -      markup match {
    1.77 -        case Markup(PATH, Name(name)) => Some(name)
    1.78 -        case _ => None
    1.79 -      }
    1.80 -  }
    1.81 -
    1.82 -
    1.83 -  /* pretty printing */
    1.84 -
    1.85 -  val Indent = new Properties.Int("indent")
    1.86 -  val BLOCK = "block"
    1.87 -  val Width = new Properties.Int("width")
    1.88 -  val BREAK = "break"
    1.89 -
    1.90 -
    1.91 -  /* hidden text */
    1.92 -
    1.93 -  val HIDDEN = "hidden"
    1.94 -
    1.95 -
    1.96 -  /* logical entities */
    1.97 -
    1.98 -  val CLASS = "class"
    1.99 -  val TYPE = "type"
   1.100 -  val FIXED = "fixed"
   1.101 -  val CONSTANT = "constant"
   1.102 -
   1.103 -  val DYNAMIC_FACT = "dynamic_fact"
   1.104 -
   1.105 -
   1.106 -  /* inner syntax */
   1.107 +  /* elements */
   1.108  
   1.109 -  val TFREE = "tfree"
   1.110 -  val TVAR = "tvar"
   1.111 -  val FREE = "free"
   1.112 -  val SKOLEM = "skolem"
   1.113 -  val BOUND = "bound"
   1.114 -  val VAR = "var"
   1.115 -  val NUM = "num"
   1.116 -  val FLOAT = "float"
   1.117 -  val XNUM = "xnum"
   1.118 -  val XSTR = "xstr"
   1.119 -  val LITERAL = "literal"
   1.120 -  val DELIMITER = "delimiter"
   1.121 -  val INNER_STRING = "inner_string"
   1.122 -  val INNER_COMMENT = "inner_comment"
   1.123 -
   1.124 -  val TOKEN_RANGE = "token_range"
   1.125 -
   1.126 -  val SORT = "sort"
   1.127 -  val TYP = "typ"
   1.128 -  val TERM = "term"
   1.129 -  val PROP = "prop"
   1.130 -
   1.131 -  val TYPING = "typing"
   1.132 -
   1.133 -  val ATTRIBUTE = "attribute"
   1.134 -  val METHOD = "method"
   1.135 -
   1.136 -
   1.137 -  /* embedded source text */
   1.138 -
   1.139 -  val ML_SOURCE = "ML_source"
   1.140 -  val DOC_SOURCE = "doc_source"
   1.141 -
   1.142 -  val ANTIQ = "antiq"
   1.143 -  val ML_ANTIQUOTATION = "ML antiquotation"
   1.144 -  val DOCUMENT_ANTIQUOTATION = "document antiquotation"
   1.145 -  val DOCUMENT_ANTIQUOTATION_OPTION = "document antiquotation option"
   1.146 -
   1.147 -
   1.148 -  /* ML syntax */
   1.149 -
   1.150 -  val ML_KEYWORD = "ML_keyword"
   1.151 -  val ML_DELIMITER = "ML_delimiter"
   1.152 -  val ML_TVAR = "ML_tvar"
   1.153 -  val ML_NUMERAL = "ML_numeral"
   1.154 -  val ML_CHAR = "ML_char"
   1.155 -  val ML_STRING = "ML_string"
   1.156 -  val ML_COMMENT = "ML_comment"
   1.157 -  val ML_MALFORMED = "ML_malformed"
   1.158 -
   1.159 -  val ML_DEF = "ML_def"
   1.160 -  val ML_OPEN = "ML_open"
   1.161 -  val ML_STRUCT = "ML_struct"
   1.162 -  val ML_TYPING = "ML_typing"
   1.163 -
   1.164 -
   1.165 -  /* outer syntax */
   1.166 -
   1.167 -  val KEYWORD_DECL = "keyword_decl"
   1.168 -  val COMMAND_DECL = "command_decl"
   1.169 -
   1.170 -  val KEYWORD = "keyword"
   1.171 -  val OPERATOR = "operator"
   1.172 -  val COMMAND = "command"
   1.173 -  val STRING = "string"
   1.174 -  val ALTSTRING = "altstring"
   1.175 -  val VERBATIM = "verbatim"
   1.176 -  val COMMENT = "comment"
   1.177 -  val CONTROL = "control"
   1.178 -  val MALFORMED = "malformed"
   1.179 -
   1.180 -  val COMMAND_SPAN = "command_span"
   1.181 -  val IGNORED_SPAN = "ignored_span"
   1.182 -  val MALFORMED_SPAN = "malformed_span"
   1.183 -
   1.184 -
   1.185 -  /* theory loader */
   1.186 -
   1.187 -  val LOADED_THEORY = "loaded_theory"
   1.188 +  val Empty = Markup("", Nil)
   1.189 +  val Data = Markup("data", Nil)
   1.190 +  val Broken = Markup("broken", Nil)
   1.191  
   1.192  
   1.193    /* timing */
   1.194 @@ -206,101 +49,8 @@
   1.195          case _ => None
   1.196        }
   1.197    }
   1.198 -
   1.199 -
   1.200 -  /* toplevel */
   1.201 -
   1.202 -  val SUBGOALS = "subgoals"
   1.203 -  val PROOF_STATE = "proof_state"
   1.204 -
   1.205 -  val STATE = "state"
   1.206 -  val SUBGOAL = "subgoal"
   1.207 -  val SENDBACK = "sendback"
   1.208 -  val HILITE = "hilite"
   1.209 -
   1.210 -
   1.211 -  /* command status */
   1.212 -
   1.213 -  val TASK = "task"
   1.214 -
   1.215 -  val FORKED = "forked"
   1.216 -  val JOINED = "joined"
   1.217 -  val FAILED = "failed"
   1.218 -  val FINISHED = "finished"
   1.219 -
   1.220 -
   1.221 -  /* interactive documents */
   1.222 -
   1.223 -  val VERSION = "version"
   1.224 -  val ASSIGN = "assign"
   1.225 -
   1.226 -
   1.227 -  /* prover process */
   1.228 -
   1.229 -  val PROVER_COMMAND = "prover_command"
   1.230 -  val PROVER_ARG = "prover_arg"
   1.231 +}
   1.232  
   1.233  
   1.234 -  /* messages */
   1.235 -
   1.236 -  val Serial = new Properties.Long("serial")
   1.237 -
   1.238 -  val MESSAGE = "message"
   1.239 -
   1.240 -  val INIT = "init"
   1.241 -  val STATUS = "status"
   1.242 -  val REPORT = "report"
   1.243 -  val WRITELN = "writeln"
   1.244 -  val TRACING = "tracing"
   1.245 -  val WARNING = "warning"
   1.246 -  val ERROR = "error"
   1.247 -  val RAW = "raw"
   1.248 -  val SYSTEM = "system"
   1.249 -  val STDOUT = "stdout"
   1.250 -  val STDERR = "stderr"
   1.251 -  val EXIT = "exit"
   1.252 -
   1.253 -  val LEGACY = "legacy"
   1.254 -
   1.255 -  val NO_REPORT = "no_report"
   1.256 -
   1.257 -  val BAD = "bad"
   1.258 -
   1.259 -  val READY = "ready"
   1.260 -
   1.261 -
   1.262 -  /* raw message functions */
   1.263 +sealed case class Markup(name: String, properties: Properties.T)
   1.264  
   1.265 -  val FUNCTION = "function"
   1.266 -  val Function = new Properties.String(FUNCTION)
   1.267 -
   1.268 -  val Assign_Execs: Properties.T = List((FUNCTION, "assign_execs"))
   1.269 -  val Removed_Versions: Properties.T = List((FUNCTION, "removed_versions"))
   1.270 -
   1.271 -  val INVOKE_SCALA = "invoke_scala"
   1.272 -  object Invoke_Scala
   1.273 -  {
   1.274 -    def unapply(props: Properties.T): Option[(String, String)] =
   1.275 -      props match {
   1.276 -        case List((FUNCTION, INVOKE_SCALA), (NAME, name), (ID, id)) => Some((name, id))
   1.277 -        case _ => None
   1.278 -      }
   1.279 -  }
   1.280 -
   1.281 -  val CANCEL_SCALA = "cancel_scala"
   1.282 -  object Cancel_Scala
   1.283 -  {
   1.284 -    def unapply(props: Properties.T): Option[String] =
   1.285 -      props match {
   1.286 -        case List((FUNCTION, CANCEL_SCALA), (ID, id)) => Some(id)
   1.287 -        case _ => None
   1.288 -      }
   1.289 -  }
   1.290 -
   1.291 -
   1.292 -  /* system data */
   1.293 -
   1.294 -  val Data = Markup("data", Nil)
   1.295 -}
   1.296 -
   1.297 -sealed case class Markup(name: String, properties: Properties.T)