From 6b649aba925b6f7462da07599fe67ebb12a3460e Mon Sep 17 00:00:00 2001 From: Samuel Mimram Date: Wed, 28 Jul 2004 21:54:47 +0000 Subject: Imported Upstream version 8.0pl1 --- ide/config_lexer.mll | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 ide/config_lexer.mll (limited to 'ide/config_lexer.mll') diff --git a/ide/config_lexer.mll b/ide/config_lexer.mll new file mode 100644 index 00000000..1c0720d1 --- /dev/null +++ b/ide/config_lexer.mll @@ -0,0 +1,68 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* s)) } + | _ { let c = lexeme_start lexbuf in + eprintf ".coqiderc: invalid character (%d)\n@." c; + token lexbuf } + | eof { EOF } + +and string = parse + | '"' { Buffer.add_char string_buffer '"' } + | '\\' '"' | _ + { Buffer.add_string string_buffer (lexeme lexbuf); string lexbuf } + | eof { eprintf ".coqiderc: unterminated string\n@." } + +{ + + let load_file f = + let c = open_in f in + let lb = from_channel c in + let m = Config_parser.prefs token lb in + close_in c; + m + + let print_file f m = + let c = open_out f in + let fmt = formatter_of_out_channel c in + let rec print_list fmt = function + | [] -> () + | s :: sl -> fprintf fmt "%S@ %a" s print_list sl + in + Stringmap.iter + (fun k s -> fprintf fmt "@[%s = %a@]@\n" k print_list s) m; + fprintf fmt "@."; + close_out c + +} -- cgit v1.2.3