progs/lexer/lex.sc
changeset 936 0b5f06539a84
parent 852 8706b846a3e0
child 948 6bb67c2dcfd3
equal deleted inserted replaced
935:4e221cf587fa 936:0b5f06539a84
    38 implicit def string2rexp(s : String) : Rexp = 
    38 implicit def string2rexp(s : String) : Rexp = 
    39   charlist2rexp(s.toList)
    39   charlist2rexp(s.toList)
    40 
    40 
    41 val HELLO : Rexp = "hello"
    41 val HELLO : Rexp = "hello"
    42 
    42 
    43 implicit def RexpOps(r: Rexp) = new {
    43 extension (r: Rexp) {
    44   def | (s: Rexp) = ALT(r, s)
    44   def | (s: Rexp) = ALT(r, s)
    45   def % = STAR(r)
    45   def % = STAR(r)
    46   def ~ (s: Rexp) = SEQ(r, s)
    46   def ~ (s: Rexp) = SEQ(r, s)
    47 }
    47 }
    48 
    48 
    49 implicit def stringOps(s: String) = new {
    49 extension (s: String) {
    50   def | (r: Rexp) = ALT(s, r)
    50   def | (r: Rexp) = ALT(s, r)
    51   def | (r: String) = ALT(s, r)
    51   def | (r: String) = ALT(s, r)
    52   def % = STAR(s)
    52   def % = STAR(s)
    53   def ~ (r: Rexp) = SEQ(s, r)
    53   def ~ (r: Rexp) = SEQ(s, r)
    54   def ~ (r: String) = SEQ(s, r)
    54   def ~ (r: String) = SEQ(s, r)