From: Ralf Treinen Date: Tue, 30 Sep 2003 19:41:24 +0000 (+0000) Subject: Imported Upstream version 3.07 X-Git-Tag: archive/raspbian/4.08.1-4+rpi1~3^2~63^2~49 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=17dcc03ce76be6068242c86ce1fba62cef2950ce;p=ocaml.git Imported Upstream version 3.07 --- diff --git a/.cvsignore b/.cvsignore index f3ba5343..25b31038 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,7 +1,6 @@ .cvsignore .depend configure -configure_latour ocamlc ocamlc.opt expunge diff --git a/.depend b/.depend index 5b12a5fa..bf99d6fa 100644 --- a/.depend +++ b/.depend @@ -428,8 +428,8 @@ asmcomp/asmlink.cmi: asmcomp/compilenv.cmi asmcomp/clambda.cmi: parsing/asttypes.cmi typing/ident.cmi \ bytecomp/lambda.cmi asmcomp/closure.cmi: asmcomp/clambda.cmi bytecomp/lambda.cmi -asmcomp/cmmgen.cmi: asmcomp/clambda.cmi asmcomp/cmm.cmi asmcomp/cmm.cmi: typing/ident.cmi +asmcomp/cmmgen.cmi: asmcomp/clambda.cmi asmcomp/cmm.cmi asmcomp/codegen.cmi: asmcomp/cmm.cmi asmcomp/comballoc.cmi: asmcomp/mach.cmi asmcomp/compilenv.cmi: asmcomp/clambda.cmi typing/ident.cmi @@ -443,8 +443,8 @@ asmcomp/printlinear.cmi: asmcomp/linearize.cmi asmcomp/printmach.cmi: asmcomp/mach.cmi asmcomp/reg.cmi asmcomp/proc.cmi: asmcomp/mach.cmi asmcomp/reg.cmi asmcomp/reg.cmi: asmcomp/cmm.cmi -asmcomp/reloadgen.cmi: asmcomp/mach.cmi asmcomp/reg.cmi asmcomp/reload.cmi: asmcomp/mach.cmi +asmcomp/reloadgen.cmi: asmcomp/mach.cmi asmcomp/reg.cmi asmcomp/schedgen.cmi: asmcomp/linearize.cmi asmcomp/mach.cmi asmcomp/scheduling.cmi: asmcomp/linearize.cmi asmcomp/selectgen.cmi: asmcomp/arch.cmo asmcomp/cmm.cmi typing/ident.cmi \ @@ -452,8 +452,8 @@ asmcomp/selectgen.cmi: asmcomp/arch.cmo asmcomp/cmm.cmi typing/ident.cmi \ asmcomp/selection.cmi: asmcomp/cmm.cmi asmcomp/mach.cmi asmcomp/spill.cmi: asmcomp/mach.cmi asmcomp/split.cmi: asmcomp/mach.cmi -asmcomp/arch.cmo: utils/misc.cmi -asmcomp/arch.cmx: utils/misc.cmx +asmcomp/arch.cmo: utils/config.cmi utils/misc.cmi +asmcomp/arch.cmx: utils/config.cmx utils/misc.cmx asmcomp/asmgen.cmo: utils/clflags.cmo asmcomp/closure.cmi asmcomp/cmm.cmi \ asmcomp/cmmgen.cmi asmcomp/coloring.cmi asmcomp/comballoc.cmi \ utils/config.cmi asmcomp/emit.cmi asmcomp/emitaux.cmi asmcomp/interf.cmi \ @@ -508,6 +508,8 @@ asmcomp/closure.cmx: parsing/asttypes.cmi asmcomp/clambda.cmx \ utils/clflags.cmx asmcomp/compilenv.cmx typing/ident.cmx \ bytecomp/lambda.cmx utils/misc.cmx typing/primitive.cmx \ bytecomp/switch.cmx utils/tbl.cmx asmcomp/closure.cmi +asmcomp/cmm.cmo: asmcomp/arch.cmo typing/ident.cmi asmcomp/cmm.cmi +asmcomp/cmm.cmx: asmcomp/arch.cmx typing/ident.cmx asmcomp/cmm.cmi asmcomp/cmmgen.cmo: asmcomp/arch.cmo parsing/asttypes.cmi asmcomp/clambda.cmi \ utils/clflags.cmo asmcomp/cmm.cmi asmcomp/compilenv.cmi utils/config.cmi \ typing/ident.cmi bytecomp/lambda.cmi utils/misc.cmi typing/primitive.cmi \ @@ -516,8 +518,6 @@ asmcomp/cmmgen.cmx: asmcomp/arch.cmx parsing/asttypes.cmi asmcomp/clambda.cmx \ utils/clflags.cmx asmcomp/cmm.cmx asmcomp/compilenv.cmx utils/config.cmx \ typing/ident.cmx bytecomp/lambda.cmx utils/misc.cmx typing/primitive.cmx \ asmcomp/proc.cmx bytecomp/switch.cmx typing/types.cmx asmcomp/cmmgen.cmi -asmcomp/cmm.cmo: asmcomp/arch.cmo typing/ident.cmi asmcomp/cmm.cmi -asmcomp/cmm.cmx: asmcomp/arch.cmx typing/ident.cmx asmcomp/cmm.cmi asmcomp/codegen.cmo: asmcomp/cmm.cmi asmcomp/coloring.cmi asmcomp/emit.cmi \ asmcomp/interf.cmi asmcomp/linearize.cmi asmcomp/liveness.cmi \ asmcomp/printcmm.cmi asmcomp/printlinear.cmi asmcomp/printmach.cmi \ @@ -538,16 +538,16 @@ asmcomp/compilenv.cmo: asmcomp/clambda.cmi utils/config.cmi typing/env.cmi \ typing/ident.cmi utils/misc.cmi asmcomp/compilenv.cmi asmcomp/compilenv.cmx: asmcomp/clambda.cmx utils/config.cmx typing/env.cmx \ typing/ident.cmx utils/misc.cmx asmcomp/compilenv.cmi +asmcomp/emit.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/compilenv.cmi \ + utils/config.cmi asmcomp/emitaux.cmi asmcomp/linearize.cmi \ + parsing/location.cmi asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi \ + asmcomp/reg.cmi asmcomp/emit.cmi +asmcomp/emit.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/compilenv.cmx \ + utils/config.cmx asmcomp/emitaux.cmx asmcomp/linearize.cmx \ + parsing/location.cmx asmcomp/mach.cmx utils/misc.cmx asmcomp/proc.cmx \ + asmcomp/reg.cmx asmcomp/emit.cmi asmcomp/emitaux.cmo: asmcomp/emitaux.cmi asmcomp/emitaux.cmx: asmcomp/emitaux.cmi -asmcomp/emit.cmo: asmcomp/arch.cmo utils/clflags.cmo asmcomp/cmm.cmi \ - asmcomp/compilenv.cmi utils/config.cmi asmcomp/emitaux.cmi \ - asmcomp/linearize.cmi parsing/location.cmi asmcomp/mach.cmi \ - utils/misc.cmi asmcomp/proc.cmi asmcomp/reg.cmi asmcomp/emit.cmi -asmcomp/emit.cmx: asmcomp/arch.cmx utils/clflags.cmx asmcomp/cmm.cmx \ - asmcomp/compilenv.cmx utils/config.cmx asmcomp/emitaux.cmx \ - asmcomp/linearize.cmx parsing/location.cmx asmcomp/mach.cmx \ - utils/misc.cmx asmcomp/proc.cmx asmcomp/reg.cmx asmcomp/emit.cmi asmcomp/interf.cmo: asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi \ asmcomp/reg.cmi asmcomp/interf.cmi asmcomp/interf.cmx: asmcomp/mach.cmx utils/misc.cmx asmcomp/proc.cmx \ @@ -584,20 +584,20 @@ asmcomp/proc.cmx: asmcomp/arch.cmx utils/ccomp.cmx utils/clflags.cmx \ asmcomp/reg.cmx asmcomp/proc.cmi asmcomp/reg.cmo: asmcomp/cmm.cmi asmcomp/reg.cmi asmcomp/reg.cmx: asmcomp/cmm.cmx asmcomp/reg.cmi +asmcomp/reload.cmo: asmcomp/reloadgen.cmi asmcomp/reload.cmi +asmcomp/reload.cmx: asmcomp/reloadgen.cmx asmcomp/reload.cmi asmcomp/reloadgen.cmo: asmcomp/mach.cmi utils/misc.cmi asmcomp/reg.cmi \ asmcomp/reloadgen.cmi asmcomp/reloadgen.cmx: asmcomp/mach.cmx utils/misc.cmx asmcomp/reg.cmx \ asmcomp/reloadgen.cmi -asmcomp/reload.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/mach.cmi \ - asmcomp/reg.cmi asmcomp/reloadgen.cmi asmcomp/reload.cmi -asmcomp/reload.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/mach.cmx \ - asmcomp/reg.cmx asmcomp/reloadgen.cmx asmcomp/reload.cmi asmcomp/schedgen.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/linearize.cmi \ asmcomp/mach.cmi utils/misc.cmi asmcomp/reg.cmi asmcomp/schedgen.cmi asmcomp/schedgen.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/linearize.cmx \ asmcomp/mach.cmx utils/misc.cmx asmcomp/reg.cmx asmcomp/schedgen.cmi -asmcomp/scheduling.cmo: asmcomp/schedgen.cmi asmcomp/scheduling.cmi -asmcomp/scheduling.cmx: asmcomp/schedgen.cmx asmcomp/scheduling.cmi +asmcomp/scheduling.cmo: asmcomp/arch.cmo asmcomp/mach.cmi \ + asmcomp/schedgen.cmi asmcomp/scheduling.cmi +asmcomp/scheduling.cmx: asmcomp/arch.cmx asmcomp/mach.cmx \ + asmcomp/schedgen.cmx asmcomp/scheduling.cmi asmcomp/selectgen.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi typing/ident.cmi \ asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi asmcomp/reg.cmi \ utils/tbl.cmi asmcomp/selectgen.cmi @@ -605,10 +605,10 @@ asmcomp/selectgen.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx typing/ident.cmx \ asmcomp/mach.cmx utils/misc.cmx asmcomp/proc.cmx asmcomp/reg.cmx \ utils/tbl.cmx asmcomp/selectgen.cmi asmcomp/selection.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/mach.cmi \ - utils/misc.cmi asmcomp/proc.cmi asmcomp/reg.cmi asmcomp/selectgen.cmi \ + utils/misc.cmi asmcomp/reg.cmi asmcomp/selectgen.cmi \ asmcomp/selection.cmi asmcomp/selection.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/mach.cmx \ - utils/misc.cmx asmcomp/proc.cmx asmcomp/reg.cmx asmcomp/selectgen.cmx \ + utils/misc.cmx asmcomp/reg.cmx asmcomp/selectgen.cmx \ asmcomp/selection.cmi asmcomp/spill.cmo: asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi \ asmcomp/reg.cmi asmcomp/spill.cmi @@ -648,8 +648,6 @@ driver/errors.cmx: bytecomp/bytelibrarian.cmx bytecomp/bytelink.cmx \ typing/typeclass.cmx typing/typecore.cmx typing/typedecl.cmx \ typing/typemod.cmx typing/typetexp.cmx utils/warnings.cmx \ driver/errors.cmi -driver/main_args.cmo: driver/main_args.cmi -driver/main_args.cmx: driver/main_args.cmi driver/main.cmo: bytecomp/bytelibrarian.cmi bytecomp/bytelink.cmi \ bytecomp/bytepackager.cmi utils/clflags.cmo driver/compile.cmi \ utils/config.cmi driver/errors.cmi driver/main_args.cmi utils/misc.cmi \ @@ -658,6 +656,8 @@ driver/main.cmx: bytecomp/bytelibrarian.cmx bytecomp/bytelink.cmx \ bytecomp/bytepackager.cmx utils/clflags.cmx driver/compile.cmx \ utils/config.cmx driver/errors.cmx driver/main_args.cmx utils/misc.cmx \ utils/warnings.cmx driver/main.cmi +driver/main_args.cmo: driver/main_args.cmi +driver/main_args.cmx: driver/main_args.cmi driver/optcompile.cmo: asmcomp/asmgen.cmi utils/ccomp.cmi utils/clflags.cmo \ asmcomp/compilenv.cmi utils/config.cmi typing/env.cmi typing/ident.cmi \ utils/misc.cmi parsing/parse.cmi driver/pparse.cmi parsing/printast.cmi \ diff --git a/Changes b/Changes index 36b8a703..b0cb25c6 100644 --- a/Changes +++ b/Changes @@ -16,14 +16,23 @@ Type-checking: expressions. For instance, if f: unit -> 'a list, "let x = f ()" gives "x" the generalized type forall 'a. 'a list, instead of '_a list as before. +- The typing of polymorphic variants in pattern matching has changed. + It is intended to be more regular, sticking to the principle of "closing + only the variants which would be otherwise incomplete". Two potential + consequences: (1) some types may be left open which were closed before, + and the resulting type might not match the interface anymore (expected to + be rare); (2) in some cases an incomplete match may be generated. - Lots of bug fixes in the handling of polymorphism and recursion inside types. - Added a new "-dtypes" option to ocamlc/ocamlopt, and an emacs extension "emacs/caml-types.el". The compiler option saves inferred type information - to file *.types, and the emacs extension allows the user to look at the + to file *.annot, and the emacs extension allows the user to look at the type of any subexpression in the source file. Works even in the case of a type error (all the types computed up to the error are available). This new feature is also supported by ocamlbrowser. +- Disable "method is overriden" warning when the method was explicitely + redefined as virtual beforehand (i.e. not through inheritance). Typing + and semantics are unchanged. Both compilers: - Added option "-dtypes" to dump detailed type information to a file. @@ -72,6 +81,7 @@ Toplevel interactive system: - Tightened interface consistency checks between .cmi files, .cm[oa] files loaded by #load, and the running toplevel. - #trace on mutually-recursive functions was broken, works again. +- Look for .ocamlinit file in home directory in addition to the current dir. Standard library: - Match_failure and Assert_failure exceptions now report @@ -81,10 +91,14 @@ Standard library: - Added format concatenation, string_of_format, format_of_string. - Module Arg: added new option handlers Set_string, Set_int, Set_float, Symbol, Tuple. +- Module Format: tag handling is now turned off by default, + use [Format.set_tags true] to activate. - Modules Lexing and Parsing: added better handling of positions - in source file. + in source file. Added function Lexing.flush_input. - Module Scanf: %n and %N formats to count characters / items read so far; - assorted bug fixes. + assorted bug fixes, %! to match end of input. New ``_'' special + flag to skip reresulting value. +- Module Format: tags are not activated by default. - Modules Set and Map: fixed bugs causing trees to become unbalanced. - Module Printf: less restrictive typing of kprintf. - Module Random: better seeding; functions to generate random int32, int64, @@ -123,7 +137,6 @@ Ocamllex: Ocamldebug: - Handle programs that run for more than 2^30 steps. -- Better support for preprocessed code. Emacs mode: - Added file caml-types.el to interactively display the type information diff --git a/INSTALL b/INSTALL index 0ed812a6..2fc5a302 100644 --- a/INSTALL +++ b/INSTALL @@ -81,6 +81,9 @@ The "configure" script accepts the following options: -no-tk Do not attempt to build LablTk. +-no-pthread + Do not attempt to use POSIX threads. + -verbose Verbose output of the configuration tests. Use it if the outcome of configure is not what you were expecting. diff --git a/LICENSE b/LICENSE index 2aa532e6..bd3dbe83 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ In the following, "the Library" refers to all files marked "Copyright INRIA" in the following directories and their sub-directories: - asmrun, byterun, config, maccaml, otherlibs, stdlib, win32caml + asmrun, byterun, camlp4, config, maccaml, otherlibs, stdlib, win32caml and "the Compiler" refers to all files marked "Copyright INRIA" in the other directories and their sub-directories. diff --git a/Makefile.nt b/Makefile.nt index 823cfe01..9c818961 100644 --- a/Makefile.nt +++ b/Makefile.nt @@ -10,7 +10,7 @@ # # ######################################################################### -# $Id: Makefile.nt,v 1.92 2003/07/03 16:21:47 xleroy Exp $ +# $Id: Makefile.nt,v 1.94 2003/09/25 08:19:17 xleroy Exp $ # The main Makefile @@ -200,7 +200,8 @@ cleanboot: opt: runtimeopt ocamlopt libraryopt otherlibrariesopt camlp4opt # Native-code versions of the tools -opt.opt: ocamlc.opt ocamlopt.opt ocamllex.opt ocamltoolsopt.opt ocamldoc.opt +opt.opt: ocamlc.opt ocamlopt.opt ocamllex.opt ocamltoolsopt.opt \ + camlp4optopt ocamldoc.opt # Installation install: installbyt installopt @@ -225,9 +226,7 @@ installbyt: cd ocamldoc ; $(MAKEREC) install mkdir -p $(STUBLIBDIR) for i in $(OTHERLIBRARIES); do $(MAKEREC) -C otherlibs/$$i install; done -ifeq ($(TOOLCHAIN),msvc) cd win32caml ; $(MAKE) install -endif cd camlp4 ; make install cp README $(DISTRIB)/Readme.gen cp README.win32 $(DISTRIB)/Readme.win @@ -241,6 +240,12 @@ installopt: cd stdlib ; $(MAKEREC) installopt cd ocamldoc ; $(MAKEREC) installopt for i in $(OTHERLIBRARIES); do $(MAKEREC) -C otherlibs/$$i installopt; done + if test -f ocamlc.opt; \ + then cp ocamlc.opt $(BINDIR)/ocamlc.opt.exe; else :; fi + if test -f ocamlopt.opt; \ + then cp ocamlopt.opt $(BINDIR)/ocamlopt.opt.exe; else :; fi + if test -f lex/ocamllex.opt; \ + then cp lex/ocamllex.opt $(BINDIR)/ocamllex.opt.exe; else :; fi clean:: partialclean @@ -560,6 +565,8 @@ camlp4out: cd camlp4/config ; \ (cat Makefile.tpl; \ echo 'EXE=.exe'; \ + echo 'O=$(O)'; \ + echo 'A=$(A)'; \ echo 'OPT='; \ echo 'OTOP=../..'; \ echo 'OLIBDIR=$$(OTOP)/boot'; \ @@ -569,15 +576,16 @@ camlp4out: cd camlp4 ; $(MAKE) camlp4opt: cd camlp4 ; $(MAKE) opt +camlp4optopt: + cd camlp4; $(MAKE) opt.opt partialclean:: cd camlp4 ; $(MAKE) clean # The Win32 toplevel GUI win32gui: -ifeq ($(TOOLCHAIN),msvc) cd win32caml ; $(MAKE) all -endif + clean:: cd win32caml ; $(MAKE) clean diff --git a/README.win32 b/README.win32 index f020f0f3..c872c3eb 100644 --- a/README.win32 +++ b/README.win32 @@ -4,7 +4,7 @@ Starting with OCaml 3.05, there are no less than three ports of Objective Caml for MS Windows available: - a native Win32 port, built with the Microsoft development tools; - - a native Win32 port, built with the MinGW development tools; + - a native Win32 port, built with the Cygwin/MinGW development tools; - a port consisting of the Unix sources compiled under the Cygwin Unix-like environment for Windows. @@ -13,8 +13,8 @@ Here is a summary of the main differences between these ports: Native MS Native MinGW Cygwin Third-party software required - for base bytecode system none none none - - for ocamlc -custom MSVC MinGW or Cygwin Cygwin - - for native-code generation MSVC+MASM MinGW or Cygwin Cygwin + - for ocamlc -custom MSVC Cygwin Cygwin + - for native-code generation MSVC+MASM Cygwin Cygwin Speed of bytecode interpreter 70% 100% 100% @@ -22,7 +22,7 @@ Replay debugger no no yes The Unix library partial partial full -The Threads library yes yes no +The Threads library yes yes yes The Graphics library yes yes no @@ -30,7 +30,7 @@ Restrictions on generated executables? none none yes (*) (*) Cygwin-generated .exe files refer to a DLL that is distributed under the GPL. Thus, these .exe files can only be distributed under a license -that is compatible with the GPL. Executables generated by MS VC or by +that is compatible with the GPL. Executables generated by MSVC or by MinGW have no such restrictions. The remainder of this document gives more information on each port. @@ -107,6 +107,10 @@ You will need the following software components to perform the recompilation: http://sourceware.cygnus.com/cygwin/ - TCL/TK version 8.3 (for the LablTK GUI) (see above). +Remember to add the directory where the libraries tk83.lib and +tcl83.lib were installed (by the Tcl/Tk installer) to the LIB variable +(library search path). + To recompile, start a Cygwin shell and change to the top-level directory of the OCaml distribution. Then, do @@ -161,10 +165,8 @@ The base bytecode system (ocamlc, ocaml, ocamllex, ocamlyacc, ...) runs without any additional tools. The native-code compiler (ocamlopt), as well as static linking of -Caml bytecode with C code (ocamlc -custom), require either the MinGW -development tools, which is free software available at - http://www.mingw.org/ -or the Cygwin development tools (also free software), available at +Caml bytecode with C code (ocamlc -custom), require +the Cygwin development tools, available at http://sources.redhat.com/cygwin/ The LablTk GUI requires Tcl/Tk 8.3. Windows binaries are @@ -240,7 +242,7 @@ Just follow the instructions for Unix machines given in the file INSTALL. NOTES: -The libraries available in this port are "num", "str", "unix" and "labltk". -"graph" and "threads" are not available yet. +The libraries available in this port are "num", "str", "threads", +"unix" and "labltk". "graph" is not available yet. The replay debugger is supported. diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp index ec6004b9..6534e38d 100644 --- a/asmcomp/i386/emit.mlp +++ b/asmcomp/i386/emit.mlp @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: emit.mlp,v 1.28 2003/06/30 15:32:45 xleroy Exp $ *) +(* $Id: emit.mlp,v 1.29 2003/08/22 14:05:03 xleroy Exp $ *) (* Emission of Intel 386 assembly code *) @@ -777,6 +777,15 @@ let emit_profile () = ` popl %eax\n` | _ -> () (*unsupported yet*) +(* Declare a global function symbol *) + +let declare_function_symbol name = + ` .globl {emit_symbol name}\n`; + match Config.system with + "linux_elf" | "bsd_elf" -> + ` .type {emit_symbol name},@function\n` + | _ -> () + (* Emission of a function declaration *) let fundecl fundecl = @@ -789,7 +798,7 @@ let fundecl fundecl = range_check_trap := 0; ` .text\n`; emit_align 16; - ` .globl {emit_symbol fundecl.fun_name}\n`; + declare_function_symbol fundecl.fun_name; `{emit_symbol fundecl.fun_name}:\n`; if !Clflags.gprofile then emit_profile(); let n = frame_size() - 4 in diff --git a/asmcomp/ia64/selection.ml b/asmcomp/ia64/selection.ml index 2f18382f..0a883c78 100644 --- a/asmcomp/ia64/selection.ml +++ b/asmcomp/ia64/selection.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: selection.ml,v 1.5 2000/07/16 02:57:31 xleroy Exp $ *) +(* $Id: selection.ml,v 1.6 2003/08/05 13:39:03 xleroy Exp $ *) (* Instruction selection for the IA64 processor *) @@ -161,7 +161,10 @@ method emit_stores env data regs_addr = self#insert (Iop(Ispecific(Istoreincr 16))) [| t2; r |] [| t2 |]; backlog := None in List.iter - (fun exp -> Array.iter do_store (self#emit_expr env exp)) + (fun exp -> + match self#emit_expr env exp with + None -> assert false + | Some regs -> Array.iter do_store regs) data; (* Store the backlog if any *) begin match !backlog with diff --git a/asmcomp/sparc/emit.mlp b/asmcomp/sparc/emit.mlp index 1d23432e..32b079f0 100644 --- a/asmcomp/sparc/emit.mlp +++ b/asmcomp/sparc/emit.mlp @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: emit.mlp,v 1.18 2003/07/17 15:11:03 xleroy Exp $ *) +(* $Id: emit.mlp,v 1.19 2003/09/04 12:31:08 xleroy Exp $ *) (* Emission of Sparc assembly code *) @@ -466,7 +466,7 @@ let rec emit_instr i dslot = if !arch_version = SPARC_V9 then begin let comp = name_for_int_movcc cmp in ` mov 0, {emit_reg i.res.(0)}\n`; - ` mov{emit_string comp} %xcc, 1, {emit_reg i.res.(0)}\n` + ` mov{emit_string comp} %icc, 1, {emit_reg i.res.(0)}\n` end else begin let comp = name_for_int_comparison cmp and lbl = new_label() in diff --git a/boot/ocamlc b/boot/ocamlc index a87d14a2..9de36cbd 100755 Binary files a/boot/ocamlc and b/boot/ocamlc differ diff --git a/boot/ocamllex b/boot/ocamllex index ac8ced2b..d502303c 100755 Binary files a/boot/ocamllex and b/boot/ocamllex differ diff --git a/byterun/io.c b/byterun/io.c index 4edead2b..d3ce9091 100644 --- a/byterun/io.c +++ b/byterun/io.c @@ -11,7 +11,7 @@ /* */ /***********************************************************************/ -/* $Id: io.c,v 1.62 2003/01/06 10:59:07 xleroy Exp $ */ +/* $Id: io.c,v 1.63 2003/07/29 11:48:34 xleroy Exp $ */ /* Buffered input/output. */ @@ -430,10 +430,10 @@ static struct custom_operations channel_operations = { CAMLexport value alloc_channel(struct channel *chan) { - value res = alloc_custom(&channel_operations, sizeof(struct channel *), - 1, 1000); + value res; + chan->refcount++; /* prevent finalization during next alloc */ + res = alloc_custom(&channel_operations, sizeof(struct channel *), 1, 1000); Channel(res) = chan; - chan->refcount++; return res; } diff --git a/camlp4/CHANGES b/camlp4/CHANGES index 038cc06b..ca9d82f9 100644 --- a/camlp4/CHANGES +++ b/camlp4/CHANGES @@ -1,3 +1,101 @@ +Camlp4 Version 3.07 +___________________ + +- [29 Sep 03] Camlp4 code now licensed under the LGPL minus clause 6. +- [09 Sep 03] Added tokens LABEL and OPTLABEL in plexer, and use them in + both parsers (ocaml and revised). There was, afaik, no other way to fix + ambiguities (bugs) in parsing labels and type constraints. + +Camlp4 Version 3.07 beta1 +________________________ + +- [July 03] Updated the ocaml/camlp4 CVS tree with the camlp4 + "parallel" CVS tree, which becomes obsolete from now on. + Added support for recursive modules, private data constructors, and + new syntaxes for integers (int32, nativeint, ...). + +Camlp4 Version 3.06++ +----------------------- + +- [02 Dec 02] In AST predefined quotation, changed antiquotations for + "rec", "mutable": now all are with coercion "opt": $opt:...$ (instead + of "rec" and "mut"). Added antiquotation for "private". Cleaned up + the entries for "methods" and for labelled and optional parameters. +- [29 Nov 02] Removed all "extract_crc" stuff no more necessary with + the new interface of Dynlink. +- [26 Nov 02] Added ability to use "#use" directives in compiled files. +- [21 Nov 02] Changed Scheme syntax for directives: now, e.g. #load "file" + is written: # (load "file"). Added directives in "implem", "interf" and + "use" directive. +- [20 Nov 02] Added Grammar.glexer returning the lexer used by a + grammar. Also added a field in Token.glexer type to ask lexers to + record the locations of the comments. +- [04 Nov 02] Added option -no_quot with normal syntax (pa_o.cmo): + don't parse quotations (it allows to use e.g. <:> as a valid token). +- [31 Oct 02] Added pa_macro.cmo (to replace pa_ifdef.cmo which is + kept for compatibility, but deprecated). The extended statements + allow de definitions of macros and conditional compilation like + in C. +- [29 Oct 02] Changed pretty printers of the three main syntaxes: if + the locations of input are not correct, do no more raise End_of_file + when displaying the inter-phrases (return: the input found up to eof + if not empty, otherwise the value of the -sep parameter if not empty, + otherwise the string "\n"). +- [25 Oct 02] Added option -records in pa_sml.cmo: generates normal + OCaml records instead of objects (the user must be sure that there + are no names conflicts). +- [22 Oct 02] Added Plexer.specific_space_dot: when set to "true", the + next call to Plexer.gmake returns a lexer where the dot preceded by + spaces (space, tab, newline, etc.) return a different token than when + not preceded by spaces. +- [19 Oct 02] Added printer in Scheme syntax: pr_scheme.cmo and the + extension pr_schemep.cmo which rebuilts parsers. +- [15 Oct 02] Now, in case of syntax error, the real input file name is + displayed (can be different from the input file, because of the possibility + of line directives, typically generated by /lib/cpp). + Changed interface of Stdpp.line_of_loc: now return also a string: the name + of the real input file name. +- [14 Oct 02] Fixed bug in normal syntax (pa_o.cmo): the constructors + with currification of parameters (C x y) were accepted. +- [14 Oct 02] Fixed many problems of make under Windows (in particular if + installations directories contain spaces). +- [11 Oct 02] In ocaml syntax (pa_o.cmo), fixed 3 bugs (or incompatibilities + with the ocaml yacc version of the compiler): 1/ "ref new foo" was + interpreted as "ref;; new foo" instead of "ref (new foo)" 2/ unary + minuses did not work correctly (nor in quotation of syntax trees), in + particular "-0.0" 3/ "begin end" was a syntax error, instead of being "()". +- [Sep-Oct 02] Many changes and improvements in Scheme syntax. +- [07 Oct 02] Added definition of Pcaml.type_declaration which is + now visible in the interface, allowing to change the type declarations. +- [07 Oct 02] Added Pcaml.syntax_name to allow syntax extensions to test + it and take different decision. In revised syntax, its value is "Revised", + in normal syntax "OCaml" and in Scheme syntax "Scheme". +- [03 Oct 02] Added lexing of '\xHH' where HH is hexadecimal number. +- [01 Oct 02] In normal syntax (camlp4o), fixed problem of lexing + comment: (* bleble'''*) +- [23 Sep 02] Fixed bug: input "0x" raised Failure "int_of_string" + without location (syntaxes pa_o and pa_r). +- [14 Sep 02] Added functions Grammar.iter_entry and Grammar.fold_entry + to iterate a grammar entry and transitively all the entries it calls. +- [12 Sep 02] Added "Pcaml.rename_id", a hook to allow parsers to give + ability to rename their identifiers. Called in Scheme syntax (pa_scheme.ml) + when generating its identifiers. +- [09 Sep 02] Fixed bug under toplevel, the command: + !Toploop.parse_toplevel_phrase (Lexing.from_buff "1;;");; + failed "End_of_file". +- [06 Sep 02] Added "Pcaml.string_of". Combined with Pcaml.pr_expr, + Pcaml.pr_patt, and so on, allow to pretty print syntax trees in string. + E.g. in the toplevel: + # #load "pr_o.cmo"; + # Pcaml.string_of Pcaml.pr_expr <:expr< let x = 3 in x + 2 >>;; + - : string = "let x = 3 in x + 2" + +Camlp4 Version 3.06 +-------------------- + +- [24 Jul 02] Added Scheme syntax: pa_scheme.ml, camlp4sch.cma (toplevel), + camlp4sch (command). + Camlp4 Version 3.05 ----------------------- diff --git a/camlp4/camlp4/.depend b/camlp4/camlp4/.depend index bf820654..00ddb5ad 100644 --- a/camlp4/camlp4/.depend +++ b/camlp4/camlp4/.depend @@ -11,6 +11,8 @@ ast2pt.cmo: $(OTOP)/parsing/asttypes.cmi $(OTOP)/parsing/location.cmi \ ast2pt.cmx: $(OTOP)/parsing/asttypes.cmi $(OTOP)/parsing/location.cmx \ $(OTOP)/parsing/longident.cmx mLast.cmi $(OTOP)/parsing/parsetree.cmi \ ast2pt.cmi +crc.cmo: $(OTOP)/otherlibs/dynlink/dynlink.cmi +crc.cmx: $(OTOP)/otherlibs/dynlink/dynlink.cmx pcaml.cmo: ast2pt.cmi mLast.cmi quotation.cmi reloc.cmi spretty.cmi pcaml.cmi pcaml.cmx: ast2pt.cmx mLast.cmi quotation.cmx reloc.cmx spretty.cmx pcaml.cmi quotation.cmo: mLast.cmi quotation.cmi diff --git a/camlp4/camlp4/Makefile b/camlp4/camlp4/Makefile index ccc6936f..7bde12fb 100644 --- a/camlp4/camlp4/Makefile +++ b/camlp4/camlp4/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.17 2003/07/14 17:59:28 mauny Exp $ +# $Id: Makefile,v 1.19 2003/08/29 12:15:14 xleroy Exp $ include ../config/Makefile @@ -37,7 +37,7 @@ camlp4.cmxa: $(CAMLP4_XOBJS) $(OCAMLOPT) $(LINKFLAGS) $(CAMLP4_XOBJS) -a -o camlp4.cmxa clean:: - rm -f *.cm* *.pp[io] *.o *.bak .*.bak *.out *.opt + rm -f *.cm* *.pp[io] *.$(O) *.$(A) *.bak .*.bak *.out *.opt rm -f $(CAMLP4) depend: @@ -64,7 +64,7 @@ install: cp mLast.cmi quotation.cmi ast2pt.cmi pcaml.cmi spretty.cmi "$(LIBDIR)/camlp4/." cp camlp4.cma $(LIBDIR)/camlp4/. if [ -f camlp4.cmxa ]; \ - then cp camlp4.cmxa camlp4.a $(LIBDIR)/camlp4/.; \ + then cp camlp4.cmxa camlp4.$(A) $(LIBDIR)/camlp4/.; \ else : ; \ fi diff --git a/camlp4/camlp4/spretty.ml b/camlp4/camlp4/spretty.ml index afa8fd9b..96bf2108 100644 --- a/camlp4/camlp4/spretty.ml +++ b/camlp4/camlp4/spretty.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: spretty.ml,v 1.2 2002/07/19 14:53:44 mauny Exp $ *) +(* $Id: spretty.ml,v 1.3 2003/09/23 18:06:18 mauny Exp $ *) type glue = [ LO | RO | LR | NO ]; type pretty = @@ -215,7 +215,10 @@ value rec hprint_pretty tab pos spc = | VL [] -> (pos, spc) | VL x -> hprint_box tab pos spc x | BE x -> hprint_box tab pos spc x - | BV x -> invalid_arg "hprint_pretty" + | BV x -> + (* This should not occur: should be + invalid_arg "hprint_pretty" instead *) + hprint_box tab pos spc x | LI (comm, nl_bef, tab_bef) x -> do { if lazy_tab.val >= 0 then do { diff --git a/camlp4/compile/Makefile b/camlp4/compile/Makefile index ce167481..9b14f3ac 100644 --- a/camlp4/compile/Makefile +++ b/camlp4/compile/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.7 2002/07/22 16:38:07 doligez Exp $ +# $Id: Makefile,v 1.8 2003/08/29 12:15:14 xleroy Exp $ include ../config/Makefile @@ -29,7 +29,7 @@ $D_fast.ml: compile.cmo $(SRC) OTOP=$(OTOP) EXE=$(EXE) ./compile.sh $(COMP_OPT) $(SRC) > $D_fast.ml install: - if test -f camlp4o.fast.opt; then cp camlp4o.fast.opt $(BINDIR)/camlp4o.opt; fi + if test -f camlp4o.fast.opt; then cp camlp4o.fast.opt $(BINDIR)/camlp4o.opt$(EXE); fi clean:: rm -f *.cm* *.pp[io] *.o *.bak .*.bak *.out *.opt diff --git a/camlp4/compile/compile.sh b/camlp4/compile/compile.sh index 780fea0c..1e86d6f7 100755 --- a/camlp4/compile/compile.sh +++ b/camlp4/compile/compile.sh @@ -22,5 +22,6 @@ $OTOP/boot/ocamlrun$EXE $OTOP/boot/ocamlc -I $OTOP/boot -c tmp.mli $OTOP/boot/ocamlrun$EXE ../meta/camlp4r$EXE -I ../meta pa_extend.cmo q_MLast.cmo -meta_action tmp.ml -o tmp.ppo $OTOP/boot/ocamlrun$EXE $OTOP/boot/ocamlc -I $OTOP/boot -I ../lib -I ../camlp4 -c -impl tmp.ppo rm tmp.ppo -$OTOP/boot/ocamlrun$EXE ../camlp4/camlp4$EXE ./compile.cmo ./tmp.cmo ../etc/pr_r.cmo ../etc/pr_rp.cmo $ARGS -sep "\n\n" -impl /dev/null +> tmp.null +$OTOP/boot/ocamlrun$EXE ../camlp4/camlp4$EXE ./compile.cmo ./tmp.cmo ../etc/pr_r.cmo ../etc/pr_rp.cmo $ARGS -sep "\n\n" -impl tmp.null rm tmp.* diff --git a/camlp4/config/Makefile-nt.cnf b/camlp4/config/Makefile-nt.cnf index e69de29b..379f3385 100644 --- a/camlp4/config/Makefile-nt.cnf +++ b/camlp4/config/Makefile-nt.cnf @@ -0,0 +1,7 @@ +EXE=.exe +OPT= +OTOP=../.. +OLIBDIR=$(OTOP)/boot +BINDIR=C:/ocaml/bin +LIBDIR=C:/ocaml/lib +MANDIR=C:/ocaml/man diff --git a/camlp4/config/configure_batch b/camlp4/config/configure_batch index f7df2e0e..fbaf719f 100755 --- a/camlp4/config/configure_batch +++ b/camlp4/config/configure_batch @@ -1,5 +1,5 @@ #! /bin/sh -# $Id: configure_batch,v 1.4 2002/07/23 14:11:49 doligez Exp $ +# $Id: configure_batch,v 1.5 2003/08/29 12:15:15 xleroy Exp $ prefix=/usr/local bindir='' @@ -66,6 +66,8 @@ for i in utils parsing otherlibs/dynlink; do done echo "EXE=$EXE" >> Makefile.cnf +echo "O=o" >> Makefile.cnf +echo "A=a" >> Makefile.cnf echo "OPT=" >> Makefile.cnf echo "OTOP=$ocaml_top" >> Makefile.cnf diff --git a/camlp4/etc/.depend b/camlp4/etc/.depend index 50e140c7..63497262 100644 --- a/camlp4/etc/.depend +++ b/camlp4/etc/.depend @@ -7,6 +7,8 @@ pa_format.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_format.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_fstream.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_fstream.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx +pa_ifdef.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi +pa_ifdef.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_lefteval.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_lefteval.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_lisp.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi @@ -27,8 +29,6 @@ pa_oop.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_oop.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_op.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_op.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx -parserify.cmo: ../camlp4/mLast.cmi parserify.cmi -parserify.cmx: ../camlp4/mLast.cmi parserify.cmi pa_ru.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_ru.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_scheme.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi @@ -37,6 +37,8 @@ pa_schemer.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_schemer.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_sml.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_sml.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx +parserify.cmo: ../camlp4/mLast.cmi parserify.cmi +parserify.cmx: ../camlp4/mLast.cmi parserify.cmi pr_depend.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pr_depend.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pr_extend.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi ../camlp4/spretty.cmi @@ -47,12 +49,16 @@ pr_null.cmo: ../camlp4/pcaml.cmi pr_null.cmx: ../camlp4/pcaml.cmx pr_o.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi ../camlp4/spretty.cmi pr_o.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx ../camlp4/spretty.cmx +pr_op.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi ../camlp4/spretty.cmi +pr_op.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx ../camlp4/spretty.cmx pr_op_main.cmo: ../camlp4/mLast.cmi parserify.cmi ../camlp4/pcaml.cmi \ ../camlp4/spretty.cmi pr_op_main.cmx: ../camlp4/mLast.cmi parserify.cmx ../camlp4/pcaml.cmx \ ../camlp4/spretty.cmx pr_r.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi ../camlp4/spretty.cmi pr_r.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx ../camlp4/spretty.cmx +pr_rp.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi ../camlp4/spretty.cmi +pr_rp.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx ../camlp4/spretty.cmx pr_rp_main.cmo: ../camlp4/mLast.cmi parserify.cmi ../camlp4/pcaml.cmi \ ../camlp4/spretty.cmi pr_rp_main.cmx: ../camlp4/mLast.cmi parserify.cmx ../camlp4/pcaml.cmx \ diff --git a/camlp4/etc/Makefile b/camlp4/etc/Makefile index 2855ccba..7fa6fbab 100644 --- a/camlp4/etc/Makefile +++ b/camlp4/etc/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.14 2003/07/15 09:34:47 mauny Exp $ +# $Id: Makefile,v 1.15 2003/08/29 12:15:15 xleroy Exp $ include ../config/Makefile @@ -83,7 +83,7 @@ install: cp $(INTF) "$(LIBDIR)/camlp4/." cp lib.sml "$(LIBDIR)/camlp4/." cp camlp4o$(EXE) camlp4sch$(EXE) "$(BINDIR)/." - if test -f camlp4o.opt; then cp camlp4o.opt "$(BINDIR)/."; cp $(OBJSX) $(OBJSX:.cmx=.o) "$(LIBDIR)/camlp4/."; fi + if test -f camlp4o.opt; then cp camlp4o.opt "$(BINDIR)/camlp4o.opt$(EXE)"; cp $(OBJSX) $(OBJSX:.cmx=.o) "$(LIBDIR)/camlp4/."; fi cp mkcamlp4.sh "$(BINDIR)/mkcamlp4" chmod a+x "$(BINDIR)/mkcamlp4" diff --git a/camlp4/etc/mkcamlp4.sh.tpl b/camlp4/etc/mkcamlp4.sh.tpl index feb825e7..80e626b4 100755 --- a/camlp4/etc/mkcamlp4.sh.tpl +++ b/camlp4/etc/mkcamlp4.sh.tpl @@ -1,17 +1,17 @@ #!/bin/sh -# $Id: mkcamlp4.sh.tpl,v 1.5 2003/07/10 12:28:19 michel Exp $ +# $Id: mkcamlp4.sh.tpl,v 1.7 2003/09/23 18:17:35 mauny Exp $ -OLIB=`ocamlc -where` -LIB=LIBDIR/camlp4 +OLIB="`ocamlc -where`" +LIB="LIBDIR/camlp4" INTERFACES= OPTS= INCL="-I ." while test "" != "$1"; do - case $1 in + case "$1" in -I) INCL="$INCL -I $2"; shift;; *) - j=`basename $1 .cmi` + j=`basename "$1" .cmi` if test "$j.cmi" = "$1"; then first="`expr "$j" : '\(.\)' | tr 'a-z' 'A-Z'`" rest="`expr "$j" : '.\(.*\)'`" @@ -22,3 +22,12 @@ while test "" != "$1"; do esac shift done + +CRC=crc_$$ +set -e +trap 'rm -f $CRC.ml $CRC.cmi $CRC.cmo' 0 2 +$OLIB/extract_crc -I $OLIB $INCL $INTERFACES > $CRC.ml +echo "let _ = Dynlink.add_available_units crc_unit_list" >> $CRC.ml +ocamlc -I $LIB odyl.cma camlp4.cma $CRC.ml $INCL $OPTS odyl.cmo -linkall +rm -f $CRC.ml $CRC.cmi $CRC.cmo + diff --git a/camlp4/etc/pa_o.ml b/camlp4/etc/pa_o.ml index 353f7fa9..078f8229 100644 --- a/camlp4/etc/pa_o.ml +++ b/camlp4/etc/pa_o.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: pa_o.ml,v 1.50 2003/07/16 18:59:26 mauny Exp $ *) +(* $Id: pa_o.ml,v 1.52 2003/09/25 12:05:05 mauny Exp $ *) open Stdpp; open Pcaml; @@ -975,8 +975,12 @@ EXTEND | "["; tpl = LIST1 type_parameter SEP ","; "]" -> (loc, tpl) ] ] ; class_fun_def: - [ [ p = labeled_patt; "->"; ce = class_expr -> + [ [ p = patt LEVEL "simple"; "->"; ce = class_expr -> <:class_expr< fun $p$ -> $ce$ >> + | p = labeled_patt; "->"; ce = class_expr -> + <:class_expr< fun $p$ -> $ce$ >> + | p = patt LEVEL "simple"; cfd = SELF -> + <:class_expr< fun $p$ -> $cfd$ >> | p = labeled_patt; cfd = SELF -> <:class_expr< fun $p$ -> $cfd$ >> ] ] ; @@ -1146,8 +1150,14 @@ EXTEND (* Labels *) ctyp: AFTER "arrow" [ NONA - [ i = lident_colon; t = SELF -> <:ctyp< ~ $i$ : $t$ >> - | i = QUESTIONIDENT; ":"; t = SELF -> <:ctyp< ? $i$ : $t$ >> ] ] + [ i = lident_colon; t1 = ctyp LEVEL "star"; "->"; t2 = SELF -> + <:ctyp< ~ $i$ : $t1$ -> $t2$ >> + | i = OPTLABEL; t1 = ctyp LEVEL "star"; "->"; t2 = SELF -> + <:ctyp< ? $i$ : $t1$ -> $t2$ >> + | i = QUESTIONIDENT; ":"; t1 = ctyp LEVEL "star"; "->"; t2 = SELF -> + <:ctyp< ? $i$ : $t1$ -> $t2$ >> + | "?"; i=lident_colon;t1 = ctyp LEVEL "star"; "->"; t2 = SELF -> + <:ctyp< ? $i$ : $t1$ -> $t2$ >> ] ] ; ctyp: LEVEL "simple" [ [ "["; OPT "|"; rfl = LIST1 row_field SEP "|"; "]" -> @@ -1175,10 +1185,12 @@ EXTEND ; expr: AFTER "apply" [ "label" - [ i = TILDEIDENT; ":"; e = SELF -> <:expr< ~ $i$ : $e$ >> + [ i = LABEL; e = SELF -> <:expr< ~ $i$ : $e$ >> | i = TILDEIDENT -> <:expr< ~ $i$ >> - | i = QUESTIONIDENT; ":"; e = SELF -> <:expr< ? $i$ : $e$ >> - | i = QUESTIONIDENT -> <:expr< ? $i$ >> ] ] + | "~"; i = LIDENT -> <:expr< ~ $i$ >> + | i = OPTLABEL; e = SELF -> <:expr< ? $i$ : $e$ >> + | i = QUESTIONIDENT -> <:expr< ? $i$ >> + | "?"; i = LIDENT -> <:expr< ? $i$ >> ] ] ; expr: LEVEL "simple" [ [ "`"; s = ident -> <:expr< ` $s$ >> ] ] @@ -1194,24 +1206,26 @@ EXTEND | "#"; t = mod_ident -> <:patt< # $list:t$ >> ] ] ; labeled_patt: - [ [ i = TILDEIDENT; ":"; p = patt LEVEL "simple" -> + [ [ i = LABEL; p = patt LEVEL "simple" -> <:patt< ~ $i$ : $p$ >> | i = TILDEIDENT -> <:patt< ~ $i$ >> + | "~"; i=LIDENT -> <:patt< ~ $i$ >> | "~"; "("; i = LIDENT; ")" -> <:patt< ~ $i$ >> | "~"; "("; i = LIDENT; ":"; t = ctyp; ")" -> <:patt< ~ $i$ : ($lid:i$ : $t$) >> - | i = QUESTIONIDENT; ":"; j = LIDENT -> + | i = OPTLABEL; j = LIDENT -> <:patt< ? $i$ : ($lid:j$) >> - | i = QUESTIONIDENT; ":"; "("; p = patt; "="; e = expr; ")" -> + | i = OPTLABEL; "("; p = patt; "="; e = expr; ")" -> <:patt< ? $i$ : ( $p$ = $e$ ) >> - | i = QUESTIONIDENT; ":"; "("; p = patt; ":"; t = ctyp; ")" -> + | i = OPTLABEL; "("; p = patt; ":"; t = ctyp; ")" -> <:patt< ? $i$ : ( $p$ : $t$ ) >> - | i = QUESTIONIDENT; ":"; "("; p = patt; ":"; t = ctyp; "="; + | i = OPTLABEL; "("; p = patt; ":"; t = ctyp; "="; e = expr; ")" -> <:patt< ? $i$ : ( $p$ : $t$ = $e$ ) >> | i = QUESTIONIDENT -> <:patt< ? $i$ >> + | "?"; i = LIDENT -> <:patt< ? $i$ >> | "?"; "("; i = LIDENT; "="; e = expr; ")" -> <:patt< ? ( $lid:i$ = $e$ ) >> | "?"; "("; i = LIDENT; ":"; t = ctyp; "="; e = expr; ")" -> @@ -1222,9 +1236,13 @@ EXTEND <:patt< ? ( $lid:i$ : $t$ ) >> ] ] ; class_type: - [ [ i = lident_colon; t = ctyp LEVEL "ctyp1"; "->"; ct = SELF -> + [ [ i = lident_colon; t = ctyp LEVEL "star"; "->"; ct = SELF -> <:class_type< [ ~ $i$ : $t$ ] -> $ct$ >> - | i = QUESTIONIDENT; ":"; t = ctyp LEVEL "ctyp1"; "->"; ct = SELF -> + | i = OPTLABEL; t = ctyp LEVEL "star"; "->"; ct = SELF -> + <:class_type< [ ? $i$ : $t$ ] -> $ct$ >> + | i = QUESTIONIDENT; ":"; t = ctyp LEVEL "star"; "->"; ct = SELF -> + <:class_type< [ ? $i$ : $t$ ] -> $ct$ >> + | "?"; i = LIDENT; ":"; t = ctyp LEVEL "star"; "->"; ct = SELF -> <:class_type< [ ? $i$ : $t$ ] -> $ct$ >> ] ] ; class_fun_binding: diff --git a/camlp4/etc/pr_depend.ml b/camlp4/etc/pr_depend.ml index 9b9ecd25..58263e48 100644 --- a/camlp4/etc/pr_depend.ml +++ b/camlp4/etc/pr_depend.ml @@ -1,5 +1,5 @@ (* camlp4r *) -(* $Id: pr_depend.ml,v 1.12 2003/07/16 12:50:08 mauny Exp $ *) +(* $Id: pr_depend.ml,v 1.13 2003/07/23 22:26:17 doligez Exp $ *) open MLast; @@ -101,6 +101,8 @@ and expr = | ExApp _ e1 e2 -> do { expr e1; expr e2; } | ExAre _ e1 e2 -> do { expr e1; expr e2; } | ExArr _ el -> list expr el + | ExAsf _ -> () + | ExAsr _ e -> do { expr e; } | ExAss _ e1 e2 -> do { expr e1; expr e2; } | ExChr _ _ -> () | ExCoe _ e t1 t2 -> do { expr e; option ctyp t1; ctyp t2 } @@ -108,6 +110,9 @@ and expr = | ExFun _ pwel -> list match_case pwel | ExIfe _ e1 e2 e3 -> do { expr e1; expr e2; expr e3; } | ExInt _ _ -> () + | ExInt32 _ _ -> () + | ExInt64 _ _ -> () + | ExNativeInt _ _ -> () | ExFlo _ _ -> () | ExLab _ _ eo -> option expr eo | ExLaz _ e -> expr e diff --git a/camlp4/etc/pr_o.ml b/camlp4/etc/pr_o.ml index 2a4dc5ac..cc12a24e 100644 --- a/camlp4/etc/pr_o.ml +++ b/camlp4/etc/pr_o.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: pr_o.ml,v 1.41 2003/07/16 12:50:08 mauny Exp $ *) +(* $Id: pr_o.ml,v 1.42 2003/08/25 13:30:13 mauny Exp $ *) open Pcaml; open Spretty; @@ -1544,6 +1544,8 @@ pr_patt.pr_levels := | <:patt< ~ $i$ : $p$ >> -> fun curr next dg k -> [: `S LO ("~" ^ i ^ ":"); `simple_patt p "" k :] + | <:patt< ? $i$ >> -> + fun curr next _ k -> [: `S LR ("?" ^ i); k :] | <:patt< ? $i$ : ($p$) >> -> fun curr next dg k -> if i = "" then [: `S LO "?"; `simple_patt p "" k :] diff --git a/camlp4/lib/Makefile b/camlp4/lib/Makefile index 3ce2ee11..781339fb 100644 --- a/camlp4/lib/Makefile +++ b/camlp4/lib/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.6 2003/07/10 12:28:24 michel Exp $ +# $Id: Makefile,v 1.7 2003/08/29 12:15:15 xleroy Exp $ include ../config/Makefile @@ -18,7 +18,7 @@ $(TARGET:.cma=.cmxa): $(OBJS:.cmo=.cmx) $(OCAMLOPT) $(OBJS:.cmo=.cmx) -a -o $(TARGET:.cma=.cmxa) clean:: - rm -f *.cm[ioax] *.cmxa *.pp[io] *.o *.a *.bak .*.bak $(TARGET) + rm -f *.cm[ioax] *.cmxa *.pp[io] *.$(O) *.$(A) *.bak .*.bak $(TARGET) depend: cp .depend .depend.bak @@ -43,10 +43,6 @@ install: installopt: cp $(TARGET:.cma=.cmxa) *.cmx "$(LIBDIR)/camlp4/." - if test -f $(TARGET:.cma=.lib); then \ - cp $(TARGET:.cma=.lib) "$(LIBDIR)/camlp4/."; \ - else \ - tar cf - $(TARGET:.cma=.a) | (cd "$(LIBDIR)/camlp4/."; tar xf -); \ - fi + tar cf - $(TARGET:.cma=.$(A)) | (cd "$(LIBDIR)/camlp4/."; tar xf -) include .depend diff --git a/camlp4/lib/plexer.ml b/camlp4/lib/plexer.ml index 9a337483..be680c83 100644 --- a/camlp4/lib/plexer.ml +++ b/camlp4/lib/plexer.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: plexer.ml,v 1.15 2003/07/15 09:13:58 mauny Exp $ *) +(* $Id: plexer.ml,v 1.16 2003/09/25 12:05:06 mauny Exp $ *) open Stdpp; open Token; @@ -462,7 +462,12 @@ value next_token_fun dfa ssd find_kwd bolpos glexr = try (("", find_kwd s), loc) with [ Not_found -> if error_on_unknown_keywords.val then err loc ("illegal token: " ^ s) - else (("", s), loc) ] + else (("", s), loc) ] in + let error_if_keyword ( ((_,id), loc) as a) = + try do { + ignore(find_kwd id); + err loc ("illegal use of a keyword as a label: " ^ id) } + with [ Not_found -> a ] in let rec next_token after_space = parser bp @@ -511,17 +516,24 @@ value next_token_fun dfa ssd find_kwd bolpos glexr = | [: `('~' as c); a = parser - [ [: `('a'..'z' as c); len = ident (store 0 c) :] ep -> - (("TILDEIDENT", get_buff len), (bp, ep)) + [ [: `('a'..'z' as c); len = ident (store 0 c); s :] ep -> + let id = get_buff len in + match s with parser + [ [: `':' :] eb -> error_if_keyword (("LABEL", id), (bp,ep)) + | [: :] -> error_if_keyword (("TILDEIDENT", id), (bp, ep)) ] | [: s :] -> let id = get_buff (ident2 (store 0 c) s) in keyword_or_error (bp, Stream.count s) id ] :] -> a + | [: `('?' as c); a = parser - [ [: `('a'..'z' as c); len = ident (store 0 c) :] ep -> - (("QUESTIONIDENT", get_buff len), (bp, ep)) + [ [: `('a'..'z' as c); len = ident (store 0 c); s :] ep -> + let id = get_buff len in + match s with parser + [ [: `':' :] eb -> error_if_keyword (("OPTLABEL", id), (bp,ep)) + | [: :] -> error_if_keyword (("QUESTIONIDENT", id), (bp, ep)) ] | [: s :] -> let id = get_buff (ident2 (store 0 c) s) in keyword_or_error (bp, Stream.count s) id ] :] -> @@ -883,9 +895,10 @@ value using_token kwd_table ident_table (p_con, p_prm) = if Hashtbl.mem kwd_table p_prm then error_ident_and_keyword p_con p_prm else Hashtbl.add ident_table p_prm p_con ] - | "TILDEIDENT" | "QUESTIONIDENT" | "INT" | "INT32" | "INT64" | "NATIVEINT" - | "FLOAT" | "CHAR" | "STRING" | - "QUOTATION" | "ANTIQUOT" | "LOCATE" | "EOI" -> + | "INT" | "INT32" | "INT64" | "NATIVEINT" + | "FLOAT" | "CHAR" | "STRING" + | "TILDEIDENT" | "QUESTIONIDENT" | "LABEL" | "OPTLABEL" + | "QUOTATION" | "ANTIQUOT" | "LOCATE" | "EOI" -> () | _ -> raise diff --git a/camlp4/meta/.depend b/camlp4/meta/.depend index 8f5e0cff..737ea5ec 100644 --- a/camlp4/meta/.depend +++ b/camlp4/meta/.depend @@ -4,6 +4,8 @@ pa_extend_m.cmo: pa_extend.cmo pa_extend_m.cmx: pa_extend.cmx pa_ifdef.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_ifdef.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx +pa_macro.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi +pa_macro.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_r.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_r.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_rp.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi diff --git a/camlp4/meta/Makefile b/camlp4/meta/Makefile index ece02752..22e6bf0e 100644 --- a/camlp4/meta/Makefile +++ b/camlp4/meta/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.12 2003/07/15 09:33:19 mauny Exp $ +# $Id: Makefile,v 1.13 2003/08/29 12:15:15 xleroy Exp $ include ../config/Makefile @@ -48,8 +48,8 @@ install: cp pa_macro.cmi pa_extend.cmi "$(LIBDIR)/camlp4/." cp camlp4r$(EXE) "$(BINDIR)/." if test -f camlp4r.opt; then \ - cp camlp4r.opt "$(BINDIR)/." ;\ - for target in $(OBJSX) $(OBJSX:.cmx=.o) ; do \ + cp camlp4r.opt "$(BINDIR)/camlp4r.opt$(EXE)" ;\ + for target in $(OBJSX) $(OBJSX:.cmx=.$(O)) ; do \ if test -f $$target; then \ cp $$target "$(LIBDIR)/camlp4/."; \ fi; \ diff --git a/camlp4/meta/pa_r.ml b/camlp4/meta/pa_r.ml index 7f368fa9..8554792e 100644 --- a/camlp4/meta/pa_r.ml +++ b/camlp4/meta/pa_r.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: pa_r.ml,v 1.52 2003/07/16 12:50:08 mauny Exp $ *) +(* $Id: pa_r.ml,v 1.53 2003/09/25 12:05:06 mauny Exp $ *) open Stdpp; open Pcaml; @@ -751,7 +751,9 @@ EXTEND ctyp: AFTER "arrow" [ NONA [ i = TILDEIDENT; ":"; t = SELF -> <:ctyp< ~ $i$ : $t$ >> - | i = QUESTIONIDENT; ":"; t = SELF -> <:ctyp< ? $i$ : $t$ >> ] ] + | i = LABEL; t = SELF -> <:ctyp< ~ $i$ : $t$ >> + | i = QUESTIONIDENT; ":"; t = SELF -> <:ctyp< ? $i$ : $t$ >> + | i = OPTLABEL; t = SELF -> <:ctyp< ? $i$ : $t$ >> ] ] ; ctyp: LEVEL "simple" [ [ "["; "="; rfl = row_field_list; "]" -> @@ -779,9 +781,12 @@ EXTEND [ [ "`"; s = ident -> <:patt< ` $s$ >> | "#"; sl = mod_ident -> <:patt< # $list:sl$ >> | i = TILDEIDENT; ":"; p = SELF -> <:patt< ~ $i$ : $p$ >> + | i = LABEL; p = SELF -> <:patt< ~ $i$ : $p$ >> | i = TILDEIDENT -> <:patt< ~ $i$ >> | i = QUESTIONIDENT; ":"; "("; p = patt_tcon; eo = OPT eq_expr; ")" -> <:patt< ? $i$ : ($p$ $opt:eo$) >> + | i = OPTLABEL; "("; p = patt_tcon; eo = OPT eq_expr; ")" -> + <:patt< ? $i$ : ($p$ $opt:eo$) >> | i = QUESTIONIDENT -> <:patt< ? $i$ >> | "?"; "("; p = patt_tcon; eo = OPT eq_expr; ")" -> @@ -793,9 +798,12 @@ EXTEND ; ipatt: [ [ i = TILDEIDENT; ":"; p = SELF -> <:patt< ~ $i$ : $p$ >> + | i = LABEL; p = SELF -> <:patt< ~ $i$ : $p$ >> | i = TILDEIDENT -> <:patt< ~ $i$ >> | i = QUESTIONIDENT; ":"; "("; p = ipatt_tcon; eo = OPT eq_expr; ")" -> <:patt< ? $i$ : ($p$ $opt:eo$) >> + | i = OPTLABEL; "("; p = ipatt_tcon; eo = OPT eq_expr; ")" -> + <:patt< ? $i$ : ($p$ $opt:eo$) >> | i = QUESTIONIDENT -> <:patt< ? $i$ >> | "?"; "("; p = ipatt_tcon; eo = OPT eq_expr; ")" -> @@ -811,8 +819,10 @@ EXTEND expr: AFTER "apply" [ "label" NONA [ i = TILDEIDENT; ":"; e = SELF -> <:expr< ~ $i$ : $e$ >> + | i = LABEL; e = SELF -> <:expr< ~ $i$ : $e$ >> | i = TILDEIDENT -> <:expr< ~ $i$ >> | i = QUESTIONIDENT; ":"; e = SELF -> <:expr< ? $i$ : $e$ >> + | i = OPTLABEL; e = SELF -> <:expr< ? $i$ : $e$ >> | i = QUESTIONIDENT -> <:expr< ? $i$ >> ] ] ; expr: LEVEL "simple" diff --git a/camlp4/ocaml_src/camlp4/.depend b/camlp4/ocaml_src/camlp4/.depend index bf820654..00ddb5ad 100644 --- a/camlp4/ocaml_src/camlp4/.depend +++ b/camlp4/ocaml_src/camlp4/.depend @@ -11,6 +11,8 @@ ast2pt.cmo: $(OTOP)/parsing/asttypes.cmi $(OTOP)/parsing/location.cmi \ ast2pt.cmx: $(OTOP)/parsing/asttypes.cmi $(OTOP)/parsing/location.cmx \ $(OTOP)/parsing/longident.cmx mLast.cmi $(OTOP)/parsing/parsetree.cmi \ ast2pt.cmi +crc.cmo: $(OTOP)/otherlibs/dynlink/dynlink.cmi +crc.cmx: $(OTOP)/otherlibs/dynlink/dynlink.cmx pcaml.cmo: ast2pt.cmi mLast.cmi quotation.cmi reloc.cmi spretty.cmi pcaml.cmi pcaml.cmx: ast2pt.cmx mLast.cmi quotation.cmx reloc.cmx spretty.cmx pcaml.cmi quotation.cmo: mLast.cmi quotation.cmi diff --git a/camlp4/ocaml_src/camlp4/Makefile b/camlp4/ocaml_src/camlp4/Makefile index 79ef816b..0e5d0576 100644 --- a/camlp4/ocaml_src/camlp4/Makefile +++ b/camlp4/ocaml_src/camlp4/Makefile @@ -37,7 +37,7 @@ camlp4.cmxa: $(CAMLP4_XOBJS) $(OCAMLOPT) $(LINKFLAGS) $(CAMLP4_XOBJS) -a -o camlp4.cmxa clean:: - rm -f *.cm* *.pp[io] *.o *.bak .*.bak *.out *.opt + rm -f *.cm* *.pp[io] *.$(O) *.$(A) *.bak .*.bak *.out *.opt rm -f $(CAMLP4) depend: @@ -64,7 +64,7 @@ install: cp mLast.cmi quotation.cmi ast2pt.cmi pcaml.cmi spretty.cmi "$(LIBDIR)/camlp4/." cp camlp4.cma $(LIBDIR)/camlp4/. if [ -f camlp4.cmxa ]; \ - then cp camlp4.cmxa camlp4.a $(LIBDIR)/camlp4/.; \ + then cp camlp4.cmxa camlp4.$(A) $(LIBDIR)/camlp4/.; \ else : ; \ fi diff --git a/camlp4/ocaml_src/camlp4/ast2pt.ml b/camlp4/ocaml_src/camlp4/ast2pt.ml index 781f7dd5..d742b556 100644 --- a/camlp4/ocaml_src/camlp4/ast2pt.ml +++ b/camlp4/ocaml_src/camlp4/ast2pt.ml @@ -10,31 +10,34 @@ (* *) (***********************************************************************) -(* $Id: ast2pt.ml,v 1.23 2003/07/16 12:50:09 mauny Exp $ *) +(* This file has been generated by program: do not edit! *) -open Stdpp -open MLast -open Parsetree -open Longident -open Asttypes +open Stdpp;; +open MLast;; +open Parsetree;; +open Longident;; +open Asttypes;; -let fast = ref false -let no_constructors_arity = ref false +let fast = ref false;; +let no_constructors_arity = ref false;; let get_tag x = if Obj.is_block (Obj.repr x) then Obj.tag (Obj.repr x) else Obj.magic x +;; -let error loc str = raise_with_loc loc (Failure str) +let error loc str = raise_with_loc loc (Failure str);; let char_of_char_token loc s = try Token.eval_char s with Failure _ as exn -> raise_with_loc loc exn +;; let string_of_string_token loc s = try Token.eval_string s with Failure _ as exn -> raise_with_loc loc exn +;; -let glob_fname = ref "" +let glob_fname = ref "";; let mkloc (bp, ep) = let loc_at n = @@ -43,6 +46,7 @@ let mkloc (bp, ep) = in {Location.loc_start = loc_at bp; Location.loc_end = loc_at ep; Location.loc_ghost = false} +;; let mkghloc (bp, ep) = let loc_at n = @@ -51,25 +55,27 @@ let mkghloc (bp, ep) = in {Location.loc_start = loc_at bp; Location.loc_end = loc_at ep; Location.loc_ghost = true} - -let mktyp loc d = {ptyp_desc = d; ptyp_loc = mkloc loc} -let mkpat loc d = {ppat_desc = d; ppat_loc = mkloc loc} -let mkghpat loc d = {ppat_desc = d; ppat_loc = mkghloc loc} -let mkexp loc d = {pexp_desc = d; pexp_loc = mkloc loc} -let mkmty loc d = {pmty_desc = d; pmty_loc = mkloc loc} -let mksig loc d = {psig_desc = d; psig_loc = mkloc loc} -let mkmod loc d = {pmod_desc = d; pmod_loc = mkloc loc} -let mkstr loc d = {pstr_desc = d; pstr_loc = mkloc loc} -let mkfield loc d = {pfield_desc = d; pfield_loc = mkloc loc} -let mkcty loc d = {pcty_desc = d; pcty_loc = mkloc loc} -let mkpcl loc d = {pcl_desc = d; pcl_loc = mkloc loc} +;; + +let mktyp loc d = {ptyp_desc = d; ptyp_loc = mkloc loc};; +let mkpat loc d = {ppat_desc = d; ppat_loc = mkloc loc};; +let mkghpat loc d = {ppat_desc = d; ppat_loc = mkghloc loc};; +let mkexp loc d = {pexp_desc = d; pexp_loc = mkloc loc};; +let mkmty loc d = {pmty_desc = d; pmty_loc = mkloc loc};; +let mksig loc d = {psig_desc = d; psig_loc = mkloc loc};; +let mkmod loc d = {pmod_desc = d; pmod_loc = mkloc loc};; +let mkstr loc d = {pstr_desc = d; pstr_loc = mkloc loc};; +let mkfield loc d = {pfield_desc = d; pfield_loc = mkloc loc};; +let mkcty loc d = {pcty_desc = d; pcty_loc = mkloc loc};; +let mkpcl loc d = {pcl_desc = d; pcl_loc = mkloc loc};; let mkpolytype t = match t with TyPol (_, _, _) -> t | _ -> TyPol (MLast.loc_of_ctyp t, [], t) +;; -let lident s = Lident s -let ldot l s = Ldot (l, s) +let lident s = Lident s;; +let ldot l s = Ldot (l, s);; let conv_con = let t = Hashtbl.create 73 in @@ -78,6 +84,7 @@ let conv_con = fun s -> try Hashtbl.find t s with Not_found -> s +;; let conv_lab = let t = Hashtbl.create 73 in @@ -85,14 +92,17 @@ let conv_lab = fun s -> try Hashtbl.find t s with Not_found -> s +;; let array_function str name = ldot (lident str) (if !fast then "unsafe_" ^ name else name) +;; let mkrf = function true -> Recursive | false -> Nonrecursive +;; let mkli s = let rec loop f = @@ -101,16 +111,19 @@ let mkli s = | [] -> f s in loop (fun s -> lident s) +;; let long_id_of_string_list loc sl = match List.rev sl with [] -> error loc "bad ast" | s :: sl -> mkli s (List.rev sl) +;; let rec ctyp_fa al = function TyApp (_, f, a) -> ctyp_fa (a :: al) f | f -> f, al +;; let rec ctyp_long_id = function @@ -125,6 +138,7 @@ let rec ctyp_long_id = | TyLid (_, s) -> false, lident s | TyCls (loc, sl) -> true, long_id_of_string_list loc sl | t -> error (loc_of_ctyp t) "incorrect type" +;; let rec ctyp = function @@ -185,15 +199,17 @@ and meth_list loc fl v = [] -> if v then [mkfield loc Pfield_var] else [] | (lab, t) :: fl -> mkfield loc (Pfield (lab, ctyp (mkpolytype t))) :: meth_list loc fl v +;; let mktype loc tl cl tk tm = let (params, variance) = List.split tl in {ptype_params = params; ptype_cstrs = cl; ptype_kind = tk; ptype_manifest = tm; ptype_loc = mkloc loc; ptype_variance = variance} -let mkmutable m = if m then Mutable else Immutable -let mkprivate m = if m then Private else Public -let mktrecord (_, n, m, t) = n, mkmutable m, ctyp (mkpolytype t) -let mkvariant (_, c, tl) = c, List.map ctyp tl +;; +let mkmutable m = if m then Mutable else Immutable;; +let mkprivate m = if m then Private else Public;; +let mktrecord (_, n, m, t) = n, mkmutable m, ctyp (mkpolytype t);; +let mkvariant (_, c, tl) = c, List.map ctyp tl;; let type_decl tl cl = function TyMan (loc, t, TyRec (_, pflag, ltl)) -> @@ -217,23 +233,27 @@ let type_decl tl cl = | _ -> Some (ctyp t) in mktype (loc_of_ctyp t) tl cl Ptype_abstract m +;; -let mkvalue_desc t p = {pval_type = ctyp t; pval_prim = p} +let mkvalue_desc t p = {pval_type = ctyp t; pval_prim = p};; let option f = function Some x -> Some (f x) | None -> None +;; let expr_of_lab loc lab = function Some e -> e | None -> ExLid (loc, lab) +;; let patt_of_lab loc lab = function Some p -> p | None -> PaLid (loc, lab) +;; let paolab loc lab peoo = let lab = @@ -248,6 +268,7 @@ let paolab loc lab peoo = | None -> PaLid (loc, lab), None in lab, p, eo +;; let rec same_type_expr ct ce = match ct, ce with @@ -256,6 +277,7 @@ let rec same_type_expr ct ce = | TyAcc (_, t1, t2), ExAcc (_, e1, e2) -> same_type_expr t1 e1 && same_type_expr t2 e2 | _ -> false +;; let rec common_id loc t e = match t, e with @@ -266,6 +288,7 @@ let rec common_id loc t e = | TyAcc (_, t1, TyUid (_, s1)), ExAcc (_, e1, ExUid (_, s2)) when s1 = s2 -> ldot (common_id loc t1 e1) s1 | _ -> error loc "this expression should repeat the class id inherited" +;; let rec type_id loc t = match t with @@ -274,6 +297,7 @@ let rec type_id loc t = | TyAcc (_, t1, TyLid (_, s1)) -> ldot (type_id loc t1) s1 | TyAcc (_, t1, TyUid (_, s1)) -> ldot (type_id loc t1) s1 | _ -> error loc "type identifier expected" +;; let rec module_type_long_id = function @@ -284,12 +308,14 @@ let rec module_type_long_id = | MtLid (_, s) -> lident s | MtUid (_, s) -> lident s | t -> error (loc_of_module_type t) "bad module type long ident" +;; let rec module_expr_long_id = function MeAcc (_, m, MeUid (_, s)) -> ldot (module_expr_long_id m) s | MeUid (_, s) -> lident s | t -> error (loc_of_module_expr t) "bad module expr long ident" +;; let mkwithc = function @@ -302,11 +328,13 @@ let mkwithc = ptype_variance = variance} | WcMod (loc, id, m) -> long_id_of_string_list loc id, Pwith_module (module_expr_long_id m) +;; let rec patt_fa al = function PaApp (_, f, a) -> patt_fa (a :: al) f | f -> f, al +;; let rec deep_mkrangepat loc c1 c2 = if c1 = c2 then mkghpat loc (Ppat_constant (Const_char c1)) @@ -315,6 +343,7 @@ let rec deep_mkrangepat loc c1 c2 = (Ppat_or (mkghpat loc (Ppat_constant (Const_char c1)), deep_mkrangepat loc (Char.chr (Char.code c1 + 1)) c2)) +;; let rec mkrangepat loc c1 c2 = if c1 > c2 then mkrangepat loc c2 c1 @@ -324,11 +353,13 @@ let rec mkrangepat loc c1 c2 = (Ppat_or (mkghpat loc (Ppat_constant (Const_char c1)), deep_mkrangepat loc (Char.chr (Char.code c1 + 1)) c2)) +;; let rec patt_long_id il = function PaAcc (_, p, PaUid (_, i)) -> patt_long_id (i :: il) p | p -> p, il +;; let rec patt_label_long_id = function @@ -337,6 +368,7 @@ let rec patt_label_long_id = | PaUid (_, s) -> lident s | PaLid (_, s) -> lident (conv_lab s) | p -> error (loc_of_patt p) "bad label" +;; let rec patt = function @@ -422,17 +454,19 @@ let rec patt = let ca = not !no_constructors_arity in mkpat loc (Ppat_construct (lident (conv_con s), None, ca)) | PaVrn (loc, s) -> mkpat loc (Ppat_variant (s, None)) -and mklabpat (lab, p) = patt_label_long_id lab, patt p +and mklabpat (lab, p) = patt_label_long_id lab, patt p;; let rec expr_fa al = function ExApp (_, f, a) -> expr_fa (a :: al) f | f -> f, al +;; let rec class_expr_fa al = function CeApp (_, ce, a) -> class_expr_fa (a :: al) ce | ce -> ce, al +;; let rec sep_expr_acc l = function @@ -443,6 +477,7 @@ let rec sep_expr_acc l = | ((_, ep), sl, e) :: l -> ((bp, ep), s :: sl, e) :: l end | e -> (loc_of_expr e, [], e) :: l +;; (* value expr_label_long_id e = @@ -458,11 +493,13 @@ let class_info class_expr ci = pci_params = params, mkloc (fst ci.ciPrm); pci_name = ci.ciNam; pci_expr = class_expr ci.ciExp; pci_loc = mkloc ci.ciLoc; pci_variance = variance} +;; let apply_with_var v x f = let vx = !v in try v := x; let r = f () in v := vx; r with e -> v := vx; raise e +;; let rec expr = function @@ -674,9 +711,9 @@ and sig_item s l = | SgInc (loc, mt) -> mksig loc (Psig_include (module_type mt)) :: l | SgMod (loc, n, mt) -> mksig loc (Psig_module (n, module_type mt)) :: l | SgRecMod (loc, nmts) -> - List.fold_right - (fun (n, mt) l -> mksig loc (Psig_module (n, module_type mt)) :: l) - nmts l + mksig loc + (Psig_recmodule (List.map (fun (n, mt) -> n, module_type mt) nmts)) :: + l | SgMty (loc, n, mt) -> let si = match mt with @@ -810,9 +847,10 @@ and class_str_item c l = | CrVal (loc, s, b, e) -> Pcf_val (s, mkmutable b, expr e, mkloc loc) :: l | CrVir (loc, s, b, t) -> Pcf_virt (s, mkprivate b, ctyp (mkpolytype t), mkloc loc) :: l +;; -let interf ast = List.fold_right sig_item ast [] -let implem ast = List.fold_right str_item ast [] +let interf ast = List.fold_right sig_item ast [];; +let implem ast = List.fold_right str_item ast [];; let directive loc = function @@ -833,8 +871,10 @@ let directive loc = loop e in Pdir_ident (long_id_of_string_list loc sl) +;; let phrase = function StDir (loc, d, dp) -> Ptop_dir (d, directive loc dp) | si -> Ptop_def (str_item si []) +;; diff --git a/camlp4/ocaml_src/camlp4/mLast.mli b/camlp4/ocaml_src/camlp4/mLast.mli index 518d11b9..54a66b9c 100644 --- a/camlp4/ocaml_src/camlp4/mLast.mli +++ b/camlp4/ocaml_src/camlp4/mLast.mli @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: mLast.mli,v 1.16 2003/07/16 12:50:09 mauny Exp $ *) +(* This file has been generated by program: do not edit! *) (* Module [MLast]: abstract syntax tree @@ -19,7 +19,7 @@ these values in concrete syntax (see the Camlp4 documentation). See also the file q_MLast.ml in Camlp4 sources. *) -type loc = int * int +type loc = int * int;; type ctyp = TyAcc of loc * ctyp * ctyp @@ -43,6 +43,7 @@ type ctyp = and row_field = RfTag of string * bool * ctyp list | RfInh of ctyp +;; type 'a class_infos = { ciLoc : loc; @@ -50,6 +51,7 @@ type 'a class_infos = ciPrm : loc * (string * (bool * bool)) list; ciNam : string; ciExp : 'a } +;; type patt = PaAcc of loc * patt * patt @@ -193,16 +195,17 @@ and class_str_item = | CrMth of loc * string * bool * expr * ctyp option | CrVal of loc * string * bool * expr | CrVir of loc * string * bool * ctyp +;; -external loc_of_ctyp : ctyp -> loc = "%field0" -external loc_of_patt : patt -> loc = "%field0" -external loc_of_expr : expr -> loc = "%field0" -external loc_of_module_type : module_type -> loc = "%field0" -external loc_of_module_expr : module_expr -> loc = "%field0" -external loc_of_sig_item : sig_item -> loc = "%field0" -external loc_of_str_item : str_item -> loc = "%field0" +external loc_of_ctyp : ctyp -> loc = "%field0";; +external loc_of_patt : patt -> loc = "%field0";; +external loc_of_expr : expr -> loc = "%field0";; +external loc_of_module_type : module_type -> loc = "%field0";; +external loc_of_module_expr : module_expr -> loc = "%field0";; +external loc_of_sig_item : sig_item -> loc = "%field0";; +external loc_of_str_item : str_item -> loc = "%field0";; -external loc_of_class_type : class_type -> loc = "%field0" -external loc_of_class_sig_item : class_sig_item -> loc = "%field0" -external loc_of_class_expr : class_expr -> loc = "%field0" -external loc_of_class_str_item : class_str_item -> loc = "%field0" +external loc_of_class_type : class_type -> loc = "%field0";; +external loc_of_class_sig_item : class_sig_item -> loc = "%field0";; +external loc_of_class_expr : class_expr -> loc = "%field0";; +external loc_of_class_str_item : class_str_item -> loc = "%field0";; diff --git a/camlp4/ocaml_src/camlp4/reloc.ml b/camlp4/ocaml_src/camlp4/reloc.ml index da62c467..980d6ce7 100644 --- a/camlp4/ocaml_src/camlp4/reloc.ml +++ b/camlp4/ocaml_src/camlp4/reloc.ml @@ -10,14 +10,15 @@ (* *) (***********************************************************************) -(* $Id: reloc.ml,v 1.15 2003/07/16 12:50:09 mauny Exp $ *) +(* This file has been generated by program: do not edit! *) -open MLast +open MLast;; let option_map f = function Some x -> Some (f x) | None -> None +;; let rec ctyp floc sh = let rec self = @@ -54,11 +55,13 @@ and row_field floc sh = function RfTag (x1, x2, x3) -> RfTag (x1, x2, List.map (ctyp floc sh) x3) | RfInh x1 -> RfInh (ctyp floc sh x1) +;; let class_infos a floc sh x = {ciLoc = floc x.ciLoc; ciVir = x.ciVir; ciPrm = begin let (x1, x2) = x.ciPrm in floc x1, x2 end; ciNam = x.ciNam; ciExp = a floc sh x.ciExp} +;; let rec patt floc sh = let rec self = @@ -331,3 +334,4 @@ and class_str_item floc sh = | CrVir (loc, x1, x2, x3) -> CrVir (floc loc, x1, x2, ctyp floc sh x3) in self +;; diff --git a/camlp4/ocaml_src/camlp4/spretty.ml b/camlp4/ocaml_src/camlp4/spretty.ml index fc21f735..ada592b6 100644 --- a/camlp4/ocaml_src/camlp4/spretty.ml +++ b/camlp4/ocaml_src/camlp4/spretty.ml @@ -222,7 +222,7 @@ let rec hprint_pretty tab pos spc = | VL [] -> pos, spc | VL x -> hprint_box tab pos spc x | BE x -> hprint_box tab pos spc x - | BV x -> invalid_arg "hprint_pretty" + | BV x -> hprint_box tab pos spc x | LI ((comm, nl_bef, tab_bef), x) -> if !lazy_tab >= 0 then begin diff --git a/camlp4/ocaml_src/lib/Makefile b/camlp4/ocaml_src/lib/Makefile index d587e744..e19e5205 100644 --- a/camlp4/ocaml_src/lib/Makefile +++ b/camlp4/ocaml_src/lib/Makefile @@ -18,7 +18,7 @@ $(TARGET:.cma=.cmxa): $(OBJS:.cmo=.cmx) $(OCAMLOPT) $(OBJS:.cmo=.cmx) -a -o $(TARGET:.cma=.cmxa) clean:: - rm -f *.cm[ioax] *.cmxa *.pp[io] *.o *.a *.bak .*.bak $(TARGET) + rm -f *.cm[ioax] *.cmxa *.pp[io] *.$(O) *.$(A) *.bak .*.bak $(TARGET) depend: cp .depend .depend.bak @@ -43,10 +43,6 @@ install: installopt: cp $(TARGET:.cma=.cmxa) *.cmx "$(LIBDIR)/camlp4/." - if test -f $(TARGET:.cma=.lib); then \ - cp $(TARGET:.cma=.lib) "$(LIBDIR)/camlp4/."; \ - else \ - tar cf - $(TARGET:.cma=.a) | (cd "$(LIBDIR)/camlp4/."; tar xf -); \ - fi + tar cf - $(TARGET:.cma=.$(A)) | (cd "$(LIBDIR)/camlp4/."; tar xf -) include .depend diff --git a/camlp4/ocaml_src/lib/plexer.ml b/camlp4/ocaml_src/lib/plexer.ml index 383f5848..329e0b77 100644 --- a/camlp4/ocaml_src/lib/plexer.ml +++ b/camlp4/ocaml_src/lib/plexer.ml @@ -10,27 +10,29 @@ (* *) (***********************************************************************) -(* $Id: plexer.ml,v 1.16 2003/07/15 09:13:59 mauny Exp $ *) +(* This file has been generated by program: do not edit! *) -open Stdpp -open Token +open Stdpp;; +open Token;; -let no_quotations = ref false +let no_quotations = ref false;; (* The string buffering machinery *) -let buff = ref (String.create 80) +let buff = ref (String.create 80);; let store len x = if len >= String.length !buff then buff := !buff ^ String.create (String.length !buff); !buff.[len] <- x; succ len +;; let mstore len s = let rec add_rec len i = if i == String.length s then len else add_rec (store len s.[i]) (succ i) in add_rec len 0 -let get_buff len = String.sub !buff 0 len +;; +let get_buff len = String.sub !buff 0 len;; (* The lexer *) @@ -42,6 +44,7 @@ let stream_peek_nth n strm = | _ :: l -> loop (n - 1) l in loop n (Stream.npeek n strm) +;; let rec ident len (strm__ : _ Stream.t) = match Stream.peek strm__ with @@ -137,9 +140,10 @@ and end_exponent_part_under len (strm__ : _ Stream.t) = Stream.junk strm__; end_exponent_part_under (store len c) strm__ | Some '_' -> Stream.junk strm__; end_exponent_part_under len strm__ | _ -> "FLOAT", get_buff len +;; -let error_on_unknown_keywords = ref false -let err loc msg = raise_with_loc loc (Token.Error msg) +let error_on_unknown_keywords = ref false;; +let err loc msg = raise_with_loc loc (Token.Error msg);; (* value next_token_fun dfa find_kwd = @@ -479,6 +483,13 @@ let next_token_fun dfa ssd find_kwd bolpos glexr = if !error_on_unknown_keywords then err loc ("illegal token: " ^ s) else ("", s), loc in + let error_if_keyword ((_, id), loc as a) = + try + ignore (find_kwd id); + err loc ("illegal use of a keyword as a label: " ^ id) + with + Not_found -> a + in let rec next_token after_space (strm__ : _ Stream.t) = let bp = Stream.count strm__ in match Stream.peek strm__ with @@ -549,8 +560,17 @@ let next_token_fun dfa ssd find_kwd bolpos glexr = try ident (store 0 c) strm__ with Stream.Failure -> raise (Stream.Error "") in + let s = strm__ in let ep = Stream.count strm__ in - ("TILDEIDENT", get_buff len), (bp, ep) + let id = get_buff len in + let (strm__ : _ Stream.t) = s in + begin match Stream.peek strm__ with + Some ':' -> + Stream.junk strm__; + let eb = Stream.count strm__ in + error_if_keyword (("LABEL", id), (bp, ep)) + | _ -> error_if_keyword (("TILDEIDENT", id), (bp, ep)) + end | _ -> let id = get_buff (ident2 (store 0 c) strm__) in keyword_or_error (bp, Stream.count strm__) id @@ -567,8 +587,17 @@ let next_token_fun dfa ssd find_kwd bolpos glexr = try ident (store 0 c) strm__ with Stream.Failure -> raise (Stream.Error "") in + let s = strm__ in let ep = Stream.count strm__ in - ("QUESTIONIDENT", get_buff len), (bp, ep) + let id = get_buff len in + let (strm__ : _ Stream.t) = s in + begin match Stream.peek strm__ with + Some ':' -> + Stream.junk strm__; + let eb = Stream.count strm__ in + error_if_keyword (("OPTLABEL", id), (bp, ep)) + | _ -> error_if_keyword (("QUESTIONIDENT", id), (bp, ep)) + end | _ -> let id = get_buff (ident2 (store 0 c) strm__) in keyword_or_error (bp, Stream.count strm__) id @@ -954,10 +983,11 @@ let next_token_fun dfa ssd find_kwd bolpos glexr = r with Stream.Error str -> err (Stream.count cstrm, Stream.count cstrm + 1) str +;; -let dollar_for_antiquotation = ref true -let specific_space_dot = ref false +let dollar_for_antiquotation = ref true;; +let specific_space_dot = ref false;; let func kwd_table glexr = let bolpos = ref 0 in @@ -965,6 +995,7 @@ let func kwd_table glexr = let dfa = !dollar_for_antiquotation in let ssd = !specific_space_dot in Token.lexer_func_of_parser (next_token_fun dfa ssd find bolpos glexr) +;; let rec check_keyword_stream (strm__ : _ Stream.t) = let _ = check strm__ in @@ -1050,10 +1081,12 @@ and check_ident2 (strm__ : _ Stream.t) = '.' | ':' | '<' | '>' | '|') -> Stream.junk strm__; check_ident2 strm__ | _ -> () +;; let check_keyword s = try check_keyword_stream (Stream.of_string s) with _ -> false +;; let error_no_respect_rules p_con p_prm = raise @@ -1063,12 +1096,14 @@ let error_no_respect_rules p_con p_prm = else if p_prm = "" then p_con else p_con ^ " \"" ^ p_prm ^ "\"") ^ " does not respect Plexer rules")) +;; let error_ident_and_keyword p_con p_prm = raise (Token.Error ("the token \"" ^ p_prm ^ "\" is used as " ^ p_con ^ " and as keyword")) +;; let using_token kwd_table ident_table (p_con, p_prm) = match p_con with @@ -1099,14 +1134,15 @@ let using_token kwd_table ident_table (p_con, p_prm) = error_ident_and_keyword p_con p_prm else Hashtbl.add ident_table p_prm p_con end - | "TILDEIDENT" | "QUESTIONIDENT" | "INT" | "INT32" | "INT64" | - "NATIVEINT" | "FLOAT" | "CHAR" | "STRING" | "QUOTATION" | "ANTIQUOT" | - "LOCATE" | "EOI" -> + | "INT" | "INT32" | "INT64" | "NATIVEINT" | "FLOAT" | "CHAR" | "STRING" | + "TILDEIDENT" | "QUESTIONIDENT" | "LABEL" | "OPTLABEL" | "QUOTATION" | + "ANTIQUOT" | "LOCATE" | "EOI" -> () | _ -> raise (Token.Error ("the constructor \"" ^ p_con ^ "\" is not recognized by Plexer")) +;; let removing_token kwd_table ident_table (p_con, p_prm) = match p_con with @@ -1114,6 +1150,7 @@ let removing_token kwd_table ident_table (p_con, p_prm) = | "LIDENT" | "UIDENT" -> if p_prm <> "" then Hashtbl.remove ident_table p_prm | _ -> () +;; let text = function @@ -1136,6 +1173,7 @@ let text = | "EOI", "" -> "end of input" | con, "" -> con | con, prm -> con ^ " \"" ^ prm ^ "\"" +;; let eq_before_colon p e = let rec loop i = @@ -1146,6 +1184,7 @@ let eq_before_colon p e = else false in loop 0 +;; let after_colon e = try @@ -1153,6 +1192,7 @@ let after_colon e = String.sub e (i + 1) (String.length e - i - 1) with Not_found -> "" +;; let tok_match = function @@ -1162,22 +1202,18 @@ let tok_match = | _ -> raise Stream.Failure end | tok -> Token.default_match tok +;; let gmake () = let kwd_table = Hashtbl.create 301 in let id_table = Hashtbl.create 301 in let glexr = ref - {tok_func = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 959, 17))); - tok_using = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 959, 37))); - tok_removing = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 959, 60))); - tok_match = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 960, 18))); - tok_text = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 960, 37))); + {tok_func = (fun _ -> raise (Match_failure ("plexer.ml", 972, 17))); + tok_using = (fun _ -> raise (Match_failure ("plexer.ml", 972, 37))); + tok_removing = (fun _ -> raise (Match_failure ("plexer.ml", 972, 60))); + tok_match = (fun _ -> raise (Match_failure ("plexer.ml", 973, 18))); + tok_text = (fun _ -> raise (Match_failure ("plexer.ml", 973, 37))); tok_comm = None} in let glex = @@ -1187,6 +1223,7 @@ let gmake () = tok_text = text; tok_comm = None} in glexr := glex; glex +;; let tparse = function @@ -1199,23 +1236,21 @@ let tparse = in Some p | _ -> None +;; let make () = let kwd_table = Hashtbl.create 301 in let id_table = Hashtbl.create 301 in let glexr = ref - {tok_func = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 988, 17))); - tok_using = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 988, 37))); + {tok_func = (fun _ -> raise (Match_failure ("plexer.ml", 1001, 17))); + tok_using = (fun _ -> raise (Match_failure ("plexer.ml", 1001, 37))); tok_removing = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 988, 60))); - tok_match = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 989, 18))); - tok_text = - (fun _ -> raise (Match_failure ("../../lib/plexer.ml", 989, 37))); + (fun _ -> raise (Match_failure ("plexer.ml", 1001, 60))); + tok_match = (fun _ -> raise (Match_failure ("plexer.ml", 1002, 18))); + tok_text = (fun _ -> raise (Match_failure ("plexer.ml", 1002, 37))); tok_comm = None} in {func = func kwd_table glexr; using = using_token kwd_table id_table; removing = removing_token kwd_table id_table; tparse = tparse; text = text} +;; diff --git a/camlp4/ocaml_src/lib/plexer.mli b/camlp4/ocaml_src/lib/plexer.mli index a541007d..601c1753 100644 --- a/camlp4/ocaml_src/lib/plexer.mli +++ b/camlp4/ocaml_src/lib/plexer.mli @@ -22,7 +22,7 @@ val gmake : unit -> Token.t Token.glexer;; - * [("", s)] is the keyword [s]. - * [("LIDENT", s)] is the ident [s] starting with a lowercase letter. - * [("UIDENT", s)] is the ident [s] starting with an uppercase letter. -- * [("INT", s)] (resp. ["INT32"], ["INT64"] and ["NATIVEINT"]) +- * [("INT", s)] (resp. ["INT32"], ["INT64"] and ["NATIVEINT"]) is an integer constant whose string source is [s]. - * [("FLOAT", s)] is a float constant whose string source is [s]. - * [("STRING", s)] is the string constant [s]. diff --git a/camlp4/ocaml_src/meta/.depend b/camlp4/ocaml_src/meta/.depend index 8f5e0cff..737ea5ec 100644 --- a/camlp4/ocaml_src/meta/.depend +++ b/camlp4/ocaml_src/meta/.depend @@ -4,6 +4,8 @@ pa_extend_m.cmo: pa_extend.cmo pa_extend_m.cmx: pa_extend.cmx pa_ifdef.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_ifdef.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx +pa_macro.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi +pa_macro.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_r.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi pa_r.cmx: ../camlp4/mLast.cmi ../camlp4/pcaml.cmx pa_rp.cmo: ../camlp4/mLast.cmi ../camlp4/pcaml.cmi diff --git a/camlp4/ocaml_src/meta/Makefile b/camlp4/ocaml_src/meta/Makefile index a7cd03d7..3996cd2c 100644 --- a/camlp4/ocaml_src/meta/Makefile +++ b/camlp4/ocaml_src/meta/Makefile @@ -5,8 +5,9 @@ include ../../config/Makefile INCLUDES=-I ../camlp4 -I ../../boot -I $(OTOP)/utils OCAMLCFLAGS=-warn-error A $(INCLUDES) OBJS=q_MLast.cmo pa_r.cmo pa_rp.cmo pa_extend.cmo pa_extend_m.cmo pa_macro.cmo pr_dump.cmo +OBJSX=$(OBJS:.cmo=.cmx) CAMLP4RM=pa_r.cmo pa_rp.cmo pr_dump.cmo -CAMLP4RMX=pa_r.cmx pa_rp.cmx pr_dump.cmx +CAMLP4RMX=$(CAMLP4RM:.cmo=.cmx) SHELL=/bin/sh COUT=$(OBJS) camlp4r$(EXE) COPT=camlp4r.opt @@ -46,6 +47,13 @@ install: cp $(OBJS) "$(LIBDIR)/camlp4/." cp pa_macro.cmi pa_extend.cmi "$(LIBDIR)/camlp4/." cp camlp4r$(EXE) "$(BINDIR)/." - if test -f $(COPT); then cp $(COPT) "$(BINDIR)/."; fi + if test -f camlp4r.opt; then \ + cp camlp4r.opt "$(BINDIR)/camlp4r.opt$(EXE)" ;\ + for target in $(OBJSX) $(OBJSX:.cmx=.$(O)) ; do \ + if test -f $$target; then \ + cp $$target "$(LIBDIR)/camlp4/."; \ + fi; \ + done; \ + fi include .depend diff --git a/camlp4/ocaml_src/meta/pa_r.ml b/camlp4/ocaml_src/meta/pa_r.ml index 74a74f93..75d5c254 100644 --- a/camlp4/ocaml_src/meta/pa_r.ml +++ b/camlp4/ocaml_src/meta/pa_r.ml @@ -10,12 +10,12 @@ (* *) (***********************************************************************) -(* $Id: pa_r.ml,v 1.46 2003/07/16 12:50:09 mauny Exp $ *) +(* This file has been generated by program: do not edit! *) -open Stdpp -open Pcaml +open Stdpp;; +open Pcaml;; -let _ = Pcaml.no_constructors_arity := false +Pcaml.no_constructors_arity := false;; let help_sequences () = Printf.eprintf "\ @@ -31,45 +31,46 @@ To avoid compilation warning use the new syntax. "; flush stderr; exit 1 -let _ = - Pcaml.add_option "-help_seq" (Arg.Unit help_sequences) - "Print explanations about new sequences and exit." +;; +Pcaml.add_option "-help_seq" (Arg.Unit help_sequences) + "Print explanations about new sequences and exit.";; -let _ = - let odfa = !(Plexer.dollar_for_antiquotation) in - Plexer.dollar_for_antiquotation := false; - Grammar.Unsafe.gram_reinit gram (Plexer.gmake ()); - Plexer.dollar_for_antiquotation := odfa; - Grammar.Unsafe.clear_entry interf; - Grammar.Unsafe.clear_entry implem; - Grammar.Unsafe.clear_entry top_phrase; - Grammar.Unsafe.clear_entry use_file; - Grammar.Unsafe.clear_entry module_type; - Grammar.Unsafe.clear_entry module_expr; - Grammar.Unsafe.clear_entry sig_item; - Grammar.Unsafe.clear_entry str_item; - Grammar.Unsafe.clear_entry expr; - Grammar.Unsafe.clear_entry patt; - Grammar.Unsafe.clear_entry ctyp; - Grammar.Unsafe.clear_entry let_binding; - Grammar.Unsafe.clear_entry type_declaration; - Grammar.Unsafe.clear_entry class_type; - Grammar.Unsafe.clear_entry class_expr; - Grammar.Unsafe.clear_entry class_sig_item; - Grammar.Unsafe.clear_entry class_str_item +let odfa = !(Plexer.dollar_for_antiquotation) in +Plexer.dollar_for_antiquotation := false; +Grammar.Unsafe.gram_reinit gram (Plexer.gmake ()); +Plexer.dollar_for_antiquotation := odfa; +Grammar.Unsafe.clear_entry interf; +Grammar.Unsafe.clear_entry implem; +Grammar.Unsafe.clear_entry top_phrase; +Grammar.Unsafe.clear_entry use_file; +Grammar.Unsafe.clear_entry module_type; +Grammar.Unsafe.clear_entry module_expr; +Grammar.Unsafe.clear_entry sig_item; +Grammar.Unsafe.clear_entry str_item; +Grammar.Unsafe.clear_entry expr; +Grammar.Unsafe.clear_entry patt; +Grammar.Unsafe.clear_entry ctyp; +Grammar.Unsafe.clear_entry let_binding; +Grammar.Unsafe.clear_entry type_declaration; +Grammar.Unsafe.clear_entry class_type; +Grammar.Unsafe.clear_entry class_expr; +Grammar.Unsafe.clear_entry class_sig_item; +Grammar.Unsafe.clear_entry class_str_item;; -let _ = Pcaml.parse_interf := Grammar.Entry.parse interf -let _ = Pcaml.parse_implem := Grammar.Entry.parse implem +Pcaml.parse_interf := Grammar.Entry.parse interf;; +Pcaml.parse_implem := Grammar.Entry.parse implem;; let o2b = function Some _ -> true | None -> false +;; let mksequence loc = function [e] -> e | el -> MLast.ExSeq (loc, el) +;; let mkmatchcase loc p aso w e = let p = @@ -78,10 +79,12 @@ let mkmatchcase loc p aso w e = | _ -> p in p, w, e +;; let neg_string n = let len = String.length n in if len > 0 && n.[0] = '-' then String.sub n 1 (len - 1) else "-" ^ n +;; let mkumin loc f arg = match arg with @@ -91,6 +94,7 @@ let mkumin loc f arg = | MLast.ExNativeInt (loc, n) -> MLast.ExNativeInt (loc, neg_string n) | MLast.ExFlo (_, n) -> MLast.ExFlo (loc, neg_string n) | _ -> let f = "~" ^ f in MLast.ExApp (loc, MLast.ExLid (loc, f), arg) +;; let mklistexp loc last = let rec loop top = @@ -106,6 +110,7 @@ let mklistexp loc last = (loc, MLast.ExApp (loc, MLast.ExUid (loc, "::"), e1), loop false el) in loop true +;; let mklistpat loc last = let rec loop top = @@ -121,6 +126,7 @@ let mklistpat loc last = (loc, MLast.PaApp (loc, MLast.PaUid (loc, "::"), p1), loop false pl) in loop true +;; let mkexprident loc i j = let rec loop m = @@ -129,13 +135,15 @@ let mkexprident loc i j = | e -> MLast.ExAcc (loc, m, e) in loop (MLast.ExUid (loc, i)) j +;; let mkassert loc e = match e with MLast.ExUid (_, "False") -> MLast.ExAsf loc | _ -> MLast.ExAsr (loc, e) +;; -let append_elem el e = el @ [e] +let append_elem el e = el @ [e];; (* ...suppose to flush the input in case of syntax error to avoid multiple errors in case of cut-and-paste in the xterm, but work bad: for example @@ -153,11 +161,11 @@ and sync_semi cs = Pcaml.sync.val := sync; *) -let ipatt = Grammar.Entry.create gram "ipatt" -let with_constr = Grammar.Entry.create gram "with_constr" -let row_field = Grammar.Entry.create gram "row_field" +let ipatt = Grammar.Entry.create gram "ipatt";; +let with_constr = Grammar.Entry.create gram "with_constr";; +let row_field = Grammar.Entry.create gram "row_field";; -let not_yet_warned_variant = ref true +let not_yet_warned_variant = ref true;; let warn_variant loc = if !not_yet_warned_variant then begin @@ -166,8 +174,9 @@ let warn_variant loc = (Printf.sprintf "use of syntax of variants types deprecated since version 3.05") end +;; -let not_yet_warned = ref true +let not_yet_warned = ref true;; let warn_sequence loc = if !not_yet_warned then begin @@ -175,2656 +184,2633 @@ let warn_sequence loc = !(Pcaml.warning) loc "use of syntax of sequences deprecated since version 3.01.1" end -let _ = - Pcaml.add_option "-no_warn_seq" (Arg.Clear not_yet_warned) - "No warning when using old syntax for sequences." +;; +Pcaml.add_option "-no_warn_seq" (Arg.Clear not_yet_warned) + "No warning when using old syntax for sequences.";; -let _ = - Grammar.extend - (let _ = (sig_item : 'sig_item Grammar.Entry.e) - and _ = (str_item : 'str_item Grammar.Entry.e) - and _ = (ctyp : 'ctyp Grammar.Entry.e) - and _ = (patt : 'patt Grammar.Entry.e) - and _ = (expr : 'expr Grammar.Entry.e) - and _ = (module_type : 'module_type Grammar.Entry.e) - and _ = (module_expr : 'module_expr Grammar.Entry.e) - and _ = (class_type : 'class_type Grammar.Entry.e) - and _ = (class_expr : 'class_expr Grammar.Entry.e) - and _ = (class_sig_item : 'class_sig_item Grammar.Entry.e) - and _ = (class_str_item : 'class_str_item Grammar.Entry.e) - and _ = (let_binding : 'let_binding Grammar.Entry.e) - and _ = (type_declaration : 'type_declaration Grammar.Entry.e) - and _ = (ipatt : 'ipatt Grammar.Entry.e) - and _ = (with_constr : 'with_constr Grammar.Entry.e) - and _ = (row_field : 'row_field Grammar.Entry.e) in - let grammar_entry_create s = - Grammar.Entry.create (Grammar.of_entry sig_item) s - in - let rebind_exn : 'rebind_exn Grammar.Entry.e = - grammar_entry_create "rebind_exn" - and module_binding : 'module_binding Grammar.Entry.e = - grammar_entry_create "module_binding" - and module_rec_binding : 'module_rec_binding Grammar.Entry.e = - grammar_entry_create "module_rec_binding" - and module_declaration : 'module_declaration Grammar.Entry.e = - grammar_entry_create "module_declaration" - and module_rec_declaration : 'module_rec_declaration Grammar.Entry.e = - grammar_entry_create "module_rec_declaration" - and cons_expr_opt : 'cons_expr_opt Grammar.Entry.e = - grammar_entry_create "cons_expr_opt" - and dummy : 'dummy Grammar.Entry.e = grammar_entry_create "dummy" - and sequence : 'sequence Grammar.Entry.e = - grammar_entry_create "sequence" - and fun_binding : 'fun_binding Grammar.Entry.e = - grammar_entry_create "fun_binding" - and match_case : 'match_case Grammar.Entry.e = - grammar_entry_create "match_case" - and as_patt_opt : 'as_patt_opt Grammar.Entry.e = - grammar_entry_create "as_patt_opt" - and when_expr_opt : 'when_expr_opt Grammar.Entry.e = - grammar_entry_create "when_expr_opt" - and label_expr : 'label_expr Grammar.Entry.e = - grammar_entry_create "label_expr" - and expr_ident : 'expr_ident Grammar.Entry.e = - grammar_entry_create "expr_ident" - and fun_def : 'fun_def Grammar.Entry.e = grammar_entry_create "fun_def" - and cons_patt_opt : 'cons_patt_opt Grammar.Entry.e = - grammar_entry_create "cons_patt_opt" - and label_patt : 'label_patt Grammar.Entry.e = - grammar_entry_create "label_patt" - and patt_label_ident : 'patt_label_ident Grammar.Entry.e = - grammar_entry_create "patt_label_ident" - and label_ipatt : 'label_ipatt Grammar.Entry.e = - grammar_entry_create "label_ipatt" - and type_patt : 'type_patt Grammar.Entry.e = - grammar_entry_create "type_patt" - and constrain : 'constrain Grammar.Entry.e = - grammar_entry_create "constrain" - and type_parameter : 'type_parameter Grammar.Entry.e = - grammar_entry_create "type_parameter" - and constructor_declaration : 'constructor_declaration Grammar.Entry.e = - grammar_entry_create "constructor_declaration" - and label_declaration : 'label_declaration Grammar.Entry.e = - grammar_entry_create "label_declaration" - and ident : 'ident Grammar.Entry.e = grammar_entry_create "ident" - and mod_ident : 'mod_ident Grammar.Entry.e = - grammar_entry_create "mod_ident" - and class_declaration : 'class_declaration Grammar.Entry.e = - grammar_entry_create "class_declaration" - and class_fun_binding : 'class_fun_binding Grammar.Entry.e = - grammar_entry_create "class_fun_binding" - and class_type_parameters : 'class_type_parameters Grammar.Entry.e = - grammar_entry_create "class_type_parameters" - and class_fun_def : 'class_fun_def Grammar.Entry.e = - grammar_entry_create "class_fun_def" - and class_structure : 'class_structure Grammar.Entry.e = - grammar_entry_create "class_structure" - and class_self_patt : 'class_self_patt Grammar.Entry.e = - grammar_entry_create "class_self_patt" - and as_lident : 'as_lident Grammar.Entry.e = - grammar_entry_create "as_lident" - and polyt : 'polyt Grammar.Entry.e = grammar_entry_create "polyt" - and cvalue_binding : 'cvalue_binding Grammar.Entry.e = - grammar_entry_create "cvalue_binding" - and label : 'label Grammar.Entry.e = grammar_entry_create "label" - and class_self_type : 'class_self_type Grammar.Entry.e = - grammar_entry_create "class_self_type" - and class_description : 'class_description Grammar.Entry.e = - grammar_entry_create "class_description" - and class_type_declaration : 'class_type_declaration Grammar.Entry.e = - grammar_entry_create "class_type_declaration" - and field_expr : 'field_expr Grammar.Entry.e = - grammar_entry_create "field_expr" - and field : 'field Grammar.Entry.e = grammar_entry_create "field" - and typevar : 'typevar Grammar.Entry.e = grammar_entry_create "typevar" - and clty_longident : 'clty_longident Grammar.Entry.e = - grammar_entry_create "clty_longident" - and class_longident : 'class_longident Grammar.Entry.e = - grammar_entry_create "class_longident" - and row_field_list : 'row_field_list Grammar.Entry.e = - grammar_entry_create "row_field_list" - and name_tag : 'name_tag Grammar.Entry.e = - grammar_entry_create "name_tag" - and patt_tcon : 'patt_tcon Grammar.Entry.e = - grammar_entry_create "patt_tcon" - and ipatt_tcon : 'ipatt_tcon Grammar.Entry.e = - grammar_entry_create "ipatt_tcon" - and eq_expr : 'eq_expr Grammar.Entry.e = grammar_entry_create "eq_expr" - and direction_flag : 'direction_flag Grammar.Entry.e = - grammar_entry_create "direction_flag" - and warning_variant : 'warning_variant Grammar.Entry.e = - grammar_entry_create "warning_variant" - and warning_sequence : 'warning_sequence Grammar.Entry.e = - grammar_entry_create "warning_sequence" - in - [Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "struct"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'str_item) (loc : int * int) -> (s : 'e__1))]); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'e__1 list) _ (loc : int * int) -> - (MLast.MeStr (loc, st) : 'module_expr)); - [Gramext.Stoken ("", "functor"); Gramext.Stoken ("", "("); - Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", ")"); Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (me : 'module_expr) _ _ (t : 'module_type) _ (i : string) _ _ - (loc : int * int) -> - (MLast.MeFun (loc, i, t, me) : 'module_expr))]; - None, None, - [[Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (me2 : 'module_expr) (me1 : 'module_expr) (loc : int * int) -> - (MLast.MeApp (loc, me1, me2) : 'module_expr))]; - None, None, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (me2 : 'module_expr) _ (me1 : 'module_expr) - (loc : int * int) -> - (MLast.MeAcc (loc, me1, me2) : 'module_expr))]; - Some "simple", None, - [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (me : 'module_expr) _ (loc : int * int) -> - (me : 'module_expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (mt : 'module_type) _ (me : 'module_expr) _ - (loc : int * int) -> - (MLast.MeTyc (loc, me, mt) : 'module_expr)); - [Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.MeUid (loc, i) : 'module_expr))]]; - Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, - [Some "top", None, - [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) (loc : int * int) -> - (MLast.StExp (loc, e) : 'str_item)); - [Gramext.Stoken ("", "value"); - Gramext.Sopt (Gramext.Stoken ("", "rec")); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (l : 'let_binding list) (r : string option) _ - (loc : int * int) -> - (MLast.StVal (loc, o2b r, l) : 'str_item)); - [Gramext.Stoken ("", "type"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (type_declaration : 'type_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (tdl : 'type_declaration list) _ (loc : int * int) -> - (MLast.StTyp (loc, tdl) : 'str_item)); - [Gramext.Stoken ("", "open"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'mod_ident) _ (loc : int * int) -> - (MLast.StOpn (loc, i) : 'str_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "type"); - Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (i : string) _ _ (loc : int * int) -> - (MLast.StMty (loc, i, mt) : 'str_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "rec"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (module_rec_binding : 'module_rec_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (nmtmes : 'module_rec_binding list) _ _ (loc : int * int) -> - (MLast.StRecMod (loc, nmtmes) : 'str_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("UIDENT", ""); - Gramext.Snterm - (Grammar.Entry.obj - (module_binding : 'module_binding Grammar.Entry.e))], - Gramext.action - (fun (mb : 'module_binding) (i : string) _ (loc : int * int) -> - (MLast.StMod (loc, i, mb) : 'str_item)); - [Gramext.Stoken ("", "include"); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (loc : int * int) -> - (MLast.StInc (loc, me) : 'str_item)); - [Gramext.Stoken ("", "external"); Gramext.Stoken ("LIDENT", ""); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Slist1 (Gramext.Stoken ("STRING", ""))], - Gramext.action - (fun (pd : string list) _ (t : 'ctyp) _ (i : string) _ - (loc : int * int) -> - (MLast.StExt (loc, i, t, pd) : 'str_item)); - [Gramext.Stoken ("", "exception"); - Gramext.Snterm - (Grammar.Entry.obj - (constructor_declaration : - 'constructor_declaration Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e))], - Gramext.action - (fun (b : 'rebind_exn) (_, c, tl : 'constructor_declaration) _ - (loc : int * int) -> - (MLast.StExc (loc, c, tl, b) : 'str_item)); - [Gramext.Stoken ("", "declare"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'str_item) (loc : int * int) -> (s : 'e__2))]); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'e__2 list) _ (loc : int * int) -> - (MLast.StDcl (loc, st) : 'str_item))]]; - Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e), None, - [None, None, - [[], Gramext.action (fun (loc : int * int) -> ([] : 'rebind_exn)); - [Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], - Gramext.action - (fun (sl : 'mod_ident) _ (loc : int * int) -> (sl : 'rebind_exn))]]; - Grammar.Entry.obj (module_binding : 'module_binding Grammar.Entry.e), - None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (loc : int * int) -> - (me : 'module_binding)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (mt : 'module_type) _ - (loc : int * int) -> - (MLast.MeTyc (loc, me, mt) : 'module_binding)); - [Gramext.Stoken ("", "("); Gramext.Stoken ("UIDENT", ""); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", ")"); Gramext.Sself], - Gramext.action - (fun (mb : 'module_binding) _ (mt : 'module_type) _ (m : string) _ - (loc : int * int) -> - (MLast.MeFun (loc, m, mt, mb) : 'module_binding))]]; - Grammar.Entry.obj - (module_rec_binding : 'module_rec_binding Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (mt : 'module_type) _ (m : string) - (loc : int * int) -> - (m, mt, me : 'module_rec_binding))]]; - Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "functor"); Gramext.Stoken ("", "("); - Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself; Gramext.Stoken ("", ")"); Gramext.Stoken ("", "->"); - Gramext.Sself], - Gramext.action - (fun (mt : 'module_type) _ _ (t : 'module_type) _ (i : string) _ _ - (loc : int * int) -> - (MLast.MtFun (loc, i, t, mt) : 'module_type))]; - None, None, - [[Gramext.Sself; Gramext.Stoken ("", "with"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (with_constr : 'with_constr Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (wcl : 'with_constr list) _ (mt : 'module_type) - (loc : int * int) -> - (MLast.MtWit (loc, mt, wcl) : 'module_type))]; - None, None, - [[Gramext.Stoken ("", "sig"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'sig_item) (loc : int * int) -> (s : 'e__3))]); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (sg : 'e__3 list) _ (loc : int * int) -> - (MLast.MtSig (loc, sg) : 'module_type))]; - None, None, - [[Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (m2 : 'module_type) (m1 : 'module_type) (loc : int * int) -> - (MLast.MtApp (loc, m1, m2) : 'module_type))]; - None, None, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (m2 : 'module_type) _ (m1 : 'module_type) (loc : int * int) -> - (MLast.MtAcc (loc, m1, m2) : 'module_type))]; - Some "simple", None, - [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (mt : 'module_type) _ (loc : int * int) -> - (mt : 'module_type)); - [Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> - (MLast.MtQuo (loc, i) : 'module_type)); - [Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.MtLid (loc, i) : 'module_type)); - [Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.MtUid (loc, i) : 'module_type))]]; - Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, - [Some "top", None, - [[Gramext.Stoken ("", "value"); Gramext.Stoken ("LIDENT", ""); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (i : string) _ (loc : int * int) -> - (MLast.SgVal (loc, i, t) : 'sig_item)); - [Gramext.Stoken ("", "type"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (type_declaration : 'type_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (tdl : 'type_declaration list) _ (loc : int * int) -> - (MLast.SgTyp (loc, tdl) : 'sig_item)); - [Gramext.Stoken ("", "open"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'mod_ident) _ (loc : int * int) -> - (MLast.SgOpn (loc, i) : 'sig_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "type"); - Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (i : string) _ _ (loc : int * int) -> - (MLast.SgMty (loc, i, mt) : 'sig_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "rec"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (module_rec_declaration : - 'module_rec_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (mds : 'module_rec_declaration list) _ _ (loc : int * int) -> - (MLast.SgRecMod (loc, mds) : 'sig_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("UIDENT", ""); - Gramext.Snterm - (Grammar.Entry.obj - (module_declaration : 'module_declaration Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_declaration) (i : string) _ (loc : int * int) -> - (MLast.SgMod (loc, i, mt) : 'sig_item)); - [Gramext.Stoken ("", "include"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (loc : int * int) -> - (MLast.SgInc (loc, mt) : 'sig_item)); - [Gramext.Stoken ("", "external"); Gramext.Stoken ("LIDENT", ""); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Slist1 (Gramext.Stoken ("STRING", ""))], - Gramext.action - (fun (pd : string list) _ (t : 'ctyp) _ (i : string) _ - (loc : int * int) -> - (MLast.SgExt (loc, i, t, pd) : 'sig_item)); - [Gramext.Stoken ("", "exception"); - Gramext.Snterm - (Grammar.Entry.obj - (constructor_declaration : - 'constructor_declaration Grammar.Entry.e))], - Gramext.action - (fun (_, c, tl : 'constructor_declaration) _ (loc : int * int) -> - (MLast.SgExc (loc, c, tl) : 'sig_item)); - [Gramext.Stoken ("", "declare"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'sig_item) (loc : int * int) -> (s : 'e__4))]); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'e__4 list) _ (loc : int * int) -> - (MLast.SgDcl (loc, st) : 'sig_item))]]; - Grammar.Entry.obj - (module_declaration : 'module_declaration Grammar.Entry.e), - None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("", "("); Gramext.Stoken ("UIDENT", ""); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", ")"); Gramext.Sself], - Gramext.action - (fun (mt : 'module_declaration) _ (t : 'module_type) _ (i : string) - _ (loc : int * int) -> - (MLast.MtFun (loc, i, t, mt) : 'module_declaration)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (loc : int * int) -> - (mt : 'module_declaration))]]; - Grammar.Entry.obj - (module_rec_declaration : 'module_rec_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (m : string) (loc : int * int) -> - (m, mt : 'module_rec_declaration))]]; - Grammar.Entry.obj (with_constr : 'with_constr Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "module"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (i : 'mod_ident) _ (loc : int * int) -> - (MLast.WcMod (loc, i, me) : 'with_constr)); - [Gramext.Stoken ("", "type"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e)); - Gramext.Slist0 - (Gramext.Snterm - (Grammar.Entry.obj - (type_parameter : 'type_parameter Grammar.Entry.e))); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (tpl : 'type_parameter list) (i : 'mod_ident) _ - (loc : int * int) -> - (MLast.WcTyp (loc, i, tpl, t) : 'with_constr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), None, - [Some "top", Some Gramext.RightA, - [[Gramext.Stoken ("", "while"); Gramext.Sself; - Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); - Gramext.Snterm - (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (seq : 'sequence) _ _ (e : 'expr) _ (loc : int * int) -> - (MLast.ExWhi (loc, e, seq) : 'expr)); - [Gramext.Stoken ("", "for"); Gramext.Stoken ("LIDENT", ""); - Gramext.Stoken ("", "="); Gramext.Sself; - Gramext.Snterm - (Grammar.Entry.obj - (direction_flag : 'direction_flag Grammar.Entry.e)); - Gramext.Sself; Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); - Gramext.Snterm - (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (seq : 'sequence) _ _ (e2 : 'expr) (df : 'direction_flag) - (e1 : 'expr) _ (i : string) _ (loc : int * int) -> - (MLast.ExFor (loc, i, e1, e2, df, seq) : 'expr)); - [Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); - Gramext.Snterm - (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (seq : 'sequence) _ _ (loc : int * int) -> - (mksequence loc seq : 'expr)); - [Gramext.Stoken ("", "if"); Gramext.Sself; - Gramext.Stoken ("", "then"); Gramext.Sself; - Gramext.Stoken ("", "else"); Gramext.Sself], - Gramext.action - (fun (e3 : 'expr) _ (e2 : 'expr) _ (e1 : 'expr) _ - (loc : int * int) -> - (MLast.ExIfe (loc, e1, e2, e3) : 'expr)); - [Gramext.Stoken ("", "try"); Gramext.Sself; - Gramext.Stoken ("", "with"); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (e1 : 'expr) _ (p1 : 'ipatt) _ (e : 'expr) _ - (loc : int * int) -> - (MLast.ExTry (loc, e, [p1, None, e1]) : 'expr)); - [Gramext.Stoken ("", "try"); Gramext.Sself; - Gramext.Stoken ("", "with"); Gramext.Stoken ("", "["); - Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e)), - Gramext.Stoken ("", "|")); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (l : 'match_case list) _ _ (e : 'expr) _ (loc : int * int) -> - (MLast.ExTry (loc, e, l) : 'expr)); - [Gramext.Stoken ("", "match"); Gramext.Sself; - Gramext.Stoken ("", "with"); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (e1 : 'expr) _ (p1 : 'ipatt) _ (e : 'expr) _ - (loc : int * int) -> - (MLast.ExMat (loc, e, [p1, None, e1]) : 'expr)); - [Gramext.Stoken ("", "match"); Gramext.Sself; - Gramext.Stoken ("", "with"); Gramext.Stoken ("", "["); - Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e)), - Gramext.Stoken ("", "|")); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (l : 'match_case list) _ _ (e : 'expr) _ (loc : int * int) -> - (MLast.ExMat (loc, e, l) : 'expr)); - [Gramext.Stoken ("", "fun"); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (fun_def : 'fun_def Grammar.Entry.e))], - Gramext.action - (fun (e : 'fun_def) (p : 'ipatt) _ (loc : int * int) -> - (MLast.ExFun (loc, [p, None, e]) : 'expr)); - [Gramext.Stoken ("", "fun"); Gramext.Stoken ("", "["); - Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e)), - Gramext.Stoken ("", "|")); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (l : 'match_case list) _ _ (loc : int * int) -> - (MLast.ExFun (loc, l) : 'expr)); - [Gramext.Stoken ("", "let"); Gramext.Stoken ("", "module"); - Gramext.Stoken ("UIDENT", ""); - Gramext.Snterm - (Grammar.Entry.obj - (module_binding : 'module_binding Grammar.Entry.e)); - Gramext.Stoken ("", "in"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (mb : 'module_binding) (m : string) _ _ - (loc : int * int) -> - (MLast.ExLmd (loc, m, mb, e) : 'expr)); - [Gramext.Stoken ("", "let"); - Gramext.Sopt (Gramext.Stoken ("", "rec")); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and")); - Gramext.Stoken ("", "in"); Gramext.Sself], - Gramext.action - (fun (x : 'expr) _ (l : 'let_binding list) (r : string option) _ - (loc : int * int) -> - (MLast.ExLet (loc, o2b r, l, x) : 'expr))]; - Some "where", None, - [[Gramext.Sself; Gramext.Stoken ("", "where"); - Gramext.Sopt (Gramext.Stoken ("", "rec")); - Gramext.Snterm - (Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e))], - Gramext.action - (fun (lb : 'let_binding) (rf : string option) _ (e : 'expr) - (loc : int * int) -> - (MLast.ExLet (loc, o2b rf, [lb], e) : 'expr))]; - Some ":=", Some Gramext.NonA, - [[Gramext.Sself; Gramext.Stoken ("", ":="); Gramext.Sself; - Gramext.Snterm (Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e))], - Gramext.action - (fun _ (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExAss (loc, e1, e2) : 'expr))]; - Some "||", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "||"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "||"), e1), e2) : - 'expr))]; - Some "&&", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "&&"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "&&"), e1), e2) : - 'expr))]; - Some "<", Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "!="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "!="), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "=="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "=="), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "<>"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "<>"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "="), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", ">="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, ">="), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "<="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "<="), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", ">"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, ">"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "<"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "<"), e1), e2) : - 'expr))]; - Some "^", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "@"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "@"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "^"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "^"), e1), e2) : - 'expr))]; - Some "+", Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "-."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "-."), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "+."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "+."), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "-"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "-"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "+"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "+"), e1), e2) : - 'expr))]; - Some "*", Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "mod"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "mod"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "lxor"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "lxor"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "lor"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "lor"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "land"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "land"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "/."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "/."), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "*."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "*."), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "/"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "/"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "*"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "*"), e1), e2) : - 'expr))]; - Some "**", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "lsr"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "lsr"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "lsl"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "lsl"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "asr"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "asr"), e1), e2) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "**"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp - (loc, MLast.ExApp (loc, MLast.ExLid (loc, "**"), e1), e2) : - 'expr))]; - Some "unary minus", Some Gramext.NonA, - [[Gramext.Stoken ("", "-."); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (mkumin loc "-." e : 'expr)); - [Gramext.Stoken ("", "-"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (mkumin loc "-" e : 'expr))]; - Some "apply", Some Gramext.LeftA, - [[Gramext.Stoken ("", "lazy"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (MLast.ExLaz (loc, e) : 'expr)); - [Gramext.Stoken ("", "assert"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (mkassert loc e : 'expr)); - [Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) (e1 : 'expr) (loc : int * int) -> - (MLast.ExApp (loc, e1, e2) : 'expr))]; - Some ".", Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExAcc (loc, e1, e2) : 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Stoken ("", "["); - Gramext.Sself; Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (e2 : 'expr) _ _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExSte (loc, e1, e2) : 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Stoken ("", "("); - Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (e2 : 'expr) _ _ (e1 : 'expr) (loc : int * int) -> - (MLast.ExAre (loc, e1, e2) : 'expr))]; - Some "~-", Some Gramext.NonA, - [[Gramext.Stoken ("", "~-."); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (MLast.ExApp (loc, MLast.ExLid (loc, "~-."), e) : 'expr)); - [Gramext.Stoken ("", "~-"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (MLast.ExApp (loc, MLast.ExLid (loc, "~-"), e) : 'expr))]; - Some "simple", None, - [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action (fun _ (e : 'expr) _ (loc : int * int) -> (e : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); - Gramext.Slist1sep - (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), - Gramext.Stoken ("", ",")); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (el : 'expr list) _ (e : 'expr) _ (loc : int * int) -> - (MLast.ExTup (loc, (e :: el)) : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> - (MLast.ExTyc (loc, e, t) : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], - Gramext.action - (fun _ _ (loc : int * int) -> (MLast.ExUid (loc, "()") : 'expr)); - [Gramext.Stoken ("", "{"); Gramext.Stoken ("", "("); Gramext.Sself; - Gramext.Stoken ("", ")"); Gramext.Stoken ("", "with"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (lel : 'label_expr list) _ _ (e : 'expr) _ _ - (loc : int * int) -> - (MLast.ExRec (loc, lel, Some e) : 'expr)); - [Gramext.Stoken ("", "{"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (lel : 'label_expr list) _ (loc : int * int) -> - (MLast.ExRec (loc, lel, None) : 'expr)); - [Gramext.Stoken ("", "[|"); - Gramext.Slist0sep - (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (el : 'expr list) _ (loc : int * int) -> - (MLast.ExArr (loc, el) : 'expr)); - [Gramext.Stoken ("", "["); - Gramext.Slist1sep - (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Snterm - (Grammar.Entry.obj - (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (last : 'cons_expr_opt) (el : 'expr list) _ - (loc : int * int) -> - (mklistexp loc last el : 'expr)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")], - Gramext.action - (fun _ _ (loc : int * int) -> (MLast.ExUid (loc, "[]") : 'expr)); - [Gramext.Snterm - (Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'expr_ident) (loc : int * int) -> (i : 'expr)); - [Gramext.Stoken ("CHAR", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.ExChr (loc, s) : 'expr)); - [Gramext.Stoken ("STRING", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.ExStr (loc, s) : 'expr)); - [Gramext.Stoken ("FLOAT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.ExFlo (loc, s) : 'expr)); - [Gramext.Stoken ("NATIVEINT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.ExNativeInt (loc, s) : 'expr)); - [Gramext.Stoken ("INT64", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.ExInt64 (loc, s) : 'expr)); - [Gramext.Stoken ("INT32", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.ExInt32 (loc, s) : 'expr)); - [Gramext.Stoken ("INT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.ExInt (loc, s) : 'expr))]]; - Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e), - None, - [None, None, - [[], Gramext.action (fun (loc : int * int) -> (None : 'cons_expr_opt)); - [Gramext.Stoken ("", "::"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (Some e : 'cons_expr_opt))]]; - Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e), None, - [None, None, - [[], Gramext.action (fun (loc : int * int) -> (() : 'dummy))]]; - Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) (loc : int * int) -> ([e] : 'sequence)); - [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (e : 'expr) (loc : int * int) -> ([e] : 'sequence)); - [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";"); Gramext.Sself], - Gramext.action - (fun (el : 'sequence) _ (e : 'expr) (loc : int * int) -> - (e :: el : 'sequence)); - [Gramext.Stoken ("", "let"); - Gramext.Sopt (Gramext.Stoken ("", "rec")); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and")); - Gramext.srules - [[Gramext.Stoken ("", ";")], - Gramext.action - (fun (x : string) (loc : int * int) -> (x : 'e__5)); - [Gramext.Stoken ("", "in")], - Gramext.action - (fun (x : string) (loc : int * int) -> (x : 'e__5))]; - Gramext.Sself], - Gramext.action - (fun (el : 'sequence) _ (l : 'let_binding list) (rf : string option) - _ (loc : int * int) -> - ([MLast.ExLet (loc, o2b rf, l, mksequence loc el)] : - 'sequence))]]; - Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'fun_binding) (p : 'ipatt) (loc : int * int) -> - (p, e : 'let_binding))]]; - Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e), None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> - (MLast.ExTyc (loc, e, t) : 'fun_binding)); - [Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (e : 'fun_binding)); - [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (e : 'fun_binding) (p : 'ipatt) (loc : int * int) -> - (MLast.ExFun (loc, [p, None, e]) : 'fun_binding))]]; - Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (when_expr_opt : 'when_expr_opt Grammar.Entry.e)); - Gramext.Stoken ("", "->"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (w : 'when_expr_opt) (aso : 'as_patt_opt) - (p : 'patt) (loc : int * int) -> - (mkmatchcase loc p aso w e : 'match_case))]]; - Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e), None, - [None, None, - [[], Gramext.action (fun (loc : int * int) -> (None : 'as_patt_opt)); - [Gramext.Stoken ("", "as"); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], - Gramext.action - (fun (p : 'patt) _ (loc : int * int) -> (Some p : 'as_patt_opt))]]; - Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), - None, - [None, None, - [[], Gramext.action (fun (loc : int * int) -> (None : 'when_expr_opt)); - [Gramext.Stoken ("", "when"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (Some e : 'when_expr_opt))]]; - Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'fun_binding) (i : 'patt_label_ident) (loc : int * int) -> - (i, e : 'label_expr))]]; - Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e), None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "."); - Gramext.Sself], - Gramext.action - (fun (j : 'expr_ident) _ (i : string) (loc : int * int) -> - (mkexprident loc i j : 'expr_ident)); - [Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.ExUid (loc, i) : 'expr_ident)); - [Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.ExLid (loc, i) : 'expr_ident))]]; - Grammar.Entry.obj (fun_def : 'fun_def Grammar.Entry.e), None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("", "->"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (e : 'fun_def)); - [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (e : 'fun_def) (p : 'ipatt) (loc : int * int) -> - (MLast.ExFun (loc, [p, None, e]) : 'fun_def))]]; - Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), None, - [None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "|"); Gramext.Sself], - Gramext.action - (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> - (MLast.PaOrp (loc, p1, p2) : 'patt))]; - None, Some Gramext.NonA, - [[Gramext.Sself; Gramext.Stoken ("", ".."); Gramext.Sself], - Gramext.action - (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> - (MLast.PaRng (loc, p1, p2) : 'patt))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (p2 : 'patt) (p1 : 'patt) (loc : int * int) -> - (MLast.PaApp (loc, p1, p2) : 'patt))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> - (MLast.PaAcc (loc, p1, p2) : 'patt))]; - Some "simple", None, - [[Gramext.Stoken ("", "_")], - Gramext.action (fun _ (loc : int * int) -> (MLast.PaAny loc : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); - Gramext.Slist1sep - (Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), - Gramext.Stoken ("", ",")); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (pl : 'patt list) _ (p : 'patt) _ (loc : int * int) -> - (MLast.PaTup (loc, (p :: pl)) : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "as"); - Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (p2 : 'patt) _ (p : 'patt) _ (loc : int * int) -> - (MLast.PaAli (loc, p, p2) : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) -> - (MLast.PaTyc (loc, p, t) : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], - Gramext.action - (fun _ _ (loc : int * int) -> (MLast.PaUid (loc, "()") : 'patt)); - [Gramext.Stoken ("", "{"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (label_patt : 'label_patt Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (lpl : 'label_patt list) _ (loc : int * int) -> - (MLast.PaRec (loc, lpl) : 'patt)); - [Gramext.Stoken ("", "[|"); - Gramext.Slist0sep - (Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (pl : 'patt list) _ (loc : int * int) -> - (MLast.PaArr (loc, pl) : 'patt)); - [Gramext.Stoken ("", "["); - Gramext.Slist1sep - (Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Snterm - (Grammar.Entry.obj - (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (last : 'cons_patt_opt) (pl : 'patt list) _ - (loc : int * int) -> - (mklistpat loc last pl : 'patt)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")], - Gramext.action - (fun _ _ (loc : int * int) -> (MLast.PaUid (loc, "[]") : 'patt)); - [Gramext.Stoken ("", "-"); Gramext.Stoken ("FLOAT", "")], - Gramext.action - (fun (s : string) _ (loc : int * int) -> - (MLast.PaFlo (loc, neg_string s) : 'patt)); - [Gramext.Stoken ("", "-"); Gramext.Stoken ("NATIVEINT", "")], - Gramext.action - (fun (s : string) _ (loc : int * int) -> - (MLast.PaNativeInt (loc, neg_string s) : 'patt)); - [Gramext.Stoken ("", "-"); Gramext.Stoken ("INT64", "")], - Gramext.action - (fun (s : string) _ (loc : int * int) -> - (MLast.PaInt64 (loc, neg_string s) : 'patt)); - [Gramext.Stoken ("", "-"); Gramext.Stoken ("INT32", "")], - Gramext.action - (fun (s : string) _ (loc : int * int) -> - (MLast.PaInt32 (loc, neg_string s) : 'patt)); - [Gramext.Stoken ("", "-"); Gramext.Stoken ("INT", "")], - Gramext.action - (fun (s : string) _ (loc : int * int) -> - (MLast.PaInt (loc, neg_string s) : 'patt)); - [Gramext.Stoken ("CHAR", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaChr (loc, s) : 'patt)); - [Gramext.Stoken ("STRING", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaStr (loc, s) : 'patt)); - [Gramext.Stoken ("FLOAT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaFlo (loc, s) : 'patt)); - [Gramext.Stoken ("NATIVEINT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaNativeInt (loc, s) : 'patt)); - [Gramext.Stoken ("INT64", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaInt64 (loc, s) : 'patt)); - [Gramext.Stoken ("INT32", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaInt32 (loc, s) : 'patt)); - [Gramext.Stoken ("INT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaInt (loc, s) : 'patt)); - [Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaUid (loc, s) : 'patt)); - [Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaLid (loc, s) : 'patt))]]; - Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e), - None, - [None, None, - [[], Gramext.action (fun (loc : int * int) -> (None : 'cons_patt_opt)); - [Gramext.Stoken ("", "::"); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], - Gramext.action - (fun (p : 'patt) _ (loc : int * int) -> - (Some p : 'cons_patt_opt))]]; - Grammar.Entry.obj (label_patt : 'label_patt Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], - Gramext.action - (fun (p : 'patt) _ (i : 'patt_label_ident) (loc : int * int) -> - (i, p : 'label_patt))]]; - Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e), - None, - [None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (p2 : 'patt_label_ident) _ (p1 : 'patt_label_ident) - (loc : int * int) -> - (MLast.PaAcc (loc, p1, p2) : 'patt_label_ident))]; - Some "simple", Some Gramext.RightA, - [[Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.PaLid (loc, i) : 'patt_label_ident)); - [Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.PaUid (loc, i) : 'patt_label_ident))]]; - Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "_")], - Gramext.action - (fun _ (loc : int * int) -> (MLast.PaAny loc : 'ipatt)); - [Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (MLast.PaLid (loc, s) : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)), - Gramext.Stoken ("", ",")); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (pl : 'ipatt list) _ (p : 'ipatt) _ (loc : int * int) -> - (MLast.PaTup (loc, (p :: pl)) : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "as"); - Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (p2 : 'ipatt) _ (p : 'ipatt) _ (loc : int * int) -> - (MLast.PaAli (loc, p, p2) : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (p : 'ipatt) _ (loc : int * int) -> - (MLast.PaTyc (loc, p, t) : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (p : 'ipatt) _ (loc : int * int) -> (p : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], - Gramext.action - (fun _ _ (loc : int * int) -> (MLast.PaUid (loc, "()") : 'ipatt)); - [Gramext.Stoken ("", "{"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_ipatt : 'label_ipatt Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (lpl : 'label_ipatt list) _ (loc : int * int) -> - (MLast.PaRec (loc, lpl) : 'ipatt))]]; - Grammar.Entry.obj (label_ipatt : 'label_ipatt Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e))], - Gramext.action - (fun (p : 'ipatt) _ (i : 'patt_label_ident) (loc : int * int) -> - (i, p : 'label_ipatt))]]; - Grammar.Entry.obj - (type_declaration : 'type_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (type_patt : 'type_patt Grammar.Entry.e)); - Gramext.Slist0 - (Gramext.Snterm - (Grammar.Entry.obj - (type_parameter : 'type_parameter Grammar.Entry.e))); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Slist0 - (Gramext.Snterm - (Grammar.Entry.obj (constrain : 'constrain Grammar.Entry.e)))], - Gramext.action - (fun (cl : 'constrain list) (tk : 'ctyp) _ - (tpl : 'type_parameter list) (n : 'type_patt) - (loc : int * int) -> - (n, tpl, tk, cl : 'type_declaration))]]; - Grammar.Entry.obj (type_patt : 'type_patt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (n : string) (loc : int * int) -> (loc, n : 'type_patt))]]; - Grammar.Entry.obj (constrain : 'constrain Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "constraint"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> - (t1, t2 : 'constrain))]]; - Grammar.Entry.obj (type_parameter : 'type_parameter Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "-"); Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ _ (loc : int * int) -> - (i, (false, true) : 'type_parameter)); - [Gramext.Stoken ("", "+"); Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ _ (loc : int * int) -> - (i, (true, false) : 'type_parameter)); - [Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> - (i, (false, false) : 'type_parameter))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), None, - [None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "=="); Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> - (MLast.TyMan (loc, t1, t2) : 'ctyp))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "as"); Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> - (MLast.TyAli (loc, t1, t2) : 'ctyp))]; - None, Some Gramext.LeftA, - [[Gramext.Stoken ("", "!"); - Gramext.Slist1 - (Gramext.Snterm - (Grammar.Entry.obj (typevar : 'typevar Grammar.Entry.e))); - Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (pl : 'typevar list) _ (loc : int * int) -> - (MLast.TyPol (loc, pl, t) : 'ctyp))]; - Some "arrow", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> - (MLast.TyArr (loc, t1, t2) : 'ctyp))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) (t1 : 'ctyp) (loc : int * int) -> - (MLast.TyApp (loc, t1, t2) : 'ctyp))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> - (MLast.TyAcc (loc, t1, t2) : 'ctyp))]; - Some "simple", None, - [[Gramext.Stoken ("", "{"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_declaration : 'label_declaration Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (ldl : 'label_declaration list) _ (loc : int * int) -> - (MLast.TyRec (loc, false, ldl) : 'ctyp)); - [Gramext.Stoken ("", "["); - Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (constructor_declaration : - 'constructor_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "|")); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (cdl : 'constructor_declaration list) _ (loc : int * int) -> - (MLast.TySum (loc, false, cdl) : 'ctyp)); - [Gramext.Stoken ("", "private"); Gramext.Stoken ("", "{"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_declaration : 'label_declaration Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (ldl : 'label_declaration list) _ _ (loc : int * int) -> - (MLast.TyRec (loc, true, ldl) : 'ctyp)); - [Gramext.Stoken ("", "private"); Gramext.Stoken ("", "["); - Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (constructor_declaration : - 'constructor_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "|")); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (cdl : 'constructor_declaration list) _ _ - (loc : int * int) -> - (MLast.TySum (loc, true, cdl) : 'ctyp)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'ctyp)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "*"); - Gramext.Slist1sep - (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", "*")); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (tl : 'ctyp list) _ (t : 'ctyp) _ (loc : int * int) -> - (MLast.TyTup (loc, (t :: tl)) : 'ctyp)); - [Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.TyUid (loc, i) : 'ctyp)); - [Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.TyLid (loc, i) : 'ctyp)); - [Gramext.Stoken ("", "_")], - Gramext.action (fun _ (loc : int * int) -> (MLast.TyAny loc : 'ctyp)); - [Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> - (MLast.TyQuo (loc, i) : 'ctyp))]]; - Grammar.Entry.obj - (constructor_declaration : 'constructor_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (ci : string) (loc : int * int) -> - (loc, ci, [] : 'constructor_declaration)); - [Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "of"); - Gramext.Slist1sep - (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (cal : 'ctyp list) _ (ci : string) (loc : int * int) -> - (loc, ci, cal : 'constructor_declaration))]]; - Grammar.Entry.obj - (label_declaration : 'label_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("LIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sopt (Gramext.Stoken ("", "mutable")); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) (mf : string option) _ (i : string) - (loc : int * int) -> - (loc, i, o2b mf, t : 'label_declaration))]]; - Grammar.Entry.obj (ident : 'ident Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("UIDENT", "")], - Gramext.action (fun (i : string) (loc : int * int) -> (i : 'ident)); - [Gramext.Stoken ("LIDENT", "")], - Gramext.action (fun (i : string) (loc : int * int) -> (i : 'ident))]]; - Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e), None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "."); - Gramext.Sself], - Gramext.action - (fun (j : 'mod_ident) _ (i : string) (loc : int * int) -> - (i :: j : 'mod_ident)); - [Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> ([i] : 'mod_ident)); - [Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> ([i] : 'mod_ident))]]; - Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (class_type_declaration : - 'class_type_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (ctd : 'class_type_declaration list) _ _ (loc : int * int) -> - (MLast.StClt (loc, ctd) : 'str_item)); - [Gramext.Stoken ("", "class"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (class_declaration : 'class_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (cd : 'class_declaration list) _ (loc : int * int) -> - (MLast.StCls (loc, cd) : 'str_item))]]; - Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (class_type_declaration : - 'class_type_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (ctd : 'class_type_declaration list) _ _ (loc : int * int) -> - (MLast.SgClt (loc, ctd) : 'sig_item)); - [Gramext.Stoken ("", "class"); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (class_description : 'class_description Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (cd : 'class_description list) _ (loc : int * int) -> - (MLast.SgCls (loc, cd) : 'sig_item))]]; - Grammar.Entry.obj - (class_declaration : 'class_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Sopt (Gramext.Stoken ("", "virtual")); - Gramext.Stoken ("LIDENT", ""); - Gramext.Snterm - (Grammar.Entry.obj - (class_type_parameters : - 'class_type_parameters Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (class_fun_binding : 'class_fun_binding Grammar.Entry.e))], - Gramext.action - (fun (cfb : 'class_fun_binding) (ctp : 'class_type_parameters) - (i : string) (vf : string option) (loc : int * int) -> - ({MLast.ciLoc = loc; MLast.ciVir = o2b vf; MLast.ciPrm = ctp; - MLast.ciNam = i; MLast.ciExp = cfb} : - 'class_declaration))]]; - Grammar.Entry.obj - (class_fun_binding : 'class_fun_binding Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (cfb : 'class_fun_binding) (p : 'ipatt) (loc : int * int) -> - (MLast.CeFun (loc, p, cfb) : 'class_fun_binding)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], - Gramext.action - (fun (ce : 'class_expr) _ (ct : 'class_type) _ (loc : int * int) -> - (MLast.CeTyc (loc, ce, ct) : 'class_fun_binding)); - [Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], - Gramext.action - (fun (ce : 'class_expr) _ (loc : int * int) -> - (ce : 'class_fun_binding))]]; - Grammar.Entry.obj - (class_type_parameters : 'class_type_parameters Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "["); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (type_parameter : 'type_parameter Grammar.Entry.e)), - Gramext.Stoken ("", ",")); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (tpl : 'type_parameter list) _ (loc : int * int) -> - (loc, tpl : 'class_type_parameters)); - [], - Gramext.action - (fun (loc : int * int) -> (loc, [] : 'class_type_parameters))]]; - Grammar.Entry.obj (class_fun_def : 'class_fun_def Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "->"); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], - Gramext.action - (fun (ce : 'class_expr) _ (loc : int * int) -> - (ce : 'class_fun_def)); - [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (ce : 'class_fun_def) (p : 'ipatt) (loc : int * int) -> - (MLast.CeFun (loc, p, ce) : 'class_fun_def))]]; - Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), None, - [Some "top", None, - [[Gramext.Stoken ("", "let"); - Gramext.Sopt (Gramext.Stoken ("", "rec")); - Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and")); - Gramext.Stoken ("", "in"); Gramext.Sself], - Gramext.action - (fun (ce : 'class_expr) _ (lb : 'let_binding list) - (rf : string option) _ (loc : int * int) -> - (MLast.CeLet (loc, o2b rf, lb, ce) : 'class_expr)); - [Gramext.Stoken ("", "fun"); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (class_fun_def : 'class_fun_def Grammar.Entry.e))], - Gramext.action - (fun (ce : 'class_fun_def) (p : 'ipatt) _ (loc : int * int) -> - (MLast.CeFun (loc, p, ce) : 'class_expr))]; - Some "apply", Some Gramext.NonA, - [[Gramext.Sself; - Gramext.Snterml - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), "label")], - Gramext.action - (fun (e : 'expr) (ce : 'class_expr) (loc : int * int) -> - (MLast.CeApp (loc, ce, e) : 'class_expr))]; - Some "simple", None, - [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (ce : 'class_expr) _ (loc : int * int) -> - (ce : 'class_expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (ct : 'class_type) _ (ce : 'class_expr) _ - (loc : int * int) -> - (MLast.CeTyc (loc, ce, ct) : 'class_expr)); - [Gramext.Stoken ("", "object"); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj - (class_self_patt : 'class_self_patt Grammar.Entry.e))); - Gramext.Snterm - (Grammar.Entry.obj - (class_structure : 'class_structure Grammar.Entry.e)); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (cf : 'class_structure) (cspo : 'class_self_patt option) _ - (loc : int * int) -> - (MLast.CeStr (loc, cspo, cf) : 'class_expr)); - [Gramext.Snterm - (Grammar.Entry.obj - (class_longident : 'class_longident Grammar.Entry.e))], - Gramext.action - (fun (ci : 'class_longident) (loc : int * int) -> - (MLast.CeCon (loc, ci, []) : 'class_expr)); - [Gramext.Snterm - (Grammar.Entry.obj - (class_longident : 'class_longident Grammar.Entry.e)); - Gramext.Stoken ("", "["); - Gramext.Slist0sep - (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", ",")); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (ctcl : 'ctyp list) _ (ci : 'class_longident) - (loc : int * int) -> - (MLast.CeCon (loc, ci, ctcl) : 'class_expr))]]; - Grammar.Entry.obj (class_structure : 'class_structure Grammar.Entry.e), - None, - [None, None, - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_str_item : 'class_str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (cf : 'class_str_item) (loc : int * int) -> - (cf : 'e__6))])], - Gramext.action - (fun (cf : 'e__6 list) (loc : int * int) -> - (cf : 'class_structure))]]; - Grammar.Entry.obj (class_self_patt : 'class_self_patt Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) -> - (MLast.PaTyc (loc, p, t) : 'class_self_patt)); - [Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'class_self_patt))]]; - Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "initializer"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (se : 'expr) _ (loc : int * int) -> - (MLast.CrIni (loc, se) : 'class_str_item)); - [Gramext.Stoken ("", "type"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> - (MLast.CrCtr (loc, t1, t2) : 'class_str_item)); - [Gramext.Stoken ("", "method"); - Gramext.Sopt (Gramext.Stoken ("", "private")); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (polyt : 'polyt Grammar.Entry.e))); - Gramext.Snterm - (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'fun_binding) (topt : 'polyt option) (l : 'label) - (pf : string option) _ (loc : int * int) -> - (MLast.CrMth (loc, l, o2b pf, e, topt) : 'class_str_item)); - [Gramext.Stoken ("", "method"); Gramext.Stoken ("", "virtual"); - Gramext.Sopt (Gramext.Stoken ("", "private")); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (pf : string option) _ _ - (loc : int * int) -> - (MLast.CrVir (loc, l, o2b pf, t) : 'class_str_item)); - [Gramext.Stoken ("", "value"); - Gramext.Sopt (Gramext.Stoken ("", "mutable")); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (cvalue_binding : 'cvalue_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'cvalue_binding) (lab : 'label) (mf : string option) _ - (loc : int * int) -> - (MLast.CrVal (loc, lab, o2b mf, e) : 'class_str_item)); - [Gramext.Stoken ("", "inherit"); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e)); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (as_lident : 'as_lident Grammar.Entry.e)))], - Gramext.action - (fun (pb : 'as_lident option) (ce : 'class_expr) _ - (loc : int * int) -> - (MLast.CrInh (loc, ce, pb) : 'class_str_item)); - [Gramext.Stoken ("", "declare"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_str_item : 'class_str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'class_str_item) (loc : int * int) -> - (s : 'e__7))]); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'e__7 list) _ (loc : int * int) -> - (MLast.CrDcl (loc, st) : 'class_str_item))]]; - Grammar.Entry.obj (as_lident : 'as_lident Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "as"); Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) _ (loc : int * int) -> (i : 'as_lident))]]; - Grammar.Entry.obj (polyt : 'polyt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (loc : int * int) -> (t : 'polyt))]]; - Grammar.Entry.obj (cvalue_binding : 'cvalue_binding Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", ":>"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> - (MLast.ExCoe (loc, e, None, t) : 'cvalue_binding)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ":>"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (t2 : 'ctyp) _ (t : 'ctyp) _ (loc : int * int) -> - (MLast.ExCoe (loc, e, Some t, t2) : 'cvalue_binding)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> - (MLast.ExTyc (loc, e, t) : 'cvalue_binding)); - [Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (e : 'cvalue_binding))]]; - Grammar.Entry.obj (label : 'label Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("LIDENT", "")], - Gramext.action (fun (i : string) (loc : int * int) -> (i : 'label))]]; - Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "object"); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj - (class_self_type : 'class_self_type Grammar.Entry.e))); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_sig_item : 'class_sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (csf : 'class_sig_item) (loc : int * int) -> - (csf : 'e__8))]); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (csf : 'e__8 list) (cst : 'class_self_type option) _ - (loc : int * int) -> - (MLast.CtSig (loc, cst, csf) : 'class_type)); - [Gramext.Snterm - (Grammar.Entry.obj - (clty_longident : 'clty_longident Grammar.Entry.e))], - Gramext.action - (fun (id : 'clty_longident) (loc : int * int) -> - (MLast.CtCon (loc, id, []) : 'class_type)); - [Gramext.Snterm - (Grammar.Entry.obj - (clty_longident : 'clty_longident Grammar.Entry.e)); - Gramext.Stoken ("", "["); - Gramext.Slist1sep - (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", ",")); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (tl : 'ctyp list) _ (id : 'clty_longident) - (loc : int * int) -> - (MLast.CtCon (loc, id, tl) : 'class_type)); - [Gramext.Stoken ("", "["); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "]"); Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (ct : 'class_type) _ _ (t : 'ctyp) _ (loc : int * int) -> - (MLast.CtFun (loc, t, ct) : 'class_type))]]; - Grammar.Entry.obj (class_self_type : 'class_self_type Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'class_self_type))]]; - Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "type"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> - (MLast.CgCtr (loc, t1, t2) : 'class_sig_item)); - [Gramext.Stoken ("", "method"); - Gramext.Sopt (Gramext.Stoken ("", "private")); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (pf : string option) _ - (loc : int * int) -> - (MLast.CgMth (loc, l, o2b pf, t) : 'class_sig_item)); - [Gramext.Stoken ("", "method"); Gramext.Stoken ("", "virtual"); - Gramext.Sopt (Gramext.Stoken ("", "private")); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (pf : string option) _ _ - (loc : int * int) -> - (MLast.CgVir (loc, l, o2b pf, t) : 'class_sig_item)); - [Gramext.Stoken ("", "value"); - Gramext.Sopt (Gramext.Stoken ("", "mutable")); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (mf : string option) _ - (loc : int * int) -> - (MLast.CgVal (loc, l, o2b mf, t) : 'class_sig_item)); - [Gramext.Stoken ("", "inherit"); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], - Gramext.action - (fun (cs : 'class_type) _ (loc : int * int) -> - (MLast.CgInh (loc, cs) : 'class_sig_item)); - [Gramext.Stoken ("", "declare"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_sig_item : 'class_sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'class_sig_item) (loc : int * int) -> - (s : 'e__9))]); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'e__9 list) _ (loc : int * int) -> - (MLast.CgDcl (loc, st) : 'class_sig_item))]]; - Grammar.Entry.obj - (class_description : 'class_description Grammar.Entry.e), - None, - [None, None, - [[Gramext.Sopt (Gramext.Stoken ("", "virtual")); - Gramext.Stoken ("LIDENT", ""); - Gramext.Snterm - (Grammar.Entry.obj - (class_type_parameters : - 'class_type_parameters Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], - Gramext.action - (fun (ct : 'class_type) _ (ctp : 'class_type_parameters) - (n : string) (vf : string option) (loc : int * int) -> - ({MLast.ciLoc = loc; MLast.ciVir = o2b vf; MLast.ciPrm = ctp; - MLast.ciNam = n; MLast.ciExp = ct} : - 'class_description))]]; - Grammar.Entry.obj - (class_type_declaration : 'class_type_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Sopt (Gramext.Stoken ("", "virtual")); - Gramext.Stoken ("LIDENT", ""); - Gramext.Snterm - (Grammar.Entry.obj - (class_type_parameters : - 'class_type_parameters Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], - Gramext.action - (fun (cs : 'class_type) _ (ctp : 'class_type_parameters) - (n : string) (vf : string option) (loc : int * int) -> - ({MLast.ciLoc = loc; MLast.ciVir = o2b vf; MLast.ciPrm = ctp; - MLast.ciNam = n; MLast.ciExp = cs} : - 'class_type_declaration))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "apply"), - [None, Some Gramext.LeftA, - [[Gramext.Stoken ("", "new"); - Gramext.Snterm - (Grammar.Entry.obj - (class_longident : 'class_longident Grammar.Entry.e))], - Gramext.action - (fun (i : 'class_longident) _ (loc : int * int) -> - (MLast.ExNew (loc, i) : 'expr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "."), - [None, None, - [[Gramext.Sself; Gramext.Stoken ("", "#"); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e))], - Gramext.action - (fun (lab : 'label) _ (e : 'expr) (loc : int * int) -> - (MLast.ExSnd (loc, e, lab) : 'expr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "{<"); - Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (field_expr : 'field_expr Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Stoken ("", ">}")], - Gramext.action - (fun _ (fel : 'field_expr list) _ (loc : int * int) -> - (MLast.ExOvr (loc, fel) : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":>"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> - (MLast.ExCoe (loc, e, None, t) : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ":>"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t2 : 'ctyp) _ (t : 'ctyp) _ (e : 'expr) _ - (loc : int * int) -> - (MLast.ExCoe (loc, e, Some t, t2) : 'expr))]]; - Grammar.Entry.obj (field_expr : 'field_expr Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (l : 'label) (loc : int * int) -> - (l, e : 'field_expr))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "<"); - Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (field : 'field Grammar.Entry.e)), - Gramext.Stoken ("", ";")); - Gramext.Sopt (Gramext.Stoken ("", "..")); Gramext.Stoken ("", ">")], - Gramext.action - (fun _ (v : string option) (ml : 'field list) _ (loc : int * int) -> - (MLast.TyObj (loc, ml, o2b v) : 'ctyp)); - [Gramext.Stoken ("", "#"); - Gramext.Snterm - (Grammar.Entry.obj - (class_longident : 'class_longident Grammar.Entry.e))], - Gramext.action - (fun (id : 'class_longident) _ (loc : int * int) -> - (MLast.TyCls (loc, id) : 'ctyp))]]; - Grammar.Entry.obj (field : 'field Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("LIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (lab : string) (loc : int * int) -> - (lab, t : 'field))]]; - Grammar.Entry.obj (typevar : 'typevar Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> (i : 'typevar))]]; - Grammar.Entry.obj (clty_longident : 'clty_longident Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> ([i] : 'clty_longident)); - [Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "."); - Gramext.Sself], - Gramext.action - (fun (l : 'clty_longident) _ (m : string) (loc : int * int) -> - (m :: l : 'clty_longident))]]; - Grammar.Entry.obj (class_longident : 'class_longident Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> ([i] : 'class_longident)); - [Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "."); - Gramext.Sself], - Gramext.action - (fun (l : 'class_longident) _ (m : string) (loc : int * int) -> - (m :: l : 'class_longident))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.After "arrow"), - [None, Some Gramext.NonA, - [[Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (i : string) (loc : int * int) -> - (MLast.TyOlb (loc, i, t) : 'ctyp)); - [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (i : string) (loc : int * int) -> - (MLast.TyLab (loc, i, t) : 'ctyp))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", ">"); - Gramext.Slist1 - (Gramext.Snterm - (Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e))); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (ntl : 'name_tag list) _ (rfl : 'row_field_list) _ _ - (loc : int * int) -> - (MLast.TyVrn (loc, rfl, Some (Some ntl)) : 'ctyp)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> - (MLast.TyVrn (loc, rfl, Some (Some [])) : 'ctyp)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", ">"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> - (MLast.TyVrn (loc, rfl, Some None) : 'ctyp)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> - (MLast.TyVrn (loc, rfl, None) : 'ctyp))]]; - Grammar.Entry.obj (row_field_list : 'row_field_list Grammar.Entry.e), - None, - [None, None, - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e)), - Gramext.Stoken ("", "|"))], - Gramext.action - (fun (rfl : 'row_field list) (loc : int * int) -> - (rfl : 'row_field_list))]]; - Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) (loc : int * int) -> (MLast.RfInh t : 'row_field)); - [Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e)); - Gramext.Stoken ("", "of"); Gramext.Sopt (Gramext.Stoken ("", "&")); - Gramext.Slist1sep - (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", "&"))], - Gramext.action - (fun (l : 'ctyp list) (ao : string option) _ (i : 'ident) _ - (loc : int * int) -> - (MLast.RfTag (i, o2b ao, l) : 'row_field)); - [Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> - (MLast.RfTag (i, true, []) : 'row_field))]]; - Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> (i : 'name_tag))]]; - Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "?"); Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (eo : 'eq_expr option) (p : 'patt_tcon) _ _ - (loc : int * int) -> - (MLast.PaOlb (loc, "", Some (p, eo)) : 'patt)); - [Gramext.Stoken ("QUESTIONIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.PaOlb (loc, i, None) : 'patt)); - [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (eo : 'eq_expr option) (p : 'patt_tcon) _ _ (i : string) - (loc : int * int) -> - (MLast.PaOlb (loc, i, Some (p, eo)) : 'patt)); - [Gramext.Stoken ("TILDEIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.PaLab (loc, i, None) : 'patt)); - [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself], - Gramext.action - (fun (p : 'patt) _ (i : string) (loc : int * int) -> - (MLast.PaLab (loc, i, Some p) : 'patt)); - [Gramext.Stoken ("", "#"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], - Gramext.action - (fun (sl : 'mod_ident) _ (loc : int * int) -> - (MLast.PaTyp (loc, sl) : 'patt)); - [Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (s : 'ident) _ (loc : int * int) -> - (MLast.PaVrn (loc, s) : 'patt))]]; - Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], - Gramext.action - (fun (p : 'patt) (loc : int * int) -> (p : 'patt_tcon)); - [Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (p : 'patt) (loc : int * int) -> - (MLast.PaTyc (loc, p, t) : 'patt_tcon))]]; - Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "?"); Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (eo : 'eq_expr option) (p : 'ipatt_tcon) _ _ - (loc : int * int) -> - (MLast.PaOlb (loc, "", Some (p, eo)) : 'ipatt)); - [Gramext.Stoken ("QUESTIONIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.PaOlb (loc, i, None) : 'ipatt)); - [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (eo : 'eq_expr option) (p : 'ipatt_tcon) _ _ (i : string) - (loc : int * int) -> - (MLast.PaOlb (loc, i, Some (p, eo)) : 'ipatt)); - [Gramext.Stoken ("TILDEIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.PaLab (loc, i, None) : 'ipatt)); - [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself], - Gramext.action - (fun (p : 'ipatt) _ (i : string) (loc : int * int) -> - (MLast.PaLab (loc, i, Some p) : 'ipatt))]]; - Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e))], - Gramext.action - (fun (p : 'ipatt) (loc : int * int) -> (p : 'ipatt_tcon)); - [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (p : 'ipatt) (loc : int * int) -> - (MLast.PaTyc (loc, p, t) : 'ipatt_tcon))]]; - Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (e : 'eq_expr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.After "apply"), - [Some "label", Some Gramext.NonA, - [[Gramext.Stoken ("QUESTIONIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.ExOlb (loc, i, None) : 'expr)); - [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (i : string) (loc : int * int) -> - (MLast.ExOlb (loc, i, Some e) : 'expr)); - [Gramext.Stoken ("TILDEIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> - (MLast.ExLab (loc, i, None) : 'expr)); - [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (i : string) (loc : int * int) -> - (MLast.ExLab (loc, i, Some e) : 'expr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (s : 'ident) _ (loc : int * int) -> - (MLast.ExVrn (loc, s) : 'expr))]]; - Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "downto")], - Gramext.action (fun _ (loc : int * int) -> (false : 'direction_flag)); - [Gramext.Stoken ("", "to")], - Gramext.action - (fun _ (loc : int * int) -> (true : 'direction_flag))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "[|"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_variant : 'warning_variant Grammar.Entry.e)); - Gramext.Stoken ("", "<"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", ">"); - Gramext.Slist1 - (Gramext.Snterm - (Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e))); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (ntl : 'name_tag list) _ (rfl : 'row_field_list) _ _ _ - (loc : int * int) -> - (MLast.TyVrn (loc, rfl, Some (Some ntl)) : 'ctyp)); - [Gramext.Stoken ("", "[|"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_variant : 'warning_variant Grammar.Entry.e)); - Gramext.Stoken ("", "<"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ _ (loc : int * int) -> - (MLast.TyVrn (loc, rfl, Some (Some [])) : 'ctyp)); - [Gramext.Stoken ("", "[|"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_variant : 'warning_variant Grammar.Entry.e)); - Gramext.Stoken ("", ">"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ _ (loc : int * int) -> - (MLast.TyVrn (loc, rfl, Some None) : 'ctyp)); - [Gramext.Stoken ("", "[|"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_variant : 'warning_variant Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> - (MLast.TyVrn (loc, rfl, None) : 'ctyp))]]; - Grammar.Entry.obj (warning_variant : 'warning_variant Grammar.Entry.e), - None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> (warn_variant loc : 'warning_variant))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "top"), - [None, None, - [[Gramext.Stoken ("", "while"); Gramext.Sself; - Gramext.Stoken ("", "do"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__12))]); - Gramext.Snterm - (Grammar.Entry.obj - (warning_sequence : 'warning_sequence Grammar.Entry.e)); - Gramext.Stoken ("", "done")], - Gramext.action - (fun _ _ (seq : 'e__12 list) _ (e : 'expr) _ (loc : int * int) -> - (MLast.ExWhi (loc, e, seq) : 'expr)); - [Gramext.Stoken ("", "for"); Gramext.Stoken ("LIDENT", ""); - Gramext.Stoken ("", "="); Gramext.Sself; - Gramext.Snterm - (Grammar.Entry.obj - (direction_flag : 'direction_flag Grammar.Entry.e)); - Gramext.Sself; Gramext.Stoken ("", "do"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__11))]); - Gramext.Snterm - (Grammar.Entry.obj - (warning_sequence : 'warning_sequence Grammar.Entry.e)); - Gramext.Stoken ("", "done")], - Gramext.action - (fun _ _ (seq : 'e__11 list) _ (e2 : 'expr) (df : 'direction_flag) - (e1 : 'expr) _ (i : string) _ (loc : int * int) -> - (MLast.ExFor (loc, i, e1, e2, df, seq) : 'expr)); - [Gramext.Stoken ("", "do"); - Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__10))]); - Gramext.Stoken ("", "return"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_sequence : 'warning_sequence Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ _ (seq : 'e__10 list) _ (loc : int * int) -> - (MLast.ExSeq (loc, append_elem seq e) : 'expr))]]; - Grammar.Entry.obj - (warning_sequence : 'warning_sequence Grammar.Entry.e), - None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> - (warn_sequence loc : 'warning_sequence))]]]) +Grammar.extend + (let _ = (sig_item : 'sig_item Grammar.Entry.e) + and _ = (str_item : 'str_item Grammar.Entry.e) + and _ = (ctyp : 'ctyp Grammar.Entry.e) + and _ = (patt : 'patt Grammar.Entry.e) + and _ = (expr : 'expr Grammar.Entry.e) + and _ = (module_type : 'module_type Grammar.Entry.e) + and _ = (module_expr : 'module_expr Grammar.Entry.e) + and _ = (class_type : 'class_type Grammar.Entry.e) + and _ = (class_expr : 'class_expr Grammar.Entry.e) + and _ = (class_sig_item : 'class_sig_item Grammar.Entry.e) + and _ = (class_str_item : 'class_str_item Grammar.Entry.e) + and _ = (let_binding : 'let_binding Grammar.Entry.e) + and _ = (type_declaration : 'type_declaration Grammar.Entry.e) + and _ = (ipatt : 'ipatt Grammar.Entry.e) + and _ = (with_constr : 'with_constr Grammar.Entry.e) + and _ = (row_field : 'row_field Grammar.Entry.e) in + let grammar_entry_create s = + Grammar.Entry.create (Grammar.of_entry sig_item) s + in + let rebind_exn : 'rebind_exn Grammar.Entry.e = + grammar_entry_create "rebind_exn" + and module_binding : 'module_binding Grammar.Entry.e = + grammar_entry_create "module_binding" + and module_rec_binding : 'module_rec_binding Grammar.Entry.e = + grammar_entry_create "module_rec_binding" + and module_declaration : 'module_declaration Grammar.Entry.e = + grammar_entry_create "module_declaration" + and module_rec_declaration : 'module_rec_declaration Grammar.Entry.e = + grammar_entry_create "module_rec_declaration" + and cons_expr_opt : 'cons_expr_opt Grammar.Entry.e = + grammar_entry_create "cons_expr_opt" + and dummy : 'dummy Grammar.Entry.e = grammar_entry_create "dummy" + and sequence : 'sequence Grammar.Entry.e = grammar_entry_create "sequence" + and fun_binding : 'fun_binding Grammar.Entry.e = + grammar_entry_create "fun_binding" + and match_case : 'match_case Grammar.Entry.e = + grammar_entry_create "match_case" + and as_patt_opt : 'as_patt_opt Grammar.Entry.e = + grammar_entry_create "as_patt_opt" + and when_expr_opt : 'when_expr_opt Grammar.Entry.e = + grammar_entry_create "when_expr_opt" + and label_expr : 'label_expr Grammar.Entry.e = + grammar_entry_create "label_expr" + and expr_ident : 'expr_ident Grammar.Entry.e = + grammar_entry_create "expr_ident" + and fun_def : 'fun_def Grammar.Entry.e = grammar_entry_create "fun_def" + and cons_patt_opt : 'cons_patt_opt Grammar.Entry.e = + grammar_entry_create "cons_patt_opt" + and label_patt : 'label_patt Grammar.Entry.e = + grammar_entry_create "label_patt" + and patt_label_ident : 'patt_label_ident Grammar.Entry.e = + grammar_entry_create "patt_label_ident" + and label_ipatt : 'label_ipatt Grammar.Entry.e = + grammar_entry_create "label_ipatt" + and type_patt : 'type_patt Grammar.Entry.e = + grammar_entry_create "type_patt" + and constrain : 'constrain Grammar.Entry.e = + grammar_entry_create "constrain" + and type_parameter : 'type_parameter Grammar.Entry.e = + grammar_entry_create "type_parameter" + and constructor_declaration : 'constructor_declaration Grammar.Entry.e = + grammar_entry_create "constructor_declaration" + and label_declaration : 'label_declaration Grammar.Entry.e = + grammar_entry_create "label_declaration" + and ident : 'ident Grammar.Entry.e = grammar_entry_create "ident" + and mod_ident : 'mod_ident Grammar.Entry.e = + grammar_entry_create "mod_ident" + and class_declaration : 'class_declaration Grammar.Entry.e = + grammar_entry_create "class_declaration" + and class_fun_binding : 'class_fun_binding Grammar.Entry.e = + grammar_entry_create "class_fun_binding" + and class_type_parameters : 'class_type_parameters Grammar.Entry.e = + grammar_entry_create "class_type_parameters" + and class_fun_def : 'class_fun_def Grammar.Entry.e = + grammar_entry_create "class_fun_def" + and class_structure : 'class_structure Grammar.Entry.e = + grammar_entry_create "class_structure" + and class_self_patt : 'class_self_patt Grammar.Entry.e = + grammar_entry_create "class_self_patt" + and as_lident : 'as_lident Grammar.Entry.e = + grammar_entry_create "as_lident" + and polyt : 'polyt Grammar.Entry.e = grammar_entry_create "polyt" + and cvalue_binding : 'cvalue_binding Grammar.Entry.e = + grammar_entry_create "cvalue_binding" + and label : 'label Grammar.Entry.e = grammar_entry_create "label" + and class_self_type : 'class_self_type Grammar.Entry.e = + grammar_entry_create "class_self_type" + and class_description : 'class_description Grammar.Entry.e = + grammar_entry_create "class_description" + and class_type_declaration : 'class_type_declaration Grammar.Entry.e = + grammar_entry_create "class_type_declaration" + and field_expr : 'field_expr Grammar.Entry.e = + grammar_entry_create "field_expr" + and field : 'field Grammar.Entry.e = grammar_entry_create "field" + and typevar : 'typevar Grammar.Entry.e = grammar_entry_create "typevar" + and clty_longident : 'clty_longident Grammar.Entry.e = + grammar_entry_create "clty_longident" + and class_longident : 'class_longident Grammar.Entry.e = + grammar_entry_create "class_longident" + and row_field_list : 'row_field_list Grammar.Entry.e = + grammar_entry_create "row_field_list" + and name_tag : 'name_tag Grammar.Entry.e = grammar_entry_create "name_tag" + and patt_tcon : 'patt_tcon Grammar.Entry.e = + grammar_entry_create "patt_tcon" + and ipatt_tcon : 'ipatt_tcon Grammar.Entry.e = + grammar_entry_create "ipatt_tcon" + and eq_expr : 'eq_expr Grammar.Entry.e = grammar_entry_create "eq_expr" + and direction_flag : 'direction_flag Grammar.Entry.e = + grammar_entry_create "direction_flag" + and warning_variant : 'warning_variant Grammar.Entry.e = + grammar_entry_create "warning_variant" + and warning_sequence : 'warning_sequence Grammar.Entry.e = + grammar_entry_create "warning_sequence" + in + [Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "struct"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'str_item) (loc : int * int) -> (s : 'e__1))]); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'e__1 list) _ (loc : int * int) -> + (MLast.MeStr (loc, st) : 'module_expr)); + [Gramext.Stoken ("", "functor"); Gramext.Stoken ("", "("); + Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", ")"); Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (me : 'module_expr) _ _ (t : 'module_type) _ (i : string) _ _ + (loc : int * int) -> + (MLast.MeFun (loc, i, t, me) : 'module_expr))]; + None, None, + [[Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (me2 : 'module_expr) (me1 : 'module_expr) (loc : int * int) -> + (MLast.MeApp (loc, me1, me2) : 'module_expr))]; + None, None, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (me2 : 'module_expr) _ (me1 : 'module_expr) (loc : int * int) -> + (MLast.MeAcc (loc, me1, me2) : 'module_expr))]; + Some "simple", None, + [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (me : 'module_expr) _ (loc : int * int) -> + (me : 'module_expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (mt : 'module_type) _ (me : 'module_expr) _ + (loc : int * int) -> + (MLast.MeTyc (loc, me, mt) : 'module_expr)); + [Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.MeUid (loc, i) : 'module_expr))]]; + Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, + [Some "top", None, + [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) (loc : int * int) -> + (MLast.StExp (loc, e) : 'str_item)); + [Gramext.Stoken ("", "value"); + Gramext.Sopt (Gramext.Stoken ("", "rec")); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (l : 'let_binding list) (r : string option) _ + (loc : int * int) -> + (MLast.StVal (loc, o2b r, l) : 'str_item)); + [Gramext.Stoken ("", "type"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (type_declaration : 'type_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (tdl : 'type_declaration list) _ (loc : int * int) -> + (MLast.StTyp (loc, tdl) : 'str_item)); + [Gramext.Stoken ("", "open"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'mod_ident) _ (loc : int * int) -> + (MLast.StOpn (loc, i) : 'str_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "type"); + Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (i : string) _ _ (loc : int * int) -> + (MLast.StMty (loc, i, mt) : 'str_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "rec"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (module_rec_binding : 'module_rec_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (nmtmes : 'module_rec_binding list) _ _ (loc : int * int) -> + (MLast.StRecMod (loc, nmtmes) : 'str_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("UIDENT", ""); + Gramext.Snterm + (Grammar.Entry.obj + (module_binding : 'module_binding Grammar.Entry.e))], + Gramext.action + (fun (mb : 'module_binding) (i : string) _ (loc : int * int) -> + (MLast.StMod (loc, i, mb) : 'str_item)); + [Gramext.Stoken ("", "include"); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (loc : int * int) -> + (MLast.StInc (loc, me) : 'str_item)); + [Gramext.Stoken ("", "external"); Gramext.Stoken ("LIDENT", ""); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Slist1 (Gramext.Stoken ("STRING", ""))], + Gramext.action + (fun (pd : string list) _ (t : 'ctyp) _ (i : string) _ + (loc : int * int) -> + (MLast.StExt (loc, i, t, pd) : 'str_item)); + [Gramext.Stoken ("", "exception"); + Gramext.Snterm + (Grammar.Entry.obj + (constructor_declaration : + 'constructor_declaration Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e))], + Gramext.action + (fun (b : 'rebind_exn) (_, c, tl : 'constructor_declaration) _ + (loc : int * int) -> + (MLast.StExc (loc, c, tl, b) : 'str_item)); + [Gramext.Stoken ("", "declare"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'str_item) (loc : int * int) -> (s : 'e__2))]); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'e__2 list) _ (loc : int * int) -> + (MLast.StDcl (loc, st) : 'str_item))]]; + Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e), None, + [None, None, + [[], Gramext.action (fun (loc : int * int) -> ([] : 'rebind_exn)); + [Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], + Gramext.action + (fun (sl : 'mod_ident) _ (loc : int * int) -> (sl : 'rebind_exn))]]; + Grammar.Entry.obj (module_binding : 'module_binding Grammar.Entry.e), + None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (loc : int * int) -> + (me : 'module_binding)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (mt : 'module_type) _ (loc : int * int) -> + (MLast.MeTyc (loc, me, mt) : 'module_binding)); + [Gramext.Stoken ("", "("); Gramext.Stoken ("UIDENT", ""); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", ")"); Gramext.Sself], + Gramext.action + (fun (mb : 'module_binding) _ (mt : 'module_type) _ (m : string) _ + (loc : int * int) -> + (MLast.MeFun (loc, m, mt, mb) : 'module_binding))]]; + Grammar.Entry.obj + (module_rec_binding : 'module_rec_binding Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (mt : 'module_type) _ (m : string) + (loc : int * int) -> + (m, mt, me : 'module_rec_binding))]]; + Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "functor"); Gramext.Stoken ("", "("); + Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", ":"); Gramext.Sself; + Gramext.Stoken ("", ")"); Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (mt : 'module_type) _ _ (t : 'module_type) _ (i : string) _ _ + (loc : int * int) -> + (MLast.MtFun (loc, i, t, mt) : 'module_type))]; + None, None, + [[Gramext.Sself; Gramext.Stoken ("", "with"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (with_constr : 'with_constr Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (wcl : 'with_constr list) _ (mt : 'module_type) + (loc : int * int) -> + (MLast.MtWit (loc, mt, wcl) : 'module_type))]; + None, None, + [[Gramext.Stoken ("", "sig"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'sig_item) (loc : int * int) -> (s : 'e__3))]); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (sg : 'e__3 list) _ (loc : int * int) -> + (MLast.MtSig (loc, sg) : 'module_type))]; + None, None, + [[Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (m2 : 'module_type) (m1 : 'module_type) (loc : int * int) -> + (MLast.MtApp (loc, m1, m2) : 'module_type))]; + None, None, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (m2 : 'module_type) _ (m1 : 'module_type) (loc : int * int) -> + (MLast.MtAcc (loc, m1, m2) : 'module_type))]; + Some "simple", None, + [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (mt : 'module_type) _ (loc : int * int) -> + (mt : 'module_type)); + [Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> + (MLast.MtQuo (loc, i) : 'module_type)); + [Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.MtLid (loc, i) : 'module_type)); + [Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.MtUid (loc, i) : 'module_type))]]; + Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, + [Some "top", None, + [[Gramext.Stoken ("", "value"); Gramext.Stoken ("LIDENT", ""); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (i : string) _ (loc : int * int) -> + (MLast.SgVal (loc, i, t) : 'sig_item)); + [Gramext.Stoken ("", "type"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (type_declaration : 'type_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (tdl : 'type_declaration list) _ (loc : int * int) -> + (MLast.SgTyp (loc, tdl) : 'sig_item)); + [Gramext.Stoken ("", "open"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'mod_ident) _ (loc : int * int) -> + (MLast.SgOpn (loc, i) : 'sig_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "type"); + Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (i : string) _ _ (loc : int * int) -> + (MLast.SgMty (loc, i, mt) : 'sig_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "rec"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (module_rec_declaration : + 'module_rec_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (mds : 'module_rec_declaration list) _ _ (loc : int * int) -> + (MLast.SgRecMod (loc, mds) : 'sig_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("UIDENT", ""); + Gramext.Snterm + (Grammar.Entry.obj + (module_declaration : 'module_declaration Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_declaration) (i : string) _ (loc : int * int) -> + (MLast.SgMod (loc, i, mt) : 'sig_item)); + [Gramext.Stoken ("", "include"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (loc : int * int) -> + (MLast.SgInc (loc, mt) : 'sig_item)); + [Gramext.Stoken ("", "external"); Gramext.Stoken ("LIDENT", ""); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Slist1 (Gramext.Stoken ("STRING", ""))], + Gramext.action + (fun (pd : string list) _ (t : 'ctyp) _ (i : string) _ + (loc : int * int) -> + (MLast.SgExt (loc, i, t, pd) : 'sig_item)); + [Gramext.Stoken ("", "exception"); + Gramext.Snterm + (Grammar.Entry.obj + (constructor_declaration : + 'constructor_declaration Grammar.Entry.e))], + Gramext.action + (fun (_, c, tl : 'constructor_declaration) _ (loc : int * int) -> + (MLast.SgExc (loc, c, tl) : 'sig_item)); + [Gramext.Stoken ("", "declare"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'sig_item) (loc : int * int) -> (s : 'e__4))]); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'e__4 list) _ (loc : int * int) -> + (MLast.SgDcl (loc, st) : 'sig_item))]]; + Grammar.Entry.obj + (module_declaration : 'module_declaration Grammar.Entry.e), + None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("", "("); Gramext.Stoken ("UIDENT", ""); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", ")"); Gramext.Sself], + Gramext.action + (fun (mt : 'module_declaration) _ (t : 'module_type) _ (i : string) _ + (loc : int * int) -> + (MLast.MtFun (loc, i, t, mt) : 'module_declaration)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (loc : int * int) -> + (mt : 'module_declaration))]]; + Grammar.Entry.obj + (module_rec_declaration : 'module_rec_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (m : string) (loc : int * int) -> + (m, mt : 'module_rec_declaration))]]; + Grammar.Entry.obj (with_constr : 'with_constr Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "module"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (i : 'mod_ident) _ (loc : int * int) -> + (MLast.WcMod (loc, i, me) : 'with_constr)); + [Gramext.Stoken ("", "type"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e)); + Gramext.Slist0 + (Gramext.Snterm + (Grammar.Entry.obj + (type_parameter : 'type_parameter Grammar.Entry.e))); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (tpl : 'type_parameter list) (i : 'mod_ident) _ + (loc : int * int) -> + (MLast.WcTyp (loc, i, tpl, t) : 'with_constr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), None, + [Some "top", Some Gramext.RightA, + [[Gramext.Stoken ("", "while"); Gramext.Sself; Gramext.Stoken ("", "do"); + Gramext.Stoken ("", "{"); + Gramext.Snterm + (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (seq : 'sequence) _ _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExWhi (loc, e, seq) : 'expr)); + [Gramext.Stoken ("", "for"); Gramext.Stoken ("LIDENT", ""); + Gramext.Stoken ("", "="); Gramext.Sself; + Gramext.Snterm + (Grammar.Entry.obj + (direction_flag : 'direction_flag Grammar.Entry.e)); + Gramext.Sself; Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); + Gramext.Snterm + (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (seq : 'sequence) _ _ (e2 : 'expr) (df : 'direction_flag) + (e1 : 'expr) _ (i : string) _ (loc : int * int) -> + (MLast.ExFor (loc, i, e1, e2, df, seq) : 'expr)); + [Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); + Gramext.Snterm + (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (seq : 'sequence) _ _ (loc : int * int) -> + (mksequence loc seq : 'expr)); + [Gramext.Stoken ("", "if"); Gramext.Sself; Gramext.Stoken ("", "then"); + Gramext.Sself; Gramext.Stoken ("", "else"); Gramext.Sself], + Gramext.action + (fun (e3 : 'expr) _ (e2 : 'expr) _ (e1 : 'expr) _ (loc : int * int) -> + (MLast.ExIfe (loc, e1, e2, e3) : 'expr)); + [Gramext.Stoken ("", "try"); Gramext.Sself; Gramext.Stoken ("", "with"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (e1 : 'expr) _ (p1 : 'ipatt) _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExTry (loc, e, [p1, None, e1]) : 'expr)); + [Gramext.Stoken ("", "try"); Gramext.Sself; Gramext.Stoken ("", "with"); + Gramext.Stoken ("", "["); + Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e)), + Gramext.Stoken ("", "|")); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (l : 'match_case list) _ _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExTry (loc, e, l) : 'expr)); + [Gramext.Stoken ("", "match"); Gramext.Sself; + Gramext.Stoken ("", "with"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (e1 : 'expr) _ (p1 : 'ipatt) _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExMat (loc, e, [p1, None, e1]) : 'expr)); + [Gramext.Stoken ("", "match"); Gramext.Sself; + Gramext.Stoken ("", "with"); Gramext.Stoken ("", "["); + Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e)), + Gramext.Stoken ("", "|")); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (l : 'match_case list) _ _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExMat (loc, e, l) : 'expr)); + [Gramext.Stoken ("", "fun"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (fun_def : 'fun_def Grammar.Entry.e))], + Gramext.action + (fun (e : 'fun_def) (p : 'ipatt) _ (loc : int * int) -> + (MLast.ExFun (loc, [p, None, e]) : 'expr)); + [Gramext.Stoken ("", "fun"); Gramext.Stoken ("", "["); + Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e)), + Gramext.Stoken ("", "|")); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (l : 'match_case list) _ _ (loc : int * int) -> + (MLast.ExFun (loc, l) : 'expr)); + [Gramext.Stoken ("", "let"); Gramext.Stoken ("", "module"); + Gramext.Stoken ("UIDENT", ""); + Gramext.Snterm + (Grammar.Entry.obj + (module_binding : 'module_binding Grammar.Entry.e)); + Gramext.Stoken ("", "in"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (mb : 'module_binding) (m : string) _ _ + (loc : int * int) -> + (MLast.ExLmd (loc, m, mb, e) : 'expr)); + [Gramext.Stoken ("", "let"); Gramext.Sopt (Gramext.Stoken ("", "rec")); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and")); + Gramext.Stoken ("", "in"); Gramext.Sself], + Gramext.action + (fun (x : 'expr) _ (l : 'let_binding list) (r : string option) _ + (loc : int * int) -> + (MLast.ExLet (loc, o2b r, l, x) : 'expr))]; + Some "where", None, + [[Gramext.Sself; Gramext.Stoken ("", "where"); + Gramext.Sopt (Gramext.Stoken ("", "rec")); + Gramext.Snterm + (Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e))], + Gramext.action + (fun (lb : 'let_binding) (rf : string option) _ (e : 'expr) + (loc : int * int) -> + (MLast.ExLet (loc, o2b rf, [lb], e) : 'expr))]; + Some ":=", Some Gramext.NonA, + [[Gramext.Sself; Gramext.Stoken ("", ":="); Gramext.Sself; + Gramext.Snterm (Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e))], + Gramext.action + (fun _ (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExAss (loc, e1, e2) : 'expr))]; + Some "||", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "||"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "||"), e1), e2) : + 'expr))]; + Some "&&", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "&&"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "&&"), e1), e2) : + 'expr))]; + Some "<", Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "!="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "!="), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "=="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "=="), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "<>"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "<>"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "="), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", ">="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, ">="), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "<="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "<="), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", ">"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, ">"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "<"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "<"), e1), e2) : + 'expr))]; + Some "^", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "@"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "@"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "^"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "^"), e1), e2) : + 'expr))]; + Some "+", Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "-."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "-."), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "+."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "+."), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "-"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "-"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "+"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "+"), e1), e2) : + 'expr))]; + Some "*", Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "mod"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "mod"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "lxor"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "lxor"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "lor"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "lor"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "land"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "land"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "/."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "/."), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "*."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "*."), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "/"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "/"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "*"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "*"), e1), e2) : + 'expr))]; + Some "**", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "lsr"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "lsr"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "lsl"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "lsl"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "asr"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "asr"), e1), e2) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "**"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp + (loc, MLast.ExApp (loc, MLast.ExLid (loc, "**"), e1), e2) : + 'expr))]; + Some "unary minus", Some Gramext.NonA, + [[Gramext.Stoken ("", "-."); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (mkumin loc "-." e : 'expr)); + [Gramext.Stoken ("", "-"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (mkumin loc "-" e : 'expr))]; + Some "apply", Some Gramext.LeftA, + [[Gramext.Stoken ("", "lazy"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (MLast.ExLaz (loc, e) : 'expr)); + [Gramext.Stoken ("", "assert"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (mkassert loc e : 'expr)); + [Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) (e1 : 'expr) (loc : int * int) -> + (MLast.ExApp (loc, e1, e2) : 'expr))]; + Some ".", Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExAcc (loc, e1, e2) : 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Stoken ("", "["); + Gramext.Sself; Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (e2 : 'expr) _ _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExSte (loc, e1, e2) : 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Stoken ("", "("); + Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (e2 : 'expr) _ _ (e1 : 'expr) (loc : int * int) -> + (MLast.ExAre (loc, e1, e2) : 'expr))]; + Some "~-", Some Gramext.NonA, + [[Gramext.Stoken ("", "~-."); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (MLast.ExApp (loc, MLast.ExLid (loc, "~-."), e) : 'expr)); + [Gramext.Stoken ("", "~-"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (MLast.ExApp (loc, MLast.ExLid (loc, "~-"), e) : 'expr))]; + Some "simple", None, + [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action (fun _ (e : 'expr) _ (loc : int * int) -> (e : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), + Gramext.Stoken ("", ",")); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (el : 'expr list) _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExTup (loc, (e :: el)) : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExTyc (loc, e, t) : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], + Gramext.action + (fun _ _ (loc : int * int) -> (MLast.ExUid (loc, "()") : 'expr)); + [Gramext.Stoken ("", "{"); Gramext.Stoken ("", "("); Gramext.Sself; + Gramext.Stoken ("", ")"); Gramext.Stoken ("", "with"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (lel : 'label_expr list) _ _ (e : 'expr) _ _ + (loc : int * int) -> + (MLast.ExRec (loc, lel, Some e) : 'expr)); + [Gramext.Stoken ("", "{"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (lel : 'label_expr list) _ (loc : int * int) -> + (MLast.ExRec (loc, lel, None) : 'expr)); + [Gramext.Stoken ("", "[|"); + Gramext.Slist0sep + (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (el : 'expr list) _ (loc : int * int) -> + (MLast.ExArr (loc, el) : 'expr)); + [Gramext.Stoken ("", "["); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Snterm + (Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (last : 'cons_expr_opt) (el : 'expr list) _ + (loc : int * int) -> + (mklistexp loc last el : 'expr)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")], + Gramext.action + (fun _ _ (loc : int * int) -> (MLast.ExUid (loc, "[]") : 'expr)); + [Gramext.Snterm + (Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e))], + Gramext.action (fun (i : 'expr_ident) (loc : int * int) -> (i : 'expr)); + [Gramext.Stoken ("CHAR", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.ExChr (loc, s) : 'expr)); + [Gramext.Stoken ("STRING", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.ExStr (loc, s) : 'expr)); + [Gramext.Stoken ("FLOAT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.ExFlo (loc, s) : 'expr)); + [Gramext.Stoken ("NATIVEINT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.ExNativeInt (loc, s) : 'expr)); + [Gramext.Stoken ("INT64", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.ExInt64 (loc, s) : 'expr)); + [Gramext.Stoken ("INT32", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.ExInt32 (loc, s) : 'expr)); + [Gramext.Stoken ("INT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.ExInt (loc, s) : 'expr))]]; + Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e), None, + [None, None, + [[], Gramext.action (fun (loc : int * int) -> (None : 'cons_expr_opt)); + [Gramext.Stoken ("", "::"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (Some e : 'cons_expr_opt))]]; + Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e), None, + [None, None, + [[], Gramext.action (fun (loc : int * int) -> (() : 'dummy))]]; + Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action (fun (e : 'expr) (loc : int * int) -> ([e] : 'sequence)); + [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (e : 'expr) (loc : int * int) -> ([e] : 'sequence)); + [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";"); Gramext.Sself], + Gramext.action + (fun (el : 'sequence) _ (e : 'expr) (loc : int * int) -> + (e :: el : 'sequence)); + [Gramext.Stoken ("", "let"); Gramext.Sopt (Gramext.Stoken ("", "rec")); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and")); + Gramext.srules + [[Gramext.Stoken ("", ";")], + Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__5)); + [Gramext.Stoken ("", "in")], + Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__5))]; + Gramext.Sself], + Gramext.action + (fun (el : 'sequence) _ (l : 'let_binding list) (rf : string option) _ + (loc : int * int) -> + ([MLast.ExLet (loc, o2b rf, l, mksequence loc el)] : 'sequence))]]; + Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'fun_binding) (p : 'ipatt) (loc : int * int) -> + (p, e : 'let_binding))]]; + Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e), None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> + (MLast.ExTyc (loc, e, t) : 'fun_binding)); + [Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (e : 'fun_binding)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (e : 'fun_binding) (p : 'ipatt) (loc : int * int) -> + (MLast.ExFun (loc, [p, None, e]) : 'fun_binding))]]; + Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e)); + Gramext.Stoken ("", "->"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (w : 'when_expr_opt) (aso : 'as_patt_opt) + (p : 'patt) (loc : int * int) -> + (mkmatchcase loc p aso w e : 'match_case))]]; + Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e), None, + [None, None, + [[], Gramext.action (fun (loc : int * int) -> (None : 'as_patt_opt)); + [Gramext.Stoken ("", "as"); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], + Gramext.action + (fun (p : 'patt) _ (loc : int * int) -> (Some p : 'as_patt_opt))]]; + Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), None, + [None, None, + [[], Gramext.action (fun (loc : int * int) -> (None : 'when_expr_opt)); + [Gramext.Stoken ("", "when"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (Some e : 'when_expr_opt))]]; + Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj + (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'fun_binding) (i : 'patt_label_ident) (loc : int * int) -> + (i, e : 'label_expr))]]; + Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e), None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "."); + Gramext.Sself], + Gramext.action + (fun (j : 'expr_ident) _ (i : string) (loc : int * int) -> + (mkexprident loc i j : 'expr_ident)); + [Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.ExUid (loc, i) : 'expr_ident)); + [Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.ExLid (loc, i) : 'expr_ident))]]; + Grammar.Entry.obj (fun_def : 'fun_def Grammar.Entry.e), None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("", "->"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action (fun (e : 'expr) _ (loc : int * int) -> (e : 'fun_def)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (e : 'fun_def) (p : 'ipatt) (loc : int * int) -> + (MLast.ExFun (loc, [p, None, e]) : 'fun_def))]]; + Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), None, + [None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "|"); Gramext.Sself], + Gramext.action + (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> + (MLast.PaOrp (loc, p1, p2) : 'patt))]; + None, Some Gramext.NonA, + [[Gramext.Sself; Gramext.Stoken ("", ".."); Gramext.Sself], + Gramext.action + (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> + (MLast.PaRng (loc, p1, p2) : 'patt))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (p2 : 'patt) (p1 : 'patt) (loc : int * int) -> + (MLast.PaApp (loc, p1, p2) : 'patt))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> + (MLast.PaAcc (loc, p1, p2) : 'patt))]; + Some "simple", None, + [[Gramext.Stoken ("", "_")], + Gramext.action (fun _ (loc : int * int) -> (MLast.PaAny loc : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), + Gramext.Stoken ("", ",")); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (pl : 'patt list) _ (p : 'patt) _ (loc : int * int) -> + (MLast.PaTup (loc, (p :: pl)) : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "as"); + Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (p2 : 'patt) _ (p : 'patt) _ (loc : int * int) -> + (MLast.PaAli (loc, p, p2) : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) -> + (MLast.PaTyc (loc, p, t) : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], + Gramext.action + (fun _ _ (loc : int * int) -> (MLast.PaUid (loc, "()") : 'patt)); + [Gramext.Stoken ("", "{"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (label_patt : 'label_patt Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (lpl : 'label_patt list) _ (loc : int * int) -> + (MLast.PaRec (loc, lpl) : 'patt)); + [Gramext.Stoken ("", "[|"); + Gramext.Slist0sep + (Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (pl : 'patt list) _ (loc : int * int) -> + (MLast.PaArr (loc, pl) : 'patt)); + [Gramext.Stoken ("", "["); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Snterm + (Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (last : 'cons_patt_opt) (pl : 'patt list) _ + (loc : int * int) -> + (mklistpat loc last pl : 'patt)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")], + Gramext.action + (fun _ _ (loc : int * int) -> (MLast.PaUid (loc, "[]") : 'patt)); + [Gramext.Stoken ("", "-"); Gramext.Stoken ("FLOAT", "")], + Gramext.action + (fun (s : string) _ (loc : int * int) -> + (MLast.PaFlo (loc, neg_string s) : 'patt)); + [Gramext.Stoken ("", "-"); Gramext.Stoken ("NATIVEINT", "")], + Gramext.action + (fun (s : string) _ (loc : int * int) -> + (MLast.PaNativeInt (loc, neg_string s) : 'patt)); + [Gramext.Stoken ("", "-"); Gramext.Stoken ("INT64", "")], + Gramext.action + (fun (s : string) _ (loc : int * int) -> + (MLast.PaInt64 (loc, neg_string s) : 'patt)); + [Gramext.Stoken ("", "-"); Gramext.Stoken ("INT32", "")], + Gramext.action + (fun (s : string) _ (loc : int * int) -> + (MLast.PaInt32 (loc, neg_string s) : 'patt)); + [Gramext.Stoken ("", "-"); Gramext.Stoken ("INT", "")], + Gramext.action + (fun (s : string) _ (loc : int * int) -> + (MLast.PaInt (loc, neg_string s) : 'patt)); + [Gramext.Stoken ("CHAR", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaChr (loc, s) : 'patt)); + [Gramext.Stoken ("STRING", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaStr (loc, s) : 'patt)); + [Gramext.Stoken ("FLOAT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaFlo (loc, s) : 'patt)); + [Gramext.Stoken ("NATIVEINT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaNativeInt (loc, s) : 'patt)); + [Gramext.Stoken ("INT64", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaInt64 (loc, s) : 'patt)); + [Gramext.Stoken ("INT32", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaInt32 (loc, s) : 'patt)); + [Gramext.Stoken ("INT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaInt (loc, s) : 'patt)); + [Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaUid (loc, s) : 'patt)); + [Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaLid (loc, s) : 'patt))]]; + Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e), None, + [None, None, + [[], Gramext.action (fun (loc : int * int) -> (None : 'cons_patt_opt)); + [Gramext.Stoken ("", "::"); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], + Gramext.action + (fun (p : 'patt) _ (loc : int * int) -> (Some p : 'cons_patt_opt))]]; + Grammar.Entry.obj (label_patt : 'label_patt Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj + (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], + Gramext.action + (fun (p : 'patt) _ (i : 'patt_label_ident) (loc : int * int) -> + (i, p : 'label_patt))]]; + Grammar.Entry.obj (patt_label_ident : 'patt_label_ident Grammar.Entry.e), + None, + [None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (p2 : 'patt_label_ident) _ (p1 : 'patt_label_ident) + (loc : int * int) -> + (MLast.PaAcc (loc, p1, p2) : 'patt_label_ident))]; + Some "simple", Some Gramext.RightA, + [[Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.PaLid (loc, i) : 'patt_label_ident)); + [Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.PaUid (loc, i) : 'patt_label_ident))]]; + Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "_")], + Gramext.action (fun _ (loc : int * int) -> (MLast.PaAny loc : 'ipatt)); + [Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (MLast.PaLid (loc, s) : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)), + Gramext.Stoken ("", ",")); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (pl : 'ipatt list) _ (p : 'ipatt) _ (loc : int * int) -> + (MLast.PaTup (loc, (p :: pl)) : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "as"); + Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (p2 : 'ipatt) _ (p : 'ipatt) _ (loc : int * int) -> + (MLast.PaAli (loc, p, p2) : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (p : 'ipatt) _ (loc : int * int) -> + (MLast.PaTyc (loc, p, t) : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action (fun _ (p : 'ipatt) _ (loc : int * int) -> (p : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], + Gramext.action + (fun _ _ (loc : int * int) -> (MLast.PaUid (loc, "()") : 'ipatt)); + [Gramext.Stoken ("", "{"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (label_ipatt : 'label_ipatt Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (lpl : 'label_ipatt list) _ (loc : int * int) -> + (MLast.PaRec (loc, lpl) : 'ipatt))]]; + Grammar.Entry.obj (label_ipatt : 'label_ipatt Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj + (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e))], + Gramext.action + (fun (p : 'ipatt) _ (i : 'patt_label_ident) (loc : int * int) -> + (i, p : 'label_ipatt))]]; + Grammar.Entry.obj (type_declaration : 'type_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (type_patt : 'type_patt Grammar.Entry.e)); + Gramext.Slist0 + (Gramext.Snterm + (Grammar.Entry.obj + (type_parameter : 'type_parameter Grammar.Entry.e))); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Slist0 + (Gramext.Snterm + (Grammar.Entry.obj (constrain : 'constrain Grammar.Entry.e)))], + Gramext.action + (fun (cl : 'constrain list) (tk : 'ctyp) _ + (tpl : 'type_parameter list) (n : 'type_patt) (loc : int * int) -> + (n, tpl, tk, cl : 'type_declaration))]]; + Grammar.Entry.obj (type_patt : 'type_patt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (n : string) (loc : int * int) -> (loc, n : 'type_patt))]]; + Grammar.Entry.obj (constrain : 'constrain Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "constraint"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> + (t1, t2 : 'constrain))]]; + Grammar.Entry.obj (type_parameter : 'type_parameter Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "-"); Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ _ (loc : int * int) -> + (i, (false, true) : 'type_parameter)); + [Gramext.Stoken ("", "+"); Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ _ (loc : int * int) -> + (i, (true, false) : 'type_parameter)); + [Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> + (i, (false, false) : 'type_parameter))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), None, + [None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "=="); Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> + (MLast.TyMan (loc, t1, t2) : 'ctyp))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "as"); Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> + (MLast.TyAli (loc, t1, t2) : 'ctyp))]; + None, Some Gramext.LeftA, + [[Gramext.Stoken ("", "!"); + Gramext.Slist1 + (Gramext.Snterm + (Grammar.Entry.obj (typevar : 'typevar Grammar.Entry.e))); + Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (pl : 'typevar list) _ (loc : int * int) -> + (MLast.TyPol (loc, pl, t) : 'ctyp))]; + Some "arrow", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> + (MLast.TyArr (loc, t1, t2) : 'ctyp))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) (t1 : 'ctyp) (loc : int * int) -> + (MLast.TyApp (loc, t1, t2) : 'ctyp))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> + (MLast.TyAcc (loc, t1, t2) : 'ctyp))]; + Some "simple", None, + [[Gramext.Stoken ("", "{"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (label_declaration : 'label_declaration Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (ldl : 'label_declaration list) _ (loc : int * int) -> + (MLast.TyRec (loc, false, ldl) : 'ctyp)); + [Gramext.Stoken ("", "["); + Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj + (constructor_declaration : + 'constructor_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "|")); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (cdl : 'constructor_declaration list) _ (loc : int * int) -> + (MLast.TySum (loc, false, cdl) : 'ctyp)); + [Gramext.Stoken ("", "private"); Gramext.Stoken ("", "{"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (label_declaration : 'label_declaration Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (ldl : 'label_declaration list) _ _ (loc : int * int) -> + (MLast.TyRec (loc, true, ldl) : 'ctyp)); + [Gramext.Stoken ("", "private"); Gramext.Stoken ("", "["); + Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj + (constructor_declaration : + 'constructor_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "|")); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (cdl : 'constructor_declaration list) _ _ (loc : int * int) -> + (MLast.TySum (loc, true, cdl) : 'ctyp)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'ctyp)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "*"); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", "*")); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (tl : 'ctyp list) _ (t : 'ctyp) _ (loc : int * int) -> + (MLast.TyTup (loc, (t :: tl)) : 'ctyp)); + [Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.TyUid (loc, i) : 'ctyp)); + [Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.TyLid (loc, i) : 'ctyp)); + [Gramext.Stoken ("", "_")], + Gramext.action (fun _ (loc : int * int) -> (MLast.TyAny loc : 'ctyp)); + [Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> + (MLast.TyQuo (loc, i) : 'ctyp))]]; + Grammar.Entry.obj + (constructor_declaration : 'constructor_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (ci : string) (loc : int * int) -> + (loc, ci, [] : 'constructor_declaration)); + [Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "of"); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (cal : 'ctyp list) _ (ci : string) (loc : int * int) -> + (loc, ci, cal : 'constructor_declaration))]]; + Grammar.Entry.obj + (label_declaration : 'label_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("LIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sopt (Gramext.Stoken ("", "mutable")); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) (mf : string option) _ (i : string) + (loc : int * int) -> + (loc, i, o2b mf, t : 'label_declaration))]]; + Grammar.Entry.obj (ident : 'ident Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("UIDENT", "")], + Gramext.action (fun (i : string) (loc : int * int) -> (i : 'ident)); + [Gramext.Stoken ("LIDENT", "")], + Gramext.action (fun (i : string) (loc : int * int) -> (i : 'ident))]]; + Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e), None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "."); + Gramext.Sself], + Gramext.action + (fun (j : 'mod_ident) _ (i : string) (loc : int * int) -> + (i :: j : 'mod_ident)); + [Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> ([i] : 'mod_ident)); + [Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> ([i] : 'mod_ident))]]; + Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (class_type_declaration : + 'class_type_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (ctd : 'class_type_declaration list) _ _ (loc : int * int) -> + (MLast.StClt (loc, ctd) : 'str_item)); + [Gramext.Stoken ("", "class"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (class_declaration : 'class_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (cd : 'class_declaration list) _ (loc : int * int) -> + (MLast.StCls (loc, cd) : 'str_item))]]; + Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (class_type_declaration : + 'class_type_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (ctd : 'class_type_declaration list) _ _ (loc : int * int) -> + (MLast.SgClt (loc, ctd) : 'sig_item)); + [Gramext.Stoken ("", "class"); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (class_description : 'class_description Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (cd : 'class_description list) _ (loc : int * int) -> + (MLast.SgCls (loc, cd) : 'sig_item))]]; + Grammar.Entry.obj + (class_declaration : 'class_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Sopt (Gramext.Stoken ("", "virtual")); + Gramext.Stoken ("LIDENT", ""); + Gramext.Snterm + (Grammar.Entry.obj + (class_type_parameters : 'class_type_parameters Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (class_fun_binding : 'class_fun_binding Grammar.Entry.e))], + Gramext.action + (fun (cfb : 'class_fun_binding) (ctp : 'class_type_parameters) + (i : string) (vf : string option) (loc : int * int) -> + ({MLast.ciLoc = loc; MLast.ciVir = o2b vf; MLast.ciPrm = ctp; + MLast.ciNam = i; MLast.ciExp = cfb} : + 'class_declaration))]]; + Grammar.Entry.obj + (class_fun_binding : 'class_fun_binding Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (cfb : 'class_fun_binding) (p : 'ipatt) (loc : int * int) -> + (MLast.CeFun (loc, p, cfb) : 'class_fun_binding)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], + Gramext.action + (fun (ce : 'class_expr) _ (ct : 'class_type) _ (loc : int * int) -> + (MLast.CeTyc (loc, ce, ct) : 'class_fun_binding)); + [Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], + Gramext.action + (fun (ce : 'class_expr) _ (loc : int * int) -> + (ce : 'class_fun_binding))]]; + Grammar.Entry.obj + (class_type_parameters : 'class_type_parameters Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "["); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (type_parameter : 'type_parameter Grammar.Entry.e)), + Gramext.Stoken ("", ",")); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (tpl : 'type_parameter list) _ (loc : int * int) -> + (loc, tpl : 'class_type_parameters)); + [], + Gramext.action + (fun (loc : int * int) -> (loc, [] : 'class_type_parameters))]]; + Grammar.Entry.obj (class_fun_def : 'class_fun_def Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "->"); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], + Gramext.action + (fun (ce : 'class_expr) _ (loc : int * int) -> (ce : 'class_fun_def)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (ce : 'class_fun_def) (p : 'ipatt) (loc : int * int) -> + (MLast.CeFun (loc, p, ce) : 'class_fun_def))]]; + Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), None, + [Some "top", None, + [[Gramext.Stoken ("", "let"); Gramext.Sopt (Gramext.Stoken ("", "rec")); + Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and")); + Gramext.Stoken ("", "in"); Gramext.Sself], + Gramext.action + (fun (ce : 'class_expr) _ (lb : 'let_binding list) + (rf : string option) _ (loc : int * int) -> + (MLast.CeLet (loc, o2b rf, lb, ce) : 'class_expr)); + [Gramext.Stoken ("", "fun"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (class_fun_def : 'class_fun_def Grammar.Entry.e))], + Gramext.action + (fun (ce : 'class_fun_def) (p : 'ipatt) _ (loc : int * int) -> + (MLast.CeFun (loc, p, ce) : 'class_expr))]; + Some "apply", Some Gramext.NonA, + [[Gramext.Sself; + Gramext.Snterml + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), "label")], + Gramext.action + (fun (e : 'expr) (ce : 'class_expr) (loc : int * int) -> + (MLast.CeApp (loc, ce, e) : 'class_expr))]; + Some "simple", None, + [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (ce : 'class_expr) _ (loc : int * int) -> (ce : 'class_expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (ct : 'class_type) _ (ce : 'class_expr) _ (loc : int * int) -> + (MLast.CeTyc (loc, ce, ct) : 'class_expr)); + [Gramext.Stoken ("", "object"); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj + (class_self_patt : 'class_self_patt Grammar.Entry.e))); + Gramext.Snterm + (Grammar.Entry.obj + (class_structure : 'class_structure Grammar.Entry.e)); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (cf : 'class_structure) (cspo : 'class_self_patt option) _ + (loc : int * int) -> + (MLast.CeStr (loc, cspo, cf) : 'class_expr)); + [Gramext.Snterm + (Grammar.Entry.obj + (class_longident : 'class_longident Grammar.Entry.e))], + Gramext.action + (fun (ci : 'class_longident) (loc : int * int) -> + (MLast.CeCon (loc, ci, []) : 'class_expr)); + [Gramext.Snterm + (Grammar.Entry.obj + (class_longident : 'class_longident Grammar.Entry.e)); + Gramext.Stoken ("", "["); + Gramext.Slist0sep + (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", ",")); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (ctcl : 'ctyp list) _ (ci : 'class_longident) + (loc : int * int) -> + (MLast.CeCon (loc, ci, ctcl) : 'class_expr))]]; + Grammar.Entry.obj (class_structure : 'class_structure Grammar.Entry.e), + None, + [None, None, + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_str_item : 'class_str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (cf : 'class_str_item) (loc : int * int) -> + (cf : 'e__6))])], + Gramext.action + (fun (cf : 'e__6 list) (loc : int * int) -> + (cf : 'class_structure))]]; + Grammar.Entry.obj (class_self_patt : 'class_self_patt Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) -> + (MLast.PaTyc (loc, p, t) : 'class_self_patt)); + [Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'class_self_patt))]]; + Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "initializer"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (se : 'expr) _ (loc : int * int) -> + (MLast.CrIni (loc, se) : 'class_str_item)); + [Gramext.Stoken ("", "type"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> + (MLast.CrCtr (loc, t1, t2) : 'class_str_item)); + [Gramext.Stoken ("", "method"); + Gramext.Sopt (Gramext.Stoken ("", "private")); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (polyt : 'polyt Grammar.Entry.e))); + Gramext.Snterm + (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'fun_binding) (topt : 'polyt option) (l : 'label) + (pf : string option) _ (loc : int * int) -> + (MLast.CrMth (loc, l, o2b pf, e, topt) : 'class_str_item)); + [Gramext.Stoken ("", "method"); Gramext.Stoken ("", "virtual"); + Gramext.Sopt (Gramext.Stoken ("", "private")); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (pf : string option) _ _ + (loc : int * int) -> + (MLast.CrVir (loc, l, o2b pf, t) : 'class_str_item)); + [Gramext.Stoken ("", "value"); + Gramext.Sopt (Gramext.Stoken ("", "mutable")); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (cvalue_binding : 'cvalue_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'cvalue_binding) (lab : 'label) (mf : string option) _ + (loc : int * int) -> + (MLast.CrVal (loc, lab, o2b mf, e) : 'class_str_item)); + [Gramext.Stoken ("", "inherit"); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e)); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (as_lident : 'as_lident Grammar.Entry.e)))], + Gramext.action + (fun (pb : 'as_lident option) (ce : 'class_expr) _ + (loc : int * int) -> + (MLast.CrInh (loc, ce, pb) : 'class_str_item)); + [Gramext.Stoken ("", "declare"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_str_item : 'class_str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'class_str_item) (loc : int * int) -> + (s : 'e__7))]); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'e__7 list) _ (loc : int * int) -> + (MLast.CrDcl (loc, st) : 'class_str_item))]]; + Grammar.Entry.obj (as_lident : 'as_lident Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "as"); Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) _ (loc : int * int) -> (i : 'as_lident))]]; + Grammar.Entry.obj (polyt : 'polyt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action (fun (t : 'ctyp) _ (loc : int * int) -> (t : 'polyt))]]; + Grammar.Entry.obj (cvalue_binding : 'cvalue_binding Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", ":>"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> + (MLast.ExCoe (loc, e, None, t) : 'cvalue_binding)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ":>"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (t2 : 'ctyp) _ (t : 'ctyp) _ (loc : int * int) -> + (MLast.ExCoe (loc, e, Some t, t2) : 'cvalue_binding)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> + (MLast.ExTyc (loc, e, t) : 'cvalue_binding)); + [Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (e : 'cvalue_binding))]]; + Grammar.Entry.obj (label : 'label Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("LIDENT", "")], + Gramext.action (fun (i : string) (loc : int * int) -> (i : 'label))]]; + Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "object"); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj + (class_self_type : 'class_self_type Grammar.Entry.e))); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_sig_item : 'class_sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (csf : 'class_sig_item) (loc : int * int) -> + (csf : 'e__8))]); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (csf : 'e__8 list) (cst : 'class_self_type option) _ + (loc : int * int) -> + (MLast.CtSig (loc, cst, csf) : 'class_type)); + [Gramext.Snterm + (Grammar.Entry.obj + (clty_longident : 'clty_longident Grammar.Entry.e))], + Gramext.action + (fun (id : 'clty_longident) (loc : int * int) -> + (MLast.CtCon (loc, id, []) : 'class_type)); + [Gramext.Snterm + (Grammar.Entry.obj + (clty_longident : 'clty_longident Grammar.Entry.e)); + Gramext.Stoken ("", "["); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", ",")); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (tl : 'ctyp list) _ (id : 'clty_longident) (loc : int * int) -> + (MLast.CtCon (loc, id, tl) : 'class_type)); + [Gramext.Stoken ("", "["); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "]"); Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (ct : 'class_type) _ _ (t : 'ctyp) _ (loc : int * int) -> + (MLast.CtFun (loc, t, ct) : 'class_type))]]; + Grammar.Entry.obj (class_self_type : 'class_self_type Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'class_self_type))]]; + Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "type"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> + (MLast.CgCtr (loc, t1, t2) : 'class_sig_item)); + [Gramext.Stoken ("", "method"); + Gramext.Sopt (Gramext.Stoken ("", "private")); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (pf : string option) _ + (loc : int * int) -> + (MLast.CgMth (loc, l, o2b pf, t) : 'class_sig_item)); + [Gramext.Stoken ("", "method"); Gramext.Stoken ("", "virtual"); + Gramext.Sopt (Gramext.Stoken ("", "private")); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (pf : string option) _ _ + (loc : int * int) -> + (MLast.CgVir (loc, l, o2b pf, t) : 'class_sig_item)); + [Gramext.Stoken ("", "value"); + Gramext.Sopt (Gramext.Stoken ("", "mutable")); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (mf : string option) _ + (loc : int * int) -> + (MLast.CgVal (loc, l, o2b mf, t) : 'class_sig_item)); + [Gramext.Stoken ("", "inherit"); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], + Gramext.action + (fun (cs : 'class_type) _ (loc : int * int) -> + (MLast.CgInh (loc, cs) : 'class_sig_item)); + [Gramext.Stoken ("", "declare"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_sig_item : 'class_sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'class_sig_item) (loc : int * int) -> + (s : 'e__9))]); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'e__9 list) _ (loc : int * int) -> + (MLast.CgDcl (loc, st) : 'class_sig_item))]]; + Grammar.Entry.obj + (class_description : 'class_description Grammar.Entry.e), + None, + [None, None, + [[Gramext.Sopt (Gramext.Stoken ("", "virtual")); + Gramext.Stoken ("LIDENT", ""); + Gramext.Snterm + (Grammar.Entry.obj + (class_type_parameters : 'class_type_parameters Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], + Gramext.action + (fun (ct : 'class_type) _ (ctp : 'class_type_parameters) (n : string) + (vf : string option) (loc : int * int) -> + ({MLast.ciLoc = loc; MLast.ciVir = o2b vf; MLast.ciPrm = ctp; + MLast.ciNam = n; MLast.ciExp = ct} : + 'class_description))]]; + Grammar.Entry.obj + (class_type_declaration : 'class_type_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Sopt (Gramext.Stoken ("", "virtual")); + Gramext.Stoken ("LIDENT", ""); + Gramext.Snterm + (Grammar.Entry.obj + (class_type_parameters : 'class_type_parameters Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], + Gramext.action + (fun (cs : 'class_type) _ (ctp : 'class_type_parameters) (n : string) + (vf : string option) (loc : int * int) -> + ({MLast.ciLoc = loc; MLast.ciVir = o2b vf; MLast.ciPrm = ctp; + MLast.ciNam = n; MLast.ciExp = cs} : + 'class_type_declaration))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "apply"), + [None, Some Gramext.LeftA, + [[Gramext.Stoken ("", "new"); + Gramext.Snterm + (Grammar.Entry.obj + (class_longident : 'class_longident Grammar.Entry.e))], + Gramext.action + (fun (i : 'class_longident) _ (loc : int * int) -> + (MLast.ExNew (loc, i) : 'expr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "."), + [None, None, + [[Gramext.Sself; Gramext.Stoken ("", "#"); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e))], + Gramext.action + (fun (lab : 'label) _ (e : 'expr) (loc : int * int) -> + (MLast.ExSnd (loc, e, lab) : 'expr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "{<"); + Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (field_expr : 'field_expr Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Stoken ("", ">}")], + Gramext.action + (fun _ (fel : 'field_expr list) _ (loc : int * int) -> + (MLast.ExOvr (loc, fel) : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":>"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExCoe (loc, e, None, t) : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ":>"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t2 : 'ctyp) _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExCoe (loc, e, Some t, t2) : 'expr))]]; + Grammar.Entry.obj (field_expr : 'field_expr Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (l : 'label) (loc : int * int) -> + (l, e : 'field_expr))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "<"); + Gramext.Slist0sep + (Gramext.Snterm (Grammar.Entry.obj (field : 'field Grammar.Entry.e)), + Gramext.Stoken ("", ";")); + Gramext.Sopt (Gramext.Stoken ("", "..")); Gramext.Stoken ("", ">")], + Gramext.action + (fun _ (v : string option) (ml : 'field list) _ (loc : int * int) -> + (MLast.TyObj (loc, ml, o2b v) : 'ctyp)); + [Gramext.Stoken ("", "#"); + Gramext.Snterm + (Grammar.Entry.obj + (class_longident : 'class_longident Grammar.Entry.e))], + Gramext.action + (fun (id : 'class_longident) _ (loc : int * int) -> + (MLast.TyCls (loc, id) : 'ctyp))]]; + Grammar.Entry.obj (field : 'field Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("LIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (lab : string) (loc : int * int) -> + (lab, t : 'field))]]; + Grammar.Entry.obj (typevar : 'typevar Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> (i : 'typevar))]]; + Grammar.Entry.obj (clty_longident : 'clty_longident Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> ([i] : 'clty_longident)); + [Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "."); + Gramext.Sself], + Gramext.action + (fun (l : 'clty_longident) _ (m : string) (loc : int * int) -> + (m :: l : 'clty_longident))]]; + Grammar.Entry.obj (class_longident : 'class_longident Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> ([i] : 'class_longident)); + [Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "."); + Gramext.Sself], + Gramext.action + (fun (l : 'class_longident) _ (m : string) (loc : int * int) -> + (m :: l : 'class_longident))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.After "arrow"), + [None, Some Gramext.NonA, + [[Gramext.Stoken ("OPTLABEL", ""); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) (i : string) (loc : int * int) -> + (MLast.TyOlb (loc, i, t) : 'ctyp)); + [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (i : string) (loc : int * int) -> + (MLast.TyOlb (loc, i, t) : 'ctyp)); + [Gramext.Stoken ("LABEL", ""); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) (i : string) (loc : int * int) -> + (MLast.TyLab (loc, i, t) : 'ctyp)); + [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (i : string) (loc : int * int) -> + (MLast.TyLab (loc, i, t) : 'ctyp))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", ">"); + Gramext.Slist1 + (Gramext.Snterm + (Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e))); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (ntl : 'name_tag list) _ (rfl : 'row_field_list) _ _ + (loc : int * int) -> + (MLast.TyVrn (loc, rfl, Some (Some ntl)) : 'ctyp)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> + (MLast.TyVrn (loc, rfl, Some (Some [])) : 'ctyp)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", ">"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> + (MLast.TyVrn (loc, rfl, Some None) : 'ctyp)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> + (MLast.TyVrn (loc, rfl, None) : 'ctyp))]]; + Grammar.Entry.obj (row_field_list : 'row_field_list Grammar.Entry.e), + None, + [None, None, + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e)), + Gramext.Stoken ("", "|"))], + Gramext.action + (fun (rfl : 'row_field list) (loc : int * int) -> + (rfl : 'row_field_list))]]; + Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) (loc : int * int) -> (MLast.RfInh t : 'row_field)); + [Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e)); + Gramext.Stoken ("", "of"); Gramext.Sopt (Gramext.Stoken ("", "&")); + Gramext.Slist1sep + (Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", "&"))], + Gramext.action + (fun (l : 'ctyp list) (ao : string option) _ (i : 'ident) _ + (loc : int * int) -> + (MLast.RfTag (i, o2b ao, l) : 'row_field)); + [Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> + (MLast.RfTag (i, true, []) : 'row_field))]]; + Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> (i : 'name_tag))]]; + Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "?"); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'eq_expr option) (p : 'patt_tcon) _ _ + (loc : int * int) -> + (MLast.PaOlb (loc, "", Some (p, eo)) : 'patt)); + [Gramext.Stoken ("QUESTIONIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.PaOlb (loc, i, None) : 'patt)); + [Gramext.Stoken ("OPTLABEL", ""); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'eq_expr option) (p : 'patt_tcon) _ (i : string) + (loc : int * int) -> + (MLast.PaOlb (loc, i, Some (p, eo)) : 'patt)); + [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'eq_expr option) (p : 'patt_tcon) _ _ (i : string) + (loc : int * int) -> + (MLast.PaOlb (loc, i, Some (p, eo)) : 'patt)); + [Gramext.Stoken ("TILDEIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.PaLab (loc, i, None) : 'patt)); + [Gramext.Stoken ("LABEL", ""); Gramext.Sself], + Gramext.action + (fun (p : 'patt) (i : string) (loc : int * int) -> + (MLast.PaLab (loc, i, Some p) : 'patt)); + [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sself], + Gramext.action + (fun (p : 'patt) _ (i : string) (loc : int * int) -> + (MLast.PaLab (loc, i, Some p) : 'patt)); + [Gramext.Stoken ("", "#"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], + Gramext.action + (fun (sl : 'mod_ident) _ (loc : int * int) -> + (MLast.PaTyp (loc, sl) : 'patt)); + [Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (s : 'ident) _ (loc : int * int) -> + (MLast.PaVrn (loc, s) : 'patt))]]; + Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], + Gramext.action (fun (p : 'patt) (loc : int * int) -> (p : 'patt_tcon)); + [Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (p : 'patt) (loc : int * int) -> + (MLast.PaTyc (loc, p, t) : 'patt_tcon))]]; + Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "?"); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'eq_expr option) (p : 'ipatt_tcon) _ _ + (loc : int * int) -> + (MLast.PaOlb (loc, "", Some (p, eo)) : 'ipatt)); + [Gramext.Stoken ("QUESTIONIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.PaOlb (loc, i, None) : 'ipatt)); + [Gramext.Stoken ("OPTLABEL", ""); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'eq_expr option) (p : 'ipatt_tcon) _ (i : string) + (loc : int * int) -> + (MLast.PaOlb (loc, i, Some (p, eo)) : 'ipatt)); + [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); + Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e))); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'eq_expr option) (p : 'ipatt_tcon) _ _ (i : string) + (loc : int * int) -> + (MLast.PaOlb (loc, i, Some (p, eo)) : 'ipatt)); + [Gramext.Stoken ("TILDEIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.PaLab (loc, i, None) : 'ipatt)); + [Gramext.Stoken ("LABEL", ""); Gramext.Sself], + Gramext.action + (fun (p : 'ipatt) (i : string) (loc : int * int) -> + (MLast.PaLab (loc, i, Some p) : 'ipatt)); + [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sself], + Gramext.action + (fun (p : 'ipatt) _ (i : string) (loc : int * int) -> + (MLast.PaLab (loc, i, Some p) : 'ipatt))]]; + Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e))], + Gramext.action + (fun (p : 'ipatt) (loc : int * int) -> (p : 'ipatt_tcon)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (p : 'ipatt) (loc : int * int) -> + (MLast.PaTyc (loc, p, t) : 'ipatt_tcon))]]; + Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (e : 'eq_expr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.After "apply"), + [Some "label", Some Gramext.NonA, + [[Gramext.Stoken ("QUESTIONIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.ExOlb (loc, i, None) : 'expr)); + [Gramext.Stoken ("OPTLABEL", ""); Gramext.Sself], + Gramext.action + (fun (e : 'expr) (i : string) (loc : int * int) -> + (MLast.ExOlb (loc, i, Some e) : 'expr)); + [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (i : string) (loc : int * int) -> + (MLast.ExOlb (loc, i, Some e) : 'expr)); + [Gramext.Stoken ("TILDEIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> + (MLast.ExLab (loc, i, None) : 'expr)); + [Gramext.Stoken ("LABEL", ""); Gramext.Sself], + Gramext.action + (fun (e : 'expr) (i : string) (loc : int * int) -> + (MLast.ExLab (loc, i, Some e) : 'expr)); + [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (i : string) (loc : int * int) -> + (MLast.ExLab (loc, i, Some e) : 'expr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (s : 'ident) _ (loc : int * int) -> + (MLast.ExVrn (loc, s) : 'expr))]]; + Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "downto")], + Gramext.action (fun _ (loc : int * int) -> (false : 'direction_flag)); + [Gramext.Stoken ("", "to")], + Gramext.action (fun _ (loc : int * int) -> (true : 'direction_flag))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "[|"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_variant : 'warning_variant Grammar.Entry.e)); + Gramext.Stoken ("", "<"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", ">"); + Gramext.Slist1 + (Gramext.Snterm + (Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e))); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (ntl : 'name_tag list) _ (rfl : 'row_field_list) _ _ _ + (loc : int * int) -> + (MLast.TyVrn (loc, rfl, Some (Some ntl)) : 'ctyp)); + [Gramext.Stoken ("", "[|"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_variant : 'warning_variant Grammar.Entry.e)); + Gramext.Stoken ("", "<"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ _ (loc : int * int) -> + (MLast.TyVrn (loc, rfl, Some (Some [])) : 'ctyp)); + [Gramext.Stoken ("", "[|"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_variant : 'warning_variant Grammar.Entry.e)); + Gramext.Stoken ("", ">"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ _ (loc : int * int) -> + (MLast.TyVrn (loc, rfl, Some None) : 'ctyp)); + [Gramext.Stoken ("", "[|"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_variant : 'warning_variant Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> + (MLast.TyVrn (loc, rfl, None) : 'ctyp))]]; + Grammar.Entry.obj (warning_variant : 'warning_variant Grammar.Entry.e), + None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> (warn_variant loc : 'warning_variant))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "top"), + [None, None, + [[Gramext.Stoken ("", "while"); Gramext.Sself; Gramext.Stoken ("", "do"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__12))]); + Gramext.Snterm + (Grammar.Entry.obj + (warning_sequence : 'warning_sequence Grammar.Entry.e)); + Gramext.Stoken ("", "done")], + Gramext.action + (fun _ _ (seq : 'e__12 list) _ (e : 'expr) _ (loc : int * int) -> + (MLast.ExWhi (loc, e, seq) : 'expr)); + [Gramext.Stoken ("", "for"); Gramext.Stoken ("LIDENT", ""); + Gramext.Stoken ("", "="); Gramext.Sself; + Gramext.Snterm + (Grammar.Entry.obj + (direction_flag : 'direction_flag Grammar.Entry.e)); + Gramext.Sself; Gramext.Stoken ("", "do"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__11))]); + Gramext.Snterm + (Grammar.Entry.obj + (warning_sequence : 'warning_sequence Grammar.Entry.e)); + Gramext.Stoken ("", "done")], + Gramext.action + (fun _ _ (seq : 'e__11 list) _ (e2 : 'expr) (df : 'direction_flag) + (e1 : 'expr) _ (i : string) _ (loc : int * int) -> + (MLast.ExFor (loc, i, e1, e2, df, seq) : 'expr)); + [Gramext.Stoken ("", "do"); + Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__10))]); + Gramext.Stoken ("", "return"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_sequence : 'warning_sequence Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ _ (seq : 'e__10 list) _ (loc : int * int) -> + (MLast.ExSeq (loc, append_elem seq e) : 'expr))]]; + Grammar.Entry.obj (warning_sequence : 'warning_sequence Grammar.Entry.e), + None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> + (warn_sequence loc : 'warning_sequence))]]]);; -let _ = - Grammar.extend - (let _ = (interf : 'interf Grammar.Entry.e) - and _ = (implem : 'implem Grammar.Entry.e) - and _ = (use_file : 'use_file Grammar.Entry.e) - and _ = (top_phrase : 'top_phrase Grammar.Entry.e) - and _ = (expr : 'expr Grammar.Entry.e) - and _ = (patt : 'patt Grammar.Entry.e) in - let grammar_entry_create s = - Grammar.Entry.create (Grammar.of_entry interf) s - in - let sig_item_semi : 'sig_item_semi Grammar.Entry.e = - grammar_entry_create "sig_item_semi" - and str_item_semi : 'str_item_semi Grammar.Entry.e = - grammar_entry_create "str_item_semi" - and phrase : 'phrase Grammar.Entry.e = grammar_entry_create "phrase" in - [Grammar.Entry.obj (interf : 'interf Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("EOI", "")], - Gramext.action (fun _ (loc : int * int) -> ([], false : 'interf)); - [Gramext.Snterm - (Grammar.Entry.obj - (sig_item_semi : 'sig_item_semi Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (sil, stopped : 'interf) (si : 'sig_item_semi) - (loc : int * int) -> - (si :: sil, stopped : 'interf)); - [Gramext.Stoken ("", "#"); Gramext.Stoken ("LIDENT", ""); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (dp : 'expr option) (n : string) _ (loc : int * int) -> - ([MLast.SgDir (loc, n, dp), loc], true : 'interf))]]; - Grammar.Entry.obj (sig_item_semi : 'sig_item_semi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (si : 'sig_item) (loc : int * int) -> - (si, loc : 'sig_item_semi))]]; - Grammar.Entry.obj (implem : 'implem Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("EOI", "")], - Gramext.action (fun _ (loc : int * int) -> ([], false : 'implem)); - [Gramext.Snterm - (Grammar.Entry.obj - (str_item_semi : 'str_item_semi Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (sil, stopped : 'implem) (si : 'str_item_semi) - (loc : int * int) -> - (si :: sil, stopped : 'implem)); - [Gramext.Stoken ("", "#"); Gramext.Stoken ("LIDENT", ""); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (dp : 'expr option) (n : string) _ (loc : int * int) -> - ([MLast.StDir (loc, n, dp), loc], true : 'implem))]]; - Grammar.Entry.obj (str_item_semi : 'str_item_semi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (si : 'str_item) (loc : int * int) -> - (si, loc : 'str_item_semi))]]; - Grammar.Entry.obj (top_phrase : 'top_phrase Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("EOI", "")], - Gramext.action (fun _ (loc : int * int) -> (None : 'top_phrase)); - [Gramext.Snterm - (Grammar.Entry.obj (phrase : 'phrase Grammar.Entry.e))], - Gramext.action - (fun (ph : 'phrase) (loc : int * int) -> (Some ph : 'top_phrase))]]; - Grammar.Entry.obj (use_file : 'use_file Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("EOI", "")], - Gramext.action (fun _ (loc : int * int) -> ([], false : 'use_file)); - [Gramext.Snterm - (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";"); Gramext.Sself], - Gramext.action - (fun (sil, stopped : 'use_file) _ (si : 'str_item) - (loc : int * int) -> - (si :: sil, stopped : 'use_file)); - [Gramext.Stoken ("", "#"); Gramext.Stoken ("LIDENT", ""); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (dp : 'expr option) (n : string) _ (loc : int * int) -> - ([MLast.StDir (loc, n, dp)], true : 'use_file))]]; - Grammar.Entry.obj (phrase : 'phrase Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (sti : 'str_item) (loc : int * int) -> (sti : 'phrase)); - [Gramext.Stoken ("", "#"); Gramext.Stoken ("LIDENT", ""); - Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (dp : 'expr option) (n : string) _ (loc : int * int) -> - (MLast.StDir (loc, n, dp) : 'phrase))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("QUOTATION", "")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (let x = - try - let i = String.index x ':' in - String.sub x 0 i, - String.sub x (i + 1) (String.length x - i - 1) - with - Not_found -> "", x - in - Pcaml.handle_expr_quotation loc x : - 'expr)); - [Gramext.Stoken ("LOCATE", "")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (let x = - try - let i = String.index x ':' in - int_of_string (String.sub x 0 i), - String.sub x (i + 1) (String.length x - i - 1) - with - Not_found | Failure _ -> 0, x - in - Pcaml.handle_expr_locate loc x : - 'expr))]]; - Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("QUOTATION", "")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (let x = - try - let i = String.index x ':' in - String.sub x 0 i, - String.sub x (i + 1) (String.length x - i - 1) - with - Not_found -> "", x - in - Pcaml.handle_patt_quotation loc x : - 'patt)); - [Gramext.Stoken ("LOCATE", "")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (let x = - try - let i = String.index x ':' in - int_of_string (String.sub x 0 i), - String.sub x (i + 1) (String.length x - i - 1) - with - Not_found | Failure _ -> 0, x - in - Pcaml.handle_patt_locate loc x : - 'patt))]]]) +Grammar.extend + (let _ = (interf : 'interf Grammar.Entry.e) + and _ = (implem : 'implem Grammar.Entry.e) + and _ = (use_file : 'use_file Grammar.Entry.e) + and _ = (top_phrase : 'top_phrase Grammar.Entry.e) + and _ = (expr : 'expr Grammar.Entry.e) + and _ = (patt : 'patt Grammar.Entry.e) in + let grammar_entry_create s = + Grammar.Entry.create (Grammar.of_entry interf) s + in + let sig_item_semi : 'sig_item_semi Grammar.Entry.e = + grammar_entry_create "sig_item_semi" + and str_item_semi : 'str_item_semi Grammar.Entry.e = + grammar_entry_create "str_item_semi" + and phrase : 'phrase Grammar.Entry.e = grammar_entry_create "phrase" in + [Grammar.Entry.obj (interf : 'interf Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("EOI", "")], + Gramext.action (fun _ (loc : int * int) -> ([], false : 'interf)); + [Gramext.Snterm + (Grammar.Entry.obj (sig_item_semi : 'sig_item_semi Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (sil, stopped : 'interf) (si : 'sig_item_semi) + (loc : int * int) -> + (si :: sil, stopped : 'interf)); + [Gramext.Stoken ("", "#"); Gramext.Stoken ("LIDENT", ""); + Gramext.Sopt + (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (dp : 'expr option) (n : string) _ (loc : int * int) -> + ([MLast.SgDir (loc, n, dp), loc], true : 'interf))]]; + Grammar.Entry.obj (sig_item_semi : 'sig_item_semi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (si : 'sig_item) (loc : int * int) -> + (si, loc : 'sig_item_semi))]]; + Grammar.Entry.obj (implem : 'implem Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("EOI", "")], + Gramext.action (fun _ (loc : int * int) -> ([], false : 'implem)); + [Gramext.Snterm + (Grammar.Entry.obj (str_item_semi : 'str_item_semi Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (sil, stopped : 'implem) (si : 'str_item_semi) + (loc : int * int) -> + (si :: sil, stopped : 'implem)); + [Gramext.Stoken ("", "#"); Gramext.Stoken ("LIDENT", ""); + Gramext.Sopt + (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (dp : 'expr option) (n : string) _ (loc : int * int) -> + ([MLast.StDir (loc, n, dp), loc], true : 'implem))]]; + Grammar.Entry.obj (str_item_semi : 'str_item_semi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (si : 'str_item) (loc : int * int) -> + (si, loc : 'str_item_semi))]]; + Grammar.Entry.obj (top_phrase : 'top_phrase Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("EOI", "")], + Gramext.action (fun _ (loc : int * int) -> (None : 'top_phrase)); + [Gramext.Snterm (Grammar.Entry.obj (phrase : 'phrase Grammar.Entry.e))], + Gramext.action + (fun (ph : 'phrase) (loc : int * int) -> (Some ph : 'top_phrase))]]; + Grammar.Entry.obj (use_file : 'use_file Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("EOI", "")], + Gramext.action (fun _ (loc : int * int) -> ([], false : 'use_file)); + [Gramext.Snterm + (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";"); Gramext.Sself], + Gramext.action + (fun (sil, stopped : 'use_file) _ (si : 'str_item) + (loc : int * int) -> + (si :: sil, stopped : 'use_file)); + [Gramext.Stoken ("", "#"); Gramext.Stoken ("LIDENT", ""); + Gramext.Sopt + (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (dp : 'expr option) (n : string) _ (loc : int * int) -> + ([MLast.StDir (loc, n, dp)], true : 'use_file))]]; + Grammar.Entry.obj (phrase : 'phrase Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (sti : 'str_item) (loc : int * int) -> (sti : 'phrase)); + [Gramext.Stoken ("", "#"); Gramext.Stoken ("LIDENT", ""); + Gramext.Sopt + (Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (dp : 'expr option) (n : string) _ (loc : int * int) -> + (MLast.StDir (loc, n, dp) : 'phrase))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("QUOTATION", "")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (let x = + try + let i = String.index x ':' in + String.sub x 0 i, + String.sub x (i + 1) (String.length x - i - 1) + with + Not_found -> "", x + in + Pcaml.handle_expr_quotation loc x : + 'expr)); + [Gramext.Stoken ("LOCATE", "")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (let x = + try + let i = String.index x ':' in + int_of_string (String.sub x 0 i), + String.sub x (i + 1) (String.length x - i - 1) + with + Not_found | Failure _ -> 0, x + in + Pcaml.handle_expr_locate loc x : + 'expr))]]; + Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("QUOTATION", "")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (let x = + try + let i = String.index x ':' in + String.sub x 0 i, + String.sub x (i + 1) (String.length x - i - 1) + with + Not_found -> "", x + in + Pcaml.handle_patt_quotation loc x : + 'patt)); + [Gramext.Stoken ("LOCATE", "")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (let x = + try + let i = String.index x ':' in + int_of_string (String.sub x 0 i), + String.sub x (i + 1) (String.length x - i - 1) + with + Not_found | Failure _ -> 0, x + in + Pcaml.handle_patt_locate loc x : + 'patt))]]]);; diff --git a/camlp4/ocaml_src/meta/q_MLast.ml b/camlp4/ocaml_src/meta/q_MLast.ml index 07002367..f1a1d85c 100644 --- a/camlp4/ocaml_src/meta/q_MLast.ml +++ b/camlp4/ocaml_src/meta/q_MLast.ml @@ -10,9 +10,9 @@ (* *) (***********************************************************************) -(* $Id: q_MLast.ml,v 1.55 2003/07/16 12:50:10 mauny Exp $ *) +(* This file has been generated by program: do not edit! *) -let gram = Grammar.gcreate (Plexer.gmake ()) +let gram = Grammar.gcreate (Plexer.gmake ());; module Qast = struct @@ -29,7 +29,8 @@ module Qast = | Record of (string * t) list | Loc | Antiquot of MLast.loc * string - let loc = 0, 0 + ;; + let loc = 0, 0;; let rec to_expr = function Node (n, al) -> @@ -71,6 +72,7 @@ module Qast = and to_expr_label (l, a) = MLast.PaAcc (loc, MLast.PaUid (loc, "MLast"), MLast.PaLid (loc, l)), to_expr a + ;; let rec to_patt = function Node (n, al) -> @@ -110,7 +112,9 @@ module Qast = and to_patt_label (l, a) = MLast.PaAcc (loc, MLast.PaUid (loc, "MLast"), MLast.PaLid (loc, l)), to_patt a + ;; end +;; let antiquot k (bp, ep) x = let shift = @@ -118,48 +122,51 @@ let antiquot k (bp, ep) x = else String.length "$" + String.length k + String.length ":" in Qast.Antiquot ((shift + bp, shift + ep), x) +;; -let sig_item = Grammar.Entry.create gram "signature item" -let str_item = Grammar.Entry.create gram "structure item" -let ctyp = Grammar.Entry.create gram "type" -let patt = Grammar.Entry.create gram "pattern" -let expr = Grammar.Entry.create gram "expression" +let sig_item = Grammar.Entry.create gram "signature item";; +let str_item = Grammar.Entry.create gram "structure item";; +let ctyp = Grammar.Entry.create gram "type";; +let patt = Grammar.Entry.create gram "pattern";; +let expr = Grammar.Entry.create gram "expression";; -let module_type = Grammar.Entry.create gram "module type" -let module_expr = Grammar.Entry.create gram "module expression" +let module_type = Grammar.Entry.create gram "module type";; +let module_expr = Grammar.Entry.create gram "module expression";; -let class_type = Grammar.Entry.create gram "class type" -let class_expr = Grammar.Entry.create gram "class expr" -let class_sig_item = Grammar.Entry.create gram "class signature item" -let class_str_item = Grammar.Entry.create gram "class structure item" +let class_type = Grammar.Entry.create gram "class type";; +let class_expr = Grammar.Entry.create gram "class expr";; +let class_sig_item = Grammar.Entry.create gram "class signature item";; +let class_str_item = Grammar.Entry.create gram "class structure item";; -let ipatt = Grammar.Entry.create gram "ipatt" -let let_binding = Grammar.Entry.create gram "let_binding" -let type_declaration = Grammar.Entry.create gram "type_declaration" -let with_constr = Grammar.Entry.create gram "with_constr" -let row_field = Grammar.Entry.create gram "row_field" +let ipatt = Grammar.Entry.create gram "ipatt";; +let let_binding = Grammar.Entry.create gram "let_binding";; +let type_declaration = Grammar.Entry.create gram "type_declaration";; +let with_constr = Grammar.Entry.create gram "with_constr";; +let row_field = Grammar.Entry.create gram "row_field";; -let a_list = Grammar.Entry.create gram "a_list" -let a_opt = Grammar.Entry.create gram "a_opt" -let a_UIDENT = Grammar.Entry.create gram "a_UIDENT" -let a_LIDENT = Grammar.Entry.create gram "a_LIDENT" -let a_INT = Grammar.Entry.create gram "a_INT" -let a_FLOAT = Grammar.Entry.create gram "a_FLOAT" -let a_STRING = Grammar.Entry.create gram "a_STRING" -let a_CHAR = Grammar.Entry.create gram "a_CHAR" -let a_TILDEIDENT = Grammar.Entry.create gram "a_TILDEIDENT" -let a_QUESTIONIDENT = Grammar.Entry.create gram "a_QUESTIONIDENT" +let a_list = Grammar.Entry.create gram "a_list";; +let a_opt = Grammar.Entry.create gram "a_opt";; +let a_UIDENT = Grammar.Entry.create gram "a_UIDENT";; +let a_LIDENT = Grammar.Entry.create gram "a_LIDENT";; +let a_INT = Grammar.Entry.create gram "a_INT";; +let a_FLOAT = Grammar.Entry.create gram "a_FLOAT";; +let a_STRING = Grammar.Entry.create gram "a_STRING";; +let a_CHAR = Grammar.Entry.create gram "a_CHAR";; +let a_TILDEIDENT = Grammar.Entry.create gram "a_TILDEIDENT";; +let a_QUESTIONIDENT = Grammar.Entry.create gram "a_QUESTIONIDENT";; let o2b = function Qast.Option (Some _) -> Qast.Bool true | Qast.Option None -> Qast.Bool false | x -> x +;; let mksequence _ = function Qast.List [e] -> e | el -> Qast.Node ("ExSeq", [Qast.Loc; el]) +;; let mkmatchcase _ p aso w e = let p = @@ -169,10 +176,12 @@ let mkmatchcase _ p aso w e = | _ -> Qast.Node ("PaAli", [Qast.Loc; p; aso]) in Qast.Tuple [p; w; e] +;; let neg_string n = let len = String.length n in if len > 0 && n.[0] = '-' then String.sub n 1 (len - 1) else "-" ^ n +;; let mkumin _ f arg = match arg with @@ -189,6 +198,7 @@ let mkumin _ f arg = ("ExApp", [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str f]); arg]) | _ -> assert false +;; let mkuminpat _ f is_int s = let s = @@ -200,6 +210,7 @@ let mkuminpat _ f is_int s = Qast.Bool true -> Qast.Node ("PaInt", [Qast.Loc; s]) | Qast.Bool false -> Qast.Node ("PaFlo", [Qast.Loc; s]) | _ -> assert false +;; let mklistexp _ last = let rec loop top = @@ -222,6 +233,7 @@ let mklistexp _ last = | a -> a in loop true +;; let mklistpat _ last = let rec loop top = @@ -244,6 +256,7 @@ let mklistpat _ last = | a -> a in loop true +;; let mkexprident loc i j = let rec loop m = @@ -253,16 +266,18 @@ let mkexprident loc i j = | e -> Qast.Node ("ExAcc", [Qast.Loc; m; e]) in loop (Qast.Node ("ExUid", [Qast.Loc; i])) j +;; let mkassert _ e = match e with Qast.Node ("ExUid", [_; Qast.Str "False"]) -> Qast.Node ("ExAsf", [Qast.Loc]) | _ -> Qast.Node ("ExAsr", [Qast.Loc; e]) +;; -let append_elem el e = Qast.Apply ("@", [el; Qast.List [e]]) +let append_elem el e = Qast.Apply ("@", [el; Qast.List [e]]);; -let not_yet_warned_antiq = ref true +let not_yet_warned_antiq = ref true;; let warn_antiq loc vers = if !not_yet_warned_antiq then begin @@ -271,8 +286,9 @@ let warn_antiq loc vers = (Printf.sprintf "use of antiquotation syntax deprecated since version %s" vers) end +;; -let not_yet_warned_variant = ref true +let not_yet_warned_variant = ref true;; let warn_variant _ = if !not_yet_warned_variant then begin @@ -281,8 +297,9 @@ let warn_variant _ = (Printf.sprintf "use of syntax of variants types deprecated since version 3.05") end +;; -let not_yet_warned_seq = ref true +let not_yet_warned_seq = ref true;; let warn_sequence _ = if !not_yet_warned_seq then begin @@ -291,4397 +308,4295 @@ let warn_sequence _ = (Printf.sprintf "use of syntax of sequences deprecated since version 3.01.1") end +;; -let _ = - Grammar.extend - (let _ = (sig_item : 'sig_item Grammar.Entry.e) - and _ = (str_item : 'str_item Grammar.Entry.e) - and _ = (ctyp : 'ctyp Grammar.Entry.e) - and _ = (patt : 'patt Grammar.Entry.e) - and _ = (expr : 'expr Grammar.Entry.e) - and _ = (module_type : 'module_type Grammar.Entry.e) - and _ = (module_expr : 'module_expr Grammar.Entry.e) - and _ = (class_type : 'class_type Grammar.Entry.e) - and _ = (class_expr : 'class_expr Grammar.Entry.e) - and _ = (class_sig_item : 'class_sig_item Grammar.Entry.e) - and _ = (class_str_item : 'class_str_item Grammar.Entry.e) - and _ = (let_binding : 'let_binding Grammar.Entry.e) - and _ = (type_declaration : 'type_declaration Grammar.Entry.e) - and _ = (ipatt : 'ipatt Grammar.Entry.e) - and _ = (with_constr : 'with_constr Grammar.Entry.e) - and _ = (row_field : 'row_field Grammar.Entry.e) in - let grammar_entry_create s = - Grammar.Entry.create (Grammar.of_entry sig_item) s - in - let rebind_exn : 'rebind_exn Grammar.Entry.e = - grammar_entry_create "rebind_exn" - and module_binding : 'module_binding Grammar.Entry.e = - grammar_entry_create "module_binding" - and module_rec_binding : 'module_rec_binding Grammar.Entry.e = - grammar_entry_create "module_rec_binding" - and module_declaration : 'module_declaration Grammar.Entry.e = - grammar_entry_create "module_declaration" - and module_rec_declaration : 'module_rec_declaration Grammar.Entry.e = - grammar_entry_create "module_rec_declaration" - and cons_expr_opt : 'cons_expr_opt Grammar.Entry.e = - grammar_entry_create "cons_expr_opt" - and dummy : 'dummy Grammar.Entry.e = grammar_entry_create "dummy" - and fun_binding : 'fun_binding Grammar.Entry.e = - grammar_entry_create "fun_binding" - and match_case : 'match_case Grammar.Entry.e = - grammar_entry_create "match_case" - and as_patt_opt : 'as_patt_opt Grammar.Entry.e = - grammar_entry_create "as_patt_opt" - and label_expr : 'label_expr Grammar.Entry.e = - grammar_entry_create "label_expr" - and fun_def : 'fun_def Grammar.Entry.e = grammar_entry_create "fun_def" - and cons_patt_opt : 'cons_patt_opt Grammar.Entry.e = - grammar_entry_create "cons_patt_opt" - and label_patt : 'label_patt Grammar.Entry.e = - grammar_entry_create "label_patt" - and label_ipatt : 'label_ipatt Grammar.Entry.e = - grammar_entry_create "label_ipatt" - and type_patt : 'type_patt Grammar.Entry.e = - grammar_entry_create "type_patt" - and constrain : 'constrain Grammar.Entry.e = - grammar_entry_create "constrain" - and type_parameter : 'type_parameter Grammar.Entry.e = - grammar_entry_create "type_parameter" - and constructor_declaration : 'constructor_declaration Grammar.Entry.e = - grammar_entry_create "constructor_declaration" - and label_declaration : 'label_declaration Grammar.Entry.e = - grammar_entry_create "label_declaration" - and ident : 'ident Grammar.Entry.e = grammar_entry_create "ident" - and class_declaration : 'class_declaration Grammar.Entry.e = - grammar_entry_create "class_declaration" - and class_fun_binding : 'class_fun_binding Grammar.Entry.e = - grammar_entry_create "class_fun_binding" - and class_type_parameters : 'class_type_parameters Grammar.Entry.e = - grammar_entry_create "class_type_parameters" - and class_fun_def : 'class_fun_def Grammar.Entry.e = - grammar_entry_create "class_fun_def" - and class_structure : 'class_structure Grammar.Entry.e = - grammar_entry_create "class_structure" - and class_self_patt : 'class_self_patt Grammar.Entry.e = - grammar_entry_create "class_self_patt" - and as_lident : 'as_lident Grammar.Entry.e = - grammar_entry_create "as_lident" - and polyt : 'polyt Grammar.Entry.e = grammar_entry_create "polyt" - and cvalue_binding : 'cvalue_binding Grammar.Entry.e = - grammar_entry_create "cvalue_binding" - and label : 'label Grammar.Entry.e = grammar_entry_create "label" - and class_self_type : 'class_self_type Grammar.Entry.e = - grammar_entry_create "class_self_type" - and class_description : 'class_description Grammar.Entry.e = - grammar_entry_create "class_description" - and class_type_declaration : 'class_type_declaration Grammar.Entry.e = - grammar_entry_create "class_type_declaration" - and field_expr : 'field_expr Grammar.Entry.e = - grammar_entry_create "field_expr" - and field : 'field Grammar.Entry.e = grammar_entry_create "field" - and typevar : 'typevar Grammar.Entry.e = grammar_entry_create "typevar" - and row_field_list : 'row_field_list Grammar.Entry.e = - grammar_entry_create "row_field_list" - and name_tag : 'name_tag Grammar.Entry.e = - grammar_entry_create "name_tag" - and patt_tcon : 'patt_tcon Grammar.Entry.e = - grammar_entry_create "patt_tcon" - and ipatt_tcon : 'ipatt_tcon Grammar.Entry.e = - grammar_entry_create "ipatt_tcon" - and eq_expr : 'eq_expr Grammar.Entry.e = grammar_entry_create "eq_expr" - and warning_variant : 'warning_variant Grammar.Entry.e = - grammar_entry_create "warning_variant" - and warning_sequence : 'warning_sequence Grammar.Entry.e = - grammar_entry_create "warning_sequence" - and sequence : 'sequence Grammar.Entry.e = - grammar_entry_create "sequence" - and expr_ident : 'expr_ident Grammar.Entry.e = - grammar_entry_create "expr_ident" - and patt_label_ident : 'patt_label_ident Grammar.Entry.e = - grammar_entry_create "patt_label_ident" - and when_expr_opt : 'when_expr_opt Grammar.Entry.e = - grammar_entry_create "when_expr_opt" - and mod_ident : 'mod_ident Grammar.Entry.e = - grammar_entry_create "mod_ident" - and clty_longident : 'clty_longident Grammar.Entry.e = - grammar_entry_create "clty_longident" - and class_longident : 'class_longident Grammar.Entry.e = - grammar_entry_create "class_longident" - and direction_flag : 'direction_flag Grammar.Entry.e = - grammar_entry_create "direction_flag" - in - [Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "struct"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (str_item : 'str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'str_item) (loc : int * int) -> - (s : 'e__1))])], - Gramext.action - (fun (a : 'e__1 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'a_list) _ (loc : int * int) -> - (Qast.Node ("MeStr", [Qast.Loc; st]) : 'module_expr)); - [Gramext.Stoken ("", "functor"); Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", ")"); Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (me : 'module_expr) _ _ (t : 'module_type) _ (i : 'a_UIDENT) _ - _ (loc : int * int) -> - (Qast.Node ("MeFun", [Qast.Loc; i; t; me]) : 'module_expr))]; - None, None, - [[Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (me2 : 'module_expr) (me1 : 'module_expr) (loc : int * int) -> - (Qast.Node ("MeApp", [Qast.Loc; me1; me2]) : 'module_expr))]; - None, None, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (me2 : 'module_expr) _ (me1 : 'module_expr) - (loc : int * int) -> - (Qast.Node ("MeAcc", [Qast.Loc; me1; me2]) : 'module_expr))]; - Some "simple", None, - [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (me : 'module_expr) _ (loc : int * int) -> - (me : 'module_expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (mt : 'module_type) _ (me : 'module_expr) _ - (loc : int * int) -> - (Qast.Node ("MeTyc", [Qast.Loc; me; mt]) : 'module_expr)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_UIDENT) (loc : int * int) -> - (Qast.Node ("MeUid", [Qast.Loc; i]) : 'module_expr))]]; - Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, - [Some "top", None, - [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) (loc : int * int) -> - (Qast.Node ("StExp", [Qast.Loc; e]) : 'str_item)); - [Gramext.Stoken ("", "value"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "rec")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__3))])], - Gramext.action - (fun (a : 'e__3 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'let_binding list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (l : 'a_list) (r : 'a_opt) _ (loc : int * int) -> - (Qast.Node ("StVal", [Qast.Loc; o2b r; l]) : 'str_item)); - [Gramext.Stoken ("", "type"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (type_declaration : 'type_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'type_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (tdl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("StTyp", [Qast.Loc; tdl]) : 'str_item)); - [Gramext.Stoken ("", "open"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'mod_ident) _ (loc : int * int) -> - (Qast.Node ("StOpn", [Qast.Loc; i]) : 'str_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "type"); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (i : 'a_UIDENT) _ _ (loc : int * int) -> - (Qast.Node ("StMty", [Qast.Loc; i; mt]) : 'str_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "rec"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (module_rec_binding : - 'module_rec_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'module_rec_binding list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (nmtmes : 'a_list) _ _ (loc : int * int) -> - (Qast.Node ("StRecMod", [Qast.Loc; nmtmes]) : 'str_item)); - [Gramext.Stoken ("", "module"); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (module_binding : 'module_binding Grammar.Entry.e))], - Gramext.action - (fun (mb : 'module_binding) (i : 'a_UIDENT) _ (loc : int * int) -> - (Qast.Node ("StMod", [Qast.Loc; i; mb]) : 'str_item)); - [Gramext.Stoken ("", "include"); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (loc : int * int) -> - (Qast.Node ("StInc", [Qast.Loc; me]) : 'str_item)); - [Gramext.Stoken ("", "external"); - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.srules - [[Gramext.Slist1 - (Gramext.Snterm - (Grammar.Entry.obj - (a_STRING : 'a_STRING Grammar.Entry.e)))], - Gramext.action - (fun (a : 'a_STRING list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (pd : 'a_list) _ (t : 'ctyp) _ (i : 'a_LIDENT) _ - (loc : int * int) -> - (Qast.Node ("StExt", [Qast.Loc; i; t; pd]) : 'str_item)); - [Gramext.Stoken ("", "exception"); - Gramext.Snterm - (Grammar.Entry.obj - (constructor_declaration : - 'constructor_declaration Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e))], - Gramext.action - (fun (b : 'rebind_exn) (ctl : 'constructor_declaration) _ - (loc : int * int) -> - (let (_, c, tl) = - match ctl with - Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3 - | _ -> - match () with - _ -> raise (Match_failure ("./meta/q_MLast.ml", 300, 19)) - in - Qast.Node ("StExc", [Qast.Loc; c; tl; b]) : - 'str_item)); - [Gramext.Stoken ("", "declare"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (str_item : 'str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'str_item) (loc : int * int) -> - (s : 'e__2))])], - Gramext.action - (fun (a : 'e__2 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'a_list) _ (loc : int * int) -> - (Qast.Node ("StDcl", [Qast.Loc; st]) : 'str_item))]]; - Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e), None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> (Qast.List [] : 'rebind_exn)); - [Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], - Gramext.action - (fun (sl : 'mod_ident) _ (loc : int * int) -> (sl : 'rebind_exn))]]; - Grammar.Entry.obj (module_binding : 'module_binding Grammar.Entry.e), - None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (loc : int * int) -> - (me : 'module_binding)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (mt : 'module_type) _ - (loc : int * int) -> - (Qast.Node ("MeTyc", [Qast.Loc; me; mt]) : 'module_binding)); - [Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", ")"); Gramext.Sself], - Gramext.action - (fun (mb : 'module_binding) _ (mt : 'module_type) _ (m : 'a_UIDENT) - _ (loc : int * int) -> - (Qast.Node ("MeFun", [Qast.Loc; m; mt; mb]) : - 'module_binding))]]; - Grammar.Entry.obj - (module_rec_binding : 'module_rec_binding Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (mt : 'module_type) _ (m : 'a_UIDENT) - (loc : int * int) -> - (Qast.Tuple [m; me; mt] : 'module_rec_binding))]]; - Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "functor"); Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself; Gramext.Stoken ("", ")"); - Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (mt : 'module_type) _ _ (t : 'module_type) _ (i : 'a_UIDENT) _ - _ (loc : int * int) -> - (Qast.Node ("MtFun", [Qast.Loc; i; t; mt]) : 'module_type))]; - None, None, - [[Gramext.Sself; Gramext.Stoken ("", "with"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (with_constr : 'with_constr Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'with_constr list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (wcl : 'a_list) _ (mt : 'module_type) (loc : int * int) -> - (Qast.Node ("MtWit", [Qast.Loc; mt; wcl]) : 'module_type))]; - None, None, - [[Gramext.Stoken ("", "sig"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (sig_item : 'sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'sig_item) (loc : int * int) -> - (s : 'e__4))])], - Gramext.action - (fun (a : 'e__4 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (sg : 'a_list) _ (loc : int * int) -> - (Qast.Node ("MtSig", [Qast.Loc; sg]) : 'module_type))]; - None, None, - [[Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (m2 : 'module_type) (m1 : 'module_type) (loc : int * int) -> - (Qast.Node ("MtApp", [Qast.Loc; m1; m2]) : 'module_type))]; - None, None, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (m2 : 'module_type) _ (m1 : 'module_type) (loc : int * int) -> - (Qast.Node ("MtAcc", [Qast.Loc; m1; m2]) : 'module_type))]; - Some "simple", None, - [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (mt : 'module_type) _ (loc : int * int) -> - (mt : 'module_type)); - [Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> - (Qast.Node ("MtQuo", [Qast.Loc; i]) : 'module_type)); - [Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> - (Qast.Node ("MtLid", [Qast.Loc; i]) : 'module_type)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_UIDENT) (loc : int * int) -> - (Qast.Node ("MtUid", [Qast.Loc; i]) : 'module_type))]]; - Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, - [Some "top", None, - [[Gramext.Stoken ("", "value"); - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (i : 'a_LIDENT) _ (loc : int * int) -> - (Qast.Node ("SgVal", [Qast.Loc; i; t]) : 'sig_item)); - [Gramext.Stoken ("", "type"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (type_declaration : 'type_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'type_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (tdl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("SgTyp", [Qast.Loc; tdl]) : 'sig_item)); - [Gramext.Stoken ("", "open"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'mod_ident) _ (loc : int * int) -> - (Qast.Node ("SgOpn", [Qast.Loc; i]) : 'sig_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "rec"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (module_rec_declaration : - 'module_rec_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'module_rec_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (mds : 'a_list) _ _ (loc : int * int) -> - (Qast.Node ("SgRecMod", [Qast.Loc; mds]) : 'sig_item)); - [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "type"); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (i : 'a_UIDENT) _ _ (loc : int * int) -> - (Qast.Node ("SgMty", [Qast.Loc; i; mt]) : 'sig_item)); - [Gramext.Stoken ("", "module"); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (module_declaration : 'module_declaration Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_declaration) (i : 'a_UIDENT) _ - (loc : int * int) -> - (Qast.Node ("SgMod", [Qast.Loc; i; mt]) : 'sig_item)); - [Gramext.Stoken ("", "include"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (loc : int * int) -> - (Qast.Node ("SgInc", [Qast.Loc; mt]) : 'sig_item)); - [Gramext.Stoken ("", "external"); - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.srules - [[Gramext.Slist1 - (Gramext.Snterm - (Grammar.Entry.obj - (a_STRING : 'a_STRING Grammar.Entry.e)))], - Gramext.action - (fun (a : 'a_STRING list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (pd : 'a_list) _ (t : 'ctyp) _ (i : 'a_LIDENT) _ - (loc : int * int) -> - (Qast.Node ("SgExt", [Qast.Loc; i; t; pd]) : 'sig_item)); - [Gramext.Stoken ("", "exception"); - Gramext.Snterm - (Grammar.Entry.obj - (constructor_declaration : - 'constructor_declaration Grammar.Entry.e))], - Gramext.action - (fun (ctl : 'constructor_declaration) _ (loc : int * int) -> - (let (_, c, tl) = - match ctl with - Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3 - | _ -> - match () with - _ -> raise (Match_failure ("./meta/q_MLast.ml", 358, 19)) - in - Qast.Node ("SgExc", [Qast.Loc; c; tl]) : - 'sig_item)); - [Gramext.Stoken ("", "declare"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (sig_item : 'sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'sig_item) (loc : int * int) -> - (s : 'e__5))])], - Gramext.action - (fun (a : 'e__5 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'a_list) _ (loc : int * int) -> - (Qast.Node ("SgDcl", [Qast.Loc; st]) : 'sig_item))]]; - Grammar.Entry.obj - (module_declaration : 'module_declaration Grammar.Entry.e), - None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("", ")"); Gramext.Sself], - Gramext.action - (fun (mt : 'module_declaration) _ (t : 'module_type) _ - (i : 'a_UIDENT) _ (loc : int * int) -> - (Qast.Node ("MtFun", [Qast.Loc; i; t; mt]) : - 'module_declaration)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (loc : int * int) -> - (mt : 'module_declaration))]]; - Grammar.Entry.obj - (module_rec_declaration : 'module_rec_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], - Gramext.action - (fun (mt : 'module_type) _ (m : 'a_UIDENT) (loc : int * int) -> - (Qast.Tuple [m; mt] : 'module_rec_declaration))]]; - Grammar.Entry.obj (with_constr : 'with_constr Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "module"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], - Gramext.action - (fun (me : 'module_expr) _ (i : 'mod_ident) _ (loc : int * int) -> - (Qast.Node ("WcMod", [Qast.Loc; i; me]) : 'with_constr)); - [Gramext.Stoken ("", "type"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e)); - Gramext.srules - [[Gramext.Slist0 - (Gramext.Snterm - (Grammar.Entry.obj - (type_parameter : 'type_parameter Grammar.Entry.e)))], - Gramext.action - (fun (a : 'type_parameter list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (tpl : 'a_list) (i : 'mod_ident) _ - (loc : int * int) -> - (Qast.Node ("WcTyp", [Qast.Loc; i; tpl; t]) : 'with_constr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), None, - [Some "top", Some Gramext.RightA, - [[Gramext.Stoken ("", "while"); Gramext.Sself; - Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); - Gramext.Snterm - (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (seq : 'sequence) _ _ (e : 'expr) _ (loc : int * int) -> - (Qast.Node ("ExWhi", [Qast.Loc; e; seq]) : 'expr)); - [Gramext.Stoken ("", "for"); - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "="); Gramext.Sself; - Gramext.Snterm - (Grammar.Entry.obj - (direction_flag : 'direction_flag Grammar.Entry.e)); - Gramext.Sself; Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); - Gramext.Snterm - (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (seq : 'sequence) _ _ (e2 : 'expr) (df : 'direction_flag) - (e1 : 'expr) _ (i : 'a_LIDENT) _ (loc : int * int) -> - (Qast.Node ("ExFor", [Qast.Loc; i; e1; e2; df; seq]) : 'expr)); - [Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); - Gramext.Snterm - (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (seq : 'sequence) _ _ (loc : int * int) -> - (mksequence Qast.Loc seq : 'expr)); - [Gramext.Stoken ("", "if"); Gramext.Sself; - Gramext.Stoken ("", "then"); Gramext.Sself; - Gramext.Stoken ("", "else"); Gramext.Sself], - Gramext.action - (fun (e3 : 'expr) _ (e2 : 'expr) _ (e1 : 'expr) _ - (loc : int * int) -> - (Qast.Node ("ExIfe", [Qast.Loc; e1; e2; e3]) : 'expr)); - [Gramext.Stoken ("", "try"); Gramext.Sself; - Gramext.Stoken ("", "with"); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (e1 : 'expr) _ (p1 : 'ipatt) _ (e : 'expr) _ - (loc : int * int) -> - (Qast.Node - ("ExTry", - [Qast.Loc; e; - Qast.List [Qast.Tuple [p1; Qast.Option None; e1]]]) : - 'expr)); - [Gramext.Stoken ("", "try"); Gramext.Sself; - Gramext.Stoken ("", "with"); Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (match_case : 'match_case Grammar.Entry.e)), - Gramext.Stoken ("", "|"))], - Gramext.action - (fun (a : 'match_case list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (l : 'a_list) _ _ (e : 'expr) _ (loc : int * int) -> - (Qast.Node ("ExTry", [Qast.Loc; e; l]) : 'expr)); - [Gramext.Stoken ("", "match"); Gramext.Sself; - Gramext.Stoken ("", "with"); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (e1 : 'expr) _ (p1 : 'ipatt) _ (e : 'expr) _ - (loc : int * int) -> - (Qast.Node - ("ExMat", - [Qast.Loc; e; - Qast.List [Qast.Tuple [p1; Qast.Option None; e1]]]) : - 'expr)); - [Gramext.Stoken ("", "match"); Gramext.Sself; - Gramext.Stoken ("", "with"); Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (match_case : 'match_case Grammar.Entry.e)), - Gramext.Stoken ("", "|"))], - Gramext.action - (fun (a : 'match_case list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (l : 'a_list) _ _ (e : 'expr) _ (loc : int * int) -> - (Qast.Node ("ExMat", [Qast.Loc; e; l]) : 'expr)); - [Gramext.Stoken ("", "fun"); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (fun_def : 'fun_def Grammar.Entry.e))], - Gramext.action - (fun (e : 'fun_def) (p : 'ipatt) _ (loc : int * int) -> - (Qast.Node - ("ExFun", - [Qast.Loc; - Qast.List [Qast.Tuple [p; Qast.Option None; e]]]) : - 'expr)); - [Gramext.Stoken ("", "fun"); Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (match_case : 'match_case Grammar.Entry.e)), - Gramext.Stoken ("", "|"))], - Gramext.action - (fun (a : 'match_case list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (l : 'a_list) _ _ (loc : int * int) -> - (Qast.Node ("ExFun", [Qast.Loc; l]) : 'expr)); - [Gramext.Stoken ("", "let"); Gramext.Stoken ("", "module"); - Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (module_binding : 'module_binding Grammar.Entry.e)); - Gramext.Stoken ("", "in"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (mb : 'module_binding) (m : 'a_UIDENT) _ _ - (loc : int * int) -> - (Qast.Node ("ExLmd", [Qast.Loc; m; mb; e]) : 'expr)); - [Gramext.Stoken ("", "let"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "rec")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__6))])], - Gramext.action - (fun (a : 'e__6 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'let_binding list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "in"); Gramext.Sself], - Gramext.action - (fun (x : 'expr) _ (l : 'a_list) (r : 'a_opt) _ (loc : int * int) -> - (Qast.Node ("ExLet", [Qast.Loc; o2b r; l; x]) : 'expr))]; - Some "where", None, - [[Gramext.Sself; Gramext.Stoken ("", "where"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "rec")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__7))])], - Gramext.action - (fun (a : 'e__7 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm - (Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e))], - Gramext.action - (fun (lb : 'let_binding) (rf : 'a_opt) _ (e : 'expr) - (loc : int * int) -> - (Qast.Node ("ExLet", [Qast.Loc; o2b rf; Qast.List [lb]; e]) : - 'expr))]; - Some ":=", Some Gramext.NonA, - [[Gramext.Sself; Gramext.Stoken ("", ":="); Gramext.Sself; - Gramext.Snterm (Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e))], - Gramext.action - (fun _ (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node ("ExAss", [Qast.Loc; e1; e2]) : 'expr))]; - Some "||", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "||"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "||"]); e1]); - e2]) : - 'expr))]; - Some "&&", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "&&"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "&&"]); e1]); - e2]) : - 'expr))]; - Some "<", Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "!="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "!="]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "=="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "=="]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "<>"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "<>"]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "="]); - e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", ">="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str ">="]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "<="); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "<="]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", ">"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str ">"]); - e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "<"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "<"]); - e1]); - e2]) : - 'expr))]; - Some "^", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "@"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "@"]); - e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "^"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "^"]); - e1]); - e2]) : - 'expr))]; - Some "+", Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "-."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "-."]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "+."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "+."]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "-"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "-"]); - e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "+"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "+"]); - e1]); - e2]) : - 'expr))]; - Some "*", Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "mod"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "mod"]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "lxor"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "lxor"]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "lor"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "lor"]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "land"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "land"]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "/."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "/."]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "*."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "*."]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "/"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "/"]); - e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "*"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "*"]); - e1]); - e2]) : - 'expr))]; - Some "**", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "lsr"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "lsr"]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "lsl"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "lsl"]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "asr"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "asr"]); e1]); - e2]) : - 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "**"); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node - ("ExApp", - [Qast.Loc; - Qast.Node ("ExLid", [Qast.Loc; Qast.Str "**"]); e1]); - e2]) : - 'expr))]; - Some "unary minus", Some Gramext.NonA, - [[Gramext.Stoken ("", "-."); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (mkumin Qast.Loc (Qast.Str "-.") e : 'expr)); - [Gramext.Stoken ("", "-"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (mkumin Qast.Loc (Qast.Str "-") e : 'expr))]; - Some "apply", Some Gramext.LeftA, - [[Gramext.Stoken ("", "lazy"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (Qast.Node ("ExLaz", [Qast.Loc; e]) : 'expr)); - [Gramext.Stoken ("", "assert"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (mkassert Qast.Loc e : 'expr)); - [Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) (e1 : 'expr) (loc : int * int) -> - (Qast.Node ("ExApp", [Qast.Loc; e1; e2]) : 'expr))]; - Some ".", Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node ("ExAcc", [Qast.Loc; e1; e2]) : 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Stoken ("", "["); - Gramext.Sself; Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (e2 : 'expr) _ _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node ("ExSte", [Qast.Loc; e1; e2]) : 'expr)); - [Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Stoken ("", "("); - Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (e2 : 'expr) _ _ (e1 : 'expr) (loc : int * int) -> - (Qast.Node ("ExAre", [Qast.Loc; e1; e2]) : 'expr))]; - Some "~-", Some Gramext.NonA, - [[Gramext.Stoken ("", "~-."); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "~-."]); - e]) : - 'expr)); - [Gramext.Stoken ("", "~-"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (Qast.Node - ("ExApp", - [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "~-"]); - e]) : - 'expr))]; - Some "simple", None, - [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action (fun _ (e : 'expr) _ (loc : int * int) -> (e : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), - Gramext.Stoken ("", ","))], - Gramext.action - (fun (a : 'expr list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (el : 'a_list) _ (e : 'expr) _ (loc : int * int) -> - (Qast.Node ("ExTup", [Qast.Loc; Qast.Cons (e, el)]) : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> - (Qast.Node ("ExTyc", [Qast.Loc; e; t]) : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], - Gramext.action - (fun _ _ (loc : int * int) -> - (Qast.Node ("ExUid", [Qast.Loc; Qast.Str "()"]) : 'expr)); - [Gramext.Stoken ("", "{"); Gramext.Stoken ("", "("); Gramext.Sself; - Gramext.Stoken ("", ")"); Gramext.Stoken ("", "with"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_expr : 'label_expr Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'label_expr list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (lel : 'a_list) _ _ (e : 'expr) _ _ (loc : int * int) -> - (Qast.Node ("ExRec", [Qast.Loc; lel; Qast.Option (Some e)]) : - 'expr)); - [Gramext.Stoken ("", "{"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_expr : 'label_expr Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'label_expr list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (lel : 'a_list) _ (loc : int * int) -> - (Qast.Node ("ExRec", [Qast.Loc; lel; Qast.Option None]) : - 'expr)); - [Gramext.Stoken ("", "[|"); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'expr list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (el : 'a_list) _ (loc : int * int) -> - (Qast.Node ("ExArr", [Qast.Loc; el]) : 'expr)); - [Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'expr list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Snterm - (Grammar.Entry.obj - (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (last : 'cons_expr_opt) (el : 'a_list) _ (loc : int * int) -> - (mklistexp Qast.Loc last el : 'expr)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")], - Gramext.action - (fun _ _ (loc : int * int) -> - (Qast.Node ("ExUid", [Qast.Loc; Qast.Str "[]"]) : 'expr)); - [Gramext.Snterm - (Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'expr_ident) (loc : int * int) -> (i : 'expr)); - [Gramext.Snterm - (Grammar.Entry.obj (a_CHAR : 'a_CHAR Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_CHAR) (loc : int * int) -> - (Qast.Node ("ExChr", [Qast.Loc; s]) : 'expr)); - [Gramext.Snterm - (Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_STRING) (loc : int * int) -> - (Qast.Node ("ExStr", [Qast.Loc; s]) : 'expr)); - [Gramext.Snterm - (Grammar.Entry.obj (a_FLOAT : 'a_FLOAT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_FLOAT) (loc : int * int) -> - (Qast.Node ("ExFlo", [Qast.Loc; s]) : 'expr)); - [Gramext.Snterm (Grammar.Entry.obj (a_INT : 'a_INT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_INT) (loc : int * int) -> - (Qast.Node ("ExInt", [Qast.Loc; s]) : 'expr))]]; - Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e), - None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> (Qast.Option None : 'cons_expr_opt)); - [Gramext.Stoken ("", "::"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (Qast.Option (Some e) : 'cons_expr_opt))]]; - Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e), None, - [None, None, - [[], Gramext.action (fun (loc : int * int) -> (() : 'dummy))]]; - Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) (loc : int * int) -> (Qast.List [e] : 'sequence)); - [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (e : 'expr) (loc : int * int) -> - (Qast.List [e] : 'sequence)); - [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";"); Gramext.Sself], - Gramext.action - (fun (el : 'sequence) _ (e : 'expr) (loc : int * int) -> - (Qast.Cons (e, el) : 'sequence)); - [Gramext.Stoken ("", "let"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "rec")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__8))])], - Gramext.action - (fun (a : 'e__8 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'let_binding list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.srules - [[Gramext.Stoken ("", ";")], - Gramext.action - (fun (x : string) (loc : int * int) -> (x : 'e__9)); - [Gramext.Stoken ("", "in")], - Gramext.action - (fun (x : string) (loc : int * int) -> (x : 'e__9))]; - Gramext.Sself], - Gramext.action - (fun (el : 'sequence) _ (l : 'a_list) (rf : 'a_opt) _ - (loc : int * int) -> - (Qast.List - [Qast.Node - ("ExLet", [Qast.Loc; o2b rf; l; mksequence Qast.Loc el])] : - 'sequence))]]; - Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'fun_binding) (p : 'ipatt) (loc : int * int) -> - (Qast.Tuple [p; e] : 'let_binding))]]; - Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e), None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> - (Qast.Node ("ExTyc", [Qast.Loc; e; t]) : 'fun_binding)); - [Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (e : 'fun_binding)); - [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (e : 'fun_binding) (p : 'ipatt) (loc : int * int) -> - (Qast.Node - ("ExFun", - [Qast.Loc; - Qast.List [Qast.Tuple [p; Qast.Option None; e]]]) : - 'fun_binding))]]; - Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (when_expr_opt : 'when_expr_opt Grammar.Entry.e)); - Gramext.Stoken ("", "->"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (w : 'when_expr_opt) (aso : 'as_patt_opt) - (p : 'patt) (loc : int * int) -> - (mkmatchcase Qast.Loc p aso w e : 'match_case))]]; - Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e), None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> (Qast.Option None : 'as_patt_opt)); - [Gramext.Stoken ("", "as"); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], - Gramext.action - (fun (p : 'patt) _ (loc : int * int) -> - (Qast.Option (Some p) : 'as_patt_opt))]]; - Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), - None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> (Qast.Option None : 'when_expr_opt)); - [Gramext.Stoken ("", "when"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> - (Qast.Option (Some e) : 'when_expr_opt))]]; - Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'fun_binding) (i : 'patt_label_ident) (loc : int * int) -> - (Qast.Tuple [i; e] : 'label_expr))]]; - Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e), None, - [None, Some Gramext.RightA, - [[Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (j : 'expr_ident) _ (i : 'a_UIDENT) (loc : int * int) -> - (mkexprident Qast.Loc i j : 'expr_ident)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_UIDENT) (loc : int * int) -> - (Qast.Node ("ExUid", [Qast.Loc; i]) : 'expr_ident)); - [Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> - (Qast.Node ("ExLid", [Qast.Loc; i]) : 'expr_ident))]]; - Grammar.Entry.obj (fun_def : 'fun_def Grammar.Entry.e), None, - [None, Some Gramext.RightA, - [[Gramext.Stoken ("", "->"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (e : 'fun_def)); - [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (e : 'fun_def) (p : 'ipatt) (loc : int * int) -> - (Qast.Node - ("ExFun", - [Qast.Loc; - Qast.List [Qast.Tuple [p; Qast.Option None; e]]]) : - 'fun_def))]]; - Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), None, - [None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "|"); Gramext.Sself], - Gramext.action - (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> - (Qast.Node ("PaOrp", [Qast.Loc; p1; p2]) : 'patt))]; - None, Some Gramext.NonA, - [[Gramext.Sself; Gramext.Stoken ("", ".."); Gramext.Sself], - Gramext.action - (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> - (Qast.Node ("PaRng", [Qast.Loc; p1; p2]) : 'patt))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (p2 : 'patt) (p1 : 'patt) (loc : int * int) -> - (Qast.Node ("PaApp", [Qast.Loc; p1; p2]) : 'patt))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> - (Qast.Node ("PaAcc", [Qast.Loc; p1; p2]) : 'patt))]; - Some "simple", None, - [[Gramext.Stoken ("", "_")], - Gramext.action - (fun _ (loc : int * int) -> - (Qast.Node ("PaAny", [Qast.Loc]) : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), - Gramext.Stoken ("", ","))], - Gramext.action - (fun (a : 'patt list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (pl : 'a_list) _ (p : 'patt) _ (loc : int * int) -> - (Qast.Node ("PaTup", [Qast.Loc; Qast.Cons (p, pl)]) : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "as"); - Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (p2 : 'patt) _ (p : 'patt) _ (loc : int * int) -> - (Qast.Node ("PaAli", [Qast.Loc; p; p2]) : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) -> - (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'patt)); - [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], - Gramext.action - (fun _ _ (loc : int * int) -> - (Qast.Node ("PaUid", [Qast.Loc; Qast.Str "()"]) : 'patt)); - [Gramext.Stoken ("", "{"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_patt : 'label_patt Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'label_patt list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (lpl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("PaRec", [Qast.Loc; lpl]) : 'patt)); - [Gramext.Stoken ("", "[|"); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'patt list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (pl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("PaArr", [Qast.Loc; pl]) : 'patt)); - [Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'patt list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Snterm - (Grammar.Entry.obj - (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (last : 'cons_patt_opt) (pl : 'a_list) _ (loc : int * int) -> - (mklistpat Qast.Loc last pl : 'patt)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")], - Gramext.action - (fun _ _ (loc : int * int) -> - (Qast.Node ("PaUid", [Qast.Loc; Qast.Str "[]"]) : 'patt)); - [Gramext.Stoken ("", "-"); - Gramext.Snterm - (Grammar.Entry.obj (a_FLOAT : 'a_FLOAT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_FLOAT) _ (loc : int * int) -> - (mkuminpat Qast.Loc (Qast.Str "-") (Qast.Bool false) s : 'patt)); - [Gramext.Stoken ("", "-"); - Gramext.Snterm (Grammar.Entry.obj (a_INT : 'a_INT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_INT) _ (loc : int * int) -> - (mkuminpat Qast.Loc (Qast.Str "-") (Qast.Bool true) s : 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_CHAR : 'a_CHAR Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_CHAR) (loc : int * int) -> - (Qast.Node ("PaChr", [Qast.Loc; s]) : 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_STRING) (loc : int * int) -> - (Qast.Node ("PaStr", [Qast.Loc; s]) : 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_FLOAT : 'a_FLOAT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_FLOAT) (loc : int * int) -> - (Qast.Node ("PaFlo", [Qast.Loc; s]) : 'patt)); - [Gramext.Snterm (Grammar.Entry.obj (a_INT : 'a_INT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_INT) (loc : int * int) -> - (Qast.Node ("PaInt", [Qast.Loc; s]) : 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_UIDENT) (loc : int * int) -> - (Qast.Node ("PaUid", [Qast.Loc; s]) : 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_LIDENT) (loc : int * int) -> - (Qast.Node ("PaLid", [Qast.Loc; s]) : 'patt))]]; - Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e), - None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> (Qast.Option None : 'cons_patt_opt)); - [Gramext.Stoken ("", "::"); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], - Gramext.action - (fun (p : 'patt) _ (loc : int * int) -> - (Qast.Option (Some p) : 'cons_patt_opt))]]; - Grammar.Entry.obj (label_patt : 'label_patt Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], - Gramext.action - (fun (p : 'patt) _ (i : 'patt_label_ident) (loc : int * int) -> - (Qast.Tuple [i; p] : 'label_patt))]]; - Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e), - None, - [None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (p2 : 'patt_label_ident) _ (p1 : 'patt_label_ident) - (loc : int * int) -> - (Qast.Node ("PaAcc", [Qast.Loc; p1; p2]) : 'patt_label_ident))]; - Some "simple", Some Gramext.RightA, - [[Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> - (Qast.Node ("PaLid", [Qast.Loc; i]) : 'patt_label_ident)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_UIDENT) (loc : int * int) -> - (Qast.Node ("PaUid", [Qast.Loc; i]) : 'patt_label_ident))]]; - Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "_")], - Gramext.action - (fun _ (loc : int * int) -> - (Qast.Node ("PaAny", [Qast.Loc]) : 'ipatt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (s : 'a_LIDENT) (loc : int * int) -> - (Qast.Node ("PaLid", [Qast.Loc; s]) : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)), - Gramext.Stoken ("", ","))], - Gramext.action - (fun (a : 'ipatt list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (pl : 'a_list) _ (p : 'ipatt) _ (loc : int * int) -> - (Qast.Node ("PaTup", [Qast.Loc; Qast.Cons (p, pl)]) : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "as"); - Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (p2 : 'ipatt) _ (p : 'ipatt) _ (loc : int * int) -> - (Qast.Node ("PaAli", [Qast.Loc; p; p2]) : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (p : 'ipatt) _ (loc : int * int) -> - (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (p : 'ipatt) _ (loc : int * int) -> (p : 'ipatt)); - [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], - Gramext.action - (fun _ _ (loc : int * int) -> - (Qast.Node ("PaUid", [Qast.Loc; Qast.Str "()"]) : 'ipatt)); - [Gramext.Stoken ("", "{"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_ipatt : 'label_ipatt Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'label_ipatt list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (lpl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("PaRec", [Qast.Loc; lpl]) : 'ipatt))]]; - Grammar.Entry.obj (label_ipatt : 'label_ipatt Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e))], - Gramext.action - (fun (p : 'ipatt) _ (i : 'patt_label_ident) (loc : int * int) -> - (Qast.Tuple [i; p] : 'label_ipatt))]]; - Grammar.Entry.obj - (type_declaration : 'type_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (type_patt : 'type_patt Grammar.Entry.e)); - Gramext.srules - [[Gramext.Slist0 - (Gramext.Snterm - (Grammar.Entry.obj - (type_parameter : 'type_parameter Grammar.Entry.e)))], - Gramext.action - (fun (a : 'type_parameter list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.srules - [[Gramext.Slist0 - (Gramext.Snterm - (Grammar.Entry.obj - (constrain : 'constrain Grammar.Entry.e)))], - Gramext.action - (fun (a : 'constrain list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (cl : 'a_list) (tk : 'ctyp) _ (tpl : 'a_list) (n : 'type_patt) - (loc : int * int) -> - (Qast.Tuple [n; tpl; tk; cl] : 'type_declaration))]]; - Grammar.Entry.obj (type_patt : 'type_patt Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (n : 'a_LIDENT) (loc : int * int) -> - (Qast.Tuple [Qast.Loc; n] : 'type_patt))]]; - Grammar.Entry.obj (constrain : 'constrain Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "constraint"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> - (Qast.Tuple [t1; t2] : 'constrain))]]; - Grammar.Entry.obj (type_parameter : 'type_parameter Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "-"); Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ _ (loc : int * int) -> - (Qast.Tuple [i; Qast.Tuple [Qast.Bool false; Qast.Bool true]] : - 'type_parameter)); - [Gramext.Stoken ("", "+"); Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ _ (loc : int * int) -> - (Qast.Tuple [i; Qast.Tuple [Qast.Bool true; Qast.Bool false]] : - 'type_parameter)); - [Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> - (Qast.Tuple [i; Qast.Tuple [Qast.Bool false; Qast.Bool false]] : - 'type_parameter))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), None, - [None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "=="); Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> - (Qast.Node ("TyMan", [Qast.Loc; t1; t2]) : 'ctyp))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "as"); Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> - (Qast.Node ("TyAli", [Qast.Loc; t1; t2]) : 'ctyp))]; - None, Some Gramext.LeftA, - [[Gramext.Stoken ("", "!"); - Gramext.srules - [[Gramext.Slist1 - (Gramext.Snterm - (Grammar.Entry.obj (typevar : 'typevar Grammar.Entry.e)))], - Gramext.action - (fun (a : 'typevar list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (pl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("TyPol", [Qast.Loc; pl; t]) : 'ctyp))]; - Some "arrow", Some Gramext.RightA, - [[Gramext.Sself; Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> - (Qast.Node ("TyArr", [Qast.Loc; t1; t2]) : 'ctyp))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) (t1 : 'ctyp) (loc : int * int) -> - (Qast.Node ("TyApp", [Qast.Loc; t1; t2]) : 'ctyp))]; - None, Some Gramext.LeftA, - [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> - (Qast.Node ("TyAcc", [Qast.Loc; t1; t2]) : 'ctyp))]; - Some "simple", None, - [[Gramext.Stoken ("", "{"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_declaration : - 'label_declaration Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'label_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (ldl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("TyRec", [Qast.Loc; Qast.Bool false; ldl]) : 'ctyp)); - [Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (constructor_declaration : - 'constructor_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "|"))], - Gramext.action - (fun (a : 'constructor_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (cdl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("TySum", [Qast.Loc; Qast.Bool false; cdl]) : 'ctyp)); - [Gramext.Stoken ("", "private"); Gramext.Stoken ("", "{"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (label_declaration : - 'label_declaration Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'label_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "}")], - Gramext.action - (fun _ (ldl : 'a_list) _ _ (loc : int * int) -> - (Qast.Node ("TyRec", [Qast.Loc; Qast.Bool true; ldl]) : 'ctyp)); - [Gramext.Stoken ("", "private"); Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (constructor_declaration : - 'constructor_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "|"))], - Gramext.action - (fun (a : 'constructor_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (cdl : 'a_list) _ _ (loc : int * int) -> - (Qast.Node ("TySum", [Qast.Loc; Qast.Bool true; cdl]) : 'ctyp)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'ctyp)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "*"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", "*"))], - Gramext.action - (fun (a : 'ctyp list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (tl : 'a_list) _ (t : 'ctyp) _ (loc : int * int) -> - (Qast.Node ("TyTup", [Qast.Loc; Qast.Cons (t, tl)]) : 'ctyp)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_UIDENT) (loc : int * int) -> - (Qast.Node ("TyUid", [Qast.Loc; i]) : 'ctyp)); - [Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> - (Qast.Node ("TyLid", [Qast.Loc; i]) : 'ctyp)); - [Gramext.Stoken ("", "_")], - Gramext.action - (fun _ (loc : int * int) -> - (Qast.Node ("TyAny", [Qast.Loc]) : 'ctyp)); - [Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> - (Qast.Node ("TyQuo", [Qast.Loc; i]) : 'ctyp))]]; - Grammar.Entry.obj - (constructor_declaration : 'constructor_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (ci : 'a_UIDENT) (loc : int * int) -> - (Qast.Tuple [Qast.Loc; ci; Qast.List []] : - 'constructor_declaration)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "of"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'ctyp list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (cal : 'a_list) _ (ci : 'a_UIDENT) (loc : int * int) -> - (Qast.Tuple [Qast.Loc; ci; cal] : 'constructor_declaration))]]; - Grammar.Entry.obj - (label_declaration : 'label_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "mutable")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__10))])], - Gramext.action - (fun (a : 'e__10 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) (mf : 'a_opt) _ (i : 'a_LIDENT) - (loc : int * int) -> - (Qast.Tuple [Qast.Loc; i; o2b mf; t] : 'label_declaration))]]; - Grammar.Entry.obj (ident : 'ident Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_UIDENT) (loc : int * int) -> (i : 'ident)); - [Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> (i : 'ident))]]; - Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e), None, - [None, Some Gramext.RightA, - [[Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (j : 'mod_ident) _ (i : 'a_UIDENT) (loc : int * int) -> - (Qast.Cons (i, j) : 'mod_ident)); - [Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> - (Qast.List [i] : 'mod_ident)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_UIDENT) (loc : int * int) -> - (Qast.List [i] : 'mod_ident))]]; - Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (class_type_declaration : - 'class_type_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'class_type_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (ctd : 'a_list) _ _ (loc : int * int) -> - (Qast.Node ("StClt", [Qast.Loc; ctd]) : 'str_item)); - [Gramext.Stoken ("", "class"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (class_declaration : - 'class_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'class_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (cd : 'a_list) _ (loc : int * int) -> - (Qast.Node ("StCls", [Qast.Loc; cd]) : 'str_item))]]; - Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (class_type_declaration : - 'class_type_declaration Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'class_type_declaration list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (ctd : 'a_list) _ _ (loc : int * int) -> - (Qast.Node ("SgClt", [Qast.Loc; ctd]) : 'sig_item)); - [Gramext.Stoken ("", "class"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (class_description : - 'class_description Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'class_description list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (cd : 'a_list) _ (loc : int * int) -> - (Qast.Node ("SgCls", [Qast.Loc; cd]) : 'sig_item))]]; - Grammar.Entry.obj - (class_declaration : 'class_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "virtual")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__11))])], - Gramext.action - (fun (a : 'e__11 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (class_type_parameters : - 'class_type_parameters Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (class_fun_binding : 'class_fun_binding Grammar.Entry.e))], - Gramext.action - (fun (cfb : 'class_fun_binding) (ctp : 'class_type_parameters) - (i : 'a_LIDENT) (vf : 'a_opt) (loc : int * int) -> - (Qast.Record - ["ciLoc", Qast.Loc; "ciVir", o2b vf; "ciPrm", ctp; "ciNam", i; - "ciExp", cfb] : - 'class_declaration))]]; - Grammar.Entry.obj - (class_fun_binding : 'class_fun_binding Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (cfb : 'class_fun_binding) (p : 'ipatt) (loc : int * int) -> - (Qast.Node ("CeFun", [Qast.Loc; p; cfb]) : 'class_fun_binding)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], - Gramext.action - (fun (ce : 'class_expr) _ (ct : 'class_type) _ (loc : int * int) -> - (Qast.Node ("CeTyc", [Qast.Loc; ce; ct]) : 'class_fun_binding)); - [Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], - Gramext.action - (fun (ce : 'class_expr) _ (loc : int * int) -> - (ce : 'class_fun_binding))]]; - Grammar.Entry.obj - (class_type_parameters : 'class_type_parameters Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (type_parameter : 'type_parameter Grammar.Entry.e)), - Gramext.Stoken ("", ","))], - Gramext.action - (fun (a : 'type_parameter list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (tpl : 'a_list) _ (loc : int * int) -> - (Qast.Tuple [Qast.Loc; tpl] : 'class_type_parameters)); - [], - Gramext.action - (fun (loc : int * int) -> - (Qast.Tuple [Qast.Loc; Qast.List []] : - 'class_type_parameters))]]; - Grammar.Entry.obj (class_fun_def : 'class_fun_def Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "->"); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], - Gramext.action - (fun (ce : 'class_expr) _ (loc : int * int) -> - (ce : 'class_fun_def)); - [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (ce : 'class_fun_def) (p : 'ipatt) (loc : int * int) -> - (Qast.Node ("CeFun", [Qast.Loc; p; ce]) : 'class_fun_def))]]; - Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), None, - [Some "top", None, - [[Gramext.Stoken ("", "let"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "rec")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__12))])], - Gramext.action - (fun (a : 'e__12 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'let_binding list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "in"); Gramext.Sself], - Gramext.action - (fun (ce : 'class_expr) _ (lb : 'a_list) (rf : 'a_opt) _ - (loc : int * int) -> - (Qast.Node ("CeLet", [Qast.Loc; o2b rf; lb; ce]) : 'class_expr)); - [Gramext.Stoken ("", "fun"); - Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (class_fun_def : 'class_fun_def Grammar.Entry.e))], - Gramext.action - (fun (ce : 'class_fun_def) (p : 'ipatt) _ (loc : int * int) -> - (Qast.Node ("CeFun", [Qast.Loc; p; ce]) : 'class_expr))]; - Some "apply", Some Gramext.NonA, - [[Gramext.Sself; - Gramext.Snterml - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), "label")], - Gramext.action - (fun (e : 'expr) (ce : 'class_expr) (loc : int * int) -> - (Qast.Node ("CeApp", [Qast.Loc; ce; e]) : 'class_expr))]; - Some "simple", None, - [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (ce : 'class_expr) _ (loc : int * int) -> - (ce : 'class_expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (ct : 'class_type) _ (ce : 'class_expr) _ - (loc : int * int) -> - (Qast.Node ("CeTyc", [Qast.Loc; ce; ct]) : 'class_expr)); - [Gramext.Stoken ("", "object"); - Gramext.srules - [[Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj - (class_self_patt : 'class_self_patt Grammar.Entry.e)))], - Gramext.action - (fun (a : 'class_self_patt option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm - (Grammar.Entry.obj - (class_structure : 'class_structure Grammar.Entry.e)); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (cf : 'class_structure) (cspo : 'a_opt) _ - (loc : int * int) -> - (Qast.Node ("CeStr", [Qast.Loc; cspo; cf]) : 'class_expr)); - [Gramext.Snterm - (Grammar.Entry.obj - (class_longident : 'class_longident Grammar.Entry.e))], - Gramext.action - (fun (ci : 'class_longident) (loc : int * int) -> - (Qast.Node ("CeCon", [Qast.Loc; ci; Qast.List []]) : - 'class_expr)); - [Gramext.Snterm - (Grammar.Entry.obj - (class_longident : 'class_longident Grammar.Entry.e)); - Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", ","))], - Gramext.action - (fun (a : 'ctyp list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (ctcl : 'a_list) _ (ci : 'class_longident) - (loc : int * int) -> - (Qast.Node ("CeCon", [Qast.Loc; ci; ctcl]) : 'class_expr))]]; - Grammar.Entry.obj (class_structure : 'class_structure Grammar.Entry.e), - None, - [None, None, - [[Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_str_item : 'class_str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (cf : 'class_str_item) (loc : int * int) -> - (cf : 'e__13))])], - Gramext.action - (fun (a : 'e__13 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (cf : 'a_list) (loc : int * int) -> (cf : 'class_structure))]]; - Grammar.Entry.obj (class_self_patt : 'class_self_patt Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) -> - (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'class_self_patt)); - [Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'class_self_patt))]]; - Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "initializer"); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (se : 'expr) _ (loc : int * int) -> - (Qast.Node ("CrIni", [Qast.Loc; se]) : 'class_str_item)); - [Gramext.Stoken ("", "type"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> - (Qast.Node ("CrCtr", [Qast.Loc; t1; t2]) : 'class_str_item)); - [Gramext.Stoken ("", "method"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "private")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__17))])], - Gramext.action - (fun (a : 'e__17 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.srules - [[Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (polyt : 'polyt Grammar.Entry.e)))], - Gramext.action - (fun (a : 'polyt option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm - (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'fun_binding) (topt : 'a_opt) (l : 'label) (pf : 'a_opt) _ - (loc : int * int) -> - (Qast.Node ("CrMth", [Qast.Loc; l; o2b pf; e; topt]) : - 'class_str_item)); - [Gramext.Stoken ("", "method"); Gramext.Stoken ("", "virtual"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "private")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__16))])], - Gramext.action - (fun (a : 'e__16 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (pf : 'a_opt) _ _ - (loc : int * int) -> - (Qast.Node ("CrVir", [Qast.Loc; l; o2b pf; t]) : - 'class_str_item)); - [Gramext.Stoken ("", "value"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "mutable")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__15))])], - Gramext.action - (fun (a : 'e__15 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (cvalue_binding : 'cvalue_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'cvalue_binding) (lab : 'label) (mf : 'a_opt) _ - (loc : int * int) -> - (Qast.Node ("CrVal", [Qast.Loc; lab; o2b mf; e]) : - 'class_str_item)); - [Gramext.Stoken ("", "inherit"); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e)); - Gramext.srules - [[Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj - (as_lident : 'as_lident Grammar.Entry.e)))], - Gramext.action - (fun (a : 'as_lident option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]], - Gramext.action - (fun (pb : 'a_opt) (ce : 'class_expr) _ (loc : int * int) -> - (Qast.Node ("CrInh", [Qast.Loc; ce; pb]) : 'class_str_item)); - [Gramext.Stoken ("", "declare"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_str_item : 'class_str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'class_str_item) (loc : int * int) -> - (s : 'e__14))])], - Gramext.action - (fun (a : 'e__14 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'a_list) _ (loc : int * int) -> - (Qast.Node ("CrDcl", [Qast.Loc; st]) : 'class_str_item))]]; - Grammar.Entry.obj (as_lident : 'as_lident Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "as"); - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) _ (loc : int * int) -> (i : 'as_lident))]]; - Grammar.Entry.obj (polyt : 'polyt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (loc : int * int) -> (t : 'polyt))]]; - Grammar.Entry.obj (cvalue_binding : 'cvalue_binding Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", ":>"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> - (Qast.Node ("ExCoe", [Qast.Loc; e; Qast.Option None; t]) : - 'cvalue_binding)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ":>"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (t2 : 'ctyp) _ (t : 'ctyp) _ (loc : int * int) -> - (Qast.Node ("ExCoe", [Qast.Loc; e; Qast.Option (Some t); t2]) : - 'cvalue_binding)); - [Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> - (Qast.Node ("ExTyc", [Qast.Loc; e; t]) : 'cvalue_binding)); - [Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (e : 'cvalue_binding))]]; - Grammar.Entry.obj (label : 'label Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> (i : 'label))]]; - Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "object"); - Gramext.srules - [[Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj - (class_self_type : 'class_self_type Grammar.Entry.e)))], - Gramext.action - (fun (a : 'class_self_type option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_sig_item : 'class_sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (csf : 'class_sig_item) (loc : int * int) -> - (csf : 'e__18))])], - Gramext.action - (fun (a : 'e__18 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (csf : 'a_list) (cst : 'a_opt) _ (loc : int * int) -> - (Qast.Node ("CtSig", [Qast.Loc; cst; csf]) : 'class_type)); - [Gramext.Snterm - (Grammar.Entry.obj - (clty_longident : 'clty_longident Grammar.Entry.e))], - Gramext.action - (fun (id : 'clty_longident) (loc : int * int) -> - (Qast.Node ("CtCon", [Qast.Loc; id; Qast.List []]) : - 'class_type)); - [Gramext.Snterm - (Grammar.Entry.obj - (clty_longident : 'clty_longident Grammar.Entry.e)); - Gramext.Stoken ("", "["); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", ","))], - Gramext.action - (fun (a : 'ctyp list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (tl : 'a_list) _ (id : 'clty_longident) (loc : int * int) -> - (Qast.Node ("CtCon", [Qast.Loc; id; tl]) : 'class_type)); - [Gramext.Stoken ("", "["); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "]"); Gramext.Stoken ("", "->"); Gramext.Sself], - Gramext.action - (fun (ct : 'class_type) _ _ (t : 'ctyp) _ (loc : int * int) -> - (Qast.Node ("CtFun", [Qast.Loc; t; ct]) : 'class_type))]]; - Grammar.Entry.obj (class_self_type : 'class_self_type Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'class_self_type))]]; - Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "type"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> - (Qast.Node ("CgCtr", [Qast.Loc; t1; t2]) : 'class_sig_item)); - [Gramext.Stoken ("", "method"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "private")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__22))])], - Gramext.action - (fun (a : 'e__22 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (pf : 'a_opt) _ (loc : int * int) -> - (Qast.Node ("CgMth", [Qast.Loc; l; o2b pf; t]) : - 'class_sig_item)); - [Gramext.Stoken ("", "method"); Gramext.Stoken ("", "virtual"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "private")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__21))])], - Gramext.action - (fun (a : 'e__21 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (pf : 'a_opt) _ _ - (loc : int * int) -> - (Qast.Node ("CgVir", [Qast.Loc; l; o2b pf; t]) : - 'class_sig_item)); - [Gramext.Stoken ("", "value"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "mutable")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__20))])], - Gramext.action - (fun (a : 'e__20 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (mf : 'a_opt) _ (loc : int * int) -> - (Qast.Node ("CgVal", [Qast.Loc; l; o2b mf; t]) : - 'class_sig_item)); - [Gramext.Stoken ("", "inherit"); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], - Gramext.action - (fun (cs : 'class_type) _ (loc : int * int) -> - (Qast.Node ("CgInh", [Qast.Loc; cs]) : 'class_sig_item)); - [Gramext.Stoken ("", "declare"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_sig_item : 'class_sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (s : 'class_sig_item) (loc : int * int) -> - (s : 'e__19))])], - Gramext.action - (fun (a : 'e__19 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (st : 'a_list) _ (loc : int * int) -> - (Qast.Node ("CgDcl", [Qast.Loc; st]) : 'class_sig_item))]]; - Grammar.Entry.obj - (class_description : 'class_description Grammar.Entry.e), - None, - [None, None, - [[Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "virtual")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__23))])], - Gramext.action - (fun (a : 'e__23 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (class_type_parameters : - 'class_type_parameters Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], - Gramext.action - (fun (ct : 'class_type) _ (ctp : 'class_type_parameters) - (n : 'a_LIDENT) (vf : 'a_opt) (loc : int * int) -> - (Qast.Record - ["ciLoc", Qast.Loc; "ciVir", o2b vf; "ciPrm", ctp; "ciNam", n; - "ciExp", ct] : - 'class_description))]]; - Grammar.Entry.obj - (class_type_declaration : 'class_type_declaration Grammar.Entry.e), - None, - [None, None, - [[Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "virtual")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__24))])], - Gramext.action - (fun (a : 'e__24 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (class_type_parameters : - 'class_type_parameters Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], - Gramext.action - (fun (cs : 'class_type) _ (ctp : 'class_type_parameters) - (n : 'a_LIDENT) (vf : 'a_opt) (loc : int * int) -> - (Qast.Record - ["ciLoc", Qast.Loc; "ciVir", o2b vf; "ciPrm", ctp; "ciNam", n; - "ciExp", cs] : - 'class_type_declaration))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "apply"), - [None, Some Gramext.LeftA, - [[Gramext.Stoken ("", "new"); - Gramext.Snterm - (Grammar.Entry.obj - (class_longident : 'class_longident Grammar.Entry.e))], - Gramext.action - (fun (i : 'class_longident) _ (loc : int * int) -> - (Qast.Node ("ExNew", [Qast.Loc; i]) : 'expr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "."), - [None, None, - [[Gramext.Sself; Gramext.Stoken ("", "#"); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e))], - Gramext.action - (fun (lab : 'label) _ (e : 'expr) (loc : int * int) -> - (Qast.Node ("ExSnd", [Qast.Loc; e; lab]) : 'expr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "{<"); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (field_expr : 'field_expr Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'field_expr list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", ">}")], - Gramext.action - (fun _ (fel : 'a_list) _ (loc : int * int) -> - (Qast.Node ("ExOvr", [Qast.Loc; fel]) : 'expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":>"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> - (Qast.Node ("ExCoe", [Qast.Loc; e; Qast.Option None; t]) : - 'expr)); - [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ":>"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (t2 : 'ctyp) _ (t : 'ctyp) _ (e : 'expr) _ - (loc : int * int) -> - (Qast.Node ("ExCoe", [Qast.Loc; e; Qast.Option (Some t); t2]) : - 'expr))]]; - Grammar.Entry.obj (field_expr : 'field_expr Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (l : 'label) (loc : int * int) -> - (Qast.Tuple [l; e] : 'field_expr))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "<"); - Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj (field : 'field Grammar.Entry.e)), - Gramext.Stoken ("", ";"))], - Gramext.action - (fun (a : 'field list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "..")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__25))])], - Gramext.action - (fun (a : 'e__25 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Stoken ("", ">")], - Gramext.action - (fun _ (v : 'a_opt) (ml : 'a_list) _ (loc : int * int) -> - (Qast.Node ("TyObj", [Qast.Loc; ml; o2b v]) : 'ctyp)); - [Gramext.Stoken ("", "#"); - Gramext.Snterm - (Grammar.Entry.obj - (class_longident : 'class_longident Grammar.Entry.e))], - Gramext.action - (fun (id : 'class_longident) _ (loc : int * int) -> - (Qast.Node ("TyCls", [Qast.Loc; id]) : 'ctyp))]]; - Grammar.Entry.obj (field : 'field Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (lab : 'a_LIDENT) (loc : int * int) -> - (Qast.Tuple [lab; t] : 'field))]]; - Grammar.Entry.obj (typevar : 'typevar Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "'"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> (i : 'typevar))]]; - Grammar.Entry.obj (clty_longident : 'clty_longident Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> - (Qast.List [i] : 'clty_longident)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (l : 'clty_longident) _ (m : 'a_UIDENT) (loc : int * int) -> - (Qast.Cons (m, l) : 'clty_longident))]]; - Grammar.Entry.obj (class_longident : 'class_longident Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_LIDENT) (loc : int * int) -> - (Qast.List [i] : 'class_longident)); - [Gramext.Snterm - (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "."); Gramext.Sself], - Gramext.action - (fun (l : 'class_longident) _ (m : 'a_UIDENT) (loc : int * int) -> - (Qast.Cons (m, l) : 'class_longident))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.After "arrow"), - [None, Some Gramext.NonA, - [[Gramext.Snterm - (Grammar.Entry.obj - (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (i : 'a_QUESTIONIDENT) (loc : int * int) -> - (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp)); - [Gramext.Snterm - (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (i : 'a_TILDEIDENT) (loc : int * int) -> - (Qast.Node ("TyLab", [Qast.Loc; i; t]) : 'ctyp))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", ">"); - Gramext.srules - [[Gramext.Slist1 - (Gramext.Snterm - (Grammar.Entry.obj - (name_tag : 'name_tag Grammar.Entry.e)))], - Gramext.action - (fun (a : 'name_tag list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (ntl : 'a_list) _ (rfl : 'row_field_list) _ _ - (loc : int * int) -> - (Qast.Node - ("TyVrn", - [Qast.Loc; rfl; - Qast.Option (Some (Qast.Option (Some ntl)))]) : - 'ctyp)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> - (Qast.Node - ("TyVrn", - [Qast.Loc; rfl; - Qast.Option (Some (Qast.Option (Some (Qast.List []))))]) : - 'ctyp)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", ">"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> - (Qast.Node - ("TyVrn", - [Qast.Loc; rfl; Qast.Option (Some (Qast.Option None))]) : - 'ctyp)); - [Gramext.Stoken ("", "["); Gramext.Stoken ("", "="); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> - (Qast.Node ("TyVrn", [Qast.Loc; rfl; Qast.Option None]) : - 'ctyp))]]; - Grammar.Entry.obj (row_field_list : 'row_field_list Grammar.Entry.e), - None, - [None, None, - [[Gramext.srules - [[Gramext.Slist0sep - (Gramext.Snterm - (Grammar.Entry.obj - (row_field : 'row_field Grammar.Entry.e)), - Gramext.Stoken ("", "|"))], - Gramext.action - (fun (a : 'row_field list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (rfl : 'a_list) (loc : int * int) -> - (rfl : 'row_field_list))]]; - Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) (loc : int * int) -> - (Qast.Node ("RfInh", [t]) : 'row_field)); - [Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e)); - Gramext.Stoken ("", "of"); - Gramext.srules - [[Gramext.Sopt - (Gramext.srules - [[Gramext.Stoken ("", "&")], - Gramext.action - (fun (x : string) (loc : int * int) -> - (Qast.Str x : 'e__26))])], - Gramext.action - (fun (a : 'e__26 option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), - Gramext.Stoken ("", "&"))], - Gramext.action - (fun (a : 'ctyp list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (l : 'a_list) (ao : 'a_opt) _ (i : 'ident) _ - (loc : int * int) -> - (Qast.Node ("RfTag", [i; o2b ao; l]) : 'row_field)); - [Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> - (Qast.Node ("RfTag", [i; Qast.Bool true; Qast.List []]) : - 'row_field))]]; - Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (i : 'ident) _ (loc : int * int) -> (i : 'name_tag))]]; - Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "?"); Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); - Gramext.srules - [[Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], - Gramext.action - (fun (a : 'eq_expr option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (eo : 'a_opt) (p : 'patt_tcon) _ _ (loc : int * int) -> - (Qast.Node - ("PaOlb", - [Qast.Loc; Qast.Str ""; - Qast.Option (Some (Qast.Tuple [p; eo]))]) : - 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj - (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> - (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj - (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); - Gramext.srules - [[Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], - Gramext.action - (fun (a : 'eq_expr option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (eo : 'a_opt) (p : 'patt_tcon) _ _ (i : 'a_QUESTIONIDENT) - (loc : int * int) -> - (Qast.Node - ("PaOlb", - [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) : - 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj - (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_TILDEIDENT) (loc : int * int) -> - (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'patt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself], - Gramext.action - (fun (p : 'patt) _ (i : 'a_TILDEIDENT) (loc : int * int) -> - (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) : - 'patt)); - [Gramext.Stoken ("", "#"); - Gramext.Snterm - (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], - Gramext.action - (fun (sl : 'mod_ident) _ (loc : int * int) -> - (Qast.Node ("PaTyp", [Qast.Loc; sl]) : 'patt)); - [Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (s : 'ident) _ (loc : int * int) -> - (Qast.Node ("PaVrn", [Qast.Loc; s]) : 'patt))]]; - Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], - Gramext.action - (fun (p : 'patt) (loc : int * int) -> (p : 'patt_tcon)); - [Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (p : 'patt) (loc : int * int) -> - (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'patt_tcon))]]; - Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "?"); Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); - Gramext.srules - [[Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], - Gramext.action - (fun (a : 'eq_expr option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (eo : 'a_opt) (p : 'ipatt_tcon) _ _ (loc : int * int) -> - (Qast.Node - ("PaOlb", - [Qast.Loc; Qast.Str ""; - Qast.Option (Some (Qast.Tuple [p; eo]))]) : - 'ipatt)); - [Gramext.Snterm - (Grammar.Entry.obj - (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> - (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'ipatt)); - [Gramext.Snterm - (Grammar.Entry.obj - (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Stoken ("", "("); - Gramext.Snterm - (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); - Gramext.srules - [[Gramext.Sopt - (Gramext.Snterm - (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], - Gramext.action - (fun (a : 'eq_expr option) (loc : int * int) -> - (Qast.Option a : 'a_opt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (eo : 'a_opt) (p : 'ipatt_tcon) _ _ (i : 'a_QUESTIONIDENT) - (loc : int * int) -> - (Qast.Node - ("PaOlb", - [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) : - 'ipatt)); - [Gramext.Snterm - (Grammar.Entry.obj - (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_TILDEIDENT) (loc : int * int) -> - (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'ipatt)); - [Gramext.Snterm - (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself], - Gramext.action - (fun (p : 'ipatt) _ (i : 'a_TILDEIDENT) (loc : int * int) -> - (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) : - 'ipatt))]]; - Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e))], - Gramext.action - (fun (p : 'ipatt) (loc : int * int) -> (p : 'ipatt_tcon)); - [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (p : 'ipatt) (loc : int * int) -> - (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'ipatt_tcon))]]; - Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "="); - Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) _ (loc : int * int) -> (e : 'eq_expr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.After "apply"), - [Some "label", Some Gramext.NonA, - [[Gramext.Snterm - (Grammar.Entry.obj - (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> - (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option None]) : 'expr)); - [Gramext.Snterm - (Grammar.Entry.obj - (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (i : 'a_QUESTIONIDENT) (loc : int * int) -> - (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option (Some e)]) : - 'expr)); - [Gramext.Snterm - (Grammar.Entry.obj - (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e))], - Gramext.action - (fun (i : 'a_TILDEIDENT) (loc : int * int) -> - (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option None]) : 'expr)); - [Gramext.Snterm - (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ (i : 'a_TILDEIDENT) (loc : int * int) -> - (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option (Some e)]) : - 'expr))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "`"); - Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], - Gramext.action - (fun (s : 'ident) _ (loc : int * int) -> - (Qast.Node ("ExVrn", [Qast.Loc; s]) : 'expr))]]; - Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "downto")], - Gramext.action - (fun _ (loc : int * int) -> (Qast.Bool false : 'direction_flag)); - [Gramext.Stoken ("", "to")], - Gramext.action - (fun _ (loc : int * int) -> (Qast.Bool true : 'direction_flag))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "[|"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_variant : 'warning_variant Grammar.Entry.e)); - Gramext.Stoken ("", "<"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", ">"); - Gramext.srules - [[Gramext.Slist1 - (Gramext.Snterm - (Grammar.Entry.obj - (name_tag : 'name_tag Grammar.Entry.e)))], - Gramext.action - (fun (a : 'name_tag list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (ntl : 'a_list) _ (rfl : 'row_field_list) _ _ _ - (loc : int * int) -> - (Qast.Node - ("TyVrn", - [Qast.Loc; rfl; - Qast.Option (Some (Qast.Option (Some ntl)))]) : - 'ctyp)); - [Gramext.Stoken ("", "[|"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_variant : 'warning_variant Grammar.Entry.e)); - Gramext.Stoken ("", "<"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ _ (loc : int * int) -> - (Qast.Node - ("TyVrn", - [Qast.Loc; rfl; - Qast.Option (Some (Qast.Option (Some (Qast.List []))))]) : - 'ctyp)); - [Gramext.Stoken ("", "[|"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_variant : 'warning_variant Grammar.Entry.e)); - Gramext.Stoken ("", ">"); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ _ (loc : int * int) -> - (Qast.Node - ("TyVrn", - [Qast.Loc; rfl; Qast.Option (Some (Qast.Option None))]) : - 'ctyp)); - [Gramext.Stoken ("", "[|"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_variant : 'warning_variant Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (row_field_list : 'row_field_list Grammar.Entry.e)); - Gramext.Stoken ("", "|]")], - Gramext.action - (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> - (Qast.Node ("TyVrn", [Qast.Loc; rfl; Qast.Option None]) : - 'ctyp))]]; - Grammar.Entry.obj (warning_variant : 'warning_variant Grammar.Entry.e), - None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> - (warn_variant Qast.Loc : 'warning_variant))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "top"), - [None, None, - [[Gramext.Stoken ("", "while"); Gramext.Sself; - Gramext.Stoken ("", "do"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__29))])], - Gramext.action - (fun (a : 'e__29 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Snterm - (Grammar.Entry.obj - (warning_sequence : 'warning_sequence Grammar.Entry.e)); - Gramext.Stoken ("", "done")], - Gramext.action - (fun _ _ (seq : 'a_list) _ (e : 'expr) _ (loc : int * int) -> - (Qast.Node ("ExWhi", [Qast.Loc; e; seq]) : 'expr)); - [Gramext.Stoken ("", "for"); - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Stoken ("", "="); Gramext.Sself; - Gramext.Snterm - (Grammar.Entry.obj - (direction_flag : 'direction_flag Grammar.Entry.e)); - Gramext.Sself; Gramext.Stoken ("", "do"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__28))])], - Gramext.action - (fun (a : 'e__28 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Snterm - (Grammar.Entry.obj - (warning_sequence : 'warning_sequence Grammar.Entry.e)); - Gramext.Stoken ("", "done")], - Gramext.action - (fun _ _ (seq : 'a_list) _ (e2 : 'expr) (df : 'direction_flag) - (e1 : 'expr) _ (i : 'a_LIDENT) _ (loc : int * int) -> - (Qast.Node ("ExFor", [Qast.Loc; i; e1; e2; df; seq]) : 'expr)); - [Gramext.Stoken ("", "do"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__27))])], - Gramext.action - (fun (a : 'e__27 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "return"); - Gramext.Snterm - (Grammar.Entry.obj - (warning_sequence : 'warning_sequence Grammar.Entry.e)); - Gramext.Sself], - Gramext.action - (fun (e : 'expr) _ _ (seq : 'a_list) _ (loc : int * int) -> - (Qast.Node ("ExSeq", [Qast.Loc; append_elem seq e]) : 'expr))]]; - Grammar.Entry.obj - (warning_sequence : 'warning_sequence Grammar.Entry.e), - None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> - (warn_sequence Qast.Loc : 'warning_sequence))]]; - Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "list")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "list" loc a : 'sequence))]]; - Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'expr_ident))]]; - Grammar.Entry.obj - (patt_label_ident : 'patt_label_ident Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'patt_label_ident))]]; - Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "when")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "when" loc a : 'when_expr_opt))]]; - Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'mod_ident))]]; - Grammar.Entry.obj (clty_longident : 'clty_longident Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'clty_longident))]]; - Grammar.Entry.obj (class_longident : 'class_longident Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'class_longident))]]; - Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "to")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "to" loc a : 'direction_flag))]]; - Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "object"); Gramext.Stoken ("ANTIQUOT", ""); - Gramext.Stoken ("", ";"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_str_item : 'class_str_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (cf : 'class_str_item) (loc : int * int) -> - (cf : 'e__30))])], - Gramext.action - (fun (a : 'e__30 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (csl : 'a_list) _ (x : string) _ (loc : int * int) -> - (let _ = warn_antiq loc "3.05" in - Qast.Node - ("CeStr", - [Qast.Loc; Qast.Option None; - Qast.Cons (antiquot "" loc x, csl)]) : - 'class_expr)); - [Gramext.Stoken ("", "object"); Gramext.Stoken ("ANTIQUOT", ""); - Gramext.Snterm - (Grammar.Entry.obj - (class_structure : 'class_structure Grammar.Entry.e)); - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (cf : 'class_structure) (x : string) _ (loc : int * int) -> - (let _ = warn_antiq loc "3.05" in - Qast.Node ("CeStr", [Qast.Loc; antiquot "" loc x; cf]) : - 'class_expr))]]; - Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "object"); Gramext.Stoken ("ANTIQUOT", ""); - Gramext.Stoken ("", ";"); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_sig_item : 'class_sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (csf : 'class_sig_item) (loc : int * int) -> - (csf : 'e__32))])], - Gramext.action - (fun (a : 'e__32 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (csf : 'a_list) _ (x : string) _ (loc : int * int) -> - (let _ = warn_antiq loc "3.05" in - Qast.Node - ("CtSig", - [Qast.Loc; Qast.Option None; - Qast.Cons (antiquot "" loc x, csf)]) : - 'class_type)); - [Gramext.Stoken ("", "object"); Gramext.Stoken ("ANTIQUOT", ""); - Gramext.srules - [[Gramext.Slist0 - (Gramext.srules - [[Gramext.Snterm - (Grammar.Entry.obj - (class_sig_item : 'class_sig_item Grammar.Entry.e)); - Gramext.Stoken ("", ";")], - Gramext.action - (fun _ (csf : 'class_sig_item) (loc : int * int) -> - (csf : 'e__31))])], - Gramext.action - (fun (a : 'e__31 list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "end")], - Gramext.action - (fun _ (csf : 'a_list) (x : string) _ (loc : int * int) -> - (let _ = warn_antiq loc "3.05" in - Qast.Node ("CtSig", [Qast.Loc; antiquot "" loc x; csf]) : - 'class_type))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "top"), - [None, None, - [[Gramext.Stoken ("", "let"); Gramext.Stoken ("ANTIQUOT", "rec"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'let_binding list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "in"); Gramext.Sself], - Gramext.action - (fun (x : 'expr) _ (l : 'a_list) (r : string) _ (loc : int * int) -> - (let _ = warn_antiq loc "3.06+18" in - Qast.Node ("ExLet", [Qast.Loc; antiquot "rec" loc r; l; x]) : - 'expr))]]; - Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), - Some (Gramext.Level "top"), - [None, None, - [[Gramext.Stoken ("", "value"); Gramext.Stoken ("ANTIQUOT", "rec"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'let_binding list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], - Gramext.action - (fun (l : 'a_list) (r : string) _ (loc : int * int) -> - (let _ = warn_antiq loc "3.06+18" in - Qast.Node ("StVal", [Qast.Loc; antiquot "rec" loc r; l]) : - 'str_item))]]; - Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), - Some (Gramext.Level "top"), - [None, None, - [[Gramext.Stoken ("", "let"); Gramext.Stoken ("ANTIQUOT", "rec"); - Gramext.srules - [[Gramext.Slist1sep - (Gramext.Snterm - (Grammar.Entry.obj - (let_binding : 'let_binding Grammar.Entry.e)), - Gramext.Stoken ("", "and"))], - Gramext.action - (fun (a : 'let_binding list) (loc : int * int) -> - (Qast.List a : 'a_list)); - [Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; - Gramext.Stoken ("", "in"); Gramext.Sself], - Gramext.action - (fun (ce : 'class_expr) _ (lb : 'a_list) (r : string) _ - (loc : int * int) -> - (let _ = warn_antiq loc "3.06+18" in - Qast.Node ("CeLet", [Qast.Loc; antiquot "rec" loc r; lb; ce]) : - 'class_expr))]]; - Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "value"); Gramext.Stoken ("ANTIQUOT", "mut"); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj - (cvalue_binding : 'cvalue_binding Grammar.Entry.e))], - Gramext.action - (fun (e : 'cvalue_binding) (lab : 'label) (mf : string) _ - (loc : int * int) -> - (let _ = warn_antiq loc "3.06+18" in - Qast.Node ("CrVal", [Qast.Loc; lab; antiquot "mut" loc mf; e]) : - 'class_str_item)); - [Gramext.Stoken ("", "inherit"); - Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e)); - Gramext.Stoken ("ANTIQUOT", "as")], - Gramext.action - (fun (pb : string) (ce : 'class_expr) _ (loc : int * int) -> - (let _ = warn_antiq loc "3.06+18" in - Qast.Node ("CrInh", [Qast.Loc; ce; antiquot "as" loc pb]) : - 'class_str_item))]]; - Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("", "value"); Gramext.Stoken ("ANTIQUOT", "mut"); - Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); - Gramext.Stoken ("", ":"); - Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], - Gramext.action - (fun (t : 'ctyp) _ (l : 'label) (mf : string) _ (loc : int * int) -> - (let _ = warn_antiq loc "3.06+18" in - Qast.Node ("CgVal", [Qast.Loc; l; antiquot "mut" loc mf; t]) : - 'class_sig_item))]]]) +Grammar.extend + (let _ = (sig_item : 'sig_item Grammar.Entry.e) + and _ = (str_item : 'str_item Grammar.Entry.e) + and _ = (ctyp : 'ctyp Grammar.Entry.e) + and _ = (patt : 'patt Grammar.Entry.e) + and _ = (expr : 'expr Grammar.Entry.e) + and _ = (module_type : 'module_type Grammar.Entry.e) + and _ = (module_expr : 'module_expr Grammar.Entry.e) + and _ = (class_type : 'class_type Grammar.Entry.e) + and _ = (class_expr : 'class_expr Grammar.Entry.e) + and _ = (class_sig_item : 'class_sig_item Grammar.Entry.e) + and _ = (class_str_item : 'class_str_item Grammar.Entry.e) + and _ = (let_binding : 'let_binding Grammar.Entry.e) + and _ = (type_declaration : 'type_declaration Grammar.Entry.e) + and _ = (ipatt : 'ipatt Grammar.Entry.e) + and _ = (with_constr : 'with_constr Grammar.Entry.e) + and _ = (row_field : 'row_field Grammar.Entry.e) in + let grammar_entry_create s = + Grammar.Entry.create (Grammar.of_entry sig_item) s + in + let rebind_exn : 'rebind_exn Grammar.Entry.e = + grammar_entry_create "rebind_exn" + and module_binding : 'module_binding Grammar.Entry.e = + grammar_entry_create "module_binding" + and module_rec_binding : 'module_rec_binding Grammar.Entry.e = + grammar_entry_create "module_rec_binding" + and module_declaration : 'module_declaration Grammar.Entry.e = + grammar_entry_create "module_declaration" + and module_rec_declaration : 'module_rec_declaration Grammar.Entry.e = + grammar_entry_create "module_rec_declaration" + and cons_expr_opt : 'cons_expr_opt Grammar.Entry.e = + grammar_entry_create "cons_expr_opt" + and dummy : 'dummy Grammar.Entry.e = grammar_entry_create "dummy" + and fun_binding : 'fun_binding Grammar.Entry.e = + grammar_entry_create "fun_binding" + and match_case : 'match_case Grammar.Entry.e = + grammar_entry_create "match_case" + and as_patt_opt : 'as_patt_opt Grammar.Entry.e = + grammar_entry_create "as_patt_opt" + and label_expr : 'label_expr Grammar.Entry.e = + grammar_entry_create "label_expr" + and fun_def : 'fun_def Grammar.Entry.e = grammar_entry_create "fun_def" + and cons_patt_opt : 'cons_patt_opt Grammar.Entry.e = + grammar_entry_create "cons_patt_opt" + and label_patt : 'label_patt Grammar.Entry.e = + grammar_entry_create "label_patt" + and label_ipatt : 'label_ipatt Grammar.Entry.e = + grammar_entry_create "label_ipatt" + and type_patt : 'type_patt Grammar.Entry.e = + grammar_entry_create "type_patt" + and constrain : 'constrain Grammar.Entry.e = + grammar_entry_create "constrain" + and type_parameter : 'type_parameter Grammar.Entry.e = + grammar_entry_create "type_parameter" + and constructor_declaration : 'constructor_declaration Grammar.Entry.e = + grammar_entry_create "constructor_declaration" + and label_declaration : 'label_declaration Grammar.Entry.e = + grammar_entry_create "label_declaration" + and ident : 'ident Grammar.Entry.e = grammar_entry_create "ident" + and class_declaration : 'class_declaration Grammar.Entry.e = + grammar_entry_create "class_declaration" + and class_fun_binding : 'class_fun_binding Grammar.Entry.e = + grammar_entry_create "class_fun_binding" + and class_type_parameters : 'class_type_parameters Grammar.Entry.e = + grammar_entry_create "class_type_parameters" + and class_fun_def : 'class_fun_def Grammar.Entry.e = + grammar_entry_create "class_fun_def" + and class_structure : 'class_structure Grammar.Entry.e = + grammar_entry_create "class_structure" + and class_self_patt : 'class_self_patt Grammar.Entry.e = + grammar_entry_create "class_self_patt" + and as_lident : 'as_lident Grammar.Entry.e = + grammar_entry_create "as_lident" + and polyt : 'polyt Grammar.Entry.e = grammar_entry_create "polyt" + and cvalue_binding : 'cvalue_binding Grammar.Entry.e = + grammar_entry_create "cvalue_binding" + and label : 'label Grammar.Entry.e = grammar_entry_create "label" + and class_self_type : 'class_self_type Grammar.Entry.e = + grammar_entry_create "class_self_type" + and class_description : 'class_description Grammar.Entry.e = + grammar_entry_create "class_description" + and class_type_declaration : 'class_type_declaration Grammar.Entry.e = + grammar_entry_create "class_type_declaration" + and field_expr : 'field_expr Grammar.Entry.e = + grammar_entry_create "field_expr" + and field : 'field Grammar.Entry.e = grammar_entry_create "field" + and typevar : 'typevar Grammar.Entry.e = grammar_entry_create "typevar" + and row_field_list : 'row_field_list Grammar.Entry.e = + grammar_entry_create "row_field_list" + and name_tag : 'name_tag Grammar.Entry.e = grammar_entry_create "name_tag" + and patt_tcon : 'patt_tcon Grammar.Entry.e = + grammar_entry_create "patt_tcon" + and ipatt_tcon : 'ipatt_tcon Grammar.Entry.e = + grammar_entry_create "ipatt_tcon" + and eq_expr : 'eq_expr Grammar.Entry.e = grammar_entry_create "eq_expr" + and warning_variant : 'warning_variant Grammar.Entry.e = + grammar_entry_create "warning_variant" + and warning_sequence : 'warning_sequence Grammar.Entry.e = + grammar_entry_create "warning_sequence" + and sequence : 'sequence Grammar.Entry.e = grammar_entry_create "sequence" + and expr_ident : 'expr_ident Grammar.Entry.e = + grammar_entry_create "expr_ident" + and patt_label_ident : 'patt_label_ident Grammar.Entry.e = + grammar_entry_create "patt_label_ident" + and when_expr_opt : 'when_expr_opt Grammar.Entry.e = + grammar_entry_create "when_expr_opt" + and mod_ident : 'mod_ident Grammar.Entry.e = + grammar_entry_create "mod_ident" + and clty_longident : 'clty_longident Grammar.Entry.e = + grammar_entry_create "clty_longident" + and class_longident : 'class_longident Grammar.Entry.e = + grammar_entry_create "class_longident" + and direction_flag : 'direction_flag Grammar.Entry.e = + grammar_entry_create "direction_flag" + in + [Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "struct"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (str_item : 'str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'str_item) (loc : int * int) -> + (s : 'e__1))])], + Gramext.action + (fun (a : 'e__1 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'a_list) _ (loc : int * int) -> + (Qast.Node ("MeStr", [Qast.Loc; st]) : 'module_expr)); + [Gramext.Stoken ("", "functor"); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", ")"); Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (me : 'module_expr) _ _ (t : 'module_type) _ (i : 'a_UIDENT) _ _ + (loc : int * int) -> + (Qast.Node ("MeFun", [Qast.Loc; i; t; me]) : 'module_expr))]; + None, None, + [[Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (me2 : 'module_expr) (me1 : 'module_expr) (loc : int * int) -> + (Qast.Node ("MeApp", [Qast.Loc; me1; me2]) : 'module_expr))]; + None, None, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (me2 : 'module_expr) _ (me1 : 'module_expr) (loc : int * int) -> + (Qast.Node ("MeAcc", [Qast.Loc; me1; me2]) : 'module_expr))]; + Some "simple", None, + [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (me : 'module_expr) _ (loc : int * int) -> + (me : 'module_expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (mt : 'module_type) _ (me : 'module_expr) _ + (loc : int * int) -> + (Qast.Node ("MeTyc", [Qast.Loc; me; mt]) : 'module_expr)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_UIDENT) (loc : int * int) -> + (Qast.Node ("MeUid", [Qast.Loc; i]) : 'module_expr))]]; + Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, + [Some "top", None, + [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) (loc : int * int) -> + (Qast.Node ("StExp", [Qast.Loc; e]) : 'str_item)); + [Gramext.Stoken ("", "value"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "rec")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__3))])], + Gramext.action + (fun (a : 'e__3 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'let_binding list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (l : 'a_list) (r : 'a_opt) _ (loc : int * int) -> + (Qast.Node ("StVal", [Qast.Loc; o2b r; l]) : 'str_item)); + [Gramext.Stoken ("", "type"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (type_declaration : 'type_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'type_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (tdl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("StTyp", [Qast.Loc; tdl]) : 'str_item)); + [Gramext.Stoken ("", "open"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'mod_ident) _ (loc : int * int) -> + (Qast.Node ("StOpn", [Qast.Loc; i]) : 'str_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "type"); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (i : 'a_UIDENT) _ _ (loc : int * int) -> + (Qast.Node ("StMty", [Qast.Loc; i; mt]) : 'str_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "rec"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (module_rec_binding : + 'module_rec_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'module_rec_binding list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (nmtmes : 'a_list) _ _ (loc : int * int) -> + (Qast.Node ("StRecMod", [Qast.Loc; nmtmes]) : 'str_item)); + [Gramext.Stoken ("", "module"); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (module_binding : 'module_binding Grammar.Entry.e))], + Gramext.action + (fun (mb : 'module_binding) (i : 'a_UIDENT) _ (loc : int * int) -> + (Qast.Node ("StMod", [Qast.Loc; i; mb]) : 'str_item)); + [Gramext.Stoken ("", "include"); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (loc : int * int) -> + (Qast.Node ("StInc", [Qast.Loc; me]) : 'str_item)); + [Gramext.Stoken ("", "external"); + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.srules + [[Gramext.Slist1 + (Gramext.Snterm + (Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e)))], + Gramext.action + (fun (a : 'a_STRING list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (pd : 'a_list) _ (t : 'ctyp) _ (i : 'a_LIDENT) _ + (loc : int * int) -> + (Qast.Node ("StExt", [Qast.Loc; i; t; pd]) : 'str_item)); + [Gramext.Stoken ("", "exception"); + Gramext.Snterm + (Grammar.Entry.obj + (constructor_declaration : + 'constructor_declaration Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e))], + Gramext.action + (fun (b : 'rebind_exn) (ctl : 'constructor_declaration) _ + (loc : int * int) -> + (let (_, c, tl) = + match ctl with + Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3 + | _ -> + match () with + _ -> raise (Match_failure ("q_MLast.ml", 300, 19)) + in + Qast.Node ("StExc", [Qast.Loc; c; tl; b]) : + 'str_item)); + [Gramext.Stoken ("", "declare"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (str_item : 'str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'str_item) (loc : int * int) -> + (s : 'e__2))])], + Gramext.action + (fun (a : 'e__2 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'a_list) _ (loc : int * int) -> + (Qast.Node ("StDcl", [Qast.Loc; st]) : 'str_item))]]; + Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e), None, + [None, None, + [[], + Gramext.action (fun (loc : int * int) -> (Qast.List [] : 'rebind_exn)); + [Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], + Gramext.action + (fun (sl : 'mod_ident) _ (loc : int * int) -> (sl : 'rebind_exn))]]; + Grammar.Entry.obj (module_binding : 'module_binding Grammar.Entry.e), + None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (loc : int * int) -> + (me : 'module_binding)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (mt : 'module_type) _ (loc : int * int) -> + (Qast.Node ("MeTyc", [Qast.Loc; me; mt]) : 'module_binding)); + [Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", ")"); Gramext.Sself], + Gramext.action + (fun (mb : 'module_binding) _ (mt : 'module_type) _ (m : 'a_UIDENT) _ + (loc : int * int) -> + (Qast.Node ("MeFun", [Qast.Loc; m; mt; mb]) : 'module_binding))]]; + Grammar.Entry.obj + (module_rec_binding : 'module_rec_binding Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (mt : 'module_type) _ (m : 'a_UIDENT) + (loc : int * int) -> + (Qast.Tuple [m; me; mt] : 'module_rec_binding))]]; + Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "functor"); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself; Gramext.Stoken ("", ")"); + Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (mt : 'module_type) _ _ (t : 'module_type) _ (i : 'a_UIDENT) _ _ + (loc : int * int) -> + (Qast.Node ("MtFun", [Qast.Loc; i; t; mt]) : 'module_type))]; + None, None, + [[Gramext.Sself; Gramext.Stoken ("", "with"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (with_constr : 'with_constr Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'with_constr list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (wcl : 'a_list) _ (mt : 'module_type) (loc : int * int) -> + (Qast.Node ("MtWit", [Qast.Loc; mt; wcl]) : 'module_type))]; + None, None, + [[Gramext.Stoken ("", "sig"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (sig_item : 'sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'sig_item) (loc : int * int) -> + (s : 'e__4))])], + Gramext.action + (fun (a : 'e__4 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (sg : 'a_list) _ (loc : int * int) -> + (Qast.Node ("MtSig", [Qast.Loc; sg]) : 'module_type))]; + None, None, + [[Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (m2 : 'module_type) (m1 : 'module_type) (loc : int * int) -> + (Qast.Node ("MtApp", [Qast.Loc; m1; m2]) : 'module_type))]; + None, None, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (m2 : 'module_type) _ (m1 : 'module_type) (loc : int * int) -> + (Qast.Node ("MtAcc", [Qast.Loc; m1; m2]) : 'module_type))]; + Some "simple", None, + [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (mt : 'module_type) _ (loc : int * int) -> + (mt : 'module_type)); + [Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> + (Qast.Node ("MtQuo", [Qast.Loc; i]) : 'module_type)); + [Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> + (Qast.Node ("MtLid", [Qast.Loc; i]) : 'module_type)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_UIDENT) (loc : int * int) -> + (Qast.Node ("MtUid", [Qast.Loc; i]) : 'module_type))]]; + Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, + [Some "top", None, + [[Gramext.Stoken ("", "value"); + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (i : 'a_LIDENT) _ (loc : int * int) -> + (Qast.Node ("SgVal", [Qast.Loc; i; t]) : 'sig_item)); + [Gramext.Stoken ("", "type"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (type_declaration : 'type_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'type_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (tdl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("SgTyp", [Qast.Loc; tdl]) : 'sig_item)); + [Gramext.Stoken ("", "open"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'mod_ident) _ (loc : int * int) -> + (Qast.Node ("SgOpn", [Qast.Loc; i]) : 'sig_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "rec"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (module_rec_declaration : + 'module_rec_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'module_rec_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (mds : 'a_list) _ _ (loc : int * int) -> + (Qast.Node ("SgRecMod", [Qast.Loc; mds]) : 'sig_item)); + [Gramext.Stoken ("", "module"); Gramext.Stoken ("", "type"); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (i : 'a_UIDENT) _ _ (loc : int * int) -> + (Qast.Node ("SgMty", [Qast.Loc; i; mt]) : 'sig_item)); + [Gramext.Stoken ("", "module"); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (module_declaration : 'module_declaration Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_declaration) (i : 'a_UIDENT) _ (loc : int * int) -> + (Qast.Node ("SgMod", [Qast.Loc; i; mt]) : 'sig_item)); + [Gramext.Stoken ("", "include"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (loc : int * int) -> + (Qast.Node ("SgInc", [Qast.Loc; mt]) : 'sig_item)); + [Gramext.Stoken ("", "external"); + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.srules + [[Gramext.Slist1 + (Gramext.Snterm + (Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e)))], + Gramext.action + (fun (a : 'a_STRING list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (pd : 'a_list) _ (t : 'ctyp) _ (i : 'a_LIDENT) _ + (loc : int * int) -> + (Qast.Node ("SgExt", [Qast.Loc; i; t; pd]) : 'sig_item)); + [Gramext.Stoken ("", "exception"); + Gramext.Snterm + (Grammar.Entry.obj + (constructor_declaration : + 'constructor_declaration Grammar.Entry.e))], + Gramext.action + (fun (ctl : 'constructor_declaration) _ (loc : int * int) -> + (let (_, c, tl) = + match ctl with + Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3 + | _ -> + match () with + _ -> raise (Match_failure ("q_MLast.ml", 358, 19)) + in + Qast.Node ("SgExc", [Qast.Loc; c; tl]) : + 'sig_item)); + [Gramext.Stoken ("", "declare"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (sig_item : 'sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'sig_item) (loc : int * int) -> + (s : 'e__5))])], + Gramext.action + (fun (a : 'e__5 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'a_list) _ (loc : int * int) -> + (Qast.Node ("SgDcl", [Qast.Loc; st]) : 'sig_item))]]; + Grammar.Entry.obj + (module_declaration : 'module_declaration Grammar.Entry.e), + None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("", ")"); Gramext.Sself], + Gramext.action + (fun (mt : 'module_declaration) _ (t : 'module_type) _ (i : 'a_UIDENT) + _ (loc : int * int) -> + (Qast.Node ("MtFun", [Qast.Loc; i; t; mt]) : 'module_declaration)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (loc : int * int) -> + (mt : 'module_declaration))]]; + Grammar.Entry.obj + (module_rec_declaration : 'module_rec_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e))], + Gramext.action + (fun (mt : 'module_type) _ (m : 'a_UIDENT) (loc : int * int) -> + (Qast.Tuple [m; mt] : 'module_rec_declaration))]]; + Grammar.Entry.obj (with_constr : 'with_constr Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "module"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e))], + Gramext.action + (fun (me : 'module_expr) _ (i : 'mod_ident) _ (loc : int * int) -> + (Qast.Node ("WcMod", [Qast.Loc; i; me]) : 'with_constr)); + [Gramext.Stoken ("", "type"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e)); + Gramext.srules + [[Gramext.Slist0 + (Gramext.Snterm + (Grammar.Entry.obj + (type_parameter : 'type_parameter Grammar.Entry.e)))], + Gramext.action + (fun (a : 'type_parameter list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (tpl : 'a_list) (i : 'mod_ident) _ + (loc : int * int) -> + (Qast.Node ("WcTyp", [Qast.Loc; i; tpl; t]) : 'with_constr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), None, + [Some "top", Some Gramext.RightA, + [[Gramext.Stoken ("", "while"); Gramext.Sself; Gramext.Stoken ("", "do"); + Gramext.Stoken ("", "{"); + Gramext.Snterm + (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (seq : 'sequence) _ _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExWhi", [Qast.Loc; e; seq]) : 'expr)); + [Gramext.Stoken ("", "for"); + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "="); Gramext.Sself; + Gramext.Snterm + (Grammar.Entry.obj + (direction_flag : 'direction_flag Grammar.Entry.e)); + Gramext.Sself; Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); + Gramext.Snterm + (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (seq : 'sequence) _ _ (e2 : 'expr) (df : 'direction_flag) + (e1 : 'expr) _ (i : 'a_LIDENT) _ (loc : int * int) -> + (Qast.Node ("ExFor", [Qast.Loc; i; e1; e2; df; seq]) : 'expr)); + [Gramext.Stoken ("", "do"); Gramext.Stoken ("", "{"); + Gramext.Snterm + (Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e)); + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (seq : 'sequence) _ _ (loc : int * int) -> + (mksequence Qast.Loc seq : 'expr)); + [Gramext.Stoken ("", "if"); Gramext.Sself; Gramext.Stoken ("", "then"); + Gramext.Sself; Gramext.Stoken ("", "else"); Gramext.Sself], + Gramext.action + (fun (e3 : 'expr) _ (e2 : 'expr) _ (e1 : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExIfe", [Qast.Loc; e1; e2; e3]) : 'expr)); + [Gramext.Stoken ("", "try"); Gramext.Sself; Gramext.Stoken ("", "with"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (e1 : 'expr) _ (p1 : 'ipatt) _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node + ("ExTry", + [Qast.Loc; e; + Qast.List [Qast.Tuple [p1; Qast.Option None; e1]]]) : + 'expr)); + [Gramext.Stoken ("", "try"); Gramext.Sself; Gramext.Stoken ("", "with"); + Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj + (match_case : 'match_case Grammar.Entry.e)), + Gramext.Stoken ("", "|"))], + Gramext.action + (fun (a : 'match_case list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (l : 'a_list) _ _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExTry", [Qast.Loc; e; l]) : 'expr)); + [Gramext.Stoken ("", "match"); Gramext.Sself; + Gramext.Stoken ("", "with"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (e1 : 'expr) _ (p1 : 'ipatt) _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node + ("ExMat", + [Qast.Loc; e; + Qast.List [Qast.Tuple [p1; Qast.Option None; e1]]]) : + 'expr)); + [Gramext.Stoken ("", "match"); Gramext.Sself; + Gramext.Stoken ("", "with"); Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj + (match_case : 'match_case Grammar.Entry.e)), + Gramext.Stoken ("", "|"))], + Gramext.action + (fun (a : 'match_case list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (l : 'a_list) _ _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExMat", [Qast.Loc; e; l]) : 'expr)); + [Gramext.Stoken ("", "fun"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (fun_def : 'fun_def Grammar.Entry.e))], + Gramext.action + (fun (e : 'fun_def) (p : 'ipatt) _ (loc : int * int) -> + (Qast.Node + ("ExFun", + [Qast.Loc; Qast.List [Qast.Tuple [p; Qast.Option None; e]]]) : + 'expr)); + [Gramext.Stoken ("", "fun"); Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj + (match_case : 'match_case Grammar.Entry.e)), + Gramext.Stoken ("", "|"))], + Gramext.action + (fun (a : 'match_case list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (l : 'a_list) _ _ (loc : int * int) -> + (Qast.Node ("ExFun", [Qast.Loc; l]) : 'expr)); + [Gramext.Stoken ("", "let"); Gramext.Stoken ("", "module"); + Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (module_binding : 'module_binding Grammar.Entry.e)); + Gramext.Stoken ("", "in"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (mb : 'module_binding) (m : 'a_UIDENT) _ _ + (loc : int * int) -> + (Qast.Node ("ExLmd", [Qast.Loc; m; mb; e]) : 'expr)); + [Gramext.Stoken ("", "let"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "rec")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__6))])], + Gramext.action + (fun (a : 'e__6 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'let_binding list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "in"); Gramext.Sself], + Gramext.action + (fun (x : 'expr) _ (l : 'a_list) (r : 'a_opt) _ (loc : int * int) -> + (Qast.Node ("ExLet", [Qast.Loc; o2b r; l; x]) : 'expr))]; + Some "where", None, + [[Gramext.Sself; Gramext.Stoken ("", "where"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "rec")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__7))])], + Gramext.action + (fun (a : 'e__7 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm + (Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e))], + Gramext.action + (fun (lb : 'let_binding) (rf : 'a_opt) _ (e : 'expr) + (loc : int * int) -> + (Qast.Node ("ExLet", [Qast.Loc; o2b rf; Qast.List [lb]; e]) : + 'expr))]; + Some ":=", Some Gramext.NonA, + [[Gramext.Sself; Gramext.Stoken ("", ":="); Gramext.Sself; + Gramext.Snterm (Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e))], + Gramext.action + (fun _ (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node ("ExAss", [Qast.Loc; e1; e2]) : 'expr))]; + Some "||", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "||"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "||"]); + e1]); + e2]) : + 'expr))]; + Some "&&", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "&&"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "&&"]); + e1]); + e2]) : + 'expr))]; + Some "<", Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "!="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "!="]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "=="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "=="]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "<>"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "<>"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "="]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", ">="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str ">="]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "<="); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "<="]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", ">"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str ">"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "<"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "<"]); + e1]); + e2]) : + 'expr))]; + Some "^", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "@"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "@"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "^"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "^"]); + e1]); + e2]) : + 'expr))]; + Some "+", Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "-."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "-."]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "+."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "+."]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "-"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "-"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "+"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "+"]); + e1]); + e2]) : + 'expr))]; + Some "*", Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "mod"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "mod"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "lxor"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node ("ExLid", [Qast.Loc; Qast.Str "lxor"]); e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "lor"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "lor"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "land"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node ("ExLid", [Qast.Loc; Qast.Str "land"]); e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "/."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "/."]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "*."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "*."]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "/"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "/"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "*"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "*"]); + e1]); + e2]) : + 'expr))]; + Some "**", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "lsr"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "lsr"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "lsl"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "lsl"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "asr"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "asr"]); + e1]); + e2]) : + 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "**"); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; + Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "**"]); + e1]); + e2]) : + 'expr))]; + Some "unary minus", Some Gramext.NonA, + [[Gramext.Stoken ("", "-."); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (mkumin Qast.Loc (Qast.Str "-.") e : 'expr)); + [Gramext.Stoken ("", "-"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (mkumin Qast.Loc (Qast.Str "-") e : 'expr))]; + Some "apply", Some Gramext.LeftA, + [[Gramext.Stoken ("", "lazy"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExLaz", [Qast.Loc; e]) : 'expr)); + [Gramext.Stoken ("", "assert"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (mkassert Qast.Loc e : 'expr)); + [Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) (e1 : 'expr) (loc : int * int) -> + (Qast.Node ("ExApp", [Qast.Loc; e1; e2]) : 'expr))]; + Some ".", Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (e2 : 'expr) _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node ("ExAcc", [Qast.Loc; e1; e2]) : 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Stoken ("", "["); + Gramext.Sself; Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (e2 : 'expr) _ _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node ("ExSte", [Qast.Loc; e1; e2]) : 'expr)); + [Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Stoken ("", "("); + Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (e2 : 'expr) _ _ (e1 : 'expr) (loc : int * int) -> + (Qast.Node ("ExAre", [Qast.Loc; e1; e2]) : 'expr))]; + Some "~-", Some Gramext.NonA, + [[Gramext.Stoken ("", "~-."); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "~-."]); + e]) : + 'expr)); + [Gramext.Stoken ("", "~-"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (Qast.Node + ("ExApp", + [Qast.Loc; Qast.Node ("ExLid", [Qast.Loc; Qast.Str "~-"]); + e]) : + 'expr))]; + Some "simple", None, + [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action (fun _ (e : 'expr) _ (loc : int * int) -> (e : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), + Gramext.Stoken ("", ","))], + Gramext.action + (fun (a : 'expr list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (el : 'a_list) _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExTup", [Qast.Loc; Qast.Cons (e, el)]) : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExTyc", [Qast.Loc; e; t]) : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], + Gramext.action + (fun _ _ (loc : int * int) -> + (Qast.Node ("ExUid", [Qast.Loc; Qast.Str "()"]) : 'expr)); + [Gramext.Stoken ("", "{"); Gramext.Stoken ("", "("); Gramext.Sself; + Gramext.Stoken ("", ")"); Gramext.Stoken ("", "with"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (label_expr : 'label_expr Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'label_expr list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (lel : 'a_list) _ _ (e : 'expr) _ _ (loc : int * int) -> + (Qast.Node ("ExRec", [Qast.Loc; lel; Qast.Option (Some e)]) : + 'expr)); + [Gramext.Stoken ("", "{"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (label_expr : 'label_expr Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'label_expr list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (lel : 'a_list) _ (loc : int * int) -> + (Qast.Node ("ExRec", [Qast.Loc; lel; Qast.Option None]) : 'expr)); + [Gramext.Stoken ("", "[|"); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'expr list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (el : 'a_list) _ (loc : int * int) -> + (Qast.Node ("ExArr", [Qast.Loc; el]) : 'expr)); + [Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'expr list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Snterm + (Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (last : 'cons_expr_opt) (el : 'a_list) _ (loc : int * int) -> + (mklistexp Qast.Loc last el : 'expr)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")], + Gramext.action + (fun _ _ (loc : int * int) -> + (Qast.Node ("ExUid", [Qast.Loc; Qast.Str "[]"]) : 'expr)); + [Gramext.Snterm + (Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e))], + Gramext.action (fun (i : 'expr_ident) (loc : int * int) -> (i : 'expr)); + [Gramext.Snterm (Grammar.Entry.obj (a_CHAR : 'a_CHAR Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_CHAR) (loc : int * int) -> + (Qast.Node ("ExChr", [Qast.Loc; s]) : 'expr)); + [Gramext.Snterm + (Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_STRING) (loc : int * int) -> + (Qast.Node ("ExStr", [Qast.Loc; s]) : 'expr)); + [Gramext.Snterm + (Grammar.Entry.obj (a_FLOAT : 'a_FLOAT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_FLOAT) (loc : int * int) -> + (Qast.Node ("ExFlo", [Qast.Loc; s]) : 'expr)); + [Gramext.Snterm (Grammar.Entry.obj (a_INT : 'a_INT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_INT) (loc : int * int) -> + (Qast.Node ("ExInt", [Qast.Loc; s]) : 'expr))]]; + Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e), None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> (Qast.Option None : 'cons_expr_opt)); + [Gramext.Stoken ("", "::"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (Qast.Option (Some e) : 'cons_expr_opt))]]; + Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e), None, + [None, None, + [[], Gramext.action (fun (loc : int * int) -> (() : 'dummy))]]; + Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) (loc : int * int) -> (Qast.List [e] : 'sequence)); + [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (e : 'expr) (loc : int * int) -> (Qast.List [e] : 'sequence)); + [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";"); Gramext.Sself], + Gramext.action + (fun (el : 'sequence) _ (e : 'expr) (loc : int * int) -> + (Qast.Cons (e, el) : 'sequence)); + [Gramext.Stoken ("", "let"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "rec")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__8))])], + Gramext.action + (fun (a : 'e__8 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'let_binding list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.srules + [[Gramext.Stoken ("", ";")], + Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__9)); + [Gramext.Stoken ("", "in")], + Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__9))]; + Gramext.Sself], + Gramext.action + (fun (el : 'sequence) _ (l : 'a_list) (rf : 'a_opt) _ + (loc : int * int) -> + (Qast.List + [Qast.Node + ("ExLet", [Qast.Loc; o2b rf; l; mksequence Qast.Loc el])] : + 'sequence))]]; + Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'fun_binding) (p : 'ipatt) (loc : int * int) -> + (Qast.Tuple [p; e] : 'let_binding))]]; + Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e), None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> + (Qast.Node ("ExTyc", [Qast.Loc; e; t]) : 'fun_binding)); + [Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (e : 'fun_binding)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (e : 'fun_binding) (p : 'ipatt) (loc : int * int) -> + (Qast.Node + ("ExFun", + [Qast.Loc; Qast.List [Qast.Tuple [p; Qast.Option None; e]]]) : + 'fun_binding))]]; + Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e)); + Gramext.Stoken ("", "->"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (w : 'when_expr_opt) (aso : 'as_patt_opt) + (p : 'patt) (loc : int * int) -> + (mkmatchcase Qast.Loc p aso w e : 'match_case))]]; + Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e), None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> (Qast.Option None : 'as_patt_opt)); + [Gramext.Stoken ("", "as"); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], + Gramext.action + (fun (p : 'patt) _ (loc : int * int) -> + (Qast.Option (Some p) : 'as_patt_opt))]]; + Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> (Qast.Option None : 'when_expr_opt)); + [Gramext.Stoken ("", "when"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> + (Qast.Option (Some e) : 'when_expr_opt))]]; + Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj + (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'fun_binding) (i : 'patt_label_ident) (loc : int * int) -> + (Qast.Tuple [i; e] : 'label_expr))]]; + Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e), None, + [None, Some Gramext.RightA, + [[Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (j : 'expr_ident) _ (i : 'a_UIDENT) (loc : int * int) -> + (mkexprident Qast.Loc i j : 'expr_ident)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_UIDENT) (loc : int * int) -> + (Qast.Node ("ExUid", [Qast.Loc; i]) : 'expr_ident)); + [Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> + (Qast.Node ("ExLid", [Qast.Loc; i]) : 'expr_ident))]]; + Grammar.Entry.obj (fun_def : 'fun_def Grammar.Entry.e), None, + [None, Some Gramext.RightA, + [[Gramext.Stoken ("", "->"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action (fun (e : 'expr) _ (loc : int * int) -> (e : 'fun_def)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (e : 'fun_def) (p : 'ipatt) (loc : int * int) -> + (Qast.Node + ("ExFun", + [Qast.Loc; Qast.List [Qast.Tuple [p; Qast.Option None; e]]]) : + 'fun_def))]]; + Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), None, + [None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "|"); Gramext.Sself], + Gramext.action + (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> + (Qast.Node ("PaOrp", [Qast.Loc; p1; p2]) : 'patt))]; + None, Some Gramext.NonA, + [[Gramext.Sself; Gramext.Stoken ("", ".."); Gramext.Sself], + Gramext.action + (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> + (Qast.Node ("PaRng", [Qast.Loc; p1; p2]) : 'patt))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (p2 : 'patt) (p1 : 'patt) (loc : int * int) -> + (Qast.Node ("PaApp", [Qast.Loc; p1; p2]) : 'patt))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (p2 : 'patt) _ (p1 : 'patt) (loc : int * int) -> + (Qast.Node ("PaAcc", [Qast.Loc; p1; p2]) : 'patt))]; + Some "simple", None, + [[Gramext.Stoken ("", "_")], + Gramext.action + (fun _ (loc : int * int) -> + (Qast.Node ("PaAny", [Qast.Loc]) : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), + Gramext.Stoken ("", ","))], + Gramext.action + (fun (a : 'patt list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (pl : 'a_list) _ (p : 'patt) _ (loc : int * int) -> + (Qast.Node ("PaTup", [Qast.Loc; Qast.Cons (p, pl)]) : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "as"); + Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (p2 : 'patt) _ (p : 'patt) _ (loc : int * int) -> + (Qast.Node ("PaAli", [Qast.Loc; p; p2]) : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) -> + (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'patt)); + [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], + Gramext.action + (fun _ _ (loc : int * int) -> + (Qast.Node ("PaUid", [Qast.Loc; Qast.Str "()"]) : 'patt)); + [Gramext.Stoken ("", "{"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (label_patt : 'label_patt Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'label_patt list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (lpl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("PaRec", [Qast.Loc; lpl]) : 'patt)); + [Gramext.Stoken ("", "[|"); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'patt list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (pl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("PaArr", [Qast.Loc; pl]) : 'patt)); + [Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'patt list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Snterm + (Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (last : 'cons_patt_opt) (pl : 'a_list) _ (loc : int * int) -> + (mklistpat Qast.Loc last pl : 'patt)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")], + Gramext.action + (fun _ _ (loc : int * int) -> + (Qast.Node ("PaUid", [Qast.Loc; Qast.Str "[]"]) : 'patt)); + [Gramext.Stoken ("", "-"); + Gramext.Snterm + (Grammar.Entry.obj (a_FLOAT : 'a_FLOAT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_FLOAT) _ (loc : int * int) -> + (mkuminpat Qast.Loc (Qast.Str "-") (Qast.Bool false) s : 'patt)); + [Gramext.Stoken ("", "-"); + Gramext.Snterm (Grammar.Entry.obj (a_INT : 'a_INT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_INT) _ (loc : int * int) -> + (mkuminpat Qast.Loc (Qast.Str "-") (Qast.Bool true) s : 'patt)); + [Gramext.Snterm (Grammar.Entry.obj (a_CHAR : 'a_CHAR Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_CHAR) (loc : int * int) -> + (Qast.Node ("PaChr", [Qast.Loc; s]) : 'patt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_STRING) (loc : int * int) -> + (Qast.Node ("PaStr", [Qast.Loc; s]) : 'patt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_FLOAT : 'a_FLOAT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_FLOAT) (loc : int * int) -> + (Qast.Node ("PaFlo", [Qast.Loc; s]) : 'patt)); + [Gramext.Snterm (Grammar.Entry.obj (a_INT : 'a_INT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_INT) (loc : int * int) -> + (Qast.Node ("PaInt", [Qast.Loc; s]) : 'patt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_UIDENT) (loc : int * int) -> + (Qast.Node ("PaUid", [Qast.Loc; s]) : 'patt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_LIDENT) (loc : int * int) -> + (Qast.Node ("PaLid", [Qast.Loc; s]) : 'patt))]]; + Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e), None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> (Qast.Option None : 'cons_patt_opt)); + [Gramext.Stoken ("", "::"); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], + Gramext.action + (fun (p : 'patt) _ (loc : int * int) -> + (Qast.Option (Some p) : 'cons_patt_opt))]]; + Grammar.Entry.obj (label_patt : 'label_patt Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj + (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], + Gramext.action + (fun (p : 'patt) _ (i : 'patt_label_ident) (loc : int * int) -> + (Qast.Tuple [i; p] : 'label_patt))]]; + Grammar.Entry.obj (patt_label_ident : 'patt_label_ident Grammar.Entry.e), + None, + [None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (p2 : 'patt_label_ident) _ (p1 : 'patt_label_ident) + (loc : int * int) -> + (Qast.Node ("PaAcc", [Qast.Loc; p1; p2]) : 'patt_label_ident))]; + Some "simple", Some Gramext.RightA, + [[Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> + (Qast.Node ("PaLid", [Qast.Loc; i]) : 'patt_label_ident)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_UIDENT) (loc : int * int) -> + (Qast.Node ("PaUid", [Qast.Loc; i]) : 'patt_label_ident))]]; + Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "_")], + Gramext.action + (fun _ (loc : int * int) -> + (Qast.Node ("PaAny", [Qast.Loc]) : 'ipatt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (s : 'a_LIDENT) (loc : int * int) -> + (Qast.Node ("PaLid", [Qast.Loc; s]) : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ","); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)), + Gramext.Stoken ("", ","))], + Gramext.action + (fun (a : 'ipatt list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (pl : 'a_list) _ (p : 'ipatt) _ (loc : int * int) -> + (Qast.Node ("PaTup", [Qast.Loc; Qast.Cons (p, pl)]) : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "as"); + Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (p2 : 'ipatt) _ (p : 'ipatt) _ (loc : int * int) -> + (Qast.Node ("PaAli", [Qast.Loc; p; p2]) : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (p : 'ipatt) _ (loc : int * int) -> + (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action (fun _ (p : 'ipatt) _ (loc : int * int) -> (p : 'ipatt)); + [Gramext.Stoken ("", "("); Gramext.Stoken ("", ")")], + Gramext.action + (fun _ _ (loc : int * int) -> + (Qast.Node ("PaUid", [Qast.Loc; Qast.Str "()"]) : 'ipatt)); + [Gramext.Stoken ("", "{"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (label_ipatt : 'label_ipatt Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'label_ipatt list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (lpl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("PaRec", [Qast.Loc; lpl]) : 'ipatt))]]; + Grammar.Entry.obj (label_ipatt : 'label_ipatt Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj + (patt_label_ident : 'patt_label_ident Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e))], + Gramext.action + (fun (p : 'ipatt) _ (i : 'patt_label_ident) (loc : int * int) -> + (Qast.Tuple [i; p] : 'label_ipatt))]]; + Grammar.Entry.obj (type_declaration : 'type_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (type_patt : 'type_patt Grammar.Entry.e)); + Gramext.srules + [[Gramext.Slist0 + (Gramext.Snterm + (Grammar.Entry.obj + (type_parameter : 'type_parameter Grammar.Entry.e)))], + Gramext.action + (fun (a : 'type_parameter list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.srules + [[Gramext.Slist0 + (Gramext.Snterm + (Grammar.Entry.obj + (constrain : 'constrain Grammar.Entry.e)))], + Gramext.action + (fun (a : 'constrain list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (cl : 'a_list) (tk : 'ctyp) _ (tpl : 'a_list) (n : 'type_patt) + (loc : int * int) -> + (Qast.Tuple [n; tpl; tk; cl] : 'type_declaration))]]; + Grammar.Entry.obj (type_patt : 'type_patt Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (n : 'a_LIDENT) (loc : int * int) -> + (Qast.Tuple [Qast.Loc; n] : 'type_patt))]]; + Grammar.Entry.obj (constrain : 'constrain Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "constraint"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> + (Qast.Tuple [t1; t2] : 'constrain))]]; + Grammar.Entry.obj (type_parameter : 'type_parameter Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "-"); Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ _ (loc : int * int) -> + (Qast.Tuple [i; Qast.Tuple [Qast.Bool false; Qast.Bool true]] : + 'type_parameter)); + [Gramext.Stoken ("", "+"); Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ _ (loc : int * int) -> + (Qast.Tuple [i; Qast.Tuple [Qast.Bool true; Qast.Bool false]] : + 'type_parameter)); + [Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> + (Qast.Tuple [i; Qast.Tuple [Qast.Bool false; Qast.Bool false]] : + 'type_parameter))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), None, + [None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "=="); Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> + (Qast.Node ("TyMan", [Qast.Loc; t1; t2]) : 'ctyp))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "as"); Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> + (Qast.Node ("TyAli", [Qast.Loc; t1; t2]) : 'ctyp))]; + None, Some Gramext.LeftA, + [[Gramext.Stoken ("", "!"); + Gramext.srules + [[Gramext.Slist1 + (Gramext.Snterm + (Grammar.Entry.obj (typevar : 'typevar Grammar.Entry.e)))], + Gramext.action + (fun (a : 'typevar list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (pl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("TyPol", [Qast.Loc; pl; t]) : 'ctyp))]; + Some "arrow", Some Gramext.RightA, + [[Gramext.Sself; Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> + (Qast.Node ("TyArr", [Qast.Loc; t1; t2]) : 'ctyp))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) (t1 : 'ctyp) (loc : int * int) -> + (Qast.Node ("TyApp", [Qast.Loc; t1; t2]) : 'ctyp))]; + None, Some Gramext.LeftA, + [[Gramext.Sself; Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> + (Qast.Node ("TyAcc", [Qast.Loc; t1; t2]) : 'ctyp))]; + Some "simple", None, + [[Gramext.Stoken ("", "{"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (label_declaration : 'label_declaration Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'label_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (ldl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("TyRec", [Qast.Loc; Qast.Bool false; ldl]) : 'ctyp)); + [Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj + (constructor_declaration : + 'constructor_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "|"))], + Gramext.action + (fun (a : 'constructor_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (cdl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("TySum", [Qast.Loc; Qast.Bool false; cdl]) : 'ctyp)); + [Gramext.Stoken ("", "private"); Gramext.Stoken ("", "{"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (label_declaration : 'label_declaration Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'label_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "}")], + Gramext.action + (fun _ (ldl : 'a_list) _ _ (loc : int * int) -> + (Qast.Node ("TyRec", [Qast.Loc; Qast.Bool true; ldl]) : 'ctyp)); + [Gramext.Stoken ("", "private"); Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj + (constructor_declaration : + 'constructor_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "|"))], + Gramext.action + (fun (a : 'constructor_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (cdl : 'a_list) _ _ (loc : int * int) -> + (Qast.Node ("TySum", [Qast.Loc; Qast.Bool true; cdl]) : 'ctyp)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'ctyp)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", "*"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", "*"))], + Gramext.action + (fun (a : 'ctyp list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (tl : 'a_list) _ (t : 'ctyp) _ (loc : int * int) -> + (Qast.Node ("TyTup", [Qast.Loc; Qast.Cons (t, tl)]) : 'ctyp)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_UIDENT) (loc : int * int) -> + (Qast.Node ("TyUid", [Qast.Loc; i]) : 'ctyp)); + [Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> + (Qast.Node ("TyLid", [Qast.Loc; i]) : 'ctyp)); + [Gramext.Stoken ("", "_")], + Gramext.action + (fun _ (loc : int * int) -> + (Qast.Node ("TyAny", [Qast.Loc]) : 'ctyp)); + [Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> + (Qast.Node ("TyQuo", [Qast.Loc; i]) : 'ctyp))]]; + Grammar.Entry.obj + (constructor_declaration : 'constructor_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action + (fun (ci : 'a_UIDENT) (loc : int * int) -> + (Qast.Tuple [Qast.Loc; ci; Qast.List []] : + 'constructor_declaration)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "of"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'ctyp list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (cal : 'a_list) _ (ci : 'a_UIDENT) (loc : int * int) -> + (Qast.Tuple [Qast.Loc; ci; cal] : 'constructor_declaration))]]; + Grammar.Entry.obj + (label_declaration : 'label_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "mutable")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__10))])], + Gramext.action + (fun (a : 'e__10 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) (mf : 'a_opt) _ (i : 'a_LIDENT) (loc : int * int) -> + (Qast.Tuple [Qast.Loc; i; o2b mf; t] : 'label_declaration))]]; + Grammar.Entry.obj (ident : 'ident Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action (fun (i : 'a_UIDENT) (loc : int * int) -> (i : 'ident)); + [Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> (i : 'ident))]]; + Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e), None, + [None, Some Gramext.RightA, + [[Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (j : 'mod_ident) _ (i : 'a_UIDENT) (loc : int * int) -> + (Qast.Cons (i, j) : 'mod_ident)); + [Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> + (Qast.List [i] : 'mod_ident)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_UIDENT) (loc : int * int) -> + (Qast.List [i] : 'mod_ident))]]; + Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (class_type_declaration : + 'class_type_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'class_type_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (ctd : 'a_list) _ _ (loc : int * int) -> + (Qast.Node ("StClt", [Qast.Loc; ctd]) : 'str_item)); + [Gramext.Stoken ("", "class"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (class_declaration : 'class_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'class_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (cd : 'a_list) _ (loc : int * int) -> + (Qast.Node ("StCls", [Qast.Loc; cd]) : 'str_item))]]; + Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (class_type_declaration : + 'class_type_declaration Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'class_type_declaration list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (ctd : 'a_list) _ _ (loc : int * int) -> + (Qast.Node ("SgClt", [Qast.Loc; ctd]) : 'sig_item)); + [Gramext.Stoken ("", "class"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (class_description : 'class_description Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'class_description list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (cd : 'a_list) _ (loc : int * int) -> + (Qast.Node ("SgCls", [Qast.Loc; cd]) : 'sig_item))]]; + Grammar.Entry.obj + (class_declaration : 'class_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "virtual")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__11))])], + Gramext.action + (fun (a : 'e__11 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (class_type_parameters : 'class_type_parameters Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (class_fun_binding : 'class_fun_binding Grammar.Entry.e))], + Gramext.action + (fun (cfb : 'class_fun_binding) (ctp : 'class_type_parameters) + (i : 'a_LIDENT) (vf : 'a_opt) (loc : int * int) -> + (Qast.Record + ["ciLoc", Qast.Loc; "ciVir", o2b vf; "ciPrm", ctp; "ciNam", i; + "ciExp", cfb] : + 'class_declaration))]]; + Grammar.Entry.obj + (class_fun_binding : 'class_fun_binding Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (cfb : 'class_fun_binding) (p : 'ipatt) (loc : int * int) -> + (Qast.Node ("CeFun", [Qast.Loc; p; cfb]) : 'class_fun_binding)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], + Gramext.action + (fun (ce : 'class_expr) _ (ct : 'class_type) _ (loc : int * int) -> + (Qast.Node ("CeTyc", [Qast.Loc; ce; ct]) : 'class_fun_binding)); + [Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], + Gramext.action + (fun (ce : 'class_expr) _ (loc : int * int) -> + (ce : 'class_fun_binding))]]; + Grammar.Entry.obj + (class_type_parameters : 'class_type_parameters Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (type_parameter : 'type_parameter Grammar.Entry.e)), + Gramext.Stoken ("", ","))], + Gramext.action + (fun (a : 'type_parameter list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (tpl : 'a_list) _ (loc : int * int) -> + (Qast.Tuple [Qast.Loc; tpl] : 'class_type_parameters)); + [], + Gramext.action + (fun (loc : int * int) -> + (Qast.Tuple [Qast.Loc; Qast.List []] : 'class_type_parameters))]]; + Grammar.Entry.obj (class_fun_def : 'class_fun_def Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "->"); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], + Gramext.action + (fun (ce : 'class_expr) _ (loc : int * int) -> (ce : 'class_fun_def)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (ce : 'class_fun_def) (p : 'ipatt) (loc : int * int) -> + (Qast.Node ("CeFun", [Qast.Loc; p; ce]) : 'class_fun_def))]]; + Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), None, + [Some "top", None, + [[Gramext.Stoken ("", "let"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "rec")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__12))])], + Gramext.action + (fun (a : 'e__12 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'let_binding list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "in"); Gramext.Sself], + Gramext.action + (fun (ce : 'class_expr) _ (lb : 'a_list) (rf : 'a_opt) _ + (loc : int * int) -> + (Qast.Node ("CeLet", [Qast.Loc; o2b rf; lb; ce]) : 'class_expr)); + [Gramext.Stoken ("", "fun"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (class_fun_def : 'class_fun_def Grammar.Entry.e))], + Gramext.action + (fun (ce : 'class_fun_def) (p : 'ipatt) _ (loc : int * int) -> + (Qast.Node ("CeFun", [Qast.Loc; p; ce]) : 'class_expr))]; + Some "apply", Some Gramext.NonA, + [[Gramext.Sself; + Gramext.Snterml + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), "label")], + Gramext.action + (fun (e : 'expr) (ce : 'class_expr) (loc : int * int) -> + (Qast.Node ("CeApp", [Qast.Loc; ce; e]) : 'class_expr))]; + Some "simple", None, + [[Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (ce : 'class_expr) _ (loc : int * int) -> (ce : 'class_expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (ct : 'class_type) _ (ce : 'class_expr) _ (loc : int * int) -> + (Qast.Node ("CeTyc", [Qast.Loc; ce; ct]) : 'class_expr)); + [Gramext.Stoken ("", "object"); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj + (class_self_patt : 'class_self_patt Grammar.Entry.e)))], + Gramext.action + (fun (a : 'class_self_patt option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm + (Grammar.Entry.obj + (class_structure : 'class_structure Grammar.Entry.e)); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (cf : 'class_structure) (cspo : 'a_opt) _ (loc : int * int) -> + (Qast.Node ("CeStr", [Qast.Loc; cspo; cf]) : 'class_expr)); + [Gramext.Snterm + (Grammar.Entry.obj + (class_longident : 'class_longident Grammar.Entry.e))], + Gramext.action + (fun (ci : 'class_longident) (loc : int * int) -> + (Qast.Node ("CeCon", [Qast.Loc; ci; Qast.List []]) : 'class_expr)); + [Gramext.Snterm + (Grammar.Entry.obj + (class_longident : 'class_longident Grammar.Entry.e)); + Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", ","))], + Gramext.action + (fun (a : 'ctyp list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (ctcl : 'a_list) _ (ci : 'class_longident) (loc : int * int) -> + (Qast.Node ("CeCon", [Qast.Loc; ci; ctcl]) : 'class_expr))]]; + Grammar.Entry.obj (class_structure : 'class_structure Grammar.Entry.e), + None, + [None, None, + [[Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_str_item : 'class_str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (cf : 'class_str_item) (loc : int * int) -> + (cf : 'e__13))])], + Gramext.action + (fun (a : 'e__13 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (cf : 'a_list) (loc : int * int) -> (cf : 'class_structure))]]; + Grammar.Entry.obj (class_self_patt : 'class_self_patt Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) -> + (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'class_self_patt)); + [Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'class_self_patt))]]; + Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "initializer"); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (se : 'expr) _ (loc : int * int) -> + (Qast.Node ("CrIni", [Qast.Loc; se]) : 'class_str_item)); + [Gramext.Stoken ("", "type"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> + (Qast.Node ("CrCtr", [Qast.Loc; t1; t2]) : 'class_str_item)); + [Gramext.Stoken ("", "method"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "private")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__17))])], + Gramext.action + (fun (a : 'e__17 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (polyt : 'polyt Grammar.Entry.e)))], + Gramext.action + (fun (a : 'polyt option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm + (Grammar.Entry.obj (fun_binding : 'fun_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'fun_binding) (topt : 'a_opt) (l : 'label) (pf : 'a_opt) _ + (loc : int * int) -> + (Qast.Node ("CrMth", [Qast.Loc; l; o2b pf; e; topt]) : + 'class_str_item)); + [Gramext.Stoken ("", "method"); Gramext.Stoken ("", "virtual"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "private")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__16))])], + Gramext.action + (fun (a : 'e__16 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (pf : 'a_opt) _ _ (loc : int * int) -> + (Qast.Node ("CrVir", [Qast.Loc; l; o2b pf; t]) : 'class_str_item)); + [Gramext.Stoken ("", "value"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "mutable")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__15))])], + Gramext.action + (fun (a : 'e__15 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (cvalue_binding : 'cvalue_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'cvalue_binding) (lab : 'label) (mf : 'a_opt) _ + (loc : int * int) -> + (Qast.Node ("CrVal", [Qast.Loc; lab; o2b mf; e]) : + 'class_str_item)); + [Gramext.Stoken ("", "inherit"); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e)); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj + (as_lident : 'as_lident Grammar.Entry.e)))], + Gramext.action + (fun (a : 'as_lident option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]], + Gramext.action + (fun (pb : 'a_opt) (ce : 'class_expr) _ (loc : int * int) -> + (Qast.Node ("CrInh", [Qast.Loc; ce; pb]) : 'class_str_item)); + [Gramext.Stoken ("", "declare"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_str_item : 'class_str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'class_str_item) (loc : int * int) -> + (s : 'e__14))])], + Gramext.action + (fun (a : 'e__14 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'a_list) _ (loc : int * int) -> + (Qast.Node ("CrDcl", [Qast.Loc; st]) : 'class_str_item))]]; + Grammar.Entry.obj (as_lident : 'as_lident Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "as"); + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) _ (loc : int * int) -> (i : 'as_lident))]]; + Grammar.Entry.obj (polyt : 'polyt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action (fun (t : 'ctyp) _ (loc : int * int) -> (t : 'polyt))]]; + Grammar.Entry.obj (cvalue_binding : 'cvalue_binding Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", ":>"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> + (Qast.Node ("ExCoe", [Qast.Loc; e; Qast.Option None; t]) : + 'cvalue_binding)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ":>"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (t2 : 'ctyp) _ (t : 'ctyp) _ (loc : int * int) -> + (Qast.Node ("ExCoe", [Qast.Loc; e; Qast.Option (Some t); t2]) : + 'cvalue_binding)); + [Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (t : 'ctyp) _ (loc : int * int) -> + (Qast.Node ("ExTyc", [Qast.Loc; e; t]) : 'cvalue_binding)); + [Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (e : 'cvalue_binding))]]; + Grammar.Entry.obj (label : 'label Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> (i : 'label))]]; + Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "object"); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj + (class_self_type : 'class_self_type Grammar.Entry.e)))], + Gramext.action + (fun (a : 'class_self_type option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_sig_item : 'class_sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (csf : 'class_sig_item) (loc : int * int) -> + (csf : 'e__18))])], + Gramext.action + (fun (a : 'e__18 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (csf : 'a_list) (cst : 'a_opt) _ (loc : int * int) -> + (Qast.Node ("CtSig", [Qast.Loc; cst; csf]) : 'class_type)); + [Gramext.Snterm + (Grammar.Entry.obj + (clty_longident : 'clty_longident Grammar.Entry.e))], + Gramext.action + (fun (id : 'clty_longident) (loc : int * int) -> + (Qast.Node ("CtCon", [Qast.Loc; id; Qast.List []]) : 'class_type)); + [Gramext.Snterm + (Grammar.Entry.obj + (clty_longident : 'clty_longident Grammar.Entry.e)); + Gramext.Stoken ("", "["); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", ","))], + Gramext.action + (fun (a : 'ctyp list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (tl : 'a_list) _ (id : 'clty_longident) (loc : int * int) -> + (Qast.Node ("CtCon", [Qast.Loc; id; tl]) : 'class_type)); + [Gramext.Stoken ("", "["); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "]"); Gramext.Stoken ("", "->"); Gramext.Sself], + Gramext.action + (fun (ct : 'class_type) _ _ (t : 'ctyp) _ (loc : int * int) -> + (Qast.Node ("CtFun", [Qast.Loc; t; ct]) : 'class_type))]]; + Grammar.Entry.obj (class_self_type : 'class_self_type Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'class_self_type))]]; + Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "type"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t2 : 'ctyp) _ (t1 : 'ctyp) _ (loc : int * int) -> + (Qast.Node ("CgCtr", [Qast.Loc; t1; t2]) : 'class_sig_item)); + [Gramext.Stoken ("", "method"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "private")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__22))])], + Gramext.action + (fun (a : 'e__22 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (pf : 'a_opt) _ (loc : int * int) -> + (Qast.Node ("CgMth", [Qast.Loc; l; o2b pf; t]) : 'class_sig_item)); + [Gramext.Stoken ("", "method"); Gramext.Stoken ("", "virtual"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "private")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__21))])], + Gramext.action + (fun (a : 'e__21 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (pf : 'a_opt) _ _ (loc : int * int) -> + (Qast.Node ("CgVir", [Qast.Loc; l; o2b pf; t]) : 'class_sig_item)); + [Gramext.Stoken ("", "value"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "mutable")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__20))])], + Gramext.action + (fun (a : 'e__20 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (mf : 'a_opt) _ (loc : int * int) -> + (Qast.Node ("CgVal", [Qast.Loc; l; o2b mf; t]) : 'class_sig_item)); + [Gramext.Stoken ("", "inherit"); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], + Gramext.action + (fun (cs : 'class_type) _ (loc : int * int) -> + (Qast.Node ("CgInh", [Qast.Loc; cs]) : 'class_sig_item)); + [Gramext.Stoken ("", "declare"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_sig_item : 'class_sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (s : 'class_sig_item) (loc : int * int) -> + (s : 'e__19))])], + Gramext.action + (fun (a : 'e__19 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (st : 'a_list) _ (loc : int * int) -> + (Qast.Node ("CgDcl", [Qast.Loc; st]) : 'class_sig_item))]]; + Grammar.Entry.obj + (class_description : 'class_description Grammar.Entry.e), + None, + [None, None, + [[Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "virtual")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__23))])], + Gramext.action + (fun (a : 'e__23 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (class_type_parameters : 'class_type_parameters Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], + Gramext.action + (fun (ct : 'class_type) _ (ctp : 'class_type_parameters) + (n : 'a_LIDENT) (vf : 'a_opt) (loc : int * int) -> + (Qast.Record + ["ciLoc", Qast.Loc; "ciVir", o2b vf; "ciPrm", ctp; "ciNam", n; + "ciExp", ct] : + 'class_description))]]; + Grammar.Entry.obj + (class_type_declaration : 'class_type_declaration Grammar.Entry.e), + None, + [None, None, + [[Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "virtual")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__24))])], + Gramext.action + (fun (a : 'e__24 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (class_type_parameters : 'class_type_parameters Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e))], + Gramext.action + (fun (cs : 'class_type) _ (ctp : 'class_type_parameters) + (n : 'a_LIDENT) (vf : 'a_opt) (loc : int * int) -> + (Qast.Record + ["ciLoc", Qast.Loc; "ciVir", o2b vf; "ciPrm", ctp; "ciNam", n; + "ciExp", cs] : + 'class_type_declaration))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "apply"), + [None, Some Gramext.LeftA, + [[Gramext.Stoken ("", "new"); + Gramext.Snterm + (Grammar.Entry.obj + (class_longident : 'class_longident Grammar.Entry.e))], + Gramext.action + (fun (i : 'class_longident) _ (loc : int * int) -> + (Qast.Node ("ExNew", [Qast.Loc; i]) : 'expr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "."), + [None, None, + [[Gramext.Sself; Gramext.Stoken ("", "#"); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e))], + Gramext.action + (fun (lab : 'label) _ (e : 'expr) (loc : int * int) -> + (Qast.Node ("ExSnd", [Qast.Loc; e; lab]) : 'expr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "{<"); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj + (field_expr : 'field_expr Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'field_expr list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", ">}")], + Gramext.action + (fun _ (fel : 'a_list) _ (loc : int * int) -> + (Qast.Node ("ExOvr", [Qast.Loc; fel]) : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":>"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExCoe", [Qast.Loc; e; Qast.Option None; t]) : 'expr)); + [Gramext.Stoken ("", "("); Gramext.Sself; Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ":>"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (t2 : 'ctyp) _ (t : 'ctyp) _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExCoe", [Qast.Loc; e; Qast.Option (Some t); t2]) : + 'expr))]]; + Grammar.Entry.obj (field_expr : 'field_expr Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (l : 'label) (loc : int * int) -> + (Qast.Tuple [l; e] : 'field_expr))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "<"); + Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (field : 'field Grammar.Entry.e)), + Gramext.Stoken ("", ";"))], + Gramext.action + (fun (a : 'field list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "..")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__25))])], + Gramext.action + (fun (a : 'e__25 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Stoken ("", ">")], + Gramext.action + (fun _ (v : 'a_opt) (ml : 'a_list) _ (loc : int * int) -> + (Qast.Node ("TyObj", [Qast.Loc; ml; o2b v]) : 'ctyp)); + [Gramext.Stoken ("", "#"); + Gramext.Snterm + (Grammar.Entry.obj + (class_longident : 'class_longident Grammar.Entry.e))], + Gramext.action + (fun (id : 'class_longident) _ (loc : int * int) -> + (Qast.Node ("TyCls", [Qast.Loc; id]) : 'ctyp))]]; + Grammar.Entry.obj (field : 'field Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (lab : 'a_LIDENT) (loc : int * int) -> + (Qast.Tuple [lab; t] : 'field))]]; + Grammar.Entry.obj (typevar : 'typevar Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "'"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> (i : 'typevar))]]; + Grammar.Entry.obj (clty_longident : 'clty_longident Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> + (Qast.List [i] : 'clty_longident)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (l : 'clty_longident) _ (m : 'a_UIDENT) (loc : int * int) -> + (Qast.Cons (m, l) : 'clty_longident))]]; + Grammar.Entry.obj (class_longident : 'class_longident Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_LIDENT) (loc : int * int) -> + (Qast.List [i] : 'class_longident)); + [Gramext.Snterm + (Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "."); Gramext.Sself], + Gramext.action + (fun (l : 'class_longident) _ (m : 'a_UIDENT) (loc : int * int) -> + (Qast.Cons (m, l) : 'class_longident))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.After "arrow"), + [None, Some Gramext.NonA, + [[Gramext.Snterm + (Grammar.Entry.obj + (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (i : 'a_QUESTIONIDENT) (loc : int * int) -> + (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp)); + [Gramext.Snterm + (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (i : 'a_TILDEIDENT) (loc : int * int) -> + (Qast.Node ("TyLab", [Qast.Loc; i; t]) : 'ctyp))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", ">"); + Gramext.srules + [[Gramext.Slist1 + (Gramext.Snterm + (Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e)))], + Gramext.action + (fun (a : 'name_tag list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (ntl : 'a_list) _ (rfl : 'row_field_list) _ _ + (loc : int * int) -> + (Qast.Node + ("TyVrn", + [Qast.Loc; rfl; Qast.Option (Some (Qast.Option (Some ntl)))]) : + 'ctyp)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> + (Qast.Node + ("TyVrn", + [Qast.Loc; rfl; + Qast.Option (Some (Qast.Option (Some (Qast.List []))))]) : + 'ctyp)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", ">"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> + (Qast.Node + ("TyVrn", + [Qast.Loc; rfl; Qast.Option (Some (Qast.Option None))]) : + 'ctyp)); + [Gramext.Stoken ("", "["); Gramext.Stoken ("", "="); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> + (Qast.Node ("TyVrn", [Qast.Loc; rfl; Qast.Option None]) : + 'ctyp))]]; + Grammar.Entry.obj (row_field_list : 'row_field_list Grammar.Entry.e), + None, + [None, None, + [[Gramext.srules + [[Gramext.Slist0sep + (Gramext.Snterm + (Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e)), + Gramext.Stoken ("", "|"))], + Gramext.action + (fun (a : 'row_field list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (rfl : 'a_list) (loc : int * int) -> (rfl : 'row_field_list))]]; + Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) (loc : int * int) -> + (Qast.Node ("RfInh", [t]) : 'row_field)); + [Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e)); + Gramext.Stoken ("", "of"); + Gramext.srules + [[Gramext.Sopt + (Gramext.srules + [[Gramext.Stoken ("", "&")], + Gramext.action + (fun (x : string) (loc : int * int) -> + (Qast.Str x : 'e__26))])], + Gramext.action + (fun (a : 'e__26 option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)), + Gramext.Stoken ("", "&"))], + Gramext.action + (fun (a : 'ctyp list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (l : 'a_list) (ao : 'a_opt) _ (i : 'ident) _ (loc : int * int) -> + (Qast.Node ("RfTag", [i; o2b ao; l]) : 'row_field)); + [Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> + (Qast.Node ("RfTag", [i; Qast.Bool true; Qast.List []]) : + 'row_field))]]; + Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (i : 'ident) _ (loc : int * int) -> (i : 'name_tag))]]; + Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "?"); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], + Gramext.action + (fun (a : 'eq_expr option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'a_opt) (p : 'patt_tcon) _ _ (loc : int * int) -> + (Qast.Node + ("PaOlb", + [Qast.Loc; Qast.Str ""; + Qast.Option (Some (Qast.Tuple [p; eo]))]) : + 'patt)); + [Gramext.Snterm + (Grammar.Entry.obj + (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> + (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'patt)); + [Gramext.Snterm + (Grammar.Entry.obj + (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], + Gramext.action + (fun (a : 'eq_expr option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'a_opt) (p : 'patt_tcon) _ _ (i : 'a_QUESTIONIDENT) + (loc : int * int) -> + (Qast.Node + ("PaOlb", + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) : + 'patt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_TILDEIDENT) (loc : int * int) -> + (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'patt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself], + Gramext.action + (fun (p : 'patt) _ (i : 'a_TILDEIDENT) (loc : int * int) -> + (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) : + 'patt)); + [Gramext.Stoken ("", "#"); + Gramext.Snterm + (Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e))], + Gramext.action + (fun (sl : 'mod_ident) _ (loc : int * int) -> + (Qast.Node ("PaTyp", [Qast.Loc; sl]) : 'patt)); + [Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (s : 'ident) _ (loc : int * int) -> + (Qast.Node ("PaVrn", [Qast.Loc; s]) : 'patt))]]; + Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))], + Gramext.action (fun (p : 'patt) (loc : int * int) -> (p : 'patt_tcon)); + [Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (p : 'patt) (loc : int * int) -> + (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'patt_tcon))]]; + Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "?"); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], + Gramext.action + (fun (a : 'eq_expr option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'a_opt) (p : 'ipatt_tcon) _ _ (loc : int * int) -> + (Qast.Node + ("PaOlb", + [Qast.Loc; Qast.Str ""; + Qast.Option (Some (Qast.Tuple [p; eo]))]) : + 'ipatt)); + [Gramext.Snterm + (Grammar.Entry.obj + (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> + (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'ipatt)); + [Gramext.Snterm + (Grammar.Entry.obj + (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], + Gramext.action + (fun (a : 'eq_expr option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'a_opt) (p : 'ipatt_tcon) _ _ (i : 'a_QUESTIONIDENT) + (loc : int * int) -> + (Qast.Node + ("PaOlb", + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) : + 'ipatt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_TILDEIDENT) (loc : int * int) -> + (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'ipatt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself], + Gramext.action + (fun (p : 'ipatt) _ (i : 'a_TILDEIDENT) (loc : int * int) -> + (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) : + 'ipatt))]]; + Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e))], + Gramext.action + (fun (p : 'ipatt) (loc : int * int) -> (p : 'ipatt_tcon)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (p : 'ipatt) (loc : int * int) -> + (Qast.Node ("PaTyc", [Qast.Loc; p; t]) : 'ipatt_tcon))]]; + Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "="); + Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) _ (loc : int * int) -> (e : 'eq_expr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.After "apply"), + [Some "label", Some Gramext.NonA, + [[Gramext.Snterm + (Grammar.Entry.obj + (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> + (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option None]) : 'expr)); + [Gramext.Snterm + (Grammar.Entry.obj + (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (i : 'a_QUESTIONIDENT) (loc : int * int) -> + (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option (Some e)]) : + 'expr)); + [Gramext.Snterm + (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e))], + Gramext.action + (fun (i : 'a_TILDEIDENT) (loc : int * int) -> + (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option None]) : 'expr)); + [Gramext.Snterm + (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ (i : 'a_TILDEIDENT) (loc : int * int) -> + (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option (Some e)]) : + 'expr))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "`"); + Gramext.Snterm (Grammar.Entry.obj (ident : 'ident Grammar.Entry.e))], + Gramext.action + (fun (s : 'ident) _ (loc : int * int) -> + (Qast.Node ("ExVrn", [Qast.Loc; s]) : 'expr))]]; + Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "downto")], + Gramext.action + (fun _ (loc : int * int) -> (Qast.Bool false : 'direction_flag)); + [Gramext.Stoken ("", "to")], + Gramext.action + (fun _ (loc : int * int) -> (Qast.Bool true : 'direction_flag))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "[|"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_variant : 'warning_variant Grammar.Entry.e)); + Gramext.Stoken ("", "<"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", ">"); + Gramext.srules + [[Gramext.Slist1 + (Gramext.Snterm + (Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e)))], + Gramext.action + (fun (a : 'name_tag list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (ntl : 'a_list) _ (rfl : 'row_field_list) _ _ _ + (loc : int * int) -> + (Qast.Node + ("TyVrn", + [Qast.Loc; rfl; Qast.Option (Some (Qast.Option (Some ntl)))]) : + 'ctyp)); + [Gramext.Stoken ("", "[|"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_variant : 'warning_variant Grammar.Entry.e)); + Gramext.Stoken ("", "<"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ _ (loc : int * int) -> + (Qast.Node + ("TyVrn", + [Qast.Loc; rfl; + Qast.Option (Some (Qast.Option (Some (Qast.List []))))]) : + 'ctyp)); + [Gramext.Stoken ("", "[|"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_variant : 'warning_variant Grammar.Entry.e)); + Gramext.Stoken ("", ">"); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ _ (loc : int * int) -> + (Qast.Node + ("TyVrn", + [Qast.Loc; rfl; Qast.Option (Some (Qast.Option None))]) : + 'ctyp)); + [Gramext.Stoken ("", "[|"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_variant : 'warning_variant Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (row_field_list : 'row_field_list Grammar.Entry.e)); + Gramext.Stoken ("", "|]")], + Gramext.action + (fun _ (rfl : 'row_field_list) _ _ (loc : int * int) -> + (Qast.Node ("TyVrn", [Qast.Loc; rfl; Qast.Option None]) : + 'ctyp))]]; + Grammar.Entry.obj (warning_variant : 'warning_variant Grammar.Entry.e), + None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> + (warn_variant Qast.Loc : 'warning_variant))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "top"), + [None, None, + [[Gramext.Stoken ("", "while"); Gramext.Sself; Gramext.Stoken ("", "do"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__29))])], + Gramext.action + (fun (a : 'e__29 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Snterm + (Grammar.Entry.obj + (warning_sequence : 'warning_sequence Grammar.Entry.e)); + Gramext.Stoken ("", "done")], + Gramext.action + (fun _ _ (seq : 'a_list) _ (e : 'expr) _ (loc : int * int) -> + (Qast.Node ("ExWhi", [Qast.Loc; e; seq]) : 'expr)); + [Gramext.Stoken ("", "for"); + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Stoken ("", "="); Gramext.Sself; + Gramext.Snterm + (Grammar.Entry.obj + (direction_flag : 'direction_flag Grammar.Entry.e)); + Gramext.Sself; Gramext.Stoken ("", "do"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__28))])], + Gramext.action + (fun (a : 'e__28 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Snterm + (Grammar.Entry.obj + (warning_sequence : 'warning_sequence Grammar.Entry.e)); + Gramext.Stoken ("", "done")], + Gramext.action + (fun _ _ (seq : 'a_list) _ (e2 : 'expr) (df : 'direction_flag) + (e1 : 'expr) _ (i : 'a_LIDENT) _ (loc : int * int) -> + (Qast.Node ("ExFor", [Qast.Loc; i; e1; e2; df; seq]) : 'expr)); + [Gramext.Stoken ("", "do"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__27))])], + Gramext.action + (fun (a : 'e__27 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "return"); + Gramext.Snterm + (Grammar.Entry.obj + (warning_sequence : 'warning_sequence Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (e : 'expr) _ _ (seq : 'a_list) _ (loc : int * int) -> + (Qast.Node ("ExSeq", [Qast.Loc; append_elem seq e]) : 'expr))]]; + Grammar.Entry.obj (warning_sequence : 'warning_sequence Grammar.Entry.e), + None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> + (warn_sequence Qast.Loc : 'warning_sequence))]]; + Grammar.Entry.obj (sequence : 'sequence Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "list")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "list" loc a : 'sequence))]]; + Grammar.Entry.obj (expr_ident : 'expr_ident Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'expr_ident))]]; + Grammar.Entry.obj (patt_label_ident : 'patt_label_ident Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'patt_label_ident))]]; + Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "when")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "when" loc a : 'when_expr_opt))]]; + Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'mod_ident))]]; + Grammar.Entry.obj (clty_longident : 'clty_longident Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'clty_longident))]]; + Grammar.Entry.obj (class_longident : 'class_longident Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'class_longident))]]; + Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "to")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "to" loc a : 'direction_flag))]]; + Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "object"); Gramext.Stoken ("ANTIQUOT", ""); + Gramext.Stoken ("", ";"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_str_item : 'class_str_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (cf : 'class_str_item) (loc : int * int) -> + (cf : 'e__30))])], + Gramext.action + (fun (a : 'e__30 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (csl : 'a_list) _ (x : string) _ (loc : int * int) -> + (let _ = warn_antiq loc "3.05" in + Qast.Node + ("CeStr", + [Qast.Loc; Qast.Option None; + Qast.Cons (antiquot "" loc x, csl)]) : + 'class_expr)); + [Gramext.Stoken ("", "object"); Gramext.Stoken ("ANTIQUOT", ""); + Gramext.Snterm + (Grammar.Entry.obj + (class_structure : 'class_structure Grammar.Entry.e)); + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (cf : 'class_structure) (x : string) _ (loc : int * int) -> + (let _ = warn_antiq loc "3.05" in + Qast.Node ("CeStr", [Qast.Loc; antiquot "" loc x; cf]) : + 'class_expr))]]; + Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "object"); Gramext.Stoken ("ANTIQUOT", ""); + Gramext.Stoken ("", ";"); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_sig_item : 'class_sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (csf : 'class_sig_item) (loc : int * int) -> + (csf : 'e__32))])], + Gramext.action + (fun (a : 'e__32 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (csf : 'a_list) _ (x : string) _ (loc : int * int) -> + (let _ = warn_antiq loc "3.05" in + Qast.Node + ("CtSig", + [Qast.Loc; Qast.Option None; + Qast.Cons (antiquot "" loc x, csf)]) : + 'class_type)); + [Gramext.Stoken ("", "object"); Gramext.Stoken ("ANTIQUOT", ""); + Gramext.srules + [[Gramext.Slist0 + (Gramext.srules + [[Gramext.Snterm + (Grammar.Entry.obj + (class_sig_item : 'class_sig_item Grammar.Entry.e)); + Gramext.Stoken ("", ";")], + Gramext.action + (fun _ (csf : 'class_sig_item) (loc : int * int) -> + (csf : 'e__31))])], + Gramext.action + (fun (a : 'e__31 list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "end")], + Gramext.action + (fun _ (csf : 'a_list) (x : string) _ (loc : int * int) -> + (let _ = warn_antiq loc "3.05" in + Qast.Node ("CtSig", [Qast.Loc; antiquot "" loc x; csf]) : + 'class_type))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "top"), + [None, None, + [[Gramext.Stoken ("", "let"); Gramext.Stoken ("ANTIQUOT", "rec"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'let_binding list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "in"); Gramext.Sself], + Gramext.action + (fun (x : 'expr) _ (l : 'a_list) (r : string) _ (loc : int * int) -> + (let _ = warn_antiq loc "3.06+18" in + Qast.Node ("ExLet", [Qast.Loc; antiquot "rec" loc r; l; x]) : + 'expr))]]; + Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), + Some (Gramext.Level "top"), + [None, None, + [[Gramext.Stoken ("", "value"); Gramext.Stoken ("ANTIQUOT", "rec"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'let_binding list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]], + Gramext.action + (fun (l : 'a_list) (r : string) _ (loc : int * int) -> + (let _ = warn_antiq loc "3.06+18" in + Qast.Node ("StVal", [Qast.Loc; antiquot "rec" loc r; l]) : + 'str_item))]]; + Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), + Some (Gramext.Level "top"), + [None, None, + [[Gramext.Stoken ("", "let"); Gramext.Stoken ("ANTIQUOT", "rec"); + Gramext.srules + [[Gramext.Slist1sep + (Gramext.Snterm + (Grammar.Entry.obj + (let_binding : 'let_binding Grammar.Entry.e)), + Gramext.Stoken ("", "and"))], + Gramext.action + (fun (a : 'let_binding list) (loc : int * int) -> + (Qast.List a : 'a_list)); + [Gramext.Snterm + (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) (loc : int * int) -> (a : 'a_list))]; + Gramext.Stoken ("", "in"); Gramext.Sself], + Gramext.action + (fun (ce : 'class_expr) _ (lb : 'a_list) (r : string) _ + (loc : int * int) -> + (let _ = warn_antiq loc "3.06+18" in + Qast.Node ("CeLet", [Qast.Loc; antiquot "rec" loc r; lb; ce]) : + 'class_expr))]]; + Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "value"); Gramext.Stoken ("ANTIQUOT", "mut"); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj + (cvalue_binding : 'cvalue_binding Grammar.Entry.e))], + Gramext.action + (fun (e : 'cvalue_binding) (lab : 'label) (mf : string) _ + (loc : int * int) -> + (let _ = warn_antiq loc "3.06+18" in + Qast.Node ("CrVal", [Qast.Loc; lab; antiquot "mut" loc mf; e]) : + 'class_str_item)); + [Gramext.Stoken ("", "inherit"); + Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e)); + Gramext.Stoken ("ANTIQUOT", "as")], + Gramext.action + (fun (pb : string) (ce : 'class_expr) _ (loc : int * int) -> + (let _ = warn_antiq loc "3.06+18" in + Qast.Node ("CrInh", [Qast.Loc; ce; antiquot "as" loc pb]) : + 'class_str_item))]]; + Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("", "value"); Gramext.Stoken ("ANTIQUOT", "mut"); + Gramext.Snterm (Grammar.Entry.obj (label : 'label Grammar.Entry.e)); + Gramext.Stoken ("", ":"); + Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))], + Gramext.action + (fun (t : 'ctyp) _ (l : 'label) (mf : string) _ (loc : int * int) -> + (let _ = warn_antiq loc "3.06+18" in + Qast.Node ("CgVal", [Qast.Loc; l; antiquot "mut" loc mf; t]) : + 'class_sig_item))]]]);; -let _ = - Grammar.extend - (let _ = (str_item : 'str_item Grammar.Entry.e) - and _ = (sig_item : 'sig_item Grammar.Entry.e) in - let grammar_entry_create s = - Grammar.Entry.create (Grammar.of_entry str_item) s - in - let dir_param : 'dir_param Grammar.Entry.e = - grammar_entry_create "dir_param" - in - [Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "#"); - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (dir_param : 'dir_param Grammar.Entry.e))], - Gramext.action - (fun (dp : 'dir_param) (n : 'a_LIDENT) _ (loc : int * int) -> - (Qast.Node ("StDir", [Qast.Loc; n; dp]) : 'str_item))]]; - Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "#"); - Gramext.Snterm - (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); - Gramext.Snterm - (Grammar.Entry.obj (dir_param : 'dir_param Grammar.Entry.e))], - Gramext.action - (fun (dp : 'dir_param) (n : 'a_LIDENT) _ (loc : int * int) -> - (Qast.Node ("SgDir", [Qast.Loc; n; dp]) : 'sig_item))]]; - Grammar.Entry.obj (dir_param : 'dir_param Grammar.Entry.e), None, - [None, None, - [[], - Gramext.action - (fun (loc : int * int) -> (Qast.Option None : 'dir_param)); - [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], - Gramext.action - (fun (e : 'expr) (loc : int * int) -> - (Qast.Option (Some e) : 'dir_param)); - [Gramext.Stoken ("ANTIQUOT", "opt")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "opt" loc a : 'dir_param))]]]) +Grammar.extend + (let _ = (str_item : 'str_item Grammar.Entry.e) + and _ = (sig_item : 'sig_item Grammar.Entry.e) in + let grammar_entry_create s = + Grammar.Entry.create (Grammar.of_entry str_item) s + in + let dir_param : 'dir_param Grammar.Entry.e = + grammar_entry_create "dir_param" + in + [Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "#"); + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (dir_param : 'dir_param Grammar.Entry.e))], + Gramext.action + (fun (dp : 'dir_param) (n : 'a_LIDENT) _ (loc : int * int) -> + (Qast.Node ("StDir", [Qast.Loc; n; dp]) : 'str_item))]]; + Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "#"); + Gramext.Snterm + (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e)); + Gramext.Snterm + (Grammar.Entry.obj (dir_param : 'dir_param Grammar.Entry.e))], + Gramext.action + (fun (dp : 'dir_param) (n : 'a_LIDENT) _ (loc : int * int) -> + (Qast.Node ("SgDir", [Qast.Loc; n; dp]) : 'sig_item))]]; + Grammar.Entry.obj (dir_param : 'dir_param Grammar.Entry.e), None, + [None, None, + [[], + Gramext.action + (fun (loc : int * int) -> (Qast.Option None : 'dir_param)); + [Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))], + Gramext.action + (fun (e : 'expr) (loc : int * int) -> + (Qast.Option (Some e) : 'dir_param)); + [Gramext.Stoken ("ANTIQUOT", "opt")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "opt" loc a : 'dir_param))]]]);; (* Antiquotations *) -let _ = - Grammar.extend - [Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'module_expr)); - [Gramext.Stoken ("ANTIQUOT", "mexp")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "mexp" loc a : 'module_expr))]]; - Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), - Some (Gramext.Level "top"), - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'str_item)); - [Gramext.Stoken ("ANTIQUOT", "stri")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "stri" loc a : 'str_item))]]; - Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'module_type)); - [Gramext.Stoken ("ANTIQUOT", "mtyp")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "mtyp" loc a : 'module_type))]]; - Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), - Some (Gramext.Level "top"), - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'sig_item)); - [Gramext.Stoken ("ANTIQUOT", "sigi")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "sigi" loc a : 'sig_item))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (el : 'a_list) _ (loc : int * int) -> - (Qast.Node ("ExTup", [Qast.Loc; el]) : 'expr)); - [Gramext.Stoken ("ANTIQUOT", "anti")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (Qast.Node ("ExAnt", [Qast.Loc; antiquot "anti" loc a]) : 'expr)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'expr)); - [Gramext.Stoken ("ANTIQUOT", "exp")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "exp" loc a : 'expr))]]; - Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (pl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("PaTup", [Qast.Loc; pl]) : 'patt)); - [Gramext.Stoken ("ANTIQUOT", "anti")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (Qast.Node ("PaAnt", [Qast.Loc; antiquot "anti" loc a]) : 'patt)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'patt)); - [Gramext.Stoken ("ANTIQUOT", "pat")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "pat" loc a : 'patt))]]; - Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (pl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("PaTup", [Qast.Loc; pl]) : 'ipatt)); - [Gramext.Stoken ("ANTIQUOT", "anti")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (Qast.Node ("PaAnt", [Qast.Loc; antiquot "anti" loc a]) : - 'ipatt)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'ipatt)); - [Gramext.Stoken ("ANTIQUOT", "pat")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "pat" loc a : 'ipatt))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "("); - Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); - Gramext.Stoken ("", ")")], - Gramext.action - (fun _ (tl : 'a_list) _ (loc : int * int) -> - (Qast.Node ("TyTup", [Qast.Loc; tl]) : 'ctyp)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'ctyp)); - [Gramext.Stoken ("ANTIQUOT", "typ")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "typ" loc a : 'ctyp))]]; - Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'class_expr))]]; - Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'class_str_item))]]; - Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'class_sig_item))]]; - Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'class_type))]]; - Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "{<"); - Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); - Gramext.Stoken ("", ">}")], - Gramext.action - (fun _ (fel : 'a_list) _ (loc : int * int) -> - (Qast.Node ("ExOvr", [Qast.Loc; fel]) : 'expr))]]; - Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), - Some (Gramext.Level "simple"), - [None, None, - [[Gramext.Stoken ("", "#"); - Gramext.Snterm - (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], - Gramext.action - (fun (a : 'a_list) _ (loc : int * int) -> - (Qast.Node ("PaTyp", [Qast.Loc; a]) : 'patt))]]; - Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "list")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "list" loc a : 'a_list))]]; - Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("ANTIQUOT", "opt")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "opt" loc a : 'a_opt))]]; - Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("UIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> (Qast.Str i : 'a_UIDENT)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'a_UIDENT)); - [Gramext.Stoken ("ANTIQUOT", "uid")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "uid" loc a : 'a_UIDENT))]]; - Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("LIDENT", "")], - Gramext.action - (fun (i : string) (loc : int * int) -> (Qast.Str i : 'a_LIDENT)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'a_LIDENT)); - [Gramext.Stoken ("ANTIQUOT", "lid")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "lid" loc a : 'a_LIDENT))]]; - Grammar.Entry.obj (a_INT : 'a_INT Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("INT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_INT)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'a_INT)); - [Gramext.Stoken ("ANTIQUOT", "int")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "int" loc a : 'a_INT))]]; - Grammar.Entry.obj (a_FLOAT : 'a_FLOAT Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("FLOAT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_FLOAT)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'a_FLOAT)); - [Gramext.Stoken ("ANTIQUOT", "flo")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "flo" loc a : 'a_FLOAT))]]; - Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("STRING", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_STRING)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'a_STRING)); - [Gramext.Stoken ("ANTIQUOT", "str")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "str" loc a : 'a_STRING))]]; - Grammar.Entry.obj (a_CHAR : 'a_CHAR Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("CHAR", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_CHAR)); - [Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "" loc a : 'a_CHAR)); - [Gramext.Stoken ("ANTIQUOT", "chr")], - Gramext.action - (fun (a : string) (loc : int * int) -> - (antiquot "chr" loc a : 'a_CHAR))]]; - Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e), None, - [None, None, - [[Gramext.Stoken ("TILDEIDENT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_TILDEIDENT)); - [Gramext.Stoken ("", "~"); Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) _ (loc : int * int) -> - (antiquot "" loc a : 'a_TILDEIDENT))]]; - Grammar.Entry.obj (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e), - None, - [None, None, - [[Gramext.Stoken ("QUESTIONIDENT", "")], - Gramext.action - (fun (s : string) (loc : int * int) -> - (Qast.Str s : 'a_QUESTIONIDENT)); - [Gramext.Stoken ("", "?"); Gramext.Stoken ("ANTIQUOT", "")], - Gramext.action - (fun (a : string) _ (loc : int * int) -> - (antiquot "" loc a : 'a_QUESTIONIDENT))]]] +Grammar.extend + [Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'module_expr)); + [Gramext.Stoken ("ANTIQUOT", "mexp")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "mexp" loc a : 'module_expr))]]; + Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), + Some (Gramext.Level "top"), + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'str_item)); + [Gramext.Stoken ("ANTIQUOT", "stri")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "stri" loc a : 'str_item))]]; + Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'module_type)); + [Gramext.Stoken ("ANTIQUOT", "mtyp")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "mtyp" loc a : 'module_type))]]; + Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), + Some (Gramext.Level "top"), + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'sig_item)); + [Gramext.Stoken ("ANTIQUOT", "sigi")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "sigi" loc a : 'sig_item))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (el : 'a_list) _ (loc : int * int) -> + (Qast.Node ("ExTup", [Qast.Loc; el]) : 'expr)); + [Gramext.Stoken ("ANTIQUOT", "anti")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (Qast.Node ("ExAnt", [Qast.Loc; antiquot "anti" loc a]) : 'expr)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'expr)); + [Gramext.Stoken ("ANTIQUOT", "exp")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "exp" loc a : 'expr))]]; + Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (pl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("PaTup", [Qast.Loc; pl]) : 'patt)); + [Gramext.Stoken ("ANTIQUOT", "anti")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (Qast.Node ("PaAnt", [Qast.Loc; antiquot "anti" loc a]) : 'patt)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'patt)); + [Gramext.Stoken ("ANTIQUOT", "pat")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "pat" loc a : 'patt))]]; + Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (pl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("PaTup", [Qast.Loc; pl]) : 'ipatt)); + [Gramext.Stoken ("ANTIQUOT", "anti")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (Qast.Node ("PaAnt", [Qast.Loc; antiquot "anti" loc a]) : 'ipatt)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'ipatt)); + [Gramext.Stoken ("ANTIQUOT", "pat")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "pat" loc a : 'ipatt))]]; + Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "("); + Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (tl : 'a_list) _ (loc : int * int) -> + (Qast.Node ("TyTup", [Qast.Loc; tl]) : 'ctyp)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'ctyp)); + [Gramext.Stoken ("ANTIQUOT", "typ")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "typ" loc a : 'ctyp))]]; + Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'class_expr))]]; + Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'class_str_item))]]; + Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'class_sig_item))]]; + Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'class_type))]]; + Grammar.Entry.obj (expr : 'expr Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "{<"); + Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e)); + Gramext.Stoken ("", ">}")], + Gramext.action + (fun _ (fel : 'a_list) _ (loc : int * int) -> + (Qast.Node ("ExOvr", [Qast.Loc; fel]) : 'expr))]]; + Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), + Some (Gramext.Level "simple"), + [None, None, + [[Gramext.Stoken ("", "#"); + Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_list) _ (loc : int * int) -> + (Qast.Node ("PaTyp", [Qast.Loc; a]) : 'patt))]]; + Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "list")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "list" loc a : 'a_list))]]; + Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("ANTIQUOT", "opt")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "opt" loc a : 'a_opt))]]; + Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("UIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> (Qast.Str i : 'a_UIDENT)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'a_UIDENT)); + [Gramext.Stoken ("ANTIQUOT", "uid")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "uid" loc a : 'a_UIDENT))]]; + Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("LIDENT", "")], + Gramext.action + (fun (i : string) (loc : int * int) -> (Qast.Str i : 'a_LIDENT)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'a_LIDENT)); + [Gramext.Stoken ("ANTIQUOT", "lid")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "lid" loc a : 'a_LIDENT))]]; + Grammar.Entry.obj (a_INT : 'a_INT Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("INT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_INT)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'a_INT)); + [Gramext.Stoken ("ANTIQUOT", "int")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "int" loc a : 'a_INT))]]; + Grammar.Entry.obj (a_FLOAT : 'a_FLOAT Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("FLOAT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_FLOAT)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'a_FLOAT)); + [Gramext.Stoken ("ANTIQUOT", "flo")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "flo" loc a : 'a_FLOAT))]]; + Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("STRING", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_STRING)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "" loc a : 'a_STRING)); + [Gramext.Stoken ("ANTIQUOT", "str")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "str" loc a : 'a_STRING))]]; + Grammar.Entry.obj (a_CHAR : 'a_CHAR Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("CHAR", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_CHAR)); + [Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) (loc : int * int) -> (antiquot "" loc a : 'a_CHAR)); + [Gramext.Stoken ("ANTIQUOT", "chr")], + Gramext.action + (fun (a : string) (loc : int * int) -> + (antiquot "chr" loc a : 'a_CHAR))]]; + Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("TILDEIDENT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_TILDEIDENT)); + [Gramext.Stoken ("", "~"); Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) _ (loc : int * int) -> + (antiquot "" loc a : 'a_TILDEIDENT))]]; + Grammar.Entry.obj (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e), + None, + [None, None, + [[Gramext.Stoken ("QUESTIONIDENT", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> + (Qast.Str s : 'a_QUESTIONIDENT)); + [Gramext.Stoken ("", "?"); Gramext.Stoken ("ANTIQUOT", "")], + Gramext.action + (fun (a : string) _ (loc : int * int) -> + (antiquot "" loc a : 'a_QUESTIONIDENT))]]];; let apply_entry e = let f s = Grammar.Entry.parse e (Stream.of_string s) in let expr s = Qast.to_expr (f s) in let patt s = Qast.to_patt (f s) in Quotation.ExAst (expr, patt) +;; -let _ = - let sig_item_eoi = Grammar.Entry.create gram "signature item" in - Grammar.extend - [Grammar.Entry.obj (sig_item_eoi : 'sig_item_eoi Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'sig_item) (loc : int * int) -> (x : 'sig_item_eoi))]]]; - Quotation.add "sig_item" (apply_entry sig_item_eoi) +let sig_item_eoi = Grammar.Entry.create gram "signature item" in +Grammar.extend + [Grammar.Entry.obj (sig_item_eoi : 'sig_item_eoi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'sig_item) (loc : int * int) -> (x : 'sig_item_eoi))]]]; +Quotation.add "sig_item" (apply_entry sig_item_eoi);; -let _ = - let str_item_eoi = Grammar.Entry.create gram "structure item" in - Grammar.extend - [Grammar.Entry.obj (str_item_eoi : 'str_item_eoi Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'str_item) (loc : int * int) -> (x : 'str_item_eoi))]]]; - Quotation.add "str_item" (apply_entry str_item_eoi) +let str_item_eoi = Grammar.Entry.create gram "structure item" in +Grammar.extend + [Grammar.Entry.obj (str_item_eoi : 'str_item_eoi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'str_item) (loc : int * int) -> (x : 'str_item_eoi))]]]; +Quotation.add "str_item" (apply_entry str_item_eoi);; -let _ = - let ctyp_eoi = Grammar.Entry.create gram "type" in - Grammar.extend - [Grammar.Entry.obj (ctyp_eoi : 'ctyp_eoi Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'ctyp) (loc : int * int) -> (x : 'ctyp_eoi))]]]; - Quotation.add "ctyp" (apply_entry ctyp_eoi) +let ctyp_eoi = Grammar.Entry.create gram "type" in +Grammar.extend + [Grammar.Entry.obj (ctyp_eoi : 'ctyp_eoi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'ctyp) (loc : int * int) -> (x : 'ctyp_eoi))]]]; +Quotation.add "ctyp" (apply_entry ctyp_eoi);; -let _ = - let patt_eoi = Grammar.Entry.create gram "pattern" in - Grammar.extend - [Grammar.Entry.obj (patt_eoi : 'patt_eoi Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'patt) (loc : int * int) -> (x : 'patt_eoi))]]]; - Quotation.add "patt" (apply_entry patt_eoi) +let patt_eoi = Grammar.Entry.create gram "pattern" in +Grammar.extend + [Grammar.Entry.obj (patt_eoi : 'patt_eoi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'patt) (loc : int * int) -> (x : 'patt_eoi))]]]; +Quotation.add "patt" (apply_entry patt_eoi);; -let _ = - let expr_eoi = Grammar.Entry.create gram "expression" in - Grammar.extend - [Grammar.Entry.obj (expr_eoi : 'expr_eoi Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'expr) (loc : int * int) -> (x : 'expr_eoi))]]]; - Quotation.add "expr" (apply_entry expr_eoi) +let expr_eoi = Grammar.Entry.create gram "expression" in +Grammar.extend + [Grammar.Entry.obj (expr_eoi : 'expr_eoi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'expr) (loc : int * int) -> (x : 'expr_eoi))]]]; +Quotation.add "expr" (apply_entry expr_eoi);; -let _ = - let module_type_eoi = Grammar.Entry.create gram "module type" in - Grammar.extend - [Grammar.Entry.obj (module_type_eoi : 'module_type_eoi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'module_type) (loc : int * int) -> - (x : 'module_type_eoi))]]]; - Quotation.add "module_type" (apply_entry module_type_eoi) +let module_type_eoi = Grammar.Entry.create gram "module type" in +Grammar.extend + [Grammar.Entry.obj (module_type_eoi : 'module_type_eoi Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (module_type : 'module_type Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'module_type) (loc : int * int) -> + (x : 'module_type_eoi))]]]; +Quotation.add "module_type" (apply_entry module_type_eoi);; -let _ = - let module_expr_eoi = Grammar.Entry.create gram "module expression" in - Grammar.extend - [Grammar.Entry.obj (module_expr_eoi : 'module_expr_eoi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'module_expr) (loc : int * int) -> - (x : 'module_expr_eoi))]]]; - Quotation.add "module_expr" (apply_entry module_expr_eoi) +let module_expr_eoi = Grammar.Entry.create gram "module expression" in +Grammar.extend + [Grammar.Entry.obj (module_expr_eoi : 'module_expr_eoi Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'module_expr) (loc : int * int) -> + (x : 'module_expr_eoi))]]]; +Quotation.add "module_expr" (apply_entry module_expr_eoi);; -let _ = - let class_type_eoi = Grammar.Entry.create gram "class_type" in - Grammar.extend - [Grammar.Entry.obj (class_type_eoi : 'class_type_eoi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'class_type) (loc : int * int) -> - (x : 'class_type_eoi))]]]; - Quotation.add "class_type" (apply_entry class_type_eoi) +let class_type_eoi = Grammar.Entry.create gram "class_type" in +Grammar.extend + [Grammar.Entry.obj (class_type_eoi : 'class_type_eoi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'class_type) (loc : int * int) -> + (x : 'class_type_eoi))]]]; +Quotation.add "class_type" (apply_entry class_type_eoi);; -let _ = - let class_expr_eoi = Grammar.Entry.create gram "class_expr" in - Grammar.extend - [Grammar.Entry.obj (class_expr_eoi : 'class_expr_eoi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'class_expr) (loc : int * int) -> - (x : 'class_expr_eoi))]]]; - Quotation.add "class_expr" (apply_entry class_expr_eoi) +let class_expr_eoi = Grammar.Entry.create gram "class_expr" in +Grammar.extend + [Grammar.Entry.obj (class_expr_eoi : 'class_expr_eoi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'class_expr) (loc : int * int) -> + (x : 'class_expr_eoi))]]]; +Quotation.add "class_expr" (apply_entry class_expr_eoi);; -let _ = - let class_sig_item_eoi = Grammar.Entry.create gram "class_sig_item" in - Grammar.extend - [Grammar.Entry.obj - (class_sig_item_eoi : 'class_sig_item_eoi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj - (class_sig_item : 'class_sig_item Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'class_sig_item) (loc : int * int) -> - (x : 'class_sig_item_eoi))]]]; - Quotation.add "class_sig_item" (apply_entry class_sig_item_eoi) +let class_sig_item_eoi = Grammar.Entry.create gram "class_sig_item" in +Grammar.extend + [Grammar.Entry.obj + (class_sig_item_eoi : 'class_sig_item_eoi Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj + (class_sig_item : 'class_sig_item Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'class_sig_item) (loc : int * int) -> + (x : 'class_sig_item_eoi))]]]; +Quotation.add "class_sig_item" (apply_entry class_sig_item_eoi);; -let _ = - let class_str_item_eoi = Grammar.Entry.create gram "class_str_item" in - Grammar.extend - [Grammar.Entry.obj - (class_str_item_eoi : 'class_str_item_eoi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj - (class_str_item : 'class_str_item Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'class_str_item) (loc : int * int) -> - (x : 'class_str_item_eoi))]]]; - Quotation.add "class_str_item" (apply_entry class_str_item_eoi) +let class_str_item_eoi = Grammar.Entry.create gram "class_str_item" in +Grammar.extend + [Grammar.Entry.obj + (class_str_item_eoi : 'class_str_item_eoi Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj + (class_str_item : 'class_str_item Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'class_str_item) (loc : int * int) -> + (x : 'class_str_item_eoi))]]]; +Quotation.add "class_str_item" (apply_entry class_str_item_eoi);; -let _ = - let with_constr_eoi = Grammar.Entry.create gram "with constr" in - Grammar.extend - [Grammar.Entry.obj (with_constr_eoi : 'with_constr_eoi Grammar.Entry.e), - None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (with_constr : 'with_constr Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'with_constr) (loc : int * int) -> - (x : 'with_constr_eoi))]]]; - Quotation.add "with_constr" (apply_entry with_constr_eoi) +let with_constr_eoi = Grammar.Entry.create gram "with constr" in +Grammar.extend + [Grammar.Entry.obj (with_constr_eoi : 'with_constr_eoi Grammar.Entry.e), + None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (with_constr : 'with_constr Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'with_constr) (loc : int * int) -> + (x : 'with_constr_eoi))]]]; +Quotation.add "with_constr" (apply_entry with_constr_eoi);; -let _ = - let row_field_eoi = Grammar.Entry.create gram "row_field" in - Grammar.extend - [Grammar.Entry.obj (row_field_eoi : 'row_field_eoi Grammar.Entry.e), None, - [None, None, - [[Gramext.Snterm - (Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e)); - Gramext.Stoken ("EOI", "")], - Gramext.action - (fun _ (x : 'row_field) (loc : int * int) -> - (x : 'row_field_eoi))]]]; - Quotation.add "row_field" (apply_entry row_field_eoi) +let row_field_eoi = Grammar.Entry.create gram "row_field" in +Grammar.extend + [Grammar.Entry.obj (row_field_eoi : 'row_field_eoi Grammar.Entry.e), None, + [None, None, + [[Gramext.Snterm + (Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e)); + Gramext.Stoken ("EOI", "")], + Gramext.action + (fun _ (x : 'row_field) (loc : int * int) -> (x : 'row_field_eoi))]]]; +Quotation.add "row_field" (apply_entry row_field_eoi);; diff --git a/camlp4/ocaml_src/odyl/Makefile b/camlp4/ocaml_src/odyl/Makefile index 6b837d96..bd59608b 100644 --- a/camlp4/ocaml_src/odyl/Makefile +++ b/camlp4/ocaml_src/odyl/Makefile @@ -37,7 +37,7 @@ odyl_config.ml: | sed -e 's|\\|/|g' > odyl_config.ml clean:: - rm -f *.cm* *.pp[io] *.o *.bak .*.bak *.out *.opt *.a + rm -f *.cm* *.pp[io] *.$(O) *.bak .*.bak *.out *.opt *.$(A) rm -f odyl_config.ml odyl$(EXE) depend: @@ -55,6 +55,7 @@ compare: install: -$(MKDIR) "$(LIBDIR)/camlp4" "$(BINDIR)" - cp odyl.cmo odyl.cma "$(LIBDIR)/camlp4/." + cp odyl.cmo odyl.cma odyl_main.cmi $(LIBDIR)/camlp4/. + if test -f odyl.cmxa; then cp odyl.cmxa odyl.$(A) $(LIBDIR)/camlp4/.; fi include .depend diff --git a/camlp4/odyl/Makefile b/camlp4/odyl/Makefile index 097ccb67..23a90d3c 100644 --- a/camlp4/odyl/Makefile +++ b/camlp4/odyl/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.14 2003/07/16 13:34:59 xleroy Exp $ +# $Id: Makefile,v 1.15 2003/08/29 12:15:15 xleroy Exp $ include ../config/Makefile @@ -37,7 +37,7 @@ odyl_config.ml: | sed -e 's|\\|/|g' > odyl_config.ml clean:: - rm -f *.cm* *.pp[io] *.o *.bak .*.bak *.out *.opt *.a + rm -f *.cm* *.pp[io] *.$(O) *.bak .*.bak *.out *.opt *.$(A) rm -f odyl_config.ml odyl$(EXE) depend: @@ -56,6 +56,6 @@ compare: install: -$(MKDIR) "$(LIBDIR)/camlp4" "$(BINDIR)" cp odyl.cmo odyl.cma odyl_main.cmi $(LIBDIR)/camlp4/. - if test -f odyl.cmxa; then cp odyl.cmxa odyl.a $(LIBDIR)/camlp4/.; fi + if test -f odyl.cmxa; then cp odyl.cmxa odyl.$(A) $(LIBDIR)/camlp4/.; fi include .depend diff --git a/camlp4/top/.depend b/camlp4/top/.depend index 0860d8d7..d7aebc7b 100644 --- a/camlp4/top/.depend +++ b/camlp4/top/.depend @@ -8,5 +8,7 @@ camlp4_top.cmx: ../camlp4/ast2pt.cmx ../camlp4/mLast.cmi \ $(OTOP)/utils/warnings.cmx oprint.cmo: $(OTOP)/typing/outcometree.cmi $(OTOP)/toplevel/toploop.cmi oprint.cmx: $(OTOP)/typing/outcometree.cmi $(OTOP)/toplevel/toploop.cmx -rprint.cmo: $(OTOP)/typing/outcometree.cmi $(OTOP)/toplevel/toploop.cmi -rprint.cmx: $(OTOP)/typing/outcometree.cmi $(OTOP)/toplevel/toploop.cmx +rprint.cmo: $(OTOP)/parsing/asttypes.cmi $(OTOP)/typing/outcometree.cmi \ + $(OTOP)/toplevel/toploop.cmi +rprint.cmx: $(OTOP)/parsing/asttypes.cmi $(OTOP)/typing/outcometree.cmi \ + $(OTOP)/toplevel/toploop.cmx diff --git a/camlp4/top/oprint.ml b/camlp4/top/oprint.ml index 1fa4aebd..7a9d435c 100644 --- a/camlp4/top/oprint.ml +++ b/camlp4/top/oprint.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: oprint.ml,v 1.5 2003/07/15 09:14:00 mauny Exp $ *) +(* $Id: oprint.ml,v 1.6 2003/09/23 12:52:34 mauny Exp $ *) open Format; open Outcometree; @@ -114,6 +114,10 @@ value rec print_list_init pr sep ppf = | [a :: l] -> do { sep ppf; pr ppf a; print_list_init pr sep ppf l } ] ; +value pr_vars = + print_list (fun ppf s -> fprintf ppf "'%s" s) (fun ppf -> fprintf ppf "@ ") +; + value rec print_list pr sep ppf = fun [ [] -> () @@ -128,6 +132,10 @@ value pr_present = value rec print_out_type ppf = fun [ Otyp_alias ty s -> fprintf ppf "@[%a as '%s@]" print_out_type ty s + | Otyp_poly sl ty -> + fprintf ppf "@[%a.@ %a@]" + pr_vars sl + print_out_type ty | ty -> print_out_type_1 ppf ty ] and print_out_type_1 ppf = fun @@ -170,7 +178,7 @@ and print_simple_out_type ppf = else if tags = None then "> " else "? ") print_fields row_fields print_present tags - | Otyp_alias _ _ | Otyp_arrow _ _ _ | Otyp_tuple _ as ty -> + | Otyp_alias _ _ | Otyp_poly _ | Otyp_arrow _ _ _ | Otyp_tuple _ as ty -> fprintf ppf "@[<1>(%a)@]" print_out_type ty | Otyp_abstract | Otyp_sum _ | Otyp_record _ | Otyp_private _ | Otyp_manifest _ _ -> () ] diff --git a/camlp4/top/rprint.ml b/camlp4/top/rprint.ml index 6d6fc5b1..573e6246 100644 --- a/camlp4/top/rprint.ml +++ b/camlp4/top/rprint.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: rprint.ml,v 1.11 2003/07/15 09:14:00 mauny Exp $ *) +(* $Id: rprint.ml,v 1.12 2003/09/23 12:52:34 mauny Exp $ *) open Format; open Outcometree; @@ -115,6 +115,10 @@ value rec print_list pr sep ppf = | [a :: l] -> do { pr ppf a; sep ppf; print_list pr sep ppf l } ] ; +value pr_vars = + print_list (fun ppf s -> fprintf ppf "'%s" s) (fun ppf -> fprintf ppf "@ ") +; + value pr_present = print_list (fun ppf s -> fprintf ppf "`%s" s) (fun ppf -> fprintf ppf "@ ") ; @@ -130,6 +134,10 @@ and print_out_type_1 ppf = [ Otyp_arrow lab ty1 ty2 -> fprintf ppf "@[%s%a ->@ %a@]" (if lab <> "" then lab ^ ":" else "") print_out_type_2 ty1 print_out_type_1 ty2 + | Otyp_poly sl ty -> + fprintf ppf "@[%a.@ %a@]" + pr_vars sl + print_out_type ty | ty -> print_out_type_2 ppf ty ] and print_out_type_2 ppf = fun diff --git a/config/auto-aux/stackov.c b/config/auto-aux/stackov.c index d56e26e7..fb1133e8 100644 --- a/config/auto-aux/stackov.c +++ b/config/auto-aux/stackov.c @@ -11,7 +11,7 @@ /* */ /***********************************************************************/ -/* $Id: stackov.c,v 1.3 2001/12/07 13:39:44 xleroy Exp $ */ +/* $Id: stackov.c,v 1.4 2003/07/23 07:57:17 xleroy Exp $ */ #include #include @@ -41,15 +41,10 @@ static void segv_handler(int signo, siginfo_t * info, void * context) } } -void f(char * c); -void g(char * c) { char d[1024]; f(d); } -void f(char * c) { char d[1024]; g(d); } - int main(int argc, char ** argv) { struct sigaltstack stk; struct sigaction act; - struct rlimit limit; stk.ss_sp = sig_alt_stack; stk.ss_size = SIGSTKSZ; @@ -63,10 +58,11 @@ int main(int argc, char ** argv) #endif sigemptyset(&act.sa_mask); system_stack_top = (char *) &act; - limit.rlim_max = limit.rlim_cur = 0x20000; if (sigaltstack(&stk, NULL) != 0) { perror("sigaltstack"); return 2; } if (sigaction(SIGSEGV, &act, NULL) != 0) { perror("sigaction"); return 2; } - if (setrlimit(RLIMIT_STACK, &limit) != 0) { perror("setrlimit"); return 2; } - f(NULL); - return 2; + /* We used to trigger a stack overflow at this point to test whether + the code above works, but this causes problems with POSIX threads + on some BSD systems. So, instead, we just test that all this + code compiles, indicating that the required syscalls are there. */ + return 0; } diff --git a/config/auto-aux/tclversion.c b/config/auto-aux/tclversion.c index ebd1224f..77c0bb72 100644 --- a/config/auto-aux/tclversion.c +++ b/config/auto-aux/tclversion.c @@ -1,5 +1,6 @@ #include #include +#include main () { diff --git a/configure b/configure index b45aaefb..d3981084 100755 --- a/configure +++ b/configure @@ -13,7 +13,7 @@ # # ######################################################################### -# $Id: configure,v 1.195 2003/07/22 07:41:31 xleroy Exp $ +# $Id: configure,v 1.202 2003/09/25 08:17:13 xleroy Exp $ configure_options="$*" prefix=/usr/local @@ -30,6 +30,7 @@ dllib='' x11_include_dir='' x11_lib_dir='' tk_wanted=yes +pthread_wanted=yes tk_defs='' tk_libs='' tk_x11=yes @@ -44,6 +45,9 @@ gcc_warnings="-Wall -Wno-unused" unset LANG unset LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME +# Turn off some MacOS X debugging stuff, same reason +unset RC_TRACE_ARCHIVES RC_TRACE_DYLIBS RC_TRACE_PREBINDING_DISABLED + # Parse command-line arguments while : ; do @@ -81,6 +85,8 @@ while : ; do x11_lib_dir=$2; shift;; -with-pthread*|--with-pthread*) ;; # Ignored for backward compatibility + -no-pthread*|--no-pthread*) + pthread_wanted=no;; -no-tk|--no-tk) tk_wanted=no;; -tkdefs*|--tkdefs*) @@ -543,6 +549,7 @@ case "$host" in i[3456]86-*-cygwin*) arch=i386; system=cygwin;; mips-*-irix6*) arch=mips; system=irix;; hppa1.1-*-hpux*) arch=hppa; system=hpux;; + hppa2.0*-*-hpux*) arch=hppa; system=hpux;; hppa1.1-*-nextstep*) arch=hppa; system=nextstep;; rs6000-*-aix*) arch=power; model=rs6000; system=aix;; powerpc-*-aix*) arch=power; model=ppc; system=aix;; @@ -1003,11 +1010,11 @@ fi # Determine if system stack overflows can be detected case "$arch,$system" in - i386,linux_elf|i386,bsd_elf) - echo "System stack overflow can be detected." - echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;; + i386,linux_elf) + echo "System stack overflow can be detected." + echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;; *) - echo "Cannot detect system stack overflow.";; + echo "Cannot detect system stack overflow.";; esac # Determine the target architecture for the "num" library @@ -1047,6 +1054,7 @@ case "$host" in *) pthread_link="-lpthread";; esac +if test "$pthread_wanted" = "yes"; then if ./hasgot -i pthread.h $pthread_link pthread_self; then echo "POSIX threads library supported." otherlibraries="$otherlibraries systhreads" @@ -1063,9 +1071,14 @@ if ./hasgot -i pthread.h $pthread_link pthread_self; then esac echo "Options for linking with POSIX threads: $pthread_link" echo "PTHREAD_LINK=$pthread_link" >> Makefile + if sh ./hasgot $pthread_link sigwait; then + echo "sigwait() found" + echo "#define HAS_SIGWAIT" >> s.h + fi else echo "POSIX threads not found." fi +fi # Determine if the bytecode thread library is supported @@ -1182,6 +1195,7 @@ for dir in \ do if test -f $dir/libX11.a || \ test -f $dir/libX11.so || \ + test -f $dir/libX11.dll.a || \ test -f $dir/libX11.sa; then if test $dir = /usr/lib; then x11_link="-lX11" @@ -1228,6 +1242,8 @@ for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do dbm_link="-ldb1" elif sh ./hasgot -lgdbm dbm_open; then dbm_link="-lgdbm" + elif sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then + dbm_link="-lgdbm_compat -lgdbm" fi break fi @@ -1357,6 +1373,9 @@ if test $has_tk = true; then tk_libs="$tk_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin $dllib" # elif sh ./hasgot $tk_libs -ltcl $tkauxlibs Tcl_DoOneEvent; then # tk_libs="$tk_libs -ltk -ltcl" + elif sh ./hasgot -L/sw/lib $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs \ + Tcl_DoOneEvent + then tk_libs="-L/sw/lib -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib" else echo "Tcl library not found." has_tk=false diff --git a/debugger/command_line.ml b/debugger/command_line.ml index 0b6ed387..9715d3e6 100644 --- a/debugger/command_line.ml +++ b/debugger/command_line.ml @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: command_line.ml,v 1.16 2003/07/17 14:04:03 doligez Exp $ *) +(* $Id: command_line.ml,v 1.17 2003/09/09 16:02:19 xleroy Exp $ *) (************************ Reading and executing commands ***************) @@ -1012,7 +1012,7 @@ using \"load_printer\"." }; "mode of loading.\n\ It can be either : direct : the program is directly called by the debugger.\n\ - runtime : the debugger execute `camlrun -D socket programname arguments'.\n\ + runtime : the debugger execute `ocamlrun programname arguments'.\n\ manual : the program is not launched by the debugger,\n\ but manually by the user." }; { var_name = "processcount"; diff --git a/driver/compile.ml b/driver/compile.ml index 10b343d5..7bfe042b 100644 --- a/driver/compile.ml +++ b/driver/compile.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: compile.ml,v 1.52 2003/07/17 08:38:27 xleroy Exp $ *) +(* $Id: compile.ml,v 1.53 2003/07/25 12:17:18 xleroy Exp $ *) (* The batch compiler *) @@ -37,8 +37,9 @@ let init_path () = (* Return the initial environment in which compilation proceeds. *) +(* Note: do not do init_path() in initial_env, this breaks + toplevel initialization (PR#1775) *) let initial_env () = - init_path(); Ident.reinit(); try if !Clflags.nopervasives @@ -50,6 +51,7 @@ let initial_env () = (* Compile a .mli file *) let interface ppf sourcefile = + init_path(); let prefixname = chop_extension_if_any sourcefile in let modulename = String.capitalize(Filename.basename prefixname) in let inputfile = Pparse.preprocess sourcefile in @@ -78,6 +80,7 @@ let print_if ppf flag printer arg = let (++) x f = f x let implementation ppf sourcefile = + init_path(); let prefixname = chop_extension_if_any sourcefile in let modulename = String.capitalize(Filename.basename prefixname) in let inputfile = Pparse.preprocess sourcefile in diff --git a/driver/optcompile.ml b/driver/optcompile.ml index 5a15e39d..143ba525 100644 --- a/driver/optcompile.ml +++ b/driver/optcompile.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: optcompile.ml,v 1.46 2003/07/17 08:38:27 xleroy Exp $ *) +(* $Id: optcompile.ml,v 1.47 2003/07/25 12:17:19 xleroy Exp $ *) (* The batch compiler *) @@ -37,7 +37,6 @@ let init_path () = (* Return the initial environment in which compilation proceeds. *) let initial_env () = - init_path(); Ident.reinit(); try if !Clflags.nopervasives @@ -49,6 +48,7 @@ let initial_env () = (* Compile a .mli file *) let interface ppf sourcefile = + init_path(); let prefixname = Misc.chop_extension_if_any sourcefile in let modulename = String.capitalize(Filename.basename prefixname) in let inputfile = Pparse.preprocess sourcefile in @@ -78,6 +78,7 @@ let (++) x f = f x let (+++) (x, y) f = (x, f y) let implementation ppf sourcefile = + init_path(); let prefixname = Misc.chop_extension_if_any sourcefile in let modulename = String.capitalize(Filename.basename prefixname) in let inputfile = Pparse.preprocess sourcefile in diff --git a/emacs/Makefile b/emacs/Makefile index 43b3c7b1..c68fa6a3 100644 --- a/emacs/Makefile +++ b/emacs/Makefile @@ -1,10 +1,11 @@ -# $Id: Makefile,v 1.10 2003/06/12 11:39:04 doligez Exp $ +# $Id: Makefile,v 1.15 2003/08/29 15:38:28 doligez Exp $ include ../config/Makefile # Files to install FILES= caml-font.el caml-hilit.el caml.el camldebug.el \ - inf-caml.el caml-compat.el caml-help.el + inf-caml.el caml-compat.el caml-help.el caml-types.el \ + caml-xemacs.el caml-emacs.el # Where to install. If empty, automatically determined. #EMACSDIR= @@ -18,6 +19,8 @@ SCRIPTDIR = $(BINDIR) # Command for byte-compiling the files COMPILECMD=(progn \ (setq load-path (cons "." load-path)) \ + (byte-compile-file "caml-xemacs.el") \ + (byte-compile-file "caml-emacs.el") \ (byte-compile-file "caml.el") \ (byte-compile-file "inf-caml.el") \ (byte-compile-file "caml-help.el") \ @@ -37,11 +40,17 @@ install: $(MAKE) simple-install; \ fi +# install the .el files, but do not compile them. +install-el: + $(MAKE) NOCOMPILE=true install + simple-install: @echo "Installing in $(EMACSDIR)..." if test -d $(EMACSDIR); then : ; else mkdir -p $(EMACSDIR); fi cp $(FILES) $(EMACSDIR) - cd $(EMACSDIR); $(EMACS) --batch --eval '$(COMPILECMD)' + if [ -z "$(NOCOMPILE)" ]; then \ + cd $(EMACSDIR); $(EMACS) --batch --eval '$(COMPILECMD)'; \ + fi ocamltags: ocamltags.in sed -e 's:@EMACS@:$(EMACS):' ocamltags.in >ocamltags diff --git a/emacs/caml-emacs.el b/emacs/caml-emacs.el new file mode 100644 index 00000000..25132eea --- /dev/null +++ b/emacs/caml-emacs.el @@ -0,0 +1,14 @@ +;; for caml-help.el +(defalias 'caml-info-other-window 'info-other-window) + +;; for caml-types.el + +(defalias 'caml-line-beginning-position 'line-beginning-position) + +(defun caml-event-window (e) (posn-window (event-start e))) +(defun caml-event-point-start (e) (posn-point (event-start e))) +(defun caml-event-point-end (e) (posn-point (event-end e))) +(defalias 'caml-track-mouse 'track-mouse) +(defalias 'caml-read-event 'read-event) + +(provide 'caml-emacs) diff --git a/emacs/caml-help.el b/emacs/caml-help.el index 881a5572..d2a448b4 100644 --- a/emacs/caml-help.el +++ b/emacs/caml-help.el @@ -27,6 +27,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(eval-and-compile + (if (and (boundp 'running-xemacs) running-xemacs) + (require 'caml-xemacs) + (require 'caml-emacs))) + ;; Loading or building databases. ;; @@ -217,7 +222,7 @@ When call interactively, make completion over known modules." (interactive "P") (if (not (stringp arg)) - (let ((modules (ocaml-module-alist)) module) + (let ((modules (ocaml-module-alist))) (setq arg (completing-read "Open module: " modules)))) (if (and (stringp arg) (not (equal arg ""))) @@ -236,7 +241,7 @@ Otherwise if ARG is true, close all modules and reset to default. " (interactive "P") (if (= (prefix-numeric-value arg) 4) (setq ocaml-visible-modules 'lazy) - (let* ((modules (ocaml-visible-modules)) default) + (let* ((modules (ocaml-visible-modules))) (if (null modules) (error "No visible module to close")) (unless (stringp arg) (setq arg @@ -314,7 +319,7 @@ with an optional non-nil argument. ))) (defun caml-complete (arg) - "Does completion for qualified identifiers. + "Does completion for OCaml identifiers qualified. It attemps to recognize an qualified identifier Module . entry around point using function \\[ocaml-qualified-identifier]. @@ -325,9 +330,8 @@ If Module is undefined, it does completion in visible modules. Then, if completion fails, it does completion among all modules where identifier is defined." (interactive "p") - (let* ((module-entry (ocaml-qualified-identifier)) + (let* ((module-entry (ocaml-qualified-identifier)) (entry) (module) - (entry (cdr module-entry)) (beg) (end) (pattern)) (if (car module-entry) (progn @@ -360,8 +364,7 @@ where identifier is defined." (error "Did not find anything to complete around point") (setq pattern (buffer-substring beg end)) - (let* ((table 'ocaml-completion) - (all-completions (ocaml-completion pattern module)) + (let* ((all-completions (ocaml-completion pattern module)) (completion (try-completion pattern (mapcar 'list all-completions)))) (cond ((eq completion t)) @@ -382,7 +385,7 @@ where identifier is defined." (t (setq hist (mapcar 'car modules)) (completing-read "Module: " modules nil t - "" (cons 'hist 0))) + "" (cons hist 0))) ))) (if (null module) (error "Can't find completion for \"%s\"" pattern) @@ -556,6 +559,7 @@ command. An entry may be an info module or a complete file name." ;; Help function. + (defun ocaml-goto-help (&optional module entry) "Searches info manual for MODULE and ENTRY in MODULE. If unspecified, MODULE and ENTRY are inferred from the position in the @@ -564,7 +568,7 @@ current buffer using \\[ocaml-qualified-identifier]." (let ((window (selected-window)) (info-section (assoc module (ocaml-info-alist)))) (if info-section - (info-other-window (cdr info-section)) + (caml-info-other-window (cdr info-section)) (ocaml-visible-modules) (let* ((module-info (or (assoc module (ocaml-module-alist)) @@ -607,7 +611,7 @@ current buffer using \\[ocaml-qualified-identifier]." )) (defun caml-help (arg) - "Find help for qualified identifiers. + "Find documentation for OCaml qualified identifiers. It attemps to recognize an qualified identifier of the form ``Module . entry'' around point using function `ocaml-qualified-identifier'. @@ -715,9 +719,8 @@ buffer positions." (defun ocaml-link-goto (click) (interactive "e") - (let* ((start (event-start click)) - (pos (posn-point start)) - (buf (window-buffer (posn-window start))) + (let* ((pos (caml-event-point-start click)) + (buf (window-buffer (caml-event-window click))) (window (selected-window)) (link)) (setq link @@ -770,30 +773,30 @@ buffer positions." -;; bindings - -(and - (boundp 'caml-mode-map) - (keymapp caml-mode-map) - (progn - (define-key caml-mode-map [?\C-c?i] 'ocaml-add-path) - (define-key caml-mode-map [?\C-c?]] 'ocaml-close-module) - (define-key caml-mode-map [?\C-c?[] 'ocaml-open-module) - (define-key caml-mode-map [?\C-c?\C-h] 'caml-help) - (define-key caml-mode-map [?\C-c?\t] 'caml-complete) - (let ((map (lookup-key caml-mode-map [menu-bar caml]))) - (and - (keymapp map) - (progn - (define-key map [separator-help] '("---")) - (define-key map [open] '("Open add path" . ocaml-add-path )) - (define-key map [close] - '("Close module for help" . ocaml-close-module)) - (define-key map [open] '("Open module for help" . ocaml-open-module)) - (define-key map [help] '("Help for identifier" . caml-help)) - (define-key map [complete] '("Complete identifier" . caml-complete)) - ) - )))) +;; bindings ---now in caml.el + +; (and +; (boundp 'caml-mode-map) +; (keymapp caml-mode-map) +; (progn +; (define-key caml-mode-map [?\C-c?i] 'ocaml-add-path) +; (define-key caml-mode-map [?\C-c?]] 'ocaml-close-module) +; (define-key caml-mode-map [?\C-c?[] 'ocaml-open-module) +; (define-key caml-mode-map [?\C-c?\C-h] 'caml-help) +; (define-key caml-mode-map [?\C-c?\t] 'caml-complete) +; (let ((map (lookup-key caml-mode-map [menu-bar caml]))) +; (and +; (keymapp map) +; (progn +; (define-key map [separator-help] '("---")) +; (define-key map [open] '("Open add path" . ocaml-add-path )) +; (define-key map [close] +; '("Close module for help" . ocaml-close-module)) +; (define-key map [open] '("Open module for help" . ocaml-open-module)) +; (define-key map [help] '("Help for identifier" . caml-help)) +; (define-key map [complete] '("Complete identifier" . caml-complete)) +; ) +; )))) (provide 'caml-help) diff --git a/emacs/caml-types.el b/emacs/caml-types.el index 4e50b210..b4c43df6 100644 --- a/emacs/caml-types.el +++ b/emacs/caml-types.el @@ -10,71 +10,48 @@ ;(* *) ;(***********************************************************************) -;(* $Id: caml-types.el,v 1.8 2003/06/12 12:52:17 doligez Exp $ *) - -; WARNING: -; This code is experimental. Everything may change at any time. +;(* $Id: caml-types.el,v 1.24 2003/09/05 18:01:46 remy Exp $ *) ; An emacs-lisp complement to the "-dtypes" option of ocamlc and ocamlopt. -; Load this file in your emacs, then C-c C-t will show you the -; type of the expression (or pattern) that contains the cursor. -; The expression is highlighted in the current buffer. -; The type is highlighted in "foo.annot" (if your file is "foo.ml"), -; which is convenient when the type doesn't fit on a line. - - -; Hints on using the type display: - -; . If you want the type of an identifier, put the cursor in any -; occurrence of this identifier (as expression or as pattern) and -; type C-c C-t -; . If you want the result type of a function application, put the -; cursor at the first space after the function name -; . If you want the type of a list, put the cursor on a bracket, -; or on a semicolon, or on the :: constructor -; . Even if type checking fails, you can still look at the types -; in the file, up to where the type checker failed. -; . To get rid of the highlighting, put the cursor in a comment -; and type C-c C-t. -; . The mark in the foo.annot file is set to the beginning of the -; type, so you can type C-x C-x in that file to view the type. - - -; TO DO: -; - make emacs scroll the foo.annot file to show the type -; - (?) integrate this file into caml.el +;; XEmacs compatibility +(eval-and-compile + (if (and (boundp 'running-xemacs) running-xemacs) + (require 'caml-xemacs) + (require 'caml-emacs))) -; Format of the *.annot files: +(defvar caml-types-location-re nil "Regexp to parse *.annot files. -; file ::= block * -; block ::= position position annotation * -; position ::= filename num num num -; annotation ::= keyword open-paren data close-paren +Annotation files *.annot may be generated with the \"-dtypes\" option +of ocamlc and ocamlopt. -; is a space character (ASCII 0x20) -; is a line-feed character (ASCII 0x0A) -; num is a sequence of decimal digits -; filename is a string with the lexical conventions of O'Caml -; open-paren is an open parenthesis (ASCII 0x28) -; close-paren is a closed parenthesis (ASCII 0x29) -; data is any sequence of characters where is always followed by -; at least two space characters. +Their format is: -; in each block, the two positions are respectively the start and the -; end of the range described by the block. -; in a position, the filename is the name of the file, the first num -; is the line number, the second num is the offset of the beginning -; of the line, the third num is the offset of the position itself. -; the char number within the line is the difference between the third -; and second nums. + file ::= block * + block ::= position position annotation * + position ::= filename num num num + annotation ::= keyword open-paren data close-paren -; For the moment, the only possible keyword is "type". + is a space character (ASCII 0x20) + is a line-feed character (ASCII 0x0A) + num is a sequence of decimal digits + filename is a string with the lexical conventions of O'Caml + open-paren is an open parenthesis (ASCII 0x28) + close-paren is a closed parenthesis (ASCII 0x29) + data is any sequence of characters where is always followed by + at least two space characters. +- in each block, the two positions are respectively the start and the +- end of the range described by the block. +- in a position, the filename is the name of the file, the first num + is the line number, the second num is the offset of the beginning + of the line, the third num is the offset of the position itself. +- the char number within the line is the difference between the third + and second nums. -; (global-set-key "\C-c\C-t" 'caml-types-show-type) - +For the moment, the only possible keyword is \"type\"." +) (let* ((caml-types-filename-re "\"\\(\\([^\\\"]\\|\\\\.\\)*\\)\"") (caml-types-number-re "\\([0-9]*\\)") @@ -86,111 +63,410 @@ (setq caml-types-location-re (concat "^" caml-types-position-re " " caml-types-position-re))) -(setq caml-types-expr-ovl (make-overlay 1 1)) -(overlay-put caml-types-expr-ovl 'face 'region) -(setq caml-types-type-ovl (make-overlay 1 1)) -(overlay-put caml-types-type-ovl 'face 'region) +(defvar caml-types-expr-ovl (make-overlay 1 1)) + +(make-face 'caml-types-face) +(set-face-doc-string 'caml-types-face + "face for hilighting expressions and types") +(if (not (face-differs-from-default-p 'caml-types-face)) + (set-face-background 'caml-types-face "#88FF44")) + +(defvar caml-types-typed-ovl (make-overlay 1 1)) + +(make-face 'caml-types-typed-face) +(set-face-doc-string 'caml-types-typed-face + "face for hilighting typed expressions") +(if (not (face-differs-from-default-p 'caml-types-typed-face)) + (set-face-background 'caml-types-typed-face "#FF8844")) + +(overlay-put caml-types-expr-ovl 'face 'caml-types-face) +(overlay-put caml-types-typed-ovl 'face 'caml-types-typed-face) -(defun caml-types-show-type () - "Highlight the smallest expression that contains the cursor, - and display its type in the minibuffer." - (interactive) + +(defvar caml-types-annotation-tree nil) +(defvar caml-types-annotation-date nil) +(make-variable-buffer-local 'caml-types-annotation-tree) +(make-variable-buffer-local 'caml-types-annotation-date) + +(defvar caml-types-buffer-name "*caml-types*" + "Name of buffer for diplaying caml types") +(defvar caml-types-buffer nil + "buffer for diplaying caml types") + +(defun caml-types-show-type (arg) + "Show the type of expression or pattern at point. + The smallest expression or pattern that contains point is + temporarily highlighted. Its type is highlighted in the .annot + file and the mark is set to the beginning of the type. + The type is also displayed in the mini-buffer. + + Hints on using the type display: + . If you want the type of an identifier, put point within any + occurrence of this identifier. + . If you want the result type of a function application, put point + at the first space after the function name. + . If you want the type of a list, put point on a bracket, on a + semicolon, or on the :: constructor. + . Even if type checking fails, you can still look at the types + in the file, up to where the type checker failed. + +Types are also diplayed in the buffer *caml-types*, which buffer is +display when the commande is called with Prefix argument 4. + +See also `caml-types-explore' for exploration by mouse dragging. +See `caml-types-location-re' for annotation file format. +" + (interactive "p") (let* ((target-buf (current-buffer)) (target-file (file-name-nondirectory (buffer-file-name))) - (target-date (nth 5 (file-attributes (buffer-file-name)))) - (target-line (1+ (count-lines (point-min) (line-beginning-position)))) - (target-bol (line-beginning-position)) + (target-line (1+ (count-lines (point-min) + (caml-line-beginning-position)))) + (target-bol (caml-line-beginning-position)) (target-cnum (point)) (type-file (concat (file-name-sans-extension (buffer-file-name)) - ".annot")) - (type-date (nth 5 (file-attributes type-file))) - (type-buf (caml-types-find-file type-file))) - (if (caml-types-date< type-date target-date) - (message (format "%s is more recent than %s" target-file type-file)) - (save-excursion - (set-buffer type-buf) - (goto-char (point-min)) - (let ((loc (caml-types-find-location target-file target-line - target-bol target-cnum))) - (if (null loc) - (progn - (move-overlay caml-types-expr-ovl 1 1) - (move-overlay caml-types-type-ovl 1 1) - (message "The cursor is not within a typechecked expression or pattern.")) - (let ((left (caml-types-get-pos target-buf (nth 0 loc) (nth 1 loc))) - (right (caml-types-get-pos target-buf - (nth 2 loc) (nth 3 loc)))) - (move-overlay caml-types-expr-ovl left right target-buf)) - (re-search-forward "^type(") ;; not strictly correct - (forward-line 1) - (re-search-forward " \\(\\([^\n)]\\|.)\\|\n[^)]\\)*\\)\n)") - (move-overlay caml-types-type-ovl (match-beginning 1) (match-end 1) - type-buf) - (message (format "type: %s" (match-string 1))) - ; *** this doesn't seem to work, I don't know why... - ; *** (goto-char type-point) - ; *** workaround: set the mark instead - (set-mark (match-beginning 1)) - (set-buffer target-buf))))))) + ".annot"))) + (caml-types-preprocess type-file) + (unless caml-types-buffer + (setq caml-types-buffer (get-buffer-create caml-types-buffer-name))) + (let* ((targ-loc (vector target-file target-line target-bol target-cnum)) + (node (caml-types-find-location targ-loc () + caml-types-annotation-tree))) + (cond + ((null node) + (delete-overlay caml-types-expr-ovl) + (message "Point is not within a typechecked expression or pattern.") + ; (with-current-buffer type-buf (narrow-to-region 1 1)) + ) + (t + (let ((left (caml-types-get-pos target-buf (elt node 0))) + (right (caml-types-get-pos target-buf (elt node 1))) + (type (elt node 2))) + (move-overlay caml-types-expr-ovl left right target-buf) + (with-current-buffer caml-types-buffer + (erase-buffer) + (insert type) + (message (format "type: %s" type))) + )))) + (if (and (= arg 4) + (not (window-live-p (get-buffer-window caml-types-buffer)))) + (display-buffer caml-types-buffer)) + (unwind-protect + (sit-for 60) + (delete-overlay caml-types-expr-ovl) + ))) + +(defun caml-types-preprocess (type-file) + (let* ((type-date (nth 5 (file-attributes type-file))) + (target-file (file-name-nondirectory (buffer-file-name))) + (target-date (nth 5 (file-attributes target-file)))) + (unless (and caml-types-annotation-tree + (not (caml-types-date< caml-types-annotation-date type-date))) + (if (caml-types-date< type-date target-date) + (error (format "%s is more recent than %s" target-file type-file))) + (message "Reading annotation file...") + (let* ((type-buf (caml-types-find-file type-file)) + (tree (with-current-buffer type-buf + (widen) + (goto-char (point-min)) + (caml-types-build-tree target-file)))) + (setq caml-types-annotation-tree tree + caml-types-annotation-date type-date) + (kill-buffer type-buf) + (message "")) + ))) (defun caml-types-date< (date1 date2) (or (< (car date1) (car date2)) (and (= (car date1) (car date2)) (< (nth 1 date1) (nth 1 date2))))) -(defun caml-types-find-location (targ-file targ-line targ-bol targ-cnum) - (let (found) - (catch 'exit - (while (re-search-forward caml-types-location-re () t) - (let ((left-file (file-name-nondirectory (match-string 1))) - (left-line (string-to-int (match-string 3))) - (left-bol (string-to-int (match-string 4))) - (left-cnum (string-to-int (match-string 5))) - (right-file (file-name-nondirectory (match-string 6))) - (right-line (string-to-int (match-string 8))) - (right-bol (string-to-int (match-string 9))) - (right-cnum (string-to-int (match-string 10)))) - (if (and (caml-types-pos<= left-file left-line left-bol left-cnum - targ-file targ-line targ-bol targ-cnum) - (caml-types-pos> right-file right-line right-bol right-cnum - targ-file targ-line targ-bol targ-cnum)) - (throw 'exit (list left-line (- left-cnum left-bol) - right-line (- right-cnum right-bol))))))))) + +; we use an obarray for hash-consing the strings within each tree + +(defun caml-types-make-hash-table () + (make-vector 255 0)) + +(defun caml-types-hcons (elem table) + (symbol-name (intern elem table))) + + +; tree of intervals +; each node is a vector +; [ pos-left pos-right type-info child child child... ] +; type-info = +; () if this node does not correspond to an annotated interval +; (type-start . type-end) address of the annotation in the .annot file + +(defun caml-types-build-tree (target-file) + (let ((stack ()) + (accu ()) + (table (caml-types-make-hash-table)) + (type-info ())) + (while (re-search-forward caml-types-location-re () t) + (let ((l-file (file-name-nondirectory (match-string 1))) + (l-line (string-to-int (match-string 3))) + (l-bol (string-to-int (match-string 4))) + (l-cnum (string-to-int (match-string 5))) + (r-file (file-name-nondirectory (match-string 6))) + (r-line (string-to-int (match-string 8))) + (r-bol (string-to-int (match-string 9))) + (r-cnum (string-to-int (match-string 10)))) + (unless (caml-types-not-in-file l-file r-file target-file) + (while (and (re-search-forward "^" () t) + (not (looking-at "type")) + (not (looking-at "\\\""))) + (forward-char 1)) + (setq type-info + (if (looking-at + "^type(\n\\( \\([^\n)]\\|.)\\|\n[^)]\\)*\\)\n)") + (caml-types-hcons (match-string 1) table))) + (setq accu ()) + (while (and stack + (caml-types-pos-contains l-cnum r-cnum (car stack))) + (setq accu (cons (car stack) accu)) + (setq stack (cdr stack))) + (let* ((left-pos (vector l-file l-line l-bol l-cnum)) + (right-pos (vector r-file r-line r-bol r-cnum)) + (node (caml-types-make-node left-pos right-pos type-info + accu))) + (setq stack (cons node stack)))))) + (if (null stack) + (error "no annotations found for this source file") + (let* ((left-pos (elt (car (last stack)) 0)) + (right-pos (elt (car stack) 1))) + (if (null (cdr stack)) + (car stack) + (caml-types-make-node left-pos right-pos () (nreverse stack))))))) + +(defun caml-types-not-in-file (l-file r-file target-file) + (or (and (not (string= l-file target-file)) + (not (string= l-file ""))) + (and (not (string= r-file target-file)) + (not (string= r-file ""))))) + +(defun caml-types-make-node (left-pos right-pos type-info children) + (let ((result (make-vector (+ 3 (length children)) ())) + (i 3)) + (aset result 0 left-pos) + (aset result 1 right-pos) + (aset result 2 type-info) + (while children + (aset result i (car children)) + (setq children (cdr children)) + (setq i (1+ i))) + result)) + +(defun caml-types-pos-contains (l-cnum r-cnum node) + (and (<= l-cnum (elt (elt node 0) 3)) + (>= r-cnum (elt (elt node 1) 3)))) + +(defun caml-types-find-location (targ-pos curr node) + (if (not (caml-types-pos-inside targ-pos node)) + curr + (if (elt node 2) + (setq curr node)) + (let ((i (caml-types-search node targ-pos))) + (if (and (> i 3) + (caml-types-pos-inside targ-pos (elt node (1- i)))) + (caml-types-find-location targ-pos curr (elt node (1- i))) + curr)))) + +; trouve le premier fils qui commence apres la position +; ou (length node) si tous commencent avant +(defun caml-types-search (node pos) + (let ((min 3) + (max (length node)) + med) + (while (< min max) + (setq med (/ (+ min max) 2)) + (if (caml-types-pos<= (elt (elt node med) 0) pos) + (setq min (1+ med)) + (setq max med))) + min)) + +(defun caml-types-pos-inside (pos node) + (let ((left-pos (elt node 0)) + (right-pos (elt node 1))) + (and (caml-types-pos<= left-pos pos) + (caml-types-pos> right-pos pos)))) + +(defun caml-types-find-interval (buf targ-pos node) + (let ((nleft (elt node 0)) + (nright (elt node 1)) + (left ()) + (right ()) + i) + (cond + ((not (caml-types-pos-inside targ-pos node)) + (if (not (caml-types-pos<= nleft targ-pos)) + (setq right nleft)) + (if (not (caml-types-pos> nright targ-pos)) + (setq left nright))) + (t + (setq left nleft + right nright) + (setq i (caml-types-search node targ-pos)) + (if (< i (length node)) + (setq right (elt (elt node i) 0))) + (if (> i 3) + (setq left (elt (elt node (1- i)) 1))))) + (cons (if left + (caml-types-get-pos buf left) + (with-current-buffer buf (point-min))) + (if right + (caml-types-get-pos buf right) + (with-current-buffer buf (point-max)))))) ;; Warning: these comparison functions are not symmetric. ;; The first argument determines the format: ;; when its file component is empty, only the cnum is compared. -(defun caml-types-pos<= (file1 line1 bol1 cnum1 file2 line2 bol2 cnum2) - (if (string= file1 "") - (<= cnum1 cnum2) - (and (string= file1 file2) - (or (< line1 line2) - (and (= line1 line2) - (<= (- cnum1 bol1) (- cnum2 bol2))))))) - -(defun caml-types-pos> (file1 line1 bol1 cnum1 file2 line2 bol2 cnum2) - (if (string= file1 "") - (> cnum1 cnum2) - (and (string= file1 file2) - (or (> line1 line2) - (and (= line1 line2) - (> (- cnum1 bol1) (- cnum2 bol2))))))) - -(defun caml-types-get-pos (buf line col) +(defun caml-types-pos<= (pos1 pos2) + (let ((file1 (elt pos1 0)) + (line1 (elt pos1 1)) + (bol1 (elt pos1 2)) + (cnum1 (elt pos1 3)) + (file2 (elt pos2 0)) + (line2 (elt pos2 1)) + (bol2 (elt pos2 2)) + (cnum2 (elt pos2 3))) + (if (string= file1 "") + (<= cnum1 cnum2) + (and (string= file1 file2) + (or (< line1 line2) + (and (= line1 line2) + (<= (- cnum1 bol1) (- cnum2 bol2)))))))) + +(defun caml-types-pos> (pos1 pos2) + (let ((file1 (elt pos1 0)) + (line1 (elt pos1 1)) + (bol1 (elt pos1 2)) + (cnum1 (elt pos1 3)) + (file2 (elt pos2 0)) + (line2 (elt pos2 1)) + (bol2 (elt pos2 2)) + (cnum2 (elt pos2 3))) + (if (string= file1 "") + (> cnum1 cnum2) + (and (string= file1 file2) + (or (> line1 line2) + (and (= line1 line2) + (> (- cnum1 bol1) (- cnum2 bol2)))))))) + +(defun caml-types-get-pos (buf pos) (save-excursion (set-buffer buf) - (goto-line line) - (forward-char col) + (goto-line (elt pos 1)) + (forward-char (- (elt pos 3) (elt pos 2))) (point))) ; find-file-read-only-noselect seems to be missing from emacs... (defun caml-types-find-file (name) - (or (and (get-file-buffer name) - (find-file-noselect name)) - (let ((buf (find-file-noselect name))) - (save-excursion - (set-buffer buf) - (toggle-read-only 1)) - buf))) + (let (buf) + (cond + ((setq buf (get-file-buffer name)) + (unless (verify-visited-file-modtime buf) + (if (buffer-modified-p buf) + (find-file-noselect name) + (with-current-buffer buf (revert-buffer t t))) + )) + ((and (file-readable-p name) + (setq buf (find-file-noselect name))) + (with-current-buffer buf (toggle-read-only 1)) + ) + (t + (error "No annotation file. You may compile with \"-dtypes\" option")) + ) + buf)) + + +(defun caml-types-explore (event) + "Explore type annotations by mouse dragging. + +The expression under the mouse is highlighted +and its type is displayed in the minibuffer, until the move is released." + (interactive "e") + (set-buffer (window-buffer (caml-event-window event))) + (let* ((target-buf (current-buffer)) + (target-file (file-name-nondirectory (buffer-file-name))) + (type-file (concat (file-name-sans-extension (buffer-file-name)) + ".annot")) + (target-line) (target-bol) + target-pos + Left Right limits cnum node mes type + (tree caml-types-annotation-tree) + region + ) + (caml-types-preprocess type-file) + (unless caml-types-buffer + (setq caml-types-buffer (get-buffer-create caml-types-buffer-name))) + ;; (message "Drag the mouse to explore types") + (unwind-protect + (caml-track-mouse + (setq region + (caml-types-typed-make-overlay target-buf + (caml-event-point-start event))) + (while (and event + (integer-or-marker-p + (setq cnum (caml-event-point-end event)))) + (if (and region (<= (car region) cnum) (<= cnum (cdr region))) + (if (and limits (>= cnum (car limits)) (< cnum (cdr limits))) + (message mes) + (setq target-bol + (save-excursion (goto-char cnum) + (caml-line-beginning-position))) + (setq target-line + (1+ (count-lines (point-min) target-bol))) + (setq target-pos (vector target-file target-line target-bol cnum)) + (save-excursion + (setq node (caml-types-find-location target-pos () tree)) + (set-buffer caml-types-buffer) + (erase-buffer) + (cond + (node + (setq Left (caml-types-get-pos target-buf (elt node 0))) + (setq Right (caml-types-get-pos target-buf (elt node 1))) + (move-overlay caml-types-expr-ovl Left Right target-buf) + (setq limits (caml-types-find-interval target-buf target-pos + node)) + (setq type (elt node 2)) + ) + (t + (delete-overlay caml-types-expr-ovl) + (setq type "*no type information*") + (setq limits (caml-types-find-interval target-buf target-pos + tree)) + )) + (message (setq mes (format "type: %s" type))) + (insert type) + ))) + (setq event (caml-read-event)) + (unless (mouse-movement-p event) (setq event nil)) + ) + ) + (delete-overlay caml-types-expr-ovl) + (delete-overlay caml-types-typed-ovl) + ))) + +(defun caml-types-typed-make-overlay (target-buf pos) + (interactive "p") + (let ((start pos) (end pos) len node left right) + (setq len (length caml-types-annotation-tree)) + (while (> len 3) + (setq len (- len 1)) + (setq node (aref caml-types-annotation-tree len)) + (if (and (equal target-buf (current-buffer)) + (setq left (caml-types-get-pos target-buf (elt node 0)) + right (caml-types-get-pos target-buf (elt node 1))) + (<= left pos) (>= right pos) + ) + (setq start (min start left) + end (max end right)) + )) + (move-overlay caml-types-typed-ovl + (max (point-min) (- start 1)) + (min (point-max) (+ end 1)) target-buf) + (cons start end))) + +(provide 'caml-types) diff --git a/emacs/caml-xemacs.el b/emacs/caml-xemacs.el new file mode 100644 index 00000000..9fae982c --- /dev/null +++ b/emacs/caml-xemacs.el @@ -0,0 +1,19 @@ +(require 'overlay) + +;; for caml-help.el +(defun caml-info-other-window (arg) + (save-excursion (info arg)) + (view-buffer-other-window "*info*")) + +;; for caml-types.el +(defun caml-line-beginning-position () + (save-excursion (beginning-of-line) (point))) + +(defun caml-event-window (e) (event-window e)) +(defun caml-event-point-start (e) (event-closest-point e)) +(defun caml-event-point-end (e) (event-closest-point e)) +(defalias 'caml-track-mouse 'progn) +(defalias 'caml-read-event 'next-event) +(defun mouse-movement-p (e) (equal (event-type e) 'motion)) + +(provide 'caml-xemacs) diff --git a/emacs/caml.el b/emacs/caml.el index 09df4809..68b4ee43 100644 --- a/emacs/caml.el +++ b/emacs/caml.el @@ -259,8 +259,8 @@ have caml-electric-indent on, which see.") (defvar caml-shell-active nil "Non nil when a subshell is running.") -(defvar running-xemacs nil - "Non nil when using xemacs.") +(defvar running-xemacs (string-match "XEmacs" emacs-version) + "Non-nil if we are running in the XEmacs environment.") (defvar caml-mode-map nil "Keymap used in Caml mode.") @@ -280,6 +280,17 @@ have caml-electric-indent on, which see.") (if running-xemacs (define-key caml-mode-map 'backspace 'backward-delete-char-untabify) (define-key caml-mode-map "\177" 'backward-delete-char-untabify)) + + ;; caml-types + (define-key caml-mode-map [?\C-c?\C-t] 'caml-types-show-type) + (define-key caml-mode-map [down-mouse-2] 'caml-types-explore) + ;; caml-help + (define-key caml-mode-map [?\C-c?i] 'ocaml-add-path) + (define-key caml-mode-map [?\C-c?]] 'ocaml-close-module) + (define-key caml-mode-map [?\C-c?[] 'ocaml-open-module) + (define-key caml-mode-map [?\C-c?\C-h] 'caml-help) + (define-key caml-mode-map [?\C-c?\t] 'caml-complete) + ;; others (define-key caml-mode-map "\C-cb" 'caml-insert-begin-form) (define-key caml-mode-map "\C-cf" 'caml-insert-for-form) (define-key caml-mode-map "\C-ci" 'caml-insert-if-form) @@ -299,12 +310,29 @@ have caml-electric-indent on, which see.") (define-key caml-mode-map "\M-\C-h" 'caml-mark-phrase) (define-key caml-mode-map "\M-\C-q" 'caml-indent-phrase) (define-key caml-mode-map "\M-\C-x" 'caml-eval-phrase) + (if running-xemacs nil ; if not running xemacs (let ((map (make-sparse-keymap "Caml")) (forms (make-sparse-keymap "Forms"))) (define-key caml-mode-map "\C-c\C-d" 'caml-show-imenu) (define-key caml-mode-map [menu-bar] (make-sparse-keymap)) (define-key caml-mode-map [menu-bar caml] (cons "Caml" map)) + ;; caml-help + + (define-key map [open] '("Open add path" . ocaml-add-path )) + (define-key map [close] + '("Close module for help" . ocaml-close-module)) + (define-key map [open] '("Open module for help" . ocaml-open-module)) + (define-key map [help] '("Help for identifier" . caml-help)) + (define-key map [complete] '("Complete identifier" . caml-complete)) + (define-key map [separator-help] '("---")) + + ;; caml-types + (define-key map [show-type] + '("Show type at point" . caml-types-show-type )) + (define-key map [separator-types] '("---")) + + ;; others (define-key map [run-caml] '("Start subshell..." . run-caml)) (define-key map [compile] '("Compile..." . compile)) (define-key map [switch-view] @@ -345,7 +373,16 @@ have caml-electric-indent on, which see.") "---" [ "Switch view" caml-find-alternate-file t ] [ "Compile..." compile t ] - [ "Start subshell..." run-caml t ])) + [ "Start subshell..." run-caml t ] + "---" + [ "Show type at point" caml-types-show-type t ] + "---" + [ "Complete identifier" caml-complete t ] + [ "Help for identifier" caml-help t ] + [ "Add path for documentation" ocaml-add-path t ] + [ "Open module for documentation" ocaml-open t ] + [ "Close module for documentation" ocaml-close t ] + )) "Menu to add to the menubar when running Xemacs") (defvar caml-mode-syntax-table nil @@ -1835,6 +1872,22 @@ with prefix arg, indent that many phrases starting with the current phrase." (autoload 'run-caml "inf-caml" "Run an inferior Caml process." t) +(autoload 'caml-types-show-type "caml-types" + "Show the type of expression or pattern at point." t) +(autoload 'caml-types-explore "caml-types" + "Explore type annotations by mouse dragging." t) + +(autoload 'caml-help "caml-help" + "Show documentation for qualilifed OCaml identifier." t) +(autoload 'caml-complete "caml-help" + "Does completion for documented qualified OCaml identifier." t) +(autoload 'ocaml-open-module "caml-help" + "Add module in documentation search path." t) +(autoload 'ocaml-close-module "caml-help" + "Remove module from documentation search path." t) +(autoload 'ocaml-add-path "caml-help" + "Add search path for documentation." t) + ;;; caml.el ends here (provide 'caml) diff --git a/lex/.depend b/lex/.depend index 3ec916f0..b21bfd93 100644 --- a/lex/.depend +++ b/lex/.depend @@ -2,8 +2,8 @@ common.cmi: lexgen.cmi syntax.cmi compact.cmi: lexgen.cmi lexer.cmi: parser.cmi lexgen.cmi: syntax.cmi -outputbis.cmi: common.cmi lexgen.cmi syntax.cmi output.cmi: common.cmi compact.cmi lexgen.cmi syntax.cmi +outputbis.cmi: common.cmi lexgen.cmi syntax.cmi parser.cmi: syntax.cmi syntax.cmi: cset.cmi common.cmo: lexgen.cmi syntax.cmi common.cmi @@ -20,10 +20,10 @@ main.cmo: common.cmi compact.cmi lexer.cmi lexgen.cmi output.cmi \ outputbis.cmi parser.cmi syntax.cmi main.cmx: common.cmx compact.cmx lexer.cmx lexgen.cmx output.cmx \ outputbis.cmx parser.cmx syntax.cmx -outputbis.cmo: common.cmi lexgen.cmi syntax.cmi outputbis.cmi -outputbis.cmx: common.cmx lexgen.cmx syntax.cmx outputbis.cmi output.cmo: common.cmi compact.cmi lexgen.cmi syntax.cmi output.cmi output.cmx: common.cmx compact.cmx lexgen.cmx syntax.cmx output.cmi +outputbis.cmo: common.cmi lexgen.cmi syntax.cmi outputbis.cmi +outputbis.cmx: common.cmx lexgen.cmx syntax.cmx outputbis.cmi parser.cmo: cset.cmi syntax.cmi parser.cmi parser.cmx: cset.cmx syntax.cmx parser.cmi syntax.cmo: cset.cmi syntax.cmi diff --git a/lex/common.ml b/lex/common.ml index d50f3ba4..f56e7a86 100644 --- a/lex/common.ml +++ b/lex/common.ml @@ -68,12 +68,18 @@ let copy_chars = "Win32" | "Cygwin" -> copy_chars_win32 | _ -> copy_chars_unix -let copy_chunk sourcefile ic oc trl loc = - if loc.start_pos < loc.end_pos then begin +let copy_chunk sourcefile ic oc trl loc add_parens = + if loc.start_pos < loc.end_pos || add_parens then begin fprintf oc "# %d \"%s\"\n" loc.start_line sourcefile; - for i = 1 to loc.start_col do output_char oc ' ' done; + if add_parens then begin + for i = 1 to loc.start_col - 1 do output_char oc ' ' done; + output_char oc '('; + end else begin + for i = 1 to loc.start_col do output_char oc ' ' done; + end; seek_in ic loc.start_pos; copy_chars ic oc loc.start_pos loc.end_pos; + if add_parens then output_char oc ')'; update_tracker trl; end @@ -143,3 +149,5 @@ let output_env oc env = let output_args oc args = List.iter (fun x -> (output_string oc x; output_char oc ' ')) args +(* quiet flag *) +let quiet_mode = ref false;; diff --git a/lex/common.mli b/lex/common.mli index c2e52cc3..4210d21d 100644 --- a/lex/common.mli +++ b/lex/common.mli @@ -15,9 +15,11 @@ val open_tracker : string -> out_channel -> line_tracker val close_tracker : line_tracker -> unit val copy_chunk : string -> - in_channel -> out_channel -> line_tracker -> Syntax.location -> unit + in_channel -> out_channel -> line_tracker -> Syntax.location -> bool -> unit val output_mem_access : out_channel -> int -> unit val output_memory_actions : string -> out_channel -> Lexgen.memory_action list -> unit val output_env : out_channel -> (string * Lexgen.ident_info) list -> unit val output_args : out_channel -> string list -> unit + +val quiet_mode : bool ref;; diff --git a/lex/main.ml b/lex/main.ml index 4b421a1b..30fc4fbe 100644 --- a/lex/main.ml +++ b/lex/main.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: main.ml,v 1.14 2002/11/02 22:36:45 doligez Exp $ *) +(* $Id: main.ml,v 1.18 2003/09/11 14:51:06 maranget Exp $ *) (* The lexer generator. Command-line parsing. *) @@ -18,45 +18,46 @@ open Syntax open Lexgen let ml_automata = ref false -let source_name = ref "" -let output_name = ref "";; +let source_name = ref None +let output_name = ref None let usage = "usage: ocamlex [options] sourcefile" +let specs = + ["-ml", Arg.Set ml_automata, + " Output code that does not use the Lexing module built-in automata interpreter"; + "-o", Arg.String (fun x -> source_name := Some x), + " Set output file name to "; + "-q", Arg.Set Common.quiet_mode, " Do not display informational messages"; + ] + let _ = Arg.parse - ["-ml", Arg.Set ml_automata, - " Output code that does not use the Lexing module"; - "-o", Arg.String (fun x -> source_name := x), - " Set output file name to "; - ] - (fun name -> source_name := name) + specs + (fun name -> source_name := Some name) usage let main () = - let source_name = !source_name in - let dest_name = - if !output_name <> "" then - !output_name - else if Filename.check_suffix source_name ".mll" then - Filename.chop_suffix source_name ".mll" ^ ".ml" - else - source_name ^ ".ml" - in + + let source_name = match !source_name with + | None -> Arg.usage specs usage ; exit 2 + | Some name -> name in + let dest_name = match !output_name with + | Some name -> name + | None -> + if Filename.check_suffix source_name ".mll" then + Filename.chop_suffix source_name ".mll" ^ ".ml" + else + source_name ^ ".ml" in + let ic = open_in_bin source_name in let oc = open_out dest_name in let tr = Common.open_tracker dest_name oc in let lexbuf = Lexing.from_channel ic in try let def = Parser.lexer_definition Lexer.main lexbuf in - let (entries, transitions) = Lexgen.make_dfa def.entrypoints in -(* - let (entries, transitions) = Lexmin.zyva (entries,transitions) in - let tables = Compact.compact_tables transitions in - Output.output_lexdef source_name ic oc - def.header tables entries def.trailer; -*) + let (entries, transitions) = Lexgen.make_dfa def.entrypoints in if !ml_automata then begin Outputbis.output_lexdef source_name ic oc tr diff --git a/lex/output.ml b/lex/output.ml index 174b64c0..d18b0017 100644 --- a/lex/output.ml +++ b/lex/output.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: output.ml,v 1.20 2002/12/10 09:14:30 maranget Exp $ *) +(* $Id: output.ml,v 1.24 2003/08/29 17:33:45 doligez Exp $ *) (* Output the DFA tables and its entry points *) @@ -48,7 +48,7 @@ let output_byte_array oc v = (* Output the tables *) let output_tables oc tbl = - output_string oc "let lex_tables = {\n"; + output_string oc "let __ocaml_lex_tables = {\n"; fprintf oc " Lexing.lex_base = \n%a;\n" output_array tbl.tbl_base; fprintf oc " Lexing.lex_backtrk = \n%a;\n" output_array tbl.tbl_backtrk; @@ -86,17 +86,18 @@ let output_entry sourcefile ic oc oci e = e.auto_name output_args e.auto_args init_num; - fprintf oc "and __ocaml_lex_%s_rec %alexbuf state =\n" + fprintf oc "and __ocaml_lex_%s_rec %alexbuf __ocaml_lex_state =\n" e.auto_name output_args e.auto_args ; - fprintf oc " match Lexing.%sengine lex_tables state lexbuf with\n " - (if e.auto_mem_size == 0 then "" else "new_") ; + fprintf oc " match Lexing.%sengine" + (if e.auto_mem_size == 0 then "" else "new_"); + fprintf oc " __ocaml_lex_tables __ocaml_lex_state lexbuf with\n "; List.iter (fun (num, env, loc) -> fprintf oc " | "; - fprintf oc "%d -> (\n" num; - output_env oc env ; - copy_chunk sourcefile ic oc oci loc; - fprintf oc ")\n") + fprintf oc "%d ->\n" num; + output_env oc env; + copy_chunk sourcefile ic oc oci loc true; + fprintf oc "\n") e.auto_actions; fprintf oc " | n -> lexbuf.Lexing.refill_buff lexbuf; \ __ocaml_lex_%s_rec %alexbuf n\n\n" @@ -107,12 +108,13 @@ let output_entry sourcefile ic oc oci e = exception Table_overflow let output_lexdef sourcefile ic oc oci header tables entry_points trailer = - Printf.printf "%d states, %d transitions, table size %d bytes\n" - (Array.length tables.tbl_base) - (Array.length tables.tbl_trans) - (2 * (Array.length tables.tbl_base + Array.length tables.tbl_backtrk + - Array.length tables.tbl_default + Array.length tables.tbl_trans + - Array.length tables.tbl_check)); + if not !Common.quiet_mode then + Printf.printf "%d states, %d transitions, table size %d bytes\n" + (Array.length tables.tbl_base) + (Array.length tables.tbl_trans) + (2 * (Array.length tables.tbl_base + Array.length tables.tbl_backtrk + + Array.length tables.tbl_default + Array.length tables.tbl_trans + + Array.length tables.tbl_check)); let size_groups = (2 * (Array.length tables.tbl_base_code + Array.length tables.tbl_backtrk_code + @@ -120,11 +122,11 @@ let output_lexdef sourcefile ic oc oci header tables entry_points trailer = Array.length tables.tbl_trans_code + Array.length tables.tbl_check_code) + Array.length tables.tbl_code) in - if size_groups > 0 then + if size_groups > 0 && not !Common.quiet_mode then Printf.printf "%d additional bytes used for bindings\n" size_groups ; flush stdout; if Array.length tables.tbl_trans > 0x8000 then raise Table_overflow; - copy_chunk sourcefile ic oc oci header; + copy_chunk sourcefile ic oc oci header false; output_tables oc tables; begin match entry_points with [] -> () @@ -135,4 +137,4 @@ let output_lexdef sourcefile ic oc oci header tables entry_points trailer = entries; output_string oc ";;\n\n"; end; - copy_chunk sourcefile ic oc oci trailer + copy_chunk sourcefile ic oc oci trailer false diff --git a/lex/outputbis.ml b/lex/outputbis.ml index 5c5766e2..4ea00a64 100644 --- a/lex/outputbis.ml +++ b/lex/outputbis.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: outputbis.ml,v 1.3 2002/12/09 10:44:46 maranget Exp $ *) +(* $Id: outputbis.ml,v 1.5 2003/07/26 21:06:21 doligez Exp $ *) (* Output the DFA tables and its entry points *) @@ -20,7 +20,7 @@ open Lexgen open Common let output_auto_defs oc = - fprintf oc "let __init_lexbuf lexbuf mem_size = + fprintf oc "let __ocaml_lex_init_lexbuf lexbuf mem_size = let pos = lexbuf.Lexing.lex_curr_pos in lexbuf.Lexing.lex_mem <- Array.create mem_size (-1) ; lexbuf.Lexing.lex_start_pos <- pos ; @@ -30,13 +30,13 @@ let output_auto_defs oc = " ; output_string oc - "let rec __next_char lexbuf = + "let rec __ocaml_lex_next_char lexbuf = if lexbuf.Lexing.lex_curr_pos >= lexbuf.Lexing.lex_buffer_len then begin if lexbuf.Lexing.lex_eof_reached then 256 else begin lexbuf.Lexing.refill_buff lexbuf ; - __next_char lexbuf + __ocaml_lex_next_char lexbuf end end else begin let i = lexbuf.Lexing.lex_curr_pos in @@ -58,7 +58,7 @@ let output_action oc mems r = " lexbuf.Lexing.lex_curr_pos <- lexbuf.Lexing.lex_last_pos ;\n" ; fprintf oc " lexbuf.Lexing.lex_last_action\n" | Goto n -> - fprintf oc " __state%d lexbuf\n" n + fprintf oc " __ocaml_lex_state%d lexbuf\n" n let output_pat oc i = if i >= 256 then @@ -124,7 +124,7 @@ let output_tag_actions pref oc mvs = mvs let output_trans pref oc i trans = - fprintf oc "%s __state%d lexbuf = " pref i ; + fprintf oc "%s __ocaml_lex_state%d lexbuf = " pref i ; match trans with | Perform (n,mvs) -> output_tag_actions " " oc mvs ; @@ -138,7 +138,7 @@ let output_trans pref oc i trans = fprintf oc " lexbuf.Lexing.lex_last_action <- %d ;\n" n | No_remember -> () end ; - fprintf oc " match __next_char lexbuf with\n" ; + fprintf oc " match __ocaml_lex_next_char lexbuf with\n" ; output_moves oc move let output_automata oc auto = @@ -156,25 +156,30 @@ let output_automata oc auto = let output_entry sourcefile ic oc tr e = let init_num, init_moves = e.auto_initial_state in fprintf oc "%s %alexbuf = - __init_lexbuf lexbuf %d; %a match __state%d lexbuf with\n" + __ocaml_lex_init_lexbuf lexbuf %d; %a + let __ocaml_lex_result = __ocaml_lex_state%d lexbuf in + lexbuf.Lexing.lex_start_p <- lexbuf.Lexing.lex_curr_p; + lexbuf.Lexing.lex_curr_p <- {lexbuf.Lexing.lex_curr_p with + Lexing.pos_cnum = lexbuf.Lexing.lex_abs_pos + lexbuf.Lexing.lex_curr_pos}; + match __ocaml_lex_result with\n" e.auto_name output_args e.auto_args e.auto_mem_size (output_memory_actions " ") init_moves init_num ; List.iter (fun (num, env, loc) -> fprintf oc " | "; - fprintf oc "%d -> (\n" num; + fprintf oc "%d ->\n" num; output_env oc env ; - copy_chunk sourcefile ic oc tr loc; - fprintf oc ")\n") + copy_chunk sourcefile ic oc tr loc true; + fprintf oc "\n") e.auto_actions; - fprintf oc " | _ -> raise (Failure \"lexing: empty token\") \n\n\n" + fprintf oc " | _ -> raise (Failure \"lexing: empty token\")\n\n\n" (* Main output function *) let output_lexdef sourcefile ic oc tr header entry_points transitions trailer = - copy_chunk sourcefile ic oc tr header; + copy_chunk sourcefile ic oc tr header false; output_automata oc transitions ; begin match entry_points with [] -> () @@ -185,4 +190,4 @@ let output_lexdef sourcefile ic oc tr header entry_points transitions trailer = entries; output_string oc ";;\n\n"; end; - copy_chunk sourcefile ic oc tr trailer + copy_chunk sourcefile ic oc tr trailer false diff --git a/lex/parser.mly b/lex/parser.mly index f58f6bb8..3892872b 100644 --- a/lex/parser.mly +++ b/lex/parser.mly @@ -10,7 +10,7 @@ /* */ /***********************************************************************/ -/* $Id: parser.mly,v 1.18 2003/02/24 10:59:20 maranget Exp $ */ +/* $Id: parser.mly,v 1.19 2003/08/13 13:36:03 doligez Exp $ */ /* The grammar for lexer definitions */ @@ -33,8 +33,6 @@ let regexp_for_string s = re_string (succ n)) in re_string 0 -let char_class c1 c2 = Cset.interval c1 c2 - let rec remove_as = function | Bind (e,_) -> remove_as e | Epsilon|Eof|Characters _ as e -> e diff --git a/man/ocamllex.m b/man/ocamllex.m index 4101e89f..3b1340d3 100644 --- a/man/ocamllex.m +++ b/man/ocamllex.m @@ -5,6 +5,12 @@ ocamllex \- The Objective Caml lexer generator .SH SYNOPSIS .B ocamllex +[ +.BI \-o \ output-file +] +[ +.B \-ml +] .I filename.mll .SH DESCRIPTION @@ -38,6 +44,26 @@ When used in conjunction with a parser generated by the semantic actions compute a value belonging to the type token defined by the generated parsing module. +.SH OPTIONS + +The +.BR ocamllex (1) +command recognizes the following options: + +.TP +.BI \-o \ output-file +Specify the output file name +.IR output-file +instead of the default naming convention. + +.TP +.B \-ml +Output code that does not use the Caml built-in automata +interpreter. Instead, the automaton is encoded by Caml functions. +This option is useful for debugging +.BR ocamllex (1), +using it for production lexers is not recommended. + .SH SEE ALSO .BR ocamlyacc (1). .br diff --git a/ocamldoc/.depend b/ocamldoc/.depend index ddd3515a..8af1586b 100644 --- a/ocamldoc/.depend +++ b/ocamldoc/.depend @@ -1,3 +1,11 @@ +odoc.cmo: ../utils/clflags.cmo ../utils/config.cmi ../utils/misc.cmi \ + odoc_analyse.cmi odoc_args.cmi odoc_crc.cmo odoc_dot.cmo odoc_global.cmi \ + odoc_html.cmo odoc_info.cmi odoc_latex.cmo odoc_man.cmo odoc_messages.cmo \ + odoc_texi.cmo ../typing/typedtree.cmi +odoc.cmx: ../utils/clflags.cmx ../utils/config.cmx ../utils/misc.cmx \ + odoc_analyse.cmx odoc_args.cmx odoc_crc.cmx odoc_dot.cmx odoc_global.cmx \ + odoc_html.cmx odoc_info.cmx odoc_latex.cmx odoc_man.cmx odoc_messages.cmx \ + odoc_texi.cmx ../typing/typedtree.cmx odoc_analyse.cmo: ../utils/ccomp.cmi ../utils/clflags.cmo ../utils/config.cmi \ ../typing/ctype.cmi ../typing/env.cmi ../typing/includemod.cmi \ ../parsing/lexer.cmi ../parsing/location.cmi ../utils/misc.cmi \ @@ -44,14 +52,14 @@ odoc_class.cmo: odoc_name.cmi odoc_parameter.cmo odoc_types.cmi \ odoc_value.cmo ../typing/types.cmi odoc_class.cmx: odoc_name.cmx odoc_parameter.cmx odoc_types.cmx \ odoc_value.cmx ../typing/types.cmx -odoc_comments_global.cmo: odoc_comments_global.cmi -odoc_comments_global.cmx: odoc_comments_global.cmi odoc_comments.cmo: odoc_comments_global.cmi odoc_global.cmi odoc_lexer.cmo \ odoc_messages.cmo odoc_parser.cmi odoc_see_lexer.cmo odoc_text.cmi \ odoc_types.cmi odoc_comments.cmi odoc_comments.cmx: odoc_comments_global.cmx odoc_global.cmx odoc_lexer.cmx \ odoc_messages.cmx odoc_parser.cmx odoc_see_lexer.cmx odoc_text.cmx \ odoc_types.cmx odoc_comments.cmi +odoc_comments_global.cmo: odoc_comments_global.cmi +odoc_comments_global.cmx: odoc_comments_global.cmi odoc_cross.cmo: odoc_class.cmo odoc_exception.cmo odoc_messages.cmo \ odoc_misc.cmi odoc_module.cmo odoc_name.cmi odoc_parameter.cmo \ odoc_search.cmi odoc_type.cmo odoc_types.cmi odoc_value.cmo \ @@ -118,14 +126,6 @@ odoc_misc.cmx: ../typing/btype.cmx ../typing/ctype.cmx ../typing/ident.cmx \ ../parsing/longident.cmx odoc_messages.cmx odoc_types.cmx \ ../typing/path.cmx ../typing/printtyp.cmx ../typing/types.cmx \ odoc_misc.cmi -odoc.cmo: ../utils/clflags.cmo ../utils/config.cmi ../utils/misc.cmi \ - odoc_analyse.cmi odoc_args.cmi odoc_crc.cmo odoc_dot.cmo odoc_global.cmi \ - odoc_html.cmo odoc_info.cmi odoc_latex.cmo odoc_man.cmo odoc_messages.cmo \ - odoc_texi.cmo ../typing/typedtree.cmi -odoc.cmx: ../utils/clflags.cmx ../utils/config.cmx ../utils/misc.cmx \ - odoc_analyse.cmx odoc_args.cmx odoc_crc.cmx odoc_dot.cmx odoc_global.cmx \ - odoc_html.cmx odoc_info.cmx odoc_latex.cmx odoc_man.cmx odoc_messages.cmx \ - odoc_texi.cmx ../typing/typedtree.cmx odoc_module.cmo: odoc_class.cmo odoc_exception.cmo odoc_name.cmi \ odoc_parameter.cmo odoc_type.cmo odoc_types.cmi odoc_value.cmo \ ../typing/types.cmi @@ -180,10 +180,10 @@ odoc_str.cmx: odoc_exception.cmx odoc_messages.cmx odoc_misc.cmx \ odoc_name.cmx odoc_type.cmx odoc_value.cmx odoc_str.cmi odoc_texi.cmo: odoc_info.cmi odoc_messages.cmo odoc_to_text.cmo odoc_texi.cmx: odoc_info.cmx odoc_messages.cmx odoc_to_text.cmx -odoc_text_lexer.cmo: odoc_text_parser.cmi -odoc_text_lexer.cmx: odoc_text_parser.cmx odoc_text.cmo: odoc_text_lexer.cmo odoc_text_parser.cmi odoc_text.cmi odoc_text.cmx: odoc_text_lexer.cmx odoc_text_parser.cmx odoc_text.cmi +odoc_text_lexer.cmo: odoc_text_parser.cmi +odoc_text_lexer.cmx: odoc_text_parser.cmx odoc_text_parser.cmo: odoc_types.cmi odoc_text_parser.cmi odoc_text_parser.cmx: odoc_types.cmx odoc_text_parser.cmi odoc_to_text.cmo: odoc_info.cmi odoc_messages.cmo diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile index 33f375a5..f50234b8 100644 --- a/ocamldoc/Makefile +++ b/ocamldoc/Makefile @@ -9,7 +9,7 @@ #(* *) #(***********************************************************************) -# $Id: Makefile,v 1.35 2003/07/11 07:26:18 guesdon Exp $ +# $Id: Makefile,v 1.43 2003/09/29 14:05:01 xleroy Exp $ include ../config/Makefile @@ -25,7 +25,7 @@ OCAMLLIB = $(LIBDIR) OCAMLBIN = $(BINDIR) EXTRAC_CRC = $(CAMLRUN) ../otherlibs/dynlink/extract_crc -OCAMLPP=-pp 'grep -v DEBUG' +OCAMLPP=-pp './remove_DEBUG' # For installation ############## @@ -154,8 +154,8 @@ OCAMLCMOFILES=$(OCAMLSRCDIR)/parsing/printast.cmo \ $(OCAMLSRCDIR)/typing/printtyp.cmo \ $(OCAMLSRCDIR)/typing/includecore.cmo \ $(OCAMLSRCDIR)/typing/typetexp.cmo \ - $(OCAMLSRCDIR)/typing/parmatch.cmo \ $(OCAMLSRCDIR)/typing/typedtree.cmo \ + $(OCAMLSRCDIR)/typing/parmatch.cmo \ $(OCAMLSRCDIR)/typing/stypes.cmo \ $(OCAMLSRCDIR)/typing/typecore.cmo \ $(OCAMLSRCDIR)/typing/includeclass.cmo \ @@ -277,7 +277,7 @@ odoc_see_lexer.ml: odoc_see_lexer.mll install: dummy if test -d $(INSTALL_BINDIR); then : ; else $(MKDIR) $(INSTALL_BINDIR); fi if test -d $(INSTALL_LIBDIR); then : ; else $(MKDIR) $(INSTALL_LIBDIR); fi - $(CP) $(OCAMLDOC) $(INSTALL_BINDIR) + $(CP) $(OCAMLDOC)$(EXE) $(INSTALL_BINDIR)/$(OCAMLDOC)$(EXE) $(CP) ocamldoc.hva *.cmi $(GENERATORS) $(OCAMLDOC_LIBCMA) $(INSTALL_LIBDIR) $(CP) $(INSTALL_MLIS) $(INSTALL_CMIS) $(INSTALL_LIBDIR) if test -d $(INSTALL_MANODIR); then : ; else $(MKDIR) $(INSTALL_MANODIR); fi @@ -289,7 +289,7 @@ installopt: installopt_really: if test -d $(INSTALL_BINDIR); then : ; else $(MKDIR) $(INSTALL_BINDIR); fi if test -d $(INSTALL_LIBDIR); then : ; else $(MKDIR) $(INSTALL_LIBDIR); fi - $(CP) $(OCAMLDOC_OPT) $(INSTALL_BINDIR) + $(CP) $(OCAMLDOC_OPT) $(INSTALL_BINDIR)/$(OCAMLDOC_OPT)$(EXE) $(CP) ocamldoc.hva $(OCAMLDOC_LIBA) $(OCAMLDOC_LIBCMXA) $(INSTALL_LIBDIR) $(CP) $(INSTALL_MLIS) $(INSTALL_CMIS) $(INSTALL_LIBDIR) @@ -297,34 +297,34 @@ installopt_really: ########### test: dummy $(MKDIR) $@ - $(OCAMLDOC_RUN) -html -colorize-code -d $@ $(INCLUDES) -dump $@/ocamldoc.odoc odoc*.ml odoc*.mli + $(OCAMLDOC_RUN) -html -colorize-code -sort -d $@ $(INCLUDES) -dump $@/ocamldoc.odoc odoc*.ml odoc*.mli test_stdlib: dummy $(MKDIR) $@ - $(OCAMLDOC_RUN) -html -colorize-code -d $@ $(INCLUDES) -dump $@/stdlib.odoc ../stdlib/*.mli \ + $(OCAMLDOC_RUN) -html -colorize-code -sort -d $@ $(INCLUDES) -dump $@/stdlib.odoc ../stdlib/*.mli \ ../otherlibs/unix/unix.mli \ ../otherlibs/str/str.mli test_framed: dummy $(MKDIR) $@ - $(OCAMLDOC_RUN) -g odoc_fhtml.cmo -colorize-code -d $@ $(INCLUDES) odoc*.ml odoc*.mli + $(OCAMLDOC_RUN) -g odoc_fhtml.cmo -sort -colorize-code -d $@ $(INCLUDES) odoc*.ml odoc*.mli test_latex: dummy $(MKDIR) $@ - $(OCAMLDOC_RUN) -latex -d $@ $(INCLUDES) odoc*.ml odoc*.mli ../stdlib/*.mli ../otherlibs/unix/unix.mli + $(OCAMLDOC_RUN) -latex -sort -o $@/test.tex -d $@ $(INCLUDES) odoc*.ml odoc*.mli ../stdlib/*.mli ../otherlibs/unix/unix.mli test_man: dummy $(MKDIR) $@ - $(OCAMLDOC_RUN) -man -d $@ $(INCLUDES) odoc*.ml odoc*.mli + $(OCAMLDOC_RUN) -man -sort -d $@ $(INCLUDES) odoc*.ml odoc*.mli test_texi: dummy $(MKDIR) $@ - $(OCAMLDOC_RUN) -texi -d $@ $(INCLUDES) odoc*.ml odoc*.mli + $(OCAMLDOC_RUN) -texi -sort -d $@ $(INCLUDES) odoc*.ml odoc*.mli stdlib_man/Pervasives.o: $(STDLIB_MLIS) $(MKDIR) stdlib_man $(OCAMLDOC_RUN) -man -d stdlib_man $(INCLUDES) \ - -t "OCaml library" -man-mini -man-suffix 3 \ + -t "OCaml library" -man-mini -man-suffix 3o \ $(STDLIB_MLIS) # backup, clean and depend : @@ -332,7 +332,7 @@ stdlib_man/Pervasives.o: $(STDLIB_MLIS) clean:: dummy @rm -f *~ \#*\# - @rm -f $(OCAMLDOC) $(OCAMLDOC_OPT) *.cma *.cmxa *.cmo *.cmi *.cmx *.a *.o + @rm -f $(OCAMLDOC)$(EXE) $(OCAMLDOC_OPT) *.cma *.cmxa *.cmo *.cmi *.cmx *.a *.o @rm -f odoc_parser.output odoc_text_parser.output @rm -f odoc_lexer.ml odoc_text_lexer.ml odoc_see_lexer.ml odoc_ocamlhtml.ml @rm -f odoc_parser.ml odoc_parser.mli odoc_text_parser.ml odoc_text_parser.mli odoc_crc.ml diff --git a/ocamldoc/Makefile.nt b/ocamldoc/Makefile.nt index b4102fcf..ed7f2b2c 100644 --- a/ocamldoc/Makefile.nt +++ b/ocamldoc/Makefile.nt @@ -9,7 +9,7 @@ #(* *) #(***********************************************************************) -# $Id: Makefile.nt,v 1.18 2003/07/08 13:52:21 guesdon Exp $ +# $Id: Makefile.nt,v 1.19 2003/08/29 12:15:41 xleroy Exp $ include ../config/Makefile @@ -316,7 +316,7 @@ installopt: installopt_really: $(MKDIR) -p $(INSTALL_BINDIR) $(MKDIR) -p $(INSTALL_LIBDIR) - $(CP) $(OCAMLDOC_OPT) $(INSTALL_BINDIR)/$(OCAMLDOC_OPT) + $(CP) $(OCAMLDOC_OPT) $(INSTALL_BINDIR)/$(OCAMLDOC_OPT).exe $(CP) ocamldoc.hva $(OCAMLDOC_LIBA) $(OCAMLDOC_LIBCMXA) $(INSTALL_LIBDIR) $(CP) $(INSTALL_MLIS) $(INSTALL_CMIS) $(INSTALL_LIBDIR) diff --git a/ocamldoc/odoc_ast.ml b/ocamldoc/odoc_ast.ml index 9a7beb1f..d45d62c2 100644 --- a/ocamldoc/odoc_ast.ml +++ b/ocamldoc/odoc_ast.ml @@ -1008,9 +1008,14 @@ module Analyser = { ty_name = complete_name ; ty_info = com_opt ; - ty_parameters = List.map - (Odoc_env.subst_type new_env) - tt_type_decl.Types.type_params ; + ty_parameters = + List.map2 + (fun p (co,cn,_) -> + (Odoc_env.subst_type new_env p, + co, cn) + ) + tt_type_decl.Types.type_params + tt_type_decl.Types.type_variance ; ty_kind = kind ; ty_manifest = (match tt_type_decl.Types.type_manifest with diff --git a/ocamldoc/odoc_html.ml b/ocamldoc/odoc_html.ml index c3a622ad..164b8b14 100644 --- a/ocamldoc/odoc_html.ml +++ b/ocamldoc/odoc_html.ml @@ -805,14 +805,15 @@ class html = in s2 - (** Return html code to display a [Types.type_expr].*) + (** Return html code to display a [Types.type_expr]. *) method html_of_type_expr m_name t = let s = String.concat "\n" (Str.split (Str.regexp "\n") (Odoc_info.string_of_type_expr t)) in let s2 = Str.global_replace (Str.regexp "\n") "
" s in - ""^(self#create_fully_qualified_idents_links m_name s2)^"" - + Printf.sprintf + "%s" + (self#create_fully_qualified_idents_links m_name s2) (** Return html code to display a [Types.class_type].*) method html_of_class_type_expr m_name t = @@ -831,6 +832,12 @@ class html = print_DEBUG "html#html_of_type_expr_list: 2"; ""^(self#create_fully_qualified_idents_links m_name s2)^"" + (** Return html code to display a list of type parameters for the given type.*) + method html_of_type_expr_param_list m_name t = + let s = Odoc_info.string_of_type_param_list t in + let s2 = Str.global_replace (Str.regexp "\n") "
" s in + ""^(self#create_fully_qualified_idents_links m_name s2)^"" + (** Return html code to display a [Types.module_type]. *) method html_of_module_type m_name t = let s = String.concat "\n" @@ -915,11 +922,8 @@ class html = (self#keyword "type")^" "^ (* html mark *) ""^ - (match t.ty_parameters with - [] -> "" - | tp :: [] -> (self#html_of_type_expr father tp)^" " - | l -> "("^(self#html_of_type_expr_list father ", " l)^") " - )^ + (self#html_of_type_expr_param_list father t)^ + (match t.ty_parameters with [] -> "" | _ -> " ")^ (Name.simple t.ty_name)^" "^ (match t.ty_manifest with None -> "" | Some typ -> "= "^(self#html_of_type_expr father typ)^" ")^ (match t.ty_kind with diff --git a/ocamldoc/odoc_info.ml b/ocamldoc/odoc_info.ml index d6b7fdbe..7438fd61 100644 --- a/ocamldoc/odoc_info.ml +++ b/ocamldoc/odoc_info.ml @@ -110,11 +110,13 @@ let load_modules = Odoc_analyse.load_modules let reset_type_names = Printtyp.reset +let string_of_variance t (co,cn) = Odoc_str.string_of_variance t (co, cn) + let string_of_type_expr t = Odoc_misc.string_of_type_expr t -(** This function returns a string to represent the given list of types, - with a given separator. *) -let string_of_type_list sep type_list = Odoc_misc.string_of_type_list sep type_list +let string_of_type_list sep type_list = Odoc_str.string_of_type_list sep type_list + +let string_of_type_param_list t = Odoc_str.string_of_type_param_list t let string_of_module_type = Odoc_misc.string_of_module_type diff --git a/ocamldoc/odoc_info.mli b/ocamldoc/odoc_info.mli index ea1aa10f..a9dfa90d 100644 --- a/ocamldoc/odoc_info.mli +++ b/ocamldoc/odoc_info.mli @@ -214,7 +214,8 @@ module Type : { ty_name : Name.t ; (** Complete name of the type. *) mutable ty_info : info option ; (** Information found in the optional associated comment. *) - ty_parameters : Types.type_expr list ; (** Type parameters. *) + ty_parameters : (Types.type_expr * bool * bool) list ; + (** type parameters: (type, covariant, contravariant) *) ty_kind : type_kind ; (** Type kind. *) ty_manifest : Types.type_expr option; (** Type manifest. *) mutable ty_loc : location ; @@ -596,14 +597,24 @@ val load_modules : string -> Odoc_module.t_module list classes (call it) and methods and attributes (don't call it).*) val reset_type_names : unit -> unit -(** This function returns a string representing a Types.type_expr. - It writes in and flushes [Format.str_formatter]. *) +(** [string_of_variance t (covariant, invariant)] returns ["+"] if + the given information means "covariant", ["-"] if the it means + "contravariant", orelse [""], and always [""] if the given + type is not an abstract type with no manifest (i.e. no need + for the variance to be printed.*) +val string_of_variance : Type.t_type -> (bool * bool) -> string + +(** This function returns a string representing a Types.type_expr. *) val string_of_type_expr : Types.type_expr -> string (** This function returns a string to represent the given list of types, - with a given separator. It writes in and flushes [Format.str_formatter].*) + with a given separator. *) val string_of_type_list : string -> Types.type_expr list -> string +(** This function returns a string to represent the list of type parameters + for the given type. *) +val string_of_type_param_list : Type.t_type -> string + (** This function returns a string representing a [Types.module_type]. @param complete indicates if we must print complete signatures or just [sig end]. Default if [false]. diff --git a/ocamldoc/odoc_latex.ml b/ocamldoc/odoc_latex.ml index c6f59f9b..f033696c 100644 --- a/ocamldoc/odoc_latex.ml +++ b/ocamldoc/odoc_latex.ml @@ -374,6 +374,20 @@ class latex = ((Latex (self#make_label (self#method_label m.met_value.val_name))) :: (to_text#text_of_method m)) + (** Return LaTeX code for the parameters of a type. *) + method latex_of_type_params m_name t = + let f (p, co, cn) = + Printf.sprintf "%s%s" + (Odoc_info.string_of_variance t (co,cn)) + (self#normal_type m_name p) + in + match t.ty_parameters with + [] -> "" + | [(p,co,cn)] -> f (p, co, cn) + | l -> + Printf.sprintf "(%s)" + (String.concat ", " (List.map f t.ty_parameters)) + (** Return LaTeX code for a type. *) method latex_of_type t = let s_name = Name.simple t.ty_name in @@ -381,26 +395,26 @@ class latex = Odoc_info.reset_type_names () ; let mod_name = Name.father t.ty_name in let s_type1 = - Format.fprintf Format.str_formatter - "@[type "; - match t.ty_parameters with - [] -> Format.flush_str_formatter () - | [p] -> self#normal_type mod_name p - | l -> - Format.fprintf Format.str_formatter "(" ; - let s = self#normal_type_list mod_name ", " l in - s^")" + Format.fprintf Format.str_formatter "@[type "; + Format.fprintf Format.str_formatter "%s%s" + (self#latex_of_type_params mod_name t) + (match t.ty_parameters with [] -> "" | _ -> " "); + Format.flush_str_formatter () in Format.fprintf Format.str_formatter ("@[%s %s") s_type1 s_name; let s_type2 = - match t.ty_manifest with - None -> Format.flush_str_formatter () - | Some typ -> - Format.fprintf Format.str_formatter " = "; - self#normal_type mod_name typ + ( + match t.ty_manifest with + None -> () + | Some typ -> + Format.fprintf Format.str_formatter + " = %s" + (self#normal_type mod_name typ) + ); + Format.flush_str_formatter () in let s_type3 = Format.fprintf Format.str_formatter @@ -426,11 +440,15 @@ class latex = Format.fprintf Format.str_formatter "@[ | %s" constr.vc_name; - match constr.vc_args with - [] -> Format.flush_str_formatter () - | l -> - Format.fprintf Format.str_formatter " %s@ " "of"; - self#normal_type_list mod_name " * " l + ( + match constr.vc_args with + [] -> () + | l -> + Format.fprintf Format.str_formatter " %s@ %s" + "of" + (self#normal_type_list mod_name " * " l) + ); + Format.flush_str_formatter () in [ CodePre s_cons ] @ (match constr.vc_text with @@ -452,10 +470,11 @@ class latex = (fun r -> let s_field = Format.fprintf Format.str_formatter - "@[ %s%s :@ " + "@[ %s%s :@ %s ;" (if r.rf_mutable then "mutable " else "") - r.rf_name; - (self#normal_type mod_name r.rf_type)^" ;" + r.rf_name + (self#normal_type mod_name r.rf_type); + Format.flush_str_formatter () in [ CodePre s_field ] @ (match r.rf_text with diff --git a/ocamldoc/odoc_man.ml b/ocamldoc/odoc_man.ml index c78654db..10f85ca9 100644 --- a/ocamldoc/odoc_man.ml +++ b/ocamldoc/odoc_man.ml @@ -257,10 +257,19 @@ class man = (** Groff string to display a [Types.type_expr list].*) method man_of_type_expr_list m_name sep l = - let s = Odoc_misc.string_of_type_list sep l in + let s = Odoc_str.string_of_type_list sep l in let s2 = Str.global_replace (Str.regexp "\n") "\n.B " s in "\n.B "^(self#relative_idents m_name s2)^"\n" + (** Groff string to display the parameters of a type.*) + method man_of_type_expr_param_list m_name t = + match t.ty_parameters with + [] -> "" + | l -> + let s = Odoc_str.string_of_type_param_list t in + let s2 = Str.global_replace (Str.regexp "\n") "\n.B " s in + "\n.B "^(self#relative_idents m_name s2)^"\n" + (** Groff string to display a [Types.module_type]. *) method man_of_module_type m_name t = let s = String.concat "\n" @@ -306,12 +315,7 @@ class man = Odoc_info.reset_type_names () ; let father = Name.father t.ty_name in ".I type "^ - (match t.ty_parameters with - [] -> "" - | tp :: [] -> (Odoc_misc.string_of_type_expr tp) - | l -> - (self#man_of_type_expr_list father ", " l) - )^ + (self#man_of_type_expr_param_list father t)^ (match t.ty_parameters with [] -> "" | _ -> ".I ")^(Name.simple t.ty_name)^" \n"^ (match t.ty_manifest with None -> "" | Some typ -> "= "^(self#man_of_type_expr father typ))^ ( @@ -455,7 +459,7 @@ class man = ( match c.cl_type_parameters with [] -> () - | l -> p buf "[%s.I] " (Odoc_misc.string_of_type_list ", " l) + | l -> p buf "[%s] " (Odoc_str.string_of_type_list ", " l) ); p buf "%s : %s" (Name.simple c.cl_name) @@ -473,7 +477,7 @@ class man = ( match ct.clt_type_parameters with [] -> () - | l -> p buf "[%s.I ] " (Odoc_misc.string_of_type_list ", " l) + | l -> p buf "[%s] " (Odoc_str.string_of_type_list ", " l) ); p buf "%s = %s" (Name.simple ct.clt_name) @@ -541,7 +545,7 @@ class man = let abstract = match cl.cl_info with - None | Some { i_desc = None } -> "" + None | Some { i_desc = None } -> "no description" | Some { i_desc = Some t } -> let s = Odoc_info.string_of_text (Odoc_info.first_sentence_of_text t) in self#remove_newlines s @@ -603,7 +607,7 @@ class man = let abstract = match ct.clt_info with - None | Some { i_desc = None } -> "" + None | Some { i_desc = None } -> "no description" | Some { i_desc = Some t } -> let s = Odoc_info.string_of_text (Odoc_info.first_sentence_of_text t) in self#remove_newlines s @@ -661,7 +665,7 @@ class man = let abstract = match mt.mt_info with - None | Some { i_desc = None } -> "" + None | Some { i_desc = None } -> "no description" | Some { i_desc = Some t } -> let s = Odoc_info.string_of_text (Odoc_info.first_sentence_of_text t) in self#remove_newlines s @@ -740,7 +744,7 @@ class man = let abstract = match m.m_info with - None | Some { i_desc = None } -> "" + None | Some { i_desc = None } -> "no description" | Some { i_desc = Some t } -> let s = Odoc_info.string_of_text (Odoc_info.first_sentence_of_text t) in self#remove_newlines s @@ -868,7 +872,7 @@ class man = "OCamldoc "^ "\""^(match !Args.title with Some t -> t | None -> "")^"\"\n"^ ".SH NAME\n"^ - name^" \\- \n\n" + name^" \\- all "^name^" elements\n\n" ); let f ele = diff --git a/ocamldoc/odoc_messages.ml b/ocamldoc/odoc_messages.ml index ff9c5b2a..80b99f67 100644 --- a/ocamldoc/odoc_messages.ml +++ b/ocamldoc/odoc_messages.ml @@ -25,6 +25,7 @@ let options_are = "Options are :" let option_version = " Print version and exit" let latex_only = "(LaTeX only)" let texi_only = "(TeXinfo only)" +let latex_texi_only = "(LaTeX and TeXinfo only)" let html_only = "(HTML only)" let man_only = "(man only)" let verbose_mode = " verbose mode" @@ -72,8 +73,8 @@ let man_suffix = " use for man page files "^ let option_title = " use <title> as title for the generated documentation" let with_parameter_list = " display the complete list of parameters for functions and methods "^html_only let hide_modules = " <M1,M2.M3,...> Hide the given complete module names in generated doc" -let no_header = " Suppress header in generated documentation "^latex_only -let no_trailer = " Suppress trailer in generated documentation "^latex_only +let no_header = " Suppress header in generated documentation "^latex_texi_only +let no_trailer = " Suppress trailer in generated documentation "^latex_texi_only let separate_files = " Generate one file per toplevel module "^latex_only let latex_title ref_titles = "n,style associate {n } to the given sectionning style\n"^ diff --git a/ocamldoc/odoc_misc.ml b/ocamldoc/odoc_misc.ml index e7cce871..d2c3c52e 100644 --- a/ocamldoc/odoc_misc.ml +++ b/ocamldoc/odoc_misc.ml @@ -36,44 +36,12 @@ let input_file_as_string nom = let string_of_longident li = String.concat "." (Longident.flatten li) let string_of_type_expr t = + let b = Buffer.create 256 in + let fmt = Format.formatter_of_buffer b in Printtyp.mark_loops t; - Printtyp.type_scheme_max ~b_reset_names: false Format.str_formatter t; - let s = Format.flush_str_formatter () in - s - -let string_of_type_list sep type_list = - let rec need_parent t = - match t.Types.desc with - Types.Tarrow _ | Types.Ttuple _ -> true - | Types.Tlink t2 | Types.Tsubst t2 -> need_parent t2 - | Types.Tconstr _ -> - false - | Types.Tvar | Types.Tunivar | Types.Tobject _ | Types.Tpoly _ - | Types.Tfield _ | Types.Tnil | Types.Tvariant _ -> false - in - let print_one_type t = - Printtyp.mark_loops t; - if need_parent t then - ( - Format.fprintf Format.str_formatter "(" ; - Printtyp.type_scheme_max ~b_reset_names: false Format.str_formatter t; - Format.fprintf Format.str_formatter ")" - ) - else - Printtyp.type_scheme_max ~b_reset_names: false Format.str_formatter t - in - begin match type_list with - [] -> () - | [ty] -> print_one_type ty - | ty :: tyl -> - Format.fprintf Format.str_formatter "@[<hov 2>"; - print_one_type ty; - List.iter - (fun t -> Format.fprintf Format.str_formatter "@,%s" sep; print_one_type t) - tyl; - Format.fprintf Format.str_formatter "@]" - end; - Format.flush_str_formatter() + Printtyp.type_scheme_max ~b_reset_names: false fmt t; + Format.pp_print_flush fmt () ; + Buffer.contents b (** Return the given module type where methods and vals have been removed from the signatures. Used when we don't want to print a too long module type.*) diff --git a/ocamldoc/odoc_misc.mli b/ocamldoc/odoc_misc.mli index 5f259adb..caa1b0a2 100644 --- a/ocamldoc/odoc_misc.mli +++ b/ocamldoc/odoc_misc.mli @@ -22,10 +22,6 @@ val string_of_longident : Longident.t -> string It writes in and flushes [Format.str_formatter].*) val string_of_type_expr : Types.type_expr -> string -(** This function returns a string to represent the given list of types, - with a given separator. It writes in and flushes [Format.str_formatter].*) -val string_of_type_list : string -> Types.type_expr list -> string - (** This function returns a string representing a [Types.module_type]. @param complete indicates if we must print complete signatures or just [sig end]. Default if [false]. diff --git a/ocamldoc/odoc_sig.ml b/ocamldoc/odoc_sig.ml index b9722722..ede23eff 100644 --- a/ocamldoc/odoc_sig.ml +++ b/ocamldoc/odoc_sig.ml @@ -625,7 +625,13 @@ module Analyser = { ty_name = Name.concat current_module_name name ; ty_info = assoc_com ; - ty_parameters = List.map (Odoc_env.subst_type new_env) sig_type_decl.Types.type_params ; + ty_parameters = + List.map2 (fun p (co,cn,_) -> + (Odoc_env.subst_type new_env p, + co, cn) + ) + sig_type_decl.Types.type_params + sig_type_decl.Types.type_variance; ty_kind = type_kind ; ty_manifest = (match sig_type_decl.Types.type_manifest with diff --git a/ocamldoc/odoc_str.ml b/ocamldoc/odoc_str.ml index 74ac8453..3a5cf927 100644 --- a/ocamldoc/odoc_str.ml +++ b/ocamldoc/odoc_str.ml @@ -14,12 +14,79 @@ module Name = Odoc_name +let string_of_variance t (co,cn) = + if t.Odoc_type.ty_kind = Odoc_type.Type_abstract && + t.Odoc_type.ty_manifest = None + then + match (co, cn) with + (true, false) -> "+" + | (false, true) -> "-" + | _ -> "" + else + "" + +let raw_string_of_type_list sep type_list = + let buf = Buffer.create 256 in + let fmt = Format.formatter_of_buffer buf in + let rec need_parent t = + match t.Types.desc with + Types.Tarrow _ | Types.Ttuple _ -> true + | Types.Tlink t2 | Types.Tsubst t2 -> need_parent t2 + | Types.Tconstr _ -> + false + | Types.Tvar | Types.Tunivar | Types.Tobject _ | Types.Tpoly _ + | Types.Tfield _ | Types.Tnil | Types.Tvariant _ -> false + in + let print_one_type variance t = + Printtyp.mark_loops t; + if need_parent t then + ( + Format.fprintf fmt "(%s" variance; + Printtyp.type_scheme_max ~b_reset_names: false fmt t; + Format.fprintf fmt ")" + ) + else + ( + Format.fprintf fmt "%s" variance; + Printtyp.type_scheme_max ~b_reset_names: false fmt t + ) + in + begin match type_list with + [] -> () + | [(variance, ty)] -> print_one_type variance ty + | (variance, ty) :: tyl -> + Format.fprintf fmt "@[<hov 2>("; + print_one_type variance ty; + List.iter + (fun (variance, t) -> + Format.fprintf fmt "@,%s" sep; + print_one_type variance t + ) + tyl; + Format.fprintf fmt ")@]" + end; + Format.pp_print_flush fmt (); + Buffer.contents buf + +let string_of_type_list sep type_list = + raw_string_of_type_list sep (List.map (fun t -> ("", t)) type_list) + +let string_of_type_param_list t = + raw_string_of_type_list ", " + (List.map + (fun (typ, co, cn) -> (string_of_variance t (co, cn), typ)) + t.Odoc_type.ty_parameters + ) + let string_of_type t = let module M = Odoc_type in "type "^ (String.concat "" (List.map - (fun p -> (Odoc_misc.string_of_type_expr p)^" ") + (fun (p, co, cn) -> + (string_of_variance t (co, cn))^ + (Odoc_misc.string_of_type_expr p)^" " + ) t.M.ty_parameters ) )^ diff --git a/ocamldoc/odoc_str.mli b/ocamldoc/odoc_str.mli index 711de7e6..12116f5a 100644 --- a/ocamldoc/odoc_str.mli +++ b/ocamldoc/odoc_str.mli @@ -12,6 +12,17 @@ (** The functions to get a string from different kinds of elements (types, modules, ...). *) +(** @return the variance string for the given type and (covariant, contravariant) information. *) +val string_of_variance : Odoc_type.t_type -> (bool * bool) -> string + +(** This function returns a string to represent the given list of types, + with a given separator. It writes in and flushes [Format.str_formatter].*) +val string_of_type_list : string -> Types.type_expr list -> string + +(** This function returns a string to represent the list of type parameters + for the given type. It writes in and flushes [Format.str_formatter].*) +val string_of_type_param_list : Odoc_type.t_type -> string + (** @return a string to describe the given type. *) val string_of_type : Odoc_type.t_type -> string diff --git a/ocamldoc/odoc_texi.ml b/ocamldoc/odoc_texi.ml index 7c570e58..3a52d104 100644 --- a/ocamldoc/odoc_texi.ml +++ b/ocamldoc/odoc_texi.ml @@ -8,7 +8,7 @@ (* under the terms of the Q Public License version 1.0. *) (***********************************************************************) -(* $Id: odoc_texi.ml,v 1.12 2003/07/04 09:30:55 guesdon Exp $ *) +(* $Id: odoc_texi.ml,v 1.13 2003/09/05 15:40:12 guesdon Exp $ *) (** Generation of Texinfo documentation. *) @@ -591,11 +591,19 @@ class texi = self#texi_of_text t - method string_of_type_parameter = function + method string_of_type_parameters t = + let f (tp, co, cn) = + Printf.sprintf "%s%s" + (Odoc_info.string_of_variance t (co, cn)) + (Odoc_info.string_of_type_expr tp) + in + match t.ty_parameters with | [] -> "" - | [ tp ] -> (Odoc_info.string_of_type_expr tp) ^ " " - | l -> "(" ^ (String.concat ", " - (List.map Odoc_info.string_of_type_expr l)) ^ ") " + | [ (tp, co, cn) ] -> + (f (tp, co, cn))^" " + | l -> + Printf.sprintf "(%s) " + (String.concat ", " (List.map f l)) method string_of_type_args = function | [] -> "" @@ -607,7 +615,7 @@ class texi = let t = [ self#fixedblock ( [ Newline ; minus ; Raw "type " ; - Raw (self#string_of_type_parameter ty.ty_parameters) ; + Raw (self#string_of_type_parameters ty) ; Raw (Name.simple ty.ty_name) ] @ ( match ty.ty_manifest with | None -> [] diff --git a/ocamldoc/odoc_to_text.ml b/ocamldoc/odoc_to_text.ml index 77d9aec6..7b325bd3 100644 --- a/ocamldoc/odoc_to_text.ml +++ b/ocamldoc/odoc_to_text.ml @@ -234,10 +234,11 @@ class virtual to_text = (** @return [text] value for a value. *) method text_of_value v = let s_name = Name.simple v.val_name in - Format.fprintf Format.str_formatter "@[<hov 2>val %s :@ " - s_name; let s = - (self#normal_type (Name.father v.val_name) v.val_type) + Format.fprintf Format.str_formatter "@[<hov 2>val %s :@ %s" + s_name + (self#normal_type (Name.father v.val_name) v.val_type); + Format.flush_str_formatter () in [ CodePre s ] @ [Latex ("\\index{"^(self#label s_name)^"@\\verb`"^(self#label ~no_:false s_name)^"`}\n")] @ @@ -246,11 +247,14 @@ class virtual to_text = (** @return [text] value for a class attribute. *) method text_of_attribute a = let s_name = Name.simple a.att_value.val_name in - Format.fprintf Format.str_formatter "@[<hov 2>val %s%s :@ " - (if a.att_mutable then "mutable " else "") - s_name; let mod_name = Name.father a.att_value.val_name in - let s = self#normal_type mod_name a.att_value.val_type in + let s = + Format.fprintf Format.str_formatter "@[<hov 2>val %s%s :@ %s" + (if a.att_mutable then "mutable " else "") + s_name + (self#normal_type mod_name a.att_value.val_type); + Format.flush_str_formatter () + in (CodePre s) :: [Latex ("\\index{"^(self#label s_name)^"@\\verb`"^(self#label ~no_:false s_name)^"`}\n")] @ (self#text_of_info a.att_value.val_info) @@ -258,12 +262,15 @@ class virtual to_text = (** @return [text] value for a class method. *) method text_of_method m = let s_name = Name.simple m.met_value.val_name in - Format.fprintf Format.str_formatter "@[<hov 2>method %s%s%s :@ " - (if m.met_private then "private " else "") - (if m.met_virtual then "virtual " else "") - s_name ; let mod_name = Name.father m.met_value.val_name in - let s = self#normal_type mod_name m.met_value.val_type in + let s = + Format.fprintf Format.str_formatter "@[<hov 2>method %s%s%s :@ %s" + (if m.met_private then "private " else "") + (if m.met_virtual then "virtual " else "") + s_name + (self#normal_type mod_name m.met_value.val_type); + Format.flush_str_formatter () + in (CodePre s) :: [Latex ("\\index{"^(self#label s_name)^"@\\verb`"^(self#label ~no_:false s_name)^"`}\n")] @ (self#text_of_info m.met_value.val_info) diff --git a/ocamldoc/odoc_type.ml b/ocamldoc/odoc_type.ml index 4e53fac1..946b70eb 100644 --- a/ocamldoc/odoc_type.ml +++ b/ocamldoc/odoc_type.ml @@ -41,7 +41,8 @@ type type_kind = type t_type = { ty_name : Name.t ; mutable ty_info : Odoc_types.info option ; (** optional user information *) - ty_parameters : Types.type_expr list ; (** type parameters *) + ty_parameters : (Types.type_expr * bool * bool) list ; + (** type parameters: (type, covariant, contravariant) *) ty_kind : type_kind ; ty_manifest : Types.type_expr option; (** type manifest *) mutable ty_loc : Odoc_types.location ; diff --git a/ocamldoc/remove_DEBUG b/ocamldoc/remove_DEBUG new file mode 100755 index 00000000..99ab8972 --- /dev/null +++ b/ocamldoc/remove_DEBUG @@ -0,0 +1,8 @@ +#!/bin/sh + +# usage: remove_DEBUG <file> +# remove from <file> every line that contains the string "DEBUG", +# respecting the cpp # line annotation conventions + +echo "# 1 \"$1\"" +sed -e '/DEBUG/s/.*//' "$1" diff --git a/otherlibs/graph/.depend b/otherlibs/graph/.depend index cfd5a8ef..1bc2b881 100644 --- a/otherlibs/graph/.depend +++ b/otherlibs/graph/.depend @@ -1,23 +1,47 @@ -color.o: color.c libgraph.h ../../config/s.h ../../byterun/misc.h -draw.o: draw.c libgraph.h ../../config/s.h ../../byterun/misc.h -dump_img.o: dump_img.c libgraph.h ../../config/s.h ../../byterun/misc.h \ - image.h ../../byterun/gc.h ../../byterun/major_gc.h \ +color.o: color.c libgraph.h ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h +draw.o: draw.c libgraph.h ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h +dump_img.o: dump_img.c libgraph.h ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h image.h ../../byterun/alloc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ ../../byterun/freelist.h ../../byterun/minor_gc.h -events.o: events.c libgraph.h ../../config/s.h ../../byterun/misc.h -fill.o: fill.c libgraph.h ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h -image.o: image.c libgraph.h ../../config/s.h ../../byterun/misc.h image.h -make_img.o: make_img.c libgraph.h ../../config/s.h ../../byterun/misc.h \ - image.h ../../byterun/gc.h ../../byterun/major_gc.h \ +events.o: events.c libgraph.h ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/signals.h +fill.o: fill.c libgraph.h ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ ../../byterun/freelist.h ../../byterun/minor_gc.h -open.o: open.c libgraph.h ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ +image.o: image.c libgraph.h ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h image.h ../../byterun/alloc.h \ + ../../byterun/custom.h +make_img.o: make_img.c libgraph.h ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h image.h ../../byterun/memory.h ../../byterun/gc.h \ + ../../byterun/major_gc.h ../../byterun/freelist.h \ ../../byterun/minor_gc.h -point_col.o: point_col.c libgraph.h ../../config/s.h ../../byterun/misc.h -sound.o: sound.c libgraph.h ../../config/s.h ../../byterun/misc.h -subwindow.o: subwindow.c libgraph.h ../../config/s.h ../../byterun/misc.h -text.o: text.c libgraph.h ../../config/s.h ../../byterun/misc.h +open.o: open.c libgraph.h ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/callback.h ../../byterun/fail.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h +point_col.o: point_col.c libgraph.h ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h +sound.o: sound.c libgraph.h ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h +subwindow.o: subwindow.c libgraph.h ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h +text.o: text.c libgraph.h ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h graphics.cmo: graphics.cmi graphics.cmx: graphics.cmi graphicsX11.cmo: graphics.cmi graphicsX11.cmi diff --git a/otherlibs/graph/Makefile b/otherlibs/graph/Makefile index f953bf59..24f6fbc5 100644 --- a/otherlibs/graph/Makefile +++ b/otherlibs/graph/Makefile @@ -11,7 +11,7 @@ # # ######################################################################### -# $Id: Makefile,v 1.34 2002/06/27 11:36:01 xleroy Exp $ +# $Id: Makefile,v 1.35 2003/08/05 13:39:33 xleroy Exp $ # Makefile for the portable graphics library @@ -56,7 +56,7 @@ install: cp graphics.cm[ia] graphicsX11.cmi graphics.mli graphicsX11.mli $(LIBDIR) installopt: - cp graphics.cmxa graphics.a $(LIBDIR) + cp graphics.cmx graphics.cmxa graphics.a $(LIBDIR) cd $(LIBDIR); $(RANLIB) graphics.a .SUFFIXES: .ml .mli .cmo .cmi .cmx diff --git a/otherlibs/labltk/Makefile b/otherlibs/labltk/Makefile index 9e89adc0..4e4fbd15 100644 --- a/otherlibs/labltk/Makefile +++ b/otherlibs/labltk/Makefile @@ -1,7 +1,9 @@ # Top Makefile for mlTk SUBDIRS=compiler support lib jpf frx tkanim examples_labltk \ - camltk labltk examples_camltk browser + examples_camltk browser +SUBDIRS_GENERATED=camltk labltk + all: cd support; $(MAKE) @@ -71,5 +73,8 @@ partialclean clean: for d in $(SUBDIRS); do \ cd $$d; $(MAKE) -f Makefile clean; cd ..; \ done + for d in $(SUBDIRS_GENERATED); do \ + cd $$d; $(MAKE) -f Makefile.gen clean; cd ..; \ + done depend: diff --git a/otherlibs/labltk/camltk/Makefile.gen b/otherlibs/labltk/camltk/Makefile.gen index 01c633a3..1e4f50a1 100644 --- a/otherlibs/labltk/camltk/Makefile.gen +++ b/otherlibs/labltk/camltk/Makefile.gen @@ -41,6 +41,6 @@ cTk.ml camltk.ml .depend: _tkgen.ml ../builtin/report.ml ../compiler/pp #../buil # All .{ml,mli} files are generated in this directory clean: - rm -f *.cm* *.ml *.mli *.o *.a + rm -f *.cm* *.ml *.mli *.o *.a .depend -# rm -f modules .depend +# rm -f modules diff --git a/otherlibs/labltk/examples_labltk/hello.tcl b/otherlibs/labltk/examples_labltk/hello.tcl index 9e9985c1..84ceccd6 100755 --- a/otherlibs/labltk/examples_labltk/hello.tcl +++ b/otherlibs/labltk/examples_labltk/hello.tcl @@ -1,4 +1,4 @@ -#!/usr/local/bin/wish4.0 +#!/usr/bin/wish button .hello -text "Hello, TclTk!" diff --git a/otherlibs/labltk/labltk/Makefile.gen b/otherlibs/labltk/labltk/Makefile.gen index 20891d15..a7f85082 100644 --- a/otherlibs/labltk/labltk/Makefile.gen +++ b/otherlibs/labltk/labltk/Makefile.gen @@ -40,6 +40,6 @@ tk.ml labltk.ml .depend: _tkgen.ml ../builtin/report.ml ../compiler/pp #../built # All .{ml,mli} files are generated in this directory clean: - rm -f *.cm* *.ml *.mli *.o *.a + rm -f *.cm* *.ml *.mli *.o *.a .depend -# rm -f modules .depend +# rm -f modules diff --git a/otherlibs/str/.depend b/otherlibs/str/.depend index 70671c2f..c93656ba 100644 --- a/otherlibs/str/.depend +++ b/otherlibs/str/.depend @@ -1,5 +1,7 @@ -strstubs.o: strstubs.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h +strstubs.o: strstubs.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ + ../../byterun/major_gc.h ../../byterun/freelist.h \ + ../../byterun/minor_gc.h ../../byterun/fail.h str.cmo: str.cmi str.cmx: str.cmi diff --git a/otherlibs/str/str.mli b/otherlibs/str/str.mli index 71b63bc8..b71d2f17 100644 --- a/otherlibs/str/str.mli +++ b/otherlibs/str/str.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: str.mli,v 1.20 2002/12/09 14:05:18 xleroy Exp $ *) +(* $Id: str.mli,v 1.21 2003/09/23 15:41:44 doligez Exp $ *) (** Regular expressions and high-level string processing *) @@ -123,14 +123,18 @@ val group_beginning : int -> int of the substring that was matched by the [n]th group of the regular expression. @raise Not_found if the [n]th group of the regular expression - was not matched. *) + was not matched. + @raise Invalid_argument if there are fewer than [n] groups in + the regular expression. *) val group_end : int -> int (** [group_end n] returns the position of the character following the last character of substring that was matched by the [n]th group of the regular expression. @raise Not_found if the [n]th group of the regular expression - was not matched. *) + was not matched. + @raise Invalid_argument if there are fewer than [n] groups in + the regular expression. *) (** {6 Replacement} *) diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile index 36c3c785..65066b7d 100644 --- a/otherlibs/systhreads/Makefile +++ b/otherlibs/systhreads/Makefile @@ -11,7 +11,7 @@ # # ######################################################################### -# $Id: Makefile,v 1.34 2002/06/27 11:36:02 xleroy Exp $ +# $Id: Makefile,v 1.35 2003/08/21 13:52:07 xleroy Exp $ include ../../config/Makefile @@ -66,7 +66,7 @@ partialclean: rm -f *.cm* clean: partialclean - rm -f libthreads*.a *.o threads.a + rm -f *.o *.a *.so rm -f $(GENFILES) install: diff --git a/otherlibs/systhreads/posix.c b/otherlibs/systhreads/posix.c index f47535f2..958c2dfb 100644 --- a/otherlibs/systhreads/posix.c +++ b/otherlibs/systhreads/posix.c @@ -11,7 +11,7 @@ /* */ /***********************************************************************/ -/* $Id: posix.c,v 1.46 2003/06/16 12:31:13 xleroy Exp $ */ +/* $Id: posix.c,v 1.47 2003/07/29 15:35:12 xleroy Exp $ */ /* Thread interface for POSIX 1003.1c threads */ @@ -779,6 +779,7 @@ int caml_threadstatus_wait (value wrapper) value caml_wait_signal(value sigs) /* ML */ { +#ifdef HAS_SIGWAIT sigset_t set; int retcode, signo; @@ -793,6 +794,10 @@ value caml_wait_signal(value sigs) /* ML */ leave_blocking_section(); caml_pthread_check(retcode, "Thread.wait_signal"); return Val_int(signo); +#else + invalid_argument("Thread.wait_signal not implemented"); + return Val_int(0); /* not reached */ +#endif } /* Error report */ diff --git a/otherlibs/threads/pervasives.ml b/otherlibs/threads/pervasives.ml index 57f6d815..f45f1af6 100644 --- a/otherlibs/threads/pervasives.ml +++ b/otherlibs/threads/pervasives.ml @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: pervasives.ml,v 1.43 2003/07/05 11:13:23 xleroy Exp $ *) +(* $Id: pervasives.ml,v 1.44 2003/07/29 09:09:33 xleroy Exp $ *) (* Same as ../../stdlib/pervasives.ml, except that I/O functions have been redefined to not block the whole process, but only the calling @@ -198,13 +198,14 @@ let valid_float_lexem s = let l = string_length s in let rec loop i = if i >= l then s ^ "." else - if s.[i] = '.' || s.[i] = 'e' then s - else loop (i+1) + match s.[i] with + | '0' .. '9' | '-' -> loop (i+1) + | _ -> s in loop 0 ;; -let string_of_float f = valid_float_lexem (format_float "%.17g" f);; +let string_of_float f = valid_float_lexem (format_float "%.12g" f);; external float_of_string : string -> float = "float_of_string" diff --git a/otherlibs/unix/.depend b/otherlibs/unix/.depend index 781fd1fd..cb4704c7 100644 --- a/otherlibs/unix/.depend +++ b/otherlibs/unix/.depend @@ -1,162 +1,283 @@ -accept.o: accept.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h socketaddr.h -access.o: access.c ../../config/s.h ../../byterun/misc.h unixsupport.h -addrofstr.o: addrofstr.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h socketaddr.h -alarm.o: alarm.c ../../config/s.h ../../byterun/misc.h unixsupport.h -bind.o: bind.c ../../config/s.h ../../byterun/misc.h unixsupport.h \ +accept.o: accept.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ + ../../byterun/major_gc.h ../../byterun/freelist.h \ + ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h \ socketaddr.h -chdir.o: chdir.c ../../config/s.h ../../byterun/misc.h unixsupport.h -chmod.o: chmod.c ../../config/s.h ../../byterun/misc.h unixsupport.h -chown.o: chown.c ../../config/s.h ../../byterun/misc.h unixsupport.h -chroot.o: chroot.c ../../config/s.h ../../byterun/misc.h unixsupport.h -close.o: close.c ../../config/s.h ../../byterun/misc.h unixsupport.h -closedir.o: closedir.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -connect.o: connect.c ../../config/s.h ../../byterun/misc.h unixsupport.h \ +access.o: access.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h +addrofstr.o: addrofstr.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/fail.h unixsupport.h socketaddr.h +alarm.o: alarm.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +bind.o: bind.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h \ socketaddr.h -cst2constr.o: cst2constr.c ../../config/s.h ../../byterun/misc.h \ - cst2constr.h -cstringv.o: cstringv.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -dup2.o: dup2.c ../../config/s.h ../../byterun/misc.h unixsupport.h -dup.o: dup.c ../../config/s.h ../../byterun/misc.h unixsupport.h -envir.o: envir.c ../../config/s.h ../../byterun/misc.h -errmsg.o: errmsg.c ../../config/s.h ../../byterun/misc.h -execv.o: execv.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ - ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -execve.o: execve.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -execvp.o: execvp.c ../../config/s.h ../../byterun/misc.h \ +chdir.o: chdir.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +chmod.o: chmod.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +chown.o: chown.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +chroot.o: chroot.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +close.o: close.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +closedir.o: closedir.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +connect.o: connect.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/signals.h unixsupport.h socketaddr.h +cst2constr.o: cst2constr.c ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h ../../byterun/fail.h cst2constr.h +cstringv.o: cstringv.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h +dup.o: dup.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +dup2.o: dup2.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +envir.o: envir.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h +errmsg.o: errmsg.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h +execv.o: execv.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h +execve.o: execve.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h +execvp.o: execvp.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h +exit.o: exit.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +fchmod.o: fchmod.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +fchown.o: fchown.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +fcntl.o: fcntl.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +fork.o: fork.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +ftruncate.o: ftruncate.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/io.h unixsupport.h +getcwd.o: getcwd.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h +getegid.o: getegid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +geteuid.o: geteuid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +getgid.o: getgid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +getgr.o: getgr.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/fail.h ../../byterun/alloc.h ../../byterun/memory.h \ ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ ../../byterun/minor_gc.h unixsupport.h -exit.o: exit.c ../../config/s.h ../../byterun/misc.h unixsupport.h -fchmod.o: fchmod.c ../../config/s.h ../../byterun/misc.h unixsupport.h -fchown.o: fchown.c ../../config/s.h ../../byterun/misc.h unixsupport.h -fcntl.o: fcntl.c ../../config/s.h ../../byterun/misc.h unixsupport.h -fork.o: fork.c ../../config/s.h ../../byterun/misc.h unixsupport.h -ftruncate.o: ftruncate.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -getcwd.o: getcwd.c ../../config/s.h ../../byterun/misc.h unixsupport.h -getegid.o: getegid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -geteuid.o: geteuid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -getgid.o: getgid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -getgr.o: getgr.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ +getgroups.o: getgroups.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h +gethost.o: gethost.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -getgroups.o: getgroups.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -gethost.o: gethost.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h socketaddr.h -gethostname.o: gethostname.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -getlogin.o: getlogin.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -getpeername.o: getpeername.c ../../config/s.h ../../byterun/misc.h \ + ../../byterun/minor_gc.h ../../byterun/fail.h ../../byterun/signals.h \ unixsupport.h socketaddr.h -getpid.o: getpid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -getppid.o: getppid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -getproto.o: getproto.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -getpw.o: getpw.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ +gethostname.o: gethostname.c ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h ../../byterun/alloc.h unixsupport.h +getlogin.o: getlogin.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h +getpeername.o: getpeername.c ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h unixsupport.h socketaddr.h +getpid.o: getpid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +getppid.o: getppid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +getproto.o: getproto.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ + ../../byterun/major_gc.h ../../byterun/freelist.h \ + ../../byterun/minor_gc.h ../../byterun/fail.h unixsupport.h +getpw.o: getpw.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ + ../../byterun/major_gc.h ../../byterun/freelist.h \ + ../../byterun/minor_gc.h ../../byterun/fail.h unixsupport.h +getserv.o: getserv.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ + ../../byterun/major_gc.h ../../byterun/freelist.h \ + ../../byterun/minor_gc.h ../../byterun/fail.h unixsupport.h +getsockname.o: getsockname.c ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h unixsupport.h socketaddr.h +gettimeofday.o: gettimeofday.c ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h ../../byterun/alloc.h unixsupport.h +getuid.o: getuid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +gmtime.o: gmtime.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ ../../byterun/major_gc.h ../../byterun/freelist.h \ ../../byterun/minor_gc.h unixsupport.h -getserv.o: getserv.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -getsockname.o: getsockname.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h socketaddr.h -gettimeofday.o: gettimeofday.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -getuid.o: getuid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -gmtime.o: gmtime.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -itimer.o: itimer.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -kill.o: kill.c ../../config/s.h ../../byterun/misc.h unixsupport.h -link.o: link.c ../../config/s.h ../../byterun/misc.h unixsupport.h -listen.o: listen.c ../../config/s.h ../../byterun/misc.h unixsupport.h -lockf.o: lockf.c ../../config/s.h ../../byterun/misc.h unixsupport.h -lseek.o: lseek.c ../../config/s.h ../../byterun/misc.h unixsupport.h -mkdir.o: mkdir.c ../../config/s.h ../../byterun/misc.h unixsupport.h -mkfifo.o: mkfifo.c ../../config/s.h ../../byterun/misc.h unixsupport.h -nice.o: nice.c ../../config/s.h ../../byterun/misc.h unixsupport.h -open.o: open.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ +itimer.o: itimer.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ ../../byterun/major_gc.h ../../byterun/freelist.h \ ../../byterun/minor_gc.h unixsupport.h -opendir.o: opendir.c ../../config/s.h ../../byterun/misc.h unixsupport.h -pipe.o: pipe.c ../../config/s.h ../../byterun/misc.h unixsupport.h -putenv.o: putenv.c ../../config/s.h ../../byterun/gc.h \ +kill.o: kill.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/fail.h unixsupport.h ../../byterun/signals.h +link.o: link.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +listen.o: listen.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +lockf.o: lockf.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +lseek.o: lseek.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/io.h unixsupport.h +mkdir.o: mkdir.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +mkfifo.o: mkfifo.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +nice.o: nice.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +open.o: open.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ + ../../byterun/major_gc.h ../../byterun/freelist.h \ + ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h +opendir.o: opendir.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +pipe.o: pipe.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h +putenv.o: putenv.c ../../byterun/memory.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/gc.h \ ../../byterun/mlvalues.h ../../byterun/misc.h ../../byterun/major_gc.h \ ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h -read.o: read.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ +read.o: read.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h \ + ../../byterun/signals.h unixsupport.h +readdir.o: readdir.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/fail.h ../../byterun/alloc.h unixsupport.h +readlink.o: readlink.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h +rename.o: rename.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +rewinddir.o: rewinddir.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +rmdir.o: rmdir.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +select.o: select.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -readdir.o: readdir.c ../../config/s.h ../../byterun/misc.h unixsupport.h -readlink.o: readlink.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -rename.o: rename.c ../../config/s.h ../../byterun/misc.h unixsupport.h -rewinddir.o: rewinddir.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -rmdir.o: rmdir.c ../../config/s.h ../../byterun/misc.h unixsupport.h -select.o: select.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -sendrecv.o: sendrecv.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h socketaddr.h -setgid.o: setgid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -setsid.o: setsid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -setuid.o: setuid.c ../../config/s.h ../../byterun/misc.h unixsupport.h -shutdown.o: shutdown.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -signals.o: signals.c ../../config/s.h ../../byterun/mlvalues.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -sleep.o: sleep.c ../../config/s.h ../../byterun/misc.h unixsupport.h -socketaddr.o: socketaddr.c ../../config/s.h ../../byterun/misc.h \ - ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h socketaddr.h -socket.o: socket.c ../../config/s.h ../../byterun/misc.h unixsupport.h -socketpair.o: socketpair.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -sockopt.o: sockopt.c ../../config/s.h ../../byterun/misc.h unixsupport.h \ - socketaddr.h -stat.o: stat.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ + ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h +sendrecv.o: sendrecv.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h cst2constr.h -strofaddr.o: strofaddr.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h socketaddr.h -symlink.o: symlink.c ../../config/s.h ../../byterun/misc.h unixsupport.h -termios.o: termios.c ../../config/s.h ../../byterun/misc.h unixsupport.h -time.o: time.c ../../config/s.h ../../byterun/misc.h unixsupport.h -times.o: times.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ + ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h \ + socketaddr.h +setgid.o: setgid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +setsid.o: setsid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +setuid.o: setuid.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +shutdown.o: shutdown.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +signals.o: signals.c ../../byterun/alloc.h ../../byterun/misc.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/mlvalues.h ../../byterun/memory.h ../../byterun/gc.h \ ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h -truncate.o: truncate.c ../../config/s.h ../../byterun/misc.h \ - unixsupport.h -umask.o: umask.c ../../config/s.h ../../byterun/misc.h unixsupport.h -unixsupport.o: unixsupport.c ../../config/s.h ../../byterun/misc.h \ + ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h +sleep.o: sleep.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/signals.h unixsupport.h +socket.o: socket.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +socketaddr.o: socketaddr.c ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/memory.h \ ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h cst2constr.h -unlink.o: unlink.c ../../config/s.h ../../byterun/misc.h unixsupport.h -utimes.o: utimes.c ../../config/s.h ../../byterun/misc.h unixsupport.h -wait.o: wait.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ + ../../byterun/minor_gc.h unixsupport.h socketaddr.h +socketpair.o: socketpair.c ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h ../../byterun/alloc.h unixsupport.h +sockopt.o: sockopt.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h socketaddr.h +stat.o: stat.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h ../../byterun/alloc.h \ + unixsupport.h cst2constr.h ../../byterun/io.h +strofaddr.o: strofaddr.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h socketaddr.h +symlink.o: symlink.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +termios.o: termios.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h +time.o: time.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h unixsupport.h +times.o: times.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ ../../byterun/major_gc.h ../../byterun/freelist.h \ ../../byterun/minor_gc.h unixsupport.h -write.o: write.c ../../config/s.h ../../byterun/misc.h ../../byterun/gc.h \ +truncate.o: truncate.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/io.h unixsupport.h +umask.o: umask.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +unixsupport.o: unixsupport.c ../../byterun/mlvalues.h \ + ../../byterun/config.h ../../config/m.h ../../config/s.h \ + ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/callback.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h ../../byterun/fail.h \ + unixsupport.h cst2constr.h +unlink.o: unlink.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +utimes.o: utimes.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h unixsupport.h +wait.o: wait.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/alloc.h ../../byterun/memory.h ../../byterun/gc.h \ ../../byterun/major_gc.h ../../byterun/freelist.h \ - ../../byterun/minor_gc.h unixsupport.h + ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h +write.o: write.c ../../byterun/mlvalues.h ../../byterun/config.h \ + ../../config/m.h ../../config/s.h ../../byterun/misc.h \ + ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \ + ../../byterun/freelist.h ../../byterun/minor_gc.h \ + ../../byterun/signals.h unixsupport.h unixLabels.cmi: unix.cmi -unixLabels.cmo: unix.cmi unixLabels.cmi -unixLabels.cmx: unix.cmx unixLabels.cmi unix.cmo: unix.cmi unix.cmx: unix.cmi +unixLabels.cmo: unix.cmi unixLabels.cmi +unixLabels.cmx: unix.cmx unixLabels.cmi diff --git a/otherlibs/unix/unix.mli b/otherlibs/unix/unix.mli index 5f3608f3..36d24796 100644 --- a/otherlibs/unix/unix.mli +++ b/otherlibs/unix/unix.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: unix.mli,v 1.70 2003/01/21 12:51:55 doligez Exp $ *) +(* $Id: unix.mli,v 1.71 2003/09/14 16:46:31 doligez Exp $ *) (** Interface to the Unix system *) @@ -416,7 +416,8 @@ val fchown : file_descr -> int -> int -> unit (** Change the owner uid and owner gid of an opened file. *) val umask : int -> int -(** Set the process creation mask, and return the previous mask. *) +(** Set the process's file mode creation mask, and return the previous + mask. *) val access : string -> access_permission list -> unit (** Check that the process has the given permissions over the named diff --git a/parsing/lexer.mll b/parsing/lexer.mll index d0b44616..3f3a237a 100644 --- a/parsing/lexer.mll +++ b/parsing/lexer.mll @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: lexer.mll,v 1.65 2003/04/25 12:27:30 xleroy Exp $ *) +(* $Id: lexer.mll,v 1.66 2003/08/25 13:15:47 doligez Exp $ *) (* The lexer definition *) @@ -68,7 +68,7 @@ let keyword_table = "of", OF; "open", OPEN; "or", OR; - "parser", PARSER; +(* "parser", PARSER; *) "private", PRIVATE; "rec", REC; "sig", SIG; diff --git a/parsing/location.ml b/parsing/location.ml index b577b546..d681dd90 100644 --- a/parsing/location.ml +++ b/parsing/location.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: location.ml,v 1.42 2002/11/26 17:14:28 doligez Exp $ *) +(* $Id: location.ml,v 1.43 2003/09/03 13:24:56 doligez Exp $ *) open Lexing @@ -195,14 +195,13 @@ let (msg_file, msg_line, msg_chars, msg_to, msg_colon, msg_head) = (* return file, line, char from the given position *) let get_pos_info pos = - let fname = if pos.pos_fname <> "" then pos.pos_fname else !input_name in let (filename, linenum, linebeg) = - if fname = "" then + if pos.pos_fname = "" && !input_name = "" then ("", -1, 0) - else if pos.pos_lnum = -1 then - Linenum.for_position fname pos.pos_cnum + else if pos.pos_fname = "" then + Linenum.for_position !input_name pos.pos_cnum else - (fname, pos.pos_lnum, pos.pos_bol) + (pos.pos_fname, pos.pos_lnum, pos.pos_bol) in (filename, linenum, pos.pos_cnum - linebeg) ;; diff --git a/parsing/parser.mly b/parsing/parser.mly index 32e28c2b..6fa9d6c5 100644 --- a/parsing/parser.mly +++ b/parsing/parser.mly @@ -10,7 +10,7 @@ /* */ /***********************************************************************/ -/* $Id: parser.mly,v 1.115 2003/07/02 09:14:31 xleroy Exp $ */ +/* $Id: parser.mly,v 1.117 2003/08/25 13:15:47 doligez Exp $ */ /* The parser definition */ @@ -264,7 +264,7 @@ let bigarray_set arr arg newval = %token OPEN %token <string> OPTLABEL %token OR -%token PARSER +/* %token PARSER */ %token PLUS %token <string> PREFIXOP %token PRIVATE @@ -630,19 +630,9 @@ class_fields: { Pcf_meth $2 :: $1 } | class_fields CONSTRAINT constrain { Pcf_cstr $3 :: $1 } -/* - | class_fields LET rec_flag class_let_bindings IN - { let (bindings, loc) = $4 in - Pcf_let ($3, List.rev bindings, loc) :: $1 } -*/ | class_fields INITIALIZER seq_expr { Pcf_init $3 :: $1 } ; -/* -class_let_bindings: let_bindings - { $1, symbol_rloc () } -; -*/ parent_binder: AS LIDENT { Some $2 } @@ -722,11 +712,6 @@ class_sig_fields: value_type: mutable_flag label COLON core_type { $2, $1, Some $4, symbol_rloc () } -/* -XXX Should be removed - | mutable_flag label - { $2, $1, None, symbol_rloc () } -*/ ; method_type: METHOD private_flag label COLON poly_type @@ -890,16 +875,6 @@ expr: { bigarray_set $1 $4 $7 } | label LESSMINUS expr { mkexp(Pexp_setinstvar($1, $3)) } -/* - | expr SHARP label - { mkexp(Pexp_send($1, $3)) } - | expr SHARP label simple_expr_list - { mkexp(Pexp_apply({ pexp_desc = Pexp_send($1, $3); - pexp_loc = { loc_start = Parsing.symbol_start (); - loc_end = Parsing.rhs_end 3; - loc_ghost = false } }, - List.rev $4)) } -*/ | ASSERT simple_expr %prec below_SHARP { mkassert $2 } | LAZY simple_expr %prec below_SHARP @@ -994,14 +969,6 @@ label_expr: label_ident: LIDENT { ($1, mkexp(Pexp_ident(Lident $1))) } ; -/* -simple_expr_list: - simple_expr - { [$1] } - | simple_expr_list simple_expr - { $2 :: $1 } -; -*/ let_bindings: let_binding { [$1] } | let_bindings AND let_binding { $3 :: $1 } @@ -1013,12 +980,6 @@ let_binding: { ($1, $3) } ; fun_binding: -/* - EQUAL seq_expr - { $2 } - | labeled_simple_pattern fun_binding - { let (l, o, p) = $1 in mkexp(Pexp_function(l, o, [p, $2])) } -*/ strict_binding { $1 } | type_constraint EQUAL seq_expr diff --git a/stdlib/.depend b/stdlib/.depend index bc656656..c19afaa8 100644 --- a/stdlib/.depend +++ b/stdlib/.depend @@ -8,10 +8,10 @@ random.cmi: int32.cmi int64.cmi nativeint.cmi weak.cmi: hashtbl.cmi arg.cmo: array.cmi buffer.cmi list.cmi printf.cmi string.cmi sys.cmi arg.cmi arg.cmx: array.cmx buffer.cmx list.cmx printf.cmx string.cmx sys.cmx arg.cmi -arrayLabels.cmo: array.cmi arrayLabels.cmi -arrayLabels.cmx: array.cmx arrayLabels.cmi array.cmo: array.cmi array.cmx: array.cmi +arrayLabels.cmo: array.cmi arrayLabels.cmi +arrayLabels.cmx: array.cmx arrayLabels.cmi buffer.cmo: string.cmi sys.cmi buffer.cmi buffer.cmx: string.cmx sys.cmx buffer.cmi callback.cmo: obj.cmi callback.cmi @@ -46,10 +46,10 @@ lazy.cmo: obj.cmi lazy.cmi lazy.cmx: obj.cmx lazy.cmi lexing.cmo: array.cmi string.cmi sys.cmi lexing.cmi lexing.cmx: array.cmx string.cmx sys.cmx lexing.cmi -listLabels.cmo: list.cmi listLabels.cmi -listLabels.cmx: list.cmx listLabels.cmi list.cmo: list.cmi list.cmx: list.cmi +listLabels.cmo: list.cmi listLabels.cmi +listLabels.cmx: list.cmx listLabels.cmi map.cmo: map.cmi map.cmx: map.cmi marshal.cmo: string.cmi marshal.cmi @@ -90,10 +90,10 @@ stdLabels.cmo: arrayLabels.cmi listLabels.cmi stringLabels.cmi stdLabels.cmi stdLabels.cmx: arrayLabels.cmx listLabels.cmx stringLabels.cmx stdLabels.cmi stream.cmo: list.cmi obj.cmi string.cmi stream.cmi stream.cmx: list.cmx obj.cmx string.cmx stream.cmi -stringLabels.cmo: string.cmi stringLabels.cmi -stringLabels.cmx: string.cmx stringLabels.cmi string.cmo: char.cmi list.cmi pervasives.cmi string.cmi string.cmx: char.cmx list.cmx pervasives.cmx string.cmi +stringLabels.cmo: string.cmi stringLabels.cmi +stringLabels.cmx: string.cmx stringLabels.cmi sys.cmo: sys.cmi sys.cmx: sys.cmi weak.cmo: array.cmi hashtbl.cmi obj.cmi sys.cmi weak.cmi diff --git a/stdlib/arg.ml b/stdlib/arg.ml index fdd4b3bb..6f5e7fdc 100644 --- a/stdlib/arg.ml +++ b/stdlib/arg.ml @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: arg.ml,v 1.29 2003/07/03 13:17:09 doligez Exp $ *) +(* $Id: arg.ml,v 1.30 2003/07/24 18:23:54 doligez Exp $ *) type key = string type doc = string @@ -85,10 +85,12 @@ let usage speclist errmsg = let current = ref 0;; -let parse_argv argv speclist anonfun errmsg = +let parse_argv ?(current=current) argv speclist anonfun errmsg = + let l = Array.length argv in let b = Buffer.create 200 in + let initpos = !current in let stop error = - let progname = if Array.length argv > 0 then argv.(0) else "(?)" in + let progname = if initpos < l then argv.(initpos) else "(?)" in begin match error with | Unknown "-help" -> () | Unknown "--help" -> () @@ -107,7 +109,6 @@ let parse_argv argv speclist anonfun errmsg = then raise (Help (Buffer.contents b)) else raise (Bad (Buffer.contents b)) in - let l = Array.length argv in incr current; while !current < l do let s = argv.(!current) in @@ -186,7 +187,6 @@ let parse_argv argv speclist anonfun errmsg = ;; let parse l f msg = - current := 0; try parse_argv Sys.argv l f msg; with diff --git a/stdlib/arg.mli b/stdlib/arg.mli index b0e34101..e4fb4718 100644 --- a/stdlib/arg.mli +++ b/stdlib/arg.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: arg.mli,v 1.32 2003/06/19 18:13:31 doligez Exp $ *) +(* $Id: arg.mli,v 1.33 2003/07/24 18:23:54 doligez Exp $ *) (** Parsing of command line arguments. @@ -94,12 +94,13 @@ val parse : own [-help] and [--help] options in [speclist]. *) -val parse_argv : string array -> +val parse_argv : ?current: int ref -> string array -> (key * spec * doc) list -> anon_fun -> usage_msg -> unit -(** [Arg.parse_argv args speclist anon_fun usage_msg] parses the array - [args] as if it were the command line. It uses and updates the - value of [Arg.current]. You must set [Arg.current] before calling - [parse_argv], and restore it afterward if needed. +(** [Arg.parse_argv ~current args speclist anon_fun usage_msg] parses + the array [args] as if it were the command line. It uses and updates + the value of [~current] (if given), or [Arg.current]. You must set + it before calling [parse_argv]. The initial value of [current] + is the index of the program name (argument 0) in the array. If an error occurs, [Arg.parse_argv] raises [Arg.Bad] with the error message as argument. If option [-help] or [--help] is given, [Arg.parse_argv] raises [Arg.Help] with the help message @@ -122,4 +123,7 @@ val usage : (key * spec * doc) list -> usage_msg -> unit val current : int ref (** Position (in {!Sys.argv}) of the argument being processed. You can - change this value, e.g. to force {!Arg.parse} to skip some arguments.*) + change this value, e.g. to force {!Arg.parse} to skip some arguments. + {!Arg.parse} uses the initial value of {!Arg.current} as the index of + argument 0 (the program name) and starts parsing arguments + at the next element. *) diff --git a/stdlib/format.mli b/stdlib/format.mli index 2831a84a..650e9cfc 100644 --- a/stdlib/format.mli +++ b/stdlib/format.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: format.mli,v 1.61 2003/07/05 11:13:23 xleroy Exp $ *) +(* $Id: format.mli,v 1.63 2003/09/25 10:33:52 weis Exp $ *) (** Pretty printing. @@ -279,17 +279,17 @@ type tag = string;; By default, those tags do not influence line breaking calculation: the tag ``markers'' are not considered as part of the printing - material that drive line breaking (in other words, the length of + material that drives line breaking (in other words, the length of those strings is considered as zero for line breaking). Thus, tag handling is in some sense transparent to pretty-printing - and do not interfere with usual pretty-printing. Hence, a single + and does not interfere with usual pretty-printing. Hence, a single pretty printing routine can output both simple ``verbatim'' material or richer decorated output depending on the treatment of - tags. Default behavior of the pretty printer engine is to consider - tags as active, so that output is decorated. Otherwise, if - [set_tags] is set to [false], the pretty printer engine just skips - tags, and the output is regular. + tags. By default, tags are not active, hence the output is not + decorated with tag information. Once [set_tags] is set to [true], + the pretty printer engine honors tags and decorates the output + accordingly. When a tag has been opened (or closed), it is both and successively ``printed'' and ``marked''. Printing a tag means calling a @@ -303,7 +303,7 @@ type tag = string;; marker string associated to its tag argument. Being flushed directly into the output device of the formatter, tag marker strings are not considered as part of the printing material that - drive line breaking (in other words, the length of the strings + drives line breaking (in other words, the length of the strings corresponding to tag markers is considered as zero for line breaking). In addition, advanced users may take advantage of the specificity of tag markers to be precisely output when the @@ -338,7 +338,7 @@ val set_mark_tags : bool -> unit;; [set_mark_tags b] turns on or off the output of tag markers. *) val get_print_tags : unit -> bool;; val get_mark_tags : unit -> bool;; -(** Return the current status of tag printing and marking. *) +(** Return the current status of tags printing and tags marking. *) (** {6 Redirecting formatter output} *) diff --git a/stdlib/gc.ml b/stdlib/gc.ml index aa7bbd45..1f34a06c 100644 --- a/stdlib/gc.ml +++ b/stdlib/gc.ml @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: gc.ml,v 1.16 2002/02/05 17:11:32 doligez Exp $ *) +(* $Id: gc.ml,v 1.17 2003/08/07 14:17:59 doligez Exp $ *) type stat = { minor_words : float; @@ -90,10 +90,9 @@ let rec call_alarm arec = ;; let create_alarm f = - let a = ref true in let arec = { active = ref true; f = f } in finalise call_alarm arec; - a + arec.active ;; let delete_alarm a = a := false;; diff --git a/stdlib/int32.mli b/stdlib/int32.mli index abf57dca..6ae18977 100644 --- a/stdlib/int32.mli +++ b/stdlib/int32.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: int32.mli,v 1.12 2002/06/26 14:52:34 xleroy Exp $ *) +(* $Id: int32.mli,v 1.13 2003/09/09 09:18:58 xleroy Exp $ *) (** 32-bit integers. @@ -133,14 +133,6 @@ external of_string : string -> int32 = "int32_of_string" val to_string : int32 -> string (** Return the string representation of its argument, in signed decimal. *) -external format : string -> int32 -> string = "int32_format" -(** [Int32.format fmt n] return the string representation of the - 32-bit integer [n] in the format specified by [fmt]. - [fmt] is a [Printf]-style format containing exactly - one [%d], [%i], [%u], [%x], [%X] or [%o] conversion specification. - This function is deprecated; use {!Printf.sprintf} with a [%lx] format - instead. *) - type t = int32 (** An alias for the type of 32-bit integers. *) @@ -149,3 +141,16 @@ val compare: t -> t -> int {!Pervasives.compare}. Along with the type [t], this function [compare] allows the module [Int32] to be passed as argument to the functors {!Set.Make} and {!Map.Make}. *) + +(**/**) + +(** {6 Deprecated functions} *) + +external format : string -> int32 -> string = "int32_format" +(** [Int32.format fmt n] return the string representation of the + 32-bit integer [n] in the format specified by [fmt]. + [fmt] is a [Printf]-style format consisting of exactly + one [%d], [%i], [%u], [%x], [%X] or [%o] conversion specification. + This function is deprecated; use {!Printf.sprintf} with a [%lx] format + instead. *) + diff --git a/stdlib/int64.mli b/stdlib/int64.mli index 890ee0e0..dc835ff8 100644 --- a/stdlib/int64.mli +++ b/stdlib/int64.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: int64.mli,v 1.14 2002/06/26 14:52:34 xleroy Exp $ *) +(* $Id: int64.mli,v 1.15 2003/09/09 09:18:58 xleroy Exp $ *) (** 64-bit integers. @@ -155,14 +155,6 @@ external of_string : string -> int64 = "int64_of_string" val to_string : int64 -> string (** Return the string representation of its argument, in decimal. *) -external format : string -> int64 -> string = "int64_format" -(** [Int64.format fmt n] return the string representation of the - 64-bit integer [n] in the format specified by [fmt]. - [fmt] is a {!Printf}-style format containing exactly - one [%d], [%i], [%u], [%x], [%X] or [%o] conversion specification. - This function is deprecated; use {!Printf.sprintf} with a [%Lx] format - instead. *) - external bits_of_float : float -> int64 = "int64_bits_of_float" (** Return the internal representation of the given float according to the IEEE 754 floating-point ``double format'' bit layout. @@ -183,3 +175,16 @@ val compare: t -> t -> int {!Pervasives.compare}. Along with the type [t], this function [compare] allows the module [Int64] to be passed as argument to the functors {!Set.Make} and {!Map.Make}. *) + +(**/**) + +(** {6 Deprecated functions} *) + +external format : string -> int64 -> string = "int64_format" +(** [Int64.format fmt n] return the string representation of the + 64-bit integer [n] in the format specified by [fmt]. + [fmt] is a {!Printf}-style format consisting of exactly one + [%d], [%i], [%u], [%x], [%X] or [%o] conversion specification. + This function is deprecated; use {!Printf.sprintf} with a [%Lx] format + instead. *) + diff --git a/stdlib/lexing.ml b/stdlib/lexing.ml index b8136b79..f7e2e843 100644 --- a/stdlib/lexing.ml +++ b/stdlib/lexing.ml @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: lexing.ml,v 1.21 2002/11/12 17:47:54 doligez Exp $ *) +(* $Id: lexing.ml,v 1.22 2003/08/13 15:31:36 doligez Exp $ *) (* The run-time library for lexers generated by camllex *) @@ -218,3 +218,13 @@ let lexeme_end lexbuf = lexbuf.lex_curr_p.pos_cnum;; let lexeme_start_p lexbuf = lexbuf.lex_start_p;; let lexeme_end_p lexbuf = lexbuf.lex_curr_p;; + + +(* Discard data left in lexer buffer. *) + +let flush_input lb = + lb.lex_curr_pos <- 0; + lb.lex_abs_pos <- 0; + lb.lex_curr_p <- {lb.lex_curr_p with pos_cnum = 0}; + lb.lex_buffer_len <- 0; +;; diff --git a/stdlib/lexing.mli b/stdlib/lexing.mli index 10cd5337..25496e20 100644 --- a/stdlib/lexing.mli +++ b/stdlib/lexing.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: lexing.mli,v 1.29 2002/11/02 21:52:54 doligez Exp $ *) +(* $Id: lexing.mli,v 1.30 2003/08/13 15:31:36 doligez Exp $ *) (** The run-time library for lexers generated by [ocamllex]. *) @@ -62,7 +62,8 @@ type lexbuf = Note that the lexing engine will only manage the [pos_cnum] field of [lex_curr_p] by updating it with the number of characters read since the start of the [lexbuf]. For the other fields to be - accurate, they must be updated by the lexer actions. + accurate, they must be initialised before the first use of the + lexbuf, and updated by the lexer actions. *) val from_channel : in_channel -> lexbuf @@ -123,6 +124,13 @@ val lexeme_end_p : lexbuf -> position (** Like [lexeme_end], but return a complete [position] instead of an offset. *) +(** {6 Miscellaneous functions} *) + +val flush_input : lexbuf -> unit +(** Discard the contents of the buffer and reset the current + position to 0. The next use of the lexbuf will trigger a + refill. *) + (**/**) (** {6 } *) diff --git a/stdlib/list.mli b/stdlib/list.mli index 5609b139..b2fc7e23 100644 --- a/stdlib/list.mli +++ b/stdlib/list.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: list.mli,v 1.42 2003/02/12 13:01:12 doligez Exp $ *) +(* $Id: list.mli,v 1.43 2003/07/25 21:40:06 doligez Exp $ *) (** List operations. @@ -273,5 +273,5 @@ val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list sorted list containting all the elements of [l1] and [l2]. If several elements compare equal, the elements of [l1] will be before the elements of [l2]. - Not tail-recursive (sum of the lenghts of the arguments). + Not tail-recursive (sum of the lengths of the arguments). *) diff --git a/stdlib/listLabels.mli b/stdlib/listLabels.mli index 2d3be79c..7db76e13 100644 --- a/stdlib/listLabels.mli +++ b/stdlib/listLabels.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: listLabels.mli,v 1.9 2002/06/05 12:12:47 doligez Exp $ *) +(* $Id: listLabels.mli,v 1.10 2003/07/25 21:40:06 doligez Exp $ *) (** List operations. @@ -279,5 +279,5 @@ val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list sorted list containting all the elements of [l1] and [l2]. If several elements compare equal, the elements of [l1] will be before the elements of [l2]. - Not tail-recursive (sum of the lenghts of the arguments). + Not tail-recursive (sum of the lengths of the arguments). *) diff --git a/stdlib/nativeint.mli b/stdlib/nativeint.mli index 7d821695..83cb7242 100644 --- a/stdlib/nativeint.mli +++ b/stdlib/nativeint.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: nativeint.mli,v 1.14 2002/06/26 14:52:34 xleroy Exp $ *) +(* $Id: nativeint.mli,v 1.15 2003/09/09 09:18:58 xleroy Exp $ *) (** Processor-native integers. @@ -162,14 +162,6 @@ external of_string : string -> nativeint = "nativeint_of_string" val to_string : nativeint -> string (** Return the string representation of its argument, in decimal. *) -external format : string -> nativeint -> string = "nativeint_format" -(** [Nativeint.format fmt n] return the string representation of the - native integer [n] in the format specified by [fmt]. - [fmt] is a [Printf]-style format containing exactly - one [%d], [%i], [%u], [%x], [%X] or [%o] conversion specification. - This function is deprecated; use {!Printf.sprintf} with a [%nx] format - instead. *) - type t = nativeint (** An alias for the type of native integers. *) @@ -179,3 +171,15 @@ val compare: t -> t -> int allows the module [Nativeint] to be passed as argument to the functors {!Set.Make} and {!Map.Make}. *) +(**/**) + +(** {6 Deprecated functions} *) + +external format : string -> nativeint -> string = "nativeint_format" +(** [Nativeint.format fmt n] return the string representation of the + native integer [n] in the format specified by [fmt]. + [fmt] is a [Printf]-style format consisting of exactly + one [%d], [%i], [%u], [%x], [%X] or [%o] conversion specification. + This function is deprecated; use {!Printf.sprintf} with a [%nx] format + instead. *) + diff --git a/stdlib/parsing.ml b/stdlib/parsing.ml index 96775d35..68289d98 100644 --- a/stdlib/parsing.ml +++ b/stdlib/parsing.ml @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: parsing.ml,v 1.16 2002/11/01 17:06:46 doligez Exp $ *) +(* $Id: parsing.ml,v 1.17 2003/08/01 23:28:58 doligez Exp $ *) (* The parsing engine *) @@ -151,6 +151,7 @@ let yyparse tables start lexer lexbuf = and init_errflag = env.errflag in env.stackbase <- env.sp + 1; env.curr_char <- start; + env.symb_end <- lexbuf.lex_curr_p; try loop Start (Obj.repr ()) with exn -> diff --git a/stdlib/pervasives.ml b/stdlib/pervasives.ml index 883f0865..54cb7bfb 100644 --- a/stdlib/pervasives.ml +++ b/stdlib/pervasives.ml @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: pervasives.ml,v 1.65 2003/07/05 11:13:23 xleroy Exp $ *) +(* $Id: pervasives.ml,v 1.67 2003/07/29 09:08:42 xleroy Exp $ *) (* type 'a option = None | Some of 'a *) @@ -189,13 +189,14 @@ let valid_float_lexem s = let l = string_length s in let rec loop i = if i >= l then s ^ "." else - if s.[i] = '.' || s.[i] = 'e' then s - else loop (i+1) + match s.[i] with + | '0' .. '9' | '-' -> loop (i+1) + | _ -> s in loop 0 ;; -let string_of_float f = valid_float_lexem (format_float "%.17g" f);; +let string_of_float f = valid_float_lexem (format_float "%.12g" f);; external float_of_string : string -> float = "float_of_string" diff --git a/stdlib/pervasives.mli b/stdlib/pervasives.mli index c029b347..67d2b12a 100644 --- a/stdlib/pervasives.mli +++ b/stdlib/pervasives.mli @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: pervasives.mli,v 1.92 2003/07/05 11:13:23 xleroy Exp $ *) +(* $Id: pervasives.mli,v 1.93 2003/09/04 12:44:48 doligez Exp $ *) (** The initially opened module. @@ -157,7 +157,7 @@ external ( mod ) : int -> int -> int = "%modint" (** Integer remainder. If [y] is not zero, the result of [x mod y] satisfies the following properties: [x = (x / y) * y + x mod y] and - [abs(x mod y) < abs(y)]. + [abs(x mod y) <= abs(y)-1]. If [y = 0], [x mod y] raises [Division_by_zero]. Notice that [x mod y] is negative if and only if [x < 0]. *) diff --git a/stdlib/sys.ml b/stdlib/sys.ml index 5254148b..349067c0 100644 --- a/stdlib/sys.ml +++ b/stdlib/sys.ml @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: sys.ml,v 1.75 2003/07/17 09:04:39 xleroy Exp $ *) +(* $Id: sys.ml,v 1.78 2003/09/12 07:46:23 xleroy Exp $ *) (* System interface *) @@ -78,4 +78,4 @@ let catch_break on = (* OCaml version string, must be in the format described in sys.mli. *) -let ocaml_version = "3.07+beta 1";; +let ocaml_version = "3.07";; diff --git a/tools/ocamlsize b/tools/ocamlsize index 7880b9a4..659543d5 100755 --- a/tools/ocamlsize +++ b/tools/ocamlsize @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl foreach $f (@ARGV) { open(FILE, $f) || die("Cannot open $f"); diff --git a/toplevel/toploop.ml b/toplevel/toploop.ml index cea17e8b..23987a9c 100644 --- a/toplevel/toploop.ml +++ b/toplevel/toploop.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: toploop.ml,v 1.81 2003/06/30 15:31:06 xleroy Exp $ *) +(* $Id: toploop.ml,v 1.83 2003/08/21 13:55:30 xleroy Exp $ *) (* The interactive toplevel loop *) @@ -336,14 +336,6 @@ let refill_lexbuf buffer len = | Exit -> !i end -(* Discard data left in lexer buffer. *) - -let empty_lexbuf lb = - lb.lex_curr_pos <- 0; - lb.lex_abs_pos <- 0; - lb.lex_curr_p <- {lb.lex_curr_p with pos_cnum = 0}; - lb.lex_buffer_len <- 0 - (* Toplevel initialization. Performed here instead of at the beginning of loop() so that user code linked in with ocamlmktop can call directives from Topdirs. *) @@ -358,7 +350,11 @@ let _ = crc_intfs let load_ocamlinit ppf = + let home_init = + try Filename.concat (Sys.getenv "HOME") ".ocamlinit" + with Not_found -> ".ocamlinit" in if Sys.file_exists ".ocamlinit" then ignore(use_silently ppf ".ocamlinit") + else if Sys.file_exists home_init then ignore(use_silently ppf home_init) let set_paths () = (* Add whatever -I options have been specified on the command line, @@ -386,7 +382,7 @@ let loop ppf = while true do let snap = Btype.snapshot () in try - empty_lexbuf lb; + Lexing.flush_input lb; Location.reset(); first_line := true; let phr = try !parse_toplevel_phrase lb with Exit -> raise PPerror in diff --git a/toplevel/topmain.ml b/toplevel/topmain.ml index 5a3929c8..ffad5337 100644 --- a/toplevel/topmain.ml +++ b/toplevel/topmain.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: topmain.ml,v 1.33 2003/06/30 15:31:06 xleroy Exp $ *) +(* $Id: topmain.ml,v 1.34 2003/07/25 12:18:25 xleroy Exp $ *) open Clflags @@ -66,6 +66,7 @@ let main () = \032 D/d enable/disable deprecated features\n\ \032 E/e enable/disable fragile match\n\ \032 F/f enable/disable partially applied function\n\ + \032 L/l enable/disable labels omitted in application\n\ \032 M/m enable/disable overriden method\n\ \032 P/p enable/disable partial match\n\ \032 S/s enable/disable non-unit statement\n\ diff --git a/typing/btype.ml b/typing/btype.ml index 3fc655a7..4dc4b4e1 100644 --- a/typing/btype.ml +++ b/typing/btype.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: btype.ml,v 1.32 2003/07/02 09:14:32 xleroy Exp $ *) +(* $Id: btype.ml,v 1.33 2003/08/09 11:47:57 garrigue Exp $ *) (* Basic operations on core types *) @@ -328,6 +328,20 @@ let rec forget_abbrev_rec mem path = let forget_abbrev mem path = try mem := forget_abbrev_rec !mem path with Exit -> () +let rec check_abbrev_rec path = function + Mnil -> true + | Mcons (path', _, ty, rem) -> + if Path.same path path' && + match repr ty with + {desc = Tconstr(path',_,_)} -> Path.same path path' + | _ -> false + then false + else check_abbrev_rec path rem + | Mlink mem' -> + check_abbrev_rec path !mem' + +let check_memorized_abbrevs path = + List.for_all (fun mem -> check_abbrev_rec path !mem) !memo (**********************************) (* Utilities for labels *) @@ -392,6 +406,10 @@ let log_change ch = let log_type ty = if ty.id <= !last_snapshot then log_change (Ctype (ty, ty.desc)) let link_type ty ty' = log_type ty; ty.desc <- Tlink ty' +(*match repr ty' with + {desc=Tconstr(path,_,_)} -> assert (check_memorized_abbrevs path) + | _ -> () +*) let set_level ty level = if ty.id <= !last_snapshot then log_change (Clevel (ty, ty.level)); ty.level <- level diff --git a/typing/ctype.ml b/typing/ctype.ml index cc80c74a..80a647f2 100644 --- a/typing/ctype.ml +++ b/typing/ctype.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: ctype.ml,v 1.167 2003/07/08 10:00:43 garrigue Exp $ *) +(* $Id: ctype.ml,v 1.170 2003/09/25 08:05:38 xleroy Exp $ *) (* Operations on core types *) @@ -1204,8 +1204,8 @@ let rec occur_rec env visited ty0 ty = if List.memq ty visited then raise Occur; if not !Clflags.recursive_types then iter_type_expr (occur_rec env (ty::visited) ty0) ty - with Occur when generic_abbrev env p -> - let ty' = repr (expand_abbrev env ty) in + with Occur -> try + let ty' = try_expand_head env ty in (* Maybe we could simply make a recursive call here, but it seems it could make the occur check loop (see change in rev. 1.58) *) @@ -1215,6 +1215,7 @@ let rec occur_rec env visited ty0 ty = | _ -> if not !Clflags.recursive_types then iter_type_expr (occur_rec env (ty'::visited) ty0) ty' + with Cannot_expand -> raise Occur end | Tobject _ | Tvariant _ -> () @@ -2071,19 +2072,22 @@ let rec rigidify_rec vars ty = let ty = repr ty in if ty.level >= lowest_level then begin ty.level <- pivot_level - ty.level; - begin match ty.desc with + match ty.desc with | Tvar -> if not (List.memq ty !vars) then vars := ty :: !vars | Tvariant row -> let row = row_repr row in let more = repr row.row_more in - if more.desc = Tvar && not row.row_fixed then + if more.desc = Tvar && not row.row_fixed then begin let more' = newty2 more.level Tvar in let row' = {row with row_fixed=true; row_fields=[]; row_more=more'} in link_type more (newty2 ty.level (Tvariant row')) - | _ -> () - end; - iter_type_expr (rigidify_rec vars) ty + end; + iter_row (rigidify_rec vars) row; + (* only consider the row variable if the variant is not static *) + if not (static_row row) then rigidify_rec vars (row_more row) + | _ -> + iter_type_expr (rigidify_rec vars) ty end let rigidify ty = @@ -2104,6 +2108,7 @@ let all_distinct_vars env vars = let matches env ty ty' = let snap = snapshot () in let vars = rigidify ty in + cleanup_abbrev (); let ok = try unify env ty ty'; all_distinct_vars env vars with Unify _ -> false @@ -2947,15 +2952,15 @@ let cyclic_abbrev env id ty = let ty = repr ty in match ty.desc with Tconstr (p, tl, abbrev) -> - if List.exists (Path.same p) seen then true else begin - try - check_cycle (p :: seen) (expand_abbrev env ty) - with Cannot_expand -> - false + p = Path.Pident id || List.memq ty seen || + begin try + check_cycle (ty :: seen) (expand_abbrev env ty) + with Cannot_expand -> + false end | _ -> false - in check_cycle [Path.Pident id] ty + in check_cycle [] ty (* Normalize a type before printing, saving... *) let rec normalize_type_rec env ty = diff --git a/typing/includemod.ml b/typing/includemod.ml index da5f30d6..025ba527 100644 --- a/typing/includemod.ml +++ b/typing/includemod.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: includemod.ml,v 1.31 2003/07/18 12:44:18 xleroy Exp $ *) +(* $Id: includemod.ml,v 1.32 2003/07/27 17:02:33 xleroy Exp $ *) (* Inclusion checks for the module language *) @@ -147,13 +147,11 @@ and try_modtypes env subst mty1 mty2 = | (Tmty_signature sig1, Tmty_signature sig2) -> signatures env subst sig1 sig2 | (Tmty_functor(param1, arg1, res1), Tmty_functor(param2, arg2, res2)) -> - let cc_arg = - modtypes env Subst.identity (Subst.modtype subst arg2) arg1 - in + let arg2' = Subst.modtype subst arg2 in + let cc_arg = modtypes env Subst.identity arg2' arg1 in let cc_res = - modtypes (Env.add_module param1 arg2 env) - (Subst.add_module param2 (Pident param1) subst) res1 res2 - in + modtypes (Env.add_module param1 arg2' env) + (Subst.add_module param2 (Pident param1) subst) res1 res2 in begin match (cc_arg, cc_res) with (Tcoerce_none, Tcoerce_none) -> Tcoerce_none | _ -> Tcoerce_functor(cc_arg, cc_res) diff --git a/typing/oprint.ml b/typing/oprint.ml index 8fcaef3a..2d905d45 100644 --- a/typing/oprint.ml +++ b/typing/oprint.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: oprint.ml,v 1.17 2003/07/02 09:14:33 xleroy Exp $ *) +(* $Id: oprint.ml,v 1.18 2003/07/29 09:11:13 xleroy Exp $ *) open Format open Outcometree @@ -40,11 +40,31 @@ let value_ident ppf name = (* Values *) -let parenthesize_if_neg ppf fmt v zero = - let neg = (v < zero) in - if neg then pp_print_char ppf '('; +let valid_float_lexeme s = + let l = String.length s in + let rec loop i = + if i >= l then s ^ "." else + match s.[i] with + | '0' .. '9' | '-' -> loop (i+1) + | _ -> s + in loop 0 + +let float_repres f = + match classify_float f with + FP_nan -> "nan" + | FP_infinite -> + if f < 0.0 then "neg_infinity" else "infinity" + | _ -> + let s1 = Printf.sprintf "%.12g" f in + if f = float_of_string s1 then valid_float_lexeme s1 else + let s2 = Printf.sprintf "%.15g" f in + if f = float_of_string s2 then valid_float_lexeme s2 else + Printf.sprintf "%.18g" f + +let parenthesize_if_neg ppf fmt v isneg = + if isneg then pp_print_char ppf '('; fprintf ppf fmt v; - if neg then pp_print_char ppf ')' + if isneg then pp_print_char ppf ')' let print_out_value ppf tree = let rec print_tree_1 ppf = @@ -58,11 +78,11 @@ let print_out_value ppf tree = fprintf ppf "@[<2>`%s@ %a@]" name print_simple_tree param | tree -> print_simple_tree ppf tree and print_constr_param ppf = function - | Oval_int i -> parenthesize_if_neg ppf "%i" i 0 - | Oval_int32 i -> parenthesize_if_neg ppf "%lil" i 0l - | Oval_int64 i -> parenthesize_if_neg ppf "%LiL" i 0L - | Oval_nativeint i -> parenthesize_if_neg ppf "%nin" i 0n - | Oval_float f -> parenthesize_if_neg ppf "%F" f 0.0 + | Oval_int i -> parenthesize_if_neg ppf "%i" i (i < 0) + | Oval_int32 i -> parenthesize_if_neg ppf "%lil" i (i < 0l) + | Oval_int64 i -> parenthesize_if_neg ppf "%LiL" i (i < 0L) + | Oval_nativeint i -> parenthesize_if_neg ppf "%nin" i (i < 0n) + | Oval_float f -> parenthesize_if_neg ppf "%s" (float_repres f) (f < 0.0) | tree -> print_simple_tree ppf tree and print_simple_tree ppf = function @@ -70,7 +90,7 @@ let print_out_value ppf tree = | Oval_int32 i -> fprintf ppf "%lil" i | Oval_int64 i -> fprintf ppf "%LiL" i | Oval_nativeint i -> fprintf ppf "%nin" i - | Oval_float f -> fprintf ppf "%F" f + | Oval_float f -> fprintf ppf "%s" (float_repres f) | Oval_char c -> fprintf ppf "%C" c | Oval_string s -> begin try fprintf ppf "%S" s with diff --git a/typing/parmatch.ml b/typing/parmatch.ml index 452b96ab..ce690d38 100644 --- a/typing/parmatch.ml +++ b/typing/parmatch.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: parmatch.ml,v 1.55 2003/07/02 09:14:33 xleroy Exp $ *) +(* $Id: parmatch.ml,v 1.61 2003/08/18 08:26:18 garrigue Exp $ *) (* Detection of partial matches and unused match cases. *) @@ -34,6 +34,8 @@ let rec omegas i = let omega_list l = List.map (fun _ -> omega) l +let zero = make_pat (Tpat_constant (Const_int 0)) Ctype.none Env.empty + (***********************) (* Compatibility check *) (***********************) @@ -531,13 +533,51 @@ let filter_all pat0 pss = pss) pss +(* Variant related functions *) + +let rec set_last a = function + [] -> [] + | [_] -> [a] + | x::l -> x :: set_last a l + +(* mark constructor lines for failure when they are incomplete *) +let rec mark_partial = function + ({pat_desc = Tpat_alias(p,_)}::ps)::pss -> + mark_partial ((p::ps)::pss) + | ({pat_desc = Tpat_or(p1,p2,_)}::ps)::pss -> + mark_partial ((p1::ps)::(p2::ps)::pss) + | ({pat_desc = (Tpat_any | Tpat_var(_))} :: _ as ps) :: pss -> + ps :: mark_partial pss + | ps::pss -> + (set_last zero ps) :: mark_partial pss + | [] -> [] + +let close_variant env row = + let row = Btype.row_repr row in + let nm = + List.fold_left + (fun nm (tag,f) -> + match Btype.row_field_repr f with + | Reither(_, _, false, e) -> + (* m=false means that this tag is not explicitly matched *) + Btype.set_row_field e Rabsent; + None + | Rabsent | Reither (_, _, true, _) | Rpresent _ -> nm) + row.row_name row.row_fields in + if not row.row_closed || nm != row.row_name then begin + (* this unification cannot fail *) + Ctype.unify env row.row_more + (Btype.newgenty + (Tvariant {row with row_fields = []; row_more = Btype.newgenvar(); + row_closed = true; row_name = nm})) + end (* Check whether the first column of env makes up a complete signature or not. *) -let full_match tdefs force env = match env with +let full_match closing env = match env with | ({pat_desc = Tpat_construct ({cstr_tag=Cstr_exception _},_)},_)::_ -> false | ({pat_desc = Tpat_construct(c,_)},_) :: _ -> @@ -550,30 +590,17 @@ let full_match tdefs force env = match env with env in let row = Btype.row_repr row in - if force && not row.row_fixed then begin - (* force=true, we are called from check_partial, and must close *) - let (ok, nm) = - List.fold_left - (fun (ok,nm) (tag,f) -> - match Btype.row_field_repr f with - Rabsent -> (ok, nm) - | Reither(_, _, false, e) -> - (* m=false means that this tag is not explicitly matched *) - Btype.set_row_field e Rabsent; - (ok, None) - | Reither (_, _, true, _) - (* m=true, do not discard matched tags, rather warn *) - | Rpresent _ -> - (ok && List.mem tag fields, nm)) - (true, row.row_name) row.row_fields in - if not row.row_closed || nm != row.row_name then - (* this unification cannot fail *) - Ctype.unify tdefs row.row_more - (Btype.newgenty - (Tvariant {row with row_fields = []; row_more = Btype.newgenvar(); - row_closed = true; row_name = nm})); - ok - end else + if closing && not row.row_fixed then + (* closing=true, we are considering the variant as closed *) + List.for_all + (fun (tag,f) -> + match Btype.row_field_repr f with + Rabsent | Reither(_, _, false, _) -> true + | Reither (_, _, true, _) + (* m=true, do not discard matched tags, rather warn *) + | Rpresent _ -> List.mem tag fields) + row.row_fields + else row.row_closed && List.for_all (fun (tag,f) -> @@ -705,7 +732,9 @@ let build_other env = match env with | Reither (c, _, _, _) -> make_other_pat tag c :: others | Rpresent arg -> make_other_pat tag (arg = None) :: others) [] row.row_fields - with [] -> assert false + with + [] -> + make_other_pat "AnyExtraTag" true | pat::other_pats -> List.fold_left (fun p_res pat -> @@ -831,7 +860,7 @@ let rec satisfiable pss qs = match pss with (* first column of pss is made of variables only *) | [] -> satisfiable (filter_extra pss) qs | constrs -> - (not (full_match Env.empty false constrs) && + (not (full_match false constrs) && satisfiable (filter_extra pss) qs) || List.exists (fun (p,pss) -> satisfiable pss (simple_match_args p omega @ qs)) @@ -903,62 +932,108 @@ and try_many_extra some qs = function supplies an example of a matching value. This function should be called for exhaustiveness check only. - It impacts variant typing *) type 'a result = | Rnone (* No matching value *) | Rsome of 'a (* This matching value *) -(* boolean argument ``variants'' is unused at present *) -let rec try_many variants f = function +let rec try_many f = function | [] -> Rnone | x::rest -> begin match f x with - | Rnone -> try_many variants f rest - | r -> - if variants then ignore (try_many variants f rest); - r + | Rnone -> try_many f rest + | r -> r end -let rec exhaust variants tdefs pss n = match pss with +let rec exhaust pss n = match pss with | [] -> Rsome (omegas n) | []::_ -> Rnone | pss -> - let q0 = discr_pat omega pss in + let q0 = discr_pat omega pss in begin match filter_all q0 pss with (* first column of pss is made of variables only *) - [] -> - begin match exhaust variants tdefs (filter_extra pss) (n-1) with + | [] -> + begin match exhaust (filter_extra pss) (n-1) with | Rsome r -> Rsome (q0::r) | r -> r end | constrs -> let try_non_omega (p,pss) = match - exhaust variants tdefs pss - (List.length (simple_match_args p omega) + n - 1) + exhaust pss (List.length (simple_match_args p omega) + n - 1) with | Rsome r -> Rsome (set_args p r) | r -> r in - if full_match tdefs true constrs - then try_many variants try_non_omega constrs + if full_match false constrs + then try_many try_non_omega constrs else - match exhaust variants tdefs (filter_extra pss) (n-1) with - | Rnone -> try_many variants try_non_omega constrs + (* + D = filter_extra pss is the default matrix + as it is included in pss, one can avoid + recursive calls on specialized matrices, + Essentially : + * D exhaustive => pss exhaustive + * D non-exhaustive => we have a non-filtered value + *) + let r = exhaust (filter_extra pss) (n-1) in + match r with + | Rnone -> Rnone | Rsome r -> - (* try all constructors anyway, for variant typing ! *) - (* Note: it may impact dramatically on cost *) - if variants then - ignore (try_many variants try_non_omega constrs) ; try Rsome (build_other constrs::r) with (* cannot occur, since constructors don't make a full signature *) | Empty -> fatal_error "Parmatch.exhaust" - end +(* + Another exhaustiveness check, enforcing variant typing. + Note that it does not check exact exhaustiveness, but whether a + matching could be made exhaustive by closing all variant types. + When this is true of all other columns, the current column is left + open (even if it means that the whole matching is not exhaustive as + a result). + When this is false for the matrix minus the current column, and the + current column is composed of variant tags, we close the variant + (even if it doesn't help in making the matching exhaustive). +*) + +let rec pressure_variants tdefs = function + | [] -> false + | []::_ -> true + | pss -> + let q0 = discr_pat omega pss in + begin match filter_all q0 pss with + [] -> pressure_variants tdefs (filter_extra pss) + | constrs -> + let rec try_non_omega = function + (p,pss) :: rem -> + let ok = pressure_variants tdefs pss in + try_non_omega rem && ok + | [] -> true + in + if full_match (tdefs=None) constrs then + try_non_omega constrs + else if tdefs = None then + pressure_variants None (filter_extra pss) + else + let full = full_match true constrs in + let ok = + if full then try_non_omega constrs + else try_non_omega (filter_all q0 (mark_partial pss)) + in + begin match constrs, tdefs with + ({pat_desc=Tpat_variant(_,_,row)},_):: _, Some env -> + let row = Btype.row_repr row in + if row.row_fixed + || pressure_variants None (filter_extra pss) then () + else close_variant env row + | _ -> () + end; + ok + end + (* Yet another satisfiable fonction *) @@ -1338,24 +1413,17 @@ and lubs ps qs = match ps,qs with (******************************) (* Entry points *) +(* - Variant closing *) (* - Partial match *) (* - Unused match case *) (******************************) +(* Apply pressure to variants *) + +let pressure_variants tdefs patl = + let pss = List.map (fun p -> [p;omega]) patl in + ignore (pressure_variants (Some tdefs) pss) -(* - A small cvs commit/commit discussion.... - JG: - Exhaustiveness of matching MUST be checked, even - when the warning is excluded explicitely by user. - LM: - Why such a strange thing ? - JG: - Because the typing of variants depends on it. - LM: - Ok, note that by contrast, unused clause check still can be avoided at - user request. - *) (* Build up a working pattern matrix. - Forget about guarded patterns @@ -1438,23 +1506,8 @@ let check_partial_all v casel = with | NoGuard -> None -(* look for variants *) -let rec look_variant p = match p.pat_desc with - | Tpat_variant (_,_,_) -> true - | Tpat_any | Tpat_var _ | Tpat_constant _ -> false - | Tpat_alias (p,_) -> look_variant p - | Tpat_or (p1,p2,_) -> look_variant p1 || look_variant p2 - | Tpat_construct (_,ps) | Tpat_tuple ps | Tpat_array ps -> look_variants ps - | Tpat_record lps -> look_variants (List.map snd lps) - -and look_variants = function - | [] -> false - | q::rem -> look_variant q || look_variants rem - - -let check_partial tdefs loc casel = - let variant_inside = List.exists (fun (p,_) -> look_variant p) casel in - let pss = initial_matrix casel in +let check_partial loc casel = + let pss = initial_matrix casel in let pss = get_mins le_pats pss in match pss with | [] -> @@ -1475,7 +1528,7 @@ let check_partial tdefs loc casel = end ; Partial | ps::_ -> - begin match exhaust variant_inside tdefs pss (List.length ps) with + begin match exhaust pss (List.length ps) with | Rnone -> Total | Rsome [v] -> let errmsg = diff --git a/typing/parmatch.mli b/typing/parmatch.mli index 94ce976f..a7c4636e 100644 --- a/typing/parmatch.mli +++ b/typing/parmatch.mli @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: parmatch.mli,v 1.8 2002/05/24 14:34:37 maranget Exp $ *) +(* $Id: parmatch.mli,v 1.9 2003/08/18 08:26:18 garrigue Exp $ *) (* Detection of partial matches and unused match cases. *) open Types @@ -44,8 +44,8 @@ val pat_of_constr : pattern -> constructor_description -> pattern val complete_constrs : pattern -> constructor_tag list -> constructor_description list -val check_partial: - Env.t -> Location.t -> (pattern * expression) list -> partial +val pressure_variants: Env.t -> pattern list -> unit +val check_partial: Location.t -> (pattern * expression) list -> partial val check_unused: Env.t -> (pattern * expression) list -> unit diff --git a/typing/stypes.ml b/typing/stypes.ml index 7aa365eb..4c510eb7 100644 --- a/typing/stypes.ml +++ b/typing/stypes.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: stypes.ml,v 1.5 2003/06/12 12:52:17 doligez Exp $ *) +(* $Id: stypes.ml,v 1.8 2003/07/25 18:00:40 doligez Exp $ *) (* Recording and dumping (partial) type information *) @@ -21,11 +21,6 @@ interesting in case of errors. *) -(* - TO DO: - - (?) reset type names between toplevel phrases -*) - open Format;; open Lexing;; open Location;; @@ -47,48 +42,89 @@ let get_location ti = ;; let type_info = ref ([] : type_info list);; +let phrases = ref ([] : Location.t list);; let record ti = if !Clflags.save_types && not (get_location ti).Location.loc_ghost then type_info := ti :: !type_info ;; -(* A comparison function compatible with inclusion order *) -let compare_loc ti1 ti2 = - let loc1 = get_location ti1 and loc2 = get_location ti2 in - match compare loc1.loc_end loc2.loc_end with - | 0 -> compare loc2.loc_start loc1.loc_start +let record_phrase loc = + if !Clflags.save_types then phrases := loc :: !phrases; +;; + +(* comparison order: + the intervals are sorted by order of increasing upper bound + same upper bound -> sorted by decreasing lower bound +*) +let cmp_loc_inner_first loc1 loc2 = + match compare loc1.loc_end.pos_cnum loc2.loc_end.pos_cnum with + | 0 -> compare loc2.loc_start.pos_cnum loc1.loc_start.pos_cnum | x -> x ;; +let cmp_ti_inner_first ti1 ti2 = + cmp_loc_inner_first (get_location ti1) (get_location ti2) +;; let print_position pp pos = fprintf pp "%S %d %d %d" pos.pos_fname pos.pos_lnum pos.pos_bol pos.pos_cnum; ;; +let sort_filter_phrases () = + let ph = List.sort (fun x y -> cmp_loc_inner_first y x) !phrases in + let rec loop accu cur l = + match l with + | [] -> accu + | loc :: t -> + if cur.loc_start.pos_cnum <= loc.loc_start.pos_cnum + && cur.loc_end.pos_cnum >= loc.loc_end.pos_cnum + then loop accu cur t + else loop (loc :: accu) loc t + in + phrases := loop [] Location.none ph; +;; + +let rec printtyp_reset_maybe loc = + match !phrases with + | cur :: t when cur.loc_start.pos_cnum <= loc.loc_start.pos_cnum -> + Printtyp.reset (); + phrases := t; + printtyp_reset_maybe loc; + | _ -> () +;; + + (* The format of the annotation file is documented in emacs/caml-types.el. *) let print_info pp ti = match ti with - Ti_class _ | Ti_mod _ -> () + | Ti_class _ | Ti_mod _ -> () | Ti_pat {pat_loc = loc; pat_type = typ} | Ti_expr {exp_loc = loc; exp_type = typ} -> print_position pp loc.loc_start; fprintf pp " "; print_position pp loc.loc_end; fprintf pp "@.type(@. "; + printtyp_reset_maybe loc; + Printtyp.mark_loops typ; Printtyp.type_expr pp typ; fprintf pp "@.)@."; ;; let get_info () = - let info = List.sort compare_loc !type_info in + let info = List.fast_sort cmp_ti_inner_first !type_info in type_info := []; info +;; let dump filename = - let info = get_info () in if !Clflags.save_types then begin + let info = get_info () in let pp = formatter_of_out_channel (open_out filename) in - List.iter (print_info pp) info + sort_filter_phrases (); + List.iter (print_info pp) info; + phrases := []; + end else begin + type_info := []; end; ;; diff --git a/typing/stypes.mli b/typing/stypes.mli index 7b4956ab..92ca2598 100644 --- a/typing/stypes.mli +++ b/typing/stypes.mli @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: stypes.mli,v 1.2 2003/04/02 06:57:14 garrigue Exp $ *) +(* $Id: stypes.mli,v 1.3 2003/07/23 16:52:41 doligez Exp $ *) (* Recording and dumping (partial) type information *) @@ -26,6 +26,7 @@ type type_info = ;; val record : type_info -> unit;; +val record_phrase : Location.t -> unit;; val dump : string -> unit;; val get_location : type_info -> Location.t;; diff --git a/typing/subst.ml b/typing/subst.ml index c19051ed..8f497d6b 100644 --- a/typing/subst.ml +++ b/typing/subst.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: subst.ml,v 1.43 2003/07/02 09:14:34 xleroy Exp $ *) +(* $Id: subst.ml,v 1.44 2003/07/22 10:58:39 garrigue Exp $ *) (* Substitutions *) @@ -105,20 +105,21 @@ let rec typexp s ty = ty.desc <- Tsubst ty2; (* avoid Tlink in the new type *) Tlink ty2 | _ -> - let static = static_row row in + let dup = + s.for_saving || more.level = generic_level || static_row row in (* Various cases for the row variable *) let more' = match more.desc with Tsubst ty -> ty | _ -> save_desc more more.desc; if s.for_saving then newpersty more.desc else - if static then newgenvar () else more + if dup && more.desc <> Tunivar then newgenvar () else more in (* Register new type first for recursion *) more.desc <- Tsubst(newgenty(Ttuple[more';ty'])); (* Return a new copy *) let row = - copy_row (typexp s) true row (not s.for_saving) more' in + copy_row (typexp s) true row (not dup) more' in let row = if s.for_saving then {row with row_bound = []} else row in match row.row_name with diff --git a/typing/typeclass.ml b/typing/typeclass.ml index 7480b4dc..c2a318bd 100644 --- a/typing/typeclass.ml +++ b/typing/typeclass.ml @@ -205,7 +205,7 @@ let enter_val cl_num vars lab mut ty val_env met_env par_env = vars := Vars.add lab (id, mut, ty) !vars; result -let inheritance impl self_type env concr_meths loc parent = +let inheritance self_type env concr_meths warn_meths loc parent = match scrape_class_type parent with Tcty_signature cl_sig -> @@ -220,16 +220,16 @@ let inheritance impl self_type env concr_meths loc parent = assert false end; - if impl then begin - let overridings = Concr.inter cl_sig.cty_concr concr_meths in - if not (Concr.is_empty overridings) then begin - Location.prerr_warning loc - (Warnings.Method_override (Concr.elements overridings)) - end + let overridings = Concr.inter cl_sig.cty_concr warn_meths in + if not (Concr.is_empty overridings) then begin + Location.prerr_warning loc + (Warnings.Method_override (Concr.elements overridings)) end; + let concr_meths = Concr.union cl_sig.cty_concr concr_meths in + let warn_meths = Concr.union cl_sig.cty_concr warn_meths in - (cl_sig, concr_meths) + (cl_sig, concr_meths, warn_meths) | _ -> raise(Error(loc, Structure_expected parent)) @@ -276,8 +276,9 @@ let rec class_type_field env self_type meths (val_sig, concr_meths) = function Pctf_inher sparent -> let parent = class_type env sparent in - let (cl_sig, concr_meths) = - inheritance false self_type env concr_meths sparent.pcty_loc parent + let (cl_sig, concr_meths, _) = + inheritance self_type env concr_meths Concr.empty sparent.pcty_loc + parent in let val_sig = Vars.fold @@ -375,12 +376,12 @@ and class_type env scty = module StringSet = Set.Make(struct type t = string let compare = compare end) let rec class_field cl_num self_type meths vars - (val_env, met_env, par_env, fields, concr_meths, inh_vals) = + (val_env, met_env, par_env, fields, concr_meths, warn_meths, inh_vals) = function Pcf_inher (sparent, super) -> let parent = class_expr cl_num val_env par_env sparent in - let (cl_sig, concr_meths) = - inheritance true self_type val_env concr_meths sparent.pcl_loc + let (cl_sig, concr_meths, warn_meths) = + inheritance self_type val_env concr_meths warn_meths sparent.pcl_loc parent.cl_type in (* Variables *) @@ -416,7 +417,7 @@ let rec class_field cl_num self_type meths vars in (val_env, met_env, par_env, lazy(Cf_inher (parent, inh_vars, inh_meths))::fields, - concr_meths, inh_vals) + concr_meths, warn_meths, inh_vals) | Pcf_val (lab, mut, sexp, loc) -> if StringSet.mem lab inh_vals then @@ -434,11 +435,12 @@ let rec class_field cl_num self_type meths vars enter_val cl_num vars lab mut exp.exp_type val_env met_env par_env in (val_env, met_env, par_env, lazy(Cf_val (lab, id, exp)) :: fields, - concr_meths, inh_vals) + concr_meths, warn_meths, inh_vals) | Pcf_virt (lab, priv, sty, loc) -> virtual_method val_env meths self_type lab priv sty loc; - (val_env, met_env, par_env, fields, concr_meths, inh_vals) + let warn_meths = Concr.remove lab warn_meths in + (val_env, met_env, par_env, fields, concr_meths, warn_meths, inh_vals) | Pcf_meth (lab, priv, expr, loc) -> let (_, ty) = @@ -480,11 +482,11 @@ let rec class_field cl_num self_type meths vars Cf_meth (lab, texp) end in (val_env, met_env, par_env, field::fields, - Concr.add lab concr_meths, inh_vals) + Concr.add lab concr_meths, Concr.add lab warn_meths, inh_vals) | Pcf_cstr (sty, sty', loc) -> type_constraint val_env sty sty' loc; - (val_env, met_env, par_env, fields, concr_meths, inh_vals) + (val_env, met_env, par_env, fields, concr_meths, warn_meths, inh_vals) | Pcf_let (rec_flag, sdefs, loc) -> let (defs, val_env) = @@ -514,7 +516,7 @@ let rec class_field cl_num self_type meths vars ([], met_env, par_env) in (val_env, met_env, par_env, lazy(Cf_let(rec_flag, defs, vals))::fields, - concr_meths, inh_vals) + concr_meths, warn_meths, inh_vals) | Pcf_init expr -> let expr = make_method cl_num expr in @@ -530,7 +532,8 @@ let rec class_field cl_num self_type meths vars Ctype.end_def (); Cf_init texp end in - (val_env, met_env, par_env, field::fields, concr_meths, inh_vals) + (val_env, met_env, par_env, field::fields, + concr_meths, warn_meths, inh_vals) and class_structure cl_num val_env met_env (spat, str) = (* Environment for substructures *) @@ -554,9 +557,10 @@ and class_structure cl_num val_env met_env (spat, str) = end; (* Class fields *) - let (_, _, _, fields, concr_meths, _) = + let (_, _, _, fields, concr_meths, _, _) = List.fold_left (class_field cl_num self_type meths vars) - (val_env, meth_env, par_env, [], Concr.empty, StringSet.empty) + (val_env, meth_env, par_env, [], Concr.empty, Concr.empty, + StringSet.empty) str in Ctype.unify val_env self_type (Ctype.newvar ()); @@ -664,7 +668,7 @@ and class_expr cl_num val_env met_env scl = | _ -> true in let partial = - Parmatch.check_partial val_env pat.pat_loc + Parmatch.check_partial pat.pat_loc [pat, (* Dummy expression *) {exp_desc = Texp_constant (Asttypes.Const_int 1); exp_loc = Location.none; @@ -1342,20 +1346,19 @@ let report_error ppf = function | Unbound_val lab -> fprintf ppf "Unbound instance variable %s" lab | Unbound_type_var (printer, reason) -> - let print_labty real ppf ty = - if real then Printtyp.type_expr ppf ty else fprintf ppf ".." in + let print_common ppf kind ty0 real lab ty = + let ty1 = + if real then ty0 else Btype.newgenty(Tobject(ty0, ref None)) in + Printtyp.reset_and_mark_loops_list [ty; ty1]; + fprintf ppf + "The %s %s@ has type@;<1 2>%a@ where@ %a@ is unbound" + kind lab Printtyp.type_expr ty Printtyp.type_expr ty0 + in let print_reason ppf = function | Ctype.CC_Method (ty0, real, lab, ty) -> - Printtyp.reset_and_mark_loops_list [ty; ty0]; - fprintf ppf - "The method %s@ has type@;<1 2>%a@ where@ %a@ is unbound" - lab Printtyp.type_expr ty (print_labty real) ty0 + print_common ppf "method" ty0 real lab ty | Ctype.CC_Value (ty0, real, lab, ty) -> - Printtyp.reset_and_mark_loops_list [ty; ty0]; - fprintf ppf - "The instance variable %s@ has type@;<1 2>%a@ \ - where@ %a@ is unbound" - lab Printtyp.type_expr ty (print_labty real) ty0 + print_common ppf "instance variable" ty0 real lab ty in Printtyp.reset (); fprintf ppf diff --git a/typing/typecore.ml b/typing/typecore.ml index 8b4edb66..8608c3dc 100644 --- a/typing/typecore.ml +++ b/typing/typecore.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: typecore.ml,v 1.151 2003/07/05 11:13:24 xleroy Exp $ *) +(* $Id: typecore.ml,v 1.154 2003/08/25 00:41:24 garrigue Exp $ *) (* Typechecking for the core language *) @@ -142,6 +142,48 @@ let unify_pat env pat expected_ty = | Tags(l1,l2) -> raise(Typetexp.Error(pat.pat_loc, Typetexp.Variant_tags (l1, l2))) +(* make all Reither present in open variants *) +let finalize_variant pat = + match pat.pat_desc with + Tpat_variant(tag, opat, row) -> + let row = row_repr row in + let field = + try row_field_repr (List.assoc tag row.row_fields) + with Not_found -> Rabsent + in + begin match field with + | Rabsent -> assert false + | Reither (true, [], _, e) when not row.row_closed -> + set_row_field e (Rpresent None) + | Reither (false, ty::tl, _, e) when not row.row_closed -> + set_row_field e (Rpresent (Some ty)); + begin match opat with None -> assert false + | Some pat -> List.iter (unify_pat pat.pat_env pat) (ty::tl) + end + | Reither (c, l, true, e) when not row.row_fixed -> + set_row_field e (Reither (c, [], false, ref None)) + | _ -> () + end; + (* Force check of well-formedness *) + unify_pat pat.pat_env pat + (newty(Tvariant{row_fields=[]; row_more=newvar(); row_closed=false; + row_bound=[]; row_fixed=false; row_name=None})); + | _ -> () + +let rec iter_pattern f p = + f p; + iter_pattern_desc (iter_pattern f) p.pat_desc + +let has_variants p = + try + iter_pattern (function {pat_desc=Tpat_variant _} -> raise Exit | _ -> ()) + p; + false + with Exit -> + true + + +(* pattern environment *) let pattern_variables = ref ([]: (Ident.t * type_expr) list) let pattern_force = ref ([] : (unit -> unit) list) let reset_pattern () = @@ -460,6 +502,10 @@ let type_pattern_list env spatl = let type_class_arg_pattern cl_num val_env met_env l spat = reset_pattern (); let pat = type_pat val_env spat in + if has_variants pat then begin + Parmatch.pressure_variants val_env [pat]; + iter_pattern finalize_variant pat + end; List.iter (fun f -> f()) (get_ref pattern_force); if is_optional l then unify_pat val_env pat (type_option (newvar ())); let (pv, met_env) = @@ -507,60 +553,6 @@ let force_delayed_checks () = List.iter (fun f -> f ()) (List.rev !delayed_checks); reset_delayed_checks () -let finalize_variant pat = - match pat.pat_desc with - Tpat_variant(tag, opat, row) -> - let row = row_repr row in - let field = - try row_field_repr (List.assoc tag row.row_fields) - with Not_found -> Rabsent - in - begin match field with - | Rabsent -> assert false - | Reither (true, [], _, e) when not row.row_closed -> - set_row_field e (Rpresent None) - | Reither (false, ty::tl, _, e) when not row.row_closed -> - set_row_field e (Rpresent (Some ty)); - begin match opat with None -> assert false - | Some pat -> List.iter (unify_pat pat.pat_env pat) (ty::tl) - end - | Reither (c, l, true, e) when not row.row_fixed -> - set_row_field e (Reither (c, [], false, ref None)) - | _ -> () - end; - (* Force check of well-formedness *) - unify_pat pat.pat_env pat - (newty(Tvariant{row_fields=[]; row_more=newvar(); row_closed=false; - row_bound=[]; row_fixed=false; row_name=None})); -(* - (* Eventually post a delayed warning check *) - if (match row_field_repr field with Reither _ -> true | _ -> false) then - add_delayed_check - (fun () -> if row_field_repr field = Rabsent then - Location.prerr_warning pat.pat_loc Warnings.Unused_match) -*) - | _ -> () - -let rec iter_pattern f p = - f p; - match p.pat_desc with - Tpat_any | Tpat_var _ | Tpat_constant _ -> - () - | Tpat_alias (p, _) -> - iter_pattern f p - | Tpat_tuple pl -> - List.iter (iter_pattern f) pl - | Tpat_construct (_, pl) -> - List.iter (iter_pattern f) pl - | Tpat_variant (_, p, _) -> - may (iter_pattern f) p - | Tpat_record fl -> - List.iter (fun (_, p) -> iter_pattern f p) fl - | Tpat_or (p, p', _) -> - iter_pattern f p; - iter_pattern f p' - | Tpat_array pl -> - List.iter (iter_pattern f) pl (* Generalization criterion for expressions *) @@ -751,6 +743,9 @@ let list_labels env ty = list_labels_aux env [] [] ty (* Check that all univars are safe in a type *) let check_univars env kind exp ty_expected vars = + (* need to expand twice? cf. Ctype.unify2 *) + let vars = List.map (expand_head env) vars in + let vars = List.map (expand_head env) vars in let vars' = List.filter (fun t -> @@ -1756,22 +1751,12 @@ and type_cases ?in_function env ty_arg ty_res partial_loc caselist = unify_pat env pat ty_arg'; (pat, ext_env)) caselist in - (* Build dummy cases, since we cannot type yet *) - let dummy_cases = List.map2 - (fun (pat, _) (_, act) -> - let dummy = { exp_desc = Texp_tuple []; exp_type = newty (Ttuple[]); - exp_env = env; exp_loc = act.pexp_loc } in - match act.pexp_desc with - Pexp_when _ -> - pat, {dummy with exp_desc = Texp_when(dummy, dummy)} - | _ -> pat, dummy) - pat_env_list caselist in - (* Check partial matches here (required for polymorphic variants) *) - let partial = - match partial_loc with None -> Partial - | Some loc -> Parmatch.check_partial env loc dummy_cases in - (* Revert to normal typing of variants (also register checks) *) - List.iter (fun (pat, _) -> iter_pattern finalize_variant pat) dummy_cases; + (* Check for polymorphic variants to close *) + let patl = List.map fst pat_env_list in + if List.exists has_variants patl then begin + Parmatch.pressure_variants env patl; + List.iter (iter_pattern finalize_variant) patl + end; (* `Contaminating' unifications start here *) List.iter (fun f -> f()) !pattern_force; begin match pat_env_list with [] -> () @@ -1783,7 +1768,12 @@ and type_cases ?in_function env ty_arg ty_res partial_loc caselist = (fun (pat, ext_env) (spat, sexp) -> let exp = type_expect ?in_function ext_env sexp ty_res in (pat, exp)) - pat_env_list caselist in + pat_env_list caselist + in + let partial = + match partial_loc with None -> Partial + | Some loc -> Parmatch.check_partial loc cases + in add_delayed_check (fun () -> Parmatch.check_unused env cases); cases, partial @@ -1808,6 +1798,14 @@ and type_let env rec_flag spat_sexp_list = {pat with pat_type = instance pat.pat_type}) pat_list end else pat_list in + (* Polymoprhic variant processing *) + List.iter + (fun pat -> + if has_variants pat then begin + Parmatch.pressure_variants env [pat]; + iter_pattern finalize_variant pat + end) + pat_list; (* Only bind pattern variables after generalizing *) List.iter (fun f -> f()) force; let exp_env = @@ -1817,7 +1815,7 @@ and type_let env rec_flag spat_sexp_list = (fun (spat, sexp) pat -> type_expect exp_env sexp pat.pat_type) spat_sexp_list pat_list in List.iter2 - (fun pat exp -> ignore(Parmatch.check_partial env pat.pat_loc [pat, exp])) + (fun pat exp -> ignore(Parmatch.check_partial pat.pat_loc [pat, exp])) pat_list exp_list; end_def(); List.iter2 diff --git a/typing/typedtree.ml b/typing/typedtree.ml index f06a659d..2161fd11 100644 --- a/typing/typedtree.ml +++ b/typing/typedtree.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: typedtree.ml,v 1.34 2003/06/19 15:53:53 xleroy Exp $ *) +(* $Id: typedtree.ml,v 1.35 2003/08/12 03:11:38 garrigue Exp $ *) (* Abstract syntax tree after typing *) @@ -150,25 +150,52 @@ and module_coercion = (* Auxiliary functions over the a.s.t. *) +let iter_pattern_desc f = function + | Tpat_alias(p, id) -> f p + | Tpat_tuple patl -> List.iter f patl + | Tpat_construct(cstr, patl) -> List.iter f patl + | Tpat_variant(_, pat, _) -> may f pat + | Tpat_record lbl_pat_list -> + List.iter (fun (lbl, pat) -> f pat) lbl_pat_list + | Tpat_array patl -> List.iter f patl + | Tpat_or(p1, p2, _) -> f p1; f p2 + | Tpat_any + | Tpat_var _ + | Tpat_constant _ -> () + +let map_pattern_desc f d = + match d with + | Tpat_alias (p1, id) -> + Tpat_alias (f p1, id) + | Tpat_tuple pats -> + Tpat_tuple (List.map f pats) + | Tpat_record lpats -> + Tpat_record (List.map (fun (l,p) -> l, f p) lpats) + | Tpat_construct (c,pats) -> + Tpat_construct (c, List.map f pats) + | Tpat_array pats -> + Tpat_array (List.map f pats) + | Tpat_variant (x1, Some p1, x2) -> + Tpat_variant (x1, Some (f p1), x2) + | Tpat_or (p1,p2,path) -> + Tpat_or (f p1, f p2, path) + | Tpat_var _ + | Tpat_constant _ + | Tpat_any + | Tpat_variant (_,None,_) -> d + (* List the identifiers bound by a pattern or a let *) let idents = ref([]: Ident.t list) let rec bound_idents pat = match pat.pat_desc with - Tpat_any -> () | Tpat_var id -> idents := id :: !idents | Tpat_alias(p, id) -> bound_idents p; idents := id :: !idents - | Tpat_constant cst -> () - | Tpat_tuple patl -> List.iter bound_idents patl - | Tpat_construct(cstr, patl) -> List.iter bound_idents patl - | Tpat_variant(_, pat, _) -> may bound_idents pat - | Tpat_record lbl_pat_list -> - List.iter (fun (lbl, pat) -> bound_idents pat) lbl_pat_list - | Tpat_array patl -> List.iter bound_idents patl | Tpat_or(p1, _, _) -> (* Invariant : both arguments binds the same variables *) bound_idents p1 + | d -> iter_pattern_desc bound_idents d let pat_bound_idents pat = idents := []; bound_idents pat; let res = !idents in idents := []; res @@ -195,23 +222,5 @@ let rec alpha_pat env p = match p.pat_desc with with | Not_found -> new_p end -| Tpat_tuple pats -> - {p with pat_desc = - Tpat_tuple (List.map (alpha_pat env) pats)} -| Tpat_record lpats -> - {p with pat_desc = - Tpat_record (List.map (fun (l,p) -> l,alpha_pat env p) lpats)} -| Tpat_construct (c,pats) -> - {p with pat_desc = - Tpat_construct (c,List.map (alpha_pat env) pats)} -| Tpat_array pats -> - {p with pat_desc = - Tpat_array (List.map (alpha_pat env) pats)} -| Tpat_variant (x1, Some p1, x2) -> - {p with pat_desc = - Tpat_variant (x1, Some (alpha_pat env p1), x2)} -| Tpat_or (p1,p2,path) -> - {p with pat_desc = - Tpat_or (alpha_pat env p1, alpha_pat env p2, path)} -| Tpat_constant _|Tpat_any|Tpat_variant (_,None,_) -> p - +| d -> + {p with pat_desc = map_pattern_desc (alpha_pat env) d} diff --git a/typing/typedtree.mli b/typing/typedtree.mli index 9f8bcd03..c3eb97d7 100644 --- a/typing/typedtree.mli +++ b/typing/typedtree.mli @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: typedtree.mli,v 1.32 2003/06/19 15:53:53 xleroy Exp $ *) +(* $Id: typedtree.mli,v 1.33 2003/08/12 03:11:38 garrigue Exp $ *) (* Abstract syntax tree after typing *) @@ -151,6 +151,9 @@ and module_coercion = (* Auxiliary functions over the a.s.t. *) +val iter_pattern_desc : (pattern -> unit) -> pattern_desc -> unit +val map_pattern_desc : (pattern -> pattern) -> pattern_desc -> pattern_desc + val let_bound_idents: (pattern * expression) list -> Ident.t list val rev_let_bound_idents: (pattern * expression) list -> Ident.t list diff --git a/typing/typemod.ml b/typing/typemod.ml index 9273b8aa..7b9f1d2c 100644 --- a/typing/typemod.ml +++ b/typing/typemod.ml @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: typemod.ml,v 1.63 2003/07/01 13:05:43 xleroy Exp $ *) +(* $Id: typemod.ml,v 1.65 2003/08/20 14:35:14 xleroy Exp $ *) (* Type-checking of the module language *) @@ -659,7 +659,10 @@ and type_structure anchor env sstr = (Tstr_include (modl, bound_value_identifiers sg) :: str_rem, sg @ sig_rem, final_env) - in type_struct env sstr + in + if !Clflags.save_types + then List.iter (function {pstr_loc = l} -> Stypes.record_phrase l) sstr; + type_struct env sstr let type_module = type_module None let type_structure = type_structure None @@ -766,6 +769,7 @@ let package_units objfiles cmifile modulename = (modname, Env.read_signature modname (pref ^ ".cmi"))) objfiles in (* Compute signature of packaged unit *) + Ident.reinit(); let sg = package_signatures Subst.identity units in (* See if explicit interface is provided *) let mlifile = diff --git a/win32caml/Makefile b/win32caml/Makefile index 1401c96f..73655769 100644 --- a/win32caml/Makefile +++ b/win32caml/Makefile @@ -11,34 +11,42 @@ # # ######################################################################### -# $Id: Makefile,v 1.6 2002/06/07 09:49:45 xleroy Exp $ +# $Id: Makefile,v 1.8 2003/08/29 14:30:15 xleroy Exp $ include ../config/Makefile -CC=cl /nologo -CFLAGS=/MT -O /Zi +CC=$(BYTECC) +CFLAGS=$(BYTECCCOMPOPTS) -OBJS=startocaml.obj ocaml.res ocaml.obj menu.obj +OBJS=startocaml.$(O) ocamlres.$(O) ocaml.$(O) menu.$(O) -LIBS=kernel32.lib advapi32.lib gdi32.lib user32.lib comdlg32.lib comctl32.lib +LIBS=$(call SYSLIB,kernel32) $(call SYSLIB,advapi32) $(call SYSLIB,gdi32) \ + $(call SYSLIB,user32) $(call SYSLIB,comdlg32) $(call SYSLIB,comctl32) all: ocamlwin.exe ocamlwin.exe: $(OBJS) $(CC) $(CFLAGS) -o ocamlwin.exe $(OBJS) $(LIBS) -ocaml.res: ocaml.rc ocaml.ico +ocamlres.$(O): ocaml.rc ocaml.ico +ifeq ($(TOOLCHAIN),msvc) rc ocaml.rc + cvtres /nologo /machine:ix86 /out:$@ ocaml.res + rm -f ocaml.res +endif +ifeq ($(TOOLCHAIN),mingw) + windres -i ocaml.rc -o $@ +endif $(OBJS): inria.h inriares.h clean: - rm -f ocamlwin.exe ocaml.res *.obj *.pdb ocamlwin.ilk + rm -f ocamlwin.exe *.$(O) *.pdb ocamlwin.ilk install: cp ocamlwin.exe $(PREFIX)/OCamlWin.exe -.SUFFIXES: .c .obj +.SUFFIXES: .c .$(O) -.c.obj: +.c.$(O): $(CC) $(CFLAGS) -c $*.c diff --git a/win32caml/menu.c b/win32caml/menu.c index 016d5252..fd23f581 100644 --- a/win32caml/menu.c +++ b/win32caml/menu.c @@ -10,7 +10,7 @@ /* */ /***********************************************************************/ -/* $Id: menu.c,v 1.5 2002/07/23 14:12:02 doligez Exp $ */ +/* $Id: menu.c,v 1.6 2003/09/09 09:07:14 xleroy Exp $ */ #include <stdio.h> #include <windows.h> @@ -18,6 +18,7 @@ #include "inria.h" #include "inriares.h" +void InterruptOcaml(void); LOGFONT CurrentFont; int CurrentFontFamily = (FIXED_PITCH | FF_MODERN); int CurrentFontStyle; diff --git a/win32caml/ocaml.c b/win32caml/ocaml.c index cf903f4c..e5d8ada5 100644 --- a/win32caml/ocaml.c +++ b/win32caml/ocaml.c @@ -10,7 +10,7 @@ /* */ /***********************************************************************/ -/* $Id: ocaml.c,v 1.5 2002/07/23 14:12:03 doligez Exp $ */ +/* $Id: ocaml.c,v 1.6 2003/09/09 09:07:14 xleroy Exp $ */ /*@@ Wedit generated application. Written Sat Jun 02 18:22:38 2001 @@header: D:\lcc\inria\inriares.h @@ -29,6 +29,7 @@ int EditControls = IDEDITCONTROL; static WNDPROC lpEProc; static char lineBuffer[1024*32]; +int ResetText(void); int ReadToLineBuffer(void); int AddLineBuffer(void); static int busy; diff --git a/win32caml/startocaml.c b/win32caml/startocaml.c index f3a9da63..25656f83 100644 --- a/win32caml/startocaml.c +++ b/win32caml/startocaml.c @@ -10,14 +10,13 @@ /* */ /***********************************************************************/ -/* $Id: startocaml.c,v 1.6 2002/07/23 14:12:03 doligez Exp $ */ +/* $Id: startocaml.c,v 1.8 2003/09/09 09:07:14 xleroy Exp $ */ #include <windows.h> #include <stdio.h> -#include <windows.h> #include <direct.h> +#include <io.h> #include "inria.h" -extern int _get_osfhandle(int); PROCESS_INFORMATION pi; #define BUFSIZE 4096 STARTUPINFO startInfo; @@ -144,6 +143,7 @@ int GetOcamlPath(void) "Software", "Objective Caml", "InterpreterPath", path)) { /* Key doesn't exist? Ask user */ + path[0] = '\0'; if (!BrowseForFile("Ocaml interpreter|ocaml.exe", path)) { ShowDbgMsg("Impossible to find ocaml.exe. I quit"); exit(0); @@ -217,13 +217,14 @@ int IsWindowsNT(void) Errors: If any system call for whatever reason fails, the thread will exit. No error message is shown. ------------------------------------------------------------------------*/ -int _stdcall DoStartOcaml(HWND hwndParent) +DWORD _stdcall DoStartOcaml(LPVOID param) { char *cmdline; int processStarted; LPSECURITY_ATTRIBUTES lpsa=NULL; SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd; + HWND hwndParent = (HWND) param; sa.nLength = sizeof(SECURITY_ATTRIBUTES); // Under windows NT/2000/Whistler we have to initialize the security descriptors @@ -356,7 +357,7 @@ void InterruptOcaml(void) { if (! GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, pi.dwProcessId)) { char message[1024]; - sprintf(message, "GenerateConsole failed: %d\n", GetLastError()); + sprintf(message, "GenerateConsole failed: %ld\n", GetLastError()); MessageBox(NULL, message, "Ocaml", MB_OK); } WriteToPipe(" "); diff --git a/yacc/defs.h b/yacc/defs.h index 448e40e9..f1af3950 100644 --- a/yacc/defs.h +++ b/yacc/defs.h @@ -12,7 +12,7 @@ /* Based on public-domain code from Berkeley Yacc */ -/* $Id: defs.h,v 1.19 2003/07/17 14:51:43 xleroy Exp $ */ +/* $Id: defs.h,v 1.20 2003/09/03 13:26:10 doligez Exp $ */ #include <assert.h> #include <ctype.h> @@ -226,6 +226,7 @@ extern char lflag; extern char rflag; extern char tflag; extern char vflag; +extern char qflag; extern char sflag; extern char big_endian; diff --git a/yacc/main.c b/yacc/main.c index c26feea4..a8b9b43d 100644 --- a/yacc/main.c +++ b/yacc/main.c @@ -12,7 +12,7 @@ /* Based on public-domain code from Berkeley Yacc */ -/* $Id: main.c,v 1.16 2001/07/12 12:54:23 doligez Exp $ */ +/* $Id: main.c,v 1.17 2003/09/03 13:26:10 doligez Exp $ */ #include <signal.h> #include <string.h> @@ -26,6 +26,7 @@ char lflag; char rflag; char tflag; char vflag; +char qflag; char sflag; char big_endian; @@ -134,7 +135,7 @@ void set_signals(void) void usage(void) { - fprintf(stderr, "usage: %s [-v] [-b file_prefix] filename\n", + fprintf(stderr, "usage: %s [-v] [-q] [-b file_prefix] filename\n", myname); exit(1); } @@ -164,6 +165,10 @@ void getargs(int argc, char **argv) vflag = 1; break; + case 'q': + qflag = 1; + break; + case 'b': if (*++s) file_prefix = s; @@ -188,6 +193,10 @@ void getargs(int argc, char **argv) vflag = 1; break; + case 'q': + qflag = 1; + break; + default: usage(); } diff --git a/yacc/reader.c b/yacc/reader.c index e97c6cef..42ddc9b9 100644 --- a/yacc/reader.c +++ b/yacc/reader.c @@ -12,7 +12,7 @@ /* Based on public-domain code from Berkeley Yacc */ -/* $Id: reader.c,v 1.25 2003/07/17 14:51:43 xleroy Exp $ */ +/* $Id: reader.c,v 1.26 2003/07/23 23:03:00 doligez Exp $ */ #include <string.h> #include "defs.h" @@ -1233,9 +1233,10 @@ void copy_action(void) else fprintf(f, "(peek_val parser_env %d : '%s) in\n", n - i, item->name); } - fprintf(f, " Obj.repr((\n"); + fprintf(f, " Obj.repr(\n"); fprintf(f, line_format, lineno, input_file_name); - for (i = cptr - line; i >= 0; i--) fputc(' ', f); + for (i = 0; i < cptr - line; i++) fputc(' ', f); + fputc ('(', f); depth = 1; cptr++; @@ -1268,15 +1269,15 @@ loop: goto loop; } if (c == '}' && depth == 1) { - fprintf(f, "\n# 0\n "); + fprintf(f, ")\n# 0\n "); cptr++; tagres = plhs[nrules]->tag; if (tagres) - fprintf(f, ") : %s))\n", tagres); + fprintf(f, " : %s))\n", tagres); else if (sflag) - fprintf(f, ")))\n"); + fprintf(f, "))\n"); else - fprintf(f, ") : '%s))\n", plhs[nrules]->name); + fprintf(f, " : '%s))\n", plhs[nrules]->name); if (sflag) fprintf(f, "\n"); return;