Commit 59a15ab3 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-10-06 07:52:41 by cvscast] added #help directive to the toplevel

Original author: cvscast
Date: 2003-10-06 07:52:42+00:00
parent 85f4e437
......@@ -57,6 +57,15 @@ let dump_env ppf =
Typer.iter_values !typing_env
(fun x t -> dump_value ppf x t (get_global_value x))
let directive_help ppf =
Format.fprintf ppf
"Toplevel directives:
#quit;; quit the interpreter
#env;; dump current environment
#reinit_ns;; reinitialize namespace processing
#help;; shows this help message
"
let rec print_exn ppf = function
| Location (loc, w, exn) ->
Format.fprintf ppf "Error %a:@." Location.print_loc (loc,w);
......@@ -251,6 +260,9 @@ let rec phrases ppf phs = match phs with
| { descr = Ast.Directive `Reinit_ns } :: rest ->
Typer.set_ns_table_for_printer !typing_env;
phrases ppf rest
| { descr = Ast.Directive `Help } :: rest ->
directive_help ppf;
phrases ppf rest
| [] -> ()
let catch_exn ppf_err = function
......
......@@ -29,6 +29,7 @@ and toplevel_directive =
[ `Quit
| `Env
| `Reinit_ns
| `Help
]
......
......@@ -116,6 +116,7 @@ EXTEND
| DIRECTIVE "#quit" -> [ mk loc (Directive `Quit) ]
| DIRECTIVE "#env" -> [ mk loc (Directive `Env) ]
| DIRECTIVE "#reinit_ns" -> [ mk loc (Directive `Reinit_ns) ]
| DIRECTIVE "#help" -> [ mk loc (Directive `Help) ]
| "include"; s = STRING2 ->
let s =
if Filename.is_relative s
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment