Debian Codegraph @

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

raw
1 (* options.sml
2 *
3 * COPYRIGHT (c) 2006
4 * Aaron Turon ([email protected])
5 * All rights reserved.
6 *
7 * Command-line options for ml-ulex
8 *)
9
10 structure Options =
11 struct
12
13 exception Usage of string
14
15 datatype be_mode = BySize | TableBased | FnBased
16
17 val fname : string ref = ref ""
18 val lexCompat : bool ref = ref false
19 val dump : bool ref = ref false
20 val dot : bool ref = ref false
21 val match : bool ref = ref false
22 val beTest : bool ref = ref false
23 val minimize : bool ref = ref false
24 val beMode : be_mode ref = ref BySize
25 val strictSML : bool ref = ref false
26
27 fun procArg arg = (case arg
28 of "--dot" => dot := true
29 | "--dump" => dump := true
30 | "--match" => match := true
31 | "--testbe" => beTest := true
32 | "--ml-lex-mode" => lexCompat := true
33 | "--minimize" => minimize := true
34 | "--table-based" => beMode := TableBased
35 | "--fn-based" => beMode := FnBased
36 | "--strict-sml" => strictSML := true
37 | file =>
38 if String.isPrefix "--" file
39 then raise Usage(concat["Unrecognized option '", file, "'"])
40 else if String.size (!fname) > 0
41 then raise Usage "Only one input file may be specified"
42 else fname := file
43 (* end case *))
44
45 (* the arguments *)
46 val args = "[--dot] [--dump] [--match] [--ml-lex-mode] [--minimize] [--table-based] [--fn-based] [--strict-sml]"
47
48 end