From: Mart Lubbers Date: Sat, 12 Mar 2016 16:38:51 +0000 (+0100) Subject: added command line option for selftest, still needs to implement X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=dd9529f0ce7864e2bf6df4e4973bd2af068985a0;p=cc1516.git added command line option for selftest, still needs to implement --- diff --git a/spl.icl b/spl.icl index 893d699..0a3f197 100644 --- a/spl.icl +++ b/spl.icl @@ -24,6 +24,7 @@ from yard import :: Error, instance toString Error program :: String, lex :: Bool, parse :: Bool, + selftest :: Bool, fp :: Maybe String, help :: Bool} @@ -49,6 +50,7 @@ Start w <<< " --version Show the version\n" <<< " --[no-]lex Lexer output(default: disabled)\n" <<< " --[no-]parse Parser output(default: enabled)\n" + <<< " --[no-]selftest Feed pprint parse back(default: disabled)\n" = snd $ fclose stdin w # (contents, stdin, w) = readFileOrStdin stdin args.fp w = case contents of @@ -91,6 +93,8 @@ where pa ["--no-lex":r] o = pa r {o & lex=False} pa ["--parse":r] o = pa r {o & parse=True} pa ["--no-parse":r] o = pa r {o & parse=False} + pa ["--selftest":r] o = pa r {o & selftest=True} + pa ["--no-selftest":r] o = pa r {o & selftest=False} pa [x:r] o = pa r {o & fp=Just x} readFileOrStdin :: *File (Maybe String) *World -> *(Either String [Char], *File, *World)