equal
deleted
inserted
replaced
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 |
11 |
12 |
12 |
13 |
13 import scala.language.implicitConversions |
14 import scala.language.implicitConversions |
14 import scala.language.reflectiveCalls |
15 import scala.language.reflectiveCalls |
15 |
16 |
39 } |
40 } |
40 implicit def string2rexp(s : String) : Rexp = |
41 implicit def string2rexp(s : String) : Rexp = |
41 charlist2rexp(s.toList) |
42 charlist2rexp(s.toList) |
42 |
43 |
43 extension (s: String) { |
44 extension (s: String) { |
44 def $ (r: Rexp) = RECD(s, r) |
45 infix def $ (r: Rexp) = RECD(s, r) |
45 } |
46 } |
46 |
47 |
47 extension (r: Rexp) { |
48 extension (r: Rexp) { |
48 def | (s: Rexp) = ALT(r, s) |
49 def | (s: Rexp) = ALT(r, s) |
49 def % = STAR(r) |
50 def % = STAR(r) |
250 |
251 |
251 // post 2.5.0 ammonite |
252 // post 2.5.0 ammonite |
252 // import os._ |
253 // import os._ |
253 |
254 |
254 //@doc("Tokenising a file.") |
255 //@doc("Tokenising a file.") |
255 @main |
256 //@main |
256 def main(fname: String) = { |
257 def main(fname: String) = { |
257 println(tokenise(os.read(os.pwd / fname))) |
258 println(tokenise(os.read(os.pwd / fname))) |
258 } |
259 } |