src/Pure/PIDE/protocol.scala
changeset 71624 f0499449e149
parent 71601 97ccf48c2f0c
child 71630 50425e4c3910
equal deleted inserted replaced
71623:b3bddebe44ca 71624:f0499449e149
   154   {
   154   {
   155     val text = Pretty.string_of(List(msg))
   155     val text = Pretty.string_of(List(msg))
   156     if (is_warning(msg) || is_legacy(msg)) Library.prefix_lines("### ", text)
   156     if (is_warning(msg) || is_legacy(msg)) Library.prefix_lines("### ", text)
   157     else if (is_error(msg)) Library.prefix_lines("*** ", text)
   157     else if (is_error(msg)) Library.prefix_lines("*** ", text)
   158     else text
   158     else text
       
   159   }
       
   160 
       
   161 
       
   162   /* export */
       
   163 
       
   164   val Export_Marker = Protocol_Message.Marker(Markup.EXPORT)
       
   165 
       
   166   object Export
       
   167   {
       
   168     sealed case class Args(
       
   169       id: Option[String],
       
   170       serial: Long,
       
   171       theory_name: String,
       
   172       name: String,
       
   173       executable: Boolean,
       
   174       compress: Boolean,
       
   175       strict: Boolean)
       
   176     {
       
   177       def compound_name: String = isabelle.Export.compound_name(theory_name, name)
       
   178     }
       
   179 
       
   180     object Marker
       
   181     {
       
   182       def unapply(line: String): Option[(Args, Path)] =
       
   183         line match {
       
   184           case Export_Marker(text) =>
       
   185             val props = XML.Decode.properties(YXML.parse_body(text))
       
   186             props match {
       
   187               case
       
   188                 List(
       
   189                   (Markup.SERIAL, Value.Long(serial)),
       
   190                   (Markup.THEORY_NAME, theory_name),
       
   191                   (Markup.NAME, name),
       
   192                   (Markup.EXECUTABLE, Value.Boolean(executable)),
       
   193                   (Markup.COMPRESS, Value.Boolean(compress)),
       
   194                   (Markup.STRICT, Value.Boolean(strict)),
       
   195                   (Markup.FILE, file)) if isabelle.Path.is_valid(file) =>
       
   196                 val args = Args(None, serial, theory_name, name, executable, compress, strict)
       
   197                 Some((args, isabelle.Path.explode(file)))
       
   198               case _ => None
       
   199             }
       
   200           case _ => None
       
   201         }
       
   202     }
       
   203 
       
   204     def unapply(props: Properties.T): Option[Args] =
       
   205       props match {
       
   206         case
       
   207           List(
       
   208             (Markup.FUNCTION, Markup.EXPORT),
       
   209             (Markup.ID, id),
       
   210             (Markup.SERIAL, Value.Long(serial)),
       
   211             (Markup.THEORY_NAME, theory_name),
       
   212             (Markup.NAME, name),
       
   213             (Markup.EXECUTABLE, Value.Boolean(executable)),
       
   214             (Markup.COMPRESS, Value.Boolean(compress)),
       
   215             (Markup.STRICT, Value.Boolean(strict))) =>
       
   216           Some(Args(proper_string(id), serial, theory_name, name, executable, compress, strict))
       
   217         case _ => None
       
   218       }
   159   }
   219   }
   160 
   220 
   161 
   221 
   162   /* breakpoints */
   222   /* breakpoints */
   163 
   223