diff options
author | Camil Staps | 2015-07-03 23:39:40 +0200 |
---|---|---|
committer | Camil Staps | 2015-07-03 23:41:02 +0200 |
commit | f0ed4df2b0e11ab66966a8395cd7d6d29c7a8efc (patch) | |
tree | ecdfbd232e1710f67c233c3e4281560f0344a10c /LogicParser.icl | |
parent | Installation (diff) |
Latex & Html output options
Diffstat (limited to 'LogicParser.icl')
-rw-r--r-- | LogicParser.icl | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/LogicParser.icl b/LogicParser.icl index 320e2cc..fbf19ef 100644 --- a/LogicParser.icl +++ b/LogicParser.icl @@ -26,12 +26,18 @@ module LogicParser import StdEnv, StdMaybe, ArgEnv, Logic Start -| argc < 1 = abort ("Usage: " +++ argv.[0] +++ " -b -nt <string>\n") -| extended = toString (truthtable (parse argv.[2])) -| otherwise = toString (simple_truthtable_n [parse argv.[n] \\ n <- [1..argc]]) -//| otherwise = toString ((if extended truthtable simple_truthtable) (parse argv.[1])) +| isEmpty exprs = abort ("Usage: " +++ argv.[0] +++ " -b -nt [-e] [-html|-latex] <string>\n") +| otherwise = show outputoption (compute (if extended truthtable_n simple_truthtable_n (map parse exprs))) where argc = size argv - 1 argv = getCommandLine - extended = argv.[1] == "-e" + + exprs = filter (\s . s.[0] <> '-') [argv.[n] \\ n <- [1..argc]] + + extended = hasArg "-e" + outputoption + | hasArg "-html" = Html + | hasArg "-latex" = LaTeX + | otherwise = Plain + hasArg arg = or [arg == argv.[n] \\ n <- [0..argc]] |