solution/cw5/fun_tokens.sc
changeset 867 54bcd848d716
parent 864 b5b1bc0a603b
child 868 8fb3b6d3be70
equal deleted inserted replaced
866:89418980c19d 867:54bcd848d716
   269   val tks = lexing_simp(FUN_REGS, s).collect(token)
   269   val tks = lexing_simp(FUN_REGS, s).collect(token)
   270   if (tks.length != 0) tks
   270   if (tks.length != 0) tks
   271   else { println (s"Tokenise Error") ; sys.exit(-1) }     
   271   else { println (s"Tokenise Error") ; sys.exit(-1) }     
   272 }
   272 }
   273 
   273 
   274 import ammonite.ops._
   274 //import ammonite.ops._
   275 
   275 
   276 //@doc("Tokenising a file.")
   276 //@doc("Tokenising a file.")
   277 @main
   277 @main
   278 def main(fname: String) = {
   278 def main(fname: String) = {
   279   println(tokenise(os.read(os.pwd / fname)))
   279   println(tokenise(os.read(os.pwd / fname)))