Commit fa0ad8b5 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

Improved the output of help commands in the interactive acg program

parent d74784ed
; -*-org-*-
* BUG
+ BUG dans le parsing (essayer avec dstag-discourse-grammar.acg r540
et dstag-clausal-grammar.acg r539 et dstag-tag-discourse-script
r541):
+ tag_discourse parse Fred + est + de +mauvaise + humeur + parce + que + Fred + a +perdu + les+clefs:DU;
* Général
** Avant Prochaine release
......@@ -16,6 +10,7 @@
+ [X] modifier la documentation
+ [ ] remove useless reduction.* files (hint: the useful one is in the
acg-data directory)
+ [ ] améliorer le pretty-printing des termes
** DONE Faire un Bolt package
......
......@@ -162,6 +162,15 @@ fi
AC_MSG_RESULT(Bolt log level is $BOLT_LEVEL.)
# Look for ANSITerminal with ocamlfind
AC_ARG_VAR(ANSITerminal_PATH,[Directory where to find the ANSITerminal library if not in a standard location])
AC_LIB_CHECKING(ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,"unix.cma",true,$ANSITerminal_PATH)
if test "$FOUND_LIB" != "no" ; then
AC_SUBST(ANSITerminal_INCLUDE,$LIB_INCLUDE)
fi
# What is the OCAML version ?
# we extract Ocaml version number
OCAML_VERSION=`$OCAMLC -version`
......
......@@ -591,6 +591,8 @@ OCAMLP4_LOC
OCAML09WARNINGS
TYPES
CAMLP4_LIB
ANSITerminal_INCLUDE
ANSITerminal_PATH
BOLT_LEVEL
BOLT_PP
BOLT_LIB
......@@ -662,7 +664,8 @@ host_alias
target_alias
DYPGEN_PATH
DYPGENLIB_PATH
BOLTLIB_PATH'
BOLTLIB_PATH
ANSITerminal_PATH'
# Initialize some variables set by options.
......@@ -1283,6 +1286,9 @@ Some influential environment variables:
BOLTLIB_PATH
Directory where to find the bolt library if not in a standard
location
ANSITerminal_PATH
Directory where to find the ANSITerminal library if not in a
standard location
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
......@@ -2854,6 +2860,176 @@ fi
$as_echo "Bolt log level is $BOLT_LEVEL." >&6; }
# Look for ANSITerminal with ocamlfind
MACRO="A"
MACRO=$MACRO"C_LIB_CHECKING"
NAME=ANSITerminal
STD_FOLDER=ANSITerminal
LIB_FILE=ANSITerminal
OFIND_NAME=ANSITerminal
OPAM_PACKAGE=ANSITerminal
MOD=ANSITerminal
OPTIONS="unix.cma"
NO_OPTIONAL=true
LIB_PATH=$ANSITerminal_PATH
# test au cas ou un argument obligatoire est manquant
if test "$NAME" = "" || test "$STD_FOLDER" = "" || test "$OFIND_NAME" = "" || test "$LIB_FILE" = "" || test "$MOD" = "" ; then
echo ""
echo "Can't check a library"
echo "Missing argument in $MACRO($NAME,$STD_FOLDER,$OFIND_NAME,$LIB_FILE,$MOD,$OPTIONS,$NO_OPTIONAL)"
echo ""
exit 1
fi
# affichage du nom de la librairie a checker (avec details sur l'optionalité)
if test "$NO_OPTIONAL" = true; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for requested library : $NAME" >&5
$as_echo_n "checking for requested library : $NAME... " >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for optional library : $NAME" >&5
$as_echo_n "checking for optional library : $NAME... " >&6; }
fi
# si le fichier ml de test existe
if test -f c_check_$STD_FOLDER.ml ; then
# si on peut le supprimer
if test -w c_check_$STD_FOLDER.ml ; then
# on le supprimer
rm c_check_$STD_FOLDER.ml >& /dev/null
# sinon on arrete et on balance un message d'erreur (ie on a pas les droits sur le fichier
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Cannot remove c_check_ANSITerminal.ml. Please change its right with chmod 666 c_check_ANSITerminal.ml
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
# on prepare le fichier ml de test
echo "open $MOD;;" > c_check_$STD_FOLDER.ml
# définition de la variable disant si on a trouvé la librairie ou pas
FOUND_LIB="no"
if test -n "$LIB_PATH" ; then
LIB_INCLUDE="-I $LIB_PATH"
# on teste maintenant si on peut exectuer le fichier ml de test
if ($OCAMLC -c $OPTIONS $LIB_INCLUDE $LIB_FILE.cma c_check_$STD_FOLDER.ml >& /dev/null) ; then
# on y arrive, on dit qu'on a trouvé la lib avec la variable d'environnement
FOUND_LIB=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Found with the environment variable => $LIB_INCLUDE" >&5
$as_echo "Found with the environment variable => $LIB_INCLUDE" >&6; }
fi
fi
if test "$FOUND_LIB" = "no" ; then
# si on arrive à l'executer avec la librairie dans le rep de lib de caml
if ($OCAMLC -c $OPTIONS c_check_$STD_FOLDER.ml >& /dev/null) ; then
# pas besoin d'include
LIB_INCLUDE=""
LIB_DIR=`$OCAMLC -where`
FOUND_LIB=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Found in ocaml lib directory" >&5
$as_echo "Found in ocaml lib directory" >&6; }
fi
fi
# sinon on essaie avec un repertoire dedié à la lib (-I +xxx yyy.cma)
if test "$FOUND_LIB" = "no" ; then
if ($OCAMLC -c $OPTIONS -I +$STD_FOLDER $LIB_FILE.cma c_check_$STD_FOLDER.ml >& /dev/null) ; then
# si ca marche, on s'arrete et on precise le include
LIB_INCLUDE="-I +$STD_FOLDER"
LIB_DIR=`$OCAMLC -where`
LIB_DIR="$LIB_DIR/$STD_FOLDER"
FOUND_LIB=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Found in $STD_FOLDER directory => $LIB_INCLUDE" >&5
$as_echo "Found in $STD_FOLDER directory => $LIB_INCLUDE" >&6; }
fi
fi
# sinon, on essaie avec ocamlfind
if test "$FOUND_LIB" = "no" ; then
# si on n'a pas ocamlfind , on s'arrete (dans le cas d'une lib oblig.) ou
# on lance un warning (dans le cas d'une lib optionelle)
if test "$OCAMLFIND" != "no" ; then
echo testing with $OCAMLFIND
# on regarde déjà si la lib est installée avec ocamlfind
if $OCAMLFIND query $OFIND_NAME > /dev/null 2>&1 ; then
# si c'est le cas, on recupere le repertoire d'installation et le include correspondant
LIB_INCLUDE=`$OCAMLFIND query $OFIND_NAME`
LIB_INCLUDE="-I $LIB_INCLUDE"
# on teste maintenant si on peut exectuer le fichier ml de test
if ($OCAMLC -c $OPTIONS $LIB_INCLUDE $LIB_FILE.cma c_check_$STD_FOLDER.ml >& /dev/null) ; then
# on y arrive, on dit qu'on a trouvé la lib avec ocamlfind
FOUND_LIB=yes
LIB_DIR=`$OCAMLFIND query $OFIND_NAME`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Found with $OCAMLFIND => $LIB_INCLUDE" >&5
$as_echo "Found with $OCAMLFIND => $LIB_INCLUDE" >&6; }
fi
fi
fi
fi
if test "$FOUND_LIB" = "no" ; then
# si opam est installé, on essaye dans la lib de opam
if test "$OPAM$" != "no" ; then
if test "$OPAM config var $OPAM_PACKAGE:installed" = "true" ; then
OPAM_OCAML_VERSION=`opam config var ocaml-version`
OCAML_VERSION=`$OCAMLC -version`
if test "$OPAM_OCAML_VERSION" = "$OCAML_VERSION" ; then
LIB_INCLUDE=`$OPAM config var lib`
LIB_INCLUDE="-I $LIB_INCLUDE/$STD_FOLDER"
# on teste maintenant si on peut exectuer le fichier ml de test
if ($OCAMLC -c $OPTIONS $LIB_INCLUDE $LIB_FILE.cma c_check_$STD_FOLDER.ml >& /dev/null) ; then
# on y arrive, on dit qu'on a trouvé la lib avec opam
FOUND_LIB=yes
LIB_DIR=`$OPAM config var lib`
LIB_DIR="$LIB_DIR/$STD_FOLDER"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Found with $OPAM => $LIB_INCLUDE" >&5
$as_echo "Found with $OPAM => $LIB_INCLUDE" >&6; }
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: There is an opam installation of the library" >&5
$as_echo "There is an opam installation of the library" >&6; }
fi
fi
fi
fi
if test "$FOUND_LIB" = "no" ; then
# suivant l'optionalité de la lib: un warning ou une erreur
if test "$NO_OPTIONAL" = "true"; then
as_fn_error $? "The $NAME library is missing." "$LINENO" 5
LIB_INCLUDE="no"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: The $NAME library is missing." >&5
$as_echo "The $NAME library is missing." >&6; }
LIB_INCLUDE="no"
fi
fi
# suppression du fichier ml de test
rm c_check_$STD_FOLDER.ml >& /dev/null
rm c_check_$STD_FOLDER.cmo >& /dev/null
rm c_check_$STD_FOLDER.cmi >& /dev/null
if test "$FOUND_LIB" != "no" ; then
ANSITerminal_INCLUDE=$LIB_INCLUDE
fi
# What is the OCAML version ?
# we extract Ocaml version number
OCAML_VERSION=`$OCAMLC -version`
......
......@@ -26,12 +26,12 @@ include ../Makefile.master
###############################
# Used libraries
LIBS += dyp.cma str.cma
LIBS += dyp.cma str.cma ANSITerminal.cma
# The corresponding directories
# (if not in the main ocaml lib directory,
# ex. -I +campl4
LIBDIR += @DYPGEN_INCLUDE@
LIBDIR += @DYPGEN_INCLUDE@ @ANSITerminal_INCLUDE@
# Directories to which the current source files depend on
PREVIOUS_DIRS = ../utils ../datalog.prover ../logic ../grammars ../acg-data
......
......@@ -44,7 +44,7 @@ module P = Script_parser.Make(E)
let welcome_msg =
Printf.sprintf
"\n\t\t\tWelcome to the ACG toplevel\n\t\t\t Version %s\n\t\t\t\tINRIA 2008\nPlease send your comments or bug reports or featrure requests to sylvain.pogodalla@loria.fr\n\n\nType\n\t\thelp ;\nto get help.\n\n\n\n"
"\n\t\t\tWelcome to the ACG toplevel\n\t\t\t Version %s\n\t\t\t\t©INRIA 2008-2014\nPlease send your comments or bug reports or featrure requests to sylvain.pogodalla@inria.fr\n\n\nType\n\t\thelp ;\nto get help.\n\n\n\n"
Version.version
......@@ -53,16 +53,22 @@ let env = ref E.empty
let anon_fun s = env := P.parse_file s !dirs !env
let _ =
let () = Arg.parse options anon_fun usg_msg in
let () = Printf.printf "%s%!" welcome_msg in
(* ANSITerminal get the size info from stdin In case of redirection,
the latter may not be set. That's why it is first duplicated and
stdin is then duplicated from stdout *)
let stdin_tmp=Unix.dup Unix.stdin in
let stdin_tmp_in_ch = Unix.in_channel_of_descr stdin_tmp in
let () = Unix.dup2 Unix.stdout Unix.stdin in
let () = Arg.parse options anon_fun usg_msg in
let continue = ref true in
let () =
while !continue do
try
env := P.parse_entry !dirs !env
env := P.parse_entry stdin_tmp_in_ch !dirs !env
with
| End_of_file
| Sys.Break -> continue := false
| End_of_file
| Sys.Break -> continue := false
done in
Printf.printf "\n%!"
Printf.printf "\n%!"
This diff is collapsed.
......@@ -19,6 +19,10 @@
open Environment
val info : Unix.file_descr -> string -> unit
module type Action_sig =
sig
......
......@@ -38,12 +38,18 @@ type token =
| TRACE
| PRINT of Abstract_syntax.location
| ANALYSE of (string*Abstract_syntax.location*string)
| ANALYSE_HELP
| CHECK of (string*Abstract_syntax.location*string)
| CHECK_HELP
| REALIZE of (string*Abstract_syntax.location*string)
| REALIZE_HELP
| PARSE of (string*Abstract_syntax.location*string)
| PARSE_HELP
| IDB of Abstract_syntax.location
| QUERY of (string*Abstract_syntax.location*string)
| QUERY_HELP
| ADD of (string*Abstract_syntax.location*string)
| ADD_HELP
| COMPOSE
| SEMICOLONN of string
| AS
......@@ -55,6 +61,7 @@ type token =
| CREATE_LEX
| CREATE_HELP
| SAVE of (string*Abstract_syntax.location*string)
| SAVE_HELP
let loc lexbuf = Lexing.lexeme_start_p lexbuf,Lexing.lexeme_end_p lexbuf
......@@ -73,6 +80,10 @@ type token =
else
failwith "Bug: matched string expected"
let extract = function
| None -> "help"
| Some x -> x
let add_space () =
let () = if !space_added then () else Buffer.add_char echo_content ' ' in
space_added := false
......@@ -92,6 +103,8 @@ let newline = ('\010' | '\013' | "\013\010")
let letter = ['a'-'z' 'A'-'Z']
let digit = ['0'-'9']
let string = (letter|digit|'_')*
let skip_space = ([' ' '\t' '\n'])*
let help_command = skip_space "help" skip_space ";"
rule lexer =
......@@ -110,36 +123,60 @@ let string = (letter|digit|'_')*
| "help" as c {let () = echo_str c in HELP}
| "print" as c {let () = echo_str c in PRINT (loc lexbuf)}
| "analyse" as c {let () = echo_str c in let () = Buffer.reset string_content in
string (fun x l -> ANALYSE (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
optional_string (fun x l -> match x with
| None -> ANALYSE_HELP
| Some x -> ANALYSE (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "check" as c {let () = echo_str c in let () = Buffer.reset string_content in
string (fun x l -> CHECK (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
optional_string (fun x l -> match x with
| None -> CHECK_HELP
| Some x -> CHECK (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "realize" as c {let () = echo_str c in let () = Buffer.reset string_content in
string (fun x l -> REALIZE (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
optional_string (fun x l -> match x with
| None -> REALIZE_HELP
| Some x -> REALIZE (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "parse" as c {let () = echo_str c in let () = Buffer.reset string_content in
string (fun x l -> PARSE (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
optional_string (fun x l -> match x with
| None -> PARSE_HELP
| Some x -> PARSE (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "idb" as c {let () = echo_str c in IDB (loc lexbuf)}
| "query" as c {let () = echo_str c in let () = Buffer.reset string_content in
string (fun x l -> QUERY (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
optional_string (fun x l -> match x with
| None -> QUERY_HELP
| Some x -> QUERY (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "add" as c {let () = echo_str c in let () = Buffer.reset string_content in
string_wo_space (fun x l -> ADD (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
optional_string_wo_space (fun x l -> match x with
| None -> ADD_HELP
| Some x -> ADD (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "compose" as c {let () = echo_str c in COMPOSE}
| "don't" as c {let () = echo_str c in DONT}
| "wait" as c {let () = echo_str c in WAIT}
| "as" as c {let () = echo_str c in AS}
| "save" as c {let () = echo_str c in let () = Buffer.reset string_content in
string_wo_space (fun x l -> SAVE (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
optional_string_wo_space (fun x l -> match x with
| None -> SAVE_HELP
| Some x -> SAVE (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| letter string as c {let () = echo_str c in IDENTT (Lexing.lexeme lexbuf,loc lexbuf)}
| _ {raise (Scripting_errors.Error (Scripting_errors.Command_expected,loc lexbuf))}
and comment f_parser = parse
| newline {let () = Error.update_loc lexbuf None in f_parser lexbuf}
| _ {comment f_parser lexbuf}
and optional_string f = parse
| [' ' '\t'] {optional_string f lexbuf}
| "help" {let () = echo_str ("help") in
f None (loc lexbuf)}
| _ as c {let () = Buffer.add_char string_content c in string f lexbuf}
and string f = parse
| ";" {f (Buffer.contents string_content) (loc lexbuf)}
| ";" {f (Some (Buffer.contents string_content)) (loc lexbuf)}
| "#" {comment (string f) lexbuf}
| newline {let () = Error.update_loc lexbuf None in string f lexbuf}
| _ as c {let () = Buffer.add_char string_content c in string f lexbuf}
and optional_string_wo_space f = parse
| [' ' '\t'] {optional_string f lexbuf}
| "help" {let () = echo_str ("help") in
f None (loc lexbuf)}
| _ as c {let () = Buffer.add_char string_content c in string_wo_space f lexbuf}
and string_wo_space f = parse
| ";" {f (Buffer.contents string_content) (loc lexbuf)}
| ";" {f (Some (Buffer.contents string_content)) (loc lexbuf)}
| "#" {comment (string_wo_space f) lexbuf}
| [' ' '\t'] {string_wo_space f lexbuf}
| newline {let () = Error.update_loc lexbuf None in string_wo_space f lexbuf}
......@@ -151,23 +188,29 @@ let string = (letter|digit|'_')*
| "help" {LOAD_HELP}
| "#" {comment load_options lexbuf}
| "data" as c {let () = echo_str c in let () = Buffer.reset string_content in
string_wo_space (fun x l -> LOAD_DATA (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
string_wo_space (fun x l ->
let x = extract x in LOAD_DATA (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "d" as c {let () = echo_chr c in let () = Buffer.reset string_content in
string_wo_space (fun x l -> LOAD_DATA (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
string_wo_space (fun x l ->
let x = extract x in LOAD_DATA (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "object" as c {let () = echo_str c in let () = Buffer.reset string_content in
string_wo_space (fun x l -> LOAD_OBJECT (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
string_wo_space (fun x l ->
let x = extract x in LOAD_OBJECT (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "o" as c {let () = echo_chr c in let () = Buffer.reset string_content in
string_wo_space (fun x l -> LOAD_OBJECT (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
string_wo_space (fun x l ->
let x = extract x in LOAD_OBJECT (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "script" as c {let () = echo_str c in let () = Buffer.reset string_content in
string_wo_space (fun x l -> LOAD_SCRIPT (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
string_wo_space (fun x l ->
let x = extract x in LOAD_SCRIPT (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| "s" as c {let () = echo_chr c in let () = Buffer.reset string_content in
string_wo_space (fun x l -> LOAD_SCRIPT (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
string_wo_space (fun x l ->
let x = extract x in LOAD_SCRIPT (strip_trailing_space x,l,let () = echo_str (x^";") in reset_echo ())) lexbuf}
| _ {raise (Scripting_errors.Error (Scripting_errors.Missing_option Scripting_errors.Load,loc lexbuf))}
and create_options = parse
| [' ' '\t'] {create_options lexbuf}
| "help" {CREATE_HELP}
| newline {let () = Error.update_loc lexbuf None in create_options lexbuf}
| eof {EOII}
| "help" {CREATE_HELP}
| "#" {comment create_options lexbuf}
| "s" as c {let () = echo_chr c in let () = Buffer.reset string_content in CREATE_SIG}
| "sig" as c {let () = echo_str c in let () = Buffer.reset string_content in CREATE_SIG}
......
......@@ -58,13 +58,19 @@
HELP
<Abstract_syntax.Abstract_syntax.location>PRINT
<(string*Abstract_syntax.Abstract_syntax.location*string)>ANALYSE
ANALYSE_HELP
<(string*Abstract_syntax.Abstract_syntax.location*string)>CHECK
CHECK_HELP
<(string*Abstract_syntax.Abstract_syntax.location*string)>REALIZE
REALIZE_HELP
<(string*Abstract_syntax.Abstract_syntax.location*string)>PARSE
PARSE_HELP
<Abstract_syntax.Abstract_syntax.location>IDB
<(string*Abstract_syntax.Abstract_syntax.location*string)>QUERY
QUERY_HELP
<(string*Abstract_syntax.Abstract_syntax.location*string)>ADD
COMPOSE
ADD_HELP
<string>SEMICOLONN
AS
DONT
......@@ -74,6 +80,7 @@
CREATE_LEX
CREATE_HELP
<(string*Abstract_syntax.Abstract_syntax.location*string)>SAVE
SAVE_HELP
%start <(E.t)> zzcommands
......@@ -174,6 +181,18 @@
| HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help None) in e}
| all_commands<c> HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some c)) in e}
| LOAD_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Load)) in e}
| LOAD_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Load)) in e}
| ANALYSE_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Analyse)) in e}
| REALIZE_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Realize)) in e}
| CHECK_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Check)) in e}
| PARSE_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Parse)) in e}
| QUERY_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Query)) in e}
| SAVE_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Save)) in e}
| ADD_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Add)) in e}
| CREATE_HELP SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> let () = F.help (F.Help (Some F.Create)) in e}
| CREATE_SIG IDENTT<n> SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> F.create_sig n e}
| CREATE_LEX IDENTT<n> IDENTT<n1> IDENTT<n2> SEMICOLONN<l> {let () = echo dyp.global_data l in fun e -> F.create_lex ~abs:n1 ~obj:n2 n e}
| optional_idents<names> SAVE<filename,l,line> { let () = echo dyp.global_data line in fun e ->
......@@ -191,9 +210,15 @@
| DONT TRACE {F.Dont_trace}
| PRINT {F.Print}
| ANALYSE {F.Analyse}
| CHECK {F.Check}
| REALIZE {F.Realize}
| PARSE {F.Parse}
| IDB {F.Idb}
| QUERY {F.Query}
| ADD {F.Add}
| COMPOSE {F.Compose}
| HELP {F.Help None}
| SAVE {F.Save}
optional_ident :
......@@ -243,13 +268,18 @@
let is_fully_commented_line s = Str.string_match commented_regexp s 0
let bufferize () =
let read_line_from_in_ch in_ch =
let () = flush stdout in
input_line in_ch
let bufferize in_ch =
let () = Printf.printf "# " in
let buf = Buffer.create 16 in
let no_semi_colon=ref true in
let () =
while !no_semi_colon do
let input = read_line () in
let input = read_line_from_in_ch in_ch in
if not (is_fully_commented_line input) then
try
let semi_colon_index=String.index input ';' in
......@@ -267,8 +297,8 @@
let parse_entry ?(verbose=true) includes env =
let in_str = bufferize () in
let parse_entry ?(verbose=true) in_ch includes env =
let in_str = bufferize in_ch in
let lexbuf = Lexing.from_string in_str in
let new_env=
try
......@@ -301,7 +331,7 @@ end}
val parse_file : ?verbose:bool -> string -> string list -> E.t -> E.t
val parse_entry : ?verbose:bool -> string list -> E.t -> E.t
val parse_entry : ?verbose:bool -> in_channel -> string list -> E.t -> E.t
}
%mli{end}
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