solutions/cw1/matcher.sc
author Christian Urban <christian.urban@kcl.ac.uk>
Sun, 29 Sep 2024 18:46:02 +0100
changeset 965 94f5cce73a4f
parent 919 53f08d873e09
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
864
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
919
53f08d873e09 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 894
diff changeset
     2
println("===========================")
864
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
919
53f08d873e09 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 894
diff changeset
     4
//import $file.cw1
53f08d873e09 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 894
diff changeset
     5
//import cw1._
53f08d873e09 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 894
diff changeset
     6
import CW1._ 
864
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
919
53f08d873e09 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 894
diff changeset
     8
/*
864
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
val Regex31 = NTIMES(CHAR('a'),3)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
val Regex32 = NTIMES(OPTIONAL(CHAR('a')),3)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
val Regex33 = UPTO(CHAR('a'),3)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
val Regex34 = UPTO(OPTIONAL(CHAR('a')),3)
919
53f08d873e09 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 894
diff changeset
    13
val Regex35 = NMTIMES(CHAR('a'),3,5)
53f08d873e09 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 894
diff changeset
    14
val Regex36 = NMTIMES(OPTIONAL(CHAR('a')),3,5)
864
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
val string31 = ""
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
val string32 = "a"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
val string33 = "aa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
val string34 = "aaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
val string35 = "aaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
val string36 = "aaaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
val string37 = "aaaaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
println("Question3")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    25
println(matcher(Regex31, string31))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    26
println(matcher(Regex31, string32))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    27
println(matcher(Regex31, string33))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    28
println(matcher(Regex31, string34))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    29
println(matcher(Regex31, string35))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    30
println(matcher(Regex31, string36))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    31
println(matcher(Regex31, string37)); println("")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    32
println(matcher(Regex32, string31))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    33
println(matcher(Regex32, string32))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    34
println(matcher(Regex32, string33))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    35
println(matcher(Regex32, string34))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    36
println(matcher(Regex32, string35))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    37
println(matcher(Regex32, string36))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    38
println(matcher(Regex32, string37)); println("")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    39
println(matcher(Regex33, string31))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    40
println(matcher(Regex33, string32))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    41
println(matcher(Regex33, string33))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    42
println(matcher(Regex33, string34))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    43
println(matcher(Regex33, string35))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    44
println(matcher(Regex33, string36))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    45
println(matcher(Regex33, string37)); println("")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    46
println(matcher(Regex34, string31))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    47
println(matcher(Regex34, string32))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    48
println(matcher(Regex34, string33))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    49
println(matcher(Regex34, string34))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    50
println(matcher(Regex34, string35))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    51
println(matcher(Regex34, string36))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    52
println(matcher(Regex34, string37)); println("")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    53
println(matcher(Regex35, string31))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    54
println(matcher(Regex35, string32))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    55
println(matcher(Regex35, string33))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    56
println(matcher(Regex35, string34))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    57
println(matcher(Regex35, string35))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    58
println(matcher(Regex35, string36))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    59
println(matcher(Regex35, string37)); println("")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    60
println(matcher(Regex36, string31))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    61
println(matcher(Regex36, string32))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    62
println(matcher(Regex36, string33))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    63
println(matcher(Regex36, string34))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    64
println(matcher(Regex36, string35))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    65
println(matcher(Regex36, string36))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    66
println(matcher(Regex36, string37)); println("")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    67
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    68
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    69
val RegexX = BETWEEN(CHAR('a'), 0, 5)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    70
val stringX = ""
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    71
println(matcher(RegexX, stringX))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    72
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    73
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    74
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    75
val str0 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    76
val str1 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    77
val str2 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    78
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    79
val matchA = (c:Char) => c == 'a'
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    80
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    81
val reg_1 = SEQ(SEQ(CFUN(matchA), CFUN(matchA)), CFUN(matchA))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    82
val reg_2 = SEQ(NTIMES(CFUN(matchA), 19), OPTIONAL(CFUN(matchA)))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    83
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    84
val reg_1_mod = PLUS(PLUS(reg_1))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    85
val reg_2_mod = PLUS(PLUS(reg_2))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    86
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    87
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    88
matcher(reg_1_mod, str0)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    89
matcher(reg_1_mod, str1)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    90
matcher(reg_1_mod, str2)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    91
matcher(reg_2_mod, str0)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    92
matcher(reg_2_mod, str1)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    93
matcher(reg_2_mod, str2)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    94
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    95
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    96
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    97
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    98
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    99
//Q3: matcher test (table)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   100
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   101
// a^{3}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   102
val re1 = NTIMES(CHAR('a'), 3)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   103
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   104
matcher(re1, "")        //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   105
matcher(re1, "a")       //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   106
matcher(re1, "aa")      //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   107
matcher(re1, "aaa")     //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   108
matcher(re1, "aaaaa")   //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   109
matcher(re1, "aaaaaa")  //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   110
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   111
// (a?)^{3}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   112
val re2 = NTIMES(OPTIONAL(CHAR('a')), 3)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   113
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   114
matcher(re2, "")        //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   115
matcher(re2, "a")       //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   116
matcher(re2, "aa")      //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   117
matcher(re2, "aaa")     //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   118
matcher(re2, "aaaaa")   //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   119
matcher(re2, "aaaaaa")  //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   120
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   121
// (a)^{..3}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   122
val re3 = UPTO((CHAR('a')), 3)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   123
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   124
matcher(re3, "")        //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   125
matcher(re3, "a")       //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   126
matcher(re3, "aa")      //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   127
matcher(re3, "aaa")     //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   128
matcher(re3, "aaaaa")   //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   129
matcher(re3, "aaaaaa")  //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   130
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   131
// (a?)^{..3}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   132
val re4 = UPTO(OPTIONAL(CHAR('a')), 3)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   133
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   134
matcher(re4, "")        //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   135
matcher(re4, "a")       //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   136
matcher(re4, "aa")      //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   137
matcher(re4, "aaa")     //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   138
matcher(re4, "aaaaa")   //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   139
matcher(re4, "aaaaaa")  //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   140
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   141
// (a)^{3..5}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   142
val re5 = BETWEEN(CHAR('a'), 3, 5)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   143
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   144
matcher(re5, "")        //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   145
matcher(re5, "a")       //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   146
matcher(re5, "aa")      //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   147
matcher(re5, "aaa")     //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   148
matcher(re5, "aaaaa")   //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   149
matcher(re5, "aaaaaa")  //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   150
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   151
// (a?)^{3..5}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   152
val re6 = BETWEEN(OPTIONAL(CHAR('a')), 3, 5)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   153
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   154
matcher(re6, "")        //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   155
matcher(re6, "a")       //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   156
matcher(re6, "aa")      //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   157
matcher(re6, "aaa")     //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   158
matcher(re6, "aaaaa")   //true
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   159
matcher(re6, "aaaaaa")  //false
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   160
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   161
//Q5: regular expression for email addresses
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   162
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   163
val alphaNum = ('a' to 'z').toSet ++ ('0' to '9')
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   164
val Q5email = SEQ(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   165
                PLUS(RANGE(alphaNum + '_' + '-' + '.')), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   166
                SEQ(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   167
                    CHAR('@'), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   168
                    SEQ(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   169
                        PLUS(RANGE(alphaNum + '-' + '.')), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   170
                        SEQ(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   171
                            CHAR('.'), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   172
                            BETWEEN(RANGE(('a' to 'z').toSet + '.'), 2, 6)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   173
                            )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   174
                      )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   175
                )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   176
              )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   177
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   178
ders("nicolas.volken@kcl.ac.uk".toList, Q5email)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   179
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   180
// Q6
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   181
val Q6 = SEQ(CHAR('/'),
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   182
            SEQ(CHAR('*'),
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   183
                SEQ(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   184
                  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   185
                    NOT(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   186
                      SEQ(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   187
                        STAR(FALL),
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   188
                        SEQ(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   189
                          CHAR('*'),
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   190
                          SEQ(
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   191
                            CHAR('/'),
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   192
                            STAR(FALL)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   193
                          )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   194
                        )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   195
                      )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   196
                    )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   197
                  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   198
                    ,
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   199
                    SEQ(CHAR('*'),
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   200
                    CHAR('/')
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   201
                    )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   202
                )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   203
            )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   204
        )
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   205
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   206
matcher(Q6, "/**/")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   207
matcher(Q6, "/*foobar*/")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   208
matcher(Q6, "/*test*/test*/")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   209
matcher(Q6, "/*test/*test*/")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   210
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   211
// Q7
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   212
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   213
val Q7r1 = SEQ(CHAR('a'), SEQ(CHAR('a'), CHAR('a')))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   214
val Q7r2 = SEQ(BETWEEN(CHAR('a'), 19, 19), OPTIONAL(CHAR('a')))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   215
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   216
val Q7str5 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   217
val Q7str6 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   218
val Q7str7 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   219
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   220
matcher(PLUS(PLUS(Q7r1)), Q7str5)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   221
matcher(PLUS(PLUS(Q7r2)), Q7str5)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   222
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   223
matcher(PLUS(PLUS(Q7r1)), Q7str6)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   224
matcher(PLUS(PLUS(Q7r2)), Q7str6)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   225
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   226
matcher(PLUS(PLUS(Q7r1)), Q7str7)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   227
matcher(PLUS(PLUS(Q7r2)), Q7str7)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   228
919
53f08d873e09 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 894
diff changeset
   229
*/