src/Pure/PIDE/isabelle_markup.scala
author wenzelm
Mon Oct 01 16:37:22 2012 +0200 (2012-10-01)
changeset 49674 dbadb4d03cbc
parent 49566 66cbf8bb4693
child 50162 e06eabc421e7
permissions -rw-r--r--
report sort assignment of visible type variables;
     1 /*  Title:      Pure/PIDE/isabelle_markup.scala
     2     Author:     Makarius
     3 
     4 Isabelle markup elements.
     5 */
     6 
     7 package isabelle
     8 
     9 
    10 object Isabelle_Markup
    11 {
    12   /* formal entities */
    13 
    14   val BINDING = "binding"
    15   val ENTITY = "entity"
    16   val DEF = "def"
    17   val REF = "ref"
    18 
    19   object Entity
    20   {
    21     def unapply(markup: Markup): Option[(String, String)] =
    22       markup match {
    23         case Markup(ENTITY, props @ Markup.Kind(kind)) =>
    24           props match {
    25             case Markup.Name(name) => Some(kind, name)
    26             case _ => None
    27           }
    28         case _ => None
    29       }
    30   }
    31 
    32 
    33   /* position */
    34 
    35   val LINE = "line"
    36   val OFFSET = "offset"
    37   val END_OFFSET = "end_offset"
    38   val FILE = "file"
    39   val ID = "id"
    40 
    41   val DEF_LINE = "def_line"
    42   val DEF_OFFSET = "def_offset"
    43   val DEF_END_OFFSET = "def_end_offset"
    44   val DEF_FILE = "def_file"
    45   val DEF_ID = "def_id"
    46 
    47   val POSITION_PROPERTIES = Set(LINE, OFFSET, END_OFFSET, FILE, ID)
    48   val POSITION = "position"
    49 
    50 
    51   /* path */
    52 
    53   val PATH = "path"
    54 
    55   object Path
    56   {
    57     def unapply(markup: Markup): Option[String] =
    58       markup match {
    59         case Markup(PATH, Markup.Name(name)) => Some(name)
    60         case _ => None
    61       }
    62   }
    63 
    64 
    65   /* pretty printing */
    66 
    67   val Indent = new Properties.Int("indent")
    68   val BLOCK = "block"
    69   val Width = new Properties.Int("width")
    70   val BREAK = "break"
    71 
    72   val SEPARATOR = "separator"
    73 
    74 
    75   /* hidden text */
    76 
    77   val HIDDEN = "hidden"
    78 
    79 
    80   /* logical entities */
    81 
    82   val CLASS = "class"
    83   val TYPE_NAME = "type_name"
    84   val FIXED = "fixed"
    85   val CONSTANT = "constant"
    86 
    87   val DYNAMIC_FACT = "dynamic_fact"
    88 
    89 
    90   /* inner syntax */
    91 
    92   val TFREE = "tfree"
    93   val TVAR = "tvar"
    94   val FREE = "free"
    95   val SKOLEM = "skolem"
    96   val BOUND = "bound"
    97   val VAR = "var"
    98   val NUMERAL = "numeral"
    99   val LITERAL = "literal"
   100   val DELIMITER = "delimiter"
   101   val INNER_STRING = "inner_string"
   102   val INNER_COMMENT = "inner_comment"
   103 
   104   val TOKEN_RANGE = "token_range"
   105 
   106   val SORT = "sort"
   107   val TYP = "typ"
   108   val TERM = "term"
   109   val PROP = "prop"
   110 
   111   val SORTING = "sorting"
   112   val TYPING = "typing"
   113 
   114   val ATTRIBUTE = "attribute"
   115   val METHOD = "method"
   116 
   117 
   118   /* embedded source text */
   119 
   120   val ML_SOURCE = "ML_source"
   121   val DOCUMENT_SOURCE = "document_source"
   122 
   123   val ANTIQ = "antiq"
   124   val ML_ANTIQUOTATION = "ML_antiquotation"
   125   val DOCUMENT_ANTIQUOTATION = "document_antiquotation"
   126   val DOCUMENT_ANTIQUOTATION_OPTION = "document_antiquotation_option"
   127 
   128 
   129   /* ML syntax */
   130 
   131   val ML_KEYWORD = "ML_keyword"
   132   val ML_DELIMITER = "ML_delimiter"
   133   val ML_TVAR = "ML_tvar"
   134   val ML_NUMERAL = "ML_numeral"
   135   val ML_CHAR = "ML_char"
   136   val ML_STRING = "ML_string"
   137   val ML_COMMENT = "ML_comment"
   138 
   139   val ML_DEF = "ML_def"
   140   val ML_OPEN = "ML_open"
   141   val ML_STRUCT = "ML_struct"
   142   val ML_TYPING = "ML_typing"
   143 
   144 
   145   /* outer syntax */
   146 
   147   val KEYWORD = "keyword"
   148   val OPERATOR = "operator"
   149   val COMMAND = "command"
   150   val STRING = "string"
   151   val ALTSTRING = "altstring"
   152   val VERBATIM = "verbatim"
   153   val COMMENT = "comment"
   154   val CONTROL = "control"
   155 
   156   val KEYWORD1 = "keyword1"
   157   val KEYWORD2 = "keyword2"
   158 
   159 
   160   /* timing */
   161 
   162   val TIMING = "timing"
   163   val ELAPSED = "elapsed"
   164   val CPU = "cpu"
   165   val GC = "gc"
   166 
   167   object Timing
   168   {
   169     def apply(timing: isabelle.Timing): Markup =
   170       Markup(TIMING, List(
   171         (ELAPSED, Properties.Value.Double(timing.elapsed.seconds)),
   172         (CPU, Properties.Value.Double(timing.cpu.seconds)),
   173         (GC, Properties.Value.Double(timing.gc.seconds))))
   174     def unapply(markup: Markup): Option[isabelle.Timing] =
   175       markup match {
   176         case Markup(TIMING, List(
   177           (ELAPSED, Properties.Value.Double(elapsed)),
   178           (CPU, Properties.Value.Double(cpu)),
   179           (GC, Properties.Value.Double(gc)))) =>
   180             Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc)))
   181         case _ => None
   182       }
   183   }
   184 
   185 
   186   /* toplevel */
   187 
   188   val SUBGOALS = "subgoals"
   189   val PROOF_STATE = "proof_state"
   190 
   191   val STATE = "state"
   192   val SUBGOAL = "subgoal"
   193   val SENDBACK = "sendback"
   194   val INTENSIFY = "intensify"
   195 
   196 
   197   /* command status */
   198 
   199   val TASK = "task"
   200 
   201   val ACCEPTED = "accepted"
   202   val FORKED = "forked"
   203   val JOINED = "joined"
   204   val RUNNING = "running"
   205   val FINISHED = "finished"
   206   val FAILED = "failed"
   207 
   208 
   209   /* interactive documents */
   210 
   211   val VERSION = "version"
   212   val ASSIGN = "assign"
   213 
   214 
   215   /* prover process */
   216 
   217   val PROVER_COMMAND = "prover_command"
   218   val PROVER_ARG = "prover_arg"
   219 
   220 
   221   /* messages */
   222 
   223   val Serial = new Properties.Long("serial")
   224 
   225   val MESSAGE = "message"
   226 
   227   val INIT = "init"
   228   val STATUS = "status"
   229   val REPORT = "report"
   230   val WRITELN = "writeln"
   231   val TRACING = "tracing"
   232   val WARNING = "warning"
   233   val ERROR = "error"
   234   val PROTOCOL = "protocol"
   235   val SYSTEM = "system"
   236   val STDOUT = "stdout"
   237   val STDERR = "stderr"
   238   val EXIT = "exit"
   239 
   240   val WRITELN_MESSAGE = "writeln_message"
   241   val TRACING_MESSAGE = "tracing_message"
   242   val WARNING_MESSAGE = "warning_message"
   243   val ERROR_MESSAGE = "error_message"
   244 
   245   val message: String => String =
   246     Map(WRITELN -> WRITELN_MESSAGE, TRACING -> TRACING_MESSAGE,
   247         WARNING -> WARNING_MESSAGE, ERROR -> ERROR_MESSAGE)
   248       .withDefault((name: String) => name + "_message")
   249 
   250   val Return_Code = new Properties.Int("return_code")
   251 
   252   val LEGACY = "legacy"
   253 
   254   val NO_REPORT = "no_report"
   255 
   256   val BAD = "bad"
   257 
   258   val GRAPHVIEW = "graphview"
   259 
   260 
   261   /* protocol message functions */
   262 
   263   val FUNCTION = "function"
   264   val Function = new Properties.String(FUNCTION)
   265 
   266   val Assign_Execs: Properties.T = List((FUNCTION, "assign_execs"))
   267   val Removed_Versions: Properties.T = List((FUNCTION, "removed_versions"))
   268 
   269   object Invoke_Scala
   270   {
   271     def unapply(props: Properties.T): Option[(String, String)] =
   272       props match {
   273         case List((FUNCTION, "invoke_scala"), (Markup.NAME, name), (ID, id)) => Some((name, id))
   274         case _ => None
   275       }
   276   }
   277   object Cancel_Scala
   278   {
   279     def unapply(props: Properties.T): Option[String] =
   280       props match {
   281         case List((FUNCTION, "cancel_scala"), (ID, id)) => Some(id)
   282         case _ => None
   283       }
   284   }
   285 }
   286