progs/fun/fun.sc
changeset 955 47acfd7f9096
parent 870 739039774cee
child 975 ae5c03560d4d
equal deleted inserted replaced
954:eda0ccf56c72 955:47acfd7f9096
    72 // generating instructions, labels etc
    72 // generating instructions, labels etc
    73 import scala.language.implicitConversions
    73 import scala.language.implicitConversions
    74 import scala.language.reflectiveCalls
    74 import scala.language.reflectiveCalls
    75 
    75 
    76 // convenience for code-generation (string interpolations)
    76 // convenience for code-generation (string interpolations)
    77 implicit def sring_inters(sc: StringContext) = new {
    77 extension (sc: StringContext) {
    78   def i(args: Any*): String = "   " ++ sc.s(args:_*) ++ "\n"  // instructions
    78   def i(args: Any*): String = "   " ++ sc.s(args:_*) ++ "\n"  // instructions
    79   def l(args: Any*): String = sc.s(args:_*) ++ ":\n"          // labels
    79   def l(args: Any*): String = sc.s(args:_*) ++ ":\n"          // labels
    80   def m(args: Any*): String = sc.s(args:_*) ++ "\n"           // methods
    80   def m(args: Any*): String = sc.s(args:_*) ++ "\n"           // methods
    81 }
    81 }
    82 
    82