175 | 175 |
parsePragma text =
|
176 | 176 |
case consumeWords ["Tests", "for"] text of
|
177 | 177 |
Just rest ->
|
178 | |
tryFunctionalities functionalities rest
|
|
178 |
TestsFor $ tryFunctionalities functionalities rest
|
179 | 179 |
Nothing ->
|
180 | 180 |
case consumeWords ["Functionality"] text of
|
181 | 181 |
Just rest ->
|
|
201 | 201 |
let
|
202 | 202 |
(moduleName, functionName) = parseSpecifier specifier
|
203 | 203 |
in
|
204 | |
Just $ TestsFor $ HaskellTest moduleName functionName
|
|
204 |
Just $ HaskellTest moduleName functionName
|
205 | 205 |
Nothing ->
|
206 | 206 |
Nothing
|
207 | 207 |
|
208 | 208 |
parseShellFunctionality text =
|
209 | 209 |
case consumeWords ["shell", "command"] text of
|
210 | 210 |
Just specifier ->
|
211 | |
Just $ TestsFor $ ShellTest $ parseQuotedString specifier
|
|
211 |
let
|
|
212 |
(command, _) = parseQuotedString specifier
|
|
213 |
in
|
|
214 |
Just $ ShellTest command
|
212 | 215 |
Nothing ->
|
213 | 216 |
Nothing
|
214 | 217 |
|
|
220 | 223 |
|
221 | 224 |
parseFuncDefn text =
|
222 | 225 |
let
|
223 | |
x = parseQuotedString text
|
224 | |
-- XXX wow, so incomplete
|
225 | |
in
|
226 | |
FunctionalityDefinition text $ HaskellTest "GUH" ""
|
|
226 |
(name, rest) = parseQuotedString text
|
|
227 |
in
|
|
228 |
case consumeWords ["is", "implemented", "by"] rest of
|
|
229 |
Just funky ->
|
|
230 |
let
|
|
231 |
functionality = tryFunctionalities functionalities funky
|
|
232 |
in
|
|
233 |
FunctionalityDefinition text functionality
|
|
234 |
Nothing ->
|
|
235 |
error $ "bad functionality definition: " ++ text
|
|
236 |
|
227 | 237 |
|
228 | 238 |
parseQuotedString ('"':rest) =
|
229 | 239 |
parseQuotedString' rest
|
|
231 | 241 |
error $ "bad quoted string: " ++ str
|
232 | 242 |
|
233 | 243 |
parseQuotedString' ('"':rest) =
|
234 | |
""
|
|
244 |
("", rest)
|
235 | 245 |
parseQuotedString' (char:rest) =
|
236 | |
(char:parseQuotedString' rest)
|
|
246 |
let
|
|
247 |
(next, remainder) = parseQuotedString' rest
|
|
248 |
in
|
|
249 |
(char:next, remainder)
|
237 | 250 |
|
238 | 251 |
consumeWords [] text =
|
239 | 252 |
Just $ stripLeadingWhitespace text
|