progs/lexer/lexer.sc
changeset 971 51e00f223792
parent 970 1d4659dd83fe
equal deleted inserted replaced
970:1d4659dd83fe 971:51e00f223792
    41   case c::s => SEQ(CHAR(c), charlist2rexp(s))
    41   case c::s => SEQ(CHAR(c), charlist2rexp(s))
    42 }
    42 }
    43 
    43 
    44 given Conversion[String, Rexp] = (s => charlist2rexp(s.toList))
    44 given Conversion[String, Rexp] = (s => charlist2rexp(s.toList))
    45 
    45 
       
    46 //extension (s: String) {
       
    47 //  def $ (r: Rexp) = RECD(s, r)
       
    48 //}
    46 extension (s: String) {
    49 extension (s: String) {
    47   def $ (r: Rexp) = RECD(s, r)
    50   def $ (r: Rexp) = RECD(s, r)
    48 }
    51   def | (r: Rexp) = ALT(s, r)
       
    52   def | (r: String) = ALT(s, r)
       
    53   def % = STAR(s)
       
    54   def ~ (r: Rexp) = SEQ(s, r)
       
    55   def ~ (r: String) = SEQ(s, r)
       
    56 }
       
    57  
    49 
    58 
    50 extension (r: Rexp) {
    59 extension (r: Rexp) {
    51   def | (s: Rexp) = ALT(r, s)
    60   def | (s: Rexp) = ALT(r, s)
    52   def % = STAR(r)
    61   def % = STAR(r)
    53   def ~ (s: Rexp) = SEQ(r, s)
    62   def ~ (s: Rexp) = SEQ(r, s)