src/Pure/PIDE/markup.scala
changeset 71624 f0499449e149
parent 71623 b3bddebe44ca
child 71673 88dfbc382a3d
equal deleted inserted replaced
71623:b3bddebe44ca 71624:f0499449e149
   623 
   623 
   624 
   624 
   625   /* export */
   625   /* export */
   626 
   626 
   627   val EXPORT = "export"
   627   val EXPORT = "export"
   628   val Export_Marker = Protocol_Message.Marker(EXPORT)
   628   val THEORY_NAME = "theory_name"
   629 
   629   val EXECUTABLE = "executable"
   630   object Export
   630   val COMPRESS = "compress"
   631   {
   631   val STRICT = "strict"
   632     sealed case class Args(
       
   633       id: Option[String],
       
   634       serial: Long,
       
   635       theory_name: String,
       
   636       name: String,
       
   637       executable: Boolean,
       
   638       compress: Boolean,
       
   639       strict: Boolean)
       
   640     {
       
   641       def compound_name: String = isabelle.Export.compound_name(theory_name, name)
       
   642     }
       
   643 
       
   644     val THEORY_NAME = "theory_name"
       
   645     val EXECUTABLE = "executable"
       
   646     val COMPRESS = "compress"
       
   647     val STRICT = "strict"
       
   648 
       
   649     object Marker
       
   650     {
       
   651       def unapply(line: String): Option[(Args, Path)] =
       
   652         line match {
       
   653           case Export_Marker(text) =>
       
   654             val props = XML.Decode.properties(YXML.parse_body(text))
       
   655             props match {
       
   656               case
       
   657                 List(
       
   658                   (SERIAL, Value.Long(serial)),
       
   659                   (THEORY_NAME, theory_name),
       
   660                   (NAME, name),
       
   661                   (EXECUTABLE, Value.Boolean(executable)),
       
   662                   (COMPRESS, Value.Boolean(compress)),
       
   663                   (STRICT, Value.Boolean(strict)),
       
   664                   (FILE, file)) if isabelle.Path.is_valid(file) =>
       
   665                 val args = Args(None, serial, theory_name, name, executable, compress, strict)
       
   666                 Some((args, isabelle.Path.explode(file)))
       
   667               case _ => None
       
   668             }
       
   669           case _ => None
       
   670         }
       
   671     }
       
   672 
       
   673     def unapply(props: Properties.T): Option[Args] =
       
   674       props match {
       
   675         case
       
   676           List(
       
   677             (FUNCTION, EXPORT),
       
   678             (ID, id),
       
   679             (SERIAL, Value.Long(serial)),
       
   680             (THEORY_NAME, theory_name),
       
   681             (NAME, name),
       
   682             (EXECUTABLE, Value.Boolean(executable)),
       
   683             (COMPRESS, Value.Boolean(compress)),
       
   684             (STRICT, Value.Boolean(strict))) =>
       
   685           Some(Args(proper_string(id), serial, theory_name, name, executable, compress, strict))
       
   686         case _ => None
       
   687       }
       
   688   }
       
   689 
   632 
   690 
   633 
   691   /* debugger output */
   634   /* debugger output */
   692 
   635 
   693   val DEBUGGER_STATE = "debugger_state"
   636   val DEBUGGER_STATE = "debugger_state"