--- a/solutions/cw2/lexer.sc Fri Sep 15 10:49:33 2023 +0100
+++ b/solutions/cw2/lexer.sc Sun Sep 17 19:12:57 2023 +0100
@@ -37,13 +37,14 @@
implicit def string2rexp(s : String) : Rexp =
charlist2rexp(s.toList)
-implicit def RexpOps(r: Rexp) = new {
+extension (r: Rexp) {
+ def ~ (s: Rexp) = SEQ(r, s)
+ def % = STAR(r)
def | (s: Rexp) = ALT(r, s)
- def % = STAR(r)
- def ~ (s: Rexp) = SEQ(r, s)
}
-implicit def stringOps(s: String) = new {
+
+extension (s: String) {
def | (r: Rexp) = ALT(s, r)
def | (r: String) = ALT(s, r)
def % = STAR(s)