Debian Codegraph @

lib/mllpt-lib/ml-lpt/ml-antlr/options.sml

raw
1 (* options.sml
2 *
3 * COPYRIGHT (c) 2007-2016 Fellowship of SML/NJ
4 *
5 * Processing of command line arguments
6 *)
7
8 structure Options =
9 struct
10
11 val unitActions = ref false
12 val debug = ref false
13 val dotOutput = ref false
14 val texOutput = ref false
15 val fname = ref ""
16
17 (* process the command line arguments; return true if there is an error *)
18 fun processArgs args = let
19 fun procArg "--dot" = (dotOutput := true; false)
20 | procArg "--latex" = (texOutput := true; false)
21 | procArg "--unit-actions" = (unitActions := true; false)
22 | procArg "--debug" = (debug := true; false)
23 | procArg _ = true
24 in
25 case List.filter procArg args
26 of [file] => (fname := file; false)
27 | _ => true (* error: exactly one file should be specified *)
28 (* end case *)
29 end
30
31 (* usage message *)
32 val usage = "usage: ml-antlr [--dot] [--latex] [--unit-actions | --debug] <file>"
33
34 end