equal
deleted
inserted
replaced
61 |
61 |
62 // main matcher function |
62 // main matcher function |
63 def matcher(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r)) |
63 def matcher(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r)) |
64 |
64 |
65 |
65 |
|
66 var regex = NTIMES(CHAR('a'),5) |
|
67 println(matcher(regex,"aaaaa")) |
|
68 |
66 //one or zero |
69 //one or zero |
67 def OPT(r: Rexp) = ALT(r, ONE) |
70 def OPT(r: Rexp) = ALT(r, ONE) |
68 |
71 |
69 //evil regular expressions |
72 //evil regular expressions |
70 def EVIL1(n: Int) = SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n)) |
73 def EVIL1(n: Int) = SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n)) |