progs/fun/fun_tokens.sc
changeset 975 ae5c03560d4d
parent 961 c0600f8b6427
equal deleted inserted replaced
974:0cb4bf2469d1 975:ae5c03560d4d
     6 //     amm fun_tokens.sc fact.fun
     6 //     amm fun_tokens.sc fact.fun
     7 //
     7 //
     8 //     amm fun_tokens.sc defs.fun
     8 //     amm fun_tokens.sc defs.fun
     9 //
     9 //
    10 
    10 
    11 //> using toolkit 0.5.0
       
    12  
       
    13 
    11 
    14 import scala.language.implicitConversions    
    12 import scala.language.implicitConversions    
    15 import scala.language.reflectiveCalls 
    13 import scala.language.reflectiveCalls 
    16 
    14 
    17 abstract class Rexp 
    15 abstract class Rexp 
   244   val tks = lexing_simp(FUN_REGS, s).collect(token)
   242   val tks = lexing_simp(FUN_REGS, s).collect(token)
   245   if (tks.length != 0) tks
   243   if (tks.length != 0) tks
   246   else { println (s"Tokenise Error") ; sys.exit(-1) }     
   244   else { println (s"Tokenise Error") ; sys.exit(-1) }     
   247 }
   245 }
   248 
   246 
   249 // pre-2.5.0 ammonite 
   247 
   250 // import ammonite.ops._
   248 @main
   251 
       
   252 // post 2.5.0 ammonite
       
   253 // import os._
       
   254 
       
   255 //@doc("Tokenising a file.")
       
   256 //@main
       
   257 def main(fname: String) = {
   249 def main(fname: String) = {
   258   println(tokenise(os.read(os.pwd / fname)))
   250   println(tokenise(os.read(os.pwd / fname)))
   259 }
   251 }