src/Pure/System/scala.scala
changeset 72756 72ac27ea12b2
parent 72332 319dd5c618a5
child 72760 042180540068
equal deleted inserted replaced
72755:8dffbe01a3e1 72756:72ac27ea12b2
    18   /** registered functions **/
    18   /** registered functions **/
    19 
    19 
    20   abstract class Fun(val name: String) extends Function[String, String]
    20   abstract class Fun(val name: String) extends Function[String, String]
    21   {
    21   {
    22     override def toString: String = name
    22     override def toString: String = name
       
    23     def position: Properties.T = here.position
       
    24     def here: Scala_Project.Here
    23     def apply(arg: String): String
    25     def apply(arg: String): String
    24   }
    26   }
    25 
    27 
    26   class Functions(val functions: Fun*) extends Isabelle_System.Service
    28   class Functions(val functions: Fun*) extends Isabelle_System.Service
    27 
    29 
    32 
    34 
    33   /** demo functions **/
    35   /** demo functions **/
    34 
    36 
    35   object Echo extends Fun("echo")
    37   object Echo extends Fun("echo")
    36   {
    38   {
       
    39     val here = Scala_Project.here
    37     def apply(arg: String): String = arg
    40     def apply(arg: String): String = arg
    38   }
    41   }
    39 
    42 
    40   object Sleep extends Fun("sleep")
    43   object Sleep extends Fun("sleep")
    41   {
    44   {
       
    45     val here = Scala_Project.here
    42     def apply(seconds: String): String =
    46     def apply(seconds: String): String =
    43     {
    47     {
    44       val t =
    48       val t =
    45         seconds match {
    49         seconds match {
    46           case Value.Double(s) => Time.seconds(s)
    50           case Value.Double(s) => Time.seconds(s)
   121     }
   125     }
   122   }
   126   }
   123 
   127 
   124   object Toplevel extends Fun("scala_toplevel")
   128   object Toplevel extends Fun("scala_toplevel")
   125   {
   129   {
       
   130     val here = Scala_Project.here
   126     def apply(arg: String): String =
   131     def apply(arg: String): String =
   127     {
   132     {
   128       val (interpret, source) =
   133       val (interpret, source) =
   129         YXML.parse_body(arg) match {
   134         YXML.parse_body(arg) match {
   130           case Nil => (false, "")
   135           case Nil => (false, "")