equal
deleted
inserted
replaced
74 //============ |
74 //============ |
75 |
75 |
76 // the optional regular expression (one or zero times) |
76 // the optional regular expression (one or zero times) |
77 def OPT(r: Rexp) = ALT(r, ONE) // r + 1 |
77 def OPT(r: Rexp) = ALT(r, ONE) // r + 1 |
78 |
78 |
79 // the n-times regular expression (explicitly expanded) |
79 // the n-times regular expression (explicitly expanded to SEQs) |
80 def NTIMES(r: Rexp, n: Int) : Rexp = n match { |
80 def NTIMES(r: Rexp, n: Int) : Rexp = n match { |
81 case 0 => ONE |
81 case 0 => ONE |
82 case 1 => r |
82 case 1 => r |
83 case n => SEQ(r, NTIMES(r, n - 1)) |
83 case n => SEQ(r, NTIMES(r, n - 1)) |
84 } |
84 } |