pax_global_header00006660000000000000000000000064135750775000014523gustar00rootroot0000000000000052 comment=b5e75d581b1250965f6b3e9ce4c51349c03f4d29 js_of_ocaml-3.5.2/000077500000000000000000000000001357507750000140055ustar00rootroot00000000000000js_of_ocaml-3.5.2/.github/000077500000000000000000000000001357507750000153455ustar00rootroot00000000000000js_of_ocaml-3.5.2/.github/ISSUE_TEMPLATE/000077500000000000000000000000001357507750000175305ustar00rootroot00000000000000js_of_ocaml-3.5.2/.github/ISSUE_TEMPLATE/bug_report.md000066400000000000000000000005511357507750000222230ustar00rootroot00000000000000--- name: Bug report about: Create a report title: "[BUG]" labels: bug assignees: '' --- **Describe the bug** A clear and concise description of what the bug is and how to reproduce it. **Expected behavior** A clear and concise description of what you expected to happen. **Versions** Version of packages used to reproduce the bug (ocamlc, js_of_ocaml, ..) js_of_ocaml-3.5.2/.github/ISSUE_TEMPLATE/feature_request.md000066400000000000000000000007771357507750000232700ustar00rootroot00000000000000--- name: Feature request about: Suggest an idea title: "[FEATURE REQUEST]" labels: enhancement assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. js_of_ocaml-3.5.2/.github/ISSUE_TEMPLATE/other.md000066400000000000000000000001751357507750000211760ustar00rootroot00000000000000--- name: Other about: Anything that is neither a bug report nor a feature request title: '' labels: '' assignees: '' --- js_of_ocaml-3.5.2/.gitignore000066400000000000000000000015601357507750000157770ustar00rootroot00000000000000# Boring file regexps: # C object files *.o *.a *.so # Ocaml object files *.cmi *.cmo *.cmx *.cma *.cmxa *.cmxs *.cmjs # generated by dune *.merlin *.install # backup files *~ *# .#* # Specific to Js_of_ocaml *.byte *.tmpjs *.map ocamltests gh-pages _opam _build # Benchmarks benchmarks/*.svg benchmarks/*.pdf benchmarks/__run benchmarks/build benchmarks/results benchmarks/config api/wiki/ api/html manual/files/boulderdash/ manual/files/cubes/ manual/files/graph_viewer/ manual/files/hyperbolic/ manual/files/minesweeper/ manual/files/planet/ manual/files/toplevel/ manual/files/webgl/ manual/files/wiki/ manual/files/wysiwyg/ toplevel/examples/lwt_toplevel_bin/*.cmis.js toplevel/examples/lwt_toplevel_bin/test_dynlink.js toplevel/examples/lwt_toplevel_bin/test_dynlink.cmi.js toplevel/examples/lwt_toplevel_bin/toplevel.js toplevel/examples/lwt_toplevel_bin/eval.js js_of_ocaml-3.5.2/.jenkins.sh000066400000000000000000000026441357507750000160660ustar00rootroot00000000000000opam update opam pin add --no-action js_of_ocaml.dev . opam pin add --no-action js_of_ocaml-compiler.dev . opam pin add --no-action js_of_ocaml-ocamlbuild.dev . opam pin add --no-action js_of_ocaml-ppx.dev . opam pin add --no-action js_of_ocaml-lwt.dev . opam pin add --no-action js_of_ocaml-tyxml.dev . opam pin add --no-action js_of_ocaml-toplevel.dev . opam install lwt reactiveData tyxml || true opam install ppx_tools ppx_deriving || true opam install --deps-only \ js_of_ocaml \ js_of_ocaml-lwt \ js_of_ocaml-compiler \ js_of_ocaml-ocamlbuild \ js_of_ocaml-toplevel \ js_of_ocaml-ppx \ js_of_ocaml-tyxml opam install --verbose js_of_ocaml-compiler opam install --verbose js_of_ocaml-ocamlbuild opam install --verbose js_of_ocaml opam install --verbose js_of_ocaml-ppx opam install --verbose js_of_ocaml-lwt opam install --verbose js_of_ocaml-tyxml opam install --verbose js_of_ocaml-toplevel do_build_doc () { opam install ocp-indent higlo base64 make clean make all make -C doc doc make -C doc wikidoc cp -Rf doc/manual/files/* ${MANUAL_FILES_DIR}/ cp -Rf doc/manual/src/* ${MANUAL_SRC_DIR}/ cp -Rf doc/api/wiki/*.wiki ${API_DIR}/ } do_remove () { opam remove --verbose \ js_of_ocaml \ js_of_ocaml-compiler \ js_of_ocaml-ocamlbuild \ js_of_ocaml-ppx \ js_of_ocaml-toplevel \ js_of_ocaml-lwt \ js_of_ocaml-tyxml } js_of_ocaml-3.5.2/.ocamlformat000066400000000000000000000005101357507750000163060ustar00rootroot00000000000000break-cases=toplevel break-fun-decl=fit-or-vertical break-infix=fit-or-vertical if-then-else=keyword-first parens-tuple=multi-line-only type-decl=sparse wrap-comments=false wrap-fun-args=false indicate-multiline-delimiters=no break-infix-before-func break-separators=before dock-collection-brackets=false margin=90 version=0.12 js_of_ocaml-3.5.2/.ocp-indent000066400000000000000000000000521357507750000160430ustar00rootroot00000000000000normal with=0 syntax=lwt mll max_indent=2 js_of_ocaml-3.5.2/.travis.yml000066400000000000000000000016011357507750000161140ustar00rootroot00000000000000language: c sudo: false cache: directories: - $HOME/.opam - $HOME/Library/Caches/Homebrew matrix: include: - os: linux env: OCAML_VERSION=4.02 MODE=opam - os: linux env: OCAML_VERSION=4.03 MODE=opam - os: linux env: OCAML_VERSION=4.04 MODE=opam - os: linux env: OCAML_VERSION=4.05 MODE=opam - os: linux env: OCAML_VERSION=4.06 MODE=opam - os: linux env: OCAML_VERSION=4.07 MODE=opam - os: linux env: OCAML_VERSION=4.08 MODE=opam - os: linux env: OCAML_VERSION=4.08 MODE=opam - os: linux env: OCAML_VERSION=4.09 MODE=build name: "4.09 all targets" - os: osx env: OCAML_VERSION=4.07 MODE=opam allow_failures: - os: osx env: OCAML_VERSION=4.07 MODE=opam fast_finish: true script: bash -e tools/travis.sh # safelist branches: only: - master - wikidoc js_of_ocaml-3.5.2/CHANGES.md000066400000000000000000000553001357507750000154020ustar00rootroot00000000000000# 3.5.2 (2019-12-14) - Hong Kong ## Features/Changes * Misc: support for ocaml 4.10 * Misc: ppx_deriving_json uses ppxlib >= 0.9 ## Bug fixes * Runtime: fix pseudo fs initialization (#931) # 3.5.1 (2019-11-16) - Hong Kong ## Features/Changes ## Bug fixes * Runtime: fix poly compare with null and undefined (#920) * Lib: Deriving Json does not export an [import] unit * Dynlink/toplevel: export all units when no export file is specified (#921) * Ppx: ppx_deriving_json should allow [%to_json: t] syntax # 3.5.0 (2019-11-10) - Hong Kong ## Features/Changes * Compiler: Improve testing of the compiler (Ty Overby) * Compiler: Add several macros for making the runtime easier to maintain (#771) (Ty Overby) * Compiler: Allow to emit one javascript per compilation unit (#783) * Compiler: refactoring (#781, #782, #787, #795, #802) * Compiler: more source map location for the javascript runtime (#795) * Compiler: tune variable naming (#838) * Compiler: Work around num lib incompatibility * Compiler: escape '# 1.0+beta12) ## Bug fixes * Runtime: fix Sys.file_exists for the in-memory filesystem. * Runtime: implement missing primitives: caml_nativeint_bswap, caml_floatarray_*, caml_ba_change_layout * Runtime: few other bugfixes. * Compiler: fix compat with OCaml 4.06 # 3.0.0 (2017-06-23) - Hong Kong ## Features/Changes * Misc: switch to ppx instead of camlp4 * Misc: always install deriving_json * Misc: remove support for async_kernel, bin_prot * Misc: remove support for ppx_driver * Misc: split js_of_ocaml in multiple packages * Misc: switch to jbuilder * Misc: new pseudo filesystem support with better node support * Compiler: sourcemap support is now optional * Compiler: no more strong dep on yojson, b64, menhir, ocamllex * Compiler: improve separate compilation workflow * Runtime: add support for weakdef * Syntaxes: add expect tests * Syntaxes: switch to ocaml-migrate-parsetree and ppx_tools_versioned * Lib: Add primitives in [Js.Unsafe] * Lib: remove keycode module, replaced by Dom_html.Keyboard_code * Lib: XmlHttpRequest, API change for perform functions. ## Bug fixes * Runtime: fix many stubs * Lib: fix many signatures * Compiler: fix performance of compilation passes (simpl,clean) * Compiler: fix compat with OCaml 4.06 * Toplevel: flush channels after execution. * Toplevel: fix toplevel generation when using -export-unit # 2.8.4 (2016-12-21) ## Features/Changes * Compiler: new jsoo_link binary to link multiple javascript files together and merging sourcemaps. * Toplevel: improve generation of toplevels, one can now pass a an export file containing units to export. (see jsoo_listunits) * Lib: Provide a Js_of_ocaml (namespace) module to ease transition with future version of js_of_ocaml ## Bug fixes * Compiler: fix separate compilation when facing empty unit inside a library * Runtime: fix many javascript stubs * Syntac: fix ppx deriving json # 2.8.3 (2016-11-04) ## Features/Changes * Runtime: complete support for 4.04 ## Bug fixes * Compiler: fix order of javascript files * Compiler: fix Javascript lexer (newline inside strings) * Compiler: fix bug in closure generation * Compiler: fix regression in closure generation (introduced in 2.8) (#531) * Compiler: fix code generation when static evaluation is disabled # 2.8.2 (2016-09-10) ## Features/Changes * Lib: add Dom_html.Keyboard_code & Dom_html.Keyboard_key (Corwin de Boor) * Misc: update lib and runtime to work better with non browser environment * Misc: initial support for 4.04 ## Bug fixes * Compiler: fix js output for x - -1 * Compiler: fix parsing of annotations in the runtime * Compiler: fix javascript minifier * Compiler: various fixes for separate compilation. # 2.8.1 (2016-07-01) ## Features/Changes * Compiler: reduce memory usage for shortvar * Lib: Add optional `prefix` arg to Jsonp.call * Ppx: add ppx_driver compatibility ## Bug fixes * Lib: fix Js.object_keys, Js.export * Lib: Async, do not ignore unhandled exceptions # 2.8 (2016-06-16) ## Features/Changes * Compiler: allow dynlink of precompiled javascript file * Compiler: Improve tailcall optimization * Compiler: Improve pretty mode * Compiler: More inlining and static evaluation * Compiler: Better source map support, to leverage resolve_variable_names in chrome DevTools * Compiler: preserve as much as possible the initial OCaml variable names * Lib: synchronize with tyxml 4.0.0 * Lib: convert string/bigstring to/from typed_array * Lib: add Tyxml_js.Register API. * Lib: Support for Core_kernel and Async_kernel (32bit only). * Lib: Mutation observer. * Runtime: bigstring, caml_int32_bits_of_float, .. * Runtime: better nodejs integration ## Misc * Support for OCaml 4.03 * Toplevel with ppx syntax ## Bug fixes * Compiler: Fix float printing * Compiler: fix separate compilation # 2.7 (2016-01-25) ## Features/Changes * Syntax: ppx_deriving * Compiler: Add custom_header ability to jsoo generate file (Edgar Aroutiounian) * Compiler: Bytecode parsing, improved performance * Lib: add geolocation API (Stéphane Legrand) * Lib: add Mutation observers API (Stéphane Legrand) * Lib: add Jstable module (Drup) * Lib: add WebWorker API (Grégoire Henry) * Lib: Allow to customize 'in_channel' with specific 'refiller' (Grégoire Henry) * Lib: Synchronized tyxml 3.6.0 ## BugFixes * Compiler: Fix compilation of the [match with exception] construct * Compiler: fix compat with the upcoming ocaml 4.03 * Lib: Tyxml_js, discrepancy between Firefox and Chromium * Lib: various small fixes * Runtime: Fix Big_int.square_big_int * Runtime: graphics, fix draw_image with transparent pixel * Ppx: fix for merlin # 2.6 (2015-07-15) ## Features/Changes * Compiler: Findlib is optional * Compiler: improvement of sourcemap support (ie: inlinned sourcemap) * Compiler: Support for separate compilation (compile cm{o,a} -> js) * Compiler: more inlining * Syntax: new ppx syntax * Syntax: js object literal (camlp4 + ppx) * Runtime: support for Dynlink * Runtime: Support for upcoming release of Bin_prot, Core_kernel, Async_kernel * Lib: add requestAnimationFrame * Lib: complete Js.Math * Lib: complete xmlHttpRequest ## Misc * Drop support for 3.12 ## BugFixes * Runtime: Fix caml_hash * Lib: fix tyxml + svg * Lib: various Api fixes # 2.5 (2014-09-30) ## Features/Changes * Compiler: SourceMap improvement * Compiler: remove registration of unused named value (wrt runtime) * Compiler: Smarter inlining, Constant sharing, Switch generation * Lib: Dom binding: *AttributeNS, *AttributeNode*, borderRadius * Runtime: improve performance of string, array allocation * Misc: enable safestring for OCaml 4.02 * Commandline: switch to Cmdliner. Better -help + manpage ## BugFixes * Compiler: workaround a bug in ocaml 4.02 wrt debug section. * Compiler: bug when generating minified JavaScript. * Runtime: fix Obj.tag * Runtime: fix internalmod wrt ocaml4.02 # 2.4.1 (2014-08-28) ## BugFixes * Compiler: restore compatibility with ocaml 4.02 * Runtime: fix caml_hash, Math.imul may give wrong results (#215) * Lib: Graphics_js, update text drawing baseline * Lib: Fix overuse of FormData in XmlHttpRequest (Tomohiro Matsuyama #214) # 2.4 (2014-08-08) ## Features/Changes * Runtime: support for num (Ryan Goulden) * Lib: initial support for Dom_svg * Lib: introduce Jsonp module * Lib: introduce JSON object binding * Lib: introduce DomContentLoaded * lib: introduce eventSource * Lib: introduce js_of_ocaml.toplevel package * Lib: various improvement: textContent,outerHTML,unload event,css properties * Lib: complete binding of Js.array * Lib: change signature of Sys_js.register_autoload * Lib: sync js_of_ocaml.tyxml with latest tyxml * Tools: helpers to build toplevel: jsoo_mktop, jsoo_mkcmis ## BugFixes * Compiler: generate js files with default permission, was 0o600 (#182) (Daniel Bünzli) * Syntax: fix typing of method arguments * Runtime: fix behaviour of Sys.argv (Tomohiro Matsuyama) * Runtime: fix caml_js_meth_call * Compiler: fix assert false when deadcode is off * Compiler: fix compilation of Js.debugger # 2.3 (2014-06-30) ## Features/Changes * Lib: remove deprecated Event_arrow * Lib: introduce js_of_ocaml.tyxml * Lib: introduce js_of_ocaml.weak (that loads weak.js) and remove predicate joo_weak * Lib: introduce js_of_ocaml.log (Lwt logger) * Lib: Dom_html.{range,selection} (Enguerrand Decorne) ## BugFixes * Compiler: fix traduction of Ult binop (#177) * Compiler: fix the build of compiler.{cmxs,cma} (Stéphane Glondu) * Compiler: fix traduction of logical shift right * Runtime: fix marshaling (#176) * Meta: update predicates (joo_* -> jsoo_*) * Lib: fix class type Dom_html.optionElement # 2.2 (2014-05-15) ## Features/Changes * Runtime: improve blit_string perf * Compiler: option to warn about unused js variable * Lib: audio/videoElement ## BugFixes * Syntax: catch exception in syntax extension (#158) * Compiler: compat with Node.js (global object) (#160) * Runtime: fix graphics.js * Lib: fix Dom.event interface # 2.1 (2014-04-28) ## Features/Changes * Runtime: bigarray comparison * Compiler: allow to embed directory with -file dir_name=ext1,ext2:dest_path * Compiler: can now output embedded files in a different js file * Lib: js_of_ocaml.graphics * Lib: Js.Unsafe.expr to embed JavasScript expression to be used instead of Js.Unsafe.variable (or eval_string) * Lib: Sys_js.js_of_ocaml_version && Sys_js.file_content * OCamlbuild plugin: Add the OASIS support, document the API and add the tags sourcemap (included in the meta-tag debug) and tailcall (#148) (by Jacques-Pascal Deplaix) ## BugFixes * Syntax: Better type constraint (#84) * Compiler: caml_failwith primitive was sometime missing (#147) * Compiler: variable names used outside a program were not marked as reserved (#146) * Lib: fix WebGl interface # 2.0 (2014-04-11) ## Features/Changes * Compiler: generate shorter variable names * Parsing and minifying of external javascript file (ie: runtime) (by Hugo Heuzard) * Compiler: JavaScript strict mode enabled * Runtime: add support for recursive module (by Hugo Heuzard) * Compiler: use trampoline to implement tailcall optim (by Hugo Heuzard) * Improved OCaml toplevel UI (by Hugo Heuzard) * Toplevel: support dynamic loading of cmo and cma files * Runtime: add Bigarray support (contributed by Andrew Ray) * Library: switch from "float Js.t" to just "float" for typing JavaScript numbers * Compiler: Add javascript file lookup using findlib (+mypkg/myfile.js will read myfile.js from mypkg findlib directory) (by Hugo Heuzard) * Compiler: improve missing primitives & reserved name detection (by Hugo Heuzard) * Compiler: static evaluation of constant ("staticeval" optimisation) (by Hugo Heuzard) * Compiler: share constants (by Hugo Heuzard) * Compiler: alias primitives (by Hugo Heuzard) * Compiler: complete javascript ast (by Hugo Heuzard) * Compiler: 'caml_format_int %d x' compiles to ""+x (by Hugo Heuzard) * Add JavaScript file in META (to be used with ocamlfind) (by Hugo Heuzard) * Add Ocamlbuild plugin js_of_ocaml.ocamlbuild (by Jacques-Pascal Deplaix) * Add/Install classlist.js, weak.js * Add Url.Current.protocol (by Vicent Balat) * Dependency: deriving instead of deriving-ocsigen * Runtime: log wrong string encoding issues to the console (by Hugo Heuzard) * Add compiler_libs (by Pierre Chambart) * Compile syntax extension to native code as well (by Hugo Heuzard) * Add a JavaScript parser (extracted from facebook/pfff) * Compiler: remove redundant 'var' (by Hugo Heuzard) * Compiler: improve compact mode, remove unnecessary space, semicolon * Runtime: Support in_channel and out_channel (by Hugo Heuzard) * Compiler: option to embed files into the generated js such files can be read using open_in (by Hugo Heuzard) * Runtime: add cache for method lookup (by Hugo Heuzard) * Compiler: experimental sourcemap support (by Hugo Heuzard) * JavaScript Errors are now wrapped inside OCaml exceptions (by Hugo Heuzard) ## BugFixes * Compiler: js file is not create in case of error (by Hugo Heuzard) * Fix compatibility when using type covn (by Hugo Heuzard) * Fix md5 : incorrect for string where (length % 64) E 56..59 (by Grégoire Henry) * Fix caml_js_new: when called with more than 8 arguments * Address a number of integer overflow issues (by Hugo Heuzard) * Fix float comparisons (NaN was not compared correctly) # 1.4 (2013-12-03) ## Features/Changes * Add missing primitives for OCaml 4.01 * Improved Dom bindings (Hugo Heuzard and many other contributors) * Add -linkall option to keep all provided primitives (Pierre Chambard) * Improved tail-call optimization (Hugo Heuzard) * Added optimization levels: -o {1,2,3} (Hugo Heuzard) ## Bugfixes * Fixed some incorrect Dom bindings * Fixed hypot primitive (Pierre Chambard) * Fixed tail call optimization bug (some incorrect code was generated when the number of arguments did not match the number of function parameters) * Fixed a bug with empty strings * Fixed weak.js (primitives for Weak module) # 1.3 (2012-11-28) ## Features/Changes * Runtime and toplevel updates to support OCaml 4.0 * Add WebSocket bindings * Added -debuginfo option to output source code location information (patch by Kensuke Matsuzaki) * Dom_html: added change, input and hashChange event bindings * Adding Lwt_js_events.async_loop and buffered_loop ## Bugfixes * Fix array and string blitting with overlapping regions * Url module: fix encoding of '+' * Library: use 'this' instead of 'window' for better portability * Dom_html: fix creation of elements with type or name attribute under IE 9 * Compiler: small fix to bytecode parsing that could result in incorrect generated code * Dom_html: fix mouse wheel event bindings * Dom: fix the type of item methods * Deriving_json: tail-recursive serialisation of lists (by Hugo Heuzard) * Deriving_json: fix parsing of float arrays and polymorphic variants (by Hugo Heuzard) # 1.2 (2012-06-02) ## Features/Changes * Improvements in the data-flow solver * Add Dom_html.window##onscroll * Dom_events.listen: handler should return boolean * Add DOM drag/drop events ## Bugfixes * Fix #284 * Fix return type of window##open_ # 1.1.1 (2012-03-15) ## Misc * add webgl example ## Bugfixes * Url parsing. * webgl binding types # 1.1 (2012-02-24) ## Libraries: * Lots of new dom bindings * WebGL * Typed arrays * Many speed improvement (marshal, strings, regexps) * Many bug fixed ## Compiler: * Add -I option to select directories containing cmi files * Fix compilation of mutually recursive functions occurring in loops * In Javascript output, parenthesize numbers when followed by a dot * Fix order of evaluation bug * Fix compilation of loops in 'try ... with' body (close #263) ## Misc: * hyperbolic tree example # 1.0.9 (2011-11-30) * Bugfixe in polymorphic comparison. # 1.0.8 (2011-11-25) * Compatibility with deriving-0.3 * Libraries: * Adding Event_arrows.iter * Events: adding Dom_html.stopPropagation and ?propagate parameter in Event_arrows # 1.0.7 (2011-11-18) ## Libraries: * Add Dom_html.buttonPressed * Add functions to downcast Dom_html.event into mouseEvent, keyboardEvent, ... * Add Dom.document.adoptNode * removed Date.now() function, not supported by all browsers * Allow to test the button associated to a Dom_html.mouseEvent * Add localStorage and sessionStorage api ## Bugfixes * Deriving_json: fix string (un)marshaling (was broken for byte > 127) * Do not emit string escape sequence \\v (not supported by IE8) * Removed incorrect optimization of !(x < y) into (x ># y) * Allow compilation on win32/msvc * Open all files in binary mode # 1.0.6 (2011-09-28) ## Libraries: * add Dom_html.iFrameEliom##width * add Dom_html.window##scroll * add Dom.document##importNode ## Bugfixes * browser compatility for Regexp.search and check_headers (XmlHttpRequest.send). # 1.0.5 (2011-09-21) ## Libraries: * XmlHttpRequest: allow to cancel ta XHR after receiving the HTTP headers * Added the [CSS.Angle] module to handle angles in CSS ## Bugfixes * array_get/set bound check # 1.0.4 (2011-09-07) ## Libraries: * History API * improvements of CSS module * Add coercion and attribute manipulation functions in Dom module ## Bugfixes * fix typo in 'greater than or equal to' * marshaling, unmarshaling and comparison are not recursive anymore: avoid stack overflow * use custom formatter to pretty print Javascript code to avoid newlines where it is forbidden. * fix type of Dom.nodeList.item (was optdef, is now opt) * fixes for internet explorer. * fixes for bug exposed by Berke Durak's tool jsure. # 1.0.3 (2011-07-13) ## Libraries * Add a CSS module * export Form.form_elements * add onsubmit method to Dom_html.formElement * add classList property to dom elements ## Bugfixes * 'caml_int_of_string' was incorrect for negative number * Fixed misparenthesized Javascript 'new' expressions # 1.0.2 (2011-04-13) ## Compiler * Switch licence to LGPL * API to generate a function instead of a standalone program * option to compile an OCaml toplevel ## Libraries * Add an optional JSON deriving class * Add Math.random binding * Add scrollWidth/scrollHeight element methods to the DOM * Add coercion function Dom_html.CoerceTo.element * Renaming functions in XmlHttpRequest: * send -> perform * send_string -> perform_raw_url ## Bugfixes * fix compilation of Int32/Nativeint * fix compilation of self-recursive functions in loops * fix to File module for when there is no FileReader class in the host browser * fixed big in weak support # 1.0.1 (2011-01-26) * Allow use of Lwt.pause. * Split ocamlfind packages in two: syntax and library. ## Bugfixes * conversion of Int64 to string. * typos. # 1.0 (2010-12-13) Initial release js_of_ocaml-3.5.2/CONTRIBUTING.md000066400000000000000000000026711357507750000162440ustar00rootroot00000000000000# Contributing to Js_of_ocaml ## Reporting Issues If you encounter a problem when using js_of_ocaml or if you have any questions, please open a [GitHub issue](https://github.com/ocsigen/js_of_ocaml/issues/). 1. Check first if your issue has already been [reported](https://github.com/ocsigen/js_of_ocaml/issues/). 2. Include the version of ocaml and js_of_ocaml you are using (`ocamlc -version`, `js_of_ocaml --version`). 3. Describe the expected and actual behavior. 4. Do not unsubscribe from the issue until it is closed, the maintainers may ask for your feedback. ## Pull Requests We actively welcome pull requests. 1. Prior to investing a large amount of time into significant or invasive changes, it is likely more efficient to first open an issue for discussion and planning. 2. Install all dependencies (see [Install dependencies](#install-dependencies)) 3. Fork the repository and create your branch from `master`. 4. If you have added code that should be tested, add tests. 5. Ensure tests still pass (see [Running the tests](#running-the-tests)). 6. Add an entry in the changelog `CHANGES.md` ### Install dependencies ``` opam install --deps-only js_of_ocaml js_of_ocaml-lwt js_of_ocaml-compiler js_of_ocaml-ocamlbuild js_of_ocaml-toplevel js_of_ocaml-ppx js_of_ocaml-ppx_deriving_json js_of_ocaml-tyxml opam install lwt reactiveData tyxml ppxlib cohttp-lwt-unix menhir ppx_expect yojson sexplib ``` ### Running the tests Just run `make tests`. js_of_ocaml-3.5.2/HACKING.md000066400000000000000000000010631357507750000153730ustar00rootroot00000000000000# Release procedure * Documentation * Make sure the doc is up to date (See Documentation generation) * In the wikidoc branch, copy dev to VERSION * update VERSION * dune-release tag $(cat VERSION) * dune-release distrib -n js_of_ocaml * dune-release publish distrib * dune-release opam pkg * dune-release opam submit # Documentation generation * make doc * git checkout wikidoc * git reset --hard origin/wikidoc * make installdoc * cd _wikidoc * git diff # review diff * git commit -am "sync doc" && git push origin wikidoc * cd .. * git push origin wikidoc js_of_ocaml-3.5.2/LICENSE000066400000000000000000001317771357507750000150320ustar00rootroot00000000000000In the following, "the Compiler and Library" refers to all files marked "Copyright CNRS Université Paris Diderot" in the following directories and their sub-directories: compiler, lib, runtime, toplevel, tools and "the Examples" refers to all files marked "Copyright CNRS Université Paris Diderot" in directory "examples" and its sub-directories. The Compiler and Library are distributed under the terms of the GNU Library General Public License version 2 (included below). The Examples are distributed under the terms of the GNU Lesser General Public License version 2 (included below). As a special exception to the GNU Lesser General Public License, you may link, statically or dynamically, a "work that uses the Library" with a publicly distributed version of the Library to produce an executable file containing portions of the Library, and distribute that executable file under terms of your choice, without any of the additional requirements listed in clause 6 of the GNU Lesser General Public License. By "a publicly distributed version of the Library", we mean either the unmodified Library, or a modified version of the Library that is distributed under the conditions defined in clause 3 of the GNU Lesser General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU Lesser General Public License. ---------------------------------------------------------------------- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. ---------------------------------------------------------------------- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Lesser Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! js_of_ocaml-3.5.2/META.js_of_ocaml-compiler.template000066400000000000000000000007331357507750000223550ustar00rootroot00000000000000# DUNE_GEN package "runtime" ( package "num" ( description = "runtime support for the num library." version = "[distributed with js_of_ocaml-compiler]" jsoo_runtime = "nat.js" linkopts(javascript) = "+js_of_ocaml-compiler/nat.js" ) package "graphics" ( description = "runtime support for the graphics library." version = "[distributed with js_of_ocaml-compiler]" jsoo_runtime = "graphics.js" linkopts(javascript) = "+js_of_ocaml-compiler/graphics.js" ) ) js_of_ocaml-3.5.2/META.js_of_ocaml-ppx.template000066400000000000000000000007301357507750000213470ustar00rootroot00000000000000# DUNE_GEN package "deriving" ( description = "deprecated alias. use js_of_ocaml-ppx_deriving_json directly" requires = "js_of_ocaml-ppx_deriving_json" ) package "as-lib" ( archive(byte) = "ppx_js.cma" archive(native) = "ppx_js.cmxa" plugin(byte) = "ppx_js.cma" plugin(native) = "ppx_js.cmxs" exists_if = "ppx_js.cma" requires = "compiler-libs compiler-libs.common ocaml-migrate-parsetree ppx_tools_versioned" ) js_of_ocaml-3.5.2/META.js_of_ocaml-toplevel.template000066400000000000000000000001061357507750000223670ustar00rootroot00000000000000# DUNE_GEN linkopts(javascript) = "+js_of_ocaml-compiler/toplevel.js" js_of_ocaml-3.5.2/META.js_of_ocaml.template000066400000000000000000000013401357507750000205400ustar00rootroot00000000000000# DUNE_GEN linkopts(javascript,-jsoo_noruntime) = "+js_of_ocaml-compiler/runtime.js" linkopts(javascript,jsoo_classlist) += "+js_of_ocaml-compiler/classlist.js" linkopts(javascript,pkg_graphics) += "+js_of_ocaml-compiler/graphics.js" linkopts(javascript,pkg_num) += "+js_of_ocaml-compiler/nat.js" package "weak" ( ) package "num" ( requires = "js_of_ocaml-compiler.runtime.num" ) package "ppx" ( requires = "js_of_ocaml-ppx" ) package "tyxml" ( requires = "js_of_ocaml-tyxml" ) package "graphics" ( requires = "js_of_ocaml-lwt.graphics" ) package "ocamlbuild" ( requires = "js_of_ocaml-ocamlbuild" ) package "compiler" ( requires = "js_of_ocaml-compiler" ) package "toplevel" ( requires = "js_of_ocaml-toplevel" )js_of_ocaml-3.5.2/Makefile000066400000000000000000000011031357507750000154400ustar00rootroot00000000000000all: dune build @install @default -j 8 tests: dune runtest test runtest runtests: tests doc: dune build @ocsigen-doc promote: dune promote fmt: dune build @fmt --auto-promote 2> /dev/null || true git diff --exit-code clean: dune clean installdoc: rm -rf _wikidoc git clone ./ _wikidoc (cd _wikidoc && git checkout wikidoc) rm -rf _wikidoc/doc/dev/* cp -r _build/default/_doc/_html _wikidoc/doc/dev/api cp -r _build/default/manual _wikidoc/doc/dev/manual find _wikidoc/doc/dev/ -name dune -delete .PHONY: all tests test runtest runtests doc clean installdoc js_of_ocaml-3.5.2/README.md000066400000000000000000000117361357507750000152740ustar00rootroot00000000000000[![Build Status](https://travis-ci.org/ocsigen/js_of_ocaml.svg?branch=master)](https://travis-ci.org/ocsigen/js_of_ocaml) # Js_of_ocaml (jsoo) Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js. * It is easy to install and use as it works with an existing installation of OCaml, with no need to recompile any library. * It comes with bindings for a large part of the browser APIs. * According to our benchmarks, the generated programs runs typically faster than with the OCaml bytecode interpreter. * We believe this compiler will prove much easier to maintain than a retargeted OCaml compiler, as the bytecode provides a very stable API. ## Requirements See [opam](https://github.com/ocsigen/js_of_ocaml/blob/master/js_of_ocaml-compiler.opam) file for version constraints. ### optional * [lwt](https://github.com/ocsigen/lwt) * [tyxml](https://github.com/ocsigen/tyxml) * [reactiveData](https://github.com/ocsigen/reactiveData) * [yojson](https://github.com/mjambon/yojson) ### Toplevel requirements * tyxml, reactiveData * ocp-indent: needed to support indentation in the toplevel * higlo: needed to support Syntax highlighting in the toplevel * cohttp: needed to build the toplevel webserver ## Installation ### Opam ``` opam install js_of_ocaml js_of_ocaml-ppx ``` ### Manual * edit `Makefile.conf` to change the default configuration * run `make all` to compile * run `make install` as root to install the compiler and its libraries * run `make uninstall` as root to uninstall them You can run `make toplevel-examples` if you want to build a Web-based OCaml toplevel as well. [Try the toplevel](http://ocsigen.github.io/js_of_ocaml/) ## Usage Your program must first be compiled using the OCaml bytecode compiler `ocamlc`. JavaScript bindings are provided by the `js_of_ocaml` package. The syntax extension is provided by `js_of_ocaml.syntax` package. ``` ocamlfind ocamlc -package js_of_ocaml -package js_of_ocaml.ppx -linkpkg -o cubes.byte cubes.ml ``` Then, run the `js_of_ocaml` compiler to produce JavaScript code: ``` js_of_ocaml cubes.byte ``` ## Features Most of the OCaml standard library is supported. However, * Weak semantic cannot be implemented using JavaScript. A dummy implementation is provided. * Most of the Sys module is not supported. Extra libraries distributed with OCaml (such as Thread or Str) are not supported in general. However, * Bigarray: bigarrays are supported using Typed Arrays * Num: supported using `+nat.js` option * Graphics: partially supported using canvas (see js_of_ocaml.graphics) * Unix: time related functions are supported Tail call is not optimized in general. However, mutually recursive functions are optimized: * self recursive functions (when the tail calls are the function itself) are compiled using a loop. * trampolines are used otherwise. [More](http://ocsigen.org/js_of_ocaml/dev/manual/tailcall) about tail call optimization. Data representation differs from the usual one. Most notably, integers are 32 bits (rather than 31 bits or 63 bits), which is their natural size in JavaScript, and floats are not boxed. As a consequence, marshalling, polymorphic comparison, and hashing functions can yield results different from usual: * marshalling of floats is not supported (unmarshalling works); * the polymorphic hash function will not give the same results on datastructures containing floats; * these functions may be more prone to stack overflow. ## Toplevel * [OCaml 4.02.3](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.02.3) * [OCaml 4.03.0](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.03.0) * [OCaml 4.04.2](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.04.2) includes Base, Core_kernel, Async_kernel, Async_js * [OCaml 4.04.0+BER](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.04.0+BER) see http://okmij.org/ftp/ML/MetaOCaml.html * [OCaml 4.05.0](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.05.0) includes Base, Core_kernel, Async_kernel, Async_js * [OCaml 4.06.0](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.06.0) includes Base, Core_kernel, Async_kernel, Async_js ## Contents of the distribution | Filename | Description | |----------- |----------------------------------------------| | LICENSE | license and copyright notice | | README | this file | | compiler/ | compiler | | examples/ | small examples | | lib/ | library for interfacing with JavaScript APIs | | ppx/ | ppx syntax extensions | | runtime/ | runtime system | | toplevel/ | web-based OCaml toplevel | | ocamlbuild/ | ocamlbuild plugin for js_of_ocaml | js_of_ocaml-3.5.2/TODO.txt000066400000000000000000000141411357507750000153140ustar00rootroot00000000000000Libraries ========= - object literals {:m = 1; n = "abcd":} : [> `m of int; `n of string] Js.record Js.t ==> usual rule for mapping field names; check for no duplicate. - array literals in particular, heterogeneous arrays... ('a, 'b, 'c) t ??? module Tuple : sig type 'a tuple val e : unit tuple val a : 'a tuple -> 'b -> ('a * 'b) tuple type ('a, 'b) acc val first : ('a * 'b, 'b) acc val next : ('a, 'b) acc -> ('c * 'a, 'b) acc val get : 'a tuple -> ('a, 'b) acc -> 'b val set : 'a tuple -> ('a, 'b) acc -> 'b -> unit end = struct type 'a tuple = 'a let e = () let a x y = (x, y) end <_0: t0; _1: t1; _n: tn> t Benchmarks/examples =================== - polishing - check canvas availability in examples - finish planet (no cpu when not moving / not visible) - take examples from http://shootout.alioth.debian.org/? - planets (+satellites?) ===> Runge-Kutta - 3D effects: http://gyu.que.jp/jscloth/ http://stackoverflow.com/questions/1584854/how-to-draw-3d-sphere Compiler optimizations ====================== - "unsafe" option: no check for division by zero / array access - per module options: we could apply "unsafe" and "inline" options selectively - syntactic sugar for Javascript literal strings + optimization to avoid going through Caml strings - Can we avoid spurious conversions from boolean to integers??? ===> explicit conversion to boolean; specialized "if" that operates on booleans directly - constant hoisting (including functions, out of loops and functions) - inline also partially applied functions - we should check stack compatibility when parsing: when jumping somewhere, the stack should keep the same shape - Improved optimizations ==> cross-function optimizations ==> deadcode elimination inside blocks (for instance, elimination of function which are defined in a functor but are not used) ========================== ========================== Special case for shortcut boolean operations... 1 |\ | \2 | /\ |/ \ 3 4 ========================== MD5 === http://www.myersdaily.org/joseph/javascript/md5-speed-test.html http://code.google.com/p/crypto-js/source/browse/trunk/src/Crypto.js http://bitwiseshiftleft.github.com/sjcl/ Float <-> hex ============= http://babbage.cs.qc.edu/IEEE-754/js/IEEE-754.js http://snippets.dzone.com/posts/show/685 http://jsfromhell.com/classes/binary-parser Filling a string ================ function stringFill3(x, n) { var s = ''; for (;;) { if (n & 1) s += x; n >>= 1; if (n) x += x; else break; } return s; } Conversion string <-> array =========================== http://code.google.com/p/crypto-js/source/browse/trunk/src/Crypto.js Byte array ==> string ===================== int array --map--> string array --join--> string b[i] = toString[a[i]] where toString is a precomputed array of strings Bigint ====== http://www.leemon.com/crypto/BigInt.js ========================== BUGS ==== - ISINT is compiled to "not a block"; document this deviation (or document that we should not rely on the Obj module) PERFORMANCE =========== - should we rebind variables from a deeper level ? (only if used more than once...) var x = ... function () { var y = x; ... y .... y ... y .... } IMPROVEMENTS ============ - be more cautious regarding how we print floats... (is it accurate?) ==> gdtoa http://caml.inria.fr/pub/ml-archives/caml-list/2002/12/2813f8e8be115b0bad1bc16b1e41b744.en.html - explicit conversion from int to boolean - simplify conditional definition should be: Cond of Var.t * cont * cont (we need to eliminate unnecessary conversions from bool to integer for that) NEW FEATURES ============ - Can we use the debugger information to generate specialized code? (Use objects rather than arrays for tuples, ...) DATA REPRESENTATION =================== - should wrap Ocaml exceptions (more robust code)... ==> use Error object as base object, special "message" method DATA ANALYSIS ============= - interprocedural analysis COMPRESSION OPTIMIZATION ======================== - http://timepedia.blogspot.com/2009/08/on-reducing-size-of-compressed.html http://timepedia.blogspot.com/2009/11/traveling-salesman-problem-and.html ==> order functions by similarity ==> 7-zip is better at compressing than gzip, with the same algorithm... DOCUMENTATION ============= document as much as we can: * the representation of datas, closures, ... * the assumption we make regarding the bytecode ==> ISINT ================================ REFERENCES ========== http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/ http://code.google.com/closure/compiler/ http://code.google.com/p/ocamljs/source/browse/#svn/trunk/src Inlining: see Manuel Serrano's paper Resolving and Exploiting the k-CFA Paradox Illuminating Functional vs. Object-Oriented Program Analysis Matthew Might Yannis Smaragdakis David Van Horn ================================== Use window.postMessage instead of setTimeout for yield (setTimeout always waits a bit!) ==> but window.postMessage is synchronous in IE8 + does not cooperate well with other users of message events ================================== Could we generate ocaml bytecode as well? (bytecode optimizer) LLVM code? Targeting JAVA / .net seem harder: not type information... ================================== http://www.pps.jussieu.fr/~montela/ocamil/ Note that the OCamIL compilers and tools are currently based on OCaml v3.06. An upgrade to the latest OCaml version is scheduled for the next release. [Never happened...] ocamldefun (on ocaml_beginners) I'd really like to play around ocamldefun, but it seems to only work with ocaml 3.06. Has anyone had luck setting this up in more recent versions of ocaml? OCamlexc (on caml list) So I was wondering if there is any current or recent projects (or interests) to resume OCamlExc development and complete the set of handled constructs, as I'm afraid I'll have neither the time nor the skills to do the job. js_of_ocaml-3.5.2/VERSION000066400000000000000000000000061357507750000150510ustar00rootroot000000000000003.5.2 js_of_ocaml-3.5.2/api/000077500000000000000000000000001357507750000145565ustar00rootroot00000000000000js_of_ocaml-3.5.2/api/dune000066400000000000000000000000651357507750000154350ustar00rootroot00000000000000(alias (name ocsigen-doc) (deps (alias ../doc))) js_of_ocaml-3.5.2/appveyor.yml000066400000000000000000000005771357507750000164060ustar00rootroot00000000000000# AppVeyor config using https://github.com/Chris00/ocaml-appveyor install: - appveyor DownloadFile "https://raw.githubusercontent.com/Chris00/ocaml-appveyor/master/install_ocaml.cmd" -FileName "C:\install_ocaml.cmd" - C:\install_ocaml.cmd build_script: - cd "%APPVEYOR_BUILD_FOLDER%" - dune build @install @DEFAULT -j 8 artifacts: - path: _build/log name: build-log js_of_ocaml-3.5.2/benchmarks/000077500000000000000000000000001357507750000161225ustar00rootroot00000000000000js_of_ocaml-3.5.2/benchmarks/Makefile000066400000000000000000000132421357507750000175640ustar00rootroot00000000000000# graphs without precompiled programs: GRAPHSNOPR = time.pdf time-optim.pdf nativejs.pdf # graphs with precompiled programs: GRAPHSPR = size.pdf size-optim.pdf compiletime.pdf # For full benchs: all: _perf graphsnopr graphspr _noperf graphsnopr: _noprecomp $(GRAPHSNOPR) graphspr: __precomp $(GRAPHSPR) # For fast benchs: test: _perf fastrun $(GRAPHS) _noperf exes= $(wildcard programs/*) exesnames = $(exes:programs/%=%) missingsizesml = $(exesnames:%=results/sizes/ml/%) missingsizes=$(missingsizesml) missingcompiletimes = $(exesnames:%=results/compiletimes/`hostname`/byte/%) $(exesnames:%=results/compiletimes/`hostname`/opt/%) RUN=dune exec ./run.exe -- REPORT=dune exec ./report.exe -- .PHONY: $(GRAPHSNOPR:.pdf=.svg) $(GRAPHSPR:.pdf=.svg) size.gpl _noprecomp # compile with precompiled programs for creating benchs __precomp: mkdir -p build/byte ln -sf $(exes:%=../../%) build/byte if [ ! -d precomptmp ] ; then $(RUN) -compile ; else cd precomptmp ; find . -type f -exec mv {} ../{} \; ; fi rm -rf precomptmp touch __precomp # for running the test we do not want precompiled programs __run: make _noprecomp $(RUN) -all touch __run fastrun: make _noprecomp echo "======================== WARNING: fast benchs!" $(RUN) -ffast -all touch __run _noprecomp: if [ -f __precomp ] ; \ then \ rm -f __precomp ;\ mkdir -p precomptmp/build/byte ;\ mkdir -p build ;\ mkdir -p results ;\ find build -type d -exec mkdir -p precomptmp/{} \; ;\ find results -type d -exec mkdir -p precomptmp/{} \; ;\ for i in $(exesnames) ; do if [ -f build/byte/$$i ] ; then mv -f build/byte/$$i precomptmp/build/byte/ ; fi ; done ;\ for i in $(exesnames) ; do for j in build/*/$$i.js ; do if [ -f $$j ] ; then mv $$j precomptmp/$$j ; fi ; done ; done ;\ for i in $(exesnames) ; do for j in results/sizes/js_of_ocaml/*/$$i ; do if [ -f $$j ] ; then mv $$j precomptmp/$$j ; fi ; done ; done ;\ for i in $(exesnames) ; do for j in results/sizes/*/$$i ; do if [ -f $$j ] ; then mv $$j precomptmp/$$j ; fi ;done ; done ;\ fi __missingcompiletimes: mkdir -p results/compiletimes/`hostname`/byte/ for i in $(missingcompiletimes) ; do if [ ! -f $$i ] ; then echo 0 > $$i ; fi ; done touch __missingcompiletimes __missingsizes: __precomp for i in $(missingsizes) ; do if [ ! -f $$i ] ; then echo 0 > $$i ; fi ; done if [ -f results/sizes/ml/unison ] ; then echo 828471 > results/sizes/ml/unison ; fi if [ -f results/sizes/ml/ocamlc ] ; then echo 800771 > results/sizes/ml/ocamlc ; fi if [ -f results/sizes/ml/ocsigen_server ] ; then echo 0 > results/sizes/ml/ocsigen_server ; fi if [ -f results/sizes/ml/js_of_ocaml ] ; then echo 171361 > results/sizes/ml/js_of_ocaml ; fi if [ -f results/sizes/ml/boulderdash ] ; then echo 12920 > results/sizes/ml/boulderdash ; fi if [ -f results/sizes/ml/canvas ] ; then echo 740 > results/sizes/ml/canvas ; fi if [ -f results/sizes/ml/cubes ] ; then echo 3773 > results/sizes/ml/cubes ; fi if [ -f results/sizes/ml/minesweeper ] ; then echo 7106 > results/sizes/ml/minesweeper ; fi if [ -f results/sizes/ml/planet ] ; then echo 16488 > results/sizes/ml/planet ; fi if [ -f results/sizes/ml/sudoku ] ; then echo 2837 > results/sizes/ml/sudoku ; fi touch __missingsizes # To generate SVG, we first need to run the benchs, # then to add data for precompiled programs time.svg: __run $(REPORT) -config report-time.config \ -omit binary_trees -omit fannkuch_redux -omit loop \ -max 5.5 -svg 7 500 150 -edgecaption -ylabel "Execution time" \ > $@ size.svg: size.gpl gnuplot < $^ > $@ size.gpl: __run __missingsizes $(REPORT) -config report-size.config \ -omit binary_trees -omit fannkuch_redux -omit loop \ -omit fannkuch_redux_2 \ -omit boyer_no_exc -omit kb_no_exc \ -append boulderdash \ -append canvas \ -append cubes \ -append minesweeper \ -append planet \ -append sudoku \ -append js_of_ocaml \ -append ocsigen_server \ -append ocamlc \ -append unison \ -max 3 -ylabel Size -script \ -svg 7 650 150 \ | perl -pe 'BEGIN{undef $$/;} s/e\nplot/e\nset key at 23.75,1.80\nplot/smg' \ > $@ time-optim.svg: __run $(REPORT) -config report-time-optim.config \ -omit binary_trees -omit fannkuch_redux -omit loop \ -omit fannkuch_redux_2 \ -max 4 -svg 7 400 150 -edgecaption -ylabel "Execution time" \ > $@ size-optim.svg: __run __missingsizes $(REPORT) -config report-size-optim.config \ -omit binary_trees -omit fannkuch_redux -omit loop \ -omit fannkuch_redux_2 \ -omit boyer_no_exc -omit kb_no_exc \ -append boulderdash \ -append canvas \ -append cubes \ -append minesweeper \ -append planet \ -append sudoku \ -append js_of_ocaml \ -append ocsigen_server \ -append ocamlc \ -append unison \ -max 2.5 -svg 7 650 150 -edgecaption -ylabel Size \ > $@ compiletime.svg: __run __precomp __missingcompiletimes $(REPORT) -config report-compiletime.config \ -omit binary_trees -omit fannkuch_redux -omit loop \ -max 2 -svg 7 500 150 -edgecaption -ylabel "Compile time" \ > $@ nativejs.svg: __run $(REPORT) -config report-nativejs.config \ -omit binary_trees -omit fannkuch_redux -omit loop \ -max 2.8 -svg 7 200 150 -edgecaption -ylabel "Execution time" \ > $@ %.pdf: %.svg inkscape -D --export-pdf="$@" -w 210 -h 297 $< _perf: for i in /sys/devices/system/cpu/cpu* ; \ do \ if [ -f $$i/cpufreq/scaling_governor ] ; then \ sudo bash -c "echo performance > $$i/cpufreq/scaling_governor" ; \ fi ; \ done _noperf: for i in /sys/devices/system/cpu/cpu* ; \ do \ if [ -f $$i/cpufreq/scaling_governor ] ; then \ sudo bash -c "echo powersave > $$i/cpufreq/scaling_governor" ; \ fi ; \ done clean: _noperf rm -rf results build __precomp __run *.svg *.pdf *~ precomptmp __missingsizes __missingcompiletimes js_of_ocaml-3.5.2/benchmarks/common.ml000066400000000000000000000171171357507750000177530ustar00rootroot00000000000000(* Js_of_ocaml benchmarks * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open StdLabels let split_on_char ~sep s = let r = ref [] in let j = ref (String.length s) in for i = String.length s - 1 downto 0 do if String.unsafe_get s i = sep then ( r := String.sub s ~pos:(i + 1) ~len:(!j - i - 1) :: !r; j := i) done; String.sub s ~pos:0 ~len:!j :: !r let mean a = let s = ref 0. in for i = 0 to Array.length a - 1 do s := !s +. a.(i) done; !s /. float (Array.length a) let mean_variance a = let m = mean a in let s = ref 0. in for i = 0 to Array.length a - 1 do let d = a.(i) -. m in s := !s +. (d *. d) done; m, !s /. float (Array.length a) (* 90% 95% 98% 99% 99.5% 99.8% 99.9%*) let tinv_table = [| 1, [| 6.314; 12.71; 31.82; 63.66; 127.3; 318.3; 636.6 |] ; 2, [| 2.920; 4.303; 6.965; 9.925; 14.09; 22.33; 31.60 |] ; 3, [| 2.353; 3.182; 4.541; 5.841; 7.453; 10.21; 12.92 |] ; 4, [| 2.132; 2.776; 3.747; 4.604; 5.598; 7.173; 8.610 |] ; 5, [| 2.015; 2.571; 3.365; 4.032; 4.773; 5.893; 6.869 |] ; 6, [| 1.943; 2.447; 3.143; 3.707; 4.317; 5.208; 5.959 |] ; 7, [| 1.895; 2.365; 2.998; 3.499; 4.029; 4.785; 5.408 |] ; 8, [| 1.860; 2.306; 2.896; 3.355; 3.833; 4.501; 5.041 |] ; 9, [| 1.833; 2.262; 2.821; 3.250; 3.690; 4.297; 4.781 |] ; 10, [| 1.812; 2.228; 2.764; 3.169; 3.581; 4.144; 4.587 |] ; 11, [| 1.796; 2.201; 2.718; 3.106; 3.497; 4.025; 4.437 |] ; 12, [| 1.782; 2.179; 2.681; 3.055; 3.428; 3.930; 4.318 |] ; 13, [| 1.771; 2.160; 2.650; 3.012; 3.372; 3.852; 4.221 |] ; 14, [| 1.761; 2.145; 2.624; 2.977; 3.326; 3.787; 4.140 |] ; 15, [| 1.753; 2.131; 2.602; 2.947; 3.286; 3.733; 4.073 |] ; 16, [| 1.746; 2.120; 2.583; 2.921; 3.252; 3.686; 4.015 |] ; 17, [| 1.740; 2.110; 2.567; 2.898; 3.222; 3.646; 3.965 |] ; 18, [| 1.734; 2.101; 2.552; 2.878; 3.197; 3.610; 3.922 |] ; 19, [| 1.729; 2.093; 2.539; 2.861; 3.174; 3.579; 3.883 |] ; 20, [| 1.725; 2.086; 2.528; 2.845; 3.153; 3.552; 3.850 |] ; 21, [| 1.721; 2.080; 2.518; 2.831; 3.135; 3.527; 3.819 |] ; 22, [| 1.717; 2.074; 2.508; 2.819; 3.119; 3.505; 3.792 |] ; 23, [| 1.714; 2.069; 2.500; 2.807; 3.104; 3.485; 3.767 |] ; 24, [| 1.711; 2.064; 2.492; 2.797; 3.091; 3.467; 3.745 |] ; 25, [| 1.708; 2.060; 2.485; 2.787; 3.078; 3.450; 3.725 |] ; 26, [| 1.706; 2.056; 2.479; 2.779; 3.067; 3.435; 3.707 |] ; 27, [| 1.703; 2.052; 2.473; 2.771; 3.057; 3.421; 3.690 |] ; 28, [| 1.701; 2.048; 2.467; 2.763; 3.047; 3.408; 3.674 |] ; 29, [| 1.699; 2.045; 2.462; 2.756; 3.038; 3.396; 3.659 |] ; 30, [| 1.697; 2.042; 2.457; 2.750; 3.030; 3.385; 3.646 |] ; 40, [| 1.684; 2.021; 2.423; 2.704; 2.971; 3.307; 3.551 |] ; 50, [| 1.676; 2.009; 2.403; 2.678; 2.937; 3.261; 3.496 |] ; 60, [| 1.671; 2.000; 2.390; 2.660; 2.915; 3.232; 3.460 |] ; 80, [| 1.664; 1.990; 2.374; 2.639; 2.887; 3.195; 3.416 |] ; 100, [| 1.660; 1.984; 2.364; 2.626; 2.871; 3.174; 3.390 |] ; 120, [| 1.658; 1.980; 2.358; 2.617; 2.860; 3.160; 3.373 |] |] let tinv_row n = let i = ref 1 in let l = Array.length tinv_table in while !i < l && fst tinv_table.(!i) <= n do incr i done; snd tinv_table.(!i - 1) let tinv95 n = (tinv_row n).(1) let tinv98 n = (tinv_row n).(2) let tinv99 n = (tinv_row n).(3) let mean_with_confidence a = let m, v = mean_variance a in let l = Array.length a in m, sqrt v /. sqrt (float l) *. tinv98 (l - 1) let src = "sources" let code = "build" let hostname = Unix.gethostname () let times = Filename.concat "results/times" hostname let sizes = "results/sizes" let compiletimes = Filename.concat "results/compiletimes" hostname module Spec : sig type t val create : string -> string -> t val dir : root:string -> t -> string val file : root:string -> t -> string -> string val no_ext : t -> t val sub_spec : t -> string -> t val find_names : root:string -> t -> string list val ml : t val js : t val byte : t val opt : t val js_of_ocaml : t val ocamljs : t val byte_unsafe : t val opt_unsafe : t val js_of_ocaml_unsafe : t val js_of_ocaml_inline : t val js_of_ocaml_deadcode : t val js_of_ocaml_compact : t val js_of_ocaml_call : t val ocamljs_unsafe : t end = struct type t = { dir : string ; ext : string } let create dir ext = { dir; ext } let no_ext { dir; _ } = { dir; ext = "" } let file ~root { dir; ext } nm = Format.sprintf "%s/%s/%s%s" root dir nm ext let dir ~root { dir; _ } = Format.sprintf "%s/%s" root dir let sub_spec { dir; ext } loc = { dir = Format.sprintf "%s/%s" dir loc; ext } let find_names ~root spec = let dir = dir ~root spec in Sys.readdir dir |> Array.to_list |> List.filter ~f:(fun nm -> let open Unix in match stat (dir ^ "/" ^ nm) with | { st_kind = S_REG | S_LNK; _ } -> true | _ -> false) |> (if spec.ext = "" then fun x -> x else fun x -> x |> List.filter ~f:(fun nm -> Filename.check_suffix nm spec.ext) |> List.map ~f:Filename.chop_extension) |> List.sort ~cmp:compare let ml = create "ml" ".ml" let js = create "js" ".js" let byte = create "byte" "" let opt = create "opt" "" let js_of_ocaml = create "js_of_ocaml" ".js" let ocamljs = create "ocamljs" ".js" let byte_unsafe = create "unsafe/byte" "" let opt_unsafe = create "unsafe/opt" "" let js_of_ocaml_unsafe = create "unsafe/js_of_ocaml" ".js" let js_of_ocaml_inline = create "noinline" ".js" let js_of_ocaml_deadcode = create "nodeadcode" ".js" let js_of_ocaml_compact = create "notcompact" ".js" let js_of_ocaml_call = create "nooptcall" ".js" let ocamljs_unsafe = create "unsafe/ocamljs" ".js" end let rec mkdir d = if not (Sys.file_exists d) then ( mkdir (Filename.dirname d); Unix.mkdir d 0o777) let need_update src dst = try let d = Unix.stat dst in d.Unix.st_kind <> Unix.S_REG || let s = Unix.stat src in d.Unix.st_mtime < s.Unix.st_mtime with Unix.Unix_error (Unix.ENOENT, _, _) -> true let measures_need_update code meas spec nm = let p = Spec.file ~root:code spec nm in let m = Spec.file ~root:meas (Spec.no_ext spec) nm in need_update p m let read_measures meas spec nm = let m = Spec.file ~root:meas (Spec.no_ext spec) nm in let l = ref [] in if Sys.file_exists m then ( let ch = open_in m in (try while true do l := float_of_string (input_line ch) :: !l done with End_of_file -> ()); close_in ch; !l) else [] let write_measures meas spec nm l = let m = Spec.file ~root:meas (Spec.no_ext spec) nm in let tmp = Spec.file ~root:meas (Spec.no_ext spec) "_tmp_" in mkdir (Spec.dir ~root:meas spec); let ch = open_out tmp in List.iter ~f:(fun t -> Printf.fprintf ch "%f\n" t) (List.rev l); close_out ch; Sys.rename tmp m js_of_ocaml-3.5.2/benchmarks/dune000066400000000000000000000001541357507750000170000ustar00rootroot00000000000000(executables (names report run) (libraries unix) ) (alias (name default) (deps report.exe run.exe))js_of_ocaml-3.5.2/benchmarks/report-compiletime.config000066400000000000000000000006321357507750000231320ustar00rootroot00000000000000histogram compiletimes "" opt #729fcf ocamlopt histogram compiletimes "" byte #204a87 ocamlc histogramref compiletimes "" js_of_ocaml #d98e2d js_of_ocaml histogram compiletimes "" nodeadcode #fb3f00 No deadcode elimination histogram compiletimes "" noinline #fb7f1f No inlining histogram compiletimes "" nooptcall #a75f0c No call optimisation histogram compiletimes "" notcompact #fb5f0f No compact expression js_of_ocaml-3.5.2/benchmarks/report-js.config000066400000000000000000000001631357507750000212360ustar00rootroot00000000000000histogramref times node js_of_ocaml #d98e2d compiled to JS (node) histogram times node js #d9112d native JS (node) js_of_ocaml-3.5.2/benchmarks/report-nativejs.config000066400000000000000000000001631357507750000224450ustar00rootroot00000000000000histogram times node js #775588 native JS (node) histogramref times node js_of_ocaml #fbaf4f compiled to JS (node) js_of_ocaml-3.5.2/benchmarks/report-size-optim.config000066400000000000000000000005221357507750000227210ustar00rootroot00000000000000#histogram sizes "" unsafe/js_of_ocaml #fb9f3f Unsafe histogramref sizes "" js_of_ocaml/generated #fbaf4f Default #histogram sizes "" nooptcall #a75f0c no optimization of calls histogram sizes "" noinline #d98e2d no inlining histogram sizes "" notcompact #a75f0c no compact code histogram sizes "" nodeadcode #752d09 no dead code removal js_of_ocaml-3.5.2/benchmarks/report-size.config000066400000000000000000000003461357507750000215770ustar00rootroot00000000000000histogram sizes "" ml #83afdf Source histogram sizes "" byte #204a87 Bytecode histogramref sizes "" js_of_ocaml/full #371f00 Runtime histogram blank histogram blank histogram sizes "" js_of_ocaml/generated #fbaf4f Generated code js_of_ocaml-3.5.2/benchmarks/report-time-optim.config000066400000000000000000000002471357507750000227110ustar00rootroot00000000000000histogramref times node js_of_ocaml #fbaf4f default histogram times node unsafe/js_of_ocaml #d98e2d unsafe histogram times node nooptcall #a75f0c No call optimisation js_of_ocaml-3.5.2/benchmarks/report-time.config000066400000000000000000000002641357507750000215620ustar00rootroot00000000000000histogram times "" opt #729fcf ocamlopt histogram times "" byte #204a87 ocamlc histogramref times node js_of_ocaml #fbaf4f node histogram times sm js_of_ocaml #fb4f4f SpiderMonkey js_of_ocaml-3.5.2/benchmarks/report.ml000077500000000000000000000264331357507750000200020ustar00rootroot00000000000000(* Js_of_ocaml benchmarks * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open StdLabels open Common let reference = ref None let nreference = ref (-1) let maximum = ref (-1.) let gnuplot = ref true let table = ref false let omitted = ref [] let appended = ref [] let errors = ref false let script = ref false let conf = ref "report.config" let svg = ref false let svgfontsize = ref 7 let svgwidth = ref 500 let svgheight = ref 150 let edgecaption = ref false let ylabel = ref "" let rec merge f l1 l2 = match l1, l2 with | [], _ | _, [] -> [] | (n1, v1) :: r1, (n2, v2) :: r2 -> if n1 < n2 then merge f r1 l2 else if n1 > n2 then merge f l1 r2 else (n1, f v1 v2) :: merge f r1 r2 let merge_blank = List.map ~f:(fun (n2, v2) -> n2, (0.0, 0.0) :: v2) let read_column ?title ?color meas spec refe = let l = List.map (Spec.find_names ~root:meas (Spec.no_ext spec)) ~f:(fun nm -> let l = read_measures meas spec nm in let a = Array.of_list l in let m, i = mean_with_confidence a in nm, [ m, i ]) in let nm = match title with | Some nm -> nm | None -> Spec.dir ~root:meas (Spec.no_ext spec) in if refe then reference := Some l; Some ([ Some (nm, color) ], l) let read_blank_column () = None let rec list_create n a = if n = 0 then [] else a :: list_create (n - 1) a let merge_columns l old_table = let rec aux = function | [] | [ None ] -> [], [] | [ Some c ] -> c | Some (h, c) :: r -> let h', t = aux r in h @ h', merge (fun v1 v2 -> v1 @ v2) c t | None :: r -> let h', t = aux r in (*VVV utile ? *) None :: h', merge_blank t in let rec remove_head_blank = function | None :: l -> let n, ll = remove_head_blank l in n + 1, ll | l -> 0, l in let add_blanks n (h, t) = if n = 0 then h, t else let zeros = list_create n (0.0, 0.0) in (*VVV utile ? *) let nodisplays = list_create n None in h @ nodisplays, List.map t ~f:(fun (a, l) -> a, l @ zeros) in (* if there was an old table, we keep only the lines corresponding to entries in that table *) let l = match l, old_table with | [], _ -> [] | _, None -> l | Some (h, c) :: ll, Some o -> Some (h, merge (fun v1 _v2 -> v1) c o) :: ll | None :: ll, Some o -> Some ([ None ], List.map o ~f:(fun (nm, _) -> nm, [ 0.0, 0.0 ])) :: ll in let nb_blanks, l = remove_head_blank (List.rev l) in let l = List.rev l in add_blanks nb_blanks (aux l) let normalize (h, t) = match !reference with | None -> h, t | Some rr -> ( h , List.map t ~f:(fun (nm, l) -> let r, _ = List.hd (List.assoc nm rr) in if r <> r then ( Format.eprintf "No reference available for '%s'@." nm; exit 1); nm, List.map l ~f:(fun (v, i) -> v /. r, i /. r)) ) let stats (h, t) = for i = 0 to List.length h - 1 do match List.nth h i with | Some (nm, _) -> let l = List.map t ~f:(fun (_, l) -> fst (List.nth l i)) in let a = Array.of_list l in Array.sort a ~cmp:compare; let p = List.fold_right l ~f:(fun x p -> x *. p) ~init:1. in Format.eprintf "%s:@. %f %f@." nm (p ** (1. /. float (List.length l))) a.(Array.length a / 2) | None -> () done let text_output _no_header (h, t) = Format.printf "-"; List.iter h ~f:(fun v -> let nm = match v with | Some (nm, _) -> nm | None -> "" in Format.printf " - \"%s\"" nm); Format.printf "@."; List.iter t ~f:(fun (nm, l) -> Format.printf "%s" nm; List.iter l ~f:(fun (m, i) -> Format.printf " %f %f" m i); Format.printf "@.") let gnuplot_output ch no_header (h, t) = let n = List.length (snd (List.hd t)) in if not no_header then ( if !svg then Printf.fprintf ch "set terminal svg size %d %d font 'Arial,%d'\n" !svgfontsize !svgwidth !svgheight; if !edgecaption then Printf.fprintf ch "set key tmargin horizontal Left left reverse\n"; Printf.fprintf ch "set multiplot\n\ set style data histograms\n\ set style fill solid 1 border rgb 'black'\n\ set style histogram errorbars gap 1%s\n\ set xtics border in scale 0,0 nomirror rotate by -30 offset character 0, 0, 0\n" (if !errors then " lw 1" else ""); if !ylabel <> "" then Printf.fprintf ch "set ylabel \"%s\"\n" !ylabel; if !maximum > 0. then Printf.fprintf ch "set yrange [0:%f]\n" !maximum else Printf.fprintf ch "set yrange [0:]\n"); (* labels *) for i = 0 to n - 1 do let nn = ref 0. in List.iter t ~f:(fun (_nm, l) -> let v, _ii = List.nth l i in if !maximum > 0. && v > !maximum then Printf.fprintf ch "set label font \",5\" \"%.2f\" at %f,%f center\n" v (!nn +. (float i /. float n) -. 0.5) (* why? *) ((!maximum *. 1.04) +. 0.1); nn := !nn +. 1.) done; Printf.fprintf ch "plot"; for i = 0 to n - 1 do match List.nth h i with | Some (_, col) -> ( if i > 0 then Printf.fprintf ch ", \"-\" using 2:3 title columnhead lw 0" else Printf.fprintf ch " \"-\" using 2:3:xtic(1) title columnhead lw 0"; match col with | Some c -> Printf.fprintf ch " lc rgb '%s'" c | None -> ()) | None -> if i > 0 then Printf.fprintf ch ", \"-\" using 2:3 title columnhead lw 0" else Printf.fprintf ch " \"-\" using 2:3:xtic(1) title columnhead lw 0" (* notitle does not work ... I don't know why ... *) done; Printf.fprintf ch "\n"; for i = 0 to n - 1 do let nm = match List.nth h i with | Some (nm, _) -> nm | None -> "" in Printf.fprintf ch "- - \"%s\"\n" nm; List.iter t ~f:(fun (nm, l) -> let v, ii = List.nth l i in Printf.fprintf ch "\"%s\" %f %f\n" nm v (if ii <> ii then 0. else ii)); Printf.fprintf ch "e\n" done let filter (h, t) = let l1 = List.filter t ~f:(fun (nm, _) -> not (List.mem nm ~set:!appended || List.mem nm ~set:!omitted)) in let app = List.fold_left !appended ~init:[] ~f:(fun beg nm -> try (nm, List.assoc nm t) :: beg with Not_found -> beg) in h, l1 @ app let output_table = let old_table = ref None in fun _r (l : ((string * 'a option) option list * _) option list) f -> let t = merge_columns l !old_table in old_table := Some (snd t); let t = filter t in let t = normalize t in stats t; f t let output_tables r conf = let output_function, close = if !table then text_output, fun () -> () else if !script then gnuplot_output stdout, fun () -> () else let ch = Unix.open_process_out "gnuplot -persist" in gnuplot_output ch, fun () -> close_out ch in let no_header = ref false in List.iter conf ~f:(fun conf -> output_table r (List.map conf ~f:(function | None -> read_blank_column () | Some (dir1, dir2, color, title, refe) -> read_column ~title ~color dir1 (Spec.create dir2 "") refe)) (output_function !no_header); no_header := true); close () let read_config () = let f = !conf in if not (Sys.file_exists f) then ( Format.eprintf "Configuration file '%s' not found!@." f; exit 1); let fullinfo = ref [] in let info = ref [] in let i = ref 0 in let reference = ref false in let ch = open_in f in let split_at_space l = try let i = String.index l ' ' in String.sub l ~pos:0 ~len:i, String.sub l ~pos:(i + 1) ~len:(String.length l - i - 1) with Not_found -> l, "" in let get_info dir0 rem refe = let dir1, rem = split_at_space rem in let dir2, rem = split_at_space rem in let color, title = split_at_space rem in let dir1 = if dir1 = "\"\"" then dir0 else dir0 ^ "/" ^ dir1 in info := Some (dir1, dir2, color, title, refe) :: !info in (try while true do let l = input_line ch in if String.length l = 0 then ( if !info <> [] then ( fullinfo := List.rev !info :: !fullinfo; info := []; i := 0)) else if l.[0] <> '#' then ( incr i; reference := !nreference = !i; let kind, rem = split_at_space l in let kind2, rem = split_at_space rem in (match kind with | "histogram" -> () | "histogramref" -> if !nreference = -1 then reference := true | _ -> Format.eprintf "Unknown config options '%s'@." kind; exit 1); match kind2 with | "blank" -> info := None :: !info | "times" -> get_info times rem !reference | "compiletimes" -> get_info compiletimes rem !reference | "sizes" -> get_info sizes rem !reference | _ -> Format.eprintf "Unknown config options '%s'@." kind2; exit 1) done with End_of_file -> ()); close_in ch; if !info <> [] then fullinfo := List.rev !info :: !fullinfo; !reference, List.rev !fullinfo let _ = let options = [ "-ref", Arg.Set_int nreference, " use column as the baseline" ; "-max", Arg.Set_float maximum, " truncate graph at level " ; "-table", Arg.Set table, " output a text table" ; ( "-omit" , Arg.String (fun s -> omitted := split_on_char s ~sep:',' @ !omitted) , " omit the given benchmark" ) ; ( "-append" , Arg.String (fun s -> appended := split_on_char s ~sep:',' @ !appended) , " append the given benchmark at the end" ) ; "-errors", Arg.Set errors, " display error bars" ; "-config", Arg.Set_string conf, " use as a config file" ; "-script", Arg.Set script, " output gnuplot script" ; ( "-svg" , Arg.Tuple [ Arg.Set svg ; Arg.Set_int svgfontsize ; Arg.Set_int svgwidth ; Arg.Set_int svgheight ] , " svg output" ) ; "-edgecaption", Arg.Set edgecaption, " display caption outside the diagram" ; "-ylabel", Arg.Set_string ylabel, " Y axis label" ] in Arg.parse (Arg.align options) (fun s -> raise (Arg.Bad (Format.sprintf "unknown option `%s'" s))) (Format.sprintf "Usage: %s [options]" Sys.argv.(0)); let r, conf = read_config () in output_tables r conf (* http://hacks.mozilla.org/2009/07/tracemonkey-overview/ http://weblogs.mozillazine.org/bz/archives/020732.html *) js_of_ocaml-3.5.2/benchmarks/run.config000066400000000000000000000003141357507750000201130ustar00rootroot00000000000000#Node: apt-get install nodejs interpreter node /usr/bin/node # #SpiderMonkey: apt-get install libmozjs-52-dev interpreter sm /usr/bin/js52 -f # #interpreter v8 #interpreter nitro #interpreter tracemonkey js_of_ocaml-3.5.2/benchmarks/run.ml000077500000000000000000000241541357507750000172710ustar00rootroot00000000000000(* Js_of_ocaml benchmarks * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open StdLabels open Common module Param = struct type t = { warm_up_time : float ; min_measures : int ; max_confidence : float ; max_duration : float ; verbose : bool } let default = { warm_up_time = 1.0 ; min_measures = 10 ; max_confidence = 0.03 ; max_duration = 5. ; verbose = false } let fast x = { x with min_measures = 5; max_confidence = 0.15 } let ffast x = { x with min_measures = 2; max_confidence = 42. } let verbose x = { x with verbose = true } end let run_command ~verbose cmd = if verbose then Format.printf "+ %s@." cmd; match Unix.system cmd with | Unix.WEXITED res when res <> 0 -> failwith (Printf.sprintf "Command '%s' failed with exit code %d." cmd res) | Unix.WSIGNALED s -> failwith (Format.sprintf "Command '%s' killed with signal %d." cmd s) | _ -> () let time ~verbose cmd = let t1 = (Unix.times ()).Unix.tms_cutime in run_command ~verbose cmd; let t2 = (Unix.times ()).Unix.tms_cutime in t2 -. t1 let compile_gen (param : Param.t) ~comptime prog src_dir (src_spec : Spec.t) dst_dir dst_spec = mkdir (Spec.dir ~root:dst_dir dst_spec); List.iter (Spec.find_names ~root:src_dir src_spec) ~f:(fun nm -> let src = Spec.file ~root:src_dir src_spec nm in let dst = Spec.file ~root:dst_dir dst_spec nm in if need_update src dst then let cmd = prog ~src ~dst in try if comptime then write_measures compiletimes dst_spec nm [ time ~verbose:param.verbose cmd ] else run_command ~verbose:param.verbose cmd with Failure s -> Format.eprintf "Failure: %s@." s) let compile param ~comptime prog = compile_gen param ~comptime (fun ~src ~dst -> Printf.sprintf "%s %s -o %s" prog src dst) (****) let need_more ~print (param : Param.t) l = let a = Array.of_list l in let n = Array.length a in if n = 0 then true else let m, i = mean_with_confidence a in if print then Format.eprintf "==> %f +/- %f / %f %d\r%!" m i (i /. m) n; n < param.min_measures || i /. m > param.max_confidence /. 2. let warm_up (param : Param.t) cmd = let t = ref 0. in while !t < param.warm_up_time do let t' = time ~verbose:param.verbose cmd in if t' > param.max_duration then failwith (Printf.sprintf "Warmup took too long %.1fs" t'); t := !t +. t' done let rec measure_rec ~print (param : Param.t) cmd l = let t = time ~verbose:param.verbose cmd in let l = t :: l in if need_more ~print param l then measure_rec ~print param cmd l else l let measure_one param code meas spec nm cmd = let l = if measures_need_update code meas spec nm then [] else read_measures meas spec nm in if need_more ~print:false param l then ( Format.eprintf "warming up ...\r%!"; warm_up param cmd; let l = measure_rec ~print:true param cmd l in write_measures meas spec nm l; Format.eprintf "\n%!"; l) else l let measure param code meas spec cmd = List.iter (Spec.find_names ~root:code spec) ~f:(fun nm -> let cmd = if cmd = "" then cmd else cmd ^ " " in let cmd = Format.sprintf "%s%s" cmd (Spec.file ~root:code spec nm) in Format.eprintf "Measure %s@." cmd; try ignore (measure_one param code meas spec nm cmd) with Failure s -> Format.eprintf "Failure: %s@." s) (****) let compile_no_ext param ~comptime prog src_dir src_spec dst_dir dst_spec = compile_gen param ~comptime prog src_dir src_spec dst_dir (Spec.no_ext dst_spec) let ml_size param = compile_no_ext param ~comptime:false (fun ~src ~dst -> Format.sprintf "perl ./utils/remove_comments.pl %s | sed 's/^ *//g' | wc -c > %s" src dst) let file_size param = compile_no_ext param ~comptime:false (fun ~src ~dst -> Format.sprintf "wc -c < %s > %s" src dst) let compr_file_size param = compile_no_ext param ~comptime:false (fun ~src ~dst -> Format.sprintf "sed 's/^ *//g' %s | gzip -c | wc -c > %s" src dst) (* let runtime_size = *) (* compile_no_ext ~comptime:false (Format.sprintf "head -n -1 %s | wc -c > %s") *) let gen_size param = compile_no_ext param ~comptime:false (fun ~src ~dst -> Format.sprintf "tail -1 %s | wc -c > %s" src dst) (****) let read_config file = if not (Sys.file_exists file) then ( Format.eprintf "Configuration file '%s' not found!@." file; exit 1); let i = ref [] in let ch = open_in file in (try while true do let line = String.trim (input_line ch) in if line.[0] <> '#' then match List.filter ~f:(function | "" -> false | _ -> true) (split_on_char line ~sep:' ') with | "interpreter" :: nm :: rem -> i := (String.concat ~sep:" " rem, nm) :: !i | [ "interpreter" ] -> Format.eprintf "Malformed config option '%s'@." line; exit 1 | kind :: _ -> Format.eprintf "Unknown config option '%s'@." kind; exit 1 | [] -> Format.eprintf "Bad config line '%s'@." line; exit 1 done with End_of_file -> ()); close_in ch; List.rev !i let _ = let compile_only = ref false in let full = ref false in let conf_file = ref "run.config" in let do_ocamljs = ref true in let nobyteopt = ref false in let param = ref Param.default in let fast_run () = param := Param.fast !param in let ffast_run () = param := Param.ffast !param in let verbose () = param := Param.verbose !param in let options = [ "-compile", Arg.Set compile_only, " only compiles" ; "-all", Arg.Set full, " run all benchmarks" ; "-config", Arg.Set_string conf_file, " use as a config file" ; "-fast", Arg.Unit fast_run, " perform less iterations" ; "-ffast", Arg.Unit ffast_run, " perform very few iterations" ; "-verbose", Arg.Unit verbose, " verbose" ; "-noocamljs", Arg.Clear do_ocamljs, " do not run ocamljs" ; ( "-nobyteopt" , Arg.Set nobyteopt , " do not run benchs on bytecode and native programs" ) ] in Arg.parse (Arg.align options) (fun s -> raise (Arg.Bad (Format.sprintf "unknown option `%s'" s))) (Format.sprintf "Usage: %s [options]" Sys.argv.(0)); let run_ocamljs = !do_ocamljs && Sys.command "ocamljs 2> /dev/null" = 0 in let conf_file = !conf_file in let compile_only = !compile_only in let nobyteopt = !nobyteopt in let full = !full in let param = !param in let interpreters = read_config conf_file in let compile = compile param ~comptime:true in let compile_jsoo opts = compile (Format.sprintf "js_of_ocaml -q %s" opts) in Format.eprintf "Compile@."; compile "ocamlc" src Spec.ml code Spec.byte; compile "ocamlopt" src Spec.ml code Spec.opt; compile_jsoo "" code Spec.byte code Spec.js_of_ocaml; compile_jsoo "--disable inline" code Spec.byte code Spec.js_of_ocaml_inline; compile_jsoo "--disable deadcode" code Spec.byte code Spec.js_of_ocaml_deadcode; compile_jsoo "--disable compact" code Spec.byte code Spec.js_of_ocaml_compact; compile_jsoo "--disable optcall" code Spec.byte code Spec.js_of_ocaml_call; if run_ocamljs then compile "ocamljs" src Spec.ml code Spec.ocamljs; compile "ocamlc -unsafe" src Spec.ml code Spec.byte_unsafe; compile "ocamlopt" src Spec.ml code Spec.opt_unsafe; compile_jsoo "" code Spec.byte_unsafe code Spec.js_of_ocaml_unsafe; if run_ocamljs then compile "ocamljs -unsafe" src Spec.ml code Spec.ocamljs_unsafe; Format.eprintf "Sizes@."; ml_size param src Spec.ml sizes Spec.ml; file_size param code Spec.byte sizes Spec.byte; file_size param code Spec.js_of_ocaml sizes (Spec.sub_spec Spec.js_of_ocaml "full"); compr_file_size param code Spec.js_of_ocaml sizes (Spec.sub_spec Spec.js_of_ocaml "gzipped"); (* runtime_size param code Spec.js_of_ocaml sizes (Spec.sub_spec Spec.js_of_ocaml "runtime"); *) gen_size param code Spec.js_of_ocaml sizes (Spec.sub_spec Spec.js_of_ocaml "generated"); gen_size param code Spec.js_of_ocaml_inline sizes Spec.js_of_ocaml_inline; gen_size param code Spec.js_of_ocaml_deadcode sizes Spec.js_of_ocaml_deadcode; gen_size param code Spec.js_of_ocaml_compact sizes Spec.js_of_ocaml_compact; gen_size param code Spec.js_of_ocaml_call sizes Spec.js_of_ocaml_call; if run_ocamljs then compr_file_size param code Spec.ocamljs sizes Spec.ocamljs; if compile_only then exit 0; Format.eprintf "Measure@."; if not nobyteopt then ( measure param code times Spec.opt ""; measure param code times Spec.byte ""); let compilers, suites = if full then ( interpreters , [ Some Spec.js_of_ocaml ; Some Spec.js_of_ocaml_unsafe ; Some Spec.js_of_ocaml_inline ; Some Spec.js_of_ocaml_deadcode ; Some Spec.js_of_ocaml_compact ; Some Spec.js_of_ocaml_call ; (if run_ocamljs then Some Spec.ocamljs else None) ; (if run_ocamljs then Some Spec.ocamljs_unsafe else None) ] ) else ( (match interpreters with | i :: _ -> [ i ] | [] -> []) , [ Some Spec.js_of_ocaml ] ) in List.iter compilers ~f:(fun (comp, dir) -> measure param src (Filename.concat times dir) Spec.js comp; List.iter suites ~f:(function | None -> () | Some suite -> measure param code (Filename.concat times dir) suite comp)) js_of_ocaml-3.5.2/benchmarks/sources/000077500000000000000000000000001357507750000176055ustar00rootroot00000000000000js_of_ocaml-3.5.2/benchmarks/sources/js/000077500000000000000000000000001357507750000202215ustar00rootroot00000000000000js_of_ocaml-3.5.2/benchmarks/sources/js/bdd.js000066400000000000000000000143331357507750000213140ustar00rootroot00000000000000// (***********************************************************************) // (* *) // (* Objective Caml *) // (* *) // (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) // (* *) // (* Copyright 1996 Institut National de Recherche en Informatique et *) // (* en Automatique. All rights reserved. This file is distributed *) // (* under the terms of the Q Public License version 1.0. *) // (* *) // (***********************************************************************) // Transaltion to js by VB // (* Translated to Caml by Xavier Leroy *) // (* Original code written in SML by ... *) //var sys = require('sys'); function arr(size,v) { var t = []; for (var i=0; i < size; i++) t[i] = v; return t; } function arr2(size) { var t = []; for (var i=0; i < size; i++) t[i] = []; return t; } function eval2(bdd, vars) { switch (bdd.id) { case 0: return false; case 1: return true; default: return vars[bdd.v]?eval2(bdd.h,vars):eval2(bdd.l,vars); } } function getId(bdd) { return bdd.id; }; var initSize_1 = 8*1024 - 1; var nodeC = 1; var sz_1 = initSize_1; var htab = arr2(sz_1+1); var n_items = 0; function hashVal(x,y,v) { return ((x << 1) + y + (v << 2)); }; function resize(newSize) { var newSz_1 = newSize-1; var newArr = arr2(newSize); for (var i = 0; i <= sz_1; i++) { var b = htab[i]; for (var j = 0; j < b.length; j++) { var n = b[j]; var ind = hashVal(getId(n.l), getId(n.h), n.v) & newSz_1; newArr[ind].push(n); } } htab = newArr; sz_1 = newSz_1; } function insert(idl,idh,v,ind,bucket,newNode) { if (n_items <= sz_1) { htab[ind].push(newNode); n_items ++; } else { resize(sz_1 + sz_1 + 2); ind = hashVal(idl,idh,v) & sz_1; htab[ind].push(newNode); }; }; function mkNode(low,v,high) { var idl = getId(low); var idh = getId(high); if (idl == idh) return low; else { var ind = hashVal(idl,idh,v) & sz_1; var bucket = htab[ind]; for (i = 0; i < bucket.length; i++) { var n = bucket[i]; if ((v == n.v) && (idl == getId(n.l)) && (idh == getId(n.h))) return n; } nodeC ++; var nn = {l:low, v:v, id:nodeC, h:high}; insert(getId(low),getId(high),v,ind,bucket,nn); return nn; }; }; function cmpVar(x,y) { if (xy) { return 1; } else return 0; }; var zero = {id:0} var one = {id:1} function mkVar(xx) { return mkNode(zero,xx,one); }; var cacheSize = 1999; var andslot1 = arr(cacheSize,0); var andslot2 = arr(cacheSize,0); var andslot3 = arr(cacheSize,zero); var xorslot1 = arr(cacheSize,0); var xorslot2 = arr(cacheSize,0); var xorslot3 = arr(cacheSize,zero); var notslot1 = arr(cacheSize,0); var notslot2 = arr(cacheSize,one); function hash(x,y) { return (((x << 1)+y) % cacheSize); }; function not(n) { var id = n.id; switch (id) { case 0: return one; case 1: return zero; default: var h = id % cacheSize; if (id == notslot1[h]) { return notslot2[h]; } else { var f = mkNode(not(n.l),n.v,not(n.h)); notslot1[h] = id; notslot2[h] = f; return f; }; }; }; function and2(n1,n2) { var i1 = n1.id; switch (i1) { case 0: return zero; case 1: return n2; default: var i2 = n2.id; switch (i2) { case 0: return zero; case 1: return n1; default: var h = hash(i1,i2); if ((i1 == andslot1[h]) && (i2 == andslot2[h])) { return andslot3[h]; } else { var f; switch (cmpVar(n1.v,n2.v)) { case 0: f = mkNode(and2(n1.l,n2.l),n1.v,and2(n1.h,n2.h)); break; case -1: f = mkNode(and2(n1.l,n2),n1.v,and2(n1.h,n2)); break; default: f = mkNode(and2(n1,n2.l),n2.v,and2(n1,n2.h)); break; }; andslot1[h] = i1; andslot2[h] = i2; andslot3[h] = f; return f; } } } } function xor(n1,n2) { var i1 = n1.id; switch (i1) { case 0: return n2; case 1: return not(n2); default: var i2 = n2.id; switch (i2) { case 0: return n1; case 1: return not(n1); default: var h = hash(i1,i2); if ((i1 == andslot1[h]) && (i2 == andslot2[h])) { return andslot3[h]; } else { var f; switch (cmpVar(n1.v,n2.v)) { case 0: f = mkNode(xor(n1.l,n2.l),n1.v,xor(n1.h,n2.h)); break; case -1: f = mkNode(xor(n1.l,n2),n1.v,xor(n1.h,n2)); break; default: f = mkNode(xor(n1,n2.l),n2.v,xor(n1,n2.h)); break; }; andslot1[h] = i1; andslot2[h] = i2; andslot3[h] = f; return f; } } } } function hwb(n) { function h(i,j) { if (i==j) { return mkVar(i); } else { return xor(and2(not(mkVar(j)),h(i,j-1)), and2(mkVar(j),g(i,j-1))); }; }; function g(i,j) { if (i==j) { return mkVar(i); } else { return xor(and2(not(mkVar(i)),h(i+1,j)), and2(mkVar(i),g(i+1,j))); }; }; return h(0,n-1); }; /* Testing */ var seed = 0; function random() { seed = (seed * 25173 + 17431)|0; return (seed & 1) > 0; }; function random_vars(n) { var vars = []; for (var i = 0; i < n; i++) vars[i] = random(); return vars; }; function test_hwb(bdd,vars) { /* We should have eval bdd vars = vars.(n-1) if n > 0 eval bdd vars = false if n = 0 where n is the number of "true" elements in vars. */ var ntrue = 0; for (var i = 0; i < vars.length; i++) { if (vars[i]) ntrue++; }; return (eval2(bdd,vars) == ((ntrue > 0) ? vars[ntrue-1] : false)) }; var n = 22; var ntests = 100; var bdd = hwb(n); var succeeded = true; for (var i = 1; i <= ntests; i++) { succeeded = succeeded && test_hwb(bdd,random_vars(n)); }; //print(nodeC); //if (succeeded) print("ok"); else print("failed"); js_of_ocaml-3.5.2/benchmarks/sources/js/bdd_lists.js000066400000000000000000000146201357507750000225310ustar00rootroot00000000000000// (***********************************************************************) // (* *) // (* Objective Caml *) // (* *) // (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) // (* *) // (* Copyright 1996 Institut National de Recherche en Informatique et *) // (* en Automatique. All rights reserved. This file is distributed *) // (* under the terms of the Q Public License version 1.0. *) // (* *) // (***********************************************************************) // Transaltion to js by VB // (* Translated to Caml by Xavier Leroy *) // (* Original code written in SML by ... *) //var sys = require('sys'); function arr(size,v) { var t = []; for (var i=0; i < size; i++) t[i] = v; return t; } function eval2(bdd, vars) { switch (bdd.id) { case 0: return false; case 1: return true; default: return vars[bdd.v]?eval2(bdd.h,vars):eval2(bdd.l,vars); } } function getId(bdd) { return bdd.id; }; var initSize_1 = 8*1024 - 1; var nodeC = 1; var sz_1 = initSize_1; var htab = new Array(sz_1+1); var n_items = 0; function hashVal(x,y,v) { return ((x << 1) + y + (v << 2)); }; function resize(newSize) { var arr = htab; var newSz_1 = newSize-1; var newArr = []; function copyBucket(bucket) { if (bucket) { var n = bucket.head; var ind = hashVal(getId(n.l), getId(n.h), n.v) & newSz_1; newArr[ind] = {head: n, tail: newArr[ind]}; copyBucket(bucket.tail); }; }; for (var n = 0; n <= sz_1; n++) { copyBucket(arr[n]); } htab = newArr; sz_1 = newSz_1; } function insert(idl,idh,v,ind,bucket,newNode) { if (n_items <= sz_1) { htab[ind] = {head: newNode, tail: bucket}; n_items ++; } else { resize(sz_1 + sz_1 + 2); ind = hashVal(idl,idh,v) & sz_1; htab[ind] = {head: newNode, tail: htab[ind]}; }; }; function mkNode(low,v,high) { var idl = getId(low); var idh = getId(high); if (idl == idh) return low; else { var ind = hashVal(idl,idh,v) & sz_1; var bucket = htab[ind]; function lookup(b) { if (!b) { nodeC ++; var nn = {l:low, v:v, id:nodeC, h:high}; insert(getId(low),getId(high),v,ind,bucket,nn); return nn; } else { var n = b.head; if ((v == n.v) && (idl == getId(n.l)) && (idh == getId(n.h))) { return n; } else { return lookup(b.tail); }; }; }; return lookup(bucket); }; }; function cmpVar(x,y) { if (xy) { return 1; } else return 0; }; var zero = {id:0} var one = {id:1} function mkVar(xx) { return mkNode(zero,xx,one); }; var cacheSize = 1999; var andslot1 = arr(cacheSize,0); var andslot2 = arr(cacheSize,0); var andslot3 = arr(cacheSize,zero); var xorslot1 = arr(cacheSize,0); var xorslot2 = arr(cacheSize,0); var xorslot3 = arr(cacheSize,zero); var notslot1 = arr(cacheSize,0); var notslot2 = arr(cacheSize,one); function hash(x,y) { return (((x << 1)+y) % cacheSize); }; function not(n) { var id = n.id; switch (id) { case 0: return one; case 1: return zero; default: var h = id % cacheSize; if (id == notslot1[h]) { return notslot2[h]; } else { var f = mkNode(not(n.l),n.v,not(n.h)); notslot1[h] = id; notslot2[h] = f; return f; }; }; }; function and2(n1,n2) { var i1 = n1.id; switch (i1) { case 0: return zero; case 1: return n2; default: var i2 = n2.id; switch (i2) { case 0: return zero; case 1: return n1; default: var h = hash(i1,i2); if ((i1 == andslot1[h]) && (i2 == andslot2[h])) { return andslot3[h]; } else { var f; switch (cmpVar(n1.v,n2.v)) { case 0: f = mkNode(and2(n1.l,n2.l),n1.v,and2(n1.h,n2.h)); break; case -1: f = mkNode(and2(n1.l,n2),n1.v,and2(n1.h,n2)); break; default: f = mkNode(and2(n1,n2.l),n2.v,and2(n1,n2.h)); break; }; andslot1[h] = i1; andslot2[h] = i2; andslot3[h] = f; return f; } } } } function xor(n1,n2) { var i1 = n1.id; switch (i1) { case 0: return n2; case 1: return not(n2); default: var i2 = n2.id; switch (i2) { case 0: return n1; case 1: return not(n1); default: var h = hash(i1,i2); if ((i1 == andslot1[h]) && (i2 == andslot2[h])) { return andslot3[h]; } else { var f; switch (cmpVar(n1.v,n2.v)) { case 0: f = mkNode(xor(n1.l,n2.l),n1.v,xor(n1.h,n2.h)); break; case -1: f = mkNode(xor(n1.l,n2),n1.v,xor(n1.h,n2)); break; default: f = mkNode(xor(n1,n2.l),n2.v,xor(n1,n2.h)); break; }; andslot1[h] = i1; andslot2[h] = i2; andslot3[h] = f; return f; } } } } function hwb(n) { function h(i,j) { if (i==j) { return mkVar(i); } else { return xor(and2(not(mkVar(j)),h(i,j-1)), and2(mkVar(j),g(i,j-1))); }; }; function g(i,j) { if (i==j) { return mkVar(i); } else { return xor(and2(not(mkVar(i)),h(i+1,j)), and2(mkVar(i),g(i+1,j))); }; }; return h(0,n-1); }; /* Testing */ var seed = 0; function random() { seed = (seed * 25173 + 17431)|0; return (seed & 1) > 0; }; function random_vars(n) { var vars = []; for (var i = 0; i < n; i++) vars[i] = random(); return vars; }; function test_hwb(bdd,vars) { /* We should have eval bdd vars = vars.(n-1) if n > 0 eval bdd vars = false if n = 0 where n is the number of "true" elements in vars. */ var ntrue = 0; for (var i = 0; i < vars.length; i++) { if (vars[i]) ntrue++; }; return (eval2(bdd,vars) == ((ntrue > 0) ? vars[ntrue-1] : false)) }; var n = 22; var ntests = 100; var bdd = hwb(n); var succeeded = true; for (var i = 1; i <= ntests; i++) { succeeded = succeeded && test_hwb(bdd,random_vars(n)); }; //print(nodeC); //if (succeeded) print("ok"); else print("failed"); js_of_ocaml-3.5.2/benchmarks/sources/js/binary_trees.js000066400000000000000000000024761357507750000232560ustar00rootroot00000000000000/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ function TreeNode(left,right,item){ this.left = left; this.right = right; this.item = item; } TreeNode.prototype.itemCheck = function(){ if (this.left==null) return this.item; else return this.item + this.left.itemCheck() - this.right.itemCheck(); } function bottomUpTree(item,depth){ if (depth>0){ return new TreeNode( bottomUpTree(2*item-1, depth-1) ,bottomUpTree(2*item, depth-1) ,item ); } else { return new TreeNode(null,null,item); } } var minDepth = 4; var n = 0; //arguments[0]; var maxDepth = Math.max(minDepth + 2, n); var stretchDepth = maxDepth + 1; var check = bottomUpTree(0,stretchDepth).itemCheck(); //print("stretch tree of depth " + stretchDepth + "\t check: " + check); var longLivedTree = bottomUpTree(0,maxDepth); for (var depth=minDepth; depth<=maxDepth; depth+=2){ var iterations = 1 << (maxDepth - depth + minDepth); check = 0; for (var i=1; i<=iterations; i++){ check += bottomUpTree(i,depth).itemCheck(); check += bottomUpTree(-i,depth).itemCheck(); } // print(iterations*2 + "\t trees of depth " + depth + "\t check: " + check); } //print("long lived tree of depth " + maxDepth + "\t check: " // + longLivedTree.itemCheck()); js_of_ocaml-3.5.2/benchmarks/sources/js/fannkuch_redux.js000066400000000000000000000031471357507750000235700ustar00rootroot00000000000000/* The Computer Language Benchmarks Game http://shootout.alioth.debian.org/ contributed by Isaac Gouy, transliterated from Mike Pall's Lua program */ function fannkuch(n) { var p = Array(n), q = Array(n), s = Array(n); var sign = 1, maxflips = 0, sum = 0, m = n-1; for(var i=0; i maxflips) maxflips = flips; // New maximum? break; } q[q0] = q0; if (q0 >= 3){ var i = 1, j = q0 - 1, t; do { t = q[i]; q[i] = q[j]; q[j] = t; i++; j--; } while (i < j); } q0 = qq; flips++; } while (true); } // Permute. if (sign == 1){ var t = p[1]; p[1] = p[0]; p[0] = t; sign = -1; // Rotate 0<-1. } else { var t = p[1]; p[1] = p[2]; p[2] = t; sign = 1; // Rotate 0<-1 and 0<-1<-2. for(var i=2; i 0.0) ? ( (this.red > 1.0) ? 1.0 : this.red ) : 0.0; this.green = (this.green > 0.0) ? ( (this.green > 1.0) ? 1.0 : this.green ) : 0.0; this.blue = (this.blue > 0.0) ? ( (this.blue > 1.0) ? 1.0 : this.blue ) : 0.0; }, distance : function(color) { var d = Math.abs(this.red - color.red) + Math.abs(this.green - color.green) + Math.abs(this.blue - color.blue); return d; }, blend: function(c1, c2, w){ var result = new Flog.RayTracer.Color(0,0,0); result = Flog.RayTracer.Color.prototype.add( Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w), Flog.RayTracer.Color.prototype.multiplyScalar(c2, w) ); return result; }, brightness : function() { var r = Math.floor(this.red*255); var g = Math.floor(this.green*255); var b = Math.floor(this.blue*255); return (r * 77 + g * 150 + b * 29) >> 8; }, toString : function () { var r = Math.floor(this.red*255); var g = Math.floor(this.green*255); var b = Math.floor(this.blue*255); return "rgb("+ r +","+ g +","+ b +")"; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Light = Class.create(); Flog.RayTracer.Light.prototype = { position: null, color: null, intensity: 10.0, initialize : function(pos, color, intensity) { this.position = pos; this.color = color; this.intensity = (intensity ? intensity : 10.0); }, toString : function () { return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Vector = Class.create(); Flog.RayTracer.Vector.prototype = { x : 0.0, y : 0.0, z : 0.0, initialize : function(x, y, z) { this.x = (x ? x : 0); this.y = (y ? y : 0); this.z = (z ? z : 0); }, copy: function(vector){ this.x = vector.x; this.y = vector.y; this.z = vector.z; }, normalize : function() { var m = this.magnitude(); return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m); }, magnitude : function() { return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z)); }, cross : function(w) { return new Flog.RayTracer.Vector( -this.z * w.y + this.y * w.z, this.z * w.x - this.x * w.z, -this.y * w.x + this.x * w.y); }, dot : function(w) { return this.x * w.x + this.y * w.y + this.z * w.z; }, add : function(v, w) { return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z); }, subtract : function(v, w) { if(!w || !v) throw 'Vectors must be defined [' + v + ',' + w + ']'; return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z); }, multiplyVector : function(v, w) { return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z); }, multiplyScalar : function(v, w) { return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w); }, toString : function () { return 'Vector [' + this.x + ',' + this.y + ',' + this.z + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Ray = Class.create(); Flog.RayTracer.Ray.prototype = { position : null, direction : null, initialize : function(pos, dir) { this.position = pos; this.direction = dir; }, toString : function () { return 'Ray [' + this.position + ',' + this.direction + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Scene = Class.create(); Flog.RayTracer.Scene.prototype = { camera : null, shapes : [], lights : [], background : null, initialize : function() { this.camera = new Flog.RayTracer.Camera( new Flog.RayTracer.Vector(0,0,-5), new Flog.RayTracer.Vector(0,0,1), new Flog.RayTracer.Vector(0,1,0) ); this.shapes = new Array(); this.lights = new Array(); this.background = new Flog.RayTracer.Background(new Flog.RayTracer.Color(0,0,0.5), 0.2); } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {}; Flog.RayTracer.Material.BaseMaterial = Class.create(); Flog.RayTracer.Material.BaseMaterial.prototype = { gloss: 2.0, // [0...infinity] 0 = matt transparency: 0.0, // 0=opaque reflection: 0.0, // [0...infinity] 0 = no reflection refraction: 0.50, hasTexture: false, initialize : function() { }, getColor: function(u, v){ }, wrapUp: function(t){ t = t % 2.0; if(t < -1) t += 2.0; if(t >= 1) t -= 2.0; return t; }, toString : function () { return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Material.Solid = Class.create(); Flog.RayTracer.Material.Solid.prototype = Object.extend( new Flog.RayTracer.Material.BaseMaterial(), { initialize : function(color, reflection, refraction, transparency, gloss) { this.color = color; this.reflection = reflection; this.transparency = transparency; this.gloss = gloss; this.hasTexture = false; }, getColor: function(u, v){ return this.color; }, toString : function () { return 'SolidMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } ); /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Material.Chessboard = Class.create(); Flog.RayTracer.Material.Chessboard.prototype = Object.extend( new Flog.RayTracer.Material.BaseMaterial(), { colorEven: null, colorOdd: null, density: 0.5, initialize : function(colorEven, colorOdd, reflection, transparency, gloss, density) { this.colorEven = colorEven; this.colorOdd = colorOdd; this.reflection = reflection; this.transparency = transparency; this.gloss = gloss; this.density = density; this.hasTexture = true; }, getColor: function(u, v){ var t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density); if(t < 0.0) return this.colorEven; else return this.colorOdd; }, toString : function () { return 'ChessMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } ); /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Sphere = Class.create(); Flog.RayTracer.Shape.Sphere.prototype = { initialize : function(pos, radius, material) { this.radius = radius; this.position = pos; this.material = material; }, intersect: function(ray){ var info = new Flog.RayTracer.IntersectionInfo(); info.shape = this; var dst = Flog.RayTracer.Vector.prototype.subtract(ray.position, this.position); var B = dst.dot(ray.direction); var C = dst.dot(dst) - (this.radius * this.radius); var D = (B * B) - C; if(D > 0){ // intersection! info.isHit = true; info.distance = (-B) - Math.sqrt(D); info.position = Flog.RayTracer.Vector.prototype.add( ray.position, Flog.RayTracer.Vector.prototype.multiplyScalar( ray.direction, info.distance ) ); info.normal = Flog.RayTracer.Vector.prototype.subtract( info.position, this.position ).normalize(); info.color = this.material.getColor(0,0); } else { info.isHit = false; } return info; }, toString : function () { return 'Sphere [position=' + this.position + ', radius=' + this.radius + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Plane = Class.create(); Flog.RayTracer.Shape.Plane.prototype = { d: 0.0, initialize : function(pos, d, material) { this.position = pos; this.d = d; this.material = material; }, intersect: function(ray){ var info = new Flog.RayTracer.IntersectionInfo(); var Vd = this.position.dot(ray.direction); if(Vd == 0) return info; // no intersection var t = -(this.position.dot(ray.position) + this.d) / Vd; if(t <= 0) return info; info.shape = this; info.isHit = true; info.position = Flog.RayTracer.Vector.prototype.add( ray.position, Flog.RayTracer.Vector.prototype.multiplyScalar( ray.direction, t ) ); info.normal = this.position; info.distance = t; if(this.material.hasTexture){ var vU = new Flog.RayTracer.Vector(this.position.y, this.position.z, -this.position.x); var vV = vU.cross(this.position); var u = info.position.dot(vU); var v = info.position.dot(vV); info.color = this.material.getColor(u,v); } else { info.color = this.material.getColor(0,0); } return info; }, toString : function () { return 'Plane [' + this.position + ', d=' + this.d + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.IntersectionInfo = Class.create(); Flog.RayTracer.IntersectionInfo.prototype = { isHit: false, hitCount: 0, shape: null, position: null, normal: null, color: null, distance: null, initialize : function() { this.color = new Flog.RayTracer.Color(0,0,0); }, toString : function () { return 'Intersection [' + this.position + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Camera = Class.create(); Flog.RayTracer.Camera.prototype = { position: null, lookAt: null, equator: null, up: null, screen: null, initialize : function(pos, lookAt, up) { this.position = pos; this.lookAt = lookAt; this.up = up; this.equator = lookAt.normalize().cross(this.up); this.screen = Flog.RayTracer.Vector.prototype.add(this.position, this.lookAt); }, getRay: function(vx, vy){ var pos = Flog.RayTracer.Vector.prototype.subtract( this.screen, Flog.RayTracer.Vector.prototype.subtract( Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx), Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy) ) ); pos.y = pos.y * -1; var dir = Flog.RayTracer.Vector.prototype.subtract( pos, this.position ); var ray = new Flog.RayTracer.Ray(pos, dir.normalize()); return ray; }, toString : function () { return 'Ray []'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Background = Class.create(); Flog.RayTracer.Background.prototype = { color : null, ambience : 0.0, initialize : function(color, ambience) { this.color = color; this.ambience = ambience; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Engine = Class.create(); Flog.RayTracer.Engine.prototype = { canvas: null, /* 2d context we can render to */ initialize: function(options){ this.options = Object.extend({ canvasHeight: 100, canvasWidth: 100, pixelWidth: 2, pixelHeight: 2, renderDiffuse: false, renderShadows: false, renderHighlights: false, renderReflections: false, rayDepth: 2 }, options || {}); this.options.canvasHeight /= this.options.pixelHeight; this.options.canvasWidth /= this.options.pixelWidth; /* TODO: dynamically include other scripts */ }, setPixel: function(x, y, color){ var pxW, pxH; pxW = this.options.pixelWidth; pxH = this.options.pixelHeight; if (this.canvas) { this.canvas.fillStyle = color.toString(); this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH); } else { if (x === y) { checkNumber += color.brightness(); } // print(x * pxW, y * pxH, pxW, pxH); } }, renderScene: function(scene, canvas){ checkNumber = 0; /* Get canvas */ if (canvas) { this.canvas = canvas.getContext("2d"); } else { this.canvas = null; } var canvasHeight = this.options.canvasHeight; var canvasWidth = this.options.canvasWidth; for(var y=0; y < canvasHeight; y++){ for(var x=0; x < canvasWidth; x++){ var yp = y * 1.0 / canvasHeight * 2 - 1; var xp = x * 1.0 / canvasWidth * 2 - 1; var ray = scene.camera.getRay(xp, yp); var color = this.getPixelColor(ray, scene); this.setPixel(x, y, color); } } if (checkNumber !== 2321) { throw new Error("Scene rendered incorrectly"); } }, getPixelColor: function(ray, scene){ var info = this.testIntersection(ray, scene, null); if(info.isHit){ var color = this.rayTrace(info, ray, scene, 0); return color; } return scene.background.color; }, testIntersection: function(ray, scene, exclude){ var hits = 0; var best = new Flog.RayTracer.IntersectionInfo(); best.distance = 2000; for(var i=0; i= 0 && info.distance < best.distance){ best = info; hits++; } } } best.hitCount = hits; return best; }, getReflectionRay: function(P,N,V){ var c1 = -N.dot(V); var R1 = Flog.RayTracer.Vector.prototype.add( Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2*c1), V ); return new Flog.RayTracer.Ray(P, R1); }, rayTrace: function(info, ray, scene, depth){ // Calc ambient var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience); var oldColor = color; var shininess = Math.pow(10, info.shape.material.gloss + 1); for(var i=0; i 0.0){ color = Flog.RayTracer.Color.prototype.add( color, Flog.RayTracer.Color.prototype.multiply( info.color, Flog.RayTracer.Color.prototype.multiplyScalar( light.color, L ) ) ); } } // The greater the depth the more accurate the colours, but // this is exponentially (!) expensive if(depth <= this.options.rayDepth){ // calculate reflection ray if(this.options.renderReflections && info.shape.material.reflection > 0) { var reflectionRay = this.getReflectionRay(info.position, info.normal, ray.direction); var refl = this.testIntersection(reflectionRay, scene, info.shape); if (refl.isHit && refl.distance > 0){ refl.color = this.rayTrace(refl, reflectionRay, scene, depth + 1); } else { refl.color = scene.background.color; } color = Flog.RayTracer.Color.prototype.blend( color, refl.color, info.shape.material.reflection ); } // Refraction /* TODO */ } /* Render shadows and highlights */ var shadowInfo = new Flog.RayTracer.IntersectionInfo(); if(this.options.renderShadows){ var shadowRay = new Flog.RayTracer.Ray(info.position, v); shadowInfo = this.testIntersection(shadowRay, scene, info.shape); if(shadowInfo.isHit && shadowInfo.shape != info.shape /*&& shadowInfo.shape.type != 'PLANE'*/){ var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5); var dB = (0.5 * Math.pow(shadowInfo.shape.material.transparency, 0.5)); color = Flog.RayTracer.Color.prototype.addScalar(vA,dB); } } // Phong specular highlights if(this.options.renderHighlights && !shadowInfo.isHit && info.shape.material.gloss > 0){ var Lv = Flog.RayTracer.Vector.prototype.subtract( info.shape.position, light.position ).normalize(); var E = Flog.RayTracer.Vector.prototype.subtract( scene.camera.position, info.shape.position ).normalize(); var H = Flog.RayTracer.Vector.prototype.subtract( E, Lv ).normalize(); var glossWeight = Math.pow(Math.max(info.normal.dot(H), 0), shininess); color = Flog.RayTracer.Color.prototype.add( Flog.RayTracer.Color.prototype.multiplyScalar(light.color, glossWeight), color ); } } color.limit(); return color; } }; function renderScene(){ var scene = new Flog.RayTracer.Scene(); scene.camera = new Flog.RayTracer.Camera( new Flog.RayTracer.Vector(0, 0, -15), new Flog.RayTracer.Vector(-0.2, 0, 5), new Flog.RayTracer.Vector(0, 1, 0) ); scene.background = new Flog.RayTracer.Background( new Flog.RayTracer.Color(0.5, 0.5, 0.5), 0.4 ); var sphere = new Flog.RayTracer.Shape.Sphere( new Flog.RayTracer.Vector(-1.5, 1.5, 2), 1.5, new Flog.RayTracer.Material.Solid( new Flog.RayTracer.Color(0,0.5,0.5), 0.3, 0.0, 0.0, 2.0 ) ); var sphere1 = new Flog.RayTracer.Shape.Sphere( new Flog.RayTracer.Vector(1, 0.25, 1), 0.5, new Flog.RayTracer.Material.Solid( new Flog.RayTracer.Color(0.9,0.9,0.9), 0.1, 0.0, 0.0, 1.5 ) ); var plane = new Flog.RayTracer.Shape.Plane( new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(), 1.2, new Flog.RayTracer.Material.Chessboard( new Flog.RayTracer.Color(1,1,1), new Flog.RayTracer.Color(0,0,0), 0.2, 0.0, 1.0, 0.7 ) ); scene.shapes.push(plane); scene.shapes.push(sphere); scene.shapes.push(sphere1); var light = new Flog.RayTracer.Light( new Flog.RayTracer.Vector(5, 10, -1), new Flog.RayTracer.Color(0.8, 0.8, 0.8) ); var light1 = new Flog.RayTracer.Light( new Flog.RayTracer.Vector(-3, 5, -15), new Flog.RayTracer.Color(0.8, 0.8, 0.8), 100 ); scene.lights.push(light); scene.lights.push(light1); var imageWidth = 100; // $F('imageWidth'); var imageHeight = 100; // $F('imageHeight'); var pixelSize = "5,5".split(','); // $F('pixelSize').split(','); var renderDiffuse = true; // $F('renderDiffuse'); var renderShadows = true; // $F('renderShadows'); var renderHighlights = true; // $F('renderHighlights'); var renderReflections = true; // $F('renderReflections'); var rayDepth = 2;//$F('rayDepth'); var raytracer = new Flog.RayTracer.Engine( { canvasWidth: imageWidth, canvasHeight: imageHeight, pixelWidth: pixelSize[0], pixelHeight: pixelSize[1], "renderDiffuse": renderDiffuse, "renderHighlights": renderHighlights, "renderShadows": renderShadows, "renderReflections": renderReflections, "rayDepth": rayDepth } ); raytracer.renderScene(scene, null, 0); } for (var i = 1; i <= 100; i++) { renderScene(); }; js_of_ocaml-3.5.2/benchmarks/sources/js/splay.js000066400000000000000000000246611357507750000217200ustar00rootroot00000000000000// Copyright 2009 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This benchmark is based on a JavaScript log processing module used // by the V8 profiler to generate execution time profiles for runs of // JavaScript applications, and it effectively measures how fast the // JavaScript engine is at allocating nodes and reclaiming the memory // used for old nodes. Because of the way splay trees work, the engine // also has to deal with a lot of changes to the large tree object // graph. // Configuration. var kSplayTreeSize = 8000; var kSplayTreeModifications = 80; var kSplayTreePayloadDepth = 5; var splayTree = null; function GeneratePayloadTree(depth, tag) { if (depth == 0) { return { array : [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], string : 'String for key ' + tag + ' in leaf node' }; } else { return { left: GeneratePayloadTree(depth - 1, tag), right: GeneratePayloadTree(depth - 1, tag) }; } } function GenerateKey() { // The benchmark framework guarantees that Math.random is // deterministic; see base.js. return Math.random(); } function InsertNewNode() { // Insert new node with a unique key. var key; do { key = GenerateKey(); } while (splayTree.find(key) != null); var payload = GeneratePayloadTree(kSplayTreePayloadDepth, String(key)); splayTree.insert(key, payload); return key; } function SplaySetup() { splayTree = new SplayTree(); for (var i = 0; i < kSplayTreeSize; i++) InsertNewNode(); } function SplayTearDown() { // Allow the garbage collector to reclaim the memory // used by the splay tree no matter how we exit the // tear down function. var keys = splayTree.exportKeys(); splayTree = null; // Verify that the splay tree has the right size. var length = keys.length; if (length != kSplayTreeSize) { throw new Error("Splay tree has wrong size"); } // Verify that the splay tree has sorted, unique keys. for (var i = 0; i < length - 1; i++) { if (keys[i] >= keys[i + 1]) { throw new Error("Splay tree not sorted"); } } } function SplayRun() { // Replace a few nodes in the splay tree. for (var i = 0; i < kSplayTreeModifications; i++) { var key = InsertNewNode(); var greatest = splayTree.findGreatestLessThan(key); if (greatest == null) splayTree.remove(key); else splayTree.remove(greatest.key); } } /** * Constructs a Splay tree. A splay tree is a self-balancing binary * search tree with the additional property that recently accessed * elements are quick to access again. It performs basic operations * such as insertion, look-up and removal in O(log(n)) amortized time. * * @constructor */ function SplayTree() { }; /** * Pointer to the root node of the tree. * * @type {SplayTree.Node} * @private */ SplayTree.prototype.root_ = null; /** * @return {boolean} Whether the tree is empty. */ SplayTree.prototype.isEmpty = function() { return !this.root_; }; /** * Inserts a node into the tree with the specified key and value if * the tree does not already contain a node with the specified key. If * the value is inserted, it becomes the root of the tree. * * @param {number} key Key to insert into the tree. * @param {*} value Value to insert into the tree. */ SplayTree.prototype.insert = function(key, value) { if (this.isEmpty()) { this.root_ = new SplayTree.Node(key, value); return; } // Splay on the key to move the last node on the search path for // the key to the root of the tree. this.splay_(key); if (this.root_.key == key) { return; } var node = new SplayTree.Node(key, value); if (key > this.root_.key) { node.left = this.root_; node.right = this.root_.right; this.root_.right = null; } else { node.right = this.root_; node.left = this.root_.left; this.root_.left = null; } this.root_ = node; }; /** * Removes a node with the specified key from the tree if the tree * contains a node with this key. The removed node is returned. If the * key is not found, an exception is thrown. * * @param {number} key Key to find and remove from the tree. * @return {SplayTree.Node} The removed node. */ SplayTree.prototype.remove = function(key) { if (this.isEmpty()) { throw Error('Key not found: ' + key); } this.splay_(key); if (this.root_.key != key) { throw Error('Key not found: ' + key); } var removed = this.root_; if (!this.root_.left) { this.root_ = this.root_.right; } else { var right = this.root_.right; this.root_ = this.root_.left; // Splay to make sure that the new root has an empty right child. this.splay_(key); // Insert the original right child as the right child of the new // root. this.root_.right = right; } return removed; }; /** * Returns the node having the specified key or null if the tree doesn't contain * a node with the specified key. * * @param {number} key Key to find in the tree. * @return {SplayTree.Node} Node having the specified key. */ SplayTree.prototype.find = function(key) { if (this.isEmpty()) { return null; } this.splay_(key); return this.root_.key == key ? this.root_ : null; }; /** * @return {SplayTree.Node} Node having the maximum key value. */ SplayTree.prototype.findMax = function(opt_startNode) { if (this.isEmpty()) { return null; } var current = opt_startNode || this.root_; while (current.right) { current = current.right; } return current; }; /** * @return {SplayTree.Node} Node having the maximum key value that * is less than the specified key value. */ SplayTree.prototype.findGreatestLessThan = function(key) { if (this.isEmpty()) { return null; } // Splay on the key to move the node with the given key or the last // node on the search path to the top of the tree. this.splay_(key); // Now the result is either the root node or the greatest node in // the left subtree. if (this.root_.key < key) { return this.root_; } else if (this.root_.left) { return this.findMax(this.root_.left); } else { return null; } }; /** * @return {Array<*>} An array containing all the keys of tree's nodes. */ SplayTree.prototype.exportKeys = function() { var result = []; if (!this.isEmpty()) { this.root_.traverse_(function(node) { result.push(node.key); }); } return result; }; /** * Perform the splay operation for the given key. Moves the node with * the given key to the top of the tree. If no node has the given * key, the last node on the search path is moved to the top of the * tree. This is the simplified top-down splaying algorithm from: * "Self-adjusting Binary Search Trees" by Sleator and Tarjan * * @param {number} key Key to splay the tree on. * @private */ SplayTree.prototype.splay_ = function(key) { if (this.isEmpty()) { return; } // Create a dummy node. The use of the dummy node is a bit // counter-intuitive: The right child of the dummy node will hold // the L tree of the algorithm. The left child of the dummy node // will hold the R tree of the algorithm. Using a dummy node, left // and right will always be nodes and we avoid special cases. var dummy, left, right; dummy = left = right = new SplayTree.Node(null, null); var current = this.root_; while (true) { if (key < current.key) { if (!current.left) { break; } if (key < current.left.key) { // Rotate right. var tmp = current.left; current.left = tmp.right; tmp.right = current; current = tmp; if (!current.left) { break; } } // Link right. right.left = current; right = current; current = current.left; } else if (key > current.key) { if (!current.right) { break; } if (key > current.right.key) { // Rotate left. var tmp = current.right; current.right = tmp.left; tmp.left = current; current = tmp; if (!current.right) { break; } } // Link left. left.right = current; left = current; current = current.right; } else { break; } } // Assemble. left.right = current.left; right.left = current.right; current.left = dummy.right; current.right = dummy.left; this.root_ = current; }; /** * Constructs a Splay tree node. * * @param {number} key Key. * @param {*} value Value. */ SplayTree.Node = function(key, value) { this.key = key; this.value = value; }; /** * @type {SplayTree.Node} */ SplayTree.Node.prototype.left = null; /** * @type {SplayTree.Node} */ SplayTree.Node.prototype.right = null; /** * Performs an ordered traversal of the subtree starting at * this SplayTree.Node. * * @param {function(SplayTree.Node)} f Visitor function. * @private */ SplayTree.Node.prototype.traverse_ = function(f) { var current = this; while (current) { var left = current.left; if (left) left.traverse_(f); f(current); current = current.right; } }; SplaySetup(); SplayRun(); SplayTearDown(); js_of_ocaml-3.5.2/benchmarks/sources/ml/000077500000000000000000000000001357507750000202155ustar00rootroot00000000000000js_of_ocaml-3.5.2/benchmarks/sources/ml/almabench.ml000066400000000000000000000327651357507750000224760ustar00rootroot00000000000000(* * ALMABENCH 1.0.1 * Objective Caml version * * A number-crunching benchmark designed for cross-language and vendor * comparisons. * * Written by Shawn Wagner, from Scott Robert Ladd's versions for * C++ and java. * * No rights reserved. This is public domain software, for use by anyone. * * This program calculates the daily ephemeris (at noon) for the years * 2000-2099 using an algorithm developed by J.L. Simon, P. Bretagnon, J. * Chapront, M. Chapront-Touze, G. Francou and J. Laskar of the Bureau des * Longitudes, Paris, France), as detailed in Astronomy & Astrophysics * 282, 663 (1994) * * Note that the code herein is design for the purpose of testing * computational performance; error handling and other such "niceties" * is virtually non-existent. * * Actual (and oft-updated) benchmark results can be found at: * http://www.coyotegulch.com * * Please do not use this information or algorithm in any way that might * upset the balance of the universe or otherwise cause planets to impact * upon one another. *) let pic = 3.14159265358979323846 and j2000 = 2451545.0 and jcentury = 36525.0 and jmillenia = 365250.0 let twopi = 2.0 *. pic and a2r = pic /. 648000.0 and r2h = 12.0 /. pic and r2d = 180.0 /. pic and gaussk = 0.01720209895 (* number of days to include in test *) let test_loops = 5 (* was: 20 *) and test_length = 36525 (* sin and cos of j2000 mean obliquity (iau 1976) *) and sineps = 0.3977771559319137 and coseps = 0.9174820620691818 and amas = [| 6023600.0; 408523.5; 328900.5; 3098710.0; 1047.355; 3498.5; 22869.0; 19314.0 |] (* * tables giving the mean keplerian elements, limited to t**2 terms: * a semi-major axis (au) * dlm mean longitude (degree and arcsecond) * e eccentricity * pi longitude of the perihelion (degree and arcsecond) * dinc inclination (degree and arcsecond) * omega longitude of the ascending node (degree and arcsecond) *) and a = [| [| 0.3870983098; 0.0; 0.0 |] ; [| 0.7233298200; 0.0; 0.0 |] ; [| 1.0000010178; 0.0; 0.0 |] ; [| 1.5236793419; 3e-10; 0.0 |] ; [| 5.2026032092; 19132e-10; -39e-10 |] ; [| 9.5549091915; -0.0000213896; 444e-10 |] ; [| 19.2184460618; -3716e-10; 979e-10 |] ; [| 30.1103868694; -16635e-10; 686e-10 |] |] and dlm = [| [| 252.25090552; 5381016286.88982; -1.92789 |] ; [| 181.97980085; 2106641364.33548; 0.59381 |] ; [| 100.46645683; 1295977422.83429; -2.04411 |] ; [| 355.43299958; 689050774.93988; 0.94264 |] ; [| 34.35151874; 109256603.77991; -30.60378 |] ; [| 50.07744430; 43996098.55732; 75.61614 |] ; [| 314.05500511; 15424811.93933; -1.75083 |] ; [| 304.34866548; 7865503.20744; 0.21103 |] |] and e = [| [| 0.2056317526; 0.0002040653; -28349e-10 |] ; [| 0.0067719164; -0.0004776521; 98127e-10 |] ; [| 0.0167086342; -0.0004203654; -0.0000126734 |] ; [| 0.0934006477; 0.0009048438; -80641e-10 |] ; [| 0.0484979255; 0.0016322542; -0.0000471366 |] ; [| 0.0555481426; -0.0034664062; -0.0000643639 |] ; [| 0.0463812221; -0.0002729293; 0.0000078913 |] ; [| 0.0094557470; 0.0000603263; 0.0 |] |] and pi = [| [| 77.45611904; 5719.11590; -4.83016 |] ; [| 131.56370300; 175.48640; -498.48184 |] ; [| 102.93734808; 11612.35290; 53.27577 |] ; [| 336.06023395; 15980.45908; -62.32800 |] ; [| 14.33120687; 7758.75163; 259.95938 |] ; [| 93.05723748; 20395.49439; 190.25952 |] ; [| 173.00529106; 3215.56238; -34.09288 |] ; [| 48.12027554; 1050.71912; 27.39717 |] |] and dinc = [| [| 7.00498625; -214.25629; 0.28977 |] ; [| 3.39466189; -30.84437; -11.67836 |] ; [| 0.0; 469.97289; -3.35053 |] ; [| 1.84972648; -293.31722; -8.11830 |] ; [| 1.30326698; -71.55890; 11.95297 |] ; [| 2.48887878; 91.85195; -17.66225 |] ; [| 0.77319689; -60.72723; 1.25759 |] ; [| 1.76995259; 8.12333; 0.08135 |] |] and omega = [| [| 48.33089304; -4515.21727; -31.79892 |] ; [| 76.67992019; -10008.48154; -51.32614 |] ; [| 174.87317577; -8679.27034; 15.34191 |] ; [| 49.55809321; -10620.90088; -230.57416 |] ; [| 100.46440702; 6362.03561; 326.52178 |] ; [| 113.66550252; -9240.19942; -66.23743 |] ; [| 74.00595701; 2669.15033; 145.93964 |] ; [| 131.78405702; -221.94322; -0.78728 |] |] (* tables for trigonometric terms to be added to the mean elements of the semi-major axes. *) and kp = [| [| 69613.0; 75645.0; 88306.0; 59899.0; 15746.0; 71087.0; 142173.0; 3086.0; 0.0 |] ; [| 21863.0; 32794.0; 26934.0; 10931.0; 26250.0; 43725.0; 53867.0; 28939.0; 0.0 |] ; [| 16002.0; 21863.0; 32004.0; 10931.0; 14529.0; 16368.0; 15318.0; 32794.0; 0.0 |] ; [| 6345.0; 7818.0; 15636.0; 7077.0; 8184.0; 14163.0; 1107.0; 4872.0; 0.0 |] ; [| 1760.0; 1454.0; 1167.0; 880.0; 287.0; 2640.0; 19.0; 2047.0; 1454.0 |] ; [| 574.0; 0.0; 880.0; 287.0; 19.0; 1760.0; 1167.0; 306.0; 574.0 |] ; [| 204.0; 0.0; 177.0; 1265.0; 4.0; 385.0; 200.0; 208.0; 204.0 |] ; [| 0.0; 102.0; 106.0; 4.0; 98.0; 1367.0; 487.0; 204.0; 0.0 |] |] and ca = [| [| 4.0; -13.0; 11.0; -9.0; -9.0; -3.0; -1.0; 4.0; 0.0 |] ; [| -156.0; 59.0; -42.0; 6.0; 19.0; -20.0; -10.0; -12.0; 0.0 |] ; [| 64.0; -152.0; 62.0; -8.0; 32.0; -41.0; 19.0; -11.0; 0.0 |] ; [| 124.0; 621.0; -145.0; 208.0; 54.0; -57.0; 30.0; 15.0; 0.0 |] ; [| -23437.0; -2634.0; 6601.0; 6259.0; -1507.0; -1821.0; 2620.0; -2115.0; -1489.0 |] ; [| 62911.0 ; -119919.0 ; 79336.0 ; 17814.0 ; -24241.0 ; 12068.0 ; 8306.0 ; -4893.0 ; 8902.0 |] ; [| 389061.0 ; -262125.0 ; -44088.0 ; 8387.0 ; -22976.0 ; -2093.0 ; -615.0 ; -9720.0 ; 6633.0 |] ; [| -412235.0; -157046.0; -31430.0; 37817.0; -9740.0; -13.0; -7449.0; 9644.0; 0.0 |] |] and sa = [| [| -29.0; -1.0; 9.0; 6.0; -6.0; 5.0; 4.0; 0.0; 0.0 |] ; [| -48.0; -125.0; -26.0; -37.0; 18.0; -13.0; -20.0; -2.0; 0.0 |] ; [| -150.0; -46.0; 68.0; 54.0; 14.0; 24.0; -28.0; 22.0; 0.0 |] ; [| -621.0; 532.0; -694.0; -20.0; 192.0; -94.0; 71.0; -73.0; 0.0 |] ; [| -14614.0; -19828.0; -5869.0; 1881.0; -4372.0; -2255.0; 782.0; 930.0; 913.0 |] ; [| 139737.0; 0.0; 24667.0; 51123.0; -5102.0; 7429.0; -4095.0; -1976.0; -9566.0 |] ; [| -138081.0 ; 0.0 ; 37205.0 ; -49039.0 ; -41901.0 ; -33872.0 ; -27037.0 ; -12474.0 ; 18797.0 |] ; [| 0.0; 28492.0; 133236.0; 69654.0; 52322.0; -49577.0; -26430.0; -3593.0; 0.0 |] |] (* tables giving the trigonometric terms to be added to the mean elements of the mean longitudes . *) and kq = [| [| 3086.0; 15746.0; 69613.0; 59899.0; 75645.0; 88306.0; 12661.0; 2658.0; 0.0; 0.0 |] ; [| 21863.0; 32794.0; 10931.0; 73.0; 4387.0; 26934.0; 1473.0; 2157.0; 0.0; 0.0 |] ; [| 10.0; 16002.0; 21863.0; 10931.0; 1473.0; 32004.0; 4387.0; 73.0; 0.0; 0.0 |] ; [| 10.0; 6345.0; 7818.0; 1107.0; 15636.0; 7077.0; 8184.0; 532.0; 10.0; 0.0 |] ; [| 19.0; 1760.0; 1454.0; 287.0; 1167.0; 880.0; 574.0; 2640.0; 19.0; 1454.0 |] ; [| 19.0; 574.0; 287.0; 306.0; 1760.0; 12.0; 31.0; 38.0; 19.0; 574.0 |] ; [| 4.0; 204.0; 177.0; 8.0; 31.0; 200.0; 1265.0; 102.0; 4.0; 204.0 |] ; [| 4.0; 102.0; 106.0; 8.0; 98.0; 1367.0; 487.0; 204.0; 4.0; 102.0 |] |] and cl = [| [| 21.0; -95.0; -157.0; 41.0; -5.0; 42.0; 23.0; 30.0; 0.0; 0.0 |] ; [| -160.0; -313.0; -235.0; 60.0; -74.0; -76.0; -27.0; 34.0; 0.0; 0.0 |] ; [| -325.0; -322.0; -79.0; 232.0; -52.0; 97.0; 55.0; -41.0; 0.0; 0.0 |] ; [| 2268.0; -979.0; 802.0; 602.0; -668.0; -33.0; 345.0; 201.0; -55.0; 0.0 |] ; [| 7610.0 ; -4997.0 ; -7689.0 ; -5841.0 ; -2617.0 ; 1115.0 ; -748.0 ; -607.0 ; 6074.0 ; 354.0 |] ; [| -18549.0 ; 30125.0 ; 20012.0 ; -730.0 ; 824.0 ; 23.0 ; 1289.0 ; -352.0 ; -14767.0 ; -2062.0 |] ; [| -135245.0 ; -14594.0 ; 4197.0 ; -4030.0 ; -5630.0 ; -2898.0 ; 2540.0 ; -306.0 ; 2939.0 ; 1986.0 |] ; [| 89948.0; 2103.0; 8963.0; 2695.0; 3682.0; 1648.0; 866.0; -154.0; -1963.0; -283.0 |] |] and sl = [| [| -342.0; 136.0; -23.0; 62.0; 66.0; -52.0; -33.0; 17.0; 0.0; 0.0 |] ; [| 524.0; -149.0; -35.0; 117.0; 151.0; 122.0; -71.0; -62.0; 0.0; 0.0 |] ; [| -105.0; -137.0; 258.0; 35.0; -116.0; -88.0; -112.0; -80.0; 0.0; 0.0 |] ; [| 854.0; -205.0; -936.0; -240.0; 140.0; -341.0; -97.0; -232.0; 536.0; 0.0 |] ; [| -56980.0; 8016.0; 1012.0; 1448.0; -3024.0; -3710.0; 318.0; 503.0; 3767.0; 577.0 |] ; [| 138606.0 ; -13478.0 ; -4964.0 ; 1441.0 ; -1319.0 ; -1482.0 ; 427.0 ; 1236.0 ; -9167.0 ; -1918.0 |] ; [| 71234.0 ; -41116.0 ; 5334.0 ; -4935.0 ; -1848.0 ; 66.0 ; 434.0 ; -1748.0 ; 3780.0 ; -701.0 |] ; [| -47645.0; 11647.0; 2166.0; 3194.0; 679.0; 0.0; -244.0; -419.0; -2531.0; 48.0 |] |] (* Normalize angle into the range -pi <= A < +pi. *) let anpm a = let w = mod_float a twopi in if abs_float w >= pic then if a < 0.0 then w +. twopi else w -. twopi else w (* The reference frame is equatorial and is with respect to the * mean equator and equinox of epoch j2000. *) let planetpv epoch np pv = (* time: julian millennia since j2000. *) let t = (epoch.(0) -. j2000 +. epoch.(1)) /. jmillenia in (* compute the mean elements. *) let da = ref (a.(np).(0) +. ((a.(np).(1) +. (a.(np).(2) *. t)) *. t)) and dl = ref (((3600.0 *. dlm.(np).(0)) +. ((dlm.(np).(1) +. (dlm.(np).(2) *. t)) *. t)) *. a2r) and de = e.(np).(0) +. ((e.(np).(1) +. (e.(np).(2) *. t)) *. t) and dp = anpm (((3600.0 *. pi.(np).(0)) +. ((pi.(np).(1) +. (pi.(np).(2) *. t)) *. t)) *. a2r) and di = ((3600.0 *. dinc.(np).(0)) +. ((dinc.(np).(1) +. (dinc.(np).(2) *. t)) *. t)) *. a2r and doh = anpm (((3600.0 *. omega.(np).(0)) +. ((omega.(np).(1) +. (omega.(np).(2) *. t)) *. t)) *. a2r) (* apply the trigonometric terms. *) and dmu = 0.35953620 *. t in (* loop invariant *) let kp = kp.(np) and kq = kq.(np) and ca = ca.(np) and sa = sa.(np) and cl = cl.(np) and sl = sl.(np) in for k = 0 to 7 do let arga = kp.(k) *. dmu and argl = kq.(k) *. dmu in da := !da +. (((ca.(k) *. cos arga) +. (sa.(k) *. sin arga)) *. 0.0000001); dl := !dl +. (((cl.(k) *. cos argl) +. (sl.(k) *. sin argl)) *. 0.0000001) done; (let arga = kp.(8) *. dmu in da := !da +. (t *. ((ca.(8) *. cos arga) +. (sa.(8) *. sin arga)) *. 0.0000001); for k = 8 to 9 do let argl = kq.(k) *. dmu in dl := !dl +. (t *. ((cl.(k) *. cos argl) +. (sl.(k) *. sin argl)) *. 0.0000001) done); dl := mod_float !dl twopi; (* iterative solution of kepler's equation to get eccentric anomaly. *) let am = !dl -. dp in let ae = ref (am +. (de *. sin am)) and k = ref 0 in let dae = ref ((am -. !ae +. (de *. sin !ae)) /. (1.0 -. (de *. cos !ae))) in ae := !ae +. !dae; incr k; while !k < 10 || abs_float !dae >= 1e-12 do dae := (am -. !ae +. (de *. sin !ae)) /. (1.0 -. (de *. cos !ae)); ae := !ae +. !dae; incr k done; (* true anomaly. *) let ae2 = !ae /. 2.0 in let at = 2.0 *. atan2 (sqrt ((1.0 +. de) /. (1.0 -. de)) *. sin ae2) (cos ae2) (* distance (au) and speed (radians per day). *) and r = !da *. (1.0 -. (de *. cos !ae)) and v = gaussk *. sqrt ((1.0 +. (1.0 /. amas.(np))) /. (!da *. !da *. !da)) and si2 = sin (di /. 2.0) in let xq = si2 *. cos doh and xp = si2 *. sin doh and tl = at +. dp in let xsw = sin tl and xcw = cos tl in let xm2 = 2.0 *. ((xp *. xcw) -. (xq *. xsw)) and xf = !da /. sqrt (1.0 -. (de *. de)) and ci2 = cos (di /. 2.0) in let xms = ((de *. sin dp) +. xsw) *. xf and xmc = ((de *. cos dp) +. xcw) *. xf and xpxq2 = 2.0 *. xp *. xq in (* position (j2000 ecliptic x,y,z in au). *) let x = r *. (xcw -. (xm2 *. xp)) and y = r *. (xsw +. (xm2 *. xq)) and z = r *. (-.xm2 *. ci2) in (* rotate to equatorial. *) pv.(0).(0) <- x; pv.(0).(1) <- (y *. coseps) -. (z *. sineps); pv.(0).(2) <- (y *. sineps) +. (z *. coseps); (* velocity (j2000 ecliptic xdot,ydot,zdot in au/d). *) let x = v *. (((-1.0 +. (2.0 *. xp *. xp)) *. xms) +. (xpxq2 *. xmc)) and y = v *. (((1.0 -. (2.0 *. xq *. xq)) *. xmc) -. (xpxq2 *. xms)) and z = v *. (2.0 *. ci2 *. ((xp *. xms) +. (xq *. xmc))) in (* rotate to equatorial *) pv.(1).(0) <- x; pv.(1).(1) <- (y *. coseps) -. (z *. sineps); pv.(1).(2) <- (y *. sineps) +. (z *. coseps) (* Computes RA, Declination, and distance from a state vector returned by * planetpv. *) let radecdist state rdd = (* Distance *) rdd.(2) <- sqrt ((state.(0).(0) *. state.(0).(0)) +. (state.(0).(1) *. state.(0).(1)) +. (state.(0).(2) *. state.(0).(2))); (* RA *) rdd.(0) <- atan2 state.(0).(1) state.(0).(0) *. r2h; if rdd.(0) < 0.0 then rdd.(0) <- rdd.(0) +. 24.0; (* Declination *) rdd.(1) <- asin (state.(0).(2) /. rdd.(2)) *. r2d (* Entry point. Calculate RA and Dec for noon on every day in 1900-2100 *) let _ = let jd = [| 0.0; 0.0 |] and pv = [| [| 0.0; 0.0; 0.0 |]; [| 0.0; 0.0; 0.0 |] |] and position = [| 0.0; 0.0; 0.0 |] in (* Test *) jd.(0) <- j2000; jd.(1) <- 1.0; for p = 0 to 7 do planetpv jd p pv; radecdist pv position (* Printf.printf "%d %.2f %.2f\n%!" p position.(0) position.(1)*) done; (* Benchmark *) for _ = 0 to test_loops - 1 do jd.(0) <- j2000; jd.(1) <- 0.0; for _ = 0 to test_length - 1 do jd.(0) <- jd.(0) +. 1.0; for p = 0 to 7 do planetpv jd p pv; radecdist pv position done done done js_of_ocaml-3.5.2/benchmarks/sources/ml/bdd.ml000066400000000000000000000147521357507750000213110ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: bdd.ml 7017 2005-08-12 09:22:04Z xleroy $ *) (* Translated to Caml by Xavier Leroy *) (* Original code written in SML by ... *) type bdd = | One | Zero | Node of bdd * int * int * bdd let rec eval bdd vars = match bdd with | Zero -> false | One -> true | Node (l, v, _, h) -> if vars.(v) then eval h vars else eval l vars let getId bdd = match bdd with | Node (_, _, id, _) -> id | Zero -> 0 | One -> 1 let initSize_1 = (8 * 1024) - 1 let nodeC = ref 1 let sz_1 = ref initSize_1 let htab = ref (Array.make (!sz_1 + 1) []) let n_items = ref 0 let hashVal x y v = (x lsl 1) + y + (v lsl 2) let resize newSize = let arr = !htab in let newSz_1 = newSize - 1 in let newArr = Array.make newSize [] in let rec copyBucket bucket = match bucket with | [] -> () | n :: ns -> ( match n with | Node (l, v, _, h) -> let ind = hashVal (getId l) (getId h) v land newSz_1 in newArr.(ind) <- n :: newArr.(ind); copyBucket ns | _ -> assert false) in for n = 0 to !sz_1 do copyBucket arr.(n) done; htab := newArr; sz_1 := newSz_1 let insert idl idh v ind bucket newNode = if !n_items <= !sz_1 then ( !htab.(ind) <- newNode :: bucket; incr n_items) else ( resize (!sz_1 + !sz_1 + 2); let ind = hashVal idl idh v land !sz_1 in !htab.(ind) <- newNode :: !htab.(ind)) let resetUnique () = sz_1 := initSize_1; htab := Array.make (!sz_1 + 1) []; n_items := 0; nodeC := 1 let mkNode low v high = let idl = getId low in let idh = getId high in if idl = idh then low else let ind = hashVal idl idh v land !sz_1 in let bucket = !htab.(ind) in let rec lookup b = match b with | [] -> let n = Node ( low , v , (incr nodeC; !nodeC) , high ) in insert (getId low) (getId high) v ind bucket n; n | n :: ns -> ( match n with | Node (l, v', _id, h) -> if v = v' && idl = getId l && idh = getId h then n else lookup ns | _ -> assert false) in lookup bucket type ordering = | LESS | EQUAL | GREATER let cmpVar (x : int) (y : int) = if x < y then LESS else if x > y then GREATER else EQUAL let zero = Zero let one = One let mkVar x = mkNode zero x one let cacheSize = 1999 let andslot1 = Array.make cacheSize 0 let andslot2 = Array.make cacheSize 0 let andslot3 = Array.make cacheSize zero let xorslot1 = Array.make cacheSize 0 let xorslot2 = Array.make cacheSize 0 let xorslot3 = Array.make cacheSize zero let notslot1 = Array.make cacheSize 0 let notslot2 = Array.make cacheSize one let hash x y = ((x lsl 1) + y) mod cacheSize let rec not n = match n with | Zero -> One | One -> Zero | Node (l, v, id, r) -> let h = id mod cacheSize in if id = notslot1.(h) then notslot2.(h) else let f = mkNode (not l) v (not r) in notslot1.(h) <- id; notslot2.(h) <- f; f let rec and2 n1 n2 = match n1 with | Node (l1, v1, i1, r1) -> ( match n2 with | Node (l2, v2, i2, r2) -> let h = hash i1 i2 in if i1 = andslot1.(h) && i2 = andslot2.(h) then andslot3.(h) else let f = match cmpVar v1 v2 with | EQUAL -> mkNode (and2 l1 l2) v1 (and2 r1 r2) | LESS -> mkNode (and2 l1 n2) v1 (and2 r1 n2) | GREATER -> mkNode (and2 n1 l2) v2 (and2 n1 r2) in andslot1.(h) <- i1; andslot2.(h) <- i2; andslot3.(h) <- f; f | Zero -> Zero | One -> n1) | Zero -> Zero | One -> n2 let rec xor n1 n2 = match n1 with | Node (l1, v1, i1, r1) -> ( match n2 with | Node (l2, v2, i2, r2) -> let h = hash i1 i2 in if i1 = andslot1.(h) && i2 = andslot2.(h) then andslot3.(h) else let f = match cmpVar v1 v2 with | EQUAL -> mkNode (xor l1 l2) v1 (xor r1 r2) | LESS -> mkNode (xor l1 n2) v1 (xor r1 n2) | GREATER -> mkNode (xor n1 l2) v2 (xor n1 r2) in andslot1.(h) <- i1; andslot2.(h) <- i2; andslot3.(h) <- f; f | Zero -> n1 | One -> not n1) | Zero -> n2 | One -> not n2 let hwb n = let rec h i j = if i = j then mkVar i else xor (and2 (not (mkVar j)) (h i (j - 1))) (and2 (mkVar j) (g i (j - 1))) and g i j = if i = j then mkVar i else xor (and2 (not (mkVar i)) (h (i + 1) j)) (and2 (mkVar i) (g (i + 1) j)) in h 0 (n - 1) (* Testing *) let seed = ref 0 let random () = seed := (!seed * 25173) + 17431; !seed land 1 > 0 let random_vars n = let vars = Array.make n false in for i = 0 to n - 1 do vars.(i) <- random () done; vars let test_hwb bdd vars = (* We should have eval bdd vars = vars.(n-1) if n > 0 eval bdd vars = false if n = 0 where n is the number of "true" elements in vars. *) let ntrue = ref 0 in for i = 0 to Array.length vars - 1 do if vars.(i) then incr ntrue done; eval bdd vars = if !ntrue > 0 then vars.(!ntrue - 1) else false let main () = let n = if Array.length Sys.argv >= 2 then int_of_string Sys.argv.(1) else 22 in let ntests = if Array.length Sys.argv >= 3 then int_of_string Sys.argv.(2) else 100 in let bdd = hwb n in let succeeded = ref true in for _ = 1 to ntests do succeeded := !succeeded && test_hwb bdd (random_vars n) done; assert !succeeded (* if !succeeded then print_string "OK\n" else print_string "FAILED\n"; Format.eprintf "%d@." !nodeC; exit 0 *) let _ = main () js_of_ocaml-3.5.2/benchmarks/sources/ml/binary_trees.ml000066400000000000000000000026241357507750000232410ustar00rootroot00000000000000(* The Computer Language Benchmarks Game * http://shootout.alioth.debian.org/ * * Contributed by Troestler Christophe * Modified by Fabrice Le Fessant *) type 'a tree = | Empty | Node of 'a tree * 'a * 'a tree let rec make i d = (* if d = 0 then Empty *) if d = 0 then Node (Empty, i, Empty) else let i2 = 2 * i and d = d - 1 in Node (make (i2 - 1) d, i, make i2 d) let rec check = function | Empty -> 0 | Node (l, i, r) -> i + check l - check r let min_depth = 4 let max_depth = let n = try int_of_string Sys.argv.(1) with _ -> 10 in max (min_depth + 2) n let stretch_depth = max_depth + 1 let () = (* Gc.set { (Gc.get()) with Gc.minor_heap_size = 1024 * 1024; max_overhead = -1; }; *) let _c = check (make 0 stretch_depth) in ( (* Printf.printf "stretch tree of depth %i\t check: %i\n" stretch_depth c *) ) let long_lived_tree = make 0 max_depth let loop_depths d = for i = 0 to ((max_depth - d) / 2) + 1 - 1 do let d = d + (i * 2) in let niter = 1 lsl (max_depth - d + min_depth) in let c = ref 0 in for i = 1 to niter do c := !c + check (make i d) + check (make (-i) d) done; ( (* Printf.printf "%i\t trees of depth %i\t check: %i\n" (2 * niter) d !c; *) ) done let () = (* flush stdout; *) loop_depths min_depth; ( (* Printf.printf "long lived tree of depth %i\t check: %i\n" max_depth (check long_lived_tree) *) ) js_of_ocaml-3.5.2/benchmarks/sources/ml/boyer.ml000066400000000000000000001075361357507750000217030ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: boyer.ml 7017 2005-08-12 09:22:04Z xleroy $ *) (* Manipulations over terms *) type term = | Var of int | Prop of head * term list and head = { name : string ; mutable props : (term * term) list } let rec print_term = function | Var v -> print_string "v"; print_int v | Prop (head, argl) -> print_string "("; print_string head.name; List.iter (fun t -> print_string " "; print_term t) argl; print_string ")" let lemmas = ref ([] : head list) (* Replacement for property lists *) let get name = let rec get_rec = function | hd1 :: hdl -> if hd1.name = name then hd1 else get_rec hdl | [] -> let entry = { name; props = [] } in lemmas := entry :: !lemmas; entry in get_rec !lemmas let add_lemma = function | Prop (_, [ (Prop (headl, _) as left); right ]) -> headl.props <- (left, right) :: headl.props | _ -> assert false (* Substitutions *) type subst = Bind of int * term let get_binding v list = let rec get_rec = function | [] -> failwith "unbound" | Bind (w, t) :: rest -> if v = w then t else get_rec rest in get_rec list let apply_subst alist term = let rec as_rec = function | Var v -> ( try get_binding v alist with Failure _ -> term) | Prop (head, argl) -> Prop (head, List.map as_rec argl) in as_rec term exception Unify let rec unify term1 term2 = unify1 term1 term2 [] and unify1 term1 term2 unify_subst = match term2 with | Var v -> ( try if get_binding v unify_subst = term1 then unify_subst else raise Unify with Failure _ -> Bind (v, term1) :: unify_subst) | Prop (head2, argl2) -> ( match term1 with | Var _ -> raise Unify | Prop (head1, argl1) -> if head1 == head2 then unify1_lst argl1 argl2 unify_subst else raise Unify) and unify1_lst l1 l2 unify_subst = match l1, l2 with | [], [] -> unify_subst | h1 :: r1, h2 :: r2 -> unify1_lst r1 r2 (unify1 h1 h2 unify_subst) | _ -> raise Unify let rec rewrite = function | Var _ as term -> term | Prop (head, argl) -> rewrite_with_lemmas (Prop (head, List.map rewrite argl)) head.props and rewrite_with_lemmas term lemmas = match lemmas with | [] -> term | (t1, t2) :: rest -> ( try rewrite (apply_subst (unify term t1) t2) with Unify -> rewrite_with_lemmas term rest) type cterm = | CVar of int | CProp of string * cterm list let rec cterm_to_term = function | CVar v -> Var v | CProp (p, l) -> Prop (get p, List.map cterm_to_term l) let add t = add_lemma (cterm_to_term t) let _ = add (CProp ( "equal" , [ CProp ("compile", [ CVar 5 ]) ; CProp ( "reverse" , [ CProp ("codegen", [ CProp ("optimize", [ CVar 5 ]); CProp ("nil", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("eqp", [ CVar 23; CVar 24 ]) ; CProp ("equal", [ CProp ("fix", [ CVar 23 ]); CProp ("fix", [ CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("gt", [ CVar 23; CVar 24 ]); CProp ("lt", [ CVar 24; CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("le", [ CVar 23; CVar 24 ]); CProp ("ge", [ CVar 24; CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("ge", [ CVar 23; CVar 24 ]); CProp ("le", [ CVar 24; CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("boolean", [ CVar 23 ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 23; CProp ("true", []) ]) ; CProp ("equal", [ CVar 23; CProp ("false", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("iff", [ CVar 23; CVar 24 ]) ; CProp ( "and" , [ CProp ("implies", [ CVar 23; CVar 24 ]) ; CProp ("implies", [ CVar 24; CVar 23 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("even1", [ CVar 23 ]) ; CProp ( "if" , [ CProp ("zerop", [ CVar 23 ]) ; CProp ("true", []) ; CProp ("odd", [ CProp ("sub1", [ CVar 23 ]) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("countps_", [ CVar 11; CVar 15 ]) ; CProp ("countps_loop", [ CVar 11; CVar 15; CProp ("zero", []) ]) ] )); add (CProp ( "equal" , [ CProp ("fact_", [ CVar 8 ]) ; CProp ("fact_loop", [ CVar 8; CProp ("one", []) ]) ] )); add (CProp ( "equal" , [ CProp ("reverse_", [ CVar 23 ]) ; CProp ("reverse_loop", [ CVar 23; CProp ("nil", []) ]) ] )); add (CProp ( "equal" , [ CProp ("divides", [ CVar 23; CVar 24 ]) ; CProp ("zerop", [ CProp ("remainder", [ CVar 24; CVar 23 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("assume_true", [ CVar 21; CVar 0 ]) ; CProp ("cons", [ CProp ("cons", [ CVar 21; CProp ("true", []) ]); CVar 0 ]) ] )); add (CProp ( "equal" , [ CProp ("assume_false", [ CVar 21; CVar 0 ]) ; CProp ("cons", [ CProp ("cons", [ CVar 21; CProp ("false", []) ]); CVar 0 ]) ] )); add (CProp ( "equal" , [ CProp ("tautology_checker", [ CVar 23 ]) ; CProp ("tautologyp", [ CProp ("normalize", [ CVar 23 ]); CProp ("nil", []) ]) ] )); add (CProp ( "equal" , [ CProp ("falsify", [ CVar 23 ]) ; CProp ("falsify1", [ CProp ("normalize", [ CVar 23 ]); CProp ("nil", []) ]) ] )); add (CProp ( "equal" , [ CProp ("prime", [ CVar 23 ]) ; CProp ( "and" , [ CProp ("not", [ CProp ("zerop", [ CVar 23 ]) ]) ; CProp ( "not" , [ CProp ("equal", [ CVar 23; CProp ("add1", [ CProp ("zero", []) ]) ]) ] ) ; CProp ("prime1", [ CVar 23; CProp ("sub1", [ CVar 23 ]) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("and", [ CVar 15; CVar 16 ]) ; CProp ( "if" , [ CVar 15 ; CProp ("if", [ CVar 16; CProp ("true", []); CProp ("false", []) ]) ; CProp ("false", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("or", [ CVar 15; CVar 16 ]) ; CProp ( "if" , [ CVar 15 ; CProp ("true", []) ; CProp ("if", [ CVar 16; CProp ("true", []); CProp ("false", []) ]) ; CProp ("false", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("not", [ CVar 15 ]) ; CProp ("if", [ CVar 15; CProp ("false", []); CProp ("true", []) ]) ] )); add (CProp ( "equal" , [ CProp ("implies", [ CVar 15; CVar 16 ]) ; CProp ( "if" , [ CVar 15 ; CProp ("if", [ CVar 16; CProp ("true", []); CProp ("false", []) ]) ; CProp ("true", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("fix", [ CVar 23 ]) ; CProp ("if", [ CProp ("numberp", [ CVar 23 ]); CVar 23; CProp ("zero", []) ]) ] )); add (CProp ( "equal" , [ CProp ("if", [ CProp ("if", [ CVar 0; CVar 1; CVar 2 ]); CVar 3; CVar 4 ]) ; CProp ( "if" , [ CVar 0 ; CProp ("if", [ CVar 1; CVar 3; CVar 4 ]) ; CProp ("if", [ CVar 2; CVar 3; CVar 4 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("zerop", [ CVar 23 ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 23; CProp ("zero", []) ]) ; CProp ("not", [ CProp ("numberp", [ CVar 23 ]) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("plus", [ CProp ("plus", [ CVar 23; CVar 24 ]); CVar 25 ]) ; CProp ("plus", [ CVar 23; CProp ("plus", [ CVar 24; CVar 25 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("plus", [ CVar 0; CVar 1 ]); CProp ("zero", []) ]) ; CProp ("and", [ CProp ("zerop", [ CVar 0 ]); CProp ("zerop", [ CVar 1 ]) ]) ] )); add (CProp ("equal", [ CProp ("difference", [ CVar 23; CVar 23 ]); CProp ("zero", []) ])); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("plus", [ CVar 0; CVar 1 ]); CProp ("plus", [ CVar 0; CVar 2 ]) ] ) ; CProp ("equal", [ CProp ("fix", [ CVar 1 ]); CProp ("fix", [ CVar 2 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("zero", []); CProp ("difference", [ CVar 23; CVar 24 ]) ]) ; CProp ("not", [ CProp ("gt", [ CVar 24; CVar 23 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CVar 23; CProp ("difference", [ CVar 23; CVar 24 ]) ]) ; CProp ( "and" , [ CProp ("numberp", [ CVar 23 ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 23; CProp ("zero", []) ]) ; CProp ("zerop", [ CVar 24 ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ( "meaning" , [ CProp ("plus_tree", [ CProp ("append", [ CVar 23; CVar 24 ]) ]); CVar 0 ] ) ; CProp ( "plus" , [ CProp ("meaning", [ CProp ("plus_tree", [ CVar 23 ]); CVar 0 ]) ; CProp ("meaning", [ CProp ("plus_tree", [ CVar 24 ]); CVar 0 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "meaning" , [ CProp ("plus_tree", [ CProp ("plus_fringe", [ CVar 23 ]) ]); CVar 0 ] ) ; CProp ("fix", [ CProp ("meaning", [ CVar 23; CVar 0 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("append", [ CProp ("append", [ CVar 23; CVar 24 ]); CVar 25 ]) ; CProp ("append", [ CVar 23; CProp ("append", [ CVar 24; CVar 25 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("reverse", [ CProp ("append", [ CVar 0; CVar 1 ]) ]) ; CProp ("append", [ CProp ("reverse", [ CVar 1 ]); CProp ("reverse", [ CVar 0 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("times", [ CVar 23; CProp ("plus", [ CVar 24; CVar 25 ]) ]) ; CProp ( "plus" , [ CProp ("times", [ CVar 23; CVar 24 ]) ; CProp ("times", [ CVar 23; CVar 25 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("times", [ CProp ("times", [ CVar 23; CVar 24 ]); CVar 25 ]) ; CProp ("times", [ CVar 23; CProp ("times", [ CVar 24; CVar 25 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("times", [ CVar 23; CVar 24 ]); CProp ("zero", []) ]) ; CProp ("or", [ CProp ("zerop", [ CVar 23 ]); CProp ("zerop", [ CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("exec", [ CProp ("append", [ CVar 23; CVar 24 ]); CVar 15; CVar 4 ]) ; CProp ("exec", [ CVar 24; CProp ("exec", [ CVar 23; CVar 15; CVar 4 ]); CVar 4 ]) ] )); add (CProp ( "equal" , [ CProp ("mc_flatten", [ CVar 23; CVar 24 ]) ; CProp ("append", [ CProp ("flatten", [ CVar 23 ]); CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ("member", [ CVar 23; CProp ("append", [ CVar 0; CVar 1 ]) ]) ; CProp ( "or" , [ CProp ("member", [ CVar 23; CVar 0 ]) ; CProp ("member", [ CVar 23; CVar 1 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("member", [ CVar 23; CProp ("reverse", [ CVar 24 ]) ]) ; CProp ("member", [ CVar 23; CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ("length", [ CProp ("reverse", [ CVar 23 ]) ]) ; CProp ("length", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("member", [ CVar 0; CProp ("intersect", [ CVar 1; CVar 2 ]) ]) ; CProp ( "and" , [ CProp ("member", [ CVar 0; CVar 1 ]) ; CProp ("member", [ CVar 0; CVar 2 ]) ] ) ] )); add (CProp ("equal", [ CProp ("nth", [ CProp ("zero", []); CVar 8 ]); CProp ("zero", []) ])); add (CProp ( "equal" , [ CProp ("exp", [ CVar 8; CProp ("plus", [ CVar 9; CVar 10 ]) ]) ; CProp ( "times" , [ CProp ("exp", [ CVar 8; CVar 9 ]); CProp ("exp", [ CVar 8; CVar 10 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("exp", [ CVar 8; CProp ("times", [ CVar 9; CVar 10 ]) ]) ; CProp ("exp", [ CProp ("exp", [ CVar 8; CVar 9 ]); CVar 10 ]) ] )); add (CProp ( "equal" , [ CProp ("reverse_loop", [ CVar 23; CVar 24 ]) ; CProp ("append", [ CProp ("reverse", [ CVar 23 ]); CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ("reverse_loop", [ CVar 23; CProp ("nil", []) ]) ; CProp ("reverse", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("count_list", [ CVar 25; CProp ("sort_lp", [ CVar 23; CVar 24 ]) ]) ; CProp ( "plus" , [ CProp ("count_list", [ CVar 25; CVar 23 ]) ; CProp ("count_list", [ CVar 25; CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("append", [ CVar 0; CVar 1 ]) ; CProp ("append", [ CVar 0; CVar 2 ]) ] ) ; CProp ("equal", [ CVar 1; CVar 2 ]) ] )); add (CProp ( "equal" , [ CProp ( "plus" , [ CProp ("remainder", [ CVar 23; CVar 24 ]) ; CProp ("times", [ CVar 24; CProp ("quotient", [ CVar 23; CVar 24 ]) ]) ] ) ; CProp ("fix", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("power_eval", [ CProp ("big_plus", [ CVar 11; CVar 8; CVar 1 ]); CVar 1 ]) ; CProp ("plus", [ CProp ("power_eval", [ CVar 11; CVar 1 ]); CVar 8 ]) ] )); add (CProp ( "equal" , [ CProp ( "power_eval" , [ CProp ("big_plus", [ CVar 23; CVar 24; CVar 8; CVar 1 ]); CVar 1 ] ) ; CProp ( "plus" , [ CVar 8 ; CProp ( "plus" , [ CProp ("power_eval", [ CVar 23; CVar 1 ]) ; CProp ("power_eval", [ CVar 24; CVar 1 ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("remainder", [ CVar 24; CProp ("one", []) ]); CProp ("zero", []) ] )); add (CProp ( "equal" , [ CProp ("lt", [ CProp ("remainder", [ CVar 23; CVar 24 ]); CVar 24 ]) ; CProp ("not", [ CProp ("zerop", [ CVar 24 ]) ]) ] )); add (CProp ("equal", [ CProp ("remainder", [ CVar 23; CVar 23 ]); CProp ("zero", []) ])); add (CProp ( "equal" , [ CProp ("lt", [ CProp ("quotient", [ CVar 8; CVar 9 ]); CVar 8 ]) ; CProp ( "and" , [ CProp ("not", [ CProp ("zerop", [ CVar 8 ]) ]) ; CProp ( "or" , [ CProp ("zerop", [ CVar 9 ]) ; CProp ("not", [ CProp ("equal", [ CVar 9; CProp ("one", []) ]) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("lt", [ CProp ("remainder", [ CVar 23; CVar 24 ]); CVar 23 ]) ; CProp ( "and" , [ CProp ("not", [ CProp ("zerop", [ CVar 24 ]) ]) ; CProp ("not", [ CProp ("zerop", [ CVar 23 ]) ]) ; CProp ("not", [ CProp ("lt", [ CVar 23; CVar 24 ]) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("power_eval", [ CProp ("power_rep", [ CVar 8; CVar 1 ]); CVar 1 ]) ; CProp ("fix", [ CVar 8 ]) ] )); add (CProp ( "equal" , [ CProp ( "power_eval" , [ CProp ( "big_plus" , [ CProp ("power_rep", [ CVar 8; CVar 1 ]) ; CProp ("power_rep", [ CVar 9; CVar 1 ]) ; CProp ("zero", []) ; CVar 1 ] ) ; CVar 1 ] ) ; CProp ("plus", [ CVar 8; CVar 9 ]) ] )); add (CProp ( "equal" , [ CProp ("gcd", [ CVar 23; CVar 24 ]); CProp ("gcd", [ CVar 24; CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("nth", [ CProp ("append", [ CVar 0; CVar 1 ]); CVar 8 ]) ; CProp ( "append" , [ CProp ("nth", [ CVar 0; CVar 8 ]) ; CProp ( "nth" , [ CVar 1 ; CProp ("difference", [ CVar 8; CProp ("length", [ CVar 0 ]) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("difference", [ CProp ("plus", [ CVar 23; CVar 24 ]); CVar 23 ]) ; CProp ("fix", [ CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ("difference", [ CProp ("plus", [ CVar 24; CVar 23 ]); CVar 23 ]) ; CProp ("fix", [ CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ( "difference" , [ CProp ("plus", [ CVar 23; CVar 24 ]) ; CProp ("plus", [ CVar 23; CVar 25 ]) ] ) ; CProp ("difference", [ CVar 24; CVar 25 ]) ] )); add (CProp ( "equal" , [ CProp ("times", [ CVar 23; CProp ("difference", [ CVar 2; CVar 22 ]) ]) ; CProp ( "difference" , [ CProp ("times", [ CVar 2; CVar 23 ]) ; CProp ("times", [ CVar 22; CVar 23 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("remainder", [ CProp ("times", [ CVar 23; CVar 25 ]); CVar 25 ]) ; CProp ("zero", []) ] )); add (CProp ( "equal" , [ CProp ( "difference" , [ CProp ("plus", [ CVar 1; CProp ("plus", [ CVar 0; CVar 2 ]) ]); CVar 0 ] ) ; CProp ("plus", [ CVar 1; CVar 2 ]) ] )); add (CProp ( "equal" , [ CProp ( "difference" , [ CProp ("add1", [ CProp ("plus", [ CVar 24; CVar 25 ]) ]); CVar 25 ] ) ; CProp ("add1", [ CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ( "lt" , [ CProp ("plus", [ CVar 23; CVar 24 ]) ; CProp ("plus", [ CVar 23; CVar 25 ]) ] ) ; CProp ("lt", [ CVar 24; CVar 25 ]) ] )); add (CProp ( "equal" , [ CProp ( "lt" , [ CProp ("times", [ CVar 23; CVar 25 ]) ; CProp ("times", [ CVar 24; CVar 25 ]) ] ) ; CProp ( "and" , [ CProp ("not", [ CProp ("zerop", [ CVar 25 ]) ]) ; CProp ("lt", [ CVar 23; CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("lt", [ CVar 24; CProp ("plus", [ CVar 23; CVar 24 ]) ]) ; CProp ("not", [ CProp ("zerop", [ CVar 23 ]) ]) ] )); add (CProp ( "equal" , [ CProp ( "gcd" , [ CProp ("times", [ CVar 23; CVar 25 ]) ; CProp ("times", [ CVar 24; CVar 25 ]) ] ) ; CProp ("times", [ CVar 25; CProp ("gcd", [ CVar 23; CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("value", [ CProp ("normalize", [ CVar 23 ]); CVar 0 ]) ; CProp ("value", [ CVar 23; CVar 0 ]) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("flatten", [ CVar 23 ]) ; CProp ("cons", [ CVar 24; CProp ("nil", []) ]) ] ) ; CProp ( "and" , [ CProp ("nlistp", [ CVar 23 ]); CProp ("equal", [ CVar 23; CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("listp", [ CProp ("gother", [ CVar 23 ]) ]) ; CProp ("listp", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("samefringe", [ CVar 23; CVar 24 ]) ; CProp ("equal", [ CProp ("flatten", [ CVar 23 ]); CProp ("flatten", [ CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("greatest_factor", [ CVar 23; CVar 24 ]); CProp ("zero", []) ] ) ; CProp ( "and" , [ CProp ( "or" , [ CProp ("zerop", [ CVar 24 ]) ; CProp ("equal", [ CVar 24; CProp ("one", []) ]) ] ) ; CProp ("equal", [ CVar 23; CProp ("zero", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("greatest_factor", [ CVar 23; CVar 24 ]); CProp ("one", []) ] ) ; CProp ("equal", [ CVar 23; CProp ("one", []) ]) ] )); add (CProp ( "equal" , [ CProp ("numberp", [ CProp ("greatest_factor", [ CVar 23; CVar 24 ]) ]) ; CProp ( "not" , [ CProp ( "and" , [ CProp ( "or" , [ CProp ("zerop", [ CVar 24 ]) ; CProp ("equal", [ CVar 24; CProp ("one", []) ]) ] ) ; CProp ("not", [ CProp ("numberp", [ CVar 23 ]) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("times_list", [ CProp ("append", [ CVar 23; CVar 24 ]) ]) ; CProp ( "times" , [ CProp ("times_list", [ CVar 23 ]); CProp ("times_list", [ CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("prime_list", [ CProp ("append", [ CVar 23; CVar 24 ]) ]) ; CProp ( "and" , [ CProp ("prime_list", [ CVar 23 ]); CProp ("prime_list", [ CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CVar 25; CProp ("times", [ CVar 22; CVar 25 ]) ]) ; CProp ( "and" , [ CProp ("numberp", [ CVar 25 ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 25; CProp ("zero", []) ]) ; CProp ("equal", [ CVar 22; CProp ("one", []) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("ge", [ CVar 23; CVar 24 ]) ; CProp ("not", [ CProp ("lt", [ CVar 23; CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CVar 23; CProp ("times", [ CVar 23; CVar 24 ]) ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 23; CProp ("zero", []) ]) ; CProp ( "and" , [ CProp ("numberp", [ CVar 23 ]) ; CProp ("equal", [ CVar 24; CProp ("one", []) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("remainder", [ CProp ("times", [ CVar 24; CVar 23 ]); CVar 24 ]) ; CProp ("zero", []) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("times", [ CVar 0; CVar 1 ]); CProp ("one", []) ]) ; CProp ( "and" , [ CProp ("not", [ CProp ("equal", [ CVar 0; CProp ("zero", []) ]) ]) ; CProp ("not", [ CProp ("equal", [ CVar 1; CProp ("zero", []) ]) ]) ; CProp ("numberp", [ CVar 0 ]) ; CProp ("numberp", [ CVar 1 ]) ; CProp ("equal", [ CProp ("sub1", [ CVar 0 ]); CProp ("zero", []) ]) ; CProp ("equal", [ CProp ("sub1", [ CVar 1 ]); CProp ("zero", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "lt" , [ CProp ("length", [ CProp ("delete", [ CVar 23; CVar 11 ]) ]) ; CProp ("length", [ CVar 11 ]) ] ) ; CProp ("member", [ CVar 23; CVar 11 ]) ] )); add (CProp ( "equal" , [ CProp ("sort2", [ CProp ("delete", [ CVar 23; CVar 11 ]) ]) ; CProp ("delete", [ CVar 23; CProp ("sort2", [ CVar 11 ]) ]) ] )); add (CProp ("equal", [ CProp ("dsort", [ CVar 23 ]); CProp ("sort2", [ CVar 23 ]) ])); add (CProp ( "equal" , [ CProp ( "length" , [ CProp ( "cons" , [ CVar 0 ; CProp ( "cons" , [ CVar 1 ; CProp ( "cons" , [ CVar 2 ; CProp ( "cons" , [ CVar 3 ; CProp ( "cons" , [ CVar 4 ; CProp ("cons", [ CVar 5; CVar 6 ]) ] ) ] ) ] ) ] ) ] ) ] ) ; CProp ("plus", [ CProp ("six", []); CProp ("length", [ CVar 6 ]) ]) ] )); add (CProp ( "equal" , [ CProp ( "difference" , [ CProp ("add1", [ CProp ("add1", [ CVar 23 ]) ]); CProp ("two", []) ] ) ; CProp ("fix", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ( "quotient" , [ CProp ("plus", [ CVar 23; CProp ("plus", [ CVar 23; CVar 24 ]) ]) ; CProp ("two", []) ] ) ; CProp ("plus", [ CVar 23; CProp ("quotient", [ CVar 24; CProp ("two", []) ]) ]) ] )); add (CProp ( "equal" , [ CProp ("sigma", [ CProp ("zero", []); CVar 8 ]) ; CProp ( "quotient" , [ CProp ("times", [ CVar 8; CProp ("add1", [ CVar 8 ]) ]) ; CProp ("two", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("plus", [ CVar 23; CProp ("add1", [ CVar 24 ]) ]) ; CProp ( "if" , [ CProp ("numberp", [ CVar 24 ]) ; CProp ("add1", [ CProp ("plus", [ CVar 23; CVar 24 ]) ]) ; CProp ("add1", [ CVar 23 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("difference", [ CVar 23; CVar 24 ]) ; CProp ("difference", [ CVar 25; CVar 24 ]) ] ) ; CProp ( "if" , [ CProp ("lt", [ CVar 23; CVar 24 ]) ; CProp ("not", [ CProp ("lt", [ CVar 24; CVar 25 ]) ]) ; CProp ( "if" , [ CProp ("lt", [ CVar 25; CVar 24 ]) ; CProp ("not", [ CProp ("lt", [ CVar 24; CVar 23 ]) ]) ; CProp ( "equal" , [ CProp ("fix", [ CVar 23 ]); CProp ("fix", [ CVar 25 ]) ] ) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ( "meaning" , [ CProp ("plus_tree", [ CProp ("delete", [ CVar 23; CVar 24 ]) ]); CVar 0 ] ) ; CProp ( "if" , [ CProp ("member", [ CVar 23; CVar 24 ]) ; CProp ( "difference" , [ CProp ("meaning", [ CProp ("plus_tree", [ CVar 24 ]); CVar 0 ]) ; CProp ("meaning", [ CVar 23; CVar 0 ]) ] ) ; CProp ("meaning", [ CProp ("plus_tree", [ CVar 24 ]); CVar 0 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("times", [ CVar 23; CProp ("add1", [ CVar 24 ]) ]) ; CProp ( "if" , [ CProp ("numberp", [ CVar 24 ]) ; CProp ( "plus" , [ CVar 23 ; CProp ("times", [ CVar 23; CVar 24 ]) ; CProp ("fix", [ CVar 23 ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("nth", [ CProp ("nil", []); CVar 8 ]) ; CProp ("if", [ CProp ("zerop", [ CVar 8 ]); CProp ("nil", []); CProp ("zero", []) ]) ] )); add (CProp ( "equal" , [ CProp ("last", [ CProp ("append", [ CVar 0; CVar 1 ]) ]) ; CProp ( "if" , [ CProp ("listp", [ CVar 1 ]) ; CProp ("last", [ CVar 1 ]) ; CProp ( "if" , [ CProp ("listp", [ CVar 0 ]) ; CProp ( "cons" , [ CProp ("car", [ CProp ("last", [ CVar 0 ]) ]); CVar 1 ] ) ; CVar 1 ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("lt", [ CVar 23; CVar 24 ]); CVar 25 ]) ; CProp ( "if" , [ CProp ("lt", [ CVar 23; CVar 24 ]) ; CProp ("equal", [ CProp ("true", []); CVar 25 ]) ; CProp ("equal", [ CProp ("false", []); CVar 25 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("assignment", [ CVar 23; CProp ("append", [ CVar 0; CVar 1 ]) ]) ; CProp ( "if" , [ CProp ("assignedp", [ CVar 23; CVar 0 ]) ; CProp ("assignment", [ CVar 23; CVar 0 ]) ; CProp ("assignment", [ CVar 23; CVar 1 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("car", [ CProp ("gother", [ CVar 23 ]) ]) ; CProp ( "if" , [ CProp ("listp", [ CVar 23 ]) ; CProp ("car", [ CProp ("flatten", [ CVar 23 ]) ]) ; CProp ("zero", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("flatten", [ CProp ("cdr", [ CProp ("gother", [ CVar 23 ]) ]) ]) ; CProp ( "if" , [ CProp ("listp", [ CVar 23 ]) ; CProp ("cdr", [ CProp ("flatten", [ CVar 23 ]) ]) ; CProp ("cons", [ CProp ("zero", []); CProp ("nil", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("quotient", [ CProp ("times", [ CVar 24; CVar 23 ]); CVar 24 ]) ; CProp ( "if" , [ CProp ("zerop", [ CVar 24 ]) ; CProp ("zero", []) ; CProp ("fix", [ CVar 23 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("get", [ CVar 9; CProp ("set", [ CVar 8; CVar 21; CVar 12 ]) ]) ; CProp ( "if" , [ CProp ("eqp", [ CVar 9; CVar 8 ]) ; CVar 21 ; CProp ("get", [ CVar 9; CVar 12 ]) ] ) ] )) (* Tautology checker *) let truep x lst = match x with | Prop (head, _) -> head.name = "true" || List.mem x lst | _ -> List.mem x lst and falsep x lst = match x with | Prop (head, _) -> head.name = "false" || List.mem x lst | _ -> List.mem x lst let rec tautologyp x true_lst false_lst = if truep x true_lst then true else if falsep x false_lst then false else (* print_term x; print_newline(); *) match x with | Var _ -> false | Prop (head, [ test; yes; no ]) -> if head.name = "if" then if truep test true_lst then tautologyp yes true_lst false_lst else if falsep test false_lst then tautologyp no true_lst false_lst else tautologyp yes (test :: true_lst) false_lst && tautologyp no true_lst (test :: false_lst) else false | _ -> assert false let tautp x = (* print_term x; print_string"\n"; *) let y = rewrite x in (* print_term y; print_string "\n"; *) tautologyp y [] [] (* the benchmark *) let subst = [ Bind ( 23 , cterm_to_term (CProp ( "f" , [ CProp ( "plus" , [ CProp ("plus", [ CVar 0; CVar 1 ]) ; CProp ("plus", [ CVar 2; CProp ("zero", []) ]) ] ) ] )) ) ; Bind ( 24 , cterm_to_term (CProp ( "f" , [ CProp ( "times" , [ CProp ("times", [ CVar 0; CVar 1 ]) ; CProp ("plus", [ CVar 2; CVar 3 ]) ] ) ] )) ) ; Bind ( 25 , cterm_to_term (CProp ( "f" , [ CProp ( "reverse" , [ CProp ( "append" , [ CProp ("append", [ CVar 0; CVar 1 ]); CProp ("nil", []) ] ) ] ) ] )) ) ; Bind ( 20 , cterm_to_term (CProp ( "equal" , [ CProp ("plus", [ CVar 0; CVar 1 ]) ; CProp ("difference", [ CVar 23; CVar 24 ]) ] )) ) ; Bind ( 22 , cterm_to_term (CProp ( "lt" , [ CProp ("remainder", [ CVar 0; CVar 1 ]) ; CProp ("member", [ CVar 0; CProp ("length", [ CVar 1 ]) ]) ] )) ) ] let term = cterm_to_term (CProp ( "implies" , [ CProp ( "and" , [ CProp ("implies", [ CVar 23; CVar 24 ]) ; CProp ( "and" , [ CProp ("implies", [ CVar 24; CVar 25 ]) ; CProp ( "and" , [ CProp ("implies", [ CVar 25; CVar 20 ]) ; CProp ("implies", [ CVar 20; CVar 22 ]) ] ) ] ) ] ) ; CProp ("implies", [ CVar 23; CVar 22 ]) ] )) let _ = let ok = ref true in for _ = 1 to 50 do if not (tautp (apply_subst subst term)) then ok := false done; assert !ok (* if !ok then print_string "Proved!\n" else print_string "Cannot prove!\n"; exit 0 *) (********* with failure s -> print_string "Exception failure("; print_string s; print_string ")\n" | Unify -> print_string "Exception Unify\n" | match_failure(file,start,stop) -> print_string "Exception match_failure("; print_string file; print_string ","; print_int start; print_string ","; print_int stop; print_string ")\n" | _ -> print_string "Exception ?\n" **********) js_of_ocaml-3.5.2/benchmarks/sources/ml/boyer_no_exc.ml000066400000000000000000001100041357507750000232160ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: boyer.ml 7017 2005-08-12 09:22:04Z xleroy $ *) (* Manipulations over terms *) type term = | Var of int | Prop of head * term list and head = { name : string ; mutable props : (term * term) list } let rec print_term = function | Var v -> print_string "v"; print_int v | Prop (head, argl) -> print_string "("; print_string head.name; List.iter (fun t -> print_string " "; print_term t) argl; print_string ")" let lemmas = ref ([] : head list) (* Replacement for property lists *) let get name = let rec get_rec = function | hd1 :: hdl -> if hd1.name = name then hd1 else get_rec hdl | [] -> let entry = { name; props = [] } in lemmas := entry :: !lemmas; entry in get_rec !lemmas let add_lemma = function | Prop (_, [ (Prop (headl, _) as left); right ]) -> headl.props <- (left, right) :: headl.props | _ -> assert false (* Substitutions *) type subst = Bind of int * term let get_binding v list = let rec get_rec = function | [] -> None | Bind (w, t) :: rest -> if v = w then Some t else get_rec rest in get_rec list let apply_subst alist term = let rec as_rec = function | Var v -> ( match get_binding v alist with | Some t -> t | None -> term) | Prop (head, argl) -> Prop (head, List.map as_rec argl) in as_rec term exception Unify let rec unify term1 term2 = unify1 term1 term2 [] and unify1 term1 term2 unify_subst = match term2 with | Var v -> ( match get_binding v unify_subst with | Some t when t = term1 -> Some unify_subst | Some _ -> None | None -> Some (Bind (v, term1) :: unify_subst)) | Prop (head2, argl2) -> ( match term1 with | Var _ -> None | Prop (head1, argl1) -> if head1 == head2 then unify1_lst argl1 argl2 unify_subst else None) and unify1_lst l1 l2 unify_subst = match l1, l2 with | [], [] -> Some unify_subst | h1 :: r1, h2 :: r2 -> ( match unify1 h1 h2 unify_subst with | Some unify_subst -> unify1_lst r1 r2 unify_subst | None -> None) | _ -> None let rec rewrite = function | Var _ as term -> term | Prop (head, argl) -> rewrite_with_lemmas (Prop (head, List.map rewrite argl)) head.props and rewrite_with_lemmas term lemmas = match lemmas with | [] -> term | (t1, t2) :: rest -> ( match unify term t1 with | Some unify_subst -> rewrite (apply_subst unify_subst t2) | None -> rewrite_with_lemmas term rest) type cterm = | CVar of int | CProp of string * cterm list let rec cterm_to_term = function | CVar v -> Var v | CProp (p, l) -> Prop (get p, List.map cterm_to_term l) let add t = add_lemma (cterm_to_term t) let _ = add (CProp ( "equal" , [ CProp ("compile", [ CVar 5 ]) ; CProp ( "reverse" , [ CProp ("codegen", [ CProp ("optimize", [ CVar 5 ]); CProp ("nil", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("eqp", [ CVar 23; CVar 24 ]) ; CProp ("equal", [ CProp ("fix", [ CVar 23 ]); CProp ("fix", [ CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("gt", [ CVar 23; CVar 24 ]); CProp ("lt", [ CVar 24; CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("le", [ CVar 23; CVar 24 ]); CProp ("ge", [ CVar 24; CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("ge", [ CVar 23; CVar 24 ]); CProp ("le", [ CVar 24; CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("boolean", [ CVar 23 ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 23; CProp ("true", []) ]) ; CProp ("equal", [ CVar 23; CProp ("false", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("iff", [ CVar 23; CVar 24 ]) ; CProp ( "and" , [ CProp ("implies", [ CVar 23; CVar 24 ]) ; CProp ("implies", [ CVar 24; CVar 23 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("even1", [ CVar 23 ]) ; CProp ( "if" , [ CProp ("zerop", [ CVar 23 ]) ; CProp ("true", []) ; CProp ("odd", [ CProp ("sub1", [ CVar 23 ]) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("countps_", [ CVar 11; CVar 15 ]) ; CProp ("countps_loop", [ CVar 11; CVar 15; CProp ("zero", []) ]) ] )); add (CProp ( "equal" , [ CProp ("fact_", [ CVar 8 ]) ; CProp ("fact_loop", [ CVar 8; CProp ("one", []) ]) ] )); add (CProp ( "equal" , [ CProp ("reverse_", [ CVar 23 ]) ; CProp ("reverse_loop", [ CVar 23; CProp ("nil", []) ]) ] )); add (CProp ( "equal" , [ CProp ("divides", [ CVar 23; CVar 24 ]) ; CProp ("zerop", [ CProp ("remainder", [ CVar 24; CVar 23 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("assume_true", [ CVar 21; CVar 0 ]) ; CProp ("cons", [ CProp ("cons", [ CVar 21; CProp ("true", []) ]); CVar 0 ]) ] )); add (CProp ( "equal" , [ CProp ("assume_false", [ CVar 21; CVar 0 ]) ; CProp ("cons", [ CProp ("cons", [ CVar 21; CProp ("false", []) ]); CVar 0 ]) ] )); add (CProp ( "equal" , [ CProp ("tautology_checker", [ CVar 23 ]) ; CProp ("tautologyp", [ CProp ("normalize", [ CVar 23 ]); CProp ("nil", []) ]) ] )); add (CProp ( "equal" , [ CProp ("falsify", [ CVar 23 ]) ; CProp ("falsify1", [ CProp ("normalize", [ CVar 23 ]); CProp ("nil", []) ]) ] )); add (CProp ( "equal" , [ CProp ("prime", [ CVar 23 ]) ; CProp ( "and" , [ CProp ("not", [ CProp ("zerop", [ CVar 23 ]) ]) ; CProp ( "not" , [ CProp ("equal", [ CVar 23; CProp ("add1", [ CProp ("zero", []) ]) ]) ] ) ; CProp ("prime1", [ CVar 23; CProp ("sub1", [ CVar 23 ]) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("and", [ CVar 15; CVar 16 ]) ; CProp ( "if" , [ CVar 15 ; CProp ("if", [ CVar 16; CProp ("true", []); CProp ("false", []) ]) ; CProp ("false", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("or", [ CVar 15; CVar 16 ]) ; CProp ( "if" , [ CVar 15 ; CProp ("true", []) ; CProp ("if", [ CVar 16; CProp ("true", []); CProp ("false", []) ]) ; CProp ("false", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("not", [ CVar 15 ]) ; CProp ("if", [ CVar 15; CProp ("false", []); CProp ("true", []) ]) ] )); add (CProp ( "equal" , [ CProp ("implies", [ CVar 15; CVar 16 ]) ; CProp ( "if" , [ CVar 15 ; CProp ("if", [ CVar 16; CProp ("true", []); CProp ("false", []) ]) ; CProp ("true", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("fix", [ CVar 23 ]) ; CProp ("if", [ CProp ("numberp", [ CVar 23 ]); CVar 23; CProp ("zero", []) ]) ] )); add (CProp ( "equal" , [ CProp ("if", [ CProp ("if", [ CVar 0; CVar 1; CVar 2 ]); CVar 3; CVar 4 ]) ; CProp ( "if" , [ CVar 0 ; CProp ("if", [ CVar 1; CVar 3; CVar 4 ]) ; CProp ("if", [ CVar 2; CVar 3; CVar 4 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("zerop", [ CVar 23 ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 23; CProp ("zero", []) ]) ; CProp ("not", [ CProp ("numberp", [ CVar 23 ]) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("plus", [ CProp ("plus", [ CVar 23; CVar 24 ]); CVar 25 ]) ; CProp ("plus", [ CVar 23; CProp ("plus", [ CVar 24; CVar 25 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("plus", [ CVar 0; CVar 1 ]); CProp ("zero", []) ]) ; CProp ("and", [ CProp ("zerop", [ CVar 0 ]); CProp ("zerop", [ CVar 1 ]) ]) ] )); add (CProp ("equal", [ CProp ("difference", [ CVar 23; CVar 23 ]); CProp ("zero", []) ])); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("plus", [ CVar 0; CVar 1 ]); CProp ("plus", [ CVar 0; CVar 2 ]) ] ) ; CProp ("equal", [ CProp ("fix", [ CVar 1 ]); CProp ("fix", [ CVar 2 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("zero", []); CProp ("difference", [ CVar 23; CVar 24 ]) ]) ; CProp ("not", [ CProp ("gt", [ CVar 24; CVar 23 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CVar 23; CProp ("difference", [ CVar 23; CVar 24 ]) ]) ; CProp ( "and" , [ CProp ("numberp", [ CVar 23 ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 23; CProp ("zero", []) ]) ; CProp ("zerop", [ CVar 24 ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ( "meaning" , [ CProp ("plus_tree", [ CProp ("append", [ CVar 23; CVar 24 ]) ]); CVar 0 ] ) ; CProp ( "plus" , [ CProp ("meaning", [ CProp ("plus_tree", [ CVar 23 ]); CVar 0 ]) ; CProp ("meaning", [ CProp ("plus_tree", [ CVar 24 ]); CVar 0 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "meaning" , [ CProp ("plus_tree", [ CProp ("plus_fringe", [ CVar 23 ]) ]); CVar 0 ] ) ; CProp ("fix", [ CProp ("meaning", [ CVar 23; CVar 0 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("append", [ CProp ("append", [ CVar 23; CVar 24 ]); CVar 25 ]) ; CProp ("append", [ CVar 23; CProp ("append", [ CVar 24; CVar 25 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("reverse", [ CProp ("append", [ CVar 0; CVar 1 ]) ]) ; CProp ("append", [ CProp ("reverse", [ CVar 1 ]); CProp ("reverse", [ CVar 0 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("times", [ CVar 23; CProp ("plus", [ CVar 24; CVar 25 ]) ]) ; CProp ( "plus" , [ CProp ("times", [ CVar 23; CVar 24 ]) ; CProp ("times", [ CVar 23; CVar 25 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("times", [ CProp ("times", [ CVar 23; CVar 24 ]); CVar 25 ]) ; CProp ("times", [ CVar 23; CProp ("times", [ CVar 24; CVar 25 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("times", [ CVar 23; CVar 24 ]); CProp ("zero", []) ]) ; CProp ("or", [ CProp ("zerop", [ CVar 23 ]); CProp ("zerop", [ CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("exec", [ CProp ("append", [ CVar 23; CVar 24 ]); CVar 15; CVar 4 ]) ; CProp ("exec", [ CVar 24; CProp ("exec", [ CVar 23; CVar 15; CVar 4 ]); CVar 4 ]) ] )); add (CProp ( "equal" , [ CProp ("mc_flatten", [ CVar 23; CVar 24 ]) ; CProp ("append", [ CProp ("flatten", [ CVar 23 ]); CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ("member", [ CVar 23; CProp ("append", [ CVar 0; CVar 1 ]) ]) ; CProp ( "or" , [ CProp ("member", [ CVar 23; CVar 0 ]) ; CProp ("member", [ CVar 23; CVar 1 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("member", [ CVar 23; CProp ("reverse", [ CVar 24 ]) ]) ; CProp ("member", [ CVar 23; CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ("length", [ CProp ("reverse", [ CVar 23 ]) ]) ; CProp ("length", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("member", [ CVar 0; CProp ("intersect", [ CVar 1; CVar 2 ]) ]) ; CProp ( "and" , [ CProp ("member", [ CVar 0; CVar 1 ]) ; CProp ("member", [ CVar 0; CVar 2 ]) ] ) ] )); add (CProp ("equal", [ CProp ("nth", [ CProp ("zero", []); CVar 8 ]); CProp ("zero", []) ])); add (CProp ( "equal" , [ CProp ("exp", [ CVar 8; CProp ("plus", [ CVar 9; CVar 10 ]) ]) ; CProp ( "times" , [ CProp ("exp", [ CVar 8; CVar 9 ]); CProp ("exp", [ CVar 8; CVar 10 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("exp", [ CVar 8; CProp ("times", [ CVar 9; CVar 10 ]) ]) ; CProp ("exp", [ CProp ("exp", [ CVar 8; CVar 9 ]); CVar 10 ]) ] )); add (CProp ( "equal" , [ CProp ("reverse_loop", [ CVar 23; CVar 24 ]) ; CProp ("append", [ CProp ("reverse", [ CVar 23 ]); CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ("reverse_loop", [ CVar 23; CProp ("nil", []) ]) ; CProp ("reverse", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("count_list", [ CVar 25; CProp ("sort_lp", [ CVar 23; CVar 24 ]) ]) ; CProp ( "plus" , [ CProp ("count_list", [ CVar 25; CVar 23 ]) ; CProp ("count_list", [ CVar 25; CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("append", [ CVar 0; CVar 1 ]) ; CProp ("append", [ CVar 0; CVar 2 ]) ] ) ; CProp ("equal", [ CVar 1; CVar 2 ]) ] )); add (CProp ( "equal" , [ CProp ( "plus" , [ CProp ("remainder", [ CVar 23; CVar 24 ]) ; CProp ("times", [ CVar 24; CProp ("quotient", [ CVar 23; CVar 24 ]) ]) ] ) ; CProp ("fix", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("power_eval", [ CProp ("big_plus", [ CVar 11; CVar 8; CVar 1 ]); CVar 1 ]) ; CProp ("plus", [ CProp ("power_eval", [ CVar 11; CVar 1 ]); CVar 8 ]) ] )); add (CProp ( "equal" , [ CProp ( "power_eval" , [ CProp ("big_plus", [ CVar 23; CVar 24; CVar 8; CVar 1 ]); CVar 1 ] ) ; CProp ( "plus" , [ CVar 8 ; CProp ( "plus" , [ CProp ("power_eval", [ CVar 23; CVar 1 ]) ; CProp ("power_eval", [ CVar 24; CVar 1 ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("remainder", [ CVar 24; CProp ("one", []) ]); CProp ("zero", []) ] )); add (CProp ( "equal" , [ CProp ("lt", [ CProp ("remainder", [ CVar 23; CVar 24 ]); CVar 24 ]) ; CProp ("not", [ CProp ("zerop", [ CVar 24 ]) ]) ] )); add (CProp ("equal", [ CProp ("remainder", [ CVar 23; CVar 23 ]); CProp ("zero", []) ])); add (CProp ( "equal" , [ CProp ("lt", [ CProp ("quotient", [ CVar 8; CVar 9 ]); CVar 8 ]) ; CProp ( "and" , [ CProp ("not", [ CProp ("zerop", [ CVar 8 ]) ]) ; CProp ( "or" , [ CProp ("zerop", [ CVar 9 ]) ; CProp ("not", [ CProp ("equal", [ CVar 9; CProp ("one", []) ]) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("lt", [ CProp ("remainder", [ CVar 23; CVar 24 ]); CVar 23 ]) ; CProp ( "and" , [ CProp ("not", [ CProp ("zerop", [ CVar 24 ]) ]) ; CProp ("not", [ CProp ("zerop", [ CVar 23 ]) ]) ; CProp ("not", [ CProp ("lt", [ CVar 23; CVar 24 ]) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("power_eval", [ CProp ("power_rep", [ CVar 8; CVar 1 ]); CVar 1 ]) ; CProp ("fix", [ CVar 8 ]) ] )); add (CProp ( "equal" , [ CProp ( "power_eval" , [ CProp ( "big_plus" , [ CProp ("power_rep", [ CVar 8; CVar 1 ]) ; CProp ("power_rep", [ CVar 9; CVar 1 ]) ; CProp ("zero", []) ; CVar 1 ] ) ; CVar 1 ] ) ; CProp ("plus", [ CVar 8; CVar 9 ]) ] )); add (CProp ( "equal" , [ CProp ("gcd", [ CVar 23; CVar 24 ]); CProp ("gcd", [ CVar 24; CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("nth", [ CProp ("append", [ CVar 0; CVar 1 ]); CVar 8 ]) ; CProp ( "append" , [ CProp ("nth", [ CVar 0; CVar 8 ]) ; CProp ( "nth" , [ CVar 1 ; CProp ("difference", [ CVar 8; CProp ("length", [ CVar 0 ]) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("difference", [ CProp ("plus", [ CVar 23; CVar 24 ]); CVar 23 ]) ; CProp ("fix", [ CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ("difference", [ CProp ("plus", [ CVar 24; CVar 23 ]); CVar 23 ]) ; CProp ("fix", [ CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ( "difference" , [ CProp ("plus", [ CVar 23; CVar 24 ]) ; CProp ("plus", [ CVar 23; CVar 25 ]) ] ) ; CProp ("difference", [ CVar 24; CVar 25 ]) ] )); add (CProp ( "equal" , [ CProp ("times", [ CVar 23; CProp ("difference", [ CVar 2; CVar 22 ]) ]) ; CProp ( "difference" , [ CProp ("times", [ CVar 2; CVar 23 ]) ; CProp ("times", [ CVar 22; CVar 23 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("remainder", [ CProp ("times", [ CVar 23; CVar 25 ]); CVar 25 ]) ; CProp ("zero", []) ] )); add (CProp ( "equal" , [ CProp ( "difference" , [ CProp ("plus", [ CVar 1; CProp ("plus", [ CVar 0; CVar 2 ]) ]); CVar 0 ] ) ; CProp ("plus", [ CVar 1; CVar 2 ]) ] )); add (CProp ( "equal" , [ CProp ( "difference" , [ CProp ("add1", [ CProp ("plus", [ CVar 24; CVar 25 ]) ]); CVar 25 ] ) ; CProp ("add1", [ CVar 24 ]) ] )); add (CProp ( "equal" , [ CProp ( "lt" , [ CProp ("plus", [ CVar 23; CVar 24 ]) ; CProp ("plus", [ CVar 23; CVar 25 ]) ] ) ; CProp ("lt", [ CVar 24; CVar 25 ]) ] )); add (CProp ( "equal" , [ CProp ( "lt" , [ CProp ("times", [ CVar 23; CVar 25 ]) ; CProp ("times", [ CVar 24; CVar 25 ]) ] ) ; CProp ( "and" , [ CProp ("not", [ CProp ("zerop", [ CVar 25 ]) ]) ; CProp ("lt", [ CVar 23; CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("lt", [ CVar 24; CProp ("plus", [ CVar 23; CVar 24 ]) ]) ; CProp ("not", [ CProp ("zerop", [ CVar 23 ]) ]) ] )); add (CProp ( "equal" , [ CProp ( "gcd" , [ CProp ("times", [ CVar 23; CVar 25 ]) ; CProp ("times", [ CVar 24; CVar 25 ]) ] ) ; CProp ("times", [ CVar 25; CProp ("gcd", [ CVar 23; CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("value", [ CProp ("normalize", [ CVar 23 ]); CVar 0 ]) ; CProp ("value", [ CVar 23; CVar 0 ]) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("flatten", [ CVar 23 ]) ; CProp ("cons", [ CVar 24; CProp ("nil", []) ]) ] ) ; CProp ( "and" , [ CProp ("nlistp", [ CVar 23 ]); CProp ("equal", [ CVar 23; CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("listp", [ CProp ("gother", [ CVar 23 ]) ]) ; CProp ("listp", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ("samefringe", [ CVar 23; CVar 24 ]) ; CProp ("equal", [ CProp ("flatten", [ CVar 23 ]); CProp ("flatten", [ CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("greatest_factor", [ CVar 23; CVar 24 ]); CProp ("zero", []) ] ) ; CProp ( "and" , [ CProp ( "or" , [ CProp ("zerop", [ CVar 24 ]) ; CProp ("equal", [ CVar 24; CProp ("one", []) ]) ] ) ; CProp ("equal", [ CVar 23; CProp ("zero", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("greatest_factor", [ CVar 23; CVar 24 ]); CProp ("one", []) ] ) ; CProp ("equal", [ CVar 23; CProp ("one", []) ]) ] )); add (CProp ( "equal" , [ CProp ("numberp", [ CProp ("greatest_factor", [ CVar 23; CVar 24 ]) ]) ; CProp ( "not" , [ CProp ( "and" , [ CProp ( "or" , [ CProp ("zerop", [ CVar 24 ]) ; CProp ("equal", [ CVar 24; CProp ("one", []) ]) ] ) ; CProp ("not", [ CProp ("numberp", [ CVar 23 ]) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("times_list", [ CProp ("append", [ CVar 23; CVar 24 ]) ]) ; CProp ( "times" , [ CProp ("times_list", [ CVar 23 ]); CProp ("times_list", [ CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("prime_list", [ CProp ("append", [ CVar 23; CVar 24 ]) ]) ; CProp ( "and" , [ CProp ("prime_list", [ CVar 23 ]); CProp ("prime_list", [ CVar 24 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CVar 25; CProp ("times", [ CVar 22; CVar 25 ]) ]) ; CProp ( "and" , [ CProp ("numberp", [ CVar 25 ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 25; CProp ("zero", []) ]) ; CProp ("equal", [ CVar 22; CProp ("one", []) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("ge", [ CVar 23; CVar 24 ]) ; CProp ("not", [ CProp ("lt", [ CVar 23; CVar 24 ]) ]) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CVar 23; CProp ("times", [ CVar 23; CVar 24 ]) ]) ; CProp ( "or" , [ CProp ("equal", [ CVar 23; CProp ("zero", []) ]) ; CProp ( "and" , [ CProp ("numberp", [ CVar 23 ]) ; CProp ("equal", [ CVar 24; CProp ("one", []) ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("remainder", [ CProp ("times", [ CVar 24; CVar 23 ]); CVar 24 ]) ; CProp ("zero", []) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("times", [ CVar 0; CVar 1 ]); CProp ("one", []) ]) ; CProp ( "and" , [ CProp ("not", [ CProp ("equal", [ CVar 0; CProp ("zero", []) ]) ]) ; CProp ("not", [ CProp ("equal", [ CVar 1; CProp ("zero", []) ]) ]) ; CProp ("numberp", [ CVar 0 ]) ; CProp ("numberp", [ CVar 1 ]) ; CProp ("equal", [ CProp ("sub1", [ CVar 0 ]); CProp ("zero", []) ]) ; CProp ("equal", [ CProp ("sub1", [ CVar 1 ]); CProp ("zero", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "lt" , [ CProp ("length", [ CProp ("delete", [ CVar 23; CVar 11 ]) ]) ; CProp ("length", [ CVar 11 ]) ] ) ; CProp ("member", [ CVar 23; CVar 11 ]) ] )); add (CProp ( "equal" , [ CProp ("sort2", [ CProp ("delete", [ CVar 23; CVar 11 ]) ]) ; CProp ("delete", [ CVar 23; CProp ("sort2", [ CVar 11 ]) ]) ] )); add (CProp ("equal", [ CProp ("dsort", [ CVar 23 ]); CProp ("sort2", [ CVar 23 ]) ])); add (CProp ( "equal" , [ CProp ( "length" , [ CProp ( "cons" , [ CVar 0 ; CProp ( "cons" , [ CVar 1 ; CProp ( "cons" , [ CVar 2 ; CProp ( "cons" , [ CVar 3 ; CProp ( "cons" , [ CVar 4 ; CProp ("cons", [ CVar 5; CVar 6 ]) ] ) ] ) ] ) ] ) ] ) ] ) ; CProp ("plus", [ CProp ("six", []); CProp ("length", [ CVar 6 ]) ]) ] )); add (CProp ( "equal" , [ CProp ( "difference" , [ CProp ("add1", [ CProp ("add1", [ CVar 23 ]) ]); CProp ("two", []) ] ) ; CProp ("fix", [ CVar 23 ]) ] )); add (CProp ( "equal" , [ CProp ( "quotient" , [ CProp ("plus", [ CVar 23; CProp ("plus", [ CVar 23; CVar 24 ]) ]) ; CProp ("two", []) ] ) ; CProp ("plus", [ CVar 23; CProp ("quotient", [ CVar 24; CProp ("two", []) ]) ]) ] )); add (CProp ( "equal" , [ CProp ("sigma", [ CProp ("zero", []); CVar 8 ]) ; CProp ( "quotient" , [ CProp ("times", [ CVar 8; CProp ("add1", [ CVar 8 ]) ]) ; CProp ("two", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("plus", [ CVar 23; CProp ("add1", [ CVar 24 ]) ]) ; CProp ( "if" , [ CProp ("numberp", [ CVar 24 ]) ; CProp ("add1", [ CProp ("plus", [ CVar 23; CVar 24 ]) ]) ; CProp ("add1", [ CVar 23 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ( "equal" , [ CProp ("difference", [ CVar 23; CVar 24 ]) ; CProp ("difference", [ CVar 25; CVar 24 ]) ] ) ; CProp ( "if" , [ CProp ("lt", [ CVar 23; CVar 24 ]) ; CProp ("not", [ CProp ("lt", [ CVar 24; CVar 25 ]) ]) ; CProp ( "if" , [ CProp ("lt", [ CVar 25; CVar 24 ]) ; CProp ("not", [ CProp ("lt", [ CVar 24; CVar 23 ]) ]) ; CProp ( "equal" , [ CProp ("fix", [ CVar 23 ]); CProp ("fix", [ CVar 25 ]) ] ) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ( "meaning" , [ CProp ("plus_tree", [ CProp ("delete", [ CVar 23; CVar 24 ]) ]); CVar 0 ] ) ; CProp ( "if" , [ CProp ("member", [ CVar 23; CVar 24 ]) ; CProp ( "difference" , [ CProp ("meaning", [ CProp ("plus_tree", [ CVar 24 ]); CVar 0 ]) ; CProp ("meaning", [ CVar 23; CVar 0 ]) ] ) ; CProp ("meaning", [ CProp ("plus_tree", [ CVar 24 ]); CVar 0 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("times", [ CVar 23; CProp ("add1", [ CVar 24 ]) ]) ; CProp ( "if" , [ CProp ("numberp", [ CVar 24 ]) ; CProp ( "plus" , [ CVar 23 ; CProp ("times", [ CVar 23; CVar 24 ]) ; CProp ("fix", [ CVar 23 ]) ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("nth", [ CProp ("nil", []); CVar 8 ]) ; CProp ("if", [ CProp ("zerop", [ CVar 8 ]); CProp ("nil", []); CProp ("zero", []) ]) ] )); add (CProp ( "equal" , [ CProp ("last", [ CProp ("append", [ CVar 0; CVar 1 ]) ]) ; CProp ( "if" , [ CProp ("listp", [ CVar 1 ]) ; CProp ("last", [ CVar 1 ]) ; CProp ( "if" , [ CProp ("listp", [ CVar 0 ]) ; CProp ( "cons" , [ CProp ("car", [ CProp ("last", [ CVar 0 ]) ]); CVar 1 ] ) ; CVar 1 ] ) ] ) ] )); add (CProp ( "equal" , [ CProp ("equal", [ CProp ("lt", [ CVar 23; CVar 24 ]); CVar 25 ]) ; CProp ( "if" , [ CProp ("lt", [ CVar 23; CVar 24 ]) ; CProp ("equal", [ CProp ("true", []); CVar 25 ]) ; CProp ("equal", [ CProp ("false", []); CVar 25 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("assignment", [ CVar 23; CProp ("append", [ CVar 0; CVar 1 ]) ]) ; CProp ( "if" , [ CProp ("assignedp", [ CVar 23; CVar 0 ]) ; CProp ("assignment", [ CVar 23; CVar 0 ]) ; CProp ("assignment", [ CVar 23; CVar 1 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("car", [ CProp ("gother", [ CVar 23 ]) ]) ; CProp ( "if" , [ CProp ("listp", [ CVar 23 ]) ; CProp ("car", [ CProp ("flatten", [ CVar 23 ]) ]) ; CProp ("zero", []) ] ) ] )); add (CProp ( "equal" , [ CProp ("flatten", [ CProp ("cdr", [ CProp ("gother", [ CVar 23 ]) ]) ]) ; CProp ( "if" , [ CProp ("listp", [ CVar 23 ]) ; CProp ("cdr", [ CProp ("flatten", [ CVar 23 ]) ]) ; CProp ("cons", [ CProp ("zero", []); CProp ("nil", []) ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("quotient", [ CProp ("times", [ CVar 24; CVar 23 ]); CVar 24 ]) ; CProp ( "if" , [ CProp ("zerop", [ CVar 24 ]) ; CProp ("zero", []) ; CProp ("fix", [ CVar 23 ]) ] ) ] )); add (CProp ( "equal" , [ CProp ("get", [ CVar 9; CProp ("set", [ CVar 8; CVar 21; CVar 12 ]) ]) ; CProp ( "if" , [ CProp ("eqp", [ CVar 9; CVar 8 ]) ; CVar 21 ; CProp ("get", [ CVar 9; CVar 12 ]) ] ) ] )) (* Tautology checker *) let truep x lst = match x with | Prop (head, _) -> head.name = "true" || List.mem x lst | _ -> List.mem x lst and falsep x lst = match x with | Prop (head, _) -> head.name = "false" || List.mem x lst | _ -> List.mem x lst let rec tautologyp x true_lst false_lst = if truep x true_lst then true else if falsep x false_lst then false else (* print_term x; print_newline(); *) match x with | Var _ -> false | Prop (head, [ test; yes; no ]) -> if head.name = "if" then if truep test true_lst then tautologyp yes true_lst false_lst else if falsep test false_lst then tautologyp no true_lst false_lst else tautologyp yes (test :: true_lst) false_lst && tautologyp no true_lst (test :: false_lst) else false | _ -> assert false let tautp x = (* print_term x; print_string"\n"; *) let y = rewrite x in (* print_term y; print_string "\n"; *) tautologyp y [] [] (* the benchmark *) let subst = [ Bind ( 23 , cterm_to_term (CProp ( "f" , [ CProp ( "plus" , [ CProp ("plus", [ CVar 0; CVar 1 ]) ; CProp ("plus", [ CVar 2; CProp ("zero", []) ]) ] ) ] )) ) ; Bind ( 24 , cterm_to_term (CProp ( "f" , [ CProp ( "times" , [ CProp ("times", [ CVar 0; CVar 1 ]) ; CProp ("plus", [ CVar 2; CVar 3 ]) ] ) ] )) ) ; Bind ( 25 , cterm_to_term (CProp ( "f" , [ CProp ( "reverse" , [ CProp ( "append" , [ CProp ("append", [ CVar 0; CVar 1 ]); CProp ("nil", []) ] ) ] ) ] )) ) ; Bind ( 20 , cterm_to_term (CProp ( "equal" , [ CProp ("plus", [ CVar 0; CVar 1 ]) ; CProp ("difference", [ CVar 23; CVar 24 ]) ] )) ) ; Bind ( 22 , cterm_to_term (CProp ( "lt" , [ CProp ("remainder", [ CVar 0; CVar 1 ]) ; CProp ("member", [ CVar 0; CProp ("length", [ CVar 1 ]) ]) ] )) ) ] let term = cterm_to_term (CProp ( "implies" , [ CProp ( "and" , [ CProp ("implies", [ CVar 23; CVar 24 ]) ; CProp ( "and" , [ CProp ("implies", [ CVar 24; CVar 25 ]) ; CProp ( "and" , [ CProp ("implies", [ CVar 25; CVar 20 ]) ; CProp ("implies", [ CVar 20; CVar 22 ]) ] ) ] ) ] ) ; CProp ("implies", [ CVar 23; CVar 22 ]) ] )) let _ = let ok = ref true in for _ = 1 to 50 do if not (tautp (apply_subst subst term)) then ok := false done; assert !ok (* if !ok then print_string "Proved!\n" else print_string "Cannot prove!\n"; exit 0 *) (********* with failure s -> print_string "Exception failure("; print_string s; print_string ")\n" | Unify -> print_string "Exception Unify\n" | match_failure(file,start,stop) -> print_string "Exception match_failure("; print_string file; print_string ","; print_int start; print_string ","; print_int stop; print_string ")\n" | _ -> print_string "Exception ?\n" **********) js_of_ocaml-3.5.2/benchmarks/sources/ml/dune000066400000000000000000000011571357507750000210770ustar00rootroot00000000000000(executables (names almabench bdd binary_trees boyer boyer_no_exc fannkuch_redux_2 fannkuch_redux fft fib hamming kb kb_no_exc loop nucleic quicksort raytrace soli splay takc taku)) (alias (name benchmark) (deps almabench.exe bdd.exe binary_trees.exe boyer.exe boyer_no_exc.exe fannkuch_redux_2.exe fannkuch_redux.exe fft.exe fib.exe hamming.exe kb.exe kb_no_exc.exe loop.exe nucleic.exe quicksort.exe raytrace.exe soli.exe splay.exe takc.exe taku.exe ))js_of_ocaml-3.5.2/benchmarks/sources/ml/fannkuch_redux.ml000066400000000000000000000031671357507750000235620ustar00rootroot00000000000000(* The Computer Language Benchmarks Game http://shootout.alioth.debian.org/ from Scala version by Otto Bommer, August 2010 *) let fannkuch n = let perm1 = Array.make n 0 in for i = 0 to n - 1 do perm1.(i) <- i done; let perm = Array.make n 0 in let count = Array.make n 0 in let flips = ref 0 and maxflips = ref 0 and checksum = ref 0 and nperm = ref 0 and r = ref n in while !r > 0 do (* Printf.printf "perm="; i := 0; while !i < n do Printf.printf "%d " perm1.(!i); i := !i +1; done; Printf.printf "\n"; *) for i = 0 to n - 1 do perm.(i) <- perm1.(i) done; while !r != 1 do count.(!r - 1) <- !r; r := !r - 1 done; flips := 0; let k = ref perm.(0) in while !k != 0 do let t = ref 0 in for i = 0 to !k / 2 do t := perm.(i); perm.(i) <- perm.(!k - i); perm.(!k - i) <- !t done; k := perm.(0); flips := !flips + 1 done; maxflips := max !maxflips !flips; checksum := !checksum + (!flips * (1 - ((!nperm land 1) lsl 1))); let go = ref true in let t = ref 0 in while !go do if !r == n then ( go := false; r := 0) else ( t := perm1.(0); for i = 0 to !r - 1 do perm1.(i) <- perm1.(i + 1) done; perm1.(!r) <- !t; count.(!r) <- count.(!r) - 1; if count.(!r) > 0 then go := false else r := !r + 1) done; incr nperm done; !maxflips, !checksum let _ = let n = 10 in let _maxflips, _checksum = fannkuch n in ( (* Printf.printf "%d\nPfannkuchen(%d) = %d\n" checksum n maxflips *) ) js_of_ocaml-3.5.2/benchmarks/sources/ml/fannkuch_redux_2.ml000066400000000000000000000036541357507750000240040ustar00rootroot00000000000000(* The Computer Language Benchmarks Game http://shootout.alioth.debian.org/ contributed by Isaac Gouy, transliterated from Mike Pall's Lua program *) let fannkuch n = let p = Array.make n 0 in let q = Array.make n 0 in let s = Array.make n 0 in let sign = ref 1 in let maxflips = ref 0 in let sum = ref 0 in for i = 0 to n - 1 do p.(i) <- i; q.(i) <- i; s.(i) <- i done; while true do let q0 = ref p.(0) in if !q0 <> 0 then ( for i = 1 to n - 1 do q.(i) <- p.(i) done; let flips = ref 1 in while let qq = q.(!q0) in if qq = 0 then ( sum := !sum + (!sign * !flips); if !flips > !maxflips then maxflips := !flips; false) else true do let qq = q.(!q0) in q.(!q0) <- !q0; (if !q0 >= 3 then let i = ref 1 in let j = ref (!q0 - 1) in while let t = q.(!i) in q.(!i) <- q.(!j); q.(!j) <- t; incr i; decr j; !i < !j do () done); q0 := qq; incr flips done); if !sign = 1 then ( let t = p.(1) in p.(1) <- p.(0); p.(0) <- t; sign := -1) else let t = p.(1) in p.(1) <- p.(2); p.(2) <- t; sign := 1; try for i = 2 to n - 1 do let sx = s.(i) in if sx <> 0 then ( s.(i) <- sx - 1; raise Exit); if i = n - 1 then ( if false then Format.eprintf "%d %d@." !sum !maxflips; exit 0); s.(i) <- i; let t = p.(0) in for j = 0 to i do p.(j) <- p.(j + 1) done; p.(i + 1) <- t done with Exit -> () done let n = 10 let pf = fannkuch n (* //print(pf[0] + "\n" + "Pfannkuchen(" + n + ") = " + pf[1]); *) js_of_ocaml-3.5.2/benchmarks/sources/ml/fft.ml000066400000000000000000000114771357507750000213400ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: fft.ml 7017 2005-08-12 09:22:04Z xleroy $ *) let pi = 3.14159265358979323846 let tpi = 2.0 *. pi let fft px py np = let i = ref 2 in let m = ref 1 in while !i < np do i := !i + !i; m := !m + 1 done; let n = !i in if n <> np then for i = np + 1 to n do px.(i) <- 0.0; py.(i) <- 0.0 (* print_string "Use "; print_int n; print_string " point fft"; print_newline() *) done; let n2 = ref (n + n) in for _ = 1 to !m - 1 do n2 := !n2 / 2; let n4 = !n2 / 4 in let e = tpi /. float !n2 in for j = 1 to n4 do let a = e *. float (j - 1) in let a3 = 3.0 *. a in let cc1 = cos a in let ss1 = sin a in let cc3 = cos a3 in let ss3 = sin a3 in let is = ref j in let id = ref (2 * !n2) in while !is < n do let i0r = ref !is in while !i0r < n do let i0 = !i0r in let i1 = i0 + n4 in let i2 = i1 + n4 in let i3 = i2 + n4 in let r1 = px.(i0) -. px.(i2) in px.(i0) <- px.(i0) +. px.(i2); let r2 = px.(i1) -. px.(i3) in px.(i1) <- px.(i1) +. px.(i3); let s1 = py.(i0) -. py.(i2) in py.(i0) <- py.(i0) +. py.(i2); let s2 = py.(i1) -. py.(i3) in py.(i1) <- py.(i1) +. py.(i3); let s3 = r1 -. s2 in let r1 = r1 +. s2 in let s2 = r2 -. s1 in let r2 = r2 +. s1 in px.(i2) <- (r1 *. cc1) -. (s2 *. ss1); py.(i2) <- (-.s2 *. cc1) -. (r1 *. ss1); px.(i3) <- (s3 *. cc3) +. (r2 *. ss3); py.(i3) <- (r2 *. cc3) -. (s3 *. ss3); i0r := i0 + !id done; is := (2 * !id) - !n2 + j; id := 4 * !id done done done; (************************************) (* Last stage, length=2 butterfly *) (************************************) let is = ref 1 in let id = ref 4 in while !is < n do let i0r = ref !is in while !i0r <= n do let i0 = !i0r in let i1 = i0 + 1 in let r1 = px.(i0) in px.(i0) <- r1 +. px.(i1); px.(i1) <- r1 -. px.(i1); let r1 = py.(i0) in py.(i0) <- r1 +. py.(i1); py.(i1) <- r1 -. py.(i1); i0r := i0 + !id done; is := (2 * !id) - 1; id := 4 * !id done; (*************************) (* Bit reverse counter *) (*************************) let j = ref 1 in for i = 1 to n - 1 do if i < !j then ( let xt = px.(!j) in px.(!j) <- px.(i); px.(i) <- xt; let xt = py.(!j) in py.(!j) <- py.(i); py.(i) <- xt); let k = ref (n / 2) in while !k < !j do j := !j - !k; k := !k / 2 done; j := !j + !k done; n let test np = (* print_int np; print_string "... "; flush stdout;*) let enp = float np in let npm = (np / 2) - 1 in let pxr = Array.make (np + 2) 0.0 and pxi = Array.make (np + 2) 0.0 in let t = pi /. enp in pxr.(1) <- (enp -. 1.0) *. 0.5; pxi.(1) <- 0.0; let n2 = np / 2 in pxr.(n2 + 1) <- -0.5; pxi.(n2 + 1) <- 0.0; for i = 1 to npm do let j = np - i in pxr.(i + 1) <- -0.5; pxr.(j + 1) <- -0.5; let z = t *. float i in let y = -0.5 *. (cos z /. sin z) in pxi.(i + 1) <- y; pxi.(j + 1) <- -.y done; (* print_newline(); for i=0 to 15 do Printf.printf "%d %f %f\n" i pxr.(i+1) pxi.(i+1) done; *) let _ = fft pxr pxi np in (* for i=0 to 15 do Printf.printf "%d %f %f\n" i pxr.(i+1) pxi.(i+1) done; *) let zr = ref 0.0 in let zi = ref 0.0 in let kr = ref 0 in let ki = ref 0 in for i = 0 to np - 1 do let a = abs_float (pxr.(i + 1) -. float i) in if !zr < a then ( zr := a; kr := i); let a = abs_float pxi.(i + 1) in if !zi < a then ( zi := a; ki := i) done; (*print !zr; print !zi;*) if abs_float !zr <= 1e-8 && abs_float !zi <= 1e-8 then ( (*print_string "ok"*) ) else assert false (*print_string "ERROR"*); ( (* print_newline()*) ) let _ = let np = ref 16 in for _ = 1 to 16 do test !np; np := !np * 2 done js_of_ocaml-3.5.2/benchmarks/sources/ml/fib.ml000066400000000000000000000021261357507750000213100ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: fib.ml 7017 2005-08-12 09:22:04Z xleroy $ *) let rec fib n = if n < 2 then 1 else fib (n - 1) + fib (n - 2) let _ = let n = 40 in (* if Array.length Sys.argv >= 2 then int_of_string Sys.argv.(1) else 40 in *) assert (fib n = 165580141) (*; print_newline(); exit 0*) js_of_ocaml-3.5.2/benchmarks/sources/ml/hamming.ml000066400000000000000000000056051357507750000221750ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Damien Doligez, projet Moscova, INRIA Rocquencourt *) (* *) (* Copyright 2002 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: hamming.ml 4303 2002-01-23 17:50:20Z doligez $ *) (* We cannot use bignums because we don't do custom runtimes, but int64 is a bit short, so we roll our own 37-digit numbers... *) let n0 = Int64.of_int 0 let n1 = Int64.of_int 1 let n2 = Int64.of_int 2 let n3 = Int64.of_int 3 let n5 = Int64.of_int 5 let ( % ) = Int64.rem let ( * ) = Int64.mul let ( / ) = Int64.div let ( + ) = Int64.add let digit = Int64.of_string "1000000000000000000" let mul n (pl, ph) = n * pl % digit, (n * ph) + (n * pl / digit) let cmp (nl, nh) (pl, ph) = if nh < ph then -1 else if nh > ph then 1 else if nl < pl then -1 else if nl > pl then 1 else 0 let x2 p = mul n2 p let x3 p = mul n3 p let x5 p = mul n5 p let nn1 = n1, n0 let pr (_nl, _nh) = ( (* if compare nh n0 = 0 then Printf.printf "%Ld\n" nl else Printf.printf "%Ld%018Ld\n" nh nl *) ) (* (* bignum version *) open Num;; let nn1 = num_of_int 1;; let x2 = fun p -> (num_of_int 2) */ p;; let x3 = fun p -> (num_of_int 3) */ p;; let x5 = fun p -> (num_of_int 5) */ p;; let cmp n p = sign_num (n -/ p);; let pr n = Printf.printf "%s\n" (string_of_num n);; *) (* This is where the interesting stuff begins. *) open Lazy type 'a lcons = Cons of 'a * 'a lcons Lazy.t type 'a llist = 'a lcons Lazy.t let rec map f l = lazy (match force l with | Cons (x, ll) -> Cons (f x, map f ll)) let rec merge cmp l1 l2 = lazy (match force l1, force l2 with | Cons (x1, ll1), Cons (x2, ll2) -> let c = cmp x1 x2 in if c = 0 then Cons (x1, merge cmp ll1 ll2) else if c < 0 then Cons (x1, merge cmp ll1 l2) else Cons (x2, merge cmp l1 ll2)) let rec iter_interval f l (start, stop) = if stop = 0 then () else match force l with | Cons (x, ll) -> if start <= 0 then f x; iter_interval f ll (start - 1, stop - 1) let rec hamming = lazy (Cons (nn1, merge cmp ham2 (merge cmp ham3 ham5))) and ham2 = lazy (force (map x2 hamming)) and ham3 = lazy (force (map x3 hamming)) and ham5 = lazy (force (map x5 hamming)) ;; iter_interval pr hamming (88000, 88100) js_of_ocaml-3.5.2/benchmarks/sources/ml/kb.ml000066400000000000000000000461431357507750000211530ustar00rootroot00000000000000let print_string _ = () let print_int _ = () let print_newline _ = () (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: terms.ml 2553 1999-11-17 18:59:06Z xleroy $ *) (****************** Term manipulations *****************) type term = | Var of int | Term of string * term list let rec union l1 l2 = match l1 with | [] -> l2 | a :: r -> if List.mem a l2 then union r l2 else a :: union r l2 let rec vars = function | Var n -> [ n ] | Term (_, l) -> vars_of_list l and vars_of_list = function | [] -> [] | t :: r -> union (vars t) (vars_of_list r) let rec substitute subst = function | Term (oper, sons) -> Term (oper, List.map (substitute subst) sons) | Var n as t -> ( try List.assoc n subst with Not_found -> t) (* Term replacement: replace M u N is M[u<-N]. *) let rec replace m u n = match u, m with | [], _ -> n | i :: u, Term (oper, sons) -> Term (oper, replace_nth i sons u n) | _ -> failwith "replace" and replace_nth i sons u n = match sons with | s :: r -> if i = 1 then replace s u n :: r else s :: replace_nth (i - 1) r u n | [] -> failwith "replace_nth" (* Term matching. *) let matching term1 term2 = let rec match_rec subst t1 t2 = match t1, t2 with | Var v, _ -> if List.mem_assoc v subst then if t2 = List.assoc v subst then subst else failwith "matching" else (v, t2) :: subst | Term (op1, sons1), Term (op2, sons2) -> if op1 = op2 then List.fold_left2 match_rec subst sons1 sons2 else failwith "matching" | _ -> failwith "matching" in match_rec [] term1 term2 (* A naive unification algorithm. *) let compsubst subst1 subst2 = List.map (fun (v, t) -> v, substitute subst1 t) subst2 @ subst1 let rec occurs n = function | Var m -> m = n | Term (_, sons) -> List.exists (occurs n) sons let rec unify term1 term2 = match term1, term2 with | Var n1, _ -> if term1 = term2 then [] else if occurs n1 term2 then failwith "unify" else [ n1, term2 ] | term1, Var n2 -> if occurs n2 term1 then failwith "unify" else [ n2, term1 ] | Term (op1, sons1), Term (op2, sons2) -> if op1 = op2 then List.fold_left2 (fun s t1 t2 -> compsubst (unify (substitute s t1) (substitute s t2)) s) [] sons1 sons2 else failwith "unify" (* We need to print terms with variables independently from input terms obtained by parsing. We give arbitrary names v1,v2,... to their variables. *) let infixes = [ "+"; "*" ] let pretty_term _ = () let pretty_close _ = () (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: equations.ml 2553 1999-11-17 18:59:06Z xleroy $ *) (****************** Equation manipulations *************) type rule = { number : int ; numvars : int ; lhs : term ; rhs : term } (* standardizes an equation so its variables are 1,2,... *) let mk_rule num m n = let all_vars = union (vars m) (vars n) in let counter = ref 0 in let subst = List.map (fun v -> incr counter; v, Var !counter) (List.rev all_vars) in { number = num; numvars = !counter; lhs = substitute subst m; rhs = substitute subst n } (* checks that rules are numbered in sequence and returns their number *) let check_rules rules = let counter = ref 0 in List.iter (fun r -> incr counter; if r.number <> !counter then failwith "Rule numbers not in sequence") rules; !counter let pretty_rule rule = print_int rule.number; print_string " : "; pretty_term rule.lhs; print_string " = "; pretty_term rule.rhs; print_newline () let pretty_rules rules = List.iter pretty_rule rules (****************** Rewriting **************************) (* Top-level rewriting. Let eq:L=R be an equation, M be a term such that L<=M. With sigma = matching L M, we define the image of M by eq as sigma(R) *) let reduce l m r = substitute (matching l m) r (* Test whether m can be reduced by l, i.e. m contains an instance of l. *) let can_match l m = try let _ = matching l m in true with Failure _ -> false let rec reducible l m = can_match l m || match m with | Term (_, sons) -> List.exists (reducible l) sons | _ -> false (* Top-level rewriting with multiple rules. *) let rec mreduce rules m = match rules with | [] -> failwith "mreduce" | rule :: rest -> ( try reduce rule.lhs m rule.rhs with Failure _ -> mreduce rest m) (* One step of rewriting in leftmost-outermost strategy, with multiple rules. Fails if no redex is found *) let rec mrewrite1 rules m = try mreduce rules m with Failure _ -> ( match m with | Var _ -> failwith "mrewrite1" | Term (f, sons) -> Term (f, mrewrite1_sons rules sons)) and mrewrite1_sons rules = function | [] -> failwith "mrewrite1" | son :: rest -> ( try mrewrite1 rules son :: rest with Failure _ -> son :: mrewrite1_sons rules rest) (* Iterating rewrite1. Returns a normal form. May loop forever *) let rec mrewrite_all rules m = try mrewrite_all rules (mrewrite1 rules m) with Failure _ -> m (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: orderings.ml 2553 1999-11-17 18:59:06Z xleroy $ *) (*********************** Recursive Path Ordering ****************************) type ordering = | Greater | Equal | NotGE let ge_ord order pair = match order pair with | NotGE -> false | _ -> true and gt_ord order pair = match order pair with | Greater -> true | _ -> false and eq_ord order pair = match order pair with | Equal -> true | _ -> false let rec rem_eq equiv x = function | [] -> failwith "rem_eq" | y :: l -> if equiv (x, y) then l else y :: rem_eq equiv x l let diff_eq equiv (x, y) = let rec diffrec = function | ([], _) as p -> p | h :: t, y -> ( try diffrec (t, rem_eq equiv h y) with Failure _ -> let x', y' = diffrec (t, y) in h :: x', y') in if List.length x > List.length y then diffrec (y, x) else diffrec (x, y) (* Multiset extension of order *) let mult_ext order = function | Term (_, sons1), Term (_, sons2) -> ( match diff_eq (eq_ord order) (sons1, sons2) with | [], [] -> Equal | l1, l2 -> if List.for_all (fun n -> List.exists (fun m -> gt_ord order (m, n)) l1) l2 then Greater else NotGE) | _ -> failwith "mult_ext" (* Lexicographic extension of order *) let lex_ext order = function | (Term (_, sons1) as m), (Term (_, sons2) as n) -> let rec lexrec = function | [], [] -> Equal | [], _ -> NotGE | _, [] -> Greater | x1 :: l1, x2 :: l2 -> ( match order (x1, x2) with | Greater -> if List.for_all (fun n' -> gt_ord order (m, n')) l2 then Greater else NotGE | Equal -> lexrec (l1, l2) | NotGE -> if List.exists (fun m' -> ge_ord order (m', n)) l1 then Greater else NotGE ) in lexrec (sons1, sons2) | _ -> failwith "lex_ext" (* Recursive path ordering *) let rpo op_order ext = let rec rporec (m, n) = if m = n then Equal else match m with | Var _ -> NotGE | Term (op1, sons1) -> ( match n with | Var vn -> if occurs vn m then Greater else NotGE | Term (op2, sons2) -> ( match op_order op1 op2 with | Greater -> if List.for_all (fun n' -> gt_ord rporec (m, n')) sons2 then Greater else NotGE | Equal -> ext rporec (m, n) | NotGE -> if List.exists (fun m' -> ge_ord rporec (m', n)) sons1 then Greater else NotGE)) in rporec (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: kb.ml 2553 1999-11-17 18:59:06Z xleroy $ *) (****************** Critical pairs *********************) (* All (u,subst) such that N/u (&var) unifies with M, with principal unifier subst *) let rec super m = function | Term (_, sons) as n -> ( let rec collate n = function | [] -> [] | son :: rest -> List.map (fun (u, subst) -> n :: u, subst) (super m son) @ collate (n + 1) rest in let insides = collate 1 sons in try ([], unify m n) :: insides with Failure _ -> insides) | _ -> [] (* Ex : let (m,_) = <> and (n,_) = <> in super m n ==> [[1],[2,Term ("B",[])]; x <- B [2],[2,Term ("A",[]); 1,Term ("B",[])]] x <- A y <- B *) (* All (u,subst), u&[], such that n/u unifies with m *) let super_strict m = function | Term (_, sons) -> let rec collate n = function | [] -> [] | son :: rest -> List.map (fun (u, subst) -> n :: u, subst) (super m son) @ collate (n + 1) rest in collate 1 sons | _ -> [] (* Critical pairs of l1=r1 with l2=r2 *) (* critical_pairs : term_pair -> term_pair -> term_pair list *) let critical_pairs (l1, r1) (l2, r2) = let mk_pair (u, subst) = substitute subst (replace l2 u r1), substitute subst r2 in List.map mk_pair (super l1 l2) (* Strict critical pairs of l1=r1 with l2=r2 *) (* strict_critical_pairs : term_pair -> term_pair -> term_pair list *) let strict_critical_pairs (l1, r1) (l2, r2) = let mk_pair (u, subst) = substitute subst (replace l2 u r1), substitute subst r2 in List.map mk_pair (super_strict l1 l2) (* All critical pairs of eq1 with eq2 *) let mutual_critical_pairs eq1 eq2 = strict_critical_pairs eq1 eq2 @ critical_pairs eq2 eq1 (* Renaming of variables *) let rename n (t1, t2) = let rec ren_rec = function | Var k -> Var (k + n) | Term (op, sons) -> Term (op, List.map ren_rec sons) in ren_rec t1, ren_rec t2 (************************ Completion ******************************) let deletion_message rule = print_string "Rule "; print_int rule.number; print_string " deleted"; print_newline () (* Generate failure message *) let non_orientable (m, n) = pretty_term m; print_string " = "; pretty_term n; print_newline () let rec partition p = function | [] -> [], [] | x :: l -> let l1, l2 = partition p l in if p x then x :: l1, l2 else l1, x :: l2 let rec get_rule n = function | [] -> raise Not_found | r :: l -> if n = r.number then r else get_rule n l (* Improved Knuth-Bendix completion procedure *) let kb_completion greater = let rec kbrec j rules = let rec process failures (k, l) eqs = (**** print_string "***kb_completion "; print_int j; print_newline(); pretty_rules rules; List.iter non_orientable failures; print_int k; print_string " "; print_int l; print_newline(); List.iter non_orientable eqs; ***) match eqs with | [] -> ( if k < l then next_criticals failures (k + 1, l) else if l < j then next_criticals failures (1, l + 1) else match failures with | [] -> rules (* successful completion *) | _ -> print_string "Non-orientable equations :"; print_newline (); List.iter non_orientable failures; failwith "kb_completion") | (m, n) :: eqs -> let m' = mrewrite_all rules m and n' = mrewrite_all rules n and enter_rule (left, right) = let new_rule = mk_rule (j + 1) left right in pretty_rule new_rule; let left_reducible rule = reducible left rule.lhs in let redl, irredl = partition left_reducible rules in List.iter deletion_message redl; let right_reduce rule = mk_rule rule.number rule.lhs (mrewrite_all (new_rule :: rules) rule.rhs) in let irreds = List.map right_reduce irredl in let eqs' = List.map (fun rule -> rule.lhs, rule.rhs) redl in kbrec (j + 1) (new_rule :: irreds) [] (k, l) (eqs @ eqs' @ failures) in (*** print_string "--- Considering "; non_orientable (m', n'); ***) if m' = n' then process failures (k, l) eqs else if greater (m', n') then enter_rule (m', n') else if greater (n', m') then enter_rule (n', m') else process ((m', n') :: failures) (k, l) eqs and next_criticals failures (k, l) = (**** print_string "***next_criticals "; print_int k; print_string " "; print_int l ; print_newline(); ****) try let rl = get_rule l rules in let el = rl.lhs, rl.rhs in if k = l then process failures (k, l) (strict_critical_pairs el (rename rl.numvars el)) else try let rk = get_rule k rules in let ek = rk.lhs, rk.rhs in process failures (k, l) (mutual_critical_pairs el (rename rl.numvars ek)) with Not_found -> next_criticals failures (k + 1, l) with Not_found -> next_criticals failures (1, l + 1) in process in kbrec (* complete_rules is assumed locally confluent, and checked Noetherian with ordering greater, rules is any list of rules *) let kb_complete greater complete_rules rules = let n = check_rules complete_rules and eqs = List.map (fun rule -> rule.lhs, rule.rhs) rules in let completed_rules = kb_completion greater n complete_rules [] (n, n) eqs in print_string "Canonical set found :"; print_newline (); pretty_rules (List.rev completed_rules) (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: kbmain.ml 7017 2005-08-12 09:22:04Z xleroy $ *) (**** let group_rules = [ { number = 1; numvars = 1; lhs = Term("*", [Term("U",[]); Var 1]); rhs = Var 1 }; { number = 2; numvars = 1; lhs = Term("*", [Term("I",[Var 1]); Var 1]); rhs = Term("U",[]) }; { number = 3; numvars = 3; lhs = Term("*", [Term("*", [Var 1; Var 2]); Var 3]); rhs = Term("*", [Var 1; Term("*", [Var 2; Var 3])]) } ] ****) let geom_rules = [ { number = 1; numvars = 1; lhs = Term ("*", [ Term ("U", []); Var 1 ]); rhs = Var 1 } ; { number = 2 ; numvars = 1 ; lhs = Term ("*", [ Term ("I", [ Var 1 ]); Var 1 ]) ; rhs = Term ("U", []) } ; { number = 3 ; numvars = 3 ; lhs = Term ("*", [ Term ("*", [ Var 1; Var 2 ]); Var 3 ]) ; rhs = Term ("*", [ Var 1; Term ("*", [ Var 2; Var 3 ]) ]) } ; { number = 4 ; numvars = 0 ; lhs = Term ("*", [ Term ("A", []); Term ("B", []) ]) ; rhs = Term ("*", [ Term ("B", []); Term ("A", []) ]) } ; { number = 5 ; numvars = 0 ; lhs = Term ("*", [ Term ("C", []); Term ("C", []) ]) ; rhs = Term ("U", []) } ; { number = 6 ; numvars = 0 ; lhs = Term ( "*" , [ Term ("C", []) ; Term ("*", [ Term ("A", []); Term ("I", [ Term ("C", []) ]) ]) ] ) ; rhs = Term ("I", [ Term ("A", []) ]) } ; { number = 7 ; numvars = 0 ; lhs = Term ( "*" , [ Term ("C", []) ; Term ("*", [ Term ("B", []); Term ("I", [ Term ("C", []) ]) ]) ] ) ; rhs = Term ("B", []) } ] let group_rank = function | "U" -> 0 | "*" -> 1 | "I" -> 2 | "B" -> 3 | "C" -> 4 | "A" -> 5 | _ -> assert false let group_precedence op1 op2 = let r1 = group_rank op1 and r2 = group_rank op2 in if r1 = r2 then Equal else if r1 > r2 then Greater else NotGE let group_order = rpo group_precedence lex_ext let greater pair = match group_order pair with | Greater -> true | _ -> false let _ = for _ = 1 to 20 do kb_complete greater [] geom_rules done js_of_ocaml-3.5.2/benchmarks/sources/ml/kb_no_exc.ml000066400000000000000000000502721357507750000225040ustar00rootroot00000000000000let print_string _ = () let print_int _ = () let print_newline _ = () (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: terms.ml 2553 1999-11-17 18:59:06Z xleroy $ *) (****************** Term manipulations *****************) type term = | Var of int | Term of string * term list let rec union l1 l2 = match l1 with | [] -> l2 | a :: r -> if List.mem a l2 then union r l2 else a :: union r l2 let rec vars = function | Var n -> [ n ] | Term (_, l) -> vars_of_list l and vars_of_list = function | [] -> [] | t :: r -> union (vars t) (vars_of_list r) let rec substitute subst = function | Term (oper, sons) -> Term (oper, List.map (substitute subst) sons) | Var n as t -> ( try List.assoc n subst with Not_found -> t) (* Term replacement: replace M u N is M[u<-N]. *) let rec replace m u n = match u, m with | [], _ -> n | i :: u, Term (oper, sons) -> Term (oper, replace_nth i sons u n) | _ -> failwith "replace" and replace_nth i sons u n = match sons with | s :: r -> if i = 1 then replace s u n :: r else s :: replace_nth (i - 1) r u n | [] -> failwith "replace_nth" (* Term matching. *) let rec fold_left2_opt f accu l1 l2 = match l1, l2 with | [], [] -> Some accu | a1 :: l1, a2 :: l2 -> ( match f accu a1 a2 with | None -> None | Some accu' -> fold_left2_opt f accu' l1 l2) | _, _ -> invalid_arg "List.fold_left2" let rec match_rec subst t1 t2 = match t1, t2 with | Var v, _ -> if List.mem_assoc v subst then if t2 = List.assoc v subst then Some subst else None else Some ((v, t2) :: subst) | Term (op1, sons1), Term (op2, sons2) -> if op1 = op2 then fold_left2_opt match_rec subst sons1 sons2 else None | _ -> None let matching term1 term2 = match_rec [] term1 term2 (* A naive unification algorithm. *) let compsubst subst1 subst2 = List.map (fun (v, t) -> v, substitute subst1 t) subst2 @ subst1 let rec occurs n = function | Var m -> m = n | Term (_, sons) -> List.exists (occurs n) sons let rec unify term1 term2 = match term1, term2 with | Var n1, _ -> if term1 = term2 then [] else if occurs n1 term2 then failwith "unify" else [ n1, term2 ] | term1, Var n2 -> if occurs n2 term1 then failwith "unify" else [ n2, term1 ] | Term (op1, sons1), Term (op2, sons2) -> if op1 = op2 then List.fold_left2 (fun s t1 t2 -> compsubst (unify (substitute s t1) (substitute s t2)) s) [] sons1 sons2 else failwith "unify" (* We need to print terms with variables independently from input terms obtained by parsing. We give arbitrary names v1,v2,... to their variables. *) let infixes = [ "+"; "*" ] let rec pretty_term = function | Var n -> print_string "v"; print_int n | Term (oper, sons) -> if List.mem oper infixes then match sons with | [ s1; s2 ] -> pretty_close s1; print_string oper; pretty_close s2 | _ -> failwith "pretty_term : infix arity <> 2" else ( print_string oper; match sons with | [] -> () | t :: lt -> print_string "("; pretty_term t; List.iter (fun t -> print_string ","; pretty_term t) lt; print_string ")") and pretty_close = function | Term (oper, _) as m -> if List.mem oper infixes then ( print_string "("; pretty_term m; print_string ")") else pretty_term m | m -> pretty_term m (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: equations.ml 2553 1999-11-17 18:59:06Z xleroy $ *) (****************** Equation manipulations *************) type rule = { number : int ; numvars : int ; lhs : term ; rhs : term } (* standardizes an equation so its variables are 1,2,... *) let mk_rule num m n = let all_vars = union (vars m) (vars n) in let counter = ref 0 in let subst = List.map (fun v -> incr counter; v, Var !counter) (List.rev all_vars) in { number = num; numvars = !counter; lhs = substitute subst m; rhs = substitute subst n } (* checks that rules are numbered in sequence and returns their number *) let check_rules rules = let counter = ref 0 in List.iter (fun r -> incr counter; if r.number <> !counter then failwith "Rule numbers not in sequence") rules; !counter let pretty_rule rule = print_int rule.number; print_string " : "; pretty_term rule.lhs; print_string " = "; pretty_term rule.rhs; print_newline () let pretty_rules rules = List.iter pretty_rule rules (****************** Rewriting **************************) (* Top-level rewriting. Let eq:L=R be an equation, M be a term such that L<=M. With sigma = matching L M, we define the image of M by eq as sigma(R) *) let reduce l m r = match matching l m with | Some s -> Some (substitute s r) | None -> None (* Test whether m can be reduced by l, i.e. m contains an instance of l. *) let can_match l m = match matching l m with | Some _ -> true | None -> false let rec reducible l m = can_match l m || match m with | Term (_, sons) -> List.exists (reducible l) sons | _ -> false (* Top-level rewriting with multiple rules. *) let rec mreduce rules m = match rules with | [] -> None | rule :: rest -> ( match reduce rule.lhs m rule.rhs with | Some _ as v -> v | None -> mreduce rest m) (* One step of rewriting in leftmost-outermost strategy, with multiple rules. Fails if no redex is found *) let rec mrewrite1 rules m = match mreduce rules m with | Some v -> v | None -> ( match m with | Var _ -> failwith "mrewrite1" | Term (f, sons) -> Term (f, mrewrite1_sons rules sons)) and mrewrite1_sons rules = function | [] -> failwith "mrewrite1" | son :: rest -> ( try mrewrite1 rules son :: rest with Failure _ -> son :: mrewrite1_sons rules rest) (* Iterating rewrite1. Returns a normal form. May loop forever *) let rec mrewrite_all rules m = try mrewrite_all rules (mrewrite1 rules m) with Failure _ -> m (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: orderings.ml 2553 1999-11-17 18:59:06Z xleroy $ *) (*********************** Recursive Path Ordering ****************************) type ordering = | Greater | Equal | NotGE let ge_ord order pair = match order pair with | NotGE -> false | _ -> true and gt_ord order pair = match order pair with | Greater -> true | _ -> false and eq_ord order pair = match order pair with | Equal -> true | _ -> false let rec rem_eq equiv x = function | [] -> failwith "rem_eq" | y :: l -> if equiv (x, y) then l else y :: rem_eq equiv x l let diff_eq equiv (x, y) = let rec diffrec = function | ([], _) as p -> p | h :: t, y -> ( try diffrec (t, rem_eq equiv h y) with Failure _ -> let x', y' = diffrec (t, y) in h :: x', y') in if List.length x > List.length y then diffrec (y, x) else diffrec (x, y) (* Multiset extension of order *) let mult_ext order = function | Term (_, sons1), Term (_, sons2) -> ( match diff_eq (eq_ord order) (sons1, sons2) with | [], [] -> Equal | l1, l2 -> if List.for_all (fun n -> List.exists (fun m -> gt_ord order (m, n)) l1) l2 then Greater else NotGE) | _ -> failwith "mult_ext" (* Lexicographic extension of order *) let lex_ext order = function | (Term (_, sons1) as m), (Term (_, sons2) as n) -> let rec lexrec = function | [], [] -> Equal | [], _ -> NotGE | _, [] -> Greater | x1 :: l1, x2 :: l2 -> ( match order (x1, x2) with | Greater -> if List.for_all (fun n' -> gt_ord order (m, n')) l2 then Greater else NotGE | Equal -> lexrec (l1, l2) | NotGE -> if List.exists (fun m' -> ge_ord order (m', n)) l1 then Greater else NotGE ) in lexrec (sons1, sons2) | _ -> failwith "lex_ext" (* Recursive path ordering *) let rpo op_order ext = let rec rporec (m, n) = if m = n then Equal else match m with | Var _ -> NotGE | Term (op1, sons1) -> ( match n with | Var vn -> if occurs vn m then Greater else NotGE | Term (op2, sons2) -> ( match op_order op1 op2 with | Greater -> if List.for_all (fun n' -> gt_ord rporec (m, n')) sons2 then Greater else NotGE | Equal -> ext rporec (m, n) | NotGE -> if List.exists (fun m' -> ge_ord rporec (m', n)) sons1 then Greater else NotGE)) in rporec (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: kb.ml 2553 1999-11-17 18:59:06Z xleroy $ *) (****************** Critical pairs *********************) (* All (u,subst) such that N/u (&var) unifies with M, with principal unifier subst *) let rec super m = function | Term (_, sons) as n -> ( let rec collate n = function | [] -> [] | son :: rest -> List.map (fun (u, subst) -> n :: u, subst) (super m son) @ collate (n + 1) rest in let insides = collate 1 sons in try ([], unify m n) :: insides with Failure _ -> insides) | _ -> [] (* Ex : let (m,_) = <> and (n,_) = <> in super m n ==> [[1],[2,Term ("B",[])]; x <- B [2],[2,Term ("A",[]); 1,Term ("B",[])]] x <- A y <- B *) (* All (u,subst), u&[], such that n/u unifies with m *) let super_strict m = function | Term (_, sons) -> let rec collate n = function | [] -> [] | son :: rest -> List.map (fun (u, subst) -> n :: u, subst) (super m son) @ collate (n + 1) rest in collate 1 sons | _ -> [] (* Critical pairs of l1=r1 with l2=r2 *) (* critical_pairs : term_pair -> term_pair -> term_pair list *) let critical_pairs (l1, r1) (l2, r2) = let mk_pair (u, subst) = substitute subst (replace l2 u r1), substitute subst r2 in List.map mk_pair (super l1 l2) (* Strict critical pairs of l1=r1 with l2=r2 *) (* strict_critical_pairs : term_pair -> term_pair -> term_pair list *) let strict_critical_pairs (l1, r1) (l2, r2) = let mk_pair (u, subst) = substitute subst (replace l2 u r1), substitute subst r2 in List.map mk_pair (super_strict l1 l2) (* All critical pairs of eq1 with eq2 *) let mutual_critical_pairs eq1 eq2 = strict_critical_pairs eq1 eq2 @ critical_pairs eq2 eq1 (* Renaming of variables *) let rename n (t1, t2) = let rec ren_rec = function | Var k -> Var (k + n) | Term (op, sons) -> Term (op, List.map ren_rec sons) in ren_rec t1, ren_rec t2 (************************ Completion ******************************) let deletion_message rule = print_string "Rule "; print_int rule.number; print_string " deleted"; print_newline () (* Generate failure message *) let non_orientable (m, n) = pretty_term m; print_string " = "; pretty_term n; print_newline () let rec partition p = function | [] -> [], [] | x :: l -> let l1, l2 = partition p l in if p x then x :: l1, l2 else l1, x :: l2 let rec get_rule n = function | [] -> raise Not_found | r :: l -> if n = r.number then r else get_rule n l (* Improved Knuth-Bendix completion procedure *) let kb_completion greater = let rec kbrec j rules = let rec process failures (k, l) eqs = (**** print_string "***kb_completion "; print_int j; print_newline(); pretty_rules rules; List.iter non_orientable failures; print_int k; print_string " "; print_int l; print_newline(); List.iter non_orientable eqs; ***) match eqs with | [] -> ( if k < l then next_criticals failures (k + 1, l) else if l < j then next_criticals failures (1, l + 1) else match failures with | [] -> rules (* successful completion *) | _ -> print_string "Non-orientable equations :"; print_newline (); List.iter non_orientable failures; failwith "kb_completion") | (m, n) :: eqs -> let m' = mrewrite_all rules m and n' = mrewrite_all rules n and enter_rule (left, right) = let new_rule = mk_rule (j + 1) left right in pretty_rule new_rule; let left_reducible rule = reducible left rule.lhs in let redl, irredl = partition left_reducible rules in List.iter deletion_message redl; let right_reduce rule = mk_rule rule.number rule.lhs (mrewrite_all (new_rule :: rules) rule.rhs) in let irreds = List.map right_reduce irredl in let eqs' = List.map (fun rule -> rule.lhs, rule.rhs) redl in kbrec (j + 1) (new_rule :: irreds) [] (k, l) (eqs @ eqs' @ failures) in (*** print_string "--- Considering "; non_orientable (m', n'); ***) if m' = n' then process failures (k, l) eqs else if greater (m', n') then enter_rule (m', n') else if greater (n', m') then enter_rule (n', m') else process ((m', n') :: failures) (k, l) eqs and next_criticals failures (k, l) = (**** print_string "***next_criticals "; print_int k; print_string " "; print_int l ; print_newline(); ****) try let rl = get_rule l rules in let el = rl.lhs, rl.rhs in if k = l then process failures (k, l) (strict_critical_pairs el (rename rl.numvars el)) else try let rk = get_rule k rules in let ek = rk.lhs, rk.rhs in process failures (k, l) (mutual_critical_pairs el (rename rl.numvars ek)) with Not_found -> next_criticals failures (k + 1, l) with Not_found -> next_criticals failures (1, l + 1) in process in kbrec (* complete_rules is assumed locally confluent, and checked Noetherian with ordering greater, rules is any list of rules *) let kb_complete greater complete_rules rules = let n = check_rules complete_rules and eqs = List.map (fun rule -> rule.lhs, rule.rhs) rules in let completed_rules = kb_completion greater n complete_rules [] (n, n) eqs in print_string "Canonical set found :"; print_newline (); pretty_rules (List.rev completed_rules) (***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: kbmain.ml 7017 2005-08-12 09:22:04Z xleroy $ *) (**** let group_rules = [ { number = 1; numvars = 1; lhs = Term("*", [Term("U",[]); Var 1]); rhs = Var 1 }; { number = 2; numvars = 1; lhs = Term("*", [Term("I",[Var 1]); Var 1]); rhs = Term("U",[]) }; { number = 3; numvars = 3; lhs = Term("*", [Term("*", [Var 1; Var 2]); Var 3]); rhs = Term("*", [Var 1; Term("*", [Var 2; Var 3])]) } ] ****) let geom_rules = [ { number = 1; numvars = 1; lhs = Term ("*", [ Term ("U", []); Var 1 ]); rhs = Var 1 } ; { number = 2 ; numvars = 1 ; lhs = Term ("*", [ Term ("I", [ Var 1 ]); Var 1 ]) ; rhs = Term ("U", []) } ; { number = 3 ; numvars = 3 ; lhs = Term ("*", [ Term ("*", [ Var 1; Var 2 ]); Var 3 ]) ; rhs = Term ("*", [ Var 1; Term ("*", [ Var 2; Var 3 ]) ]) } ; { number = 4 ; numvars = 0 ; lhs = Term ("*", [ Term ("A", []); Term ("B", []) ]) ; rhs = Term ("*", [ Term ("B", []); Term ("A", []) ]) } ; { number = 5 ; numvars = 0 ; lhs = Term ("*", [ Term ("C", []); Term ("C", []) ]) ; rhs = Term ("U", []) } ; { number = 6 ; numvars = 0 ; lhs = Term ( "*" , [ Term ("C", []) ; Term ("*", [ Term ("A", []); Term ("I", [ Term ("C", []) ]) ]) ] ) ; rhs = Term ("I", [ Term ("A", []) ]) } ; { number = 7 ; numvars = 0 ; lhs = Term ( "*" , [ Term ("C", []) ; Term ("*", [ Term ("B", []); Term ("I", [ Term ("C", []) ]) ]) ] ) ; rhs = Term ("B", []) } ] let group_rank = function | "U" -> 0 | "*" -> 1 | "I" -> 2 | "B" -> 3 | "C" -> 4 | "A" -> 5 | _ -> assert false let group_precedence op1 op2 = let r1 = group_rank op1 and r2 = group_rank op2 in if r1 = r2 then Equal else if r1 > r2 then Greater else NotGE let group_order = rpo group_precedence lex_ext let greater pair = match group_order pair with | Greater -> true | _ -> false let _ = for _ = 1 to 20 do kb_complete greater [] geom_rules done js_of_ocaml-3.5.2/benchmarks/sources/ml/loop.ml000066400000000000000000000000501357507750000215130ustar00rootroot00000000000000;; for _ = 1 to 1000000000 do () done js_of_ocaml-3.5.2/benchmarks/sources/ml/nucleic.ml000066400000000000000000005310731357507750000222020ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: nucleic.ml 7017 2005-08-12 09:22:04Z xleroy $ *) [@@@ocaml.warning "-27"] (* Use floating-point arithmetic *) external ( + ) : float -> float -> float = "%addfloat" external ( - ) : float -> float -> float = "%subfloat" external ( * ) : float -> float -> float = "%mulfloat" external ( / ) : float -> float -> float = "%divfloat" (* -- MATH UTILITIES --------------------------------------------------------*) let constant_pi = 3.14159265358979323846 let constant_minus_pi = -3.14159265358979323846 let constant_pi2 = 1.57079632679489661923 let constant_minus_pi2 = -1.57079632679489661923 (* -- POINTS ----------------------------------------------------------------*) type pt = { x : float ; y : float ; z : float } let pt_sub p1 p2 = { x = p1.x - p2.x; y = p1.y - p2.y; z = p1.z - p2.z } let pt_dist p1 p2 = let dx = p1.x - p2.x and dy = p1.y - p2.y and dz = p1.z - p2.z in sqrt ((dx * dx) + (dy * dy) + (dz * dz)) let pt_phi p = let b = atan2 p.x p.z in atan2 ((cos b * p.z) + (sin b * p.x)) p.y let pt_theta p = atan2 p.x p.z (* -- COORDINATE TRANSFORMATIONS --------------------------------------------*) (* The notation for the transformations follows "Paul, R.P. (1981) Robot Manipulators. MIT Press." with the exception that our transformation matrices don't have the perspective terms and are the transpose of Paul's one. See also "M\"antyl\"a, M. (1985) An Introduction to Solid Modeling, Computer Science Press" Appendix A. The components of a transformation matrix are named like this: a b c d e f g h i tx ty tz The components tx, ty, and tz are the translation vector. *) type tfo = { a : float ; b : float ; c : float ; d : float ; e : float ; f : float ; g : float ; h : float ; i : float ; tx : float ; ty : float ; tz : float } let tfo_id = { a = 1.0 ; b = 0.0 ; c = 0.0 ; d = 0.0 ; e = 1.0 ; f = 0.0 ; g = 0.0 ; h = 0.0 ; i = 1.0 ; tx = 0.0 ; ty = 0.0 ; tz = 0.0 } (* The function "tfo-apply" multiplies a transformation matrix, tfo, by a point vector, p. The result is a new point. *) let tfo_apply t p = { x = (p.x * t.a) + (p.y * t.d) + (p.z * t.g) + t.tx ; y = (p.x * t.b) + (p.y * t.e) + (p.z * t.h) + t.ty ; z = (p.x * t.c) + (p.y * t.f) + (p.z * t.i) + t.tz } (* The function "tfo-combine" multiplies two transformation matrices A and B. The result is a new matrix which cumulates the transformations described by A and B. *) let tfo_combine a b = (* *) (* Hand elimination of common subexpressions. Assumes lots of float registers (32 is perfect, 16 still OK). Loses on the I386, of course. *) let a_a = a.a and a_b = a.b and a_c = a.c and a_d = a.d and a_e = a.e and a_f = a.f and a_g = a.g and a_h = a.h and a_i = a.i and a_tx = a.tx and a_ty = a.ty and a_tz = a.tz and b_a = b.a and b_b = b.b and b_c = b.c and b_d = b.d and b_e = b.e and b_f = b.f and b_g = b.g and b_h = b.h and b_i = b.i and b_tx = b.tx and b_ty = b.ty and b_tz = b.tz in { a = (a_a * b_a) + (a_b * b_d) + (a_c * b_g) ; b = (a_a * b_b) + (a_b * b_e) + (a_c * b_h) ; c = (a_a * b_c) + (a_b * b_f) + (a_c * b_i) ; d = (a_d * b_a) + (a_e * b_d) + (a_f * b_g) ; e = (a_d * b_b) + (a_e * b_e) + (a_f * b_h) ; f = (a_d * b_c) + (a_e * b_f) + (a_f * b_i) ; g = (a_g * b_a) + (a_h * b_d) + (a_i * b_g) ; h = (a_g * b_b) + (a_h * b_e) + (a_i * b_h) ; i = (a_g * b_c) + (a_h * b_f) + (a_i * b_i) ; tx = (a_tx * b_a) + (a_ty * b_d) + (a_tz * b_g) + b_tx ; ty = (a_tx * b_b) + (a_ty * b_e) + (a_tz * b_h) + b_ty ; tz = (a_tx * b_c) + (a_ty * b_f) + (a_tz * b_i) + b_tz } (* *) (* Original without CSE *) (* *) (*** { a = ((a.a * b.a) + (a.b * b.d) + (a.c * b.g)); b = ((a.a * b.b) + (a.b * b.e) + (a.c * b.h)); c = ((a.a * b.c) + (a.b * b.f) + (a.c * b.i)); d = ((a.d * b.a) + (a.e * b.d) + (a.f * b.g)); e = ((a.d * b.b) + (a.e * b.e) + (a.f * b.h)); f = ((a.d * b.c) + (a.e * b.f) + (a.f * b.i)); g = ((a.g * b.a) + (a.h * b.d) + (a.i * b.g)); h = ((a.g * b.b) + (a.h * b.e) + (a.i * b.h)); i = ((a.g * b.c) + (a.h * b.f) + (a.i * b.i)); tx = ((a.tx * b.a) + (a.ty * b.d) + (a.tz * b.g) + b.tx); ty = ((a.tx * b.b) + (a.ty * b.e) + (a.tz * b.h) + b.ty); tz = ((a.tx * b.c) + (a.ty * b.f) + (a.tz * b.i) + b.tz) } ***) (* *) (* The function "tfo-inv-ortho" computes the inverse of a homogeneous transformation matrix. *) let tfo_inv_ortho t = { a = t.a ; b = t.d ; c = t.g ; d = t.b ; e = t.e ; f = t.h ; g = t.c ; h = t.f ; i = t.i ; tx = -.((t.a * t.tx) + (t.b * t.ty) + (t.c * t.tz)) ; ty = -.((t.d * t.tx) + (t.e * t.ty) + (t.f * t.tz)) ; tz = -.((t.g * t.tx) + (t.h * t.ty) + (t.i * t.tz)) } (* Given three points p1, p2, and p3, the function "tfo-align" computes a transformation matrix such that point p1 gets mapped to (0,0,0), p2 gets mapped to the Y axis and p3 gets mapped to the YZ plane. *) let tfo_align p1 p2 p3 = let x31 = p3.x - p1.x in let y31 = p3.y - p1.y in let z31 = p3.z - p1.z in let rotpy = pt_sub p2 p1 in let phi = pt_phi rotpy in let theta = pt_theta rotpy in let sinp = sin phi in let sint = sin theta in let cosp = cos phi in let cost = cos theta in let sinpsint = sinp * sint in let sinpcost = sinp * cost in let cospsint = cosp * sint in let cospcost = cosp * cost in let rotpz = { x = (cost * x31) - (sint * z31) ; y = (sinpsint * x31) + (cosp * y31) + (sinpcost * z31) ; z = (cospsint * x31) + -.(sinp * y31) + (cospcost * z31) } in let rho = pt_theta rotpz in let cosr = cos rho in let sinr = sin rho in let x = -.(p1.x * cost) + (p1.z * sint) in let y = -.(p1.x * sinpsint) - (p1.y * cosp) - (p1.z * sinpcost) in let z = -.(p1.x * cospsint) + (p1.y * sinp) - (p1.z * cospcost) in { a = (cost * cosr) - (cospsint * sinr) ; b = sinpsint ; c = (cost * sinr) + (cospsint * cosr) ; d = sinp * sinr ; e = cosp ; f = -.(sinp * cosr) ; g = -.(sint * cosr) - (cospcost * sinr) ; h = sinpcost ; i = -.(sint * sinr) + (cospcost * cosr) ; tx = (x * cosr) - (z * sinr) ; ty = y ; tz = (x * sinr) + (z * cosr) } (* -- NUCLEIC ACID CONFORMATIONS DATA BASE ----------------------------------*) (* Numbering of atoms follows the paper: IUPAC-IUB Joint Commission on Biochemical Nomenclature (JCBN) (1983) Abbreviations and Symbols for the Description of Conformations of Polynucleotide Chains. Eur. J. Biochem 131, 9-15. *) (* Define remaining atoms for each nucleotide type. *) type nuc_specific = | A of pt * pt * pt * pt * pt * pt * pt * pt | C of pt * pt * pt * pt * pt * pt | G of pt * pt * pt * pt * pt * pt * pt * pt * pt | U of pt * pt * pt * pt * pt (* A n6 n7 n9 c8 h2 h61 h62 h8 C n4 o2 h41 h42 h5 h6 G n2 n7 n9 c8 o6 h1 h21 h22 h8 U o2 o4 h3 h5 h6 *) (* Define part common to all 4 nucleotide types. *) type nuc = | N of tfo * tfo * tfo * tfo * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * pt * nuc_specific (* dgf_base_tfo ; defines the standard position for wc and wc_dumas p_o3'_275_tfo ; defines the standard position for the connect function p_o3'_180_tfo p_o3'_60_tfo p o1p o2p o5' c5' h5' h5'' c4' h4' o4' c1' h1' c2' h2'' o2' h2' c3' h3' o3' n1 n3 c2 c4 c5 c6 *) let is_A = function | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , A (_, _, _, _, _, _, _, _) ) -> true | _ -> false let is_C = function | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , C (_, _, _, _, _, _) ) -> true | _ -> false let is_G = function | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , G (_, _, _, _, _, _, _, _, _) ) -> true | _ -> false let nuc_C1' (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = c1' let nuc_C2 (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = c2 let nuc_C3' (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = c3' let nuc_C4 (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = c4 let nuc_C4' (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = c4' let nuc_N1 (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = n1 let nuc_O3' (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = o3' let nuc_P (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = p let nuc_dgf_base_tfo (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = dgf_base_tfo let nuc_p_o3'_180_tfo (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = p_o3'_180_tfo let nuc_p_o3'_275_tfo (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = p_o3'_275_tfo let nuc_p_o3'_60_tfo (N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , _ )) = p_o3'_60_tfo let rA_N9 = function | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , A (n6, n7, n9, c8, h2, h61, h62, h8) ) -> n9 | _ -> assert false let rG_N9 = function | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , G (n2, n7, n9, c8, o6, h1, h21, h22, h8) ) -> n9 | _ -> assert false (* Database of nucleotide conformations: *) let rA = N ( { a = -0.0018 ; b = -0.8207 ; c = 0.5714 ; (* dgf_base_tfo *) d = 0.2679 ; e = -0.5509 ; f = -0.7904 ; g = 0.9634 ; h = 0.1517 ; i = 0.2209 ; tx = 0.0073 ; ty = 8.4030 ; tz = 0.6232 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 5.4550; y = 8.2120; z = -2.8810 } , (* C5' *) { x = 5.4546; y = 8.8508; z = -1.9978 } , (* H5' *) { x = 5.7588; y = 8.6625; z = -3.8259 } , (* H5'' *) { x = 6.4970; y = 7.1480; z = -2.5980 } , (* C4' *) { x = 7.4896; y = 7.5919; z = -2.5214 } , (* H4' *) { x = 6.1630; y = 6.4860; z = -1.3440 } , (* O4' *) { x = 6.5400; y = 5.1200; z = -1.4190 } , (* C1' *) { x = 7.2763; y = 4.9681; z = -0.6297 } , (* H1' *) { x = 7.1940; y = 4.8830; z = -2.7770 } , (* C2' *) { x = 6.8667; y = 3.9183; z = -3.1647 } , (* H2'' *) { x = 8.5860; y = 5.0910; z = -2.6140 } , (* O2' *) { x = 8.9510; y = 4.7626; z = -1.7890 } , (* H2' *) { x = 6.5720; y = 6.0040; z = -3.6090 } , (* C3' *) { x = 5.5636; y = 5.7066; z = -3.8966 } , (* H3' *) { x = 7.3801; y = 6.3562; z = -4.7350 } , (* O3' *) { x = 4.7150; y = 0.4910; z = -0.1360 } , (* N1 *) { x = 6.3490; y = 2.1730; z = -0.6020 } , (* N3 *) { x = 5.9530; y = 0.9650; z = -0.2670 } , (* C2 *) { x = 5.2900; y = 2.9790; z = -0.8260 } , (* C4 *) { x = 3.9720; y = 2.6390; z = -0.7330 } , (* C5 *) { x = 3.6770; y = 1.3160; z = -0.3660 } , (* C6 *) A ( { x = 2.4280; y = 0.8450; z = -0.2360 } , (* N6 *) { x = 3.1660; y = 3.7290; z = -1.0360 } , (* N7 *) { x = 5.3170; y = 4.2990; z = -1.1930 } , (* N9 *) { x = 4.0100; y = 4.6780; z = -1.2990 } , (* C8 *) { x = 6.6890; y = 0.1903; z = -0.0518 } , (* H2 *) { x = 1.6470; y = 1.4460; z = -0.4040 } , (* H61 *) { x = 2.2780; y = -0.1080; z = -0.0280 } , (* H62 *) { x = 3.4421; y = 5.5744; z = -1.5482 } ) ) (* H8 *) let rA01 = N ( { a = -0.0043 ; b = -0.8175 ; c = 0.5759 ; (* dgf_base_tfo *) d = 0.2617 ; e = -0.5567 ; f = -0.7884 ; g = 0.9651 ; h = 0.1473 ; i = 0.2164 ; tx = 0.0359 ; ty = 8.3929 ; tz = 0.5532 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 5.4352; y = 8.2183; z = -2.7757 } , (* C5' *) { x = 5.3830; y = 8.7883; z = -1.8481 } , (* H5' *) { x = 5.7729; y = 8.7436; z = -3.6691 } , (* H5'' *) { x = 6.4830; y = 7.1518; z = -2.5252 } , (* C4' *) { x = 7.4749; y = 7.5972; z = -2.4482 } , (* H4' *) { x = 6.1626; y = 6.4620; z = -1.2827 } , (* O4' *) { x = 6.5431; y = 5.0992; z = -1.3905 } , (* C1' *) { x = 7.2871; y = 4.9328; z = -0.6114 } , (* H1' *) { x = 7.1852; y = 4.8935; z = -2.7592 } , (* C2' *) { x = 6.8573; y = 3.9363; z = -3.1645 } , (* H2'' *) { x = 8.5780; y = 5.1025; z = -2.6046 } , (* O2' *) { x = 8.9516; y = 4.7577; z = -1.7902 } , (* H2' *) { x = 6.5522; y = 6.0300; z = -3.5612 } , (* C3' *) { x = 5.5420; y = 5.7356; z = -3.8459 } , (* H3' *) { x = 7.3487; y = 6.4089; z = -4.6867 } , (* O3' *) { x = 4.7442; y = 0.4514; z = -0.1390 } , (* N1 *) { x = 6.3687; y = 2.1459; z = -0.5926 } , (* N3 *) { x = 5.9795; y = 0.9335; z = -0.2657 } , (* C2 *) { x = 5.3052; y = 2.9471; z = -0.8125 } , (* C4 *) { x = 3.9891; y = 2.5987; z = -0.7230 } , (* C5 *) { x = 3.7016; y = 1.2717; z = -0.3647 } , (* C6 *) A ( { x = 2.4553; y = 0.7925; z = -0.2390 } , (* N6 *) { x = 3.1770; y = 3.6859; z = -1.0198 } , (* N7 *) { x = 5.3247; y = 4.2695; z = -1.1710 } , (* N9 *) { x = 4.0156; y = 4.6415; z = -1.2759 } , (* C8 *) { x = 6.7198; y = 0.1618; z = -0.0547 } , (* H2 *) { x = 1.6709; y = 1.3900; z = -0.4039 } , (* H61 *) { x = 2.3107; y = -0.1627; z = -0.0373 } , (* H62 *) { x = 3.4426; y = 5.5361; z = -1.5199 } ) ) (* H8 *) let rA02 = N ( { a = 0.5566 ; b = 0.0449 ; c = 0.8296 ; (* dgf_base_tfo *) d = 0.5125 ; e = 0.7673 ; f = -0.3854 ; g = -0.6538 ; h = 0.6397 ; i = 0.4041 ; tx = -9.1161 ; ty = -3.7679 ; tz = -2.9968 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 4.5778; y = 6.6594; z = -4.0364 } , (* C5' *) { x = 4.9220; y = 7.1963; z = -4.9204 } , (* H5' *) { x = 3.7996; y = 5.9091; z = -4.1764 } , (* H5'' *) { x = 5.7873; y = 5.8869; z = -3.5482 } , (* C4' *) { x = 6.0405; y = 5.0875; z = -4.2446 } , (* H4' *) { x = 6.9135; y = 6.8036; z = -3.4310 } , (* O4' *) { x = 7.7293; y = 6.4084; z = -2.3392 } , (* C1' *) { x = 8.7078; y = 6.1815; z = -2.7624 } , (* H1' *) { x = 7.1305; y = 5.1418; z = -1.7347 } , (* C2' *) { x = 7.2040; y = 5.1982; z = -0.6486 } , (* H2'' *) { x = 7.7417; y = 4.0392; z = -2.3813 } , (* O2' *) { x = 8.6785; y = 4.1443; z = -2.5630 } , (* H2' *) { x = 5.6666; y = 5.2728; z = -2.1536 } , (* C3' *) { x = 5.1747; y = 5.9805; z = -1.4863 } , (* H3' *) { x = 4.9997; y = 4.0086; z = -2.1973 } , (* O3' *) { x = 10.3245; y = 8.5459; z = 1.5467 } , (* N1 *) { x = 9.8051; y = 6.9432; z = -0.1497 } , (* N3 *) { x = 10.5175; y = 7.4328; z = 0.8408 } , (* C2 *) { x = 8.7523; y = 7.7422; z = -0.4228 } , (* C4 *) { x = 8.4257; y = 8.9060; z = 0.2099 } , (* C5 *) { x = 9.2665; y = 9.3242; z = 1.2540 } , (* C6 *) A ( { x = 9.0664; y = 10.4462; z = 1.9610 } , (* N6 *) { x = 7.2750; y = 9.4537; z = -0.3428 } , (* N7 *) { x = 7.7962; y = 7.5519; z = -1.3859 } , (* N9 *) { x = 6.9479; y = 8.6157; z = -1.2771 } , (* C8 *) { x = 11.4063; y = 6.9047; z = 1.1859 } , (* H2 *) { x = 8.2845; y = 11.0341; z = 1.7552 } , (* H61 *) { x = 9.6584; y = 10.6647; z = 2.7198 } , (* H62 *) { x = 6.0430; y = 8.9853; z = -1.7594 } ) ) (* H8 *) let rA03 = N ( { a = -0.5021 ; b = 0.0731 ; c = 0.8617 ; (* dgf_base_tfo *) d = -0.8112 ; e = 0.3054 ; f = -0.4986 ; g = -0.2996 ; h = -0.9494 ; i = -0.0940 ; tx = 6.4273 ; ty = -5.1944 ; tz = -3.7807 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 4.1214; y = 6.7116; z = -1.9049 } , (* C5' *) { x = 3.3465; y = 5.9610; z = -2.0607 } , (* H5' *) { x = 4.0789; y = 7.2928; z = -0.9837 } , (* H5'' *) { x = 5.4170; y = 5.9293; z = -1.8186 } , (* C4' *) { x = 5.4506; y = 5.3400; z = -0.9023 } , (* H4' *) { x = 5.5067; y = 5.0417; z = -2.9703 } , (* O4' *) { x = 6.8650; y = 4.9152; z = -3.3612 } , (* C1' *) { x = 7.1090; y = 3.8577; z = -3.2603 } , (* H1' *) { x = 7.7152; y = 5.7282; z = -2.3894 } , (* C2' *) { x = 8.5029; y = 6.2356; z = -2.9463 } , (* H2'' *) { x = 8.1036; y = 4.8568; z = -1.3419 } , (* O2' *) { x = 8.3270; y = 3.9651; z = -1.6184 } , (* H2' *) { x = 6.7003; y = 6.7565; z = -1.8911 } , (* C3' *) { x = 6.5898; y = 7.5329; z = -2.6482 } , (* H3' *) { x = 7.0505; y = 7.2878; z = -0.6105 } , (* O3' *) { x = 9.6740; y = 4.7656; z = -7.6614 } , (* N1 *) { x = 9.0739; y = 4.3013; z = -5.3941 } , (* N3 *) { x = 9.8416; y = 4.2192; z = -6.4581 } , (* C2 *) { x = 7.9885; y = 5.0632; z = -5.6446 } , (* C4 *) { x = 7.6822; y = 5.6856; z = -6.8194 } , (* C5 *) { x = 8.5831; y = 5.5215; z = -7.8840 } , (* C6 *) A ( { x = 8.4084; y = 6.0747; z = -9.0933 } , (* N6 *) { x = 6.4857; y = 6.3816; z = -6.7035 } , (* N7 *) { x = 6.9740; y = 5.3703; z = -4.7760 } , (* N9 *) { x = 6.1133; y = 6.1613; z = -5.4808 } , (* C8 *) { x = 10.7627; y = 3.6375; z = -6.4220 } , (* H2 *) { x = 7.6031; y = 6.6390; z = -9.2733 } , (* H61 *) { x = 9.1004; y = 5.9708; z = -9.7893 } , (* H62 *) { x = 5.1705; y = 6.6830; z = -5.3167 } ) ) (* H8 *) let rA04 = N ( { a = -0.5426 ; b = -0.8175 ; c = 0.1929 ; (* dgf_base_tfo *) d = 0.8304 ; e = -0.5567 ; f = -0.0237 ; g = 0.1267 ; h = 0.1473 ; i = 0.9809 ; tx = -0.5075 ; ty = 8.3929 ; tz = 0.2229 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 5.4352; y = 8.2183; z = -2.7757 } , (* C5' *) { x = 5.3830; y = 8.7883; z = -1.8481 } , (* H5' *) { x = 5.7729; y = 8.7436; z = -3.6691 } , (* H5'' *) { x = 6.4830; y = 7.1518; z = -2.5252 } , (* C4' *) { x = 7.4749; y = 7.5972; z = -2.4482 } , (* H4' *) { x = 6.1626; y = 6.4620; z = -1.2827 } , (* O4' *) { x = 6.5431; y = 5.0992; z = -1.3905 } , (* C1' *) { x = 7.2871; y = 4.9328; z = -0.6114 } , (* H1' *) { x = 7.1852; y = 4.8935; z = -2.7592 } , (* C2' *) { x = 6.8573; y = 3.9363; z = -3.1645 } , (* H2'' *) { x = 8.5780; y = 5.1025; z = -2.6046 } , (* O2' *) { x = 8.9516; y = 4.7577; z = -1.7902 } , (* H2' *) { x = 6.5522; y = 6.0300; z = -3.5612 } , (* C3' *) { x = 5.5420; y = 5.7356; z = -3.8459 } , (* H3' *) { x = 7.3487; y = 6.4089; z = -4.6867 } , (* O3' *) { x = 3.6343; y = 2.6680; z = 2.0783 } , (* N1 *) { x = 5.4505; y = 3.9805; z = 1.2446 } , (* N3 *) { x = 4.7540; y = 3.3816; z = 2.1851 } , (* C2 *) { x = 4.8805; y = 3.7951; z = 0.0354 } , (* C4 *) { x = 3.7416; y = 3.0925; z = -0.2305 } , (* C5 *) { x = 3.0873; y = 2.4980; z = 0.8606 } , (* C6 *) A ( { x = 1.9600; y = 1.7805; z = 0.7462 } , (* N6 *) { x = 3.4605; y = 3.1184; z = -1.5906 } , (* N7 *) { x = 5.3247; y = 4.2695; z = -1.1710 } , (* N9 *) { x = 4.4244; y = 3.8244; z = -2.0953 } , (* C8 *) { x = 5.0814; y = 3.4352; z = 3.2234 } , (* H2 *) { x = 1.5423; y = 1.6454; z = -0.1520 } , (* H61 *) { x = 1.5716; y = 1.3398; z = 1.5392 } , (* H62 *) { x = 4.2675; y = 3.8876; z = -3.1721 } ) ) (* H8 *) let rA05 = N ( { a = -0.5891 ; b = 0.0449 ; c = 0.8068 ; (* dgf_base_tfo *) d = 0.5375 ; e = 0.7673 ; f = 0.3498 ; g = -0.6034 ; h = 0.6397 ; i = -0.4762 ; tx = -0.3019 ; ty = -3.7679 ; tz = -9.5913 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 4.5778; y = 6.6594; z = -4.0364 } , (* C5' *) { x = 4.9220; y = 7.1963; z = -4.9204 } , (* H5' *) { x = 3.7996; y = 5.9091; z = -4.1764 } , (* H5'' *) { x = 5.7873; y = 5.8869; z = -3.5482 } , (* C4' *) { x = 6.0405; y = 5.0875; z = -4.2446 } , (* H4' *) { x = 6.9135; y = 6.8036; z = -3.4310 } , (* O4' *) { x = 7.7293; y = 6.4084; z = -2.3392 } , (* C1' *) { x = 8.7078; y = 6.1815; z = -2.7624 } , (* H1' *) { x = 7.1305; y = 5.1418; z = -1.7347 } , (* C2' *) { x = 7.2040; y = 5.1982; z = -0.6486 } , (* H2'' *) { x = 7.7417; y = 4.0392; z = -2.3813 } , (* O2' *) { x = 8.6785; y = 4.1443; z = -2.5630 } , (* H2' *) { x = 5.6666; y = 5.2728; z = -2.1536 } , (* C3' *) { x = 5.1747; y = 5.9805; z = -1.4863 } , (* H3' *) { x = 4.9997; y = 4.0086; z = -2.1973 } , (* O3' *) { x = 10.2594; y = 10.6774; z = -1.0056 } , (* N1 *) { x = 9.7528; y = 8.7080; z = -2.2631 } , (* N3 *) { x = 10.4471; y = 9.7876; z = -1.9791 } , (* C2 *) { x = 8.7271; y = 8.5575; z = -1.3991 } , (* C4 *) { x = 8.4100; y = 9.3803; z = -0.3580 } , (* C5 *) { x = 9.2294; y = 10.5030; z = -0.1574 } , (* C6 *) A ( { x = 9.0349; y = 11.3951; z = 0.8250 } , (* N6 *) { x = 7.2891; y = 8.9068; z = 0.3121 } , (* N7 *) { x = 7.7962; y = 7.5519; z = -1.3859 } , (* N9 *) { x = 6.9702; y = 7.8292; z = -0.3353 } , (* C8 *) { x = 11.3132; y = 10.0537; z = -2.5851 } , (* H2 *) { x = 8.2741; y = 11.2784; z = 1.4629 } , (* H61 *) { x = 9.6733; y = 12.1368; z = 0.9529 } , (* H62 *) { x = 6.0888; y = 7.3990; z = 0.1403 } ) ) (* H8 *) let rA06 = N ( { a = -0.9815 ; b = 0.0731 ; c = -0.1772 ; (* dgf_base_tfo *) d = 0.1912 ; e = 0.3054 ; f = -0.9328 ; g = -0.0141 ; h = -0.9494 ; i = -0.3137 ; tx = 5.7506 ; ty = -5.1944 ; tz = 4.7470 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 4.1214; y = 6.7116; z = -1.9049 } , (* C5' *) { x = 3.3465; y = 5.9610; z = -2.0607 } , (* H5' *) { x = 4.0789; y = 7.2928; z = -0.9837 } , (* H5'' *) { x = 5.4170; y = 5.9293; z = -1.8186 } , (* C4' *) { x = 5.4506; y = 5.3400; z = -0.9023 } , (* H4' *) { x = 5.5067; y = 5.0417; z = -2.9703 } , (* O4' *) { x = 6.8650; y = 4.9152; z = -3.3612 } , (* C1' *) { x = 7.1090; y = 3.8577; z = -3.2603 } , (* H1' *) { x = 7.7152; y = 5.7282; z = -2.3894 } , (* C2' *) { x = 8.5029; y = 6.2356; z = -2.9463 } , (* H2'' *) { x = 8.1036; y = 4.8568; z = -1.3419 } , (* O2' *) { x = 8.3270; y = 3.9651; z = -1.6184 } , (* H2' *) { x = 6.7003; y = 6.7565; z = -1.8911 } , (* C3' *) { x = 6.5898; y = 7.5329; z = -2.6482 } , (* H3' *) { x = 7.0505; y = 7.2878; z = -0.6105 } , (* O3' *) { x = 6.6624; y = 3.5061; z = -8.2986 } , (* N1 *) { x = 6.5810; y = 3.2570; z = -5.9221 } , (* N3 *) { x = 6.5151; y = 2.8263; z = -7.1625 } , (* C2 *) { x = 6.8364; y = 4.5817; z = -5.8882 } , (* C4 *) { x = 7.0116; y = 5.4064; z = -6.9609 } , (* C5 *) { x = 6.9173; y = 4.8260; z = -8.2361 } , (* C6 *) A ( { x = 7.0668; y = 5.5163; z = -9.3763 } , (* N6 *) { x = 7.2573; y = 6.7070; z = -6.5394 } , (* N7 *) { x = 6.9740; y = 5.3703; z = -4.7760 } , (* N9 *) { x = 7.2238; y = 6.6275; z = -5.2453 } , (* C8 *) { x = 6.3146; y = 1.7741; z = -7.3641 } , (* H2 *) { x = 7.2568; y = 6.4972; z = -9.3456 } , (* H61 *) { x = 7.0437; y = 5.0478; z = -10.2446 } , (* H62 *) { x = 7.4108; y = 7.6227; z = -4.8418 } ) ) (* H8 *) let rA07 = N ( { a = 0.2379 ; b = 0.1310 ; c = -0.9624 ; (* dgf_base_tfo *) d = -0.5876 ; e = -0.7696 ; f = -0.2499 ; g = -0.7734 ; h = 0.6249 ; i = -0.1061 ; tx = 30.9870 ; ty = -26.9344 ; tz = 42.6416 } , { a = 0.7529 ; b = 0.1548 ; c = 0.6397 ; (* P_O3'_275_tfo *) d = 0.2952 ; e = -0.9481 ; f = -0.1180 ; g = 0.5882 ; h = 0.2777 ; i = -0.7595 ; tx = -58.8919 ; ty = -11.3095 ; tz = 6.0866 } , { a = -0.0239 ; b = 0.9667 ; c = -0.2546 ; (* P_O3'_180_tfo *) d = 0.9731 ; e = -0.0359 ; f = -0.2275 ; g = -0.2290 ; h = -0.2532 ; i = -0.9399 ; tx = 3.5401 ; ty = -29.7913 ; tz = 52.2796 } , { a = -0.8912 ; b = -0.4531 ; c = 0.0242 ; (* P_O3'_60_tfo *) d = -0.1183 ; e = 0.1805 ; f = -0.9764 ; g = 0.4380 ; h = -0.8730 ; i = -0.2145 ; tx = 19.9023 ; ty = 54.8054 ; tz = 15.2799 } , { x = 41.8210; y = 8.3880; z = 43.5890 } , (* P *) { x = 42.5400; y = 8.0450; z = 44.8330 } , (* O1P *) { x = 42.2470; y = 9.6920; z = 42.9910 } , (* O2P *) { x = 40.2550; y = 8.2030; z = 43.7340 } , (* O5' *) { x = 39.3505; y = 8.4697; z = 42.6565 } , (* C5' *) { x = 39.1377; y = 7.5433; z = 42.1230 } , (* H5' *) { x = 39.7203; y = 9.3119; z = 42.0717 } , (* H5'' *) { x = 38.0405; y = 8.9195; z = 43.2869 } , (* C4' *) { x = 37.3687; y = 9.3036; z = 42.5193 } , (* H4' *) { x = 37.4319; y = 7.8146; z = 43.9387 } , (* O4' *) { x = 37.1959; y = 8.1354; z = 45.3237 } , (* C1' *) { x = 36.1788; y = 8.5202; z = 45.3970 } , (* H1' *) { x = 38.1721; y = 9.2328; z = 45.6504 } , (* C2' *) { x = 39.1555; y = 8.7939; z = 45.8188 } , (* H2'' *) { x = 37.7862; y = 10.0617; z = 46.7013 } , (* O2' *) { x = 37.3087; y = 9.6229; z = 47.4092 } , (* H2' *) { x = 38.1844; y = 10.0268; z = 44.3367 } , (* C3' *) { x = 39.1578; y = 10.5054; z = 44.2289 } , (* H3' *) { x = 37.0547; y = 10.9127; z = 44.3441 } , (* O3' *) { x = 34.8811; y = 4.2072; z = 47.5784 } , (* N1 *) { x = 35.1084; y = 6.1336; z = 46.1818 } , (* N3 *) { x = 34.4108; y = 5.1360; z = 46.7207 } , (* C2 *) { x = 36.3908; y = 6.1224; z = 46.6053 } , (* C4 *) { x = 36.9819; y = 5.2334; z = 47.4697 } , (* C5 *) { x = 36.1786; y = 4.1985; z = 48.0035 } , (* C6 *) A ( { x = 36.6103; y = 3.2749; z = 48.8452 } , (* N6 *) { x = 38.3236; y = 5.5522; z = 47.6595 } , (* N7 *) { x = 37.3887; y = 7.0024; z = 46.2437 } , (* N9 *) { x = 38.5055; y = 6.6096; z = 46.9057 } , (* C8 *) { x = 33.3553; y = 5.0152; z = 46.4771 } , (* H2 *) { x = 37.5730; y = 3.2804; z = 49.1507 } , (* H61 *) { x = 35.9775; y = 2.5638; z = 49.1828 } , (* H62 *) { x = 39.5461; y = 6.9184; z = 47.0041 } ) ) (* H8 *) let rA08 = N ( { a = 0.1084 ; b = -0.0895 ; c = -0.9901 ; (* dgf_base_tfo *) d = 0.9789 ; e = -0.1638 ; f = 0.1220 ; g = -0.1731 ; h = -0.9824 ; i = 0.0698 ; tx = -2.9039 ; ty = 47.2655 ; tz = 33.0094 } , { a = 0.7529 ; b = 0.1548 ; c = 0.6397 ; (* P_O3'_275_tfo *) d = 0.2952 ; e = -0.9481 ; f = -0.1180 ; g = 0.5882 ; h = 0.2777 ; i = -0.7595 ; tx = -58.8919 ; ty = -11.3095 ; tz = 6.0866 } , { a = -0.0239 ; b = 0.9667 ; c = -0.2546 ; (* P_O3'_180_tfo *) d = 0.9731 ; e = -0.0359 ; f = -0.2275 ; g = -0.2290 ; h = -0.2532 ; i = -0.9399 ; tx = 3.5401 ; ty = -29.7913 ; tz = 52.2796 } , { a = -0.8912 ; b = -0.4531 ; c = 0.0242 ; (* P_O3'_60_tfo *) d = -0.1183 ; e = 0.1805 ; f = -0.9764 ; g = 0.4380 ; h = -0.8730 ; i = -0.2145 ; tx = 19.9023 ; ty = 54.8054 ; tz = 15.2799 } , { x = 41.8210; y = 8.3880; z = 43.5890 } , (* P *) { x = 42.5400; y = 8.0450; z = 44.8330 } , (* O1P *) { x = 42.2470; y = 9.6920; z = 42.9910 } , (* O2P *) { x = 40.2550; y = 8.2030; z = 43.7340 } , (* O5' *) { x = 39.4850; y = 8.9301; z = 44.6977 } , (* C5' *) { x = 39.0638; y = 9.8199; z = 44.2296 } , (* H5' *) { x = 40.0757; y = 9.0713; z = 45.6029 } , (* H5'' *) { x = 38.3102; y = 8.0414; z = 45.0789 } , (* C4' *) { x = 37.7842; y = 8.4637; z = 45.9351 } , (* H4' *) { x = 37.4200; y = 7.9453; z = 43.9769 } , (* O4' *) { x = 37.2249; y = 6.5609; z = 43.6273 } , (* C1' *) { x = 36.3360; y = 6.2168; z = 44.1561 } , (* H1' *) { x = 38.4347; y = 5.8414; z = 44.1590 } , (* C2' *) { x = 39.2688; y = 5.9974; z = 43.4749 } , (* H2'' *) { x = 38.2344; y = 4.4907; z = 44.4348 } , (* O2' *) { x = 37.6374; y = 4.0386; z = 43.8341 } , (* H2' *) { x = 38.6926; y = 6.6079; z = 45.4637 } , (* C3' *) { x = 39.7585; y = 6.5640; z = 45.6877 } , (* H3' *) { x = 37.8238; y = 6.0705; z = 46.4723 } , (* O3' *) { x = 33.9162; y = 6.2598; z = 39.7758 } , (* N1 *) { x = 34.6709; y = 6.5759; z = 42.0215 } , (* N3 *) { x = 33.7257; y = 6.5186; z = 41.0858 } , (* C2 *) { x = 35.8935; y = 6.3324; z = 41.5018 } , (* C4 *) { x = 36.2105; y = 6.0601; z = 40.1932 } , (* C5 *) { x = 35.1538; y = 6.0151; z = 39.2537 } , (* C6 *) A ( { x = 35.3088; y = 5.7642; z = 37.9649 } , (* N6 *) { x = 37.5818; y = 5.8677; z = 40.0507 } , (* N7 *) { x = 37.0932; y = 6.3197; z = 42.1810 } , (* N9 *) { x = 38.0509; y = 6.0354; z = 41.2635 } , (* C8 *) { x = 32.6830; y = 6.6898; z = 41.3532 } , (* H2 *) { x = 36.2305; y = 5.5855; z = 37.5925 } , (* H61 *) { x = 34.5056; y = 5.7512; z = 37.3528 } , (* H62 *) { x = 39.1318; y = 5.8993; z = 41.2285 } ) ) (* H8 *) let rA09 = N ( { a = 0.8467 ; b = 0.4166 ; c = -0.3311 ; (* dgf_base_tfo *) d = -0.3962 ; e = 0.9089 ; f = 0.1303 ; g = 0.3552 ; h = 0.0209 ; i = 0.9346 ; tx = -42.7319 ; ty = -26.6223 ; tz = -29.8163 } , { a = 0.7529 ; b = 0.1548 ; c = 0.6397 ; (* P_O3'_275_tfo *) d = 0.2952 ; e = -0.9481 ; f = -0.1180 ; g = 0.5882 ; h = 0.2777 ; i = -0.7595 ; tx = -58.8919 ; ty = -11.3095 ; tz = 6.0866 } , { a = -0.0239 ; b = 0.9667 ; c = -0.2546 ; (* P_O3'_180_tfo *) d = 0.9731 ; e = -0.0359 ; f = -0.2275 ; g = -0.2290 ; h = -0.2532 ; i = -0.9399 ; tx = 3.5401 ; ty = -29.7913 ; tz = 52.2796 } , { a = -0.8912 ; b = -0.4531 ; c = 0.0242 ; (* P_O3'_60_tfo *) d = -0.1183 ; e = 0.1805 ; f = -0.9764 ; g = 0.4380 ; h = -0.8730 ; i = -0.2145 ; tx = 19.9023 ; ty = 54.8054 ; tz = 15.2799 } , { x = 41.8210; y = 8.3880; z = 43.5890 } , (* P *) { x = 42.5400; y = 8.0450; z = 44.8330 } , (* O1P *) { x = 42.2470; y = 9.6920; z = 42.9910 } , (* O2P *) { x = 40.2550; y = 8.2030; z = 43.7340 } , (* O5' *) { x = 39.3505; y = 8.4697; z = 42.6565 } , (* C5' *) { x = 39.1377; y = 7.5433; z = 42.1230 } , (* H5' *) { x = 39.7203; y = 9.3119; z = 42.0717 } , (* H5'' *) { x = 38.0405; y = 8.9195; z = 43.2869 } , (* C4' *) { x = 37.6479; y = 8.1347; z = 43.9335 } , (* H4' *) { x = 38.2691; y = 10.0933; z = 44.0524 } , (* O4' *) { x = 37.3999; y = 11.1488; z = 43.5973 } , (* C1' *) { x = 36.5061; y = 11.1221; z = 44.2206 } , (* H1' *) { x = 37.0364; y = 10.7838; z = 42.1836 } , (* C2' *) { x = 37.8636; y = 11.0489; z = 41.5252 } , (* H2'' *) { x = 35.8275; y = 11.3133; z = 41.7379 } , (* O2' *) { x = 35.6214; y = 12.1896; z = 42.0714 } , (* H2' *) { x = 36.9316; y = 9.2556; z = 42.2837 } , (* C3' *) { x = 37.1778; y = 8.8260; z = 41.3127 } , (* H3' *) { x = 35.6285; y = 8.9334; z = 42.7926 } , (* O3' *) { x = 38.1482; y = 15.2833; z = 46.4641 } , (* N1 *) { x = 37.3641; y = 13.0968; z = 45.9007 } , (* N3 *) { x = 37.5032; y = 14.1288; z = 46.7300 } , (* C2 *) { x = 37.9570; y = 13.3377; z = 44.7113 } , (* C4 *) { x = 38.6397; y = 14.4660; z = 44.3267 } , (* C5 *) { x = 38.7473; y = 15.5229; z = 45.2609 } , (* C6 *) A ( { x = 39.3720; y = 16.6649; z = 45.0297 } , (* N6 *) { x = 39.1079; y = 14.3351; z = 43.0223 } , (* N7 *) { x = 38.0132; y = 12.4868; z = 43.6280 } , (* N9 *) { x = 38.7058; y = 13.1402; z = 42.6620 } , (* C8 *) { x = 37.0731; y = 14.0857; z = 47.7306 } , (* H2 *) { x = 39.8113; y = 16.8281; z = 44.1350 } , (* H61 *) { x = 39.4100; y = 17.3741; z = 45.7478 } , (* H62 *) { x = 39.0412; y = 12.9660; z = 41.6397 } ) ) (* H8 *) let rA10 = N ( { a = 0.7063 ; b = 0.6317 ; c = -0.3196 ; (* dgf_base_tfo *) d = -0.0403 ; e = -0.4149 ; f = -0.9090 ; g = -0.7068 ; h = 0.6549 ; i = -0.2676 ; tx = 6.4402 ; ty = -52.1496 ; tz = 30.8246 } , { a = 0.7529 ; b = 0.1548 ; c = 0.6397 ; (* P_O3'_275_tfo *) d = 0.2952 ; e = -0.9481 ; f = -0.1180 ; g = 0.5882 ; h = 0.2777 ; i = -0.7595 ; tx = -58.8919 ; ty = -11.3095 ; tz = 6.0866 } , { a = -0.0239 ; b = 0.9667 ; c = -0.2546 ; (* P_O3'_180_tfo *) d = 0.9731 ; e = -0.0359 ; f = -0.2275 ; g = -0.2290 ; h = -0.2532 ; i = -0.9399 ; tx = 3.5401 ; ty = -29.7913 ; tz = 52.2796 } , { a = -0.8912 ; b = -0.4531 ; c = 0.0242 ; (* P_O3'_60_tfo *) d = -0.1183 ; e = 0.1805 ; f = -0.9764 ; g = 0.4380 ; h = -0.8730 ; i = -0.2145 ; tx = 19.9023 ; ty = 54.8054 ; tz = 15.2799 } , { x = 41.8210; y = 8.3880; z = 43.5890 } , (* P *) { x = 42.5400; y = 8.0450; z = 44.8330 } , (* O1P *) { x = 42.2470; y = 9.6920; z = 42.9910 } , (* O2P *) { x = 40.2550; y = 8.2030; z = 43.7340 } , (* O5' *) { x = 39.4850; y = 8.9301; z = 44.6977 } , (* C5' *) { x = 39.0638; y = 9.8199; z = 44.2296 } , (* H5' *) { x = 40.0757; y = 9.0713; z = 45.6029 } , (* H5'' *) { x = 38.3102; y = 8.0414; z = 45.0789 } , (* C4' *) { x = 37.7099; y = 7.8166; z = 44.1973 } , (* H4' *) { x = 38.8012; y = 6.8321; z = 45.6380 } , (* O4' *) { x = 38.2431; y = 6.6413; z = 46.9529 } , (* C1' *) { x = 37.3505; y = 6.0262; z = 46.8385 } , (* H1' *) { x = 37.8484; y = 8.0156; z = 47.4214 } , (* C2' *) { x = 38.7381; y = 8.5406; z = 47.7690 } , (* H2'' *) { x = 36.8286; y = 8.0368; z = 48.3701 } , (* O2' *) { x = 36.8392; y = 7.3063; z = 48.9929 } , (* H2' *) { x = 37.3576; y = 8.6512; z = 46.1132 } , (* C3' *) { x = 37.5207; y = 9.7275; z = 46.1671 } , (* H3' *) { x = 35.9985; y = 8.2392; z = 45.9032 } , (* O3' *) { x = 39.9117; y = 2.2278; z = 48.8527 } , (* N1 *) { x = 38.6207; y = 3.6941; z = 47.4757 } , (* N3 *) { x = 38.9872; y = 2.4888; z = 47.9057 } , (* C2 *) { x = 39.2961; y = 4.6720; z = 48.1174 } , (* C4 *) { x = 40.2546; y = 4.5307; z = 49.0912 } , (* C5 *) { x = 40.5932; y = 3.2189; z = 49.4985 } , (* C6 *) A ( { x = 41.4938; y = 2.9317; z = 50.4229 } , (* N6 *) { x = 40.7195; y = 5.7755; z = 49.5060 } , (* N7 *) { x = 39.1730; y = 6.0305; z = 47.9170 } , (* N9 *) { x = 40.0413; y = 6.6250; z = 48.7728 } , (* C8 *) { x = 38.5257; y = 1.5960; z = 47.4838 } , (* H2 *) { x = 41.9907; y = 3.6753; z = 50.8921 } , (* H61 *) { x = 41.6848; y = 1.9687; z = 50.6599 } , (* H62 *) { x = 40.3571; y = 7.6321; z = 49.0452 } ) ) (* H8 *) let rAs = [ rA01; rA02; rA03; rA04; rA05; rA06; rA07; rA08; rA09; rA10 ] let rC = N ( { a = -0.0359 ; b = -0.8071 ; c = 0.5894 ; (* dgf_base_tfo *) d = -0.2669 ; e = 0.5761 ; f = 0.7726 ; g = -0.9631 ; h = -0.1296 ; i = -0.2361 ; tx = 0.1584 ; ty = 8.3434 ; tz = 0.5434 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 5.2430; y = -8.2420; z = 2.8260 } , (* C5' *) { x = 5.1974; y = -8.8497; z = 1.9223 } , (* H5' *) { x = 5.5548; y = -8.7348; z = 3.7469 } , (* H5'' *) { x = 6.3140; y = -7.2060; z = 2.5510 } , (* C4' *) { x = 7.2954; y = -7.6762; z = 2.4898 } , (* H4' *) { x = 6.0140; y = -6.5420; z = 1.2890 } , (* O4' *) { x = 6.4190; y = -5.1840; z = 1.3620 } , (* C1' *) { x = 7.1608; y = -5.0495; z = 0.5747 } , (* H1' *) { x = 7.0760; y = -4.9560; z = 2.7270 } , (* C2' *) { x = 6.7770; y = -3.9803; z = 3.1099 } , (* H2'' *) { x = 8.4500; y = -5.1930; z = 2.5810 } , (* O2' *) { x = 8.8309; y = -4.8755; z = 1.7590 } , (* H2' *) { x = 6.4060; y = -6.0590; z = 3.5580 } , (* C3' *) { x = 5.4021; y = -5.7313; z = 3.8281 } , (* H3' *) { x = 7.1570; y = -6.4240; z = 4.7070 } , (* O3' *) { x = 5.2170; y = -4.3260; z = 1.1690 } , (* N1 *) { x = 4.2960; y = -2.2560; z = 0.6290 } , (* N3 *) { x = 5.4330; y = -3.0200; z = 0.7990 } , (* C2 *) { x = 2.9930; y = -2.6780; z = 0.7940 } , (* C4 *) { x = 2.8670; y = -4.0630; z = 1.1830 } , (* C5 *) { x = 3.9570; y = -4.8300; z = 1.3550 } , (* C6 *) C ( { x = 2.0187; y = -1.8047; z = 0.5874 } , (* N4 *) { x = 6.5470; y = -2.5560; z = 0.6290 } , (* O2 *) { x = 1.0684; y = -2.1236; z = 0.7109 } , (* H41 *) { x = 2.2344; y = -0.8560; z = 0.3162 } , (* H42 *) { x = 1.8797; y = -4.4972; z = 1.3404 } , (* H5 *) { x = 3.8479; y = -5.8742; z = 1.6480 } ) ) (* H6 *) let rC01 = N ( { a = -0.0137 ; b = -0.8012 ; c = 0.5983 ; (* dgf_base_tfo *) d = -0.2523 ; e = 0.5817 ; f = 0.7733 ; g = -0.9675 ; h = -0.1404 ; i = -0.2101 ; tx = 0.2031 ; ty = 8.3874 ; tz = 0.4228 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 5.2416; y = -8.2422; z = 2.8181 } , (* C5' *) { x = 5.2050; y = -8.8128; z = 1.8901 } , (* H5' *) { x = 5.5368; y = -8.7738; z = 3.7227 } , (* H5'' *) { x = 6.3232; y = -7.2037; z = 2.6002 } , (* C4' *) { x = 7.3048; y = -7.6757; z = 2.5577 } , (* H4' *) { x = 6.0635; y = -6.5092; z = 1.3456 } , (* O4' *) { x = 6.4697; y = -5.1547; z = 1.4629 } , (* C1' *) { x = 7.2354; y = -5.0043; z = 0.7018 } , (* H1' *) { x = 7.0856; y = -4.9610; z = 2.8521 } , (* C2' *) { x = 6.7777; y = -3.9935; z = 3.2487 } , (* H2'' *) { x = 8.4627; y = -5.1992; z = 2.7423 } , (* O2' *) { x = 8.8693; y = -4.8638; z = 1.9399 } , (* H2' *) { x = 6.3877; y = -6.0809; z = 3.6362 } , (* C3' *) { x = 5.3770; y = -5.7562; z = 3.8834 } , (* H3' *) { x = 7.1024; y = -6.4754; z = 4.7985 } , (* O3' *) { x = 5.2764; y = -4.2883; z = 1.2538 } , (* N1 *) { x = 4.3777; y = -2.2062; z = 0.7229 } , (* N3 *) { x = 5.5069; y = -2.9779; z = 0.9088 } , (* C2 *) { x = 3.0693; y = -2.6246; z = 0.8500 } , (* C4 *) { x = 2.9279; y = -4.0146; z = 1.2149 } , (* C5 *) { x = 4.0101; y = -4.7892; z = 1.4017 } , (* C6 *) C ( { x = 2.1040; y = -1.7437; z = 0.6331 } , (* N4 *) { x = 6.6267; y = -2.5166; z = 0.7728 } , (* O2 *) { x = 1.1496; y = -2.0600; z = 0.7287 } , (* H41 *) { x = 2.3303; y = -0.7921; z = 0.3815 } , (* H42 *) { x = 1.9353; y = -4.4465; z = 1.3419 } , (* H5 *) { x = 3.8895; y = -5.8371; z = 1.6762 } ) ) (* H6 *) let rC02 = N ( { a = 0.5141 ; b = 0.0246 ; c = 0.8574 ; (* dgf_base_tfo *) d = -0.5547 ; e = -0.7529 ; f = 0.3542 ; g = 0.6542 ; h = -0.6577 ; i = -0.3734 ; tx = -9.1111 ; ty = -3.4598 ; tz = -3.2939 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 4.3825; y = -6.6585; z = 4.0489 } , (* C5' *) { x = 4.6841; y = -7.2019; z = 4.9443 } , (* H5' *) { x = 3.6189; y = -5.8889; z = 4.1625 } , (* H5'' *) { x = 5.6255; y = -5.9175; z = 3.5998 } , (* C4' *) { x = 5.8732; y = -5.1228; z = 4.3034 } , (* H4' *) { x = 6.7337; y = -6.8605; z = 3.5222 } , (* O4' *) { x = 7.5932; y = -6.4923; z = 2.4548 } , (* C1' *) { x = 8.5661; y = -6.2983; z = 2.9064 } , (* H1' *) { x = 7.0527; y = -5.2012; z = 1.8322 } , (* C2' *) { x = 7.1627; y = -5.2525; z = 0.7490 } , (* H2'' *) { x = 7.6666; y = -4.1249; z = 2.4880 } , (* O2' *) { x = 8.5944; y = -4.2543; z = 2.6981 } , (* H2' *) { x = 5.5661; y = -5.3029; z = 2.2009 } , (* C3' *) { x = 5.0841; y = -6.0018; z = 1.5172 } , (* H3' *) { x = 4.9062; y = -4.0452; z = 2.2042 } , (* O3' *) { x = 7.6298; y = -7.6136; z = 1.4752 } , (* N1 *) { x = 8.6945; y = -8.7046; z = -0.2857 } , (* N3 *) { x = 8.6943; y = -7.6514; z = 0.6066 } , (* C2 *) { x = 7.7426; y = -9.6987; z = -0.3801 } , (* C4 *) { x = 6.6642; y = -9.5742; z = 0.5722 } , (* C5 *) { x = 6.6391; y = -8.5592; z = 1.4526 } , (* C6 *) C ( { x = 7.9033; y = -10.6371; z = -1.3010 } , (* N4 *) { x = 9.5840; y = -6.8186; z = 0.6136 } , (* O2 *) { x = 7.2009; y = -11.3604; z = -1.3619 } , (* H41 *) { x = 8.7058; y = -10.6168; z = -1.9140 } , (* H42 *) { x = 5.8585; y = -10.3083; z = 0.5822 } , (* H5 *) { x = 5.8197; y = -8.4773; z = 2.1667 } ) ) (* H6 *) let rC03 = N ( { a = -0.4993 ; b = 0.0476 ; c = 0.8651 ; (* dgf_base_tfo *) d = 0.8078 ; e = -0.3353 ; f = 0.4847 ; g = 0.3132 ; h = 0.9409 ; i = 0.1290 ; tx = 6.2989 ; ty = -5.2303 ; tz = -3.8577 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 3.9938; y = -6.7042; z = 1.9023 } , (* C5' *) { x = 3.2332; y = -5.9343; z = 2.0319 } , (* H5' *) { x = 3.9666; y = -7.2863; z = 0.9812 } , (* H5'' *) { x = 5.3098; y = -5.9546; z = 1.8564 } , (* C4' *) { x = 5.3863; y = -5.3702; z = 0.9395 } , (* H4' *) { x = 5.3851; y = -5.0642; z = 3.0076 } , (* O4' *) { x = 6.7315; y = -4.9724; z = 3.4462 } , (* C1' *) { x = 7.0033; y = -3.9202; z = 3.3619 } , (* H1' *) { x = 7.5997; y = -5.8018; z = 2.4948 } , (* C2' *) { x = 8.3627; y = -6.3254; z = 3.0707 } , (* H2'' *) { x = 8.0410; y = -4.9501; z = 1.4724 } , (* O2' *) { x = 8.2781; y = -4.0644; z = 1.7570 } , (* H2' *) { x = 6.5701; y = -6.8129; z = 1.9714 } , (* C3' *) { x = 6.4186; y = -7.5809; z = 2.7299 } , (* H3' *) { x = 6.9357; y = -7.3841; z = 0.7235 } , (* O3' *) { x = 6.8024; y = -5.4718; z = 4.8475 } , (* N1 *) { x = 7.9218; y = -5.5700; z = 6.8877 } , (* N3 *) { x = 7.8908; y = -5.0886; z = 5.5944 } , (* C2 *) { x = 6.9789; y = -6.3827; z = 7.4823 } , (* C4 *) { x = 5.8742; y = -6.7319; z = 6.6202 } , (* C5 *) { x = 5.8182; y = -6.2769; z = 5.3570 } , (* C6 *) C ( { x = 7.1702; y = -6.7511; z = 8.7402 } , (* N4 *) { x = 8.7747; y = -4.3728; z = 5.1568 } , (* O2 *) { x = 6.4741; y = -7.3461; z = 9.1662 } , (* H41 *) { x = 7.9889; y = -6.4396; z = 9.2429 } , (* H42 *) { x = 5.0736; y = -7.3713; z = 6.9922 } , (* H5 *) { x = 4.9784; y = -6.5473; z = 4.7170 } ) ) (* H6 *) let rC04 = N ( { a = -0.5669 ; b = -0.8012 ; c = 0.1918 ; (* dgf_base_tfo *) d = -0.8129 ; e = 0.5817 ; f = 0.0273 ; g = -0.1334 ; h = -0.1404 ; i = -0.9811 ; tx = -0.3279 ; ty = 8.3874 ; tz = 0.3355 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 5.2416; y = -8.2422; z = 2.8181 } , (* C5' *) { x = 5.2050; y = -8.8128; z = 1.8901 } , (* H5' *) { x = 5.5368; y = -8.7738; z = 3.7227 } , (* H5'' *) { x = 6.3232; y = -7.2037; z = 2.6002 } , (* C4' *) { x = 7.3048; y = -7.6757; z = 2.5577 } , (* H4' *) { x = 6.0635; y = -6.5092; z = 1.3456 } , (* O4' *) { x = 6.4697; y = -5.1547; z = 1.4629 } , (* C1' *) { x = 7.2354; y = -5.0043; z = 0.7018 } , (* H1' *) { x = 7.0856; y = -4.9610; z = 2.8521 } , (* C2' *) { x = 6.7777; y = -3.9935; z = 3.2487 } , (* H2'' *) { x = 8.4627; y = -5.1992; z = 2.7423 } , (* O2' *) { x = 8.8693; y = -4.8638; z = 1.9399 } , (* H2' *) { x = 6.3877; y = -6.0809; z = 3.6362 } , (* C3' *) { x = 5.3770; y = -5.7562; z = 3.8834 } , (* H3' *) { x = 7.1024; y = -6.4754; z = 4.7985 } , (* O3' *) { x = 5.2764; y = -4.2883; z = 1.2538 } , (* N1 *) { x = 3.8961; y = -3.0896; z = -0.1893 } , (* N3 *) { x = 5.0095; y = -3.8907; z = -0.0346 } , (* C2 *) { x = 3.0480; y = -2.6632; z = 0.8116 } , (* C4 *) { x = 3.4093; y = -3.1310; z = 2.1292 } , (* C5 *) { x = 4.4878; y = -3.9124; z = 2.3088 } , (* C6 *) C ( { x = 2.0216; y = -1.8941; z = 0.4804 } , (* N4 *) { x = 5.7005; y = -4.2164; z = -0.9842 } , (* O2 *) { x = 1.4067; y = -1.5873; z = 1.2205 } , (* H41 *) { x = 1.8721; y = -1.6319; z = -0.4835 } , (* H42 *) { x = 2.8048; y = -2.8507; z = 2.9918 } , (* H5 *) { x = 4.7491; y = -4.2593; z = 3.3085 } ) ) (* H6 *) let rC05 = N ( { a = -0.6298 ; b = 0.0246 ; c = 0.7763 ; (* dgf_base_tfo *) d = -0.5226 ; e = -0.7529 ; f = -0.4001 ; g = 0.5746 ; h = -0.6577 ; i = 0.4870 ; tx = -0.0208 ; ty = -3.4598 ; tz = -9.6882 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 4.3825; y = -6.6585; z = 4.0489 } , (* C5' *) { x = 4.6841; y = -7.2019; z = 4.9443 } , (* H5' *) { x = 3.6189; y = -5.8889; z = 4.1625 } , (* H5'' *) { x = 5.6255; y = -5.9175; z = 3.5998 } , (* C4' *) { x = 5.8732; y = -5.1228; z = 4.3034 } , (* H4' *) { x = 6.7337; y = -6.8605; z = 3.5222 } , (* O4' *) { x = 7.5932; y = -6.4923; z = 2.4548 } , (* C1' *) { x = 8.5661; y = -6.2983; z = 2.9064 } , (* H1' *) { x = 7.0527; y = -5.2012; z = 1.8322 } , (* C2' *) { x = 7.1627; y = -5.2525; z = 0.7490 } , (* H2'' *) { x = 7.6666; y = -4.1249; z = 2.4880 } , (* O2' *) { x = 8.5944; y = -4.2543; z = 2.6981 } , (* H2' *) { x = 5.5661; y = -5.3029; z = 2.2009 } , (* C3' *) { x = 5.0841; y = -6.0018; z = 1.5172 } , (* H3' *) { x = 4.9062; y = -4.0452; z = 2.2042 } , (* O3' *) { x = 7.6298; y = -7.6136; z = 1.4752 } , (* N1 *) { x = 8.5977; y = -9.5977; z = 0.7329 } , (* N3 *) { x = 8.5951; y = -8.5745; z = 1.6594 } , (* C2 *) { x = 7.7372; y = -9.7371; z = -0.3364 } , (* C4 *) { x = 6.7596; y = -8.6801; z = -0.4476 } , (* C5 *) { x = 6.7338; y = -7.6721; z = 0.4408 } , (* C6 *) C ( { x = 7.8849; y = -10.7881; z = -1.1289 } , (* N4 *) { x = 9.3993; y = -8.5377; z = 2.5743 } , (* O2 *) { x = 7.2499; y = -10.8809; z = -1.9088 } , (* H41 *) { x = 8.6122; y = -11.4649; z = -0.9468 } , (* H42 *) { x = 6.0317; y = -8.6941; z = -1.2588 } , (* H5 *) { x = 5.9901; y = -6.8809; z = 0.3459 } ) ) (* H6 *) let rC06 = N ( { a = -0.9837 ; b = 0.0476 ; c = -0.1733 ; (* dgf_base_tfo *) d = -0.1792 ; e = -0.3353 ; f = 0.9249 ; g = -0.0141 ; h = 0.9409 ; i = 0.3384 ; tx = 5.7793 ; ty = -5.2303 ; tz = 4.5997 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 3.9938; y = -6.7042; z = 1.9023 } , (* C5' *) { x = 3.2332; y = -5.9343; z = 2.0319 } , (* H5' *) { x = 3.9666; y = -7.2863; z = 0.9812 } , (* H5'' *) { x = 5.3098; y = -5.9546; z = 1.8564 } , (* C4' *) { x = 5.3863; y = -5.3702; z = 0.9395 } , (* H4' *) { x = 5.3851; y = -5.0642; z = 3.0076 } , (* O4' *) { x = 6.7315; y = -4.9724; z = 3.4462 } , (* C1' *) { x = 7.0033; y = -3.9202; z = 3.3619 } , (* H1' *) { x = 7.5997; y = -5.8018; z = 2.4948 } , (* C2' *) { x = 8.3627; y = -6.3254; z = 3.0707 } , (* H2'' *) { x = 8.0410; y = -4.9501; z = 1.4724 } , (* O2' *) { x = 8.2781; y = -4.0644; z = 1.7570 } , (* H2' *) { x = 6.5701; y = -6.8129; z = 1.9714 } , (* C3' *) { x = 6.4186; y = -7.5809; z = 2.7299 } , (* H3' *) { x = 6.9357; y = -7.3841; z = 0.7235 } , (* O3' *) { x = 6.8024; y = -5.4718; z = 4.8475 } , (* N1 *) { x = 6.6920; y = -5.0495; z = 7.1354 } , (* N3 *) { x = 6.6201; y = -4.5500; z = 5.8506 } , (* C2 *) { x = 6.9254; y = -6.3614; z = 7.4926 } , (* C4 *) { x = 7.1046; y = -7.2543; z = 6.3718 } , (* C5 *) { x = 7.0391; y = -6.7951; z = 5.1106 } , (* C6 *) C ( { x = 6.9614; y = -6.6648; z = 8.7815 } , (* N4 *) { x = 6.4083; y = -3.3696; z = 5.6340 } , (* O2 *) { x = 7.1329; y = -7.6280; z = 9.0324 } , (* H41 *) { x = 6.8204; y = -5.9469; z = 9.4777 } , (* H42 *) { x = 7.2954; y = -8.3135; z = 6.5440 } , (* H5 *) { x = 7.1753; y = -7.4798; z = 4.2735 } ) ) (* H6 *) let rC07 = N ( { a = 0.0033 ; b = 0.2720 ; c = -0.9623 ; (* dgf_base_tfo *) d = 0.3013 ; e = -0.9179 ; f = -0.2584 ; g = -0.9535 ; h = -0.2891 ; i = -0.0850 ; tx = 43.0403 ; ty = 13.7233 ; tz = 34.5710 } , { a = 0.9187 ; b = 0.2887 ; c = 0.2694 ; (* P_O3'_275_tfo *) d = 0.0302 ; e = -0.7316 ; f = 0.6811 ; g = 0.3938 ; h = -0.6176 ; i = -0.6808 ; tx = -48.4330 ; ty = 26.3254 ; tz = 13.6383 } , { a = -0.1504 ; b = 0.7744 ; c = -0.6145 ; (* P_O3'_180_tfo *) d = 0.7581 ; e = 0.4893 ; f = 0.4311 ; g = 0.6345 ; h = -0.4010 ; i = -0.6607 ; tx = -31.9784 ; ty = -13.4285 ; tz = 44.9650 } , { a = -0.6236 ; b = -0.7810 ; c = -0.0337 ; (* P_O3'_60_tfo *) d = -0.6890 ; e = 0.5694 ; f = -0.4484 ; g = 0.3694 ; h = -0.2564 ; i = -0.8932 ; tx = 12.1105 ; ty = 30.8774 ; tz = 46.0946 } , { x = 33.3400; y = 11.0980; z = 46.1750 } , (* P *) { x = 34.5130; y = 10.2320; z = 46.4660 } , (* O1P *) { x = 33.4130; y = 12.3960; z = 46.9340 } , (* O2P *) { x = 31.9810; y = 10.3390; z = 46.4820 } , (* O5' *) { x = 30.8152; y = 11.1619; z = 46.2003 } , (* C5' *) { x = 30.4519; y = 10.9454; z = 45.1957 } , (* H5' *) { x = 31.0379; y = 12.2016; z = 46.4400 } , (* H5'' *) { x = 29.7081; y = 10.7448; z = 47.1428 } , (* C4' *) { x = 28.8710; y = 11.4416; z = 47.0982 } , (* H4' *) { x = 29.2550; y = 9.4394; z = 46.8162 } , (* O4' *) { x = 29.3907; y = 8.5625; z = 47.9460 } , (* C1' *) { x = 28.4416; y = 8.5669; z = 48.4819 } , (* H1' *) { x = 30.4468; y = 9.2031; z = 48.7952 } , (* C2' *) { x = 31.4222; y = 8.9651; z = 48.3709 } , (* H2'' *) { x = 30.3701; y = 8.9157; z = 50.1624 } , (* O2' *) { x = 30.0652; y = 8.0304; z = 50.3740 } , (* H2' *) { x = 30.1622; y = 10.6879; z = 48.6120 } , (* C3' *) { x = 31.0952; y = 11.2399; z = 48.7254 } , (* H3' *) { x = 29.1076; y = 11.1535; z = 49.4702 } , (* O3' *) { x = 29.7883; y = 7.2209; z = 47.5235 } , (* N1 *) { x = 29.1825; y = 5.0438; z = 46.8275 } , (* N3 *) { x = 28.8008; y = 6.2912; z = 47.2263 } , (* C2 *) { x = 30.4888; y = 4.6890; z = 46.7186 } , (* C4 *) { x = 31.5034; y = 5.6405; z = 47.0249 } , (* C5 *) { x = 31.1091; y = 6.8691; z = 47.4156 } , (* C6 *) C ( { x = 30.8109; y = 3.4584; z = 46.3336 } , (* N4 *) { x = 27.6171; y = 6.5989; z = 47.3189 } , (* O2 *) { x = 31.7923; y = 3.2301; z = 46.2638 } , (* H41 *) { x = 30.0880; y = 2.7857; z = 46.1215 } , (* H42 *) { x = 32.5542; y = 5.3634; z = 46.9395 } , (* H5 *) { x = 31.8523; y = 7.6279; z = 47.6603 } ) ) (* H6 *) let rC08 = N ( { a = 0.0797 ; b = -0.6026 ; c = -0.7941 ; (* dgf_base_tfo *) d = 0.7939 ; e = 0.5201 ; f = -0.3150 ; g = 0.6028 ; h = -0.6054 ; i = 0.5198 ; tx = -36.8341 ; ty = 41.5293 ; tz = 1.6628 } , { a = 0.9187 ; b = 0.2887 ; c = 0.2694 ; (* P_O3'_275_tfo *) d = 0.0302 ; e = -0.7316 ; f = 0.6811 ; g = 0.3938 ; h = -0.6176 ; i = -0.6808 ; tx = -48.4330 ; ty = 26.3254 ; tz = 13.6383 } , { a = -0.1504 ; b = 0.7744 ; c = -0.6145 ; (* P_O3'_180_tfo *) d = 0.7581 ; e = 0.4893 ; f = 0.4311 ; g = 0.6345 ; h = -0.4010 ; i = -0.6607 ; tx = -31.9784 ; ty = -13.4285 ; tz = 44.9650 } , { a = -0.6236 ; b = -0.7810 ; c = -0.0337 ; (* P_O3'_60_tfo *) d = -0.6890 ; e = 0.5694 ; f = -0.4484 ; g = 0.3694 ; h = -0.2564 ; i = -0.8932 ; tx = 12.1105 ; ty = 30.8774 ; tz = 46.0946 } , { x = 33.3400; y = 11.0980; z = 46.1750 } , (* P *) { x = 34.5130; y = 10.2320; z = 46.4660 } , (* O1P *) { x = 33.4130; y = 12.3960; z = 46.9340 } , (* O2P *) { x = 31.9810; y = 10.3390; z = 46.4820 } , (* O5' *) { x = 31.8779; y = 9.9369; z = 47.8760 } , (* C5' *) { x = 31.3239; y = 10.6931; z = 48.4322 } , (* H5' *) { x = 32.8647; y = 9.6624; z = 48.2489 } , (* H5'' *) { x = 31.0429; y = 8.6773; z = 47.9401 } , (* C4' *) { x = 31.0779; y = 8.2331; z = 48.9349 } , (* H4' *) { x = 29.6956; y = 8.9669; z = 47.5983 } , (* O4' *) { x = 29.2784; y = 8.1700; z = 46.4782 } , (* C1' *) { x = 28.8006; y = 7.2731; z = 46.8722 } , (* H1' *) { x = 30.5544; y = 7.7940; z = 45.7875 } , (* C2' *) { x = 30.8837; y = 8.6410; z = 45.1856 } , (* H2'' *) { x = 30.5100; y = 6.6007; z = 45.0582 } , (* O2' *) { x = 29.6694; y = 6.4168; z = 44.6326 } , (* H2' *) { x = 31.5146; y = 7.5954; z = 46.9527 } , (* C3' *) { x = 32.5255; y = 7.8261; z = 46.6166 } , (* H3' *) { x = 31.3876; y = 6.2951; z = 47.5516 } , (* O3' *) { x = 28.3976; y = 8.9302; z = 45.5933 } , (* N1 *) { x = 26.2155; y = 9.6135; z = 44.9910 } , (* N3 *) { x = 27.0281; y = 8.8961; z = 45.8192 } , (* C2 *) { x = 26.7044; y = 10.3489; z = 43.9595 } , (* C4 *) { x = 28.1088; y = 10.3837; z = 43.7247 } , (* C5 *) { x = 28.8978; y = 9.6708; z = 44.5535 } , (* C6 *) C ( { x = 25.8715; y = 11.0249; z = 43.1749 } , (* N4 *) { x = 26.5733; y = 8.2371; z = 46.7484 } , (* O2 *) { x = 26.2707; y = 11.5609; z = 42.4177 } , (* H41 *) { x = 24.8760; y = 10.9939; z = 43.3427 } , (* H42 *) { x = 28.5089; y = 10.9722; z = 42.8990 } , (* H5 *) { x = 29.9782; y = 9.6687; z = 44.4097 } ) ) (* H6 *) let rC09 = N ( { a = 0.8727 ; b = 0.4760 ; c = -0.1091 ; (* dgf_base_tfo *) d = -0.4188 ; e = 0.6148 ; f = -0.6682 ; g = -0.2510 ; h = 0.6289 ; i = 0.7359 ; tx = -8.1687 ; ty = -52.0761 ; tz = -25.0726 } , { a = 0.9187 ; b = 0.2887 ; c = 0.2694 ; (* P_O3'_275_tfo *) d = 0.0302 ; e = -0.7316 ; f = 0.6811 ; g = 0.3938 ; h = -0.6176 ; i = -0.6808 ; tx = -48.4330 ; ty = 26.3254 ; tz = 13.6383 } , { a = -0.1504 ; b = 0.7744 ; c = -0.6145 ; (* P_O3'_180_tfo *) d = 0.7581 ; e = 0.4893 ; f = 0.4311 ; g = 0.6345 ; h = -0.4010 ; i = -0.6607 ; tx = -31.9784 ; ty = -13.4285 ; tz = 44.9650 } , { a = -0.6236 ; b = -0.7810 ; c = -0.0337 ; (* P_O3'_60_tfo *) d = -0.6890 ; e = 0.5694 ; f = -0.4484 ; g = 0.3694 ; h = -0.2564 ; i = -0.8932 ; tx = 12.1105 ; ty = 30.8774 ; tz = 46.0946 } , { x = 33.3400; y = 11.0980; z = 46.1750 } , (* P *) { x = 34.5130; y = 10.2320; z = 46.4660 } , (* O1P *) { x = 33.4130; y = 12.3960; z = 46.9340 } , (* O2P *) { x = 31.9810; y = 10.3390; z = 46.4820 } , (* O5' *) { x = 30.8152; y = 11.1619; z = 46.2003 } , (* C5' *) { x = 30.4519; y = 10.9454; z = 45.1957 } , (* H5' *) { x = 31.0379; y = 12.2016; z = 46.4400 } , (* H5'' *) { x = 29.7081; y = 10.7448; z = 47.1428 } , (* C4' *) { x = 29.4506; y = 9.6945; z = 47.0059 } , (* H4' *) { x = 30.1045; y = 10.9634; z = 48.4885 } , (* O4' *) { x = 29.1794; y = 11.8418; z = 49.1490 } , (* C1' *) { x = 28.4388; y = 11.2210; z = 49.6533 } , (* H1' *) { x = 28.5211; y = 12.6008; z = 48.0367 } , (* C2' *) { x = 29.1947; y = 13.3949; z = 47.7147 } , (* H2'' *) { x = 27.2316; y = 13.0683; z = 48.3134 } , (* O2' *) { x = 27.0851; y = 13.3391; z = 49.2227 } , (* H2' *) { x = 28.4131; y = 11.5507; z = 46.9391 } , (* C3' *) { x = 28.4451; y = 12.0512; z = 45.9713 } , (* H3' *) { x = 27.2707; y = 10.6955; z = 47.1097 } , (* O3' *) { x = 29.8751; y = 12.7405; z = 50.0682 } , (* N1 *) { x = 30.7172; y = 13.1841; z = 52.2328 } , (* N3 *) { x = 30.0617; y = 12.3404; z = 51.3847 } , (* C2 *) { x = 31.1834; y = 14.3941; z = 51.8297 } , (* C4 *) { x = 30.9913; y = 14.8074; z = 50.4803 } , (* C5 *) { x = 30.3434; y = 13.9610; z = 49.6548 } , (* C6 *) C ( { x = 31.8090; y = 15.1847; z = 52.6957 } , (* N4 *) { x = 29.6470; y = 11.2494; z = 51.7616 } , (* O2 *) { x = 32.1422; y = 16.0774; z = 52.3606 } , (* H41 *) { x = 31.9392; y = 14.8893; z = 53.6527 } , (* H42 *) { x = 31.3632; y = 15.7771; z = 50.1491 } , (* H5 *) { x = 30.1742; y = 14.2374; z = 48.6141 } ) ) (* H6 *) let rC10 = N ( { a = 0.1549 ; b = 0.8710 ; c = -0.4663 ; (* dgf_base_tfo *) d = 0.6768 ; e = -0.4374 ; f = -0.5921 ; g = -0.7197 ; h = -0.2239 ; i = -0.6572 ; tx = 25.2447 ; ty = -14.1920 ; tz = 50.3201 } , { a = 0.9187 ; b = 0.2887 ; c = 0.2694 ; (* P_O3'_275_tfo *) d = 0.0302 ; e = -0.7316 ; f = 0.6811 ; g = 0.3938 ; h = -0.6176 ; i = -0.6808 ; tx = -48.4330 ; ty = 26.3254 ; tz = 13.6383 } , { a = -0.1504 ; b = 0.7744 ; c = -0.6145 ; (* P_O3'_180_tfo *) d = 0.7581 ; e = 0.4893 ; f = 0.4311 ; g = 0.6345 ; h = -0.4010 ; i = -0.6607 ; tx = -31.9784 ; ty = -13.4285 ; tz = 44.9650 } , { a = -0.6236 ; b = -0.7810 ; c = -0.0337 ; (* P_O3'_60_tfo *) d = -0.6890 ; e = 0.5694 ; f = -0.4484 ; g = 0.3694 ; h = -0.2564 ; i = -0.8932 ; tx = 12.1105 ; ty = 30.8774 ; tz = 46.0946 } , { x = 33.3400; y = 11.0980; z = 46.1750 } , (* P *) { x = 34.5130; y = 10.2320; z = 46.4660 } , (* O1P *) { x = 33.4130; y = 12.3960; z = 46.9340 } , (* O2P *) { x = 31.9810; y = 10.3390; z = 46.4820 } , (* O5' *) { x = 31.8779; y = 9.9369; z = 47.8760 } , (* C5' *) { x = 31.3239; y = 10.6931; z = 48.4322 } , (* H5' *) { x = 32.8647; y = 9.6624; z = 48.2489 } , (* H5'' *) { x = 31.0429; y = 8.6773; z = 47.9401 } , (* C4' *) { x = 30.0440; y = 8.8473; z = 47.5383 } , (* H4' *) { x = 31.6749; y = 7.6351; z = 47.2119 } , (* O4' *) { x = 31.9159; y = 6.5022; z = 48.0616 } , (* C1' *) { x = 31.0691; y = 5.8243; z = 47.9544 } , (* H1' *) { x = 31.9300; y = 7.0685; z = 49.4493 } , (* C2' *) { x = 32.9024; y = 7.5288; z = 49.6245 } , (* H2'' *) { x = 31.5672; y = 6.1750; z = 50.4632 } , (* O2' *) { x = 31.8416; y = 5.2663; z = 50.3200 } , (* H2' *) { x = 30.8618; y = 8.1514; z = 49.3749 } , (* C3' *) { x = 31.1122; y = 8.9396; z = 50.0850 } , (* H3' *) { x = 29.5351; y = 7.6245; z = 49.5409 } , (* O3' *) { x = 33.1890; y = 5.8629; z = 47.7343 } , (* N1 *) { x = 34.4004; y = 4.2636; z = 46.4828 } , (* N3 *) { x = 33.2062; y = 4.8497; z = 46.7851 } , (* C2 *) { x = 35.5600; y = 4.6374; z = 47.0822 } , (* C4 *) { x = 35.5444; y = 5.6751; z = 48.0577 } , (* C5 *) { x = 34.3565; y = 6.2450; z = 48.3432 } , (* C6 *) C ( { x = 36.6977; y = 4.0305; z = 46.7598 } , (* N4 *) { x = 32.1661; y = 4.5034; z = 46.2348 } , (* O2 *) { x = 37.5405; y = 4.3347; z = 47.2259 } , (* H41 *) { x = 36.7033; y = 3.2923; z = 46.0706 } , (* H42 *) { x = 36.4713; y = 5.9811; z = 48.5428 } , (* H5 *) { x = 34.2986; y = 7.0426; z = 49.0839 } ) ) (* H6 *) let rCs = [ rC01; rC02; rC03; rC04; rC05; rC06; rC07; rC08; rC09; rC10 ] let rG = N ( { a = -0.0018 ; b = -0.8207 ; c = 0.5714 ; (* dgf_base_tfo *) d = 0.2679 ; e = -0.5509 ; f = -0.7904 ; g = 0.9634 ; h = 0.1517 ; i = 0.2209 ; tx = 0.0073 ; ty = 8.4030 ; tz = 0.6232 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 5.4550; y = 8.2120; z = -2.8810 } , (* C5' *) { x = 5.4546; y = 8.8508; z = -1.9978 } , (* H5' *) { x = 5.7588; y = 8.6625; z = -3.8259 } , (* H5'' *) { x = 6.4970; y = 7.1480; z = -2.5980 } , (* C4' *) { x = 7.4896; y = 7.5919; z = -2.5214 } , (* H4' *) { x = 6.1630; y = 6.4860; z = -1.3440 } , (* O4' *) { x = 6.5400; y = 5.1200; z = -1.4190 } , (* C1' *) { x = 7.2763; y = 4.9681; z = -0.6297 } , (* H1' *) { x = 7.1940; y = 4.8830; z = -2.7770 } , (* C2' *) { x = 6.8667; y = 3.9183; z = -3.1647 } , (* H2'' *) { x = 8.5860; y = 5.0910; z = -2.6140 } , (* O2' *) { x = 8.9510; y = 4.7626; z = -1.7890 } , (* H2' *) { x = 6.5720; y = 6.0040; z = -3.6090 } , (* C3' *) { x = 5.5636; y = 5.7066; z = -3.8966 } , (* H3' *) { x = 7.3801; y = 6.3562; z = -4.7350 } , (* O3' *) { x = 4.7150; y = 0.4910; z = -0.1360 } , (* N1 *) { x = 6.3490; y = 2.1730; z = -0.6020 } , (* N3 *) { x = 5.9530; y = 0.9650; z = -0.2670 } , (* C2 *) { x = 5.2900; y = 2.9790; z = -0.8260 } , (* C4 *) { x = 3.9720; y = 2.6390; z = -0.7330 } , (* C5 *) { x = 3.6770; y = 1.3160; z = -0.3660 } , (* C6 *) G ( { x = 6.8426; y = 0.0056; z = -0.0019 } , (* N2 *) { x = 3.1660; y = 3.7290; z = -1.0360 } , (* N7 *) { x = 5.3170; y = 4.2990; z = -1.1930 } , (* N9 *) { x = 4.0100; y = 4.6780; z = -1.2990 } , (* C8 *) { x = 2.4280; y = 0.8450; z = -0.2360 } , (* O6 *) { x = 4.6151; y = -0.4677; z = 0.1305 } , (* H1 *) { x = 6.6463; y = -0.9463; z = 0.2729 } , (* H21 *) { x = 7.8170; y = 0.2642; z = -0.0640 } , (* H22 *) { x = 3.4421; y = 5.5744; z = -1.5482 } ) ) (* H8 *) let rG01 = N ( { a = -0.0043 ; b = -0.8175 ; c = 0.5759 ; (* dgf_base_tfo *) d = 0.2617 ; e = -0.5567 ; f = -0.7884 ; g = 0.9651 ; h = 0.1473 ; i = 0.2164 ; tx = 0.0359 ; ty = 8.3929 ; tz = 0.5532 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 5.4352; y = 8.2183; z = -2.7757 } , (* C5' *) { x = 5.3830; y = 8.7883; z = -1.8481 } , (* H5' *) { x = 5.7729; y = 8.7436; z = -3.6691 } , (* H5'' *) { x = 6.4830; y = 7.1518; z = -2.5252 } , (* C4' *) { x = 7.4749; y = 7.5972; z = -2.4482 } , (* H4' *) { x = 6.1626; y = 6.4620; z = -1.2827 } , (* O4' *) { x = 6.5431; y = 5.0992; z = -1.3905 } , (* C1' *) { x = 7.2871; y = 4.9328; z = -0.6114 } , (* H1' *) { x = 7.1852; y = 4.8935; z = -2.7592 } , (* C2' *) { x = 6.8573; y = 3.9363; z = -3.1645 } , (* H2'' *) { x = 8.5780; y = 5.1025; z = -2.6046 } , (* O2' *) { x = 8.9516; y = 4.7577; z = -1.7902 } , (* H2' *) { x = 6.5522; y = 6.0300; z = -3.5612 } , (* C3' *) { x = 5.5420; y = 5.7356; z = -3.8459 } , (* H3' *) { x = 7.3487; y = 6.4089; z = -4.6867 } , (* O3' *) { x = 4.7442; y = 0.4514; z = -0.1390 } , (* N1 *) { x = 6.3687; y = 2.1459; z = -0.5926 } , (* N3 *) { x = 5.9795; y = 0.9335; z = -0.2657 } , (* C2 *) { x = 5.3052; y = 2.9471; z = -0.8125 } , (* C4 *) { x = 3.9891; y = 2.5987; z = -0.7230 } , (* C5 *) { x = 3.7016; y = 1.2717; z = -0.3647 } , (* C6 *) G ( { x = 6.8745; y = -0.0224; z = -0.0058 } , (* N2 *) { x = 3.1770; y = 3.6859; z = -1.0198 } , (* N7 *) { x = 5.3247; y = 4.2695; z = -1.1710 } , (* N9 *) { x = 4.0156; y = 4.6415; z = -1.2759 } , (* C8 *) { x = 2.4553; y = 0.7925; z = -0.2390 } , (* O6 *) { x = 4.6497; y = -0.5095; z = 0.1212 } , (* H1 *) { x = 6.6836; y = -0.9771; z = 0.2627 } , (* H21 *) { x = 7.8474; y = 0.2424; z = -0.0653 } , (* H22 *) { x = 3.4426; y = 5.5361; z = -1.5199 } ) ) (* H8 *) let rG02 = N ( { a = 0.5566 ; b = 0.0449 ; c = 0.8296 ; (* dgf_base_tfo *) d = 0.5125 ; e = 0.7673 ; f = -0.3854 ; g = -0.6538 ; h = 0.6397 ; i = 0.4041 ; tx = -9.1161 ; ty = -3.7679 ; tz = -2.9968 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 4.5778; y = 6.6594; z = -4.0364 } , (* C5' *) { x = 4.9220; y = 7.1963; z = -4.9204 } , (* H5' *) { x = 3.7996; y = 5.9091; z = -4.1764 } , (* H5'' *) { x = 5.7873; y = 5.8869; z = -3.5482 } , (* C4' *) { x = 6.0405; y = 5.0875; z = -4.2446 } , (* H4' *) { x = 6.9135; y = 6.8036; z = -3.4310 } , (* O4' *) { x = 7.7293; y = 6.4084; z = -2.3392 } , (* C1' *) { x = 8.7078; y = 6.1815; z = -2.7624 } , (* H1' *) { x = 7.1305; y = 5.1418; z = -1.7347 } , (* C2' *) { x = 7.2040; y = 5.1982; z = -0.6486 } , (* H2'' *) { x = 7.7417; y = 4.0392; z = -2.3813 } , (* O2' *) { x = 8.6785; y = 4.1443; z = -2.5630 } , (* H2' *) { x = 5.6666; y = 5.2728; z = -2.1536 } , (* C3' *) { x = 5.1747; y = 5.9805; z = -1.4863 } , (* H3' *) { x = 4.9997; y = 4.0086; z = -2.1973 } , (* O3' *) { x = 10.3245; y = 8.5459; z = 1.5467 } , (* N1 *) { x = 9.8051; y = 6.9432; z = -0.1497 } , (* N3 *) { x = 10.5175; y = 7.4328; z = 0.8408 } , (* C2 *) { x = 8.7523; y = 7.7422; z = -0.4228 } , (* C4 *) { x = 8.4257; y = 8.9060; z = 0.2099 } , (* C5 *) { x = 9.2665; y = 9.3242; z = 1.2540 } , (* C6 *) G ( { x = 11.6077; y = 6.7966; z = 1.2752 } , (* N2 *) { x = 7.2750; y = 9.4537; z = -0.3428 } , (* N7 *) { x = 7.7962; y = 7.5519; z = -1.3859 } , (* N9 *) { x = 6.9479; y = 8.6157; z = -1.2771 } , (* C8 *) { x = 9.0664; y = 10.4462; z = 1.9610 } , (* O6 *) { x = 10.9838; y = 8.7524; z = 2.2697 } , (* H1 *) { x = 12.2274; y = 7.0896; z = 2.0170 } , (* H21 *) { x = 11.8502; y = 5.9398; z = 0.7984 } , (* H22 *) { x = 6.0430; y = 8.9853; z = -1.7594 } ) ) (* H8 *) let rG03 = N ( { a = -0.5021 ; b = 0.0731 ; c = 0.8617 ; (* dgf_base_tfo *) d = -0.8112 ; e = 0.3054 ; f = -0.4986 ; g = -0.2996 ; h = -0.9494 ; i = -0.0940 ; tx = 6.4273 ; ty = -5.1944 ; tz = -3.7807 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 4.1214; y = 6.7116; z = -1.9049 } , (* C5' *) { x = 3.3465; y = 5.9610; z = -2.0607 } , (* H5' *) { x = 4.0789; y = 7.2928; z = -0.9837 } , (* H5'' *) { x = 5.4170; y = 5.9293; z = -1.8186 } , (* C4' *) { x = 5.4506; y = 5.3400; z = -0.9023 } , (* H4' *) { x = 5.5067; y = 5.0417; z = -2.9703 } , (* O4' *) { x = 6.8650; y = 4.9152; z = -3.3612 } , (* C1' *) { x = 7.1090; y = 3.8577; z = -3.2603 } , (* H1' *) { x = 7.7152; y = 5.7282; z = -2.3894 } , (* C2' *) { x = 8.5029; y = 6.2356; z = -2.9463 } , (* H2'' *) { x = 8.1036; y = 4.8568; z = -1.3419 } , (* O2' *) { x = 8.3270; y = 3.9651; z = -1.6184 } , (* H2' *) { x = 6.7003; y = 6.7565; z = -1.8911 } , (* C3' *) { x = 6.5898; y = 7.5329; z = -2.6482 } , (* H3' *) { x = 7.0505; y = 7.2878; z = -0.6105 } , (* O3' *) { x = 9.6740; y = 4.7656; z = -7.6614 } , (* N1 *) { x = 9.0739; y = 4.3013; z = -5.3941 } , (* N3 *) { x = 9.8416; y = 4.2192; z = -6.4581 } , (* C2 *) { x = 7.9885; y = 5.0632; z = -5.6446 } , (* C4 *) { x = 7.6822; y = 5.6856; z = -6.8194 } , (* C5 *) { x = 8.5831; y = 5.5215; z = -7.8840 } , (* C6 *) G ( { x = 10.9733; y = 3.5117; z = -6.4286 } , (* N2 *) { x = 6.4857; y = 6.3816; z = -6.7035 } , (* N7 *) { x = 6.9740; y = 5.3703; z = -4.7760 } , (* N9 *) { x = 6.1133; y = 6.1613; z = -5.4808 } , (* C8 *) { x = 8.4084; y = 6.0747; z = -9.0933 } , (* O6 *) { x = 10.3759; y = 4.5855; z = -8.3504 } , (* H1 *) { x = 11.6254; y = 3.3761; z = -7.1879 } , (* H21 *) { x = 11.1917; y = 3.0460; z = -5.5593 } , (* H22 *) { x = 5.1705; y = 6.6830; z = -5.3167 } ) ) (* H8 *) let rG04 = N ( { a = -0.5426 ; b = -0.8175 ; c = 0.1929 ; (* dgf_base_tfo *) d = 0.8304 ; e = -0.5567 ; f = -0.0237 ; g = 0.1267 ; h = 0.1473 ; i = 0.9809 ; tx = -0.5075 ; ty = 8.3929 ; tz = 0.2229 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 5.4352; y = 8.2183; z = -2.7757 } , (* C5' *) { x = 5.3830; y = 8.7883; z = -1.8481 } , (* H5' *) { x = 5.7729; y = 8.7436; z = -3.6691 } , (* H5'' *) { x = 6.4830; y = 7.1518; z = -2.5252 } , (* C4' *) { x = 7.4749; y = 7.5972; z = -2.4482 } , (* H4' *) { x = 6.1626; y = 6.4620; z = -1.2827 } , (* O4' *) { x = 6.5431; y = 5.0992; z = -1.3905 } , (* C1' *) { x = 7.2871; y = 4.9328; z = -0.6114 } , (* H1' *) { x = 7.1852; y = 4.8935; z = -2.7592 } , (* C2' *) { x = 6.8573; y = 3.9363; z = -3.1645 } , (* H2'' *) { x = 8.5780; y = 5.1025; z = -2.6046 } , (* O2' *) { x = 8.9516; y = 4.7577; z = -1.7902 } , (* H2' *) { x = 6.5522; y = 6.0300; z = -3.5612 } , (* C3' *) { x = 5.5420; y = 5.7356; z = -3.8459 } , (* H3' *) { x = 7.3487; y = 6.4089; z = -4.6867 } , (* O3' *) { x = 3.6343; y = 2.6680; z = 2.0783 } , (* N1 *) { x = 5.4505; y = 3.9805; z = 1.2446 } , (* N3 *) { x = 4.7540; y = 3.3816; z = 2.1851 } , (* C2 *) { x = 4.8805; y = 3.7951; z = 0.0354 } , (* C4 *) { x = 3.7416; y = 3.0925; z = -0.2305 } , (* C5 *) { x = 3.0873; y = 2.4980; z = 0.8606 } , (* C6 *) G ( { x = 5.1433; y = 3.4373; z = 3.4609 } , (* N2 *) { x = 3.4605; y = 3.1184; z = -1.5906 } , (* N7 *) { x = 5.3247; y = 4.2695; z = -1.1710 } , (* N9 *) { x = 4.4244; y = 3.8244; z = -2.0953 } , (* C8 *) { x = 1.9600; y = 1.7805; z = 0.7462 } , (* O6 *) { x = 3.2489; y = 2.2879; z = 2.9191 } , (* H1 *) { x = 4.6785; y = 3.0243; z = 4.2568 } , (* H21 *) { x = 5.9823; y = 3.9654; z = 3.6539 } , (* H22 *) { x = 4.2675; y = 3.8876; z = -3.1721 } ) ) (* H8 *) let rG05 = N ( { a = -0.5891 ; b = 0.0449 ; c = 0.8068 ; (* dgf_base_tfo *) d = 0.5375 ; e = 0.7673 ; f = 0.3498 ; g = -0.6034 ; h = 0.6397 ; i = -0.4762 ; tx = -0.3019 ; ty = -3.7679 ; tz = -9.5913 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 4.5778; y = 6.6594; z = -4.0364 } , (* C5' *) { x = 4.9220; y = 7.1963; z = -4.9204 } , (* H5' *) { x = 3.7996; y = 5.9091; z = -4.1764 } , (* H5'' *) { x = 5.7873; y = 5.8869; z = -3.5482 } , (* C4' *) { x = 6.0405; y = 5.0875; z = -4.2446 } , (* H4' *) { x = 6.9135; y = 6.8036; z = -3.4310 } , (* O4' *) { x = 7.7293; y = 6.4084; z = -2.3392 } , (* C1' *) { x = 8.7078; y = 6.1815; z = -2.7624 } , (* H1' *) { x = 7.1305; y = 5.1418; z = -1.7347 } , (* C2' *) { x = 7.2040; y = 5.1982; z = -0.6486 } , (* H2'' *) { x = 7.7417; y = 4.0392; z = -2.3813 } , (* O2' *) { x = 8.6785; y = 4.1443; z = -2.5630 } , (* H2' *) { x = 5.6666; y = 5.2728; z = -2.1536 } , (* C3' *) { x = 5.1747; y = 5.9805; z = -1.4863 } , (* H3' *) { x = 4.9997; y = 4.0086; z = -2.1973 } , (* O3' *) { x = 10.2594; y = 10.6774; z = -1.0056 } , (* N1 *) { x = 9.7528; y = 8.7080; z = -2.2631 } , (* N3 *) { x = 10.4471; y = 9.7876; z = -1.9791 } , (* C2 *) { x = 8.7271; y = 8.5575; z = -1.3991 } , (* C4 *) { x = 8.4100; y = 9.3803; z = -0.3580 } , (* C5 *) { x = 9.2294; y = 10.5030; z = -0.1574 } , (* C6 *) G ( { x = 11.5110; y = 10.1256; z = -2.7114 } , (* N2 *) { x = 7.2891; y = 8.9068; z = 0.3121 } , (* N7 *) { x = 7.7962; y = 7.5519; z = -1.3859 } , (* N9 *) { x = 6.9702; y = 7.8292; z = -0.3353 } , (* C8 *) { x = 9.0349; y = 11.3951; z = 0.8250 } , (* O6 *) { x = 10.9013; y = 11.4422; z = -0.9512 } , (* H1 *) { x = 12.1031; y = 10.9341; z = -2.5861 } , (* H21 *) { x = 11.7369; y = 9.5180; z = -3.4859 } , (* H22 *) { x = 6.0888; y = 7.3990; z = 0.1403 } ) ) (* H8 *) let rG06 = N ( { a = -0.9815 ; b = 0.0731 ; c = -0.1772 ; (* dgf_base_tfo *) d = 0.1912 ; e = 0.3054 ; f = -0.9328 ; g = -0.0141 ; h = -0.9494 ; i = -0.3137 ; tx = 5.7506 ; ty = -5.1944 ; tz = 4.7470 } , { a = -0.8143 ; b = -0.5091 ; c = -0.2788 ; (* P_O3'_275_tfo *) d = -0.0433 ; e = -0.4257 ; f = 0.9038 ; g = -0.5788 ; h = 0.7480 ; i = 0.3246 ; tx = 1.5227 ; ty = 6.9114 ; tz = -7.0765 } , { a = 0.3822 ; b = -0.7477 ; c = 0.5430 ; (* P_O3'_180_tfo *) d = 0.4552 ; e = 0.6637 ; f = 0.5935 ; g = -0.8042 ; h = 0.0203 ; i = 0.5941 ; tx = -6.9472 ; ty = -4.1186 ; tz = -5.9108 } , { a = 0.5640 ; b = 0.8007 ; c = -0.2022 ; (* P_O3'_60_tfo *) d = -0.8247 ; e = 0.5587 ; f = -0.0878 ; g = 0.0426 ; h = 0.2162 ; i = 0.9754 ; tx = 6.2694 ; ty = -7.0540 ; tz = 3.3316 } , { x = 2.8930; y = 8.5380; z = -3.3280 } , (* P *) { x = 1.6980; y = 7.6960; z = -3.5570 } , (* O1P *) { x = 3.2260; y = 9.5010; z = -4.4020 } , (* O2P *) { x = 4.1590; y = 7.6040; z = -3.0340 } , (* O5' *) { x = 4.1214; y = 6.7116; z = -1.9049 } , (* C5' *) { x = 3.3465; y = 5.9610; z = -2.0607 } , (* H5' *) { x = 4.0789; y = 7.2928; z = -0.9837 } , (* H5'' *) { x = 5.4170; y = 5.9293; z = -1.8186 } , (* C4' *) { x = 5.4506; y = 5.3400; z = -0.9023 } , (* H4' *) { x = 5.5067; y = 5.0417; z = -2.9703 } , (* O4' *) { x = 6.8650; y = 4.9152; z = -3.3612 } , (* C1' *) { x = 7.1090; y = 3.8577; z = -3.2603 } , (* H1' *) { x = 7.7152; y = 5.7282; z = -2.3894 } , (* C2' *) { x = 8.5029; y = 6.2356; z = -2.9463 } , (* H2'' *) { x = 8.1036; y = 4.8568; z = -1.3419 } , (* O2' *) { x = 8.3270; y = 3.9651; z = -1.6184 } , (* H2' *) { x = 6.7003; y = 6.7565; z = -1.8911 } , (* C3' *) { x = 6.5898; y = 7.5329; z = -2.6482 } , (* H3' *) { x = 7.0505; y = 7.2878; z = -0.6105 } , (* O3' *) { x = 6.6624; y = 3.5061; z = -8.2986 } , (* N1 *) { x = 6.5810; y = 3.2570; z = -5.9221 } , (* N3 *) { x = 6.5151; y = 2.8263; z = -7.1625 } , (* C2 *) { x = 6.8364; y = 4.5817; z = -5.8882 } , (* C4 *) { x = 7.0116; y = 5.4064; z = -6.9609 } , (* C5 *) { x = 6.9173; y = 4.8260; z = -8.2361 } , (* C6 *) G ( { x = 6.2717; y = 1.5402; z = -7.4250 } , (* N2 *) { x = 7.2573; y = 6.7070; z = -6.5394 } , (* N7 *) { x = 6.9740; y = 5.3703; z = -4.7760 } , (* N9 *) { x = 7.2238; y = 6.6275; z = -5.2453 } , (* C8 *) { x = 7.0668; y = 5.5163; z = -9.3763 } , (* O6 *) { x = 6.5754; y = 2.9964; z = -9.1545 } , (* H1 *) { x = 6.1908; y = 1.1105; z = -8.3354 } , (* H21 *) { x = 6.1346; y = 0.9352; z = -6.6280 } , (* H22 *) { x = 7.4108; y = 7.6227; z = -4.8418 } ) ) (* H8 *) let rG07 = N ( { a = 0.0894 ; b = -0.6059 ; c = 0.7905 ; (* dgf_base_tfo *) d = -0.6810 ; e = 0.5420 ; f = 0.4924 ; g = -0.7268 ; h = -0.5824 ; i = -0.3642 ; tx = 34.1424 ; ty = 45.9610 ; tz = -11.8600 } , { a = -0.8644 ; b = -0.4956 ; c = -0.0851 ; (* P_O3'_275_tfo *) d = -0.0427 ; e = 0.2409 ; f = -0.9696 ; g = 0.5010 ; h = -0.8345 ; i = -0.2294 ; tx = 4.0167 ; ty = 54.5377 ; tz = 12.4779 } , { a = 0.3706 ; b = -0.6167 ; c = 0.6945 ; (* P_O3'_180_tfo *) d = -0.2867 ; e = -0.7872 ; f = -0.5460 ; g = 0.8834 ; h = 0.0032 ; i = -0.4686 ; tx = -52.9020 ; ty = 18.6313 ; tz = -0.6709 } , { a = 0.4155 ; b = 0.9025 ; c = -0.1137 ; (* P_O3'_60_tfo *) d = 0.9040 ; e = -0.4236 ; f = -0.0582 ; g = -0.1007 ; h = -0.0786 ; i = -0.9918 ; tx = -7.6624 ; ty = -25.2080 ; tz = 49.5181 } , { x = 31.3810; y = 0.1400; z = 47.5810 } , (* P *) { x = 29.9860; y = 0.6630; z = 47.6290 } , (* O1P *) { x = 31.7210; y = -0.6460; z = 48.8090 } , (* O2P *) { x = 32.4940; y = 1.2540; z = 47.2740 } , (* O5' *) { x = 33.8709; y = 0.7918; z = 47.2113 } , (* C5' *) { x = 34.1386; y = 0.5870; z = 46.1747 } , (* H5' *) { x = 34.0186; y = -0.0095; z = 47.9353 } , (* H5'' *) { x = 34.7297; y = 1.9687; z = 47.6685 } , (* C4' *) { x = 35.7723; y = 1.6845; z = 47.8113 } , (* H4' *) { x = 34.6455; y = 2.9768; z = 46.6660 } , (* O4' *) { x = 34.1690; y = 4.1829; z = 47.2627 } , (* C1' *) { x = 35.0437; y = 4.7633; z = 47.5560 } , (* H1' *) { x = 33.4145; y = 3.7532; z = 48.4954 } , (* C2' *) { x = 32.4340; y = 3.3797; z = 48.2001 } , (* H2'' *) { x = 33.3209; y = 4.6953; z = 49.5217 } , (* O2' *) { x = 33.2374; y = 5.6059; z = 49.2295 } , (* H2' *) { x = 34.2724; y = 2.5970; z = 48.9773 } , (* C3' *) { x = 33.6373; y = 1.8935; z = 49.5157 } , (* H3' *) { x = 35.3453; y = 3.1884; z = 49.7285 } , (* O3' *) { x = 34.0511; y = 7.8930; z = 43.7791 } , (* N1 *) { x = 34.9937; y = 6.3369; z = 45.3199 } , (* N3 *) { x = 35.0882; y = 7.3126; z = 44.4200 } , (* C2 *) { x = 33.7190; y = 5.9650; z = 45.5374 } , (* C4 *) { x = 32.5845; y = 6.4770; z = 44.9458 } , (* C5 *) { x = 32.7430; y = 7.5179; z = 43.9914 } , (* C6 *) G ( { x = 36.3030; y = 7.7827; z = 44.1036 } , (* N2 *) { x = 31.4499; y = 5.8335; z = 45.4368 } , (* N7 *) { x = 33.2760; y = 4.9817; z = 46.4043 } , (* N9 *) { x = 31.9235; y = 4.9639; z = 46.2934 } , (* C8 *) { x = 31.8602; y = 8.1000; z = 43.3695 } , (* O6 *) { x = 34.2623; y = 8.6223; z = 43.1283 } , (* H1 *) { x = 36.5188; y = 8.5081; z = 43.4347 } , (* H21 *) { x = 37.0888; y = 7.3524; z = 44.5699 } , (* H22 *) { x = 31.0815; y = 4.4201; z = 46.7218 } ) ) (* H8 *) let rG08 = N ( { a = 0.2224 ; b = 0.6335 ; c = 0.7411 ; (* dgf_base_tfo *) d = -0.3644 ; e = -0.6510 ; f = 0.6659 ; g = 0.9043 ; h = -0.4181 ; i = 0.0861 ; tx = -47.6824 ; ty = -0.5823 ; tz = -31.7554 } , { a = -0.8644 ; b = -0.4956 ; c = -0.0851 ; (* P_O3'_275_tfo *) d = -0.0427 ; e = 0.2409 ; f = -0.9696 ; g = 0.5010 ; h = -0.8345 ; i = -0.2294 ; tx = 4.0167 ; ty = 54.5377 ; tz = 12.4779 } , { a = 0.3706 ; b = -0.6167 ; c = 0.6945 ; (* P_O3'_180_tfo *) d = -0.2867 ; e = -0.7872 ; f = -0.5460 ; g = 0.8834 ; h = 0.0032 ; i = -0.4686 ; tx = -52.9020 ; ty = 18.6313 ; tz = -0.6709 } , { a = 0.4155 ; b = 0.9025 ; c = -0.1137 ; (* P_O3'_60_tfo *) d = 0.9040 ; e = -0.4236 ; f = -0.0582 ; g = -0.1007 ; h = -0.0786 ; i = -0.9918 ; tx = -7.6624 ; ty = -25.2080 ; tz = 49.5181 } , { x = 31.3810; y = 0.1400; z = 47.5810 } , (* P *) { x = 29.9860; y = 0.6630; z = 47.6290 } , (* O1P *) { x = 31.7210; y = -0.6460; z = 48.8090 } , (* O2P *) { x = 32.4940; y = 1.2540; z = 47.2740 } , (* O5' *) { x = 32.5924; y = 2.3488; z = 48.2255 } , (* C5' *) { x = 33.3674; y = 2.1246; z = 48.9584 } , (* H5' *) { x = 31.5994; y = 2.5917; z = 48.6037 } , (* H5'' *) { x = 33.0722; y = 3.5577; z = 47.4258 } , (* C4' *) { x = 33.0310; y = 4.4778; z = 48.0089 } , (* H4' *) { x = 34.4173; y = 3.3055; z = 47.0316 } , (* O4' *) { x = 34.5056; y = 3.3910; z = 45.6094 } , (* C1' *) { x = 34.7881; y = 4.4152; z = 45.3663 } , (* H1' *) { x = 33.1122; y = 3.1198; z = 45.1010 } , (* C2' *) { x = 32.9230; y = 2.0469; z = 45.1369 } , (* H2'' *) { x = 32.7946; y = 3.6590; z = 43.8529 } , (* O2' *) { x = 33.5170; y = 3.6707; z = 43.2207 } , (* H2' *) { x = 32.2730; y = 3.8173; z = 46.1566 } , (* C3' *) { x = 31.3094; y = 3.3123; z = 46.2244 } , (* H3' *) { x = 32.2391; y = 5.2039; z = 45.7807 } , (* O3' *) { x = 39.3337; y = 2.7157; z = 44.1441 } , (* N1 *) { x = 37.4430; y = 3.8242; z = 45.0824 } , (* N3 *) { x = 38.7276; y = 3.7646; z = 44.7403 } , (* C2 *) { x = 36.7791; y = 2.6963; z = 44.7704 } , (* C4 *) { x = 37.2860; y = 1.5653; z = 44.1678 } , (* C5 *) { x = 38.6647; y = 1.5552; z = 43.8235 } , (* C6 *) G ( { x = 39.5123; y = 4.8216; z = 44.9936 } , (* N2 *) { x = 36.2829; y = 0.6110; z = 44.0078 } , (* N7 *) { x = 35.4394; y = 2.4314; z = 44.9931 } , (* N9 *) { x = 35.2180; y = 1.1815; z = 44.5128 } , (* C8 *) { x = 39.2907; y = 0.6514; z = 43.2796 } , (* O6 *) { x = 40.3076; y = 2.8048; z = 43.9352 } , (* H1 *) { x = 40.4994; y = 4.9066; z = 44.7977 } , (* H21 *) { x = 39.0738; y = 5.6108; z = 45.4464 } , (* H22 *) { x = 34.3856; y = 0.4842; z = 44.4185 } ) ) (* H8 *) let rG09 = N ( { a = -0.9699 ; b = -0.1688 ; c = -0.1753 ; (* dgf_base_tfo *) d = -0.1050 ; e = -0.3598 ; f = 0.9271 ; g = -0.2196 ; h = 0.9176 ; i = 0.3312 ; tx = 45.6217 ; ty = -38.9484 ; tz = -12.3208 } , { a = -0.8644 ; b = -0.4956 ; c = -0.0851 ; (* P_O3'_275_tfo *) d = -0.0427 ; e = 0.2409 ; f = -0.9696 ; g = 0.5010 ; h = -0.8345 ; i = -0.2294 ; tx = 4.0167 ; ty = 54.5377 ; tz = 12.4779 } , { a = 0.3706 ; b = -0.6167 ; c = 0.6945 ; (* P_O3'_180_tfo *) d = -0.2867 ; e = -0.7872 ; f = -0.5460 ; g = 0.8834 ; h = 0.0032 ; i = -0.4686 ; tx = -52.9020 ; ty = 18.6313 ; tz = -0.6709 } , { a = 0.4155 ; b = 0.9025 ; c = -0.1137 ; (* P_O3'_60_tfo *) d = 0.9040 ; e = -0.4236 ; f = -0.0582 ; g = -0.1007 ; h = -0.0786 ; i = -0.9918 ; tx = -7.6624 ; ty = -25.2080 ; tz = 49.5181 } , { x = 31.3810; y = 0.1400; z = 47.5810 } , (* P *) { x = 29.9860; y = 0.6630; z = 47.6290 } , (* O1P *) { x = 31.7210; y = -0.6460; z = 48.8090 } , (* O2P *) { x = 32.4940; y = 1.2540; z = 47.2740 } , (* O5' *) { x = 33.8709; y = 0.7918; z = 47.2113 } , (* C5' *) { x = 34.1386; y = 0.5870; z = 46.1747 } , (* H5' *) { x = 34.0186; y = -0.0095; z = 47.9353 } , (* H5'' *) { x = 34.7297; y = 1.9687; z = 47.6685 } , (* C4' *) { x = 34.5880; y = 2.8482; z = 47.0404 } , (* H4' *) { x = 34.3575; y = 2.2770; z = 49.0081 } , (* O4' *) { x = 35.5157; y = 2.1993; z = 49.8389 } , (* C1' *) { x = 35.9424; y = 3.2010; z = 49.8893 } , (* H1' *) { x = 36.4701; y = 1.2820; z = 49.1169 } , (* C2' *) { x = 36.1545; y = 0.2498; z = 49.2683 } , (* H2'' *) { x = 37.8262; y = 1.4547; z = 49.4008 } , (* O2' *) { x = 38.0227; y = 1.6945; z = 50.3094 } , (* H2' *) { x = 36.2242; y = 1.6797; z = 47.6725 } , (* C3' *) { x = 36.4297; y = 0.8197; z = 47.0351 } , (* H3' *) { x = 37.0289; y = 2.8480; z = 47.4426 } , (* O3' *) { x = 34.3005; y = 3.5042; z = 54.6070 } , (* N1 *) { x = 34.7693; y = 3.7936; z = 52.2874 } , (* N3 *) { x = 34.4484; y = 4.2541; z = 53.4939 } , (* C2 *) { x = 34.9354; y = 2.4584; z = 52.2785 } , (* C4 *) { x = 34.8092; y = 1.5915; z = 53.3422 } , (* C5 *) { x = 34.4646; y = 2.1367; z = 54.6085 } , (* C6 *) G ( { x = 34.2514; y = 5.5708; z = 53.6503 } , (* N2 *) { x = 35.0641; y = 0.2835; z = 52.9337 } , (* N7 *) { x = 35.2669; y = 1.6690; z = 51.1915 } , (* N9 *) { x = 35.3288; y = 0.3954; z = 51.6563 } , (* C8 *) { x = 34.3151; y = 1.5317; z = 55.6650 } , (* O6 *) { x = 34.0623; y = 3.9797; z = 55.4539 } , (* H1 *) { x = 33.9950; y = 6.0502; z = 54.5016 } , (* H21 *) { x = 34.3512; y = 6.1432; z = 52.8242 } , (* H22 *) { x = 35.5414; y = -0.6006; z = 51.2679 } ) ) (* H8 *) let rG10 = N ( { a = -0.0980 ; b = -0.9723 ; c = 0.2122 ; (* dgf_base_tfo *) d = -0.9731 ; e = 0.1383 ; f = 0.1841 ; g = -0.2083 ; h = -0.1885 ; i = -0.9597 ; tx = 17.8469 ; ty = 38.8265 ; tz = 37.0475 } , { a = -0.8644 ; b = -0.4956 ; c = -0.0851 ; (* P_O3'_275_tfo *) d = -0.0427 ; e = 0.2409 ; f = -0.9696 ; g = 0.5010 ; h = -0.8345 ; i = -0.2294 ; tx = 4.0167 ; ty = 54.5377 ; tz = 12.4779 } , { a = 0.3706 ; b = -0.6167 ; c = 0.6945 ; (* P_O3'_180_tfo *) d = -0.2867 ; e = -0.7872 ; f = -0.5460 ; g = 0.8834 ; h = 0.0032 ; i = -0.4686 ; tx = -52.9020 ; ty = 18.6313 ; tz = -0.6709 } , { a = 0.4155 ; b = 0.9025 ; c = -0.1137 ; (* P_O3'_60_tfo *) d = 0.9040 ; e = -0.4236 ; f = -0.0582 ; g = -0.1007 ; h = -0.0786 ; i = -0.9918 ; tx = -7.6624 ; ty = -25.2080 ; tz = 49.5181 } , { x = 31.3810; y = 0.1400; z = 47.5810 } , (* P *) { x = 29.9860; y = 0.6630; z = 47.6290 } , (* O1P *) { x = 31.7210; y = -0.6460; z = 48.8090 } , (* O2P *) { x = 32.4940; y = 1.2540; z = 47.2740 } , (* O5' *) { x = 32.5924; y = 2.3488; z = 48.2255 } , (* C5' *) { x = 33.3674; y = 2.1246; z = 48.9584 } , (* H5' *) { x = 31.5994; y = 2.5917; z = 48.6037 } , (* H5'' *) { x = 33.0722; y = 3.5577; z = 47.4258 } , (* C4' *) { x = 34.0333; y = 3.3761; z = 46.9447 } , (* H4' *) { x = 32.0890; y = 3.8338; z = 46.4332 } , (* O4' *) { x = 31.6377; y = 5.1787; z = 46.5914 } , (* C1' *) { x = 32.2499; y = 5.8016; z = 45.9392 } , (* H1' *) { x = 31.9167; y = 5.5319; z = 48.0305 } , (* C2' *) { x = 31.1507; y = 5.0820; z = 48.6621 } , (* H2'' *) { x = 32.0865; y = 6.8890; z = 48.3114 } , (* O2' *) { x = 31.5363; y = 7.4819; z = 47.7942 } , (* H2' *) { x = 33.2398; y = 4.8224; z = 48.2563 } , (* C3' *) { x = 33.3166; y = 4.5570; z = 49.3108 } , (* H3' *) { x = 34.2528; y = 5.7056; z = 47.7476 } , (* O3' *) { x = 28.2782; y = 6.3049; z = 42.9364 } , (* N1 *) { x = 30.4001; y = 5.8547; z = 43.9258 } , (* N3 *) { x = 29.6195; y = 6.1568; z = 42.8913 } , (* C2 *) { x = 29.7005; y = 5.7006; z = 45.0649 } , (* C4 *) { x = 28.3383; y = 5.8221; z = 45.2343 } , (* C5 *) { x = 27.5519; y = 6.1461; z = 44.0958 } , (* C6 *) G ( { x = 30.1838; y = 6.3385; z = 41.6890 } , (* N2 *) { x = 27.9936; y = 5.5926; z = 46.5651 } , (* N7 *) { x = 30.2046; y = 5.3825; z = 46.3136 } , (* N9 *) { x = 29.1371; y = 5.3398; z = 47.1506 } , (* C8 *) { x = 26.3361; y = 6.3024; z = 44.0495 } , (* O6 *) { x = 27.8122; y = 6.5394; z = 42.0833 } , (* H1 *) { x = 29.7125; y = 6.5595; z = 40.8235 } , (* H21 *) { x = 31.1859; y = 6.2231; z = 41.6389 } , (* H22 *) { x = 28.9406; y = 5.1504; z = 48.2059 } ) ) (* H8 *) let rGs = [ rG01; rG02; rG03; rG04; rG05; rG06; rG07; rG08; rG09; rG10 ] let rU = N ( { a = -0.0359 ; b = -0.8071 ; c = 0.5894 ; (* dgf_base_tfo *) d = -0.2669 ; e = 0.5761 ; f = 0.7726 ; g = -0.9631 ; h = -0.1296 ; i = -0.2361 ; tx = 0.1584 ; ty = 8.3434 ; tz = 0.5434 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 5.2430; y = -8.2420; z = 2.8260 } , (* C5' *) { x = 5.1974; y = -8.8497; z = 1.9223 } , (* H5' *) { x = 5.5548; y = -8.7348; z = 3.7469 } , (* H5'' *) { x = 6.3140; y = -7.2060; z = 2.5510 } , (* C4' *) { x = 7.2954; y = -7.6762; z = 2.4898 } , (* H4' *) { x = 6.0140; y = -6.5420; z = 1.2890 } , (* O4' *) { x = 6.4190; y = -5.1840; z = 1.3620 } , (* C1' *) { x = 7.1608; y = -5.0495; z = 0.5747 } , (* H1' *) { x = 7.0760; y = -4.9560; z = 2.7270 } , (* C2' *) { x = 6.7770; y = -3.9803; z = 3.1099 } , (* H2'' *) { x = 8.4500; y = -5.1930; z = 2.5810 } , (* O2' *) { x = 8.8309; y = -4.8755; z = 1.7590 } , (* H2' *) { x = 6.4060; y = -6.0590; z = 3.5580 } , (* C3' *) { x = 5.4021; y = -5.7313; z = 3.8281 } , (* H3' *) { x = 7.1570; y = -6.4240; z = 4.7070 } , (* O3' *) { x = 5.2170; y = -4.3260; z = 1.1690 } , (* N1 *) { x = 4.2960; y = -2.2560; z = 0.6290 } , (* N3 *) { x = 5.4330; y = -3.0200; z = 0.7990 } , (* C2 *) { x = 2.9930; y = -2.6780; z = 0.7940 } , (* C4 *) { x = 2.8670; y = -4.0630; z = 1.1830 } , (* C5 *) { x = 3.9570; y = -4.8300; z = 1.3550 } , (* C6 *) U ( { x = 6.5470; y = -2.5560; z = 0.6290 } , (* O2 *) { x = 2.0540; y = -1.9000; z = 0.6130 } , (* O4 *) { x = 4.4300; y = -1.3020; z = 0.3600 } , (* H3 *) { x = 1.9590; y = -4.4570; z = 1.3250 } , (* H5 *) { x = 3.8460; y = -5.7860; z = 1.6240 } ) ) (* H6 *) let rU01 = N ( { a = -0.0137 ; b = -0.8012 ; c = 0.5983 ; (* dgf_base_tfo *) d = -0.2523 ; e = 0.5817 ; f = 0.7733 ; g = -0.9675 ; h = -0.1404 ; i = -0.2101 ; tx = 0.2031 ; ty = 8.3874 ; tz = 0.4228 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 5.2416; y = -8.2422; z = 2.8181 } , (* C5' *) { x = 5.2050; y = -8.8128; z = 1.8901 } , (* H5' *) { x = 5.5368; y = -8.7738; z = 3.7227 } , (* H5'' *) { x = 6.3232; y = -7.2037; z = 2.6002 } , (* C4' *) { x = 7.3048; y = -7.6757; z = 2.5577 } , (* H4' *) { x = 6.0635; y = -6.5092; z = 1.3456 } , (* O4' *) { x = 6.4697; y = -5.1547; z = 1.4629 } , (* C1' *) { x = 7.2354; y = -5.0043; z = 0.7018 } , (* H1' *) { x = 7.0856; y = -4.9610; z = 2.8521 } , (* C2' *) { x = 6.7777; y = -3.9935; z = 3.2487 } , (* H2'' *) { x = 8.4627; y = -5.1992; z = 2.7423 } , (* O2' *) { x = 8.8693; y = -4.8638; z = 1.9399 } , (* H2' *) { x = 6.3877; y = -6.0809; z = 3.6362 } , (* C3' *) { x = 5.3770; y = -5.7562; z = 3.8834 } , (* H3' *) { x = 7.1024; y = -6.4754; z = 4.7985 } , (* O3' *) { x = 5.2764; y = -4.2883; z = 1.2538 } , (* N1 *) { x = 4.3777; y = -2.2062; z = 0.7229 } , (* N3 *) { x = 5.5069; y = -2.9779; z = 0.9088 } , (* C2 *) { x = 3.0693; y = -2.6246; z = 0.8500 } , (* C4 *) { x = 2.9279; y = -4.0146; z = 1.2149 } , (* C5 *) { x = 4.0101; y = -4.7892; z = 1.4017 } , (* C6 *) U ( { x = 6.6267; y = -2.5166; z = 0.7728 } , (* O2 *) { x = 2.1383; y = -1.8396; z = 0.6581 } , (* O4 *) { x = 4.5223; y = -1.2489; z = 0.4716 } , (* H3 *) { x = 2.0151; y = -4.4065; z = 1.3290 } , (* H5 *) { x = 3.8886; y = -5.7486; z = 1.6535 } ) ) (* H6 *) let rU02 = N ( { a = 0.5141 ; b = 0.0246 ; c = 0.8574 ; (* dgf_base_tfo *) d = -0.5547 ; e = -0.7529 ; f = 0.3542 ; g = 0.6542 ; h = -0.6577 ; i = -0.3734 ; tx = -9.1111 ; ty = -3.4598 ; tz = -3.2939 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 4.3825; y = -6.6585; z = 4.0489 } , (* C5' *) { x = 4.6841; y = -7.2019; z = 4.9443 } , (* H5' *) { x = 3.6189; y = -5.8889; z = 4.1625 } , (* H5'' *) { x = 5.6255; y = -5.9175; z = 3.5998 } , (* C4' *) { x = 5.8732; y = -5.1228; z = 4.3034 } , (* H4' *) { x = 6.7337; y = -6.8605; z = 3.5222 } , (* O4' *) { x = 7.5932; y = -6.4923; z = 2.4548 } , (* C1' *) { x = 8.5661; y = -6.2983; z = 2.9064 } , (* H1' *) { x = 7.0527; y = -5.2012; z = 1.8322 } , (* C2' *) { x = 7.1627; y = -5.2525; z = 0.7490 } , (* H2'' *) { x = 7.6666; y = -4.1249; z = 2.4880 } , (* O2' *) { x = 8.5944; y = -4.2543; z = 2.6981 } , (* H2' *) { x = 5.5661; y = -5.3029; z = 2.2009 } , (* C3' *) { x = 5.0841; y = -6.0018; z = 1.5172 } , (* H3' *) { x = 4.9062; y = -4.0452; z = 2.2042 } , (* O3' *) { x = 7.6298; y = -7.6136; z = 1.4752 } , (* N1 *) { x = 8.6945; y = -8.7046; z = -0.2857 } , (* N3 *) { x = 8.6943; y = -7.6514; z = 0.6066 } , (* C2 *) { x = 7.7426; y = -9.6987; z = -0.3801 } , (* C4 *) { x = 6.6642; y = -9.5742; z = 0.5722 } , (* C5 *) { x = 6.6391; y = -8.5592; z = 1.4526 } , (* C6 *) U ( { x = 9.5840; y = -6.8186; z = 0.6136 } , (* O2 *) { x = 7.8505; y = -10.5925; z = -1.2223 } , (* O4 *) { x = 9.4601; y = -8.7514; z = -0.9277 } , (* H3 *) { x = 5.9281; y = -10.2509; z = 0.5782 } , (* H5 *) { x = 5.8831; y = -8.4931; z = 2.1028 } ) ) (* H6 *) let rU03 = N ( { a = -0.4993 ; b = 0.0476 ; c = 0.8651 ; (* dgf_base_tfo *) d = 0.8078 ; e = -0.3353 ; f = 0.4847 ; g = 0.3132 ; h = 0.9409 ; i = 0.1290 ; tx = 6.2989 ; ty = -5.2303 ; tz = -3.8577 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 3.9938; y = -6.7042; z = 1.9023 } , (* C5' *) { x = 3.2332; y = -5.9343; z = 2.0319 } , (* H5' *) { x = 3.9666; y = -7.2863; z = 0.9812 } , (* H5'' *) { x = 5.3098; y = -5.9546; z = 1.8564 } , (* C4' *) { x = 5.3863; y = -5.3702; z = 0.9395 } , (* H4' *) { x = 5.3851; y = -5.0642; z = 3.0076 } , (* O4' *) { x = 6.7315; y = -4.9724; z = 3.4462 } , (* C1' *) { x = 7.0033; y = -3.9202; z = 3.3619 } , (* H1' *) { x = 7.5997; y = -5.8018; z = 2.4948 } , (* C2' *) { x = 8.3627; y = -6.3254; z = 3.0707 } , (* H2'' *) { x = 8.0410; y = -4.9501; z = 1.4724 } , (* O2' *) { x = 8.2781; y = -4.0644; z = 1.7570 } , (* H2' *) { x = 6.5701; y = -6.8129; z = 1.9714 } , (* C3' *) { x = 6.4186; y = -7.5809; z = 2.7299 } , (* H3' *) { x = 6.9357; y = -7.3841; z = 0.7235 } , (* O3' *) { x = 6.8024; y = -5.4718; z = 4.8475 } , (* N1 *) { x = 7.9218; y = -5.5700; z = 6.8877 } , (* N3 *) { x = 7.8908; y = -5.0886; z = 5.5944 } , (* C2 *) { x = 6.9789; y = -6.3827; z = 7.4823 } , (* C4 *) { x = 5.8742; y = -6.7319; z = 6.6202 } , (* C5 *) { x = 5.8182; y = -6.2769; z = 5.3570 } , (* C6 *) U ( { x = 8.7747; y = -4.3728; z = 5.1568 } , (* O2 *) { x = 7.1154; y = -6.7509; z = 8.6509 } , (* O4 *) { x = 8.7055; y = -5.3037; z = 7.4491 } , (* H3 *) { x = 5.1416; y = -7.3178; z = 6.9665 } , (* H5 *) { x = 5.0441; y = -6.5310; z = 4.7784 } ) ) (* H6 *) let rU04 = N ( { a = -0.5669 ; b = -0.8012 ; c = 0.1918 ; (* dgf_base_tfo *) d = -0.8129 ; e = 0.5817 ; f = 0.0273 ; g = -0.1334 ; h = -0.1404 ; i = -0.9811 ; tx = -0.3279 ; ty = 8.3874 ; tz = 0.3355 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 5.2416; y = -8.2422; z = 2.8181 } , (* C5' *) { x = 5.2050; y = -8.8128; z = 1.8901 } , (* H5' *) { x = 5.5368; y = -8.7738; z = 3.7227 } , (* H5'' *) { x = 6.3232; y = -7.2037; z = 2.6002 } , (* C4' *) { x = 7.3048; y = -7.6757; z = 2.5577 } , (* H4' *) { x = 6.0635; y = -6.5092; z = 1.3456 } , (* O4' *) { x = 6.4697; y = -5.1547; z = 1.4629 } , (* C1' *) { x = 7.2354; y = -5.0043; z = 0.7018 } , (* H1' *) { x = 7.0856; y = -4.9610; z = 2.8521 } , (* C2' *) { x = 6.7777; y = -3.9935; z = 3.2487 } , (* H2'' *) { x = 8.4627; y = -5.1992; z = 2.7423 } , (* O2' *) { x = 8.8693; y = -4.8638; z = 1.9399 } , (* H2' *) { x = 6.3877; y = -6.0809; z = 3.6362 } , (* C3' *) { x = 5.3770; y = -5.7562; z = 3.8834 } , (* H3' *) { x = 7.1024; y = -6.4754; z = 4.7985 } , (* O3' *) { x = 5.2764; y = -4.2883; z = 1.2538 } , (* N1 *) { x = 3.8961; y = -3.0896; z = -0.1893 } , (* N3 *) { x = 5.0095; y = -3.8907; z = -0.0346 } , (* C2 *) { x = 3.0480; y = -2.6632; z = 0.8116 } , (* C4 *) { x = 3.4093; y = -3.1310; z = 2.1292 } , (* C5 *) { x = 4.4878; y = -3.9124; z = 2.3088 } , (* C6 *) U ( { x = 5.7005; y = -4.2164; z = -0.9842 } , (* O2 *) { x = 2.0800; y = -1.9458; z = 0.5503 } , (* O4 *) { x = 3.6834; y = -2.7882; z = -1.1190 } , (* H3 *) { x = 2.8508; y = -2.8721; z = 2.9172 } , (* H5 *) { x = 4.7188; y = -4.2247; z = 3.2295 } ) ) (* H6 *) let rU05 = N ( { a = -0.6298 ; b = 0.0246 ; c = 0.7763 ; (* dgf_base_tfo *) d = -0.5226 ; e = -0.7529 ; f = -0.4001 ; g = 0.5746 ; h = -0.6577 ; i = 0.4870 ; tx = -0.0208 ; ty = -3.4598 ; tz = -9.6882 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 4.3825; y = -6.6585; z = 4.0489 } , (* C5' *) { x = 4.6841; y = -7.2019; z = 4.9443 } , (* H5' *) { x = 3.6189; y = -5.8889; z = 4.1625 } , (* H5'' *) { x = 5.6255; y = -5.9175; z = 3.5998 } , (* C4' *) { x = 5.8732; y = -5.1228; z = 4.3034 } , (* H4' *) { x = 6.7337; y = -6.8605; z = 3.5222 } , (* O4' *) { x = 7.5932; y = -6.4923; z = 2.4548 } , (* C1' *) { x = 8.5661; y = -6.2983; z = 2.9064 } , (* H1' *) { x = 7.0527; y = -5.2012; z = 1.8322 } , (* C2' *) { x = 7.1627; y = -5.2525; z = 0.7490 } , (* H2'' *) { x = 7.6666; y = -4.1249; z = 2.4880 } , (* O2' *) { x = 8.5944; y = -4.2543; z = 2.6981 } , (* H2' *) { x = 5.5661; y = -5.3029; z = 2.2009 } , (* C3' *) { x = 5.0841; y = -6.0018; z = 1.5172 } , (* H3' *) { x = 4.9062; y = -4.0452; z = 2.2042 } , (* O3' *) { x = 7.6298; y = -7.6136; z = 1.4752 } , (* N1 *) { x = 8.5977; y = -9.5977; z = 0.7329 } , (* N3 *) { x = 8.5951; y = -8.5745; z = 1.6594 } , (* C2 *) { x = 7.7372; y = -9.7371; z = -0.3364 } , (* C4 *) { x = 6.7596; y = -8.6801; z = -0.4476 } , (* C5 *) { x = 6.7338; y = -7.6721; z = 0.4408 } , (* C6 *) U ( { x = 9.3993; y = -8.5377; z = 2.5743 } , (* O2 *) { x = 7.8374; y = -10.6990; z = -1.1008 } , (* O4 *) { x = 9.2924; y = -10.3081; z = 0.8477 } , (* H3 *) { x = 6.0932; y = -8.6982; z = -1.1929 } , (* H5 *) { x = 6.0481; y = -6.9515; z = 0.3446 } ) ) (* H6 *) let rU06 = N ( { a = -0.9837 ; b = 0.0476 ; c = -0.1733 ; (* dgf_base_tfo *) d = -0.1792 ; e = -0.3353 ; f = 0.9249 ; g = -0.0141 ; h = 0.9409 ; i = 0.3384 ; tx = 5.7793 ; ty = -5.2303 ; tz = 4.5997 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 3.9938; y = -6.7042; z = 1.9023 } , (* C5' *) { x = 3.2332; y = -5.9343; z = 2.0319 } , (* H5' *) { x = 3.9666; y = -7.2863; z = 0.9812 } , (* H5'' *) { x = 5.3098; y = -5.9546; z = 1.8564 } , (* C4' *) { x = 5.3863; y = -5.3702; z = 0.9395 } , (* H4' *) { x = 5.3851; y = -5.0642; z = 3.0076 } , (* O4' *) { x = 6.7315; y = -4.9724; z = 3.4462 } , (* C1' *) { x = 7.0033; y = -3.9202; z = 3.3619 } , (* H1' *) { x = 7.5997; y = -5.8018; z = 2.4948 } , (* C2' *) { x = 8.3627; y = -6.3254; z = 3.0707 } , (* H2'' *) { x = 8.0410; y = -4.9501; z = 1.4724 } , (* O2' *) { x = 8.2781; y = -4.0644; z = 1.7570 } , (* H2' *) { x = 6.5701; y = -6.8129; z = 1.9714 } , (* C3' *) { x = 6.4186; y = -7.5809; z = 2.7299 } , (* H3' *) { x = 6.9357; y = -7.3841; z = 0.7235 } , (* O3' *) { x = 6.8024; y = -5.4718; z = 4.8475 } , (* N1 *) { x = 6.6920; y = -5.0495; z = 7.1354 } , (* N3 *) { x = 6.6201; y = -4.5500; z = 5.8506 } , (* C2 *) { x = 6.9254; y = -6.3614; z = 7.4926 } , (* C4 *) { x = 7.1046; y = -7.2543; z = 6.3718 } , (* C5 *) { x = 7.0391; y = -6.7951; z = 5.1106 } , (* C6 *) U ( { x = 6.4083; y = -3.3696; z = 5.6340 } , (* O2 *) { x = 6.9679; y = -6.6901; z = 8.6800 } , (* O4 *) { x = 6.5626; y = -4.3957; z = 7.8812 } , (* H3 *) { x = 7.2781; y = -8.2254; z = 6.5350 } , (* H5 *) { x = 7.1657; y = -7.4312; z = 4.3503 } ) ) (* H6 *) let rU07 = N ( { a = -0.9434 ; b = 0.3172 ; c = 0.0971 ; (* dgf_base_tfo *) d = 0.2294 ; e = 0.4125 ; f = 0.8816 ; g = 0.2396 ; h = 0.8539 ; i = -0.4619 ; tx = 8.3625 ; ty = -52.7147 ; tz = 1.3745 } , { a = 0.2765 ; b = -0.1121 ; c = -0.9545 ; (* P_O3'_275_tfo *) d = -0.8297 ; e = 0.4733 ; f = -0.2959 ; g = 0.4850 ; h = 0.8737 ; i = 0.0379 ; tx = -14.7774 ; ty = -45.2464 ; tz = 21.9088 } , { a = 0.1063 ; b = -0.6334 ; c = -0.7665 ; (* P_O3'_180_tfo *) d = -0.5932 ; e = -0.6591 ; f = 0.4624 ; g = -0.7980 ; h = 0.4055 ; i = -0.4458 ; tx = 43.7634 ; ty = 4.3296 ; tz = 28.4890 } , { a = 0.7136 ; b = -0.5032 ; c = -0.4873 ; (* P_O3'_60_tfo *) d = 0.6803 ; e = 0.3317 ; f = 0.6536 ; g = -0.1673 ; h = -0.7979 ; i = 0.5791 ; tx = -17.1858 ; ty = 41.4390 ; tz = -27.0751 } , { x = 21.3880; y = 15.0780; z = 45.5770 } , (* P *) { x = 21.9980; y = 14.5500; z = 46.8210 } , (* O1P *) { x = 21.1450; y = 14.0270; z = 44.5420 } , (* O2P *) { x = 22.1250; y = 16.3600; z = 44.9460 } , (* O5' *) { x = 21.5037; y = 16.8594; z = 43.7323 } , (* C5' *) { x = 20.8147; y = 17.6663; z = 43.9823 } , (* H5' *) { x = 21.1086; y = 16.0230; z = 43.1557 } , (* H5'' *) { x = 22.5654; y = 17.4874; z = 42.8616 } , (* C4' *) { x = 22.1584; y = 17.7243; z = 41.8785 } , (* H4' *) { x = 23.0557; y = 18.6826; z = 43.4751 } , (* O4' *) { x = 24.4788; y = 18.6151; z = 43.6455 } , (* C1' *) { x = 24.9355; y = 19.0840; z = 42.7739 } , (* H1' *) { x = 24.7958; y = 17.1427; z = 43.6474 } , (* C2' *) { x = 24.5652; y = 16.7400; z = 44.6336 } , (* H2'' *) { x = 26.1041; y = 16.8773; z = 43.2455 } , (* O2' *) { x = 26.7516; y = 17.5328; z = 43.5149 } , (* H2' *) { x = 23.8109; y = 16.5979; z = 42.6377 } , (* C3' *) { x = 23.5756; y = 15.5686; z = 42.9084 } , (* H3' *) { x = 24.2890; y = 16.7447; z = 41.2729 } , (* O3' *) { x = 24.9420; y = 19.2174; z = 44.8923 } , (* N1 *) { x = 25.2655; y = 20.5636; z = 44.8883 } , (* N3 *) { x = 25.1663; y = 21.2219; z = 43.8561 } , (* C2 *) { x = 25.6911; y = 21.1219; z = 46.0494 } , (* C4 *) { x = 25.8051; y = 20.4068; z = 47.2048 } , (* C5 *) { x = 26.2093; y = 20.9962; z = 48.2534 } , (* C6 *) U ( { x = 25.4692; y = 19.0221; z = 47.2053 } , (* O2 *) { x = 25.0502; y = 18.4827; z = 46.0370 } , (* O4 *) { x = 25.9599; y = 22.1772; z = 46.0966 } , (* H3 *) { x = 25.5545; y = 18.4409; z = 48.1234 } , (* H5 *) { x = 24.7854; y = 17.4265; z = 45.9883 } ) ) (* H6 *) let rU08 = N ( { a = -0.0080 ; b = -0.7928 ; c = 0.6094 ; (* dgf_base_tfo *) d = -0.7512 ; e = 0.4071 ; f = 0.5197 ; g = -0.6601 ; h = -0.4536 ; i = -0.5988 ; tx = 44.1482 ; ty = 30.7036 ; tz = 2.1088 } , { a = 0.2765 ; b = -0.1121 ; c = -0.9545 ; (* P_O3'_275_tfo *) d = -0.8297 ; e = 0.4733 ; f = -0.2959 ; g = 0.4850 ; h = 0.8737 ; i = 0.0379 ; tx = -14.7774 ; ty = -45.2464 ; tz = 21.9088 } , { a = 0.1063 ; b = -0.6334 ; c = -0.7665 ; (* P_O3'_180_tfo *) d = -0.5932 ; e = -0.6591 ; f = 0.4624 ; g = -0.7980 ; h = 0.4055 ; i = -0.4458 ; tx = 43.7634 ; ty = 4.3296 ; tz = 28.4890 } , { a = 0.7136 ; b = -0.5032 ; c = -0.4873 ; (* P_O3'_60_tfo *) d = 0.6803 ; e = 0.3317 ; f = 0.6536 ; g = -0.1673 ; h = -0.7979 ; i = 0.5791 ; tx = -17.1858 ; ty = 41.4390 ; tz = -27.0751 } , { x = 21.3880; y = 15.0780; z = 45.5770 } , (* P *) { x = 21.9980; y = 14.5500; z = 46.8210 } , (* O1P *) { x = 21.1450; y = 14.0270; z = 44.5420 } , (* O2P *) { x = 22.1250; y = 16.3600; z = 44.9460 } , (* O5' *) { x = 23.5096; y = 16.1227; z = 44.5783 } , (* C5' *) { x = 23.5649; y = 15.8588; z = 43.5222 } , (* H5' *) { x = 23.9621; y = 15.4341; z = 45.2919 } , (* H5'' *) { x = 24.2805; y = 17.4138; z = 44.7151 } , (* C4' *) { x = 25.3492; y = 17.2309; z = 44.6030 } , (* H4' *) { x = 23.8497; y = 18.3471; z = 43.7208 } , (* O4' *) { x = 23.4090; y = 19.5681; z = 44.3321 } , (* C1' *) { x = 24.2595; y = 20.2496; z = 44.3524 } , (* H1' *) { x = 23.0418; y = 19.1813; z = 45.7407 } , (* C2' *) { x = 22.0532; y = 18.7224; z = 45.7273 } , (* H2'' *) { x = 23.1307; y = 20.2521; z = 46.6291 } , (* O2' *) { x = 22.8888; y = 21.1051; z = 46.2611 } , (* H2' *) { x = 24.0799; y = 18.1326; z = 46.0700 } , (* C3' *) { x = 23.6490; y = 17.4370; z = 46.7900 } , (* H3' *) { x = 25.3329; y = 18.7227; z = 46.5109 } , (* O3' *) { x = 22.2515; y = 20.1624; z = 43.6698 } , (* N1 *) { x = 22.4760; y = 21.0609; z = 42.6406 } , (* N3 *) { x = 23.6229; y = 21.3462; z = 42.3061 } , (* C2 *) { x = 21.3986; y = 21.6081; z = 42.0236 } , (* C4 *) { x = 20.1189; y = 21.3012; z = 42.3804 } , (* C5 *) { x = 19.1599; y = 21.8516; z = 41.7578 } , (* C6 *) U ( { x = 19.8919; y = 20.3745; z = 43.4387 } , (* O2 *) { x = 20.9790; y = 19.8423; z = 44.0440 } , (* O4 *) { x = 21.5235; y = 22.3222; z = 41.2097 } , (* H3 *) { x = 18.8732; y = 20.1200; z = 43.7312 } , (* H5 *) { x = 20.8545; y = 19.1313; z = 44.8608 } ) ) (* H6 *) let rU09 = N ( { a = -0.0317 ; b = 0.1374 ; c = 0.9900 ; (* dgf_base_tfo *) d = -0.3422 ; e = -0.9321 ; f = 0.1184 ; g = 0.9391 ; h = -0.3351 ; i = 0.0765 ; tx = -32.1929 ; ty = 25.8198 ; tz = -28.5088 } , { a = 0.2765 ; b = -0.1121 ; c = -0.9545 ; (* P_O3'_275_tfo *) d = -0.8297 ; e = 0.4733 ; f = -0.2959 ; g = 0.4850 ; h = 0.8737 ; i = 0.0379 ; tx = -14.7774 ; ty = -45.2464 ; tz = 21.9088 } , { a = 0.1063 ; b = -0.6334 ; c = -0.7665 ; (* P_O3'_180_tfo *) d = -0.5932 ; e = -0.6591 ; f = 0.4624 ; g = -0.7980 ; h = 0.4055 ; i = -0.4458 ; tx = 43.7634 ; ty = 4.3296 ; tz = 28.4890 } , { a = 0.7136 ; b = -0.5032 ; c = -0.4873 ; (* P_O3'_60_tfo *) d = 0.6803 ; e = 0.3317 ; f = 0.6536 ; g = -0.1673 ; h = -0.7979 ; i = 0.5791 ; tx = -17.1858 ; ty = 41.4390 ; tz = -27.0751 } , { x = 21.3880; y = 15.0780; z = 45.5770 } , (* P *) { x = 21.9980; y = 14.5500; z = 46.8210 } , (* O1P *) { x = 21.1450; y = 14.0270; z = 44.5420 } , (* O2P *) { x = 22.1250; y = 16.3600; z = 44.9460 } , (* O5' *) { x = 21.5037; y = 16.8594; z = 43.7323 } , (* C5' *) { x = 20.8147; y = 17.6663; z = 43.9823 } , (* H5' *) { x = 21.1086; y = 16.0230; z = 43.1557 } , (* H5'' *) { x = 22.5654; y = 17.4874; z = 42.8616 } , (* C4' *) { x = 23.0565; y = 18.3036; z = 43.3915 } , (* H4' *) { x = 23.5375; y = 16.5054; z = 42.4925 } , (* O4' *) { x = 23.6574; y = 16.4257; z = 41.0649 } , (* C1' *) { x = 24.4701; y = 17.0882; z = 40.7671 } , (* H1' *) { x = 22.3525; y = 16.9643; z = 40.5396 } , (* C2' *) { x = 21.5993; y = 16.1799; z = 40.6133 } , (* H2'' *) { x = 22.4693; y = 17.4849; z = 39.2515 } , (* O2' *) { x = 23.0899; y = 17.0235; z = 38.6827 } , (* H2' *) { x = 22.0341; y = 18.0633; z = 41.5279 } , (* C3' *) { x = 20.9509; y = 18.1709; z = 41.5846 } , (* H3' *) { x = 22.7249; y = 19.3020; z = 41.2100 } , (* O3' *) { x = 23.8580; y = 15.0648; z = 40.5757 } , (* N1 *) { x = 25.1556; y = 14.5982; z = 40.4523 } , (* N3 *) { x = 26.1047; y = 15.3210; z = 40.7448 } , (* C2 *) { x = 25.3391; y = 13.3315; z = 40.0020 } , (* C4 *) { x = 24.2974; y = 12.5148; z = 39.6749 } , (* C5 *) { x = 24.5450; y = 11.3410; z = 39.2610 } , (* C6 *) U ( { x = 22.9633; y = 12.9979; z = 39.8053 } , (* O2 *) { x = 22.8009; y = 14.2648; z = 40.2524 } , (* O4 *) { x = 26.3414; y = 12.9194; z = 39.8855 } , (* H3 *) { x = 22.1227; y = 12.3533; z = 39.5486 } , (* H5 *) { x = 21.7989; y = 14.6788; z = 40.3650 } ) ) (* H6 *) let rU10 = N ( { a = -0.9674 ; b = 0.1021 ; c = -0.2318 ; (* dgf_base_tfo *) d = -0.2514 ; e = -0.2766 ; f = 0.9275 ; g = 0.0306 ; h = 0.9555 ; i = 0.2933 ; tx = 27.8571 ; ty = -42.1305 ; tz = -24.4563 } , { a = 0.2765 ; b = -0.1121 ; c = -0.9545 ; (* P_O3'_275_tfo *) d = -0.8297 ; e = 0.4733 ; f = -0.2959 ; g = 0.4850 ; h = 0.8737 ; i = 0.0379 ; tx = -14.7774 ; ty = -45.2464 ; tz = 21.9088 } , { a = 0.1063 ; b = -0.6334 ; c = -0.7665 ; (* P_O3'_180_tfo *) d = -0.5932 ; e = -0.6591 ; f = 0.4624 ; g = -0.7980 ; h = 0.4055 ; i = -0.4458 ; tx = 43.7634 ; ty = 4.3296 ; tz = 28.4890 } , { a = 0.7136 ; b = -0.5032 ; c = -0.4873 ; (* P_O3'_60_tfo *) d = 0.6803 ; e = 0.3317 ; f = 0.6536 ; g = -0.1673 ; h = -0.7979 ; i = 0.5791 ; tx = -17.1858 ; ty = 41.4390 ; tz = -27.0751 } , { x = 21.3880; y = 15.0780; z = 45.5770 } , (* P *) { x = 21.9980; y = 14.5500; z = 46.8210 } , (* O1P *) { x = 21.1450; y = 14.0270; z = 44.5420 } , (* O2P *) { x = 22.1250; y = 16.3600; z = 44.9460 } , (* O5' *) { x = 23.5096; y = 16.1227; z = 44.5783 } , (* C5' *) { x = 23.5649; y = 15.8588; z = 43.5222 } , (* H5' *) { x = 23.9621; y = 15.4341; z = 45.2919 } , (* H5'' *) { x = 24.2805; y = 17.4138; z = 44.7151 } , (* C4' *) { x = 23.8509; y = 18.1819; z = 44.0720 } , (* H4' *) { x = 24.2506; y = 17.8583; z = 46.0741 } , (* O4' *) { x = 25.5830; y = 18.0320; z = 46.5775 } , (* C1' *) { x = 25.8569; y = 19.0761; z = 46.4256 } , (* H1' *) { x = 26.4410; y = 17.1555; z = 45.7033 } , (* C2' *) { x = 26.3459; y = 16.1253; z = 46.0462 } , (* H2'' *) { x = 27.7649; y = 17.5888; z = 45.6478 } , (* O2' *) { x = 28.1004; y = 17.9719; z = 46.4616 } , (* H2' *) { x = 25.7796; y = 17.2997; z = 44.3513 } , (* C3' *) { x = 25.9478; y = 16.3824; z = 43.7871 } , (* H3' *) { x = 26.2154; y = 18.4984; z = 43.6541 } , (* O3' *) { x = 25.7321; y = 17.6281; z = 47.9726 } , (* N1 *) { x = 25.5136; y = 18.5779; z = 48.9560 } , (* N3 *) { x = 25.2079; y = 19.7276; z = 48.6503 } , (* C2 *) { x = 25.6482; y = 18.1987; z = 50.2518 } , (* C4 *) { x = 25.9847; y = 16.9266; z = 50.6092 } , (* C5 *) { x = 26.0918; y = 16.6439; z = 51.8416 } , (* C6 *) U ( { x = 26.2067; y = 15.9515; z = 49.5943 } , (* O2 *) { x = 26.0713; y = 16.3497; z = 48.3080 } , (* O4 *) { x = 25.4890; y = 18.9105; z = 51.0618 } , (* H3 *) { x = 26.4742; y = 14.9310; z = 49.8682 } , (* H5 *) { x = 26.2346; y = 15.6394; z = 47.4975 } ) ) (* H6 *) let rUs = [ rU01; rU02; rU03; rU04; rU05; rU06; rU07; rU08; rU09; rU10 ] let rG' = N ( { a = -0.2067 ; b = -0.0264 ; c = 0.9780 ; (* dgf_base_tfo *) d = 0.9770 ; e = -0.0586 ; f = 0.2049 ; g = 0.0519 ; h = 0.9979 ; i = 0.0379 ; tx = 1.0331 ; ty = -46.8078 ; tz = -36.4742 } , { a = -0.8644 ; b = -0.4956 ; c = -0.0851 ; (* P_O3'_275_tfo *) d = -0.0427 ; e = 0.2409 ; f = -0.9696 ; g = 0.5010 ; h = -0.8345 ; i = -0.2294 ; tx = 4.0167 ; ty = 54.5377 ; tz = 12.4779 } , { a = 0.3706 ; b = -0.6167 ; c = 0.6945 ; (* P_O3'_180_tfo *) d = -0.2867 ; e = -0.7872 ; f = -0.5460 ; g = 0.8834 ; h = 0.0032 ; i = -0.4686 ; tx = -52.9020 ; ty = 18.6313 ; tz = -0.6709 } , { a = 0.4155 ; b = 0.9025 ; c = -0.1137 ; (* P_O3'_60_tfo *) d = 0.9040 ; e = -0.4236 ; f = -0.0582 ; g = -0.1007 ; h = -0.0786 ; i = -0.9918 ; tx = -7.6624 ; ty = -25.2080 ; tz = 49.5181 } , { x = 31.3810; y = 0.1400; z = 47.5810 } , (* P *) { x = 29.9860; y = 0.6630; z = 47.6290 } , (* O1P *) { x = 31.7210; y = -0.6460; z = 48.8090 } , (* O2P *) { x = 32.4940; y = 1.2540; z = 47.2740 } , (* O5' *) { x = 32.1610; y = 2.2370; z = 46.2560 } , (* C5' *) { x = 31.2986; y = 2.8190; z = 46.5812 } , (* H5' *) { x = 32.0980; y = 1.7468; z = 45.2845 } , (* H5'' *) { x = 33.3476; y = 3.1959; z = 46.1947 } , (* C4' *) { x = 33.2668; y = 3.8958; z = 45.3630 } , (* H4' *) { x = 33.3799; y = 3.9183; z = 47.4216 } , (* O4' *) { x = 34.6515; y = 3.7222; z = 48.0398 } , (* C1' *) { x = 35.2947; y = 4.5412; z = 47.7180 } , (* H1' *) { x = 35.1756; y = 2.4228; z = 47.4827 } , (* C2' *) { x = 34.6778; y = 1.5937; z = 47.9856 } , (* H2'' *) { x = 36.5631; y = 2.2672; z = 47.4798 } , (* O2' *) { x = 37.0163; y = 2.6579; z = 48.2305 } , (* H2' *) { x = 34.6953; y = 2.5043; z = 46.0448 } , (* C3' *) { x = 34.5444; y = 1.4917; z = 45.6706 } , (* H3' *) { x = 35.6679; y = 3.3009; z = 45.3487 } , (* O3' *) { x = 37.4804; y = 4.0914; z = 52.2559 } , (* N1 *) { x = 36.9670; y = 4.1312; z = 49.9281 } , (* N3 *) { x = 37.8045; y = 4.2519; z = 50.9550 } , (* C2 *) { x = 35.7171; y = 3.8264; z = 50.3222 } , (* C4 *) { x = 35.2668; y = 3.6420; z = 51.6115 } , (* C5 *) { x = 36.2037; y = 3.7829; z = 52.6706 } , (* C6 *) G ( { x = 39.0869; y = 4.5552; z = 50.7092 } , (* N2 *) { x = 33.9075; y = 3.3338; z = 51.6102 } , (* N7 *) { x = 34.6126; y = 3.6358; z = 49.5108 } , (* N9 *) { x = 33.5805; y = 3.3442; z = 50.3425 } , (* C8 *) { x = 35.9958; y = 3.6512; z = 53.8724 } , (* O6 *) { x = 38.2106; y = 4.2053; z = 52.9295 } , (* H1 *) { x = 39.8218; y = 4.6863; z = 51.3896 } , (* H21 *) { x = 39.3420; y = 4.6857; z = 49.7407 } , (* H22 *) { x = 32.5194; y = 3.1070; z = 50.2664 } ) ) (* H8 *) let rU' = N ( { a = -0.0109 ; b = 0.5907 ; c = 0.8068 ; (* dgf_base_tfo *) d = 0.2217 ; e = -0.7853 ; f = 0.5780 ; g = 0.9751 ; h = 0.1852 ; i = -0.1224 ; tx = -1.4225 ; ty = -11.0956 ; tz = -2.5217 } , { a = -0.8313 ; b = -0.4738 ; c = -0.2906 ; (* P_O3'_275_tfo *) d = 0.0649 ; e = 0.4366 ; f = -0.8973 ; g = 0.5521 ; h = -0.7648 ; i = -0.3322 ; tx = 1.6833 ; ty = 6.8060 ; tz = -7.0011 } , { a = 0.3445 ; b = -0.7630 ; c = 0.5470 ; (* P_O3'_180_tfo *) d = -0.4628 ; e = -0.6450 ; f = -0.6082 ; g = 0.8168 ; h = -0.0436 ; i = -0.5753 ; tx = -6.8179 ; ty = -3.9778 ; tz = -5.9887 } , { a = 0.5855 ; b = 0.7931 ; c = -0.1682 ; (* P_O3'_60_tfo *) d = 0.8103 ; e = -0.5790 ; f = 0.0906 ; g = -0.0255 ; h = -0.1894 ; i = -0.9816 ; tx = 6.1203 ; ty = -7.1051 ; tz = 3.1984 } , { x = 2.6760; y = -8.4960; z = 3.2880 } , (* P *) { x = 1.4950; y = -7.6230; z = 3.4770 } , (* O1P *) { x = 2.9490; y = -9.4640; z = 4.3740 } , (* O2P *) { x = 3.9730; y = -7.5950; z = 3.0340 } , (* O5' *) { x = 5.2430; y = -8.2420; z = 2.8260 } , (* C5' *) { x = 5.1974; y = -8.8497; z = 1.9223 } , (* H5' *) { x = 5.5548; y = -8.7348; z = 3.7469 } , (* H5'' *) { x = 6.3140; y = -7.2060; z = 2.5510 } , (* C4' *) { x = 5.8744; y = -6.2116; z = 2.4731 } , (* H4' *) { x = 7.2798; y = -7.2260; z = 3.6420 } , (* O4' *) { x = 8.5733; y = -6.9410; z = 3.1329 } , (* C1' *) { x = 8.9047; y = -6.0374; z = 3.6446 } , (* H1' *) { x = 8.4429; y = -6.6596; z = 1.6327 } , (* C2' *) { x = 9.2880; y = -7.1071; z = 1.1096 } , (* H2'' *) { x = 8.2502; y = -5.2799; z = 1.4754 } , (* O2' *) { x = 8.7676; y = -4.7284; z = 2.0667 } , (* H2' *) { x = 7.1642; y = -7.4416; z = 1.3021 } , (* C3' *) { x = 7.4125; y = -8.5002; z = 1.2260 } , (* H3' *) { x = 6.5160; y = -6.9772; z = 0.1267 } , (* O3' *) { x = 9.4531; y = -8.1107; z = 3.4087 } , (* N1 *) { x = 11.5931; y = -9.0015; z = 3.6357 } , (* N3 *) { x = 10.8101; y = -7.8950; z = 3.3748 } , (* C2 *) { x = 11.1439; y = -10.2744; z = 3.9206 } , (* C4 *) { x = 9.7056; y = -10.4026; z = 3.9332 } , (* C5 *) { x = 8.9192; y = -9.3419; z = 3.6833 } , (* C6 *) U ( { x = 11.3013; y = -6.8063; z = 3.1326 } , (* O2 *) { x = 11.9431; y = -11.1876; z = 4.1375 } , (* O4 *) { x = 12.5840; y = -8.8673; z = 3.6158 } , (* H3 *) { x = 9.2891; y = -11.2898; z = 4.1313 } , (* H5 *) { x = 7.9263; y = -9.4537; z = 3.6977 } ) ) (* H6 *) (* -- PARTIAL INSTANTIATIONS ------------------------------------------------*) type variable = { id : int ; t : tfo ; n : nuc } let mk_var i t n = { id = i; t; n } let absolute_pos v p = tfo_apply v.t p let atom_pos atom v = absolute_pos v (atom v.n) let rec get_var id = function | v :: lst -> if id = v.id then v else get_var id lst | _ -> assert false (* -- SEARCH ----------------------------------------------------------------*) (* Sequential backtracking algorithm *) let rec search (partial_inst : variable list) l constr = match l with | [] -> [ partial_inst ] | h :: t -> let rec try_assignments = function | [] -> [] | v :: vs -> if constr v partial_inst then search (v :: partial_inst) t constr @ try_assignments vs else try_assignments vs in try_assignments (h partial_inst) (* -- DOMAINS ---------------------------------------------------------------*) (* Primary structure: strand A CUGCCACGUCUG, strand B CAGACGUGGCAG Secondary structure: strand A CUGCCACGUCUG |||||||||||| GACGGUGCAGAC strand B Tertiary structure: 5' end of strand A C1----G12 3' end of strand B U2-------A11 G3-------C10 C4-----G9 C5---G8 A6 G6-C7 C5----G8 A4-------U9 G3--------C10 A2-------U11 5' end of strand B C1----G12 3' end of strand A "helix", "stacked" and "connected" describe the spatial relationship between two consecutive nucleotides. E.g. the nucleotides C1 and U2 from the strand A. "wc" (stands for Watson-Crick and is a type of base-pairing), and "wc-dumas" describe the spatial relationship between nucleotides from two chains that are growing in opposite directions. E.g. the nucleotides C1 from strand A and G12 from strand B. *) (* Dynamic Domains *) (* Given, "refnuc" a nucleotide which is already positioned, "nucl" the nucleotide to be placed, and "tfo" a transformation matrix which expresses the desired relationship between "refnuc" and "nucl", the function "dgf-base" computes the transformation matrix that places the nucleotide "nucl" in the given relationship to "refnuc". *) let dgf_base tfo v nucl = let x = if is_A v.n then tfo_align (atom_pos nuc_C1' v) (atom_pos rA_N9 v) (atom_pos nuc_C4 v) else if is_C v.n then tfo_align (atom_pos nuc_C1' v) (atom_pos nuc_N1 v) (atom_pos nuc_C2 v) else if is_G v.n then tfo_align (atom_pos nuc_C1' v) (atom_pos rG_N9 v) (atom_pos nuc_C4 v) else tfo_align (atom_pos nuc_C1' v) (atom_pos nuc_N1 v) (atom_pos nuc_C2 v) in tfo_combine (nuc_dgf_base_tfo nucl) (tfo_combine tfo (tfo_inv_ortho x)) (* Placement of first nucleotide. *) let reference n i partial_inst = [ mk_var i tfo_id n ] (* The transformation matrix for wc is from: Chandrasekaran R. et al (1989) A Re-Examination of the Crystal Structure of A-DNA Using Fiber Diffraction Data. J. Biomol. Struct. & Dynamics 6(6):1189-1202. *) let wc_tfo = { a = -1.0000 ; b = 0.0028 ; c = -0.0019 ; d = 0.0028 ; e = 0.3468 ; f = -0.9379 ; g = -0.0019 ; h = -0.9379 ; i = -0.3468 ; tx = -0.0080 ; ty = 6.0730 ; tz = 8.7208 } let wc nucl i j partial_inst = [ mk_var i (dgf_base wc_tfo (get_var j partial_inst) nucl) nucl ] let wc_dumas_tfo = { a = -0.9737 ; b = -0.1834 ; c = 0.1352 ; d = -0.1779 ; e = 0.2417 ; f = -0.9539 ; g = 0.1422 ; h = -0.9529 ; i = -0.2679 ; tx = 0.4837 ; ty = 6.2649 ; tz = 8.0285 } let wc_dumas nucl i j partial_inst = [ mk_var i (dgf_base wc_dumas_tfo (get_var j partial_inst) nucl) nucl ] let helix5'_tfo = { a = 0.9886 ; b = -0.0961 ; c = 0.1156 ; d = 0.1424 ; e = 0.8452 ; f = -0.5152 ; g = -0.0482 ; h = 0.5258 ; i = 0.8492 ; tx = -3.8737 ; ty = 0.5480 ; tz = 3.8024 } let helix5' nucl i j partial_inst = [ mk_var i (dgf_base helix5'_tfo (get_var j partial_inst) nucl) nucl ] let helix3'_tfo = { a = 0.9886 ; b = 0.1424 ; c = -0.0482 ; d = -0.0961 ; e = 0.8452 ; f = 0.5258 ; g = 0.1156 ; h = -0.5152 ; i = 0.8492 ; tx = 3.4426 ; ty = 2.0474 ; tz = -3.7042 } let helix3' nucl i j partial_inst = [ mk_var i (dgf_base helix3'_tfo (get_var j partial_inst) nucl) nucl ] let g37_a38_tfo = { a = 0.9991 ; b = 0.0164 ; c = -0.0387 ; d = -0.0375 ; e = 0.7616 ; f = -0.6470 ; g = 0.0189 ; h = 0.6478 ; i = 0.7615 ; tx = -3.3018 ; ty = 0.9975 ; tz = 2.5585 } let g37_a38 nucl i j partial_inst = mk_var i (dgf_base g37_a38_tfo (get_var j partial_inst) nucl) nucl let stacked5' nucl i j partial_inst = g37_a38 nucl i j partial_inst :: helix5' nucl i j partial_inst let a38_g37_tfo = { a = 0.9991 ; b = -0.0375 ; c = 0.0189 ; d = 0.0164 ; e = 0.7616 ; f = 0.6478 ; g = -0.0387 ; h = -0.6470 ; i = 0.7615 ; tx = 3.3819 ; ty = 0.7718 ; tz = -2.5321 } let a38_g37 nucl i j partial_inst = mk_var i (dgf_base a38_g37_tfo (get_var j partial_inst) nucl) nucl let stacked3' nucl i j partial_inst = a38_g37 nucl i j partial_inst :: helix3' nucl i j partial_inst let p_o3' nucls i j partial_inst = let refnuc = get_var j partial_inst in let align = tfo_inv_ortho (tfo_align (atom_pos nuc_O3' refnuc) (atom_pos nuc_C3' refnuc) (atom_pos nuc_C4' refnuc)) in let rec generate domains = function | [] -> domains | n :: ns -> generate (mk_var i (tfo_combine (nuc_p_o3'_60_tfo n) align) n :: mk_var i (tfo_combine (nuc_p_o3'_180_tfo n) align) n :: mk_var i (tfo_combine (nuc_p_o3'_275_tfo n) align) n :: domains) ns in generate [] nucls (* -- PROBLEM STATEMENT -----------------------------------------------------*) (* Define anticodon problem -- Science 253:1255 Figure 3a, 3b and 3c *) let anticodon_domains = [ reference rC 27 ; helix5' rC 28 27 ; helix5' rA 29 28 ; helix5' rG 30 29 ; helix5' rA 31 30 ; wc rU 39 31 ; helix5' rC 40 39 ; helix5' rU 41 40 ; helix5' rG 42 41 ; helix5' rG 43 42 ; stacked3' rA 38 39 ; stacked3' rG 37 38 ; stacked3' rA 36 37 ; stacked3' rA 35 36 ; stacked3' rG 34 35 ; (* <-. Distance *) p_o3' rCs 32 31 ; (* | Constraint *) p_o3' rUs 33 32 (* <-' 3.0 Angstroms *) ] (* Anticodon constraint *) let anticodon_constraint v partial_inst = let dist j = let p = atom_pos nuc_P (get_var j partial_inst) in let o3' = atom_pos nuc_O3' v in pt_dist p o3' in if v.id = 33 then dist 34 <= 3.0 else true let anticodon () = search [] anticodon_domains anticodon_constraint (* Define pseudoknot problem -- Science 253:1255 Figure 4a and 4b *) let pseudoknot_domains = [ reference rA 23 ; wc_dumas rU 8 23 ; helix3' rG 22 23 ; wc_dumas rC 9 22 ; helix3' rG 21 22 ; wc_dumas rC 10 21 ; helix3' rC 20 21 ; wc_dumas rG 11 20 ; helix3' rU' 19 20 ; (* <-. *) wc_dumas rA 12 19 ; (* | Distance *) (* | Constraint *) (* Helix 1 | 4.0 Angstroms *) helix3' rC 3 19 ; (* | *) wc_dumas rG 13 3 ; (* | *) helix3' rC 2 3 ; (* | *) wc_dumas rG 14 2 ; (* | *) helix3' rC 1 2 ; (* | *) wc_dumas rG' 15 1 ; (* | *) (* | *) (* L2 LOOP | *) p_o3' rUs 16 15 ; (* | *) p_o3' rCs 17 16 ; (* | *) p_o3' rAs 18 17 ; (* <-' *) (* *) (* L1 LOOP *) helix3' rU 7 8 ; (* <-. *) p_o3' rCs 4 3 ; (* | Constraint *) stacked5' rU 5 4 ; (* | 4.5 Angstroms *) stacked5' rC 6 5 (* <-' *) ] (* Pseudoknot constraint *) let pseudoknot_constraint v partial_inst = let dist j = let p = atom_pos nuc_P (get_var j partial_inst) in let o3' = atom_pos nuc_O3' v in pt_dist p o3' in if v.id = 18 then dist 19 <= 4.0 else if v.id = 6 then dist 7 <= 4.5 else true let pseudoknot () = search [] pseudoknot_domains pseudoknot_constraint (* -- TESTING ---------------------------------------------------------------*) let list_of_atoms = function | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , A (n6, n7, n9, c8, h2, h61, h62, h8) ) -> [| p ; o1p ; o2p ; o5' ; c5' ; h5' ; h5'' ; c4' ; h4' ; o4' ; c1' ; h1' ; c2' ; h2'' ; o2' ; h2' ; c3' ; h3' ; o3' ; n1 ; n3 ; c2 ; c4 ; c5 ; c6 ; n6 ; n7 ; n9 ; c8 ; h2 ; h61 ; h62 ; h8 |] | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , C (n4, o2, h41, h42, h5, h6) ) -> [| p ; o1p ; o2p ; o5' ; c5' ; h5' ; h5'' ; c4' ; h4' ; o4' ; c1' ; h1' ; c2' ; h2'' ; o2' ; h2' ; c3' ; h3' ; o3' ; n1 ; n3 ; c2 ; c4 ; c5 ; c6 ; n4 ; o2 ; h41 ; h42 ; h5 ; h6 |] | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , G (n2, n7, n9, c8, o6, h1, h21, h22, h8) ) -> [| p ; o1p ; o2p ; o5' ; c5' ; h5' ; h5'' ; c4' ; h4' ; o4' ; c1' ; h1' ; c2' ; h2'' ; o2' ; h2' ; c3' ; h3' ; o3' ; n1 ; n3 ; c2 ; c4 ; c5 ; c6 ; n2 ; n7 ; n9 ; c8 ; o6 ; h1 ; h21 ; h22 ; h8 |] | N ( dgf_base_tfo , p_o3'_275_tfo , p_o3'_180_tfo , p_o3'_60_tfo , p , o1p , o2p , o5' , c5' , h5' , h5'' , c4' , h4' , o4' , c1' , h1' , c2' , h2'' , o2' , h2' , c3' , h3' , o3' , n1 , n3 , c2 , c4 , c5 , c6 , U (o2, o4, h3, h5, h6) ) -> [| p ; o1p ; o2p ; o5' ; c5' ; h5' ; h5'' ; c4' ; h4' ; o4' ; c1' ; h1' ; c2' ; h2'' ; o2' ; h2' ; c3' ; h3' ; o3' ; n1 ; n3 ; c2 ; c4 ; c5 ; c6 ; o2 ; o4 ; h3 ; h5 ; h6 |] let maximum = function | x :: xs -> let rec iter m = function | [] -> m | a :: b -> iter (if a > m then a else m) b in iter x xs | _ -> assert false let var_most_distant_atom v = let atoms = list_of_atoms v.n in let max_dist = ref 0.0 in for i = 0 to pred (Array.length atoms) do let p = atoms.(i) in let distance = let pos = absolute_pos v p in sqrt ((pos.x * pos.x) + (pos.y * pos.y) + (pos.z * pos.z)) in if distance > !max_dist then max_dist := distance done; !max_dist let sol_most_distant_atom s = maximum (List.map var_most_distant_atom s) let most_distant_atom sols = maximum (List.map sol_most_distant_atom sols) let check () = List.length (pseudoknot ()) let run () = most_distant_atom (pseudoknot ()) let main () = for _ = 1 to 50 do ignore (run ()) done; assert (abs_float (run () -. 33.7976) < 0.0002) (* Printf.printf "%.4f" (run ()); print_newline() *) let _ = main () js_of_ocaml-3.5.2/benchmarks/sources/ml/quicksort.ml000066400000000000000000000055151357507750000226010ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: quicksort.ml 7017 2005-08-12 09:22:04Z xleroy $ *) (* Good test for loops. Best compiled with -unsafe. *) let rec qsort lo hi (a : int array) = if lo < hi then ( let i = ref lo in let j = ref hi in let pivot = a.(hi) in while !i < !j do while !i < hi && a.(!i) <= pivot do incr i done; while !j > lo && a.(!j) >= pivot do decr j done; if !i < !j then ( let temp = a.(!i) in a.(!i) <- a.(!j); a.(!j) <- temp) done; let temp = a.(!i) in a.(!i) <- a.(hi); a.(hi) <- temp; qsort lo (!i - 1) a; qsort (!i + 1) hi a) (* Same but abstract over the comparison to force spilling *) let cmp i j = i - j let rec qsort2 lo hi (a : int array) = if lo < hi then ( let i = ref lo in let j = ref hi in let pivot = a.(hi) in while !i < !j do while !i < hi && cmp a.(!i) pivot <= 0 do incr i done; while !j > lo && cmp a.(!j) pivot >= 0 do decr j done; if !i < !j then ( let temp = a.(!i) in a.(!i) <- a.(!j); a.(!j) <- temp) done; let temp = a.(!i) in a.(!i) <- a.(hi); a.(hi) <- temp; qsort2 lo (!i - 1) a; qsort2 (!i + 1) hi a) (* Test *) let seed = ref 0 let random () = seed := (!seed * 25173) + 17431; !seed land 0xFFF exception Failed let test_sort sort_fun size = let a = Array.make size 0 in let check = Array.make 4096 0 in for i = 0 to size - 1 do let n = random () in a.(i) <- n; check.(n) <- check.(n) + 1 done; sort_fun 0 (size - 1) a; try check.(a.(0)) <- check.(a.(0)) - 1; for i = 1 to size - 1 do if a.(i - 1) > a.(i) then raise Failed; check.(a.(i)) <- check.(a.(i)) - 1 done; for i = 0 to 4095 do if check.(i) <> 0 then raise Failed done (*print_string "OK"; print_newline()*) with Failed -> assert false (*print_string "failed"; print_newline()*) let main () = test_sort qsort 500000; test_sort qsort2 500000 let _ = main () (*exit 0*) js_of_ocaml-3.5.2/benchmarks/sources/ml/raytrace.ml000066400000000000000000000342451357507750000223710ustar00rootroot00000000000000module Color = struct type t = { red : float ; green : float ; blue : float } let make r g b = { red = r; green = g; blue = b } (* let print ch c = let r = truncate (c.red *. 255.) in let g = truncate (c.green *. 255.) in let b = truncate (c.blue *. 255.) in Format.fprintf ch "rgb(%d,%d,%d)" r g b *) let limit c = { red = (let red = c.red in if red <= 0. then 0. else if red > 1.0 then 1.0 else red) ; green = (let green = c.green in if green <= 0. then 0. else if green > 1.0 then 1.0 else green) ; blue = (let blue = c.blue in if blue <= 0. then 0. else if blue > 1.0 then 1.0 else blue) } let add c1 c2 = { red = c1.red +. c2.red; green = c1.green +. c2.green; blue = c1.blue +. c2.blue } let add_scalar c1 s = limit { red = c1.red +. s; green = c1.green +. s; blue = c1.blue +. s } let subtract c1 c2 = { red = c1.red -. c2.red; green = c1.green -. c2.green; blue = c1.blue -. c2.blue } let multiply c1 c2 = { red = c1.red *. c2.red; green = c1.green *. c2.green; blue = c1.blue *. c2.blue } let multiply_scalar c1 s = { red = c1.red *. s; green = c1.green *. s; blue = c1.blue *. s } let divide_factor c1 f = { red = c1.red /. f; green = c1.green /. f; blue = c1.blue /. f } let distance c1 c2 = abs_float (c1.red -. c2.red) +. abs_float (c1.green -. c2.green) +. abs_float (c1.blue -. c2.blue) let blend c1 c2 w = add (multiply_scalar c1 (1. -. w)) (multiply_scalar c2 w) let brightness c = let r = truncate (c.red *. 255.) in let g = truncate (c.green *. 255.) in let b = truncate (c.blue *. 255.) in ((r * 77) + (g * 150) + (b * 29)) lsr 8 end module Vector = struct type t = { x : float ; mutable y : float ; z : float } let make x y z = { x; y; z } (* let print ch v = Format.fprintf ch "%f %f %f" v.x v.y v.z *) let magnitude v = sqrt ((v.x *. v.x) +. (v.y *. v.y) +. (v.z *. v.z)) let normalize v = let m = magnitude v in { x = v.x /. m; y = v.y /. m; z = v.z /. m } let cross v w = { x = (v.y *. w.z) -. (v.z *. w.y) ; y = (v.z *. w.x) -. (v.x *. w.z) ; z = (v.x *. w.y) -. (v.y *. w.x) } let dot v w = (v.x *. w.x) +. (v.y *. w.y) +. (v.z *. w.z) let add v w = { x = v.x +. w.x; y = v.y +. w.y; z = v.z +. w.z } let subtract v w = { x = v.x -. w.x; y = v.y -. w.y; z = v.z -. w.z } let multiply_vector v w = { x = v.x *. w.x; y = v.y *. w.y; z = v.z *. w.z } let multiply_scalar v w = { x = v.x *. w; y = v.y *. w; z = v.z *. w } end module Light = struct type t = { position : Vector.t ; color : Color.t ; intensity : float } let make p c i = { position = p; color = c; intensity = i } end module Ray = struct type t = { position : Vector.t ; direction : Vector.t } let make p d = { position = p; direction = d } end module Intersection_info = struct type 'a t = { shape : 'a ; distance : float ; position : Vector.t ; normal : Vector.t ; color : Color.t } end module Camera = struct type t = { position : Vector.t ; look_at : Vector.t ; equator : Vector.t ; up : Vector.t ; screen : Vector.t } let make pos look_at up = { position = pos ; look_at ; up ; equator = Vector.cross (Vector.normalize look_at) up ; screen = Vector.add pos look_at } let get_ray c vx vy = let pos = Vector.subtract c.screen (Vector.subtract (Vector.multiply_scalar c.equator vx) (Vector.multiply_scalar c.up vy)) in pos.Vector.y <- pos.Vector.y *. -1.; let dir = Vector.subtract pos c.position in Ray.make pos (Vector.normalize dir) end module Background = struct type t = { color : Color.t ; ambience : float } let make c a = { color = c; ambience = a } end module Material = struct type t = { reflection : float ; transparency : float ; gloss : float ; has_texture : bool ; get_color : float -> float -> Color.t } let wrap_up t = let t = mod_float t 2.0 in if t < -1. then t +. 2.0 else if t >= 1. then t -. 2.0 else t let solid color reflection transparency gloss = { reflection ; transparency ; gloss ; has_texture = false ; get_color = (fun _ _ -> color) } let chessboard color_even color_odd reflection transparency gloss density = { reflection ; transparency ; gloss ; has_texture = true ; get_color = (fun u v -> let t = wrap_up (u *. density) *. wrap_up (v *. density) in if t < 0. then color_even else color_odd) } end module Shape = struct type shape = | Sphere of Vector.t * float | Plane of Vector.t * float type t = { shape : shape ; material : Material.t } let make shape material = { shape; material } let dummy = make (Sphere (Vector.make 0. 0. 0., 0.)) (Material.solid (Color.make 0. 0. 0.) 0. 0. 0.) let position s = match s.shape with | Sphere (p, _) -> p | Plane (p, _) -> p let intersect s ray = match s.shape with | Sphere (position, radius) -> let dst = Vector.subtract ray.Ray.position position in let b = Vector.dot dst ray.Ray.direction in let c = Vector.dot dst dst -. (radius *. radius) in let d = (b *. b) -. c in if d > 0. then let dist = -.b -. sqrt d in let pos = Vector.add ray.Ray.position (Vector.multiply_scalar ray.Ray.direction dist) in Some { Intersection_info.shape = s ; distance = dist ; position = pos ; normal = Vector.normalize (Vector.subtract pos position) ; color = s.material.Material.get_color 0. 0. } else None | Plane (position, d) -> let vd = Vector.dot position ray.Ray.direction in if vd = 0. then None else let t = -.(Vector.dot position ray.Ray.position +. d) /. vd in if t <= 0. then None else let pos = Vector.add ray.Ray.position (Vector.multiply_scalar ray.Ray.direction t) in Some { Intersection_info.shape = s ; distance = t ; position = pos ; normal = position ; color = (if s.material.Material.has_texture then let vu = Vector.make position.Vector.y position.Vector.z (-.position.Vector.x) in let vv = Vector.cross vu position in let u = Vector.dot pos vu in let v = Vector.dot pos vv in s.material.Material.get_color u v else s.material.Material.get_color 0. 0.) } end module Scene = struct type t = { camera : Camera.t ; shapes : Shape.t array ; lights : Light.t array ; background : Background.t } let make c s l b = { camera = c; shapes = s; lights = l; background = b } end module Engine = struct type t = { pixel_width : int ; pixel_height : int ; canvas_width : int ; canvas_height : int ; render_diffuse : bool ; render_shadows : bool ; render_highlights : bool ; render_reflections : bool ; ray_depth : int } let check_number = ref 0 let get_reflection_ray p n v = let c1 = -.Vector.dot n v in let r1 = Vector.add (Vector.multiply_scalar n (2. *. c1)) v in Ray.make p r1 let rec ray_trace options info ray scene depth = let old_color = Color.multiply_scalar info.Intersection_info.color scene.Scene.background.Background.ambience in let color = ref old_color in let shininess = 10. ** (info.Intersection_info.shape.Shape.material.Material.gloss +. 1.) in let lights = scene.Scene.lights in for i = 0 to Array.length lights - 1 do let light = lights.(i) in let v = Vector.normalize (Vector.subtract light.Light.position info.Intersection_info.position) in (if options.render_diffuse then let l = Vector.dot v info.Intersection_info.normal in if l > 0. then color := Color.add !color (Color.multiply info.Intersection_info.color (Color.multiply_scalar light.Light.color l))); (if depth <= options.ray_depth then if options.render_reflections && info.Intersection_info.shape.Shape.material.Material.reflection > 0. then let reflection_ray = get_reflection_ray info.Intersection_info.position info.Intersection_info.normal ray.Ray.direction in let col = match test_intersection reflection_ray scene info.Intersection_info.shape with | Some ({ Intersection_info.distance = d; _ } as info) when d > 0. -> ray_trace options info reflection_ray scene (depth + 1) | _ -> scene.Scene.background.Background.color in color := Color.blend !color col info.Intersection_info.shape.Shape.material.Material.reflection); let shadow_info = ref None in if options.render_shadows then ( let shadow_ray = Ray.make info.Intersection_info.position v in shadow_info := test_intersection shadow_ray scene info.Intersection_info.shape; match !shadow_info with | Some info -> (*XXX This looks wrong! *) let va = Color.multiply_scalar !color 0.5 in let db = 0.5 *. (info.Intersection_info.shape.Shape.material.Material.transparency ** 0.5) in color := Color.add_scalar va db | None -> ()); if options.render_highlights && !shadow_info <> None && info.Intersection_info.shape.Shape.material.Material.gloss > 0. then (*XXX This looks wrong! *) let shape_position = Shape.position info.Intersection_info.shape in let lv = Vector.normalize (Vector.subtract shape_position light.Light.position) in let e = Vector.normalize (Vector.subtract scene.Scene.camera.Camera.position shape_position) in let h = Vector.normalize (Vector.subtract e lv) in let gloss_weight = max (Vector.dot info.Intersection_info.normal h) 0. ** shininess in color := Color.add (Color.multiply_scalar light.Light.color gloss_weight) !color done; Color.limit !color and test_intersection ray scene exclude = let best = ref None in let dist = ref 2000. in let shapes = scene.Scene.shapes in for i = 0 to Array.length shapes - 1 do let shape = shapes.(i) in if shape != exclude then match Shape.intersect shape ray with | Some { Intersection_info.distance = d; _ } as v when d >= 0. && d < !dist -> best := v; dist := d | _ -> () done; !best let get_pixel_color options ray scene = match test_intersection ray scene Shape.dummy with | Some info -> ray_trace options info ray scene 0 | None -> scene.Scene.background.Background.color let set_pixel _options x y color = if x == y then check_number := !check_number + Color.brightness color; ( (* let pxw = options.pixel_width in let pxh = options.pixel_height in Format.eprintf "%d %d %d %d %d %a@." (x * pxw) (y * pxh) pxw pxh !check_number Color.print color; *) ) let render_scene options scene _canvas = check_number := 0; (*XXX canvas *) let canvas_height = options.canvas_height in let canvas_width = options.canvas_width in for y = 0 to canvas_height - 1 do for x = 0 to canvas_width - 1 do let yp = (float y /. float canvas_height *. 2.) -. 1. in let xp = (float x /. float canvas_width *. 2.) -. 1. in let ray = Camera.get_ray scene.Scene.camera xp yp in let color = get_pixel_color options ray scene in set_pixel options x y color done done; assert (!check_number = 2321) let make canvas_width canvas_height pixel_width pixel_height render_diffuse render_shadows render_highlights render_reflections ray_depth = { canvas_width = canvas_width / pixel_width ; canvas_height = canvas_height / pixel_height ; pixel_width ; pixel_height ; render_diffuse ; render_shadows ; render_highlights ; render_reflections ; ray_depth } end let render_scene () = let camera = Camera.make (Vector.make 0. 0. (-15.)) (Vector.make (-0.2) 0. 5.) (Vector.make 0. 1. 0.) in let background = Background.make (Color.make 0.5 0.5 0.5) 0.4 in let sphere = Shape.make (Shape.Sphere (Vector.make (-1.5) 1.5 2., 1.5)) (Material.solid (Color.make 0. 0.5 0.5) 0.3 0. 2.) in let sphere1 = Shape.make (Shape.Sphere (Vector.make 1. 0.25 1., 0.5)) (Material.solid (Color.make 0.9 0.9 0.9) 0.1 0. 1.5) in let plane = Shape.make (Shape.Plane (Vector.normalize (Vector.make 0.1 0.9 (-0.5)), 1.2)) (Material.chessboard (Color.make 1. 1. 1.) (Color.make 0. 0. 0.) 0.2 0. 1.0 0.7) in let light = Light.make (Vector.make 5. 10. (-1.)) (Color.make 0.8 0.8 0.8) 10. in let light1 = Light.make (Vector.make (-3.) 5. (-15.)) (Color.make 0.8 0.8 0.8) 100. in let scene = Scene.make camera [| plane; sphere; sphere1 |] [| light; light1 |] background in let image_width = 100 in let image_height = 100 in let pixel_size = 5, 5 in let render_diffuse = true in let render_shadows = true in let render_highlights = true in let render_reflections = true in let ray_depth = 2 in let engine = Engine.make image_width image_height (fst pixel_size) (snd pixel_size) render_diffuse render_shadows render_highlights render_reflections ray_depth in Engine.render_scene engine scene None let _ = for _ = 0 to 99 do render_scene () done js_of_ocaml-3.5.2/benchmarks/sources/ml/soli.ml000066400000000000000000000071071357507750000215220ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: soli.ml 2553 1999-11-17 18:59:06Z xleroy $ *) type peg = | Out | Empty | Peg let board = [| [| Out; Out; Out; Out; Out; Out; Out; Out; Out |] ; [| Out; Out; Out; Peg; Peg; Peg; Out; Out; Out |] ; [| Out; Out; Out; Peg; Peg; Peg; Out; Out; Out |] ; [| Out; Peg; Peg; Peg; Peg; Peg; Peg; Peg; Out |] ; [| Out; Peg; Peg; Peg; Empty; Peg; Peg; Peg; Out |] ; [| Out; Peg; Peg; Peg; Peg; Peg; Peg; Peg; Out |] ; [| Out; Out; Out; Peg; Peg; Peg; Out; Out; Out |] ; [| Out; Out; Out; Peg; Peg; Peg; Out; Out; Out |] ; [| Out; Out; Out; Out; Out; Out; Out; Out; Out |] |] (* let print_peg = function Out -> print_string "." | Empty -> print_string " " | Peg -> print_string "$" let print_board board = for i=0 to 8 do for j=0 to 8 do print_peg board.(i).(j) done; print_newline() done *) type direction = { dx : int ; dy : int } let dir = [| { dx = 0; dy = 1 }; { dx = 1; dy = 0 }; { dx = 0; dy = -1 }; { dx = -1; dy = 0 } |] type move = { x1 : int ; y1 : int ; x2 : int ; y2 : int } let moves = Array.make 31 { x1 = 0; y1 = 0; x2 = 0; y2 = 0 } let counter = ref 0 exception Found let rec solve m = counter := !counter + 1; if m = 31 then match board.(4).(4) with | Peg -> true | _ -> false else try (* if !counter mod 500 = 0 then begin print_int !counter; print_newline() end; *) for i = 1 to 7 do for j = 1 to 7 do match board.(i).(j) with | Peg -> for k = 0 to 3 do let d1 = dir.(k).dx in let d2 = dir.(k).dy in let i1 = i + d1 in let i2 = i1 + d1 in let j1 = j + d2 in let j2 = j1 + d2 in match board.(i1).(j1) with | Peg -> ( match board.(i2).(j2) with | Empty -> (* print_int i; print_string ", "; print_int j; print_string ") dir "; print_int k; print_string "\n"; *) board.(i).(j) <- Empty; board.(i1).(j1) <- Empty; board.(i2).(j2) <- Peg; if solve (m + 1) then ( moves.(m) <- { x1 = i; y1 = j; x2 = i2; y2 = j2 }; raise Found); board.(i).(j) <- Peg; board.(i1).(j1) <- Peg; board.(i2).(j2) <- Empty | _ -> ()) | _ -> () done | _ -> () done done; false with Found -> true let _ = if solve 0 then ( (*print_string "\n"; print_board board*) ) else assert false js_of_ocaml-3.5.2/benchmarks/sources/ml/splay.ml000066400000000000000000000206271357507750000217060ustar00rootroot00000000000000(* // Copyright 2009 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This benchmark is based on a JavaScript log processing module used // by the V8 profiler to generate execution time profiles for runs of // JavaScript applications, and it effectively measures how fast the // JavaScript engine is at allocating nodes and reclaiming the memory // used for old nodes. Because of the way splay trees work, the engine // also has to deal with a lot of changes to the large tree object // graph. *) (* Translation in ocaml by VB: This program is probably not the best splay tree implementation in OCaml, because it tries to follow exactly the steps of the Google v8 benchmark. *) let kSplayTreeSize = 8000 let kSplayTreeModifications = 80 let kSplayTreePayloadDepth = 5 type content_leaf = { array : int array ; string : string } type content = | CLeaf of content_leaf | CNode of content * content type tree = | Empty | Node of (tree * float * content * tree) (** * Perform the splay operation for the given key. Moves the node with * the given key to the top of the tree. If no node has the given * key, the last node on the search path is moved to the top of the * tree. This is the simplified top-down splaying algorithm from: * "Self-adjusting Binary Search Trees" by Sleator and Tarjan *) let rec splay_ ((left, key, value, right) as a) k = if k = key then a else if k < key then match left with | Empty -> a (* not found *) | Node (lleft, lk, lv, lright) -> ( if k = lk then lleft, lk, lv, Node (lright, key, value, right) (* zig *) else if k < lk then match lleft with | Empty -> Empty, lk, lv, Node (lright, key, value, right) (* not found *) | Node n -> (* zig-zig *) let llleft, llk, llv, llright = splay_ n k in llleft, llk, llv, Node (llright, lk, lv, Node (lright, key, value, right)) else match lright with | Empty -> lleft, lk, lv, Node (Empty, key, value, right) | Node n -> (* zig-zag *) let lrleft, lrk, lrv, lrright = splay_ n k in Node (lleft, lk, lv, lrleft), lrk, lrv, Node (lrright, key, value, right)) else match right with | Empty -> a | Node (rleft, rk, rv, rright) -> ( if k = rk then Node (left, key, value, rleft), rk, rv, rright (* zag *) else if k > rk then match rright with | Empty -> Node (left, key, value, rleft), rk, rv, rright (* not found *) | Node n -> (* zag-zag *) let rrleft, rrk, rrv, rrright = splay_ n k in Node (Node (left, key, value, rleft), rk, rv, rrleft), rrk, rrv, rrright else match rleft with | Empty -> Node (left, key, value, rleft), rk, rv, rright (* not found *) | Node n -> (* zag-zig *) let rlleft, rlk, rlv, rlright = splay_ n k in Node (left, key, value, rlleft), rlk, rlv, Node (rlright, rk, rv, rright)) let splay t key = match t with | Empty -> t | Node n -> Node (splay_ n key) let insert key value t = (* Splay on the key to move the last node on the search path for the key to the root of the tree.*) let t = splay t key in match t with | Empty -> Node (Empty, key, value, Empty) | Node (left, rk, rv, right) -> if rk = key then t else if key > rk then Node (Node (left, rk, rv, Empty), key, value, right) else Node (left, key, value, Node (Empty, rk, rv, right)) let remove key t = let t = splay t key in match t with | Empty -> t | Node (_, rk, _, _) when rk <> key -> raise Not_found | Node (Empty, _, _, right) -> right | Node (left, _, _, right) -> ( match splay left key with | Node (lleft, lk, lv, Empty) -> Node (lleft, lk, lv, right) | _ -> failwith "remove") let find key t = let t = splay t key in match t with | Node (_, k, v, _) when k = key -> Some v, t | _ -> None, t let rec findMax = function (* here we do not splay (but that's what the original program does) *) | Empty -> raise Not_found | Node (_, k, _, Empty) -> k | Node (_, _, _, right) -> findMax right let findGreatestLessThan key t = (* Splay on the key to move the node with the given key or the last node on the search path to the top of the tree. Now the result is either the root node or the greatest node in the left subtree. *) let t = splay t key in match t with | Empty -> None, t | Node (_, k, _, _) when k < key -> Some k, t | Node (Empty, _, _, _) -> None, t | Node (left, _, _, _) -> Some (findMax left), t let exportKeys t = let rec aux l length = function | Empty -> l, length | Node (left, k, _, right) -> let l, length = aux l length right in aux (k :: l) (length + 1) left in aux [] 0 t let rec generatePayloadTree depth tag = if depth = 0 then CLeaf { array = [| 0; 1; 2; 3; 4; 5; 6; 7; 8; 9 |] ; string = "String for key " ^ tag ^ " in leaf node" } else CNode (generatePayloadTree (depth - 1) tag, generatePayloadTree (depth - 1) tag) let random = let seed = ref 49734321 in fun () -> (* // Robert Jenkins' 32 bit integer hash function. *) let s = !seed in let s = (s + 0x7ed55d16 + (s lsl 12)) land 0xffffffff in let s = s lxor 0xc761c23c lxor (s lsr 19) in let s = s + 0x165667b1 + (s lsl 5) in let s = (s + 0xd3a2646c) lxor (s lsl 9) in let s = (s + 0xfd7046c5 + (s lsl 3)) land 0xffffffff in let s = s lxor 0xb55a4f09 lxor (s lsr 16) in seed := s; float (s land 0xfffffff) /. float 0x10000000 let generateKey = random let insertNewNode t = let rec aux t = let key = generateKey () in let vo, t = find key t in match vo with | None -> key, t | _ -> aux t in let key, t = aux t in let payload = generatePayloadTree kSplayTreePayloadDepth (string_of_float key) in key, insert key payload t let splaySetup () = let rec aux i t = if i < kSplayTreeSize then aux (i + 1) (snd (insertNewNode t)) else t in aux 0 Empty let splayTearDown t = let keys, length = exportKeys t in (* // Verify that the splay tree has the right size. *) if length <> kSplayTreeSize then failwith "Splay tree has wrong size"; (* // Verify that the splay tree has sorted, unique keys. *) match keys with | [] -> () | a :: l -> ignore (List.fold_left (fun b e -> if b >= e then failwith "Splay tree not sorted" else e) a l) let splayRun t = (* // Replace a few nodes in the splay tree. *) let rec aux i t = if i < kSplayTreeModifications then let key, t = insertNewNode t in aux (i + 1) (match findGreatestLessThan key t with | None, t -> remove key t | Some k, t -> remove k t) else t in aux 0 t let ( ++ ) a b = b a let () = splaySetup () ++ splayRun ++ splayTearDown js_of_ocaml-3.5.2/benchmarks/sources/ml/takc.ml000066400000000000000000000022021357507750000214650ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: takc.ml 7017 2005-08-12 09:22:04Z xleroy $ *) let rec tak x y z = if x > y then tak (tak (x - 1) y z) (tak (y - 1) z x) (tak (z - 1) x y) else z let rec repeat n accu = if n <= 0 then accu else repeat (n - 1) (tak 18 12 6 + accu) let _ = assert (repeat 2000 0 = 14000) (* print_int (repeat 2000); print_newline(); exit 0 *) js_of_ocaml-3.5.2/benchmarks/sources/ml/taku.ml000066400000000000000000000021251357507750000215130ustar00rootroot00000000000000(***********************************************************************) (* *) (* Objective Caml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed *) (* under the terms of the Q Public License version 1.0. *) (* *) (***********************************************************************) (* $Id: taku.ml 7017 2005-08-12 09:22:04Z xleroy $ *) let rec tak (x, y, z) = if x > y then tak (tak (x - 1, y, z), tak (y - 1, z, x), tak (z - 1, x, y)) else z let rec repeat n accu = if n <= 0 then accu else repeat (n - 1) (tak (18, 12, 6) + accu) let _ = assert (repeat 2000 0 = 14000) js_of_ocaml-3.5.2/benchmarks/utils/000077500000000000000000000000001357507750000172625ustar00rootroot00000000000000js_of_ocaml-3.5.2/benchmarks/utils/remove_comments.pl000077500000000000000000000001471357507750000230260ustar00rootroot00000000000000#!/usr/bin/perl $/ = undef; $_ = <>; s#\(\*[^*]*\*+([^)*][^*]*\*+)*\)#defined $2 ? $2 : ""#gse; print; js_of_ocaml-3.5.2/compiler/000077500000000000000000000000001357507750000156175ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/commonArg.ml000066400000000000000000000071261357507750000201010ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml_compiler open Js_of_ocaml_compiler.Stdlib open Cmdliner type 'a on_off = { enable : 'a ; disable : 'a } type t = { debug : string list on_off ; optim : string list on_off ; quiet : bool ; custom_header : string option } let debug = let doc = "enable debug [$(docv)]." in let all = List.map (Debug.available ()) ~f:(fun s -> s, s) in let arg = Arg.(value & opt_all (list (enum all)) [] & info [ "debug" ] ~docv:"SECTION" ~doc) in Term.(pure List.flatten $ arg) let enable = let doc = "Enable optimization [$(docv)]." in let all = List.map (Config.Flag.available ()) ~f:(fun s -> s, s) in let arg = Arg.(value & opt_all (list (enum all)) [] & info [ "enable" ] ~docv:"OPT" ~doc) in Term.(pure List.flatten $ arg) let disable = let doc = "Disable optimization [$(docv)]." in let all = List.map (Config.Flag.available ()) ~f:(fun s -> s, s) in let arg = Arg.(value & opt_all (list (enum all)) [] & info [ "disable" ] ~docv:"OPT" ~doc) in Term.(pure List.flatten $ arg) let pretty = let doc = "Pretty print the output." in Arg.(value & flag & info [ "pretty" ] ~doc) let debuginfo = let doc = "Output debug information." in Arg.(value & flag & info [ "debuginfo"; "debug-info" ] ~doc) let noinline = let doc = "Disable inlining." in Arg.(value & flag & info [ "noinline"; "no-inline" ] ~doc) let is_quiet = let doc = "suppress non-error messages." in Arg.(value & flag & info [ "quiet"; "q" ] ~doc) let custom_header = let doc = "Provide a custom header for the generated JavaScript file, useful for making the \ script an executable file with #!/usr/bin/env node" in Arg.(value & opt (some string) None & info [ "custom-header" ] ~doc) let t = Term.( pure (fun debug enable disable pretty debuginfo noinline quiet c_header -> let enable = if pretty then "pretty" :: enable else enable in let enable = if debuginfo then "debuginfo" :: enable else enable in let disable = if noinline then "inline" :: disable else disable in let disable_if_pretty name disable = if pretty && not (List.mem name ~set:enable) then name :: disable else disable in let disable = disable_if_pretty "shortvar" disable in let disable = disable_if_pretty "share" disable in { debug = { enable = debug; disable = [] } ; optim = { enable; disable } ; quiet ; custom_header = c_header }) $ debug $ enable $ disable $ pretty $ debuginfo $ noinline $ is_quiet $ custom_header) let on_off on off t = List.iter ~f:on t.enable; List.iter ~f:off t.disable let eval t = Config.Flag.(on_off enable disable t.optim); Debug.(on_off enable disable t.debug); quiet := t.quiet js_of_ocaml-3.5.2/compiler/commonArg.mli000066400000000000000000000021111357507750000202370ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type 'a on_off = { enable : 'a ; disable : 'a } type t = { debug : string list on_off ; optim : string list on_off ; quiet : bool ; custom_header : string option } val t : t Cmdliner.Term.t val eval : t -> unit js_of_ocaml-3.5.2/compiler/compileArg.ml000066400000000000000000000256121357507750000202410ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Js_of_ocaml_compiler.Stdlib open Js_of_ocaml_compiler open Cmdliner type t = { common : CommonArg.t ; (* compile option *) profile : Driver.profile option ; source_map : (string option * Source_map.t) option ; runtime_files : string list ; runtime_only : bool ; output_file : [ `Name of string | `Stdout ] * bool ; input_file : string option ; params : (string * string) list ; static_env : (string * string) list ; wrap_with_fun : string option ; (* toplevel *) dynlink : bool ; linkall : bool ; toplevel : bool ; export_file : string option ; nocmis : bool ; (* filesystem *) include_dir : string list ; fs_files : string list ; fs_output : string option ; fs_external : bool ; keep_unit_names : bool } let options = let toplevel_section = "OPTIONS (TOPLEVEL)" in let filesystem_section = "OPTIONS (FILESYSTEM)" in let js_files = let doc = "Link JavaScript files [$(docv)]. " ^ "One can refer to path relative to Findlib packages with " ^ "the syntax '+pkg_name/file.js'" in Arg.(value & pos_left ~rev:true 0 string [] & info [] ~docv:"JS_FILES" ~doc) in let output_file = let doc = "Set output file name to [$(docv)]." in Arg.(value & opt (some string) None & info [ "o" ] ~docv:"FILE" ~doc) in let input_file = let doc = "Compile the bytecode program [$(docv)]. " ^ "Use '-' to read from the standard input instead." in Arg.(required & pos ~rev:true 0 (some string) None & info [] ~docv:"PROGRAM" ~doc) in let keep_unit_names = let doc = "Keep unit name" in Arg.(value & flag & info [ "keep-unit-names" ] ~doc) in let profile = let doc = "Set optimization profile : [$(docv)]." in let profile = List.map Driver.profiles ~f:(fun (i, p) -> string_of_int i, p) in Arg.(value & opt (some (enum profile)) None & info [ "opt" ] ~docv:"NUM" ~doc) in let noruntime = let doc = "Do not include the standard runtime." in Arg.(value & flag & info [ "noruntime"; "no-runtime" ] ~doc) in let runtime_only = let doc = "Generate a JavaScript file containing/exporting the runtime only." in Arg.(value & flag & info [ "runtime-only" ] ~doc) in let no_sourcemap = let doc = "Don't generate source map. All other source map related flags will be be ignored." in Arg.(value & flag & info [ "no-sourcemap"; "no-source-map" ] ~doc) in let sourcemap = let doc = "Generate source map." in Arg.(value & flag & info [ "sourcemap"; "source-map" ] ~doc) in let sourcemap_inline_in_js = let doc = "Inline sourcemap in the generated JavaScript." in Arg.(value & flag & info [ "source-map-inline" ] ~doc) in let sourcemap_don't_inline_content = let doc = "Do not inline sources in source map." in Arg.(value & flag & info [ "source-map-no-source" ] ~doc) in let sourcemap_root = let doc = "root dir for source map." in Arg.(value & opt (some string) None & info [ "source-map-root" ] ~doc) in let wrap_with_function = let doc = "Wrap the generated JavaScript code inside a function that needs to be applied \ with the global object." in Arg.(value & opt (some string) None & info [ "wrap-with-fun" ] ~doc) in let set_param = let doc = "Set compiler options." in let all = List.map (Config.Param.all ()) ~f:(fun (x, _) -> x, x) in Arg.( value & opt_all (list (pair ~sep:'=' (enum all) string)) [] & info [ "set" ] ~docv:"PARAM=VALUE" ~doc) in let set_env = let doc = "Set environment variable statically." in Arg.( value & opt_all (list (pair ~sep:'=' string string)) [] & info [ "setenv" ] ~docv:"PARAM=VALUE" ~doc) in let toplevel = let doc = "Compile a toplevel." in Arg.(value & flag & info [ "toplevel" ] ~docs:toplevel_section ~doc) in let export_file = let doc = "File containing the list of unit to export in a toplevel." in Arg.(value & opt (some string) None & info [ "export" ] ~docs:toplevel_section ~doc) in let linkall = let doc = "Link all primitives." in Arg.(value & flag & info [ "linkall" ] ~doc) in let dynlink = let doc = "Enable dynlink." in Arg.(value & flag & info [ "dynlink" ] ~doc) in let nocmis = let doc = "Do not include cmis when compiling toplevel." in Arg.(value & flag & info [ "nocmis"; "no-cmis" ] ~docs:toplevel_section ~doc) in let include_dir = let doc = "Add [$(docv)] to the list of include directories." in Arg.( value & opt_all string [] & info [ "I" ] ~docs:filesystem_section ~docv:"DIR" ~doc) in let fs_files = let doc = "Register [$(docv)] to the pseudo filesystem." in Arg.( value & opt_all string [] & info [ "file" ] ~docs:filesystem_section ~docv:"FILE" ~doc) in let fs_external = Arg.( value & vflag true [ ( true , info [ "extern-fs" ] ~docs:filesystem_section ~doc: "Configure pseudo-filesystem to allow registering files from outside. \ (default)" ) ; ( false , info [ "no-extern-fs" ] ~docs:filesystem_section ~doc: "Configure pseudo-filesystem to NOT allow registering files from \ outside." ) ]) in let fs_output = let doc = "Output the filesystem to [$(docv)]." in Arg.( value & opt (some string) None & info [ "ofs" ] ~docs:filesystem_section ~docv:"FILE" ~doc) in let build_t common set_param set_env dynlink linkall toplevel export_file wrap_with_fun include_dir fs_files fs_output fs_external nocmis profile noruntime runtime_only no_sourcemap sourcemap sourcemap_inline_in_js sourcemap_don't_inline_content sourcemap_root output_file input_file js_files keep_unit_names = let chop_extension s = try Filename.chop_extension s with Invalid_argument _ -> s in let runtime_files = js_files in let runtime_files = if noruntime then runtime_files else "+runtime.js" :: runtime_files in let runtime_files = if runtime_only && Filename.check_suffix input_file ".js" then runtime_files @ [ input_file ] else runtime_files in let linkall = linkall || toplevel || runtime_only in let fs_external = fs_external || (toplevel && nocmis) || runtime_only in let input_file = match input_file, runtime_only with | "-", _ | _, true -> None | x, false -> Some x in let output_file = match output_file with | Some "-" -> `Stdout, true | Some s -> `Name s, true | None -> ( match input_file with | Some s -> `Name (chop_extension s ^ ".js"), false | None -> `Stdout, false) in let source_map = if (not no_sourcemap) && (sourcemap || sourcemap_inline_in_js) then let file, sm_output_file = match output_file with | `Name file, _ when sourcemap_inline_in_js -> file, None | `Name file, _ -> file, Some (chop_extension file ^ ".map") | `Stdout, _ -> "STDIN", None in Some ( sm_output_file , { Source_map.version = 3 ; file ; sourceroot = sourcemap_root ; sources = [] ; sources_content = (if sourcemap_don't_inline_content then None else Some []) ; names = [] ; mappings = [] } ) else None in let source_map = if Option.is_some source_map && not Source_map_io.enabled then ( warn "Warning: '--source-map' flag ignored because js_of_ocaml was compiled without \ sourcemap support (install yojson to enable support)\n\ %!"; None) else source_map in let params : (string * string) list = List.flatten set_param in let static_env : (string * string) list = List.flatten set_env in `Ok { common ; params ; profile ; static_env ; wrap_with_fun ; dynlink ; linkall ; toplevel ; export_file ; include_dir ; runtime_files ; runtime_only ; fs_files ; fs_output ; fs_external ; nocmis ; output_file ; input_file ; source_map ; keep_unit_names } in let t = Term.( pure build_t $ CommonArg.t $ set_param $ set_env $ dynlink $ linkall $ toplevel $ export_file $ wrap_with_function $ include_dir $ fs_files $ fs_output $ fs_external $ nocmis $ profile $ noruntime $ runtime_only $ no_sourcemap $ sourcemap $ sourcemap_inline_in_js $ sourcemap_don't_inline_content $ sourcemap_root $ output_file $ input_file $ js_files $ keep_unit_names) in Term.ret t let info = let doc = "Js_of_ocaml compiler" in let man = [ `S "DESCRIPTION" ; `P "Js_of_ocaml is a compiler from OCaml bytecode to Javascript. It makes it \ possible to run pure OCaml programs in JavaScript environments like web \ browsers and Node.js." ; `S "BUGS" ; `P "Bugs are tracked on github at \ $(i,https://github.com/ocsigen/js_of_ocaml/issues)." ; `S "SEE ALSO" ; `P "ocaml(1)" ; `S "AUTHORS" ; `P "Jerome Vouillon, Hugo Heuzard." ; `S "LICENSE" ; `P "Copyright (C) 2010-2019." ; `P "js_of_ocaml is free software, you can redistribute it and/or modify it under \ the terms of the GNU Lesser General Public License as published by the Free \ Software Foundation, with linking exception; either version 2.1 of the License, \ or (at your option) any later version." ] in let version = match Compiler_version.git_version with | "" -> Compiler_version.s | v -> Printf.sprintf "%s+git-%s" Compiler_version.s v in Term.info "js_of_ocaml" ~version ~doc ~man js_of_ocaml-3.5.2/compiler/compileArg.mli000066400000000000000000000031611357507750000204050ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml_compiler type t = { common : CommonArg.t ; (* compile option *) profile : Driver.profile option ; source_map : (string option * Source_map.t) option ; runtime_files : string list ; runtime_only : bool ; output_file : [ `Name of string | `Stdout ] * bool ; input_file : string option ; params : (string * string) list ; static_env : (string * string) list ; wrap_with_fun : string option ; (* toplevel *) dynlink : bool ; linkall : bool ; toplevel : bool ; export_file : string option ; nocmis : bool ; (* filesystem *) include_dir : string list ; fs_files : string list ; fs_output : string option ; fs_external : bool ; keep_unit_names : bool } val options : t Cmdliner.Term.t val info : Cmdliner.Term.info js_of_ocaml-3.5.2/compiler/dune000066400000000000000000000021211357507750000164710ustar00rootroot00000000000000(executables (names js_of_ocaml jsoo_minify jsoo_link jsoo_fs) (public_names js_of_ocaml jsoo_minify jsoo_link jsoo_fs) (package js_of_ocaml-compiler) (libraries js_of_ocaml-compiler cmdliner compiler-libs.common (select empty-findlib.ml from ;; Only link js_of_ocaml-compiler.findlib-support if it exists (js_of_ocaml-compiler.findlib-support -> empty-findlib.ml.in) ( -> empty-findlib.ml.in)) ) (flags (:standard -safe-string)) ) (rule (targets js_of_ocaml.1) (action (with-stdout-to %{targets} (run %{bin:js_of_ocaml} --help=groff)))) (rule (targets jsoo_link.1) (action (with-stdout-to %{targets} (run %{bin:jsoo_link} --help=groff)))) (rule (targets jsoo_fs.1) (action (with-stdout-to %{targets} (run %{bin:jsoo_fs} --help=groff)))) (rule (targets jsoo_minify.1) (action (with-stdout-to %{targets} (run %{bin:jsoo_minify} --help=groff)))) (install (section man) (package js_of_ocaml-compiler) (files js_of_ocaml.1 jsoo_link.1 jsoo_minify.1 jsoo_fs.1 )) js_of_ocaml-3.5.2/compiler/empty-findlib.ml.in000066400000000000000000000000301357507750000213120ustar00rootroot00000000000000(* Empty on purpose. *) js_of_ocaml-3.5.2/compiler/findlib-support/000077500000000000000000000000001357507750000207405ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/findlib-support/dune000066400000000000000000000002651357507750000216210ustar00rootroot00000000000000(library (name jsoo_findlib_support) (libraries js_of_ocaml-compiler findlib) (optional) (public_name js_of_ocaml-compiler.findlib-support) (library_flags (-linkall)) ) js_of_ocaml-3.5.2/compiler/findlib-support/jsoo_findlib_support.ml000066400000000000000000000020331357507750000255250ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2015 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) let () = let findlib_init = lazy (Findlib.init ()) in Js_of_ocaml_compiler.Findlib.set_find_pkg_dir (fun pkg -> Lazy.force findlib_init; Findlib.package_directory pkg) js_of_ocaml-3.5.2/compiler/findlib-support/jsoo_findlib_support.mli000066400000000000000000000000141357507750000256730ustar00rootroot00000000000000(* Empty *) js_of_ocaml-3.5.2/compiler/js_of_ocaml.ml000066400000000000000000000264421357507750000204340ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Js_of_ocaml_compiler.Stdlib open Js_of_ocaml_compiler let times = Debug.find "times" let debug_mem = Debug.find "mem" let _ = Sys.catch_break true let gen_unit_filename dir u = Filename.concat dir (Printf.sprintf "%s.js" u.Cmo_format.cu_name) let f { CompileArg.common ; profile ; source_map ; runtime_files ; input_file ; output_file ; params ; static_env ; wrap_with_fun ; dynlink ; linkall ; toplevel ; nocmis ; runtime_only ; include_dir ; fs_files ; fs_output ; fs_external ; export_file ; keep_unit_names } = let dynlink = dynlink || toplevel || runtime_only in let custom_header = common.CommonArg.custom_header in let global = match wrap_with_fun with | Some fun_name -> `Bind_to fun_name | None -> `Auto in CommonArg.eval common; (match output_file with | `Stdout, _ -> () | `Name name, _ when debug_mem () -> Debug.start_profiling name | `Name _, _ -> ()); List.iter params ~f:(fun (s, v) -> Config.Param.set s v); List.iter static_env ~f:(fun (s, v) -> Eval.set_static_env s v); let t = Timer.make () in let include_dir = List.map include_dir ~f:(fun d -> match Findlib.path_require_findlib d with | Some d -> let pkg, d' = match String.split ~sep:Filename.dir_sep d with | [] -> assert false | [ d ] -> "js_of_ocaml", d | pkg :: l -> pkg, List.fold_left l ~init:"" ~f:Filename.concat in Filename.concat (Findlib.find_pkg_dir pkg) d' | None -> d) in let exported_unit = match export_file with | None -> None | Some file -> if not (Sys.file_exists file) then failwith (Printf.sprintf "export file %S does not exists" file); let ic = open_in file in let t = Hashtbl.create 17 in (try while true do Hashtbl.add t (input_line ic) () done; assert false with End_of_file -> ()); close_in ic; Some (Hashtbl.fold (fun cmi () acc -> cmi :: acc) t []) in Linker.load_files runtime_files; let paths = try List.append include_dir [ Findlib.find_pkg_dir "stdlib" ] with Not_found -> include_dir in if times () then Format.eprintf "Start parsing...@."; let need_debug = Option.is_some source_map || Config.Flag.debuginfo () in let check_debug debug = if (not runtime_only) && Option.is_some source_map && Parse_bytecode.Debug.is_empty debug then warn "Warning: '--source-map' is enabled but the bytecode program was compiled with \ no debugging information.\n\ Warning: Consider passing '-g' option to ocamlc.\n\ %!" in let pseudo_fs_instr prim debug cmis = let cmis = if nocmis then StringSet.empty else cmis in let paths = paths @ StringSet.elements (Parse_bytecode.Debug.paths debug ~units:cmis) in PseudoFs.f ~prim ~cmis ~files:fs_files ~paths in let env_instr () = List.map static_env ~f:(fun (k, v) -> Primitive.add_external "caml_set_static_env"; let args = [ Code.Pc (IString k); Code.Pc (IString v) ] in Code.(Let (Var.fresh (), Prim (Extern "caml_set_static_env", args)))) in let output (one : Parse_bytecode.one) ~standalone output_file = check_debug one.debug; let init_pseudo_fs = fs_external && standalone in (match output_file with | `Stdout -> let instr = List.concat [ pseudo_fs_instr `caml_create_file one.debug one.cmis ; (if init_pseudo_fs then [ PseudoFs.init () ] else []) ; env_instr () ] in let code = Code.prepend one.code instr in let fmt = Pretty_print.to_out_channel stdout in Driver.f ~standalone ?profile ~linkall ~global ~dynlink ?source_map ?custom_header fmt one.debug code | `Name file -> let fs_instr1, fs_instr2 = match fs_output with | None -> pseudo_fs_instr `caml_create_file one.debug one.cmis, [] | Some _ -> [], pseudo_fs_instr `caml_create_file_extern one.debug one.cmis in Util.gen_file file (fun chan -> let instr = List.concat [ fs_instr1 ; (if init_pseudo_fs then [ PseudoFs.init () ] else []) ; env_instr () ] in let code = Code.prepend one.code instr in let fmt = Pretty_print.to_out_channel chan in Driver.f ~standalone ?profile ~linkall ~global ~dynlink ?source_map ?custom_header fmt one.debug code); Option.iter fs_output ~f:(fun file -> Util.gen_file file (fun chan -> let instr = fs_instr2 in let code = Code.prepend Code.empty instr in let pfs_fmt = Pretty_print.to_out_channel chan in Driver.f ~standalone ?profile ?custom_header ~global pfs_fmt one.debug code))); if times () then Format.eprintf "compilation: %a@." Timer.print t in (if runtime_only then let code : Parse_bytecode.one = { code = Parse_bytecode.predefined_exceptions () ; cmis = StringSet.empty ; debug = Parse_bytecode.Debug.create ~toplevel:false false } in output code ~standalone:true (fst output_file) else let kind, ic, close_ic = match input_file with | None -> Parse_bytecode.from_channel stdin, stdin, fun () -> () | Some fn -> let ch = open_in_bin fn in let res = Parse_bytecode.from_channel ch in res, ch, fun () -> close_in ch in (match kind with | `Exe -> let t1 = Timer.make () in let code = Parse_bytecode.from_exe ~includes:paths ~toplevel ?exported_unit ~dynlink ~debug:need_debug ic in if times () then Format.eprintf " parsing: %a@." Timer.print t1; output code ~standalone:true (fst output_file) | `Cmo cmo -> let output_file = match output_file, keep_unit_names with | (`Stdout, false), true -> `Name (gen_unit_filename "./" cmo) | (`Name x, false), true -> `Name (gen_unit_filename (Filename.dirname x) cmo) | (`Stdout, _), false -> `Stdout | (`Name x, _), false -> `Name x | (`Name x, true), true when String.length x > 0 && Char.equal x.[String.length x - 1] '/' -> `Name (gen_unit_filename x cmo) | (`Name _, true), true | (`Stdout, true), true -> failwith "use [-o dirname/] or remove [--keep-unit-names]" in let t1 = Timer.make () in let code = Parse_bytecode.from_cmo ~includes:paths ~toplevel ~debug:need_debug cmo ic in if times () then Format.eprintf " parsing: %a@." Timer.print t1; output code ~standalone:false output_file | `Cma cma when keep_unit_names -> List.iter cma.lib_units ~f:(fun cmo -> let output_file = match output_file with | `Stdout, false -> `Name (gen_unit_filename "./" cmo) | `Name x, false -> `Name (gen_unit_filename (Filename.dirname x) cmo) | `Name x, true when String.length x > 0 && Char.equal x.[String.length x - 1] '/' -> `Name (gen_unit_filename x cmo) | `Stdout, true | `Name _, true -> failwith "use [-o dirname/] or remove [--keep-unit-names]" in let t1 = Timer.make () in let code = Parse_bytecode.from_cmo ~includes:paths ~toplevel ~debug:need_debug cmo ic in if times () then Format.eprintf " parsing: %a (%s)@." Timer.print t1 cmo.cu_name; output code ~standalone:false output_file) | `Cma cma -> let t1 = Timer.make () in let code = Parse_bytecode.from_cma ~includes:paths ~toplevel ~debug:need_debug cma ic in if times () then Format.eprintf " parsing: %a@." Timer.print t1; output code ~standalone:false (fst output_file)); close_ic ()); Debug.stop_profiling () let main = Cmdliner.Term.(pure f $ CompileArg.options), CompileArg.info let _ = Timer.init Sys.time; try Cmdliner.Term.eval ~catch:false ~argv:(Util.normalize_argv ~warn_:true Sys.argv) main with | (Match_failure _ | Assert_failure _ | Not_found) as exc -> let backtrace = Printexc.get_backtrace () in Format.eprintf "%s: You found a bug. Please report it at \ https://github.com/ocsigen/js_of_ocaml/issues :@." Sys.argv.(0); Format.eprintf "Error: %s@." (Printexc.to_string exc); prerr_string backtrace; exit 1 | Magic_number.Bad_magic_number s -> Format.eprintf "%s: Error: Not an ocaml bytecode file@." Sys.argv.(0); Format.eprintf "%s: Error: Invalid magic number %S@." Sys.argv.(0) s; exit 1 | Magic_number.Bad_magic_version h -> Format.eprintf "%s: Error: Bytecode version mismatch.@." Sys.argv.(0); let k = match Magic_number.kind h with | (`Cmo | `Cma | `Exe) as x -> x | `Other _ -> assert false in let comp = if Magic_number.compare h (Magic_number.current k) < 0 then "an older" else "a newer" in Format.eprintf "%s: Error: Your ocaml bytecode and the js_of_ocaml compiler have to be compiled \ with the same version of ocaml.@." Sys.argv.(0); Format.eprintf "%s: Error: The Js_of_ocaml compiler has been compiled with ocaml version %s.@." Sys.argv.(0) Sys.ocaml_version; Format.eprintf "%s: Error: Its seems that your ocaml bytecode has been compiled with %s version \ of ocaml.@." Sys.argv.(0) comp; exit 1 | Failure s -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) s; exit 1 | exc -> let backtrace = Printexc.get_backtrace () in Format.eprintf "%s: Error: %s@." Sys.argv.(0) (Printexc.to_string exc); prerr_string backtrace; exit 1 js_of_ocaml-3.5.2/compiler/js_of_ocaml.mli000066400000000000000000000000141357507750000205700ustar00rootroot00000000000000(* Empty *) js_of_ocaml-3.5.2/compiler/jsoo-testsuite/000077500000000000000000000000001357507750000206205ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/jsoo-testsuite/bigarray_stubs.c000066400000000000000000000022541357507750000240070ustar00rootroot00000000000000#include #include static inline char * get_bstr(value v_bstr, value v_pos) { return (char *) Caml_ba_data_val(v_bstr) + Long_val(v_pos); } CAMLprim value caml_bigstring_blit_string_to_ba( value v_str, value v_src_pos, value v_bstr, value v_dst_pos, value v_len) { unsigned char *str = Bytes_val(v_str) + Long_val(v_src_pos); char *bstr = get_bstr(v_bstr, v_dst_pos); memcpy(bstr, str, Long_val(v_len)); return Val_unit; } CAMLprim value caml_bigstring_blit_ba_to_bytes( value v_bstr, value v_src_pos, value v_str, value v_dst_pos, value v_len) { char *bstr = get_bstr(v_bstr, v_src_pos); unsigned char *str = Bytes_val(v_str) + Long_val(v_dst_pos); memcpy(str, bstr, Long_val(v_len)); return Val_unit; } CAMLprim value caml_bigstring_blit_ba_to_ba( value v_src, value v_src_pos, value v_dst, value v_dst_pos, value v_len) { struct caml_ba_array *ba_src = Caml_ba_array_val(v_src); struct caml_ba_array *ba_dst = Caml_ba_array_val(v_dst); char *src = (char *) ba_src->data + Long_val(v_src_pos); char *dst = (char *) ba_dst->data + Long_val(v_dst_pos); size_t len = Long_val(v_len); memmove(dst, src, len); return Val_unit; } js_of_ocaml-3.5.2/compiler/jsoo-testsuite/dune000066400000000000000000000002451357507750000214770ustar00rootroot00000000000000(library (name jsoo_testsuite) (libraries) (c_names bigarray_stubs) (inline_tests (flags -allow-output-patterns) (modes js)) (preprocess (pps ppx_expect))) js_of_ocaml-3.5.2/compiler/jsoo-testsuite/test_bigarray.ml000066400000000000000000000173701357507750000240210ustar00rootroot00000000000000open! Stdlib open StdLabels open Bigarray module Complex = struct type t = Complex.t = { re : float ; im : float } let to_string { re; im } = Printf.sprintf "%g+%gi" re im let of_string s = match String.split_on_char ~sep:'+' s with | [ x ] -> if x.[String.length x - 2] = 'i' then { re = 0. ; im = Float.of_string (String.sub x ~pos:0 ~len:(String.length x - 1)) } else { re = Float.of_string x; im = 0. } | [ x; y ] -> assert (y.[String.length y - 2] = 'i'); { re = Float.of_string x ; im = Float.of_string (String.sub y ~pos:0 ~len:(String.length y - 1)) } | _ -> assert false end module Char = struct let to_string = Printf.sprintf "'%C'" let code = Char.code let chr = Char.chr end let from_list kind vals = let a = Array1.create kind c_layout (List.length vals) in let rec set i = function | [] -> () | hd :: tl -> a.{i} <- hd; set (i + 1) tl in set 0 vals; a let%expect_test "compare elt" = let test kind to_string a b = let op c = if c = 0 then "=" else if c < 0 then "<" else if c > 0 then ">" else "??" in let c = compare a b in let c' = compare (from_list kind [ a ]) (from_list kind [ b ]) in if c' = c then Printf.printf "%s %s %s: Bigarray compare the same\n" (to_string a) (op c) (to_string b) else Printf.printf "%s %s %s vs %s %s %s: Bigarray compare differently\n" (to_string a) (op c) (to_string b) (to_string a) (op c') (to_string b) in test int64 Int64.to_string 0x0000000110000000L 0x0000001001000000L; [%expect {| 4563402752 < 68736253952: Bigarray compare the same |}]; test int64 Int64.to_string 8796093022210L 17592186044417L; [%expect {| 8796093022210 < 17592186044417: Bigarray compare the same |}]; test int64 Int64.to_string 0xffffffffL 0x0fffffffL; [%expect {| 4294967295 > 268435455: Bigarray compare the same |}]; test int32 Int32.to_string 0x00011000l 0x00100100l; [%expect {| 69632 < 1048832: Bigarray compare the same |}]; test int32 Int32.to_string 0xffff0000l 0x0000ffffl; [%expect {| -65536 < 65535: Bigarray compare the same |}]; test complex32 Complex.to_string { re = 1.0; im = 0.0 } { re = 0.0; im = 1.0 }; [%expect {| 1+0i > 0+1i: Bigarray compare the same |}]; test complex64 Complex.to_string { re = 1.0; im = 0.0 } { re = 0.0; im = 1.0 }; [%expect {| 1+0i > 0+1i: Bigarray compare the same |}]; test float32 Float.to_string 1.0 0.0; [%expect {| 1. > 0.: Bigarray compare the same |}]; test float32 Float.to_string nan nan; [%expect {| nan = nan: Bigarray compare the same |}]; test float64 Float.to_string 0.0 1.0; [%expect {| 0. < 1.: Bigarray compare the same |}]; test float64 Float.to_string nan nan; [%expect {| nan = nan: Bigarray compare the same |}]; test int8_signed Int.to_string (-1) 1; [%expect {| -1 < 1: Bigarray compare the same |}]; test int8_unsigned Int.to_string (-1) 1; [%expect {| -1 < 1 vs -1 > 1: Bigarray compare differently |}]; test int8_unsigned Int.to_string 2 3; [%expect {| 2 < 3: Bigarray compare the same |}]; test int16_signed Int.to_string (-1) 1; [%expect {| -1 < 1: Bigarray compare the same |}]; test int16_unsigned Int.to_string (-1) 1; [%expect {| -1 < 1 vs -1 > 1: Bigarray compare differently |}]; test int16_unsigned Int.to_string 2 3; [%expect {| 2 < 3: Bigarray compare the same |}]; test int Int.to_string (-65536) 65535; [%expect {| -65536 < 65535: Bigarray compare the same |}]; test int Int.to_string 0x00011000 0x00100100; [%expect {| 69632 < 1048832: Bigarray compare the same |}]; test nativeint Nativeint.to_string (-65536n) 65535n; [%expect {| -65536 < 65535: Bigarray compare the same |}]; test nativeint Nativeint.to_string 0x00011000n 0x00100100n; [%expect {| 69632 < 1048832: Bigarray compare the same |}]; test char Char.to_string '\000' '\001'; [%expect {| ''\000'' < ''\001'': Bigarray compare the same |}]; test char Char.to_string '\255' '\000'; [%expect {| ''\255'' > ''\000'': Bigarray compare the same |}] let%expect_test "compare" = let test (type a b) (a : a) (b : b) = let c = compare (Obj.magic a) (Obj.magic b) in let s = if c = 0 then "Eq" else if c < 0 then "<" else ">" in Printf.printf "%s\n" s in (* different kind *) test (Array1.create int8_signed c_layout 1) (Array1.create char c_layout 1); [%expect {| > |}]; test (Array1.create char c_layout 1) (Array1.create int8_signed c_layout 1); [%expect {| < |}]; test (Array1.create int64 c_layout 1) (Array1.create char c_layout 1); [%expect {| > |}]; test (Array1.create char c_layout 1) (Array1.create int64 c_layout 1); [%expect {| < |}]; (* different layout *) test (Array1.create char c_layout 1) (Array1.create char fortran_layout 1); [%expect {| > |}]; test (Array1.create char fortran_layout 1) (Array1.create char c_layout 1); [%expect {| < |}]; (* different size *) test (Array1.create char c_layout 1) (Array1.create char c_layout 2); [%expect {| < |}]; test (Array1.create char c_layout 2) (Array1.create char c_layout 1); [%expect {| > |}]; test (Array2.create char c_layout 1 2) (Array1.create char c_layout 2); [%expect {| < |}]; test (Array2.create char c_layout 1 2) (Array2.create char c_layout 2 1); [%expect {| < |}]; test (Array2.create char c_layout 2 1) (Array2.create char c_layout 1 2); [%expect {| > |}]; () let%expect_test "change_layout, reshape" = let f = Array2.create int fortran_layout 2 3 in let c = Array2.create int c_layout 3 2 in f.{1, 1} <- 1; f.{2, 1} <- 2; f.{1, 2} <- 3; f.{2, 2} <- 4; f.{1, 3} <- 5; f.{2, 3} <- 6; c.{0, 0} <- 1; c.{0, 1} <- 2; c.{1, 0} <- 3; c.{1, 1} <- 4; c.{2, 0} <- 5; c.{2, 1} <- 6; let c2 = Array2.change_layout f c_layout in assert (compare c c2 = 0); let c' = genarray_of_array2 c in let c2' = genarray_of_array2 c2 in assert (compare (reshape_1 c' 6) (reshape_1 c2' 6) = 0) external blit_ba_to_ba : (_, _, _) Array1.t -> int -> (_, _, _) Array1.t -> int -> int -> unit = "caml_bigstring_blit_ba_to_ba" external blit_ba_to_bytes : (_, _, _) Array1.t -> int -> Bytes.t -> int -> int -> unit = "caml_bigstring_blit_ba_to_bytes" external blit_bytes_to_ba : Bytes.t -> int -> (_, _, _) Array1.t -> int -> int -> unit = "caml_bigstring_blit_string_to_ba" let print_ba a = for i = 0 to Array1.dim a - 1 do Printf.printf "\\%03d" (Char.code a.{i}) done; Printf.printf "\n" let print_bytes a = for i = 0 to Bytes.length a - 1 do Printf.printf "\\%03d" (Char.code (Bytes.get a i)) done; Printf.printf "\n" let%expect_test "blit ba-ba" = let a = Array1.create char c_layout 10 in let a' = Array1.sub a 2 6 in let b = Array1.create char c_layout 10 in let b' = Array1.sub b 4 6 in for i = 0 to 10 - 1 do a.{i} <- Char.chr i done; blit_ba_to_ba a' 1 b' 2 3; print_ba a; print_ba b; [%expect {| \000\001\002\003\004\005\006\007\008\009 \000\000\000\000\000\000\003\004\005\000 |}] let%expect_test "blit ba-bytes" = let a = Array1.create char c_layout 10 in let a' = Array1.sub a 2 6 in let b = Bytes.create 10 in for i = 0 to 10 - 1 do a.{i} <- Char.chr i done; blit_ba_to_bytes a' 1 b 6 3; print_ba a; print_bytes b; [%expect {| \000\001\002\003\004\005\006\007\008\009 \000\000\000\000\000\000\003\004\005\000 |}] let%expect_test "blit bytes-ba" = let a = Bytes.create 10 in let b = Array1.create char c_layout 10 in let b' = Array1.sub b 4 6 in for i = 0 to 10 - 1 do Bytes.set a i (Char.chr i) done; blit_bytes_to_ba a 3 b' 2 3; print_bytes a; print_ba b; [%expect {| \000\001\002\003\004\005\006\007\008\009 \000\000\000\000\000\000\003\004\005\000 |}] js_of_ocaml-3.5.2/compiler/jsoo_fs.ml000066400000000000000000000105361357507750000176200ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Js_of_ocaml_compiler.Stdlib open Js_of_ocaml_compiler open Cmdliner type options = { files : string list ; output_file : string ; include_dirs : string list } let options = let files = let doc = "Embed [$(docv)] in the js_of_ocaml pseudo filesystem." in Arg.(value & pos_all string [] & info [] ~docv:"FILES" ~doc) in let output_file = let doc = "Set output file name to [$(docv)]." in Arg.(required & opt (some string) None & info [ "o" ] ~docv:"FILE" ~doc) in let include_dirs = let doc = "Add [$(docv)] to the list of include directories." in Arg.(value & opt_all string [] & info [ "I" ] ~docv:"DIR" ~doc) in Term.( pure (fun files output_file include_dirs -> { files; output_file; include_dirs }) $ files $ output_file $ include_dirs) let info = let doc = "Js_of_ocaml pseudo filesystem utility" in let man = [ `S "DESCRIPTION" ; `P "jsoo_fs is a tool for embeding files in a Js_of_ocaml pseudo filesystem." ; `S "BUGS" ; `P "Bugs are tracked on github at \ $(i,https://github.com/ocsigen/js_of_ocaml/issues)." ; `S "AUTHORS" ; `P "Jerome Vouillon, Hugo Heuzard." ; `S "LICENSE" ; `P "Copyright (C) 2010-2019." ; `P "jsoo_fs is free software, you can redistribute it and/or modify it under the \ terms of the GNU Lesser General Public License as published by the Free \ Software Foundation, with linking exception; either version 2.1 of the License, \ or (at your option) any later version." ] in let version = match Compiler_version.git_version with | "" -> Compiler_version.s | v -> Printf.sprintf "%s+git-%s" Compiler_version.s v in Term.info "jsoo_fs" ~doc ~man ~version let f { files; output_file; include_dirs } = let code = {| //Provides: caml_create_file_extern function caml_create_file_extern(name,content){ if(joo_global_object.caml_create_file) joo_global_object.caml_create_file(name,content); else { if(!joo_global_object.caml_fs_tmp) joo_global_object.caml_fs_tmp = []; joo_global_object.caml_fs_tmp.push({name:name,content:content}); } return 0; } |} in let fragments = Linker.parse_string code in List.iter fragments ~f:(fun fr -> Linker.load_fragment ~filename:"" fr); let instr = PseudoFs.f ~prim:`caml_create_file_extern ~cmis:StringSet.empty ~files ~paths:include_dirs in let code = Code.prepend Code.empty instr in Util.gen_file output_file (fun chan -> let pfs_fmt = Pretty_print.to_out_channel chan in Driver.f ~standalone:true ~global:`Auto pfs_fmt (Parse_bytecode.Debug.create ~toplevel:false false) code) let main = Cmdliner.Term.(pure f $ options), info let _ = Timer.init Sys.time; try Cmdliner.Term.eval ~catch:false ~argv:(Util.normalize_argv ~warn_:true Sys.argv) main with | (Match_failure _ | Assert_failure _ | Not_found) as exc -> let backtrace = Printexc.get_backtrace () in Format.eprintf "%s: You found a bug. Please report it at \ https://github.com/ocsigen/js_of_ocaml/issues :@." Sys.argv.(0); Format.eprintf "Error: %s@." (Printexc.to_string exc); prerr_string backtrace; exit 1 | Failure s -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) s; exit 1 | exc -> let backtrace = Printexc.get_backtrace () in Format.eprintf "%s: Error: %s@." Sys.argv.(0) (Printexc.to_string exc); prerr_string backtrace; exit 1 js_of_ocaml-3.5.2/compiler/jsoo_fs.mli000066400000000000000000000000141357507750000177570ustar00rootroot00000000000000(* Empty *) js_of_ocaml-3.5.2/compiler/jsoo_link.ml000066400000000000000000000040371357507750000201440ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2016 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Js_of_ocaml_compiler.Stdlib open Js_of_ocaml_compiler let f { LinkerArg.output_file; source_map; resolve_sourcemap_url; js_files } = let with_output f = match output_file with | None -> f stdout | Some file -> Util.gen_file file f in with_output (fun output -> Link_js.link ~output ~files:js_files ~source_map ~resolve_sourcemap_url) let main = Cmdliner.Term.(pure f $ LinkerArg.options), LinkerArg.info let _ = Timer.init Sys.time; try Cmdliner.Term.eval ~catch:false ~argv:(Util.normalize_argv ~warn_:true Sys.argv) main with | (Match_failure _ | Assert_failure _ | Not_found) as exc -> let backtrace = Printexc.get_backtrace () in Format.eprintf "%s: You found a bug. Please report it at \ https://github.com/ocsigen/js_of_ocaml/issues :@." Sys.argv.(0); Format.eprintf "Error: %s@." (Printexc.to_string exc); prerr_string backtrace; exit 1 | Failure s -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) s; exit 1 | exc -> let backtrace = Printexc.get_backtrace () in Format.eprintf "%s: Error: %s@." Sys.argv.(0) (Printexc.to_string exc); prerr_string backtrace; exit 1 js_of_ocaml-3.5.2/compiler/jsoo_link.mli000066400000000000000000000000141357507750000203040ustar00rootroot00000000000000(* Empty *) js_of_ocaml-3.5.2/compiler/jsoo_minify.ml000066400000000000000000000077341357507750000205110ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Js_of_ocaml_compiler.Stdlib open Js_of_ocaml_compiler let error k = Format.ksprintf (fun s -> failwith s) k let _ = Sys.catch_break true let f { MinifyArg.common; output_file; use_stdin; files } = CommonArg.eval common; let chop_extension s = try Filename.chop_extension s with Invalid_argument _ -> s in let with_output f = match output_file with | Some "-" -> f stdout | None when use_stdin -> f stdout | None | Some _ -> let file = match output_file with | Some f -> f | None -> if List.length files = 1 then chop_extension (List.hd files) ^ ".min.js" else "a.min.js" in Util.gen_file file f in let gen pp = let pretty = Config.Flag.pretty () in Pretty_print.set_compact pp (not pretty); Code.Var.set_pretty pretty; let error_of_pi pi = match pi with | { Parse_info.name = Some src; line; col; _ } | { Parse_info.src = Some src; line; col; _ } -> error "error at file:%S l:%d col:%d" src line col | { Parse_info.line; col; _ } -> error "error at l:%d col:%d" line col in let p = List.flatten (List.map files ~f:(fun file -> let lex = Parse_js.lexer_from_file file in try Parse_js.parse lex with Parse_js.Parsing_error pi -> error_of_pi pi)) in let p = if use_stdin then let lex = Parse_js.lexer_from_channel stdin in try p @ Parse_js.parse lex with Parse_js.Parsing_error pi -> error_of_pi pi else p in let free = new Js_traverse.free in let _pfree = free#program p in let toplevel_def = free#get_def_name in let () = VarPrinter.add_reserved (StringSet.elements toplevel_def) in let true_ () = true in let open Config in let passes : ((unit -> bool) * (unit -> Js_traverse.mapper)) list = [ ( Flag.shortvar , fun () -> (new Js_traverse.rename_variable toplevel_def :> Js_traverse.mapper) ) ; (true_, fun () -> new Js_traverse.simpl) ; (true_, fun () -> new Js_traverse.clean) ] in let p = List.fold_left passes ~init:p ~f:(fun p (t, m) -> if t () then (m ())#program p else p) in let p = Js_assign.program p in Js_output.program pp p in with_output (fun out_channel -> let pp = Pretty_print.to_out_channel out_channel in gen pp) let main = Cmdliner.Term.(pure f $ MinifyArg.options), MinifyArg.info let _ = Timer.init Sys.time; try Cmdliner.Term.eval ~catch:false ~argv:(Util.normalize_argv ~warn_:true Sys.argv) main with | (Match_failure _ | Assert_failure _ | Not_found) as exc -> let backtrace = Printexc.get_backtrace () in Format.eprintf "%s: You found a bug. Please report it at \ https://github.com/ocsigen/js_of_ocaml/issues :@." Sys.argv.(0); Format.eprintf "Error: %s@." (Printexc.to_string exc); prerr_string backtrace; exit 1 | Failure s -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) s; exit 1 | exc -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) (Printexc.to_string exc); exit 1 js_of_ocaml-3.5.2/compiler/jsoo_minify.mli000066400000000000000000000000141357507750000206420ustar00rootroot00000000000000(* Empty *) js_of_ocaml-3.5.2/compiler/lib/000077500000000000000000000000001357507750000163655ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/lib/.ocamlformat-ignore000066400000000000000000000001271357507750000221530ustar00rootroot00000000000000annot_lexer.ml annot_parser.ml annot_parser.mli js_lexer.ml js_parser.ml js_parser.mli js_of_ocaml-3.5.2/compiler/lib/annot_lexer.ml000066400000000000000000003515561357507750000212540ustar00rootroot00000000000000# 1 "compiler/lib/annot_lexer.mll" (* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Annot_parser # 24 "compiler/lib/annot_lexer.ml" let __ocaml_lex_tables = { Lexing.lex_base = "\000\000\231\255\232\255\233\255\002\000\235\255\002\000\003\000\ \240\255\241\255\242\255\243\255\077\000\088\000\192\000\023\001\ \110\001\197\001\028\002\115\002\202\002\033\003\120\003\207\003\ \038\004\125\004\212\004\043\005\130\005\217\005\048\006\135\006\ \222\006\053\007\140\007\227\007\058\008\145\008\232\008\063\009\ \150\009\237\009\068\010\155\010\242\010\073\011\160\011\247\011\ \078\012\165\012\252\012\083\013\170\013\001\014\088\014\175\014\ \006\015\093\015\180\015\011\016\098\016\185\016\016\017\103\017\ \190\017\021\018\108\018\195\018\026\019\113\019\200\019\031\020\ \118\020\205\020\036\021\123\021\210\021\041\022\128\022\215\022\ \046\023\133\023\220\023\051\024\163\000\181\000\239\255\236\255\ "; Lexing.lex_backtrk = "\255\255\255\255\255\255\255\255\021\000\255\255\018\000\017\000\ \255\255\255\255\255\255\255\255\011\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\000\000\010\000\010\000\ \010\000\010\000\010\000\010\000\001\000\010\000\010\000\002\000\ \010\000\010\000\010\000\003\000\010\000\010\000\010\000\010\000\ \010\000\010\000\004\000\010\000\005\000\010\000\010\000\010\000\ \010\000\010\000\006\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\007\000\ \010\000\010\000\010\000\010\000\010\000\008\000\010\000\010\000\ \010\000\010\000\010\000\009\000\255\255\011\000\255\255\255\255\ "; Lexing.lex_default = "\001\000\000\000\000\000\000\000\255\255\000\000\255\255\255\255\ \000\000\000\000\000\000\000\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\000\000\000\000\ "; Lexing.lex_trans = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\004\000\002\000\004\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \004\000\000\000\004\000\000\000\013\000\000\000\000\000\000\000\ \011\000\010\000\000\000\000\000\009\000\000\000\000\000\000\000\ \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\ \012\000\012\000\008\000\000\000\007\000\005\000\006\000\087\000\ \086\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \022\000\013\000\021\000\013\000\013\000\013\000\015\000\014\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\019\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\018\000\013\000\016\000\ \020\000\013\000\013\000\017\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\084\000\013\000\012\000\012\000\012\000\ \012\000\012\000\012\000\012\000\012\000\012\000\012\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\085\000\085\000\085\000\085\000\085\000\ \085\000\085\000\085\000\085\000\085\000\000\000\000\000\000\000\ \000\000\000\000\000\000\084\000\013\000\085\000\085\000\085\000\ \085\000\085\000\085\000\085\000\085\000\085\000\085\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \003\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\013\000\013\000\078\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\013\000\000\000\ \013\000\013\000\013\000\013\000\072\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \059\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\053\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\044\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\040\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\013\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\037\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \013\000\000\000\013\000\013\000\013\000\013\000\030\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\023\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\013\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\024\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\025\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\026\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \027\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \028\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\013\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\029\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \013\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\031\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\013\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\032\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\033\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\034\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \013\000\035\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\036\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\013\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \013\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\038\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\013\000\013\000\039\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\013\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\041\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \042\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \043\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\013\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\045\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \013\000\000\000\046\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\048\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\047\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\013\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\051\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\049\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\050\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\052\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\013\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \013\000\000\000\054\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\055\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\013\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\056\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\057\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\058\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\060\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\013\000\000\000\013\000\013\000\013\000\013\000\061\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \013\000\000\000\013\000\013\000\062\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\063\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\064\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\065\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\066\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \067\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \068\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\013\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\069\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \013\000\000\000\070\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\071\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\013\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \073\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \074\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\075\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\076\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\013\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \077\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \013\000\000\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\013\000\ \000\000\079\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\013\000\000\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\080\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\ \013\000\013\000\081\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\013\000\000\000\013\000\013\000\ \013\000\013\000\082\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\000\000\ \000\000\000\000\000\000\013\000\000\000\013\000\013\000\013\000\ \013\000\013\000\083\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\013\000\000\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000"; Lexing.lex_check = "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\000\000\000\000\004\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \000\000\255\255\004\000\255\255\000\000\255\255\255\255\255\255\ \000\000\000\000\255\255\255\255\000\000\255\255\255\255\255\255\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\255\255\000\000\000\000\000\000\006\000\ \007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\255\255\255\255\255\255\255\255\000\000\ \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\012\000\013\000\012\000\012\000\012\000\ \012\000\012\000\012\000\012\000\012\000\012\000\012\000\255\255\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\255\255\255\255\255\255\255\255\013\000\ \255\255\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\ \013\000\013\000\013\000\084\000\084\000\084\000\084\000\084\000\ \084\000\084\000\084\000\084\000\084\000\255\255\255\255\255\255\ \255\255\255\255\255\255\085\000\014\000\085\000\085\000\085\000\ \085\000\085\000\085\000\085\000\085\000\085\000\085\000\255\255\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\255\255\255\255\255\255\255\255\255\255\255\255\ \000\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\255\255\255\255\255\255\255\255\014\000\ \255\255\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\015\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\015\000\ \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\ \015\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\ \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\ \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\ \015\000\015\000\255\255\255\255\255\255\255\255\015\000\255\255\ \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\ \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\ \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\ \015\000\015\000\016\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\255\255\255\255\255\255\255\255\016\000\255\255\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\017\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\017\000\017\000\017\000\ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\017\000\017\000\ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\ \255\255\255\255\255\255\255\255\017\000\255\255\017\000\017\000\ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\ \018\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\018\000\018\000\018\000\018\000\ \018\000\018\000\018\000\018\000\018\000\018\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\018\000\018\000\018\000\ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\018\000\ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\018\000\ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\255\255\ \255\255\255\255\255\255\018\000\255\255\018\000\018\000\018\000\ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\018\000\ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\018\000\ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\019\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\019\000\019\000\019\000\019\000\019\000\ \019\000\019\000\019\000\019\000\019\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\019\000\019\000\019\000\019\000\ \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\ \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\ \019\000\019\000\019\000\019\000\019\000\019\000\255\255\255\255\ \255\255\255\255\019\000\255\255\019\000\019\000\019\000\019\000\ \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\ \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\ \019\000\019\000\019\000\019\000\019\000\019\000\020\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\020\000\020\000\020\000\020\000\020\000\020\000\ \020\000\020\000\020\000\020\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\020\000\020\000\020\000\020\000\020\000\ \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\ \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\ \020\000\020\000\020\000\020\000\020\000\255\255\255\255\255\255\ \255\255\020\000\255\255\020\000\020\000\020\000\020\000\020\000\ \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\ \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\ \020\000\020\000\020\000\020\000\020\000\021\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\021\000\021\000\021\000\021\000\021\000\021\000\021\000\ \021\000\021\000\021\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\021\000\021\000\021\000\021\000\021\000\021\000\ \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\ \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\ \021\000\021\000\021\000\021\000\255\255\255\255\255\255\255\255\ \021\000\255\255\021\000\021\000\021\000\021\000\021\000\021\000\ \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\ \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\ \021\000\021\000\021\000\021\000\022\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\ \022\000\022\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\022\000\022\000\022\000\022\000\022\000\022\000\022\000\ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\ \022\000\022\000\022\000\255\255\255\255\255\255\255\255\022\000\ \255\255\022\000\022\000\022\000\022\000\022\000\022\000\022\000\ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\ \022\000\022\000\022\000\023\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\023\000\ \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\ \023\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\ \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\ \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\ \023\000\023\000\255\255\255\255\255\255\255\255\023\000\255\255\ \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\ \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\ \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\ \023\000\023\000\024\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\255\255\255\255\255\255\255\255\024\000\255\255\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\025\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \255\255\255\255\255\255\255\255\025\000\255\255\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \026\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\026\000\026\000\026\000\026\000\ \026\000\026\000\026\000\026\000\026\000\026\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\026\000\026\000\026\000\ \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\ \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\ \026\000\026\000\026\000\026\000\026\000\026\000\026\000\255\255\ \255\255\255\255\255\255\026\000\255\255\026\000\026\000\026\000\ \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\ \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\ \026\000\026\000\026\000\026\000\026\000\026\000\026\000\027\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\027\000\027\000\027\000\027\000\027\000\ \027\000\027\000\027\000\027\000\027\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\027\000\027\000\027\000\027\000\ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\ \027\000\027\000\027\000\027\000\027\000\027\000\255\255\255\255\ \255\255\255\255\027\000\255\255\027\000\027\000\027\000\027\000\ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\ \027\000\027\000\027\000\027\000\027\000\027\000\028\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\028\000\028\000\028\000\028\000\028\000\028\000\ \028\000\028\000\028\000\028\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\028\000\028\000\028\000\028\000\028\000\ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\ \028\000\028\000\028\000\028\000\028\000\255\255\255\255\255\255\ \255\255\028\000\255\255\028\000\028\000\028\000\028\000\028\000\ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\ \028\000\028\000\028\000\028\000\028\000\029\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\029\000\029\000\029\000\029\000\029\000\029\000\029\000\ \029\000\029\000\029\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\029\000\029\000\029\000\029\000\029\000\029\000\ \029\000\029\000\029\000\029\000\029\000\029\000\029\000\029\000\ \029\000\029\000\029\000\029\000\029\000\029\000\029\000\029\000\ \029\000\029\000\029\000\029\000\255\255\255\255\255\255\255\255\ \029\000\255\255\029\000\029\000\029\000\029\000\029\000\029\000\ \029\000\029\000\029\000\029\000\029\000\029\000\029\000\029\000\ \029\000\029\000\029\000\029\000\029\000\029\000\029\000\029\000\ \029\000\029\000\029\000\029\000\030\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \030\000\030\000\030\000\030\000\030\000\030\000\030\000\030\000\ \030\000\030\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\030\000\030\000\030\000\030\000\030\000\030\000\030\000\ \030\000\030\000\030\000\030\000\030\000\030\000\030\000\030\000\ \030\000\030\000\030\000\030\000\030\000\030\000\030\000\030\000\ \030\000\030\000\030\000\255\255\255\255\255\255\255\255\030\000\ \255\255\030\000\030\000\030\000\030\000\030\000\030\000\030\000\ \030\000\030\000\030\000\030\000\030\000\030\000\030\000\030\000\ \030\000\030\000\030\000\030\000\030\000\030\000\030\000\030\000\ \030\000\030\000\030\000\031\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\031\000\ \031\000\031\000\031\000\031\000\031\000\031\000\031\000\031\000\ \031\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \031\000\031\000\031\000\031\000\031\000\031\000\031\000\031\000\ \031\000\031\000\031\000\031\000\031\000\031\000\031\000\031\000\ \031\000\031\000\031\000\031\000\031\000\031\000\031\000\031\000\ \031\000\031\000\255\255\255\255\255\255\255\255\031\000\255\255\ \031\000\031\000\031\000\031\000\031\000\031\000\031\000\031\000\ \031\000\031\000\031\000\031\000\031\000\031\000\031\000\031\000\ \031\000\031\000\031\000\031\000\031\000\031\000\031\000\031\000\ \031\000\031\000\032\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\032\000\032\000\ \032\000\032\000\032\000\032\000\032\000\032\000\032\000\032\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\032\000\ \032\000\032\000\032\000\032\000\032\000\032\000\032\000\032\000\ \032\000\032\000\032\000\032\000\032\000\032\000\032\000\032\000\ \032\000\032\000\032\000\032\000\032\000\032\000\032\000\032\000\ \032\000\255\255\255\255\255\255\255\255\032\000\255\255\032\000\ \032\000\032\000\032\000\032\000\032\000\032\000\032\000\032\000\ \032\000\032\000\032\000\032\000\032\000\032\000\032\000\032\000\ \032\000\032\000\032\000\032\000\032\000\032\000\032\000\032\000\ \032\000\033\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\033\000\033\000\033\000\ \033\000\033\000\033\000\033\000\033\000\033\000\033\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\033\000\033\000\ \033\000\033\000\033\000\033\000\033\000\033\000\033\000\033\000\ \033\000\033\000\033\000\033\000\033\000\033\000\033\000\033\000\ \033\000\033\000\033\000\033\000\033\000\033\000\033\000\033\000\ \255\255\255\255\255\255\255\255\033\000\255\255\033\000\033\000\ \033\000\033\000\033\000\033\000\033\000\033\000\033\000\033\000\ \033\000\033\000\033\000\033\000\033\000\033\000\033\000\033\000\ \033\000\033\000\033\000\033\000\033\000\033\000\033\000\033\000\ \034\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\034\000\034\000\034\000\034\000\ \034\000\034\000\034\000\034\000\034\000\034\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\034\000\034\000\034\000\ \034\000\034\000\034\000\034\000\034\000\034\000\034\000\034\000\ \034\000\034\000\034\000\034\000\034\000\034\000\034\000\034\000\ \034\000\034\000\034\000\034\000\034\000\034\000\034\000\255\255\ \255\255\255\255\255\255\034\000\255\255\034\000\034\000\034\000\ \034\000\034\000\034\000\034\000\034\000\034\000\034\000\034\000\ \034\000\034\000\034\000\034\000\034\000\034\000\034\000\034\000\ \034\000\034\000\034\000\034\000\034\000\034\000\034\000\035\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\035\000\035\000\035\000\035\000\035\000\ \035\000\035\000\035\000\035\000\035\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\035\000\035\000\035\000\035\000\ \035\000\035\000\035\000\035\000\035\000\035\000\035\000\035\000\ \035\000\035\000\035\000\035\000\035\000\035\000\035\000\035\000\ \035\000\035\000\035\000\035\000\035\000\035\000\255\255\255\255\ \255\255\255\255\035\000\255\255\035\000\035\000\035\000\035\000\ \035\000\035\000\035\000\035\000\035\000\035\000\035\000\035\000\ \035\000\035\000\035\000\035\000\035\000\035\000\035\000\035\000\ \035\000\035\000\035\000\035\000\035\000\035\000\036\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\036\000\036\000\036\000\036\000\036\000\036\000\ \036\000\036\000\036\000\036\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\036\000\036\000\036\000\036\000\036\000\ \036\000\036\000\036\000\036\000\036\000\036\000\036\000\036\000\ \036\000\036\000\036\000\036\000\036\000\036\000\036\000\036\000\ \036\000\036\000\036\000\036\000\036\000\255\255\255\255\255\255\ \255\255\036\000\255\255\036\000\036\000\036\000\036\000\036\000\ \036\000\036\000\036\000\036\000\036\000\036\000\036\000\036\000\ \036\000\036\000\036\000\036\000\036\000\036\000\036\000\036\000\ \036\000\036\000\036\000\036\000\036\000\037\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\037\000\037\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\037\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\255\255\255\255\255\255\255\255\ \037\000\255\255\037\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\038\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \038\000\038\000\038\000\038\000\038\000\038\000\038\000\038\000\ \038\000\038\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\038\000\038\000\038\000\038\000\038\000\038\000\038\000\ \038\000\038\000\038\000\038\000\038\000\038\000\038\000\038\000\ \038\000\038\000\038\000\038\000\038\000\038\000\038\000\038\000\ \038\000\038\000\038\000\255\255\255\255\255\255\255\255\038\000\ \255\255\038\000\038\000\038\000\038\000\038\000\038\000\038\000\ \038\000\038\000\038\000\038\000\038\000\038\000\038\000\038\000\ \038\000\038\000\038\000\038\000\038\000\038\000\038\000\038\000\ \038\000\038\000\038\000\039\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\255\255\255\255\255\255\255\255\039\000\255\255\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\040\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\040\000\040\000\ \040\000\040\000\040\000\040\000\040\000\040\000\040\000\040\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\040\000\ \040\000\040\000\040\000\040\000\040\000\040\000\040\000\040\000\ \040\000\040\000\040\000\040\000\040\000\040\000\040\000\040\000\ \040\000\040\000\040\000\040\000\040\000\040\000\040\000\040\000\ \040\000\255\255\255\255\255\255\255\255\040\000\255\255\040\000\ \040\000\040\000\040\000\040\000\040\000\040\000\040\000\040\000\ \040\000\040\000\040\000\040\000\040\000\040\000\040\000\040\000\ \040\000\040\000\040\000\040\000\040\000\040\000\040\000\040\000\ \040\000\041\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\041\000\041\000\041\000\ \041\000\041\000\041\000\041\000\041\000\041\000\041\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\041\000\041\000\ \041\000\041\000\041\000\041\000\041\000\041\000\041\000\041\000\ \041\000\041\000\041\000\041\000\041\000\041\000\041\000\041\000\ \041\000\041\000\041\000\041\000\041\000\041\000\041\000\041\000\ \255\255\255\255\255\255\255\255\041\000\255\255\041\000\041\000\ \041\000\041\000\041\000\041\000\041\000\041\000\041\000\041\000\ \041\000\041\000\041\000\041\000\041\000\041\000\041\000\041\000\ \041\000\041\000\041\000\041\000\041\000\041\000\041\000\041\000\ \042\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\042\000\042\000\042\000\042\000\ \042\000\042\000\042\000\042\000\042\000\042\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\042\000\042\000\042\000\ \042\000\042\000\042\000\042\000\042\000\042\000\042\000\042\000\ \042\000\042\000\042\000\042\000\042\000\042\000\042\000\042\000\ \042\000\042\000\042\000\042\000\042\000\042\000\042\000\255\255\ \255\255\255\255\255\255\042\000\255\255\042\000\042\000\042\000\ \042\000\042\000\042\000\042\000\042\000\042\000\042\000\042\000\ \042\000\042\000\042\000\042\000\042\000\042\000\042\000\042\000\ \042\000\042\000\042\000\042\000\042\000\042\000\042\000\043\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\043\000\043\000\043\000\043\000\043\000\ \043\000\043\000\043\000\043\000\043\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\043\000\043\000\043\000\043\000\ \043\000\043\000\043\000\043\000\043\000\043\000\043\000\043\000\ \043\000\043\000\043\000\043\000\043\000\043\000\043\000\043\000\ \043\000\043\000\043\000\043\000\043\000\043\000\255\255\255\255\ \255\255\255\255\043\000\255\255\043\000\043\000\043\000\043\000\ \043\000\043\000\043\000\043\000\043\000\043\000\043\000\043\000\ \043\000\043\000\043\000\043\000\043\000\043\000\043\000\043\000\ \043\000\043\000\043\000\043\000\043\000\043\000\044\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\044\000\044\000\044\000\044\000\044\000\044\000\ \044\000\044\000\044\000\044\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\044\000\044\000\044\000\044\000\044\000\ \044\000\044\000\044\000\044\000\044\000\044\000\044\000\044\000\ \044\000\044\000\044\000\044\000\044\000\044\000\044\000\044\000\ \044\000\044\000\044\000\044\000\044\000\255\255\255\255\255\255\ \255\255\044\000\255\255\044\000\044\000\044\000\044\000\044\000\ \044\000\044\000\044\000\044\000\044\000\044\000\044\000\044\000\ \044\000\044\000\044\000\044\000\044\000\044\000\044\000\044\000\ \044\000\044\000\044\000\044\000\044\000\045\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\045\000\045\000\045\000\045\000\045\000\045\000\045\000\ \045\000\045\000\045\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\045\000\045\000\045\000\045\000\045\000\045\000\ \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\ \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\ \045\000\045\000\045\000\045\000\255\255\255\255\255\255\255\255\ \045\000\255\255\045\000\045\000\045\000\045\000\045\000\045\000\ \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\ \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\ \045\000\045\000\045\000\045\000\046\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\ \046\000\046\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\046\000\046\000\046\000\046\000\046\000\046\000\046\000\ \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\ \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\ \046\000\046\000\046\000\255\255\255\255\255\255\255\255\046\000\ \255\255\046\000\046\000\046\000\046\000\046\000\046\000\046\000\ \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\ \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\ \046\000\046\000\046\000\047\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\047\000\ \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\ \047\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\ \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\ \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\ \047\000\047\000\255\255\255\255\255\255\255\255\047\000\255\255\ \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\ \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\ \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\ \047\000\047\000\048\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\048\000\048\000\ \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\048\000\ \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\ \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\ \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\ \048\000\255\255\255\255\255\255\255\255\048\000\255\255\048\000\ \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\ \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\ \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\ \048\000\049\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\049\000\049\000\049\000\ \049\000\049\000\049\000\049\000\049\000\049\000\049\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\049\000\049\000\ \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\ \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\ \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\ \255\255\255\255\255\255\255\255\049\000\255\255\049\000\049\000\ \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\ \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\ \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\ \050\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\050\000\050\000\050\000\050\000\ \050\000\050\000\050\000\050\000\050\000\050\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\050\000\050\000\050\000\ \050\000\050\000\050\000\050\000\050\000\050\000\050\000\050\000\ \050\000\050\000\050\000\050\000\050\000\050\000\050\000\050\000\ \050\000\050\000\050\000\050\000\050\000\050\000\050\000\255\255\ \255\255\255\255\255\255\050\000\255\255\050\000\050\000\050\000\ \050\000\050\000\050\000\050\000\050\000\050\000\050\000\050\000\ \050\000\050\000\050\000\050\000\050\000\050\000\050\000\050\000\ \050\000\050\000\050\000\050\000\050\000\050\000\050\000\051\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\051\000\051\000\051\000\051\000\051\000\ \051\000\051\000\051\000\051\000\051\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\051\000\051\000\051\000\051\000\ \051\000\051\000\051\000\051\000\051\000\051\000\051\000\051\000\ \051\000\051\000\051\000\051\000\051\000\051\000\051\000\051\000\ \051\000\051\000\051\000\051\000\051\000\051\000\255\255\255\255\ \255\255\255\255\051\000\255\255\051\000\051\000\051\000\051\000\ \051\000\051\000\051\000\051\000\051\000\051\000\051\000\051\000\ \051\000\051\000\051\000\051\000\051\000\051\000\051\000\051\000\ \051\000\051\000\051\000\051\000\051\000\051\000\052\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\052\000\052\000\052\000\052\000\052\000\052\000\ \052\000\052\000\052\000\052\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\052\000\052\000\052\000\052\000\052\000\ \052\000\052\000\052\000\052\000\052\000\052\000\052\000\052\000\ \052\000\052\000\052\000\052\000\052\000\052\000\052\000\052\000\ \052\000\052\000\052\000\052\000\052\000\255\255\255\255\255\255\ \255\255\052\000\255\255\052\000\052\000\052\000\052\000\052\000\ \052\000\052\000\052\000\052\000\052\000\052\000\052\000\052\000\ \052\000\052\000\052\000\052\000\052\000\052\000\052\000\052\000\ \052\000\052\000\052\000\052\000\052\000\053\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\053\000\053\000\053\000\053\000\053\000\053\000\053\000\ \053\000\053\000\053\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\053\000\053\000\053\000\053\000\053\000\053\000\ \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\ \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\ \053\000\053\000\053\000\053\000\255\255\255\255\255\255\255\255\ \053\000\255\255\053\000\053\000\053\000\053\000\053\000\053\000\ \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\ \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\ \053\000\053\000\053\000\053\000\054\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\ \054\000\054\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\054\000\054\000\054\000\054\000\054\000\054\000\054\000\ \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\ \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\ \054\000\054\000\054\000\255\255\255\255\255\255\255\255\054\000\ \255\255\054\000\054\000\054\000\054\000\054\000\054\000\054\000\ \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\ \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\ \054\000\054\000\054\000\055\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\055\000\ \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\ \055\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\ \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\ \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\ \055\000\055\000\255\255\255\255\255\255\255\255\055\000\255\255\ \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\ \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\ \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\ \055\000\055\000\056\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\056\000\056\000\ \056\000\056\000\056\000\056\000\056\000\056\000\056\000\056\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\056\000\ \056\000\056\000\056\000\056\000\056\000\056\000\056\000\056\000\ \056\000\056\000\056\000\056\000\056\000\056\000\056\000\056\000\ \056\000\056\000\056\000\056\000\056\000\056\000\056\000\056\000\ \056\000\255\255\255\255\255\255\255\255\056\000\255\255\056\000\ \056\000\056\000\056\000\056\000\056\000\056\000\056\000\056\000\ \056\000\056\000\056\000\056\000\056\000\056\000\056\000\056\000\ \056\000\056\000\056\000\056\000\056\000\056\000\056\000\056\000\ \056\000\057\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\057\000\057\000\057\000\ \057\000\057\000\057\000\057\000\057\000\057\000\057\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\057\000\057\000\ \057\000\057\000\057\000\057\000\057\000\057\000\057\000\057\000\ \057\000\057\000\057\000\057\000\057\000\057\000\057\000\057\000\ \057\000\057\000\057\000\057\000\057\000\057\000\057\000\057\000\ \255\255\255\255\255\255\255\255\057\000\255\255\057\000\057\000\ \057\000\057\000\057\000\057\000\057\000\057\000\057\000\057\000\ \057\000\057\000\057\000\057\000\057\000\057\000\057\000\057\000\ \057\000\057\000\057\000\057\000\057\000\057\000\057\000\057\000\ \058\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\058\000\058\000\058\000\058\000\ \058\000\058\000\058\000\058\000\058\000\058\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\058\000\058\000\058\000\ \058\000\058\000\058\000\058\000\058\000\058\000\058\000\058\000\ \058\000\058\000\058\000\058\000\058\000\058\000\058\000\058\000\ \058\000\058\000\058\000\058\000\058\000\058\000\058\000\255\255\ \255\255\255\255\255\255\058\000\255\255\058\000\058\000\058\000\ \058\000\058\000\058\000\058\000\058\000\058\000\058\000\058\000\ \058\000\058\000\058\000\058\000\058\000\058\000\058\000\058\000\ \058\000\058\000\058\000\058\000\058\000\058\000\058\000\059\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\059\000\059\000\059\000\059\000\059\000\ \059\000\059\000\059\000\059\000\059\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\059\000\059\000\059\000\059\000\ \059\000\059\000\059\000\059\000\059\000\059\000\059\000\059\000\ \059\000\059\000\059\000\059\000\059\000\059\000\059\000\059\000\ \059\000\059\000\059\000\059\000\059\000\059\000\255\255\255\255\ \255\255\255\255\059\000\255\255\059\000\059\000\059\000\059\000\ \059\000\059\000\059\000\059\000\059\000\059\000\059\000\059\000\ \059\000\059\000\059\000\059\000\059\000\059\000\059\000\059\000\ \059\000\059\000\059\000\059\000\059\000\059\000\060\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\060\000\060\000\060\000\060\000\060\000\060\000\ \060\000\060\000\060\000\060\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\060\000\060\000\060\000\060\000\060\000\ \060\000\060\000\060\000\060\000\060\000\060\000\060\000\060\000\ \060\000\060\000\060\000\060\000\060\000\060\000\060\000\060\000\ \060\000\060\000\060\000\060\000\060\000\255\255\255\255\255\255\ \255\255\060\000\255\255\060\000\060\000\060\000\060\000\060\000\ \060\000\060\000\060\000\060\000\060\000\060\000\060\000\060\000\ \060\000\060\000\060\000\060\000\060\000\060\000\060\000\060\000\ \060\000\060\000\060\000\060\000\060\000\061\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\061\000\061\000\061\000\061\000\061\000\061\000\061\000\ \061\000\061\000\061\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\061\000\061\000\061\000\061\000\061\000\061\000\ \061\000\061\000\061\000\061\000\061\000\061\000\061\000\061\000\ \061\000\061\000\061\000\061\000\061\000\061\000\061\000\061\000\ \061\000\061\000\061\000\061\000\255\255\255\255\255\255\255\255\ \061\000\255\255\061\000\061\000\061\000\061\000\061\000\061\000\ \061\000\061\000\061\000\061\000\061\000\061\000\061\000\061\000\ \061\000\061\000\061\000\061\000\061\000\061\000\061\000\061\000\ \061\000\061\000\061\000\061\000\062\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \062\000\062\000\062\000\062\000\062\000\062\000\062\000\062\000\ \062\000\062\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\062\000\062\000\062\000\062\000\062\000\062\000\062\000\ \062\000\062\000\062\000\062\000\062\000\062\000\062\000\062\000\ \062\000\062\000\062\000\062\000\062\000\062\000\062\000\062\000\ \062\000\062\000\062\000\255\255\255\255\255\255\255\255\062\000\ \255\255\062\000\062\000\062\000\062\000\062\000\062\000\062\000\ \062\000\062\000\062\000\062\000\062\000\062\000\062\000\062\000\ \062\000\062\000\062\000\062\000\062\000\062\000\062\000\062\000\ \062\000\062\000\062\000\063\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\063\000\ \063\000\063\000\063\000\063\000\063\000\063\000\063\000\063\000\ \063\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \063\000\063\000\063\000\063\000\063\000\063\000\063\000\063\000\ \063\000\063\000\063\000\063\000\063\000\063\000\063\000\063\000\ \063\000\063\000\063\000\063\000\063\000\063\000\063\000\063\000\ \063\000\063\000\255\255\255\255\255\255\255\255\063\000\255\255\ \063\000\063\000\063\000\063\000\063\000\063\000\063\000\063\000\ \063\000\063\000\063\000\063\000\063\000\063\000\063\000\063\000\ \063\000\063\000\063\000\063\000\063\000\063\000\063\000\063\000\ \063\000\063\000\064\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\064\000\064\000\ \064\000\064\000\064\000\064\000\064\000\064\000\064\000\064\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\064\000\ \064\000\064\000\064\000\064\000\064\000\064\000\064\000\064\000\ \064\000\064\000\064\000\064\000\064\000\064\000\064\000\064\000\ \064\000\064\000\064\000\064\000\064\000\064\000\064\000\064\000\ \064\000\255\255\255\255\255\255\255\255\064\000\255\255\064\000\ \064\000\064\000\064\000\064\000\064\000\064\000\064\000\064\000\ \064\000\064\000\064\000\064\000\064\000\064\000\064\000\064\000\ \064\000\064\000\064\000\064\000\064\000\064\000\064\000\064\000\ \064\000\065\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\065\000\065\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\065\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\065\000\ \255\255\255\255\255\255\255\255\065\000\255\255\065\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\065\000\ \066\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\066\000\066\000\066\000\066\000\ \066\000\066\000\066\000\066\000\066\000\066\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\066\000\066\000\066\000\ \066\000\066\000\066\000\066\000\066\000\066\000\066\000\066\000\ \066\000\066\000\066\000\066\000\066\000\066\000\066\000\066\000\ \066\000\066\000\066\000\066\000\066\000\066\000\066\000\255\255\ \255\255\255\255\255\255\066\000\255\255\066\000\066\000\066\000\ \066\000\066\000\066\000\066\000\066\000\066\000\066\000\066\000\ \066\000\066\000\066\000\066\000\066\000\066\000\066\000\066\000\ \066\000\066\000\066\000\066\000\066\000\066\000\066\000\067\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\067\000\067\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\067\000\067\000\067\000\255\255\255\255\ \255\255\255\255\067\000\255\255\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\067\000\067\000\067\000\068\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\068\000\068\000\068\000\068\000\068\000\068\000\ \068\000\068\000\068\000\068\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\068\000\068\000\068\000\068\000\068\000\ \068\000\068\000\068\000\068\000\068\000\068\000\068\000\068\000\ \068\000\068\000\068\000\068\000\068\000\068\000\068\000\068\000\ \068\000\068\000\068\000\068\000\068\000\255\255\255\255\255\255\ \255\255\068\000\255\255\068\000\068\000\068\000\068\000\068\000\ \068\000\068\000\068\000\068\000\068\000\068\000\068\000\068\000\ \068\000\068\000\068\000\068\000\068\000\068\000\068\000\068\000\ \068\000\068\000\068\000\068\000\068\000\069\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\069\000\069\000\069\000\069\000\069\000\069\000\069\000\ \069\000\069\000\069\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\069\000\069\000\069\000\069\000\069\000\069\000\ \069\000\069\000\069\000\069\000\069\000\069\000\069\000\069\000\ \069\000\069\000\069\000\069\000\069\000\069\000\069\000\069\000\ \069\000\069\000\069\000\069\000\255\255\255\255\255\255\255\255\ \069\000\255\255\069\000\069\000\069\000\069\000\069\000\069\000\ \069\000\069\000\069\000\069\000\069\000\069\000\069\000\069\000\ \069\000\069\000\069\000\069\000\069\000\069\000\069\000\069\000\ \069\000\069\000\069\000\069\000\070\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \070\000\070\000\070\000\070\000\070\000\070\000\070\000\070\000\ \070\000\070\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\070\000\070\000\070\000\070\000\070\000\070\000\070\000\ \070\000\070\000\070\000\070\000\070\000\070\000\070\000\070\000\ \070\000\070\000\070\000\070\000\070\000\070\000\070\000\070\000\ \070\000\070\000\070\000\255\255\255\255\255\255\255\255\070\000\ \255\255\070\000\070\000\070\000\070\000\070\000\070\000\070\000\ \070\000\070\000\070\000\070\000\070\000\070\000\070\000\070\000\ \070\000\070\000\070\000\070\000\070\000\070\000\070\000\070\000\ \070\000\070\000\070\000\071\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\071\000\ \071\000\071\000\071\000\071\000\071\000\071\000\071\000\071\000\ \071\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \071\000\071\000\071\000\071\000\071\000\071\000\071\000\071\000\ \071\000\071\000\071\000\071\000\071\000\071\000\071\000\071\000\ \071\000\071\000\071\000\071\000\071\000\071\000\071\000\071\000\ \071\000\071\000\255\255\255\255\255\255\255\255\071\000\255\255\ \071\000\071\000\071\000\071\000\071\000\071\000\071\000\071\000\ \071\000\071\000\071\000\071\000\071\000\071\000\071\000\071\000\ \071\000\071\000\071\000\071\000\071\000\071\000\071\000\071\000\ \071\000\071\000\072\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\072\000\072\000\ \072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\072\000\ \072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\ \072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\ \072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\ \072\000\255\255\255\255\255\255\255\255\072\000\255\255\072\000\ \072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\ \072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\ \072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\ \072\000\073\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\073\000\073\000\073\000\ \073\000\073\000\073\000\073\000\073\000\073\000\073\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\073\000\073\000\ \073\000\073\000\073\000\073\000\073\000\073\000\073\000\073\000\ \073\000\073\000\073\000\073\000\073\000\073\000\073\000\073\000\ \073\000\073\000\073\000\073\000\073\000\073\000\073\000\073\000\ \255\255\255\255\255\255\255\255\073\000\255\255\073\000\073\000\ \073\000\073\000\073\000\073\000\073\000\073\000\073\000\073\000\ \073\000\073\000\073\000\073\000\073\000\073\000\073\000\073\000\ \073\000\073\000\073\000\073\000\073\000\073\000\073\000\073\000\ \074\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\074\000\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\074\000\255\255\ \255\255\255\255\255\255\074\000\255\255\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\074\000\075\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\075\000\075\000\075\000\075\000\075\000\ \075\000\075\000\075\000\075\000\075\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\075\000\075\000\075\000\075\000\ \075\000\075\000\075\000\075\000\075\000\075\000\075\000\075\000\ \075\000\075\000\075\000\075\000\075\000\075\000\075\000\075\000\ \075\000\075\000\075\000\075\000\075\000\075\000\255\255\255\255\ \255\255\255\255\075\000\255\255\075\000\075\000\075\000\075\000\ \075\000\075\000\075\000\075\000\075\000\075\000\075\000\075\000\ \075\000\075\000\075\000\075\000\075\000\075\000\075\000\075\000\ \075\000\075\000\075\000\075\000\075\000\075\000\076\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\076\000\076\000\076\000\076\000\076\000\076\000\ \076\000\076\000\076\000\076\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\076\000\076\000\076\000\076\000\076\000\ \076\000\076\000\076\000\076\000\076\000\076\000\076\000\076\000\ \076\000\076\000\076\000\076\000\076\000\076\000\076\000\076\000\ \076\000\076\000\076\000\076\000\076\000\255\255\255\255\255\255\ \255\255\076\000\255\255\076\000\076\000\076\000\076\000\076\000\ \076\000\076\000\076\000\076\000\076\000\076\000\076\000\076\000\ \076\000\076\000\076\000\076\000\076\000\076\000\076\000\076\000\ \076\000\076\000\076\000\076\000\076\000\077\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\077\000\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\077\000\255\255\255\255\255\255\255\255\ \077\000\255\255\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\077\000\078\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\078\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\078\000\078\000\255\255\255\255\255\255\255\255\078\000\ \255\255\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\078\000\078\000\079\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\079\000\ \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\ \079\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\ \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\ \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\ \079\000\079\000\255\255\255\255\255\255\255\255\079\000\255\255\ \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\ \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\ \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\ \079\000\079\000\080\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\080\000\080\000\ \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\080\000\ \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\ \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\ \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\ \080\000\255\255\255\255\255\255\255\255\080\000\255\255\080\000\ \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\ \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\ \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\ \080\000\081\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\081\000\081\000\081\000\ \081\000\081\000\081\000\081\000\081\000\081\000\081\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\081\000\081\000\ \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\ \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\ \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\ \255\255\255\255\255\255\255\255\081\000\255\255\081\000\081\000\ \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\ \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\ \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\ \082\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\082\000\082\000\082\000\082\000\ \082\000\082\000\082\000\082\000\082\000\082\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\082\000\082\000\082\000\ \082\000\082\000\082\000\082\000\082\000\082\000\082\000\082\000\ \082\000\082\000\082\000\082\000\082\000\082\000\082\000\082\000\ \082\000\082\000\082\000\082\000\082\000\082\000\082\000\255\255\ \255\255\255\255\255\255\082\000\255\255\082\000\082\000\082\000\ \082\000\082\000\082\000\082\000\082\000\082\000\082\000\082\000\ \082\000\082\000\082\000\082\000\082\000\082\000\082\000\082\000\ \082\000\082\000\082\000\082\000\082\000\082\000\082\000\083\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\083\000\083\000\083\000\083\000\083\000\ \083\000\083\000\083\000\083\000\083\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\083\000\083\000\083\000\083\000\ \083\000\083\000\083\000\083\000\083\000\083\000\083\000\083\000\ \083\000\083\000\083\000\083\000\083\000\083\000\083\000\083\000\ \083\000\083\000\083\000\083\000\083\000\083\000\255\255\255\255\ \255\255\255\255\083\000\255\255\083\000\083\000\083\000\083\000\ \083\000\083\000\083\000\083\000\083\000\083\000\083\000\083\000\ \083\000\083\000\083\000\083\000\083\000\083\000\083\000\083\000\ \083\000\083\000\083\000\083\000\083\000\083\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255"; Lexing.lex_base_code = ""; Lexing.lex_backtrk_code = ""; Lexing.lex_default_code = ""; Lexing.lex_trans_code = ""; Lexing.lex_check_code = ""; Lexing.lex_code = ""; } let rec initial lexbuf = __ocaml_lex_initial_rec lexbuf 0 and __ocaml_lex_initial_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 26 "compiler/lib/annot_lexer.mll" (TProvides) # 1702 "compiler/lib/annot_lexer.ml" | 1 -> # 27 "compiler/lib/annot_lexer.mll" (TRequires) # 1707 "compiler/lib/annot_lexer.ml" | 2 -> # 28 "compiler/lib/annot_lexer.mll" (TA_Pure ) # 1712 "compiler/lib/annot_lexer.ml" | 3 -> # 29 "compiler/lib/annot_lexer.mll" (TA_Const ) # 1717 "compiler/lib/annot_lexer.ml" | 4 -> # 30 "compiler/lib/annot_lexer.mll" (TA_Mutable ) # 1722 "compiler/lib/annot_lexer.ml" | 5 -> # 31 "compiler/lib/annot_lexer.mll" (TA_Mutator ) # 1727 "compiler/lib/annot_lexer.ml" | 6 -> # 32 "compiler/lib/annot_lexer.mll" (TA_Shallow) # 1732 "compiler/lib/annot_lexer.ml" | 7 -> # 33 "compiler/lib/annot_lexer.mll" (TA_Object_literal) # 1737 "compiler/lib/annot_lexer.ml" | 8 -> # 34 "compiler/lib/annot_lexer.mll" (TVersion) # 1742 "compiler/lib/annot_lexer.ml" | 9 -> # 35 "compiler/lib/annot_lexer.mll" (TWeakdef) # 1747 "compiler/lib/annot_lexer.ml" | 10 -> # 36 "compiler/lib/annot_lexer.mll" ( let x = Lexing.lexeme lexbuf in TIdent x) # 1754 "compiler/lib/annot_lexer.ml" | 11 -> # 39 "compiler/lib/annot_lexer.mll" ( let x = Lexing.lexeme lexbuf in TVNum x) # 1761 "compiler/lib/annot_lexer.ml" | 12 -> # 42 "compiler/lib/annot_lexer.mll" (LPARENT) # 1766 "compiler/lib/annot_lexer.ml" | 13 -> # 43 "compiler/lib/annot_lexer.mll" (RPARENT) # 1771 "compiler/lib/annot_lexer.ml" | 14 -> # 44 "compiler/lib/annot_lexer.mll" (TComma) # 1776 "compiler/lib/annot_lexer.ml" | 15 -> # 45 "compiler/lib/annot_lexer.mll" (TSemi) # 1781 "compiler/lib/annot_lexer.ml" | 16 -> # 46 "compiler/lib/annot_lexer.mll" (LE) # 1786 "compiler/lib/annot_lexer.ml" | 17 -> # 47 "compiler/lib/annot_lexer.mll" (LT) # 1791 "compiler/lib/annot_lexer.ml" | 18 -> # 48 "compiler/lib/annot_lexer.mll" (GT) # 1796 "compiler/lib/annot_lexer.ml" | 19 -> # 49 "compiler/lib/annot_lexer.mll" (GE) # 1801 "compiler/lib/annot_lexer.ml" | 20 -> # 50 "compiler/lib/annot_lexer.mll" (EQ) # 1806 "compiler/lib/annot_lexer.ml" | 21 -> # 51 "compiler/lib/annot_lexer.mll" ( initial lexbuf ) # 1811 "compiler/lib/annot_lexer.ml" | 22 -> # 52 "compiler/lib/annot_lexer.mll" ( EOF ) # 1816 "compiler/lib/annot_lexer.ml" | 23 -> # 53 "compiler/lib/annot_lexer.mll" (EOL) # 1821 "compiler/lib/annot_lexer.ml" | 24 -> # 54 "compiler/lib/annot_lexer.mll" ( TOTHER(Lexing.lexeme lexbuf) ) # 1826 "compiler/lib/annot_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_initial_rec lexbuf __ocaml_lex_state ;; js_of_ocaml-3.5.2/compiler/lib/annot_lexer.mli000066400000000000000000000016251357507750000214120ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val initial : Lexing.lexbuf -> Annot_parser.token js_of_ocaml-3.5.2/compiler/lib/annot_lexer.mll000066400000000000000000000032101357507750000214050ustar00rootroot00000000000000{ (* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Annot_parser } let identifier = ['a'-'z''A'-'Z''_']+ rule initial = parse | "Provides" {TProvides} | "Requires" {TRequires} | "pure" {TA_Pure } | "const" {TA_Const } | "mutable" {TA_Mutable } | "mutator" {TA_Mutator } | "shallow" {TA_Shallow} | "object_literal" {TA_Object_literal} | "Version" {TVersion} | "Weakdef" {TWeakdef} | ['a'-'z''A'-'Z''$''_']['a'-'z''A'-'Z''$''_''0'-'9']* { let x = Lexing.lexeme lexbuf in TIdent x} | ['0'-'9']+ ('.' (['0'-'9']+)) * { let x = Lexing.lexeme lexbuf in TVNum x} | "(" {LPARENT} | ")" {RPARENT} | "," {TComma} | ":" {TSemi} | "<=" {LE} | "<" {LT} | ">" {GT} | ">=" {GE} | "=" {EQ} | [' ''\t']+ { initial lexbuf } | eof { EOF } | ['\n'] {EOL} | _ { TOTHER(Lexing.lexeme lexbuf) } js_of_ocaml-3.5.2/compiler/lib/annot_parser.ml000066400000000000000000001350051357507750000214160ustar00rootroot00000000000000 module MenhirBasics = struct exception Error type token = | TWeakdef | TVersion | TVNum of ( # 22 "annot_parser.mly" (string) # 13 "annot_parser.ml" ) | TSemi | TRequires | TProvides | TOTHER of ( # 24 "annot_parser.mly" (string) # 21 "annot_parser.ml" ) | TIdent of ( # 22 "annot_parser.mly" (string) # 26 "annot_parser.ml" ) | TComma | TA_Shallow | TA_Pure | TA_Object_literal | TA_Mutator | TA_Mutable | TA_Const | RPARENT | LT | LPARENT | LE | GT | GE | EQ | EOL | EOF end include MenhirBasics let _eRR = MenhirBasics.Error type _menhir_env = { _menhir_lexer: Lexing.lexbuf -> token; _menhir_lexbuf: Lexing.lexbuf; _menhir_token: token; mutable _menhir_error: bool } and _menhir_state = | MenhirState46 | MenhirState44 | MenhirState35 | MenhirState24 | MenhirState22 | MenhirState20 | MenhirState14 | MenhirState10 | MenhirState3 let rec _menhir_goto_endline : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_endline -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState14 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv175)) * _menhir_state * 'tv_separated_nonempty_list_TComma_version_) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_endline) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv173)) * _menhir_state * 'tv_separated_nonempty_list_TComma_version_) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_4 : 'tv_endline) : 'tv_endline) = _v in ((let (_menhir_stack, _, (l : 'tv_separated_nonempty_list_TComma_version_)) = _menhir_stack in let _2 = () in let _1 = () in let _v : ( # 27 "annot_parser.mly" (Primitive.t) # 88 "annot_parser.ml" ) = # 39 "annot_parser.mly" ( `Version (None,l) ) # 92 "annot_parser.ml" in _menhir_goto_annot _menhir_env _menhir_stack _v) : 'freshtv174)) : 'freshtv176) | MenhirState24 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv179)) * _menhir_state * 'tv_separated_nonempty_list_TComma_TIdent_) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_endline) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv177)) * _menhir_state * 'tv_separated_nonempty_list_TComma_TIdent_) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_4 : 'tv_endline) : 'tv_endline) = _v in ((let (_menhir_stack, _, (l : 'tv_separated_nonempty_list_TComma_TIdent_)) = _menhir_stack in let _2 = () in let _1 = () in let _v : ( # 27 "annot_parser.mly" (Primitive.t) # 110 "annot_parser.ml" ) = # 37 "annot_parser.mly" ( `Requires (None,l) ) # 114 "annot_parser.ml" in _menhir_goto_annot _menhir_env _menhir_stack _v) : 'freshtv178)) : 'freshtv180) | MenhirState46 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv183)) * ( # 22 "annot_parser.mly" (string) # 122 "annot_parser.ml" )) * 'tv_option_prim_annot_) * 'tv_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_endline) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv181)) * ( # 22 "annot_parser.mly" (string) # 130 "annot_parser.ml" )) * 'tv_option_prim_annot_) * 'tv_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_6 : 'tv_endline) : 'tv_endline) = _v in ((let (((_menhir_stack, (id : ( # 22 "annot_parser.mly" (string) # 137 "annot_parser.ml" ))), (opt : 'tv_option_prim_annot_)), (args : 'tv_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__)) = _menhir_stack in let _2 = () in let _1 = () in let _v : ( # 27 "annot_parser.mly" (Primitive.t) # 144 "annot_parser.ml" ) = # 35 "annot_parser.mly" ( `Provides (None,id,(match opt with None -> `Mutator | Some k -> k),args) ) # 148 "annot_parser.ml" in _menhir_goto_annot _menhir_env _menhir_stack _v) : 'freshtv182)) : 'freshtv184) | _ -> _menhir_fail () and _menhir_goto_separated_nonempty_list_TComma_arg_annot_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_separated_nonempty_list_TComma_arg_annot_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState35 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv167) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_separated_nonempty_list_TComma_arg_annot_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv165) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((x : 'tv_separated_nonempty_list_TComma_arg_annot_) : 'tv_separated_nonempty_list_TComma_arg_annot_) = _v in ((let _v : 'tv_loption_separated_nonempty_list_TComma_arg_annot__ = # 144 "" ( x ) # 169 "annot_parser.ml" in _menhir_goto_loption_separated_nonempty_list_TComma_arg_annot__ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv166)) : 'freshtv168) | MenhirState44 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv171 * _menhir_state * 'tv_arg_annot)) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_separated_nonempty_list_TComma_arg_annot_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv169 * _menhir_state * 'tv_arg_annot)) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((xs : 'tv_separated_nonempty_list_TComma_arg_annot_) : 'tv_separated_nonempty_list_TComma_arg_annot_) = _v in ((let (_menhir_stack, _menhir_s, (x : 'tv_arg_annot)) = _menhir_stack in let _2 = () in let _v : 'tv_separated_nonempty_list_TComma_arg_annot_ = # 243 "" ( x :: xs ) # 186 "annot_parser.ml" in _menhir_goto_separated_nonempty_list_TComma_arg_annot_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv170)) : 'freshtv172) | _ -> _menhir_fail () and _menhir_goto_separated_nonempty_list_TComma_version_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_separated_nonempty_list_TComma_version_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState10 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv161 * _menhir_state * 'tv_version)) * _menhir_state * 'tv_separated_nonempty_list_TComma_version_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv159 * _menhir_state * 'tv_version)) * _menhir_state * 'tv_separated_nonempty_list_TComma_version_) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (x : 'tv_version)), _, (xs : 'tv_separated_nonempty_list_TComma_version_)) = _menhir_stack in let _2 = () in let _v : 'tv_separated_nonempty_list_TComma_version_ = # 243 "" ( x :: xs ) # 206 "annot_parser.ml" in _menhir_goto_separated_nonempty_list_TComma_version_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv160)) : 'freshtv162) | MenhirState3 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv163)) * _menhir_state * 'tv_separated_nonempty_list_TComma_version_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | EOF -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState14 | EOL -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState14 | TOTHER _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState14) : 'freshtv164) | _ -> _menhir_fail () and _menhir_fail : unit -> 'a = fun () -> Printf.fprintf stderr "Internal failure -- please contact the parser generator's developers.\n%!"; assert false and _menhir_run15 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 24 "annot_parser.mly" (string) # 236 "annot_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv157) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 24 "annot_parser.mly" (string) # 245 "annot_parser.ml" )) : ( # 24 "annot_parser.mly" (string) # 249 "annot_parser.ml" )) = _v in ((let _v : 'tv_endline = # 67 "annot_parser.mly" ( failwith _1 ) # 254 "annot_parser.ml" in _menhir_goto_endline _menhir_env _menhir_stack _menhir_s _v) : 'freshtv158) and _menhir_run16 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv155) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_endline = # 65 "annot_parser.mly" ( () ) # 267 "annot_parser.ml" in _menhir_goto_endline _menhir_env _menhir_stack _menhir_s _v) : 'freshtv156) and _menhir_run17 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv153) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_endline = # 66 "annot_parser.mly" ( () ) # 280 "annot_parser.ml" in _menhir_goto_endline _menhir_env _menhir_stack _menhir_s _v) : 'freshtv154) and _menhir_goto_arg_annot : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_arg_annot -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv151 * _menhir_state * 'tv_arg_annot) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | TComma -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv145 * _menhir_state * 'tv_arg_annot) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TA_Const -> _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState44 | TA_Mutable -> _menhir_run38 _menhir_env (Obj.magic _menhir_stack) MenhirState44 | TA_Object_literal -> _menhir_run37 _menhir_env (Obj.magic _menhir_stack) MenhirState44 | TA_Shallow -> _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState44 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState44) : 'freshtv146) | RPARENT -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv147 * _menhir_state * 'tv_arg_annot) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_arg_annot)) = _menhir_stack in let _v : 'tv_separated_nonempty_list_TComma_arg_annot_ = # 241 "" ( [ x ] ) # 317 "annot_parser.ml" in _menhir_goto_separated_nonempty_list_TComma_arg_annot_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv148) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv149 * _menhir_state * 'tv_arg_annot) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv150)) : 'freshtv152) and _menhir_goto_op : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_op -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv143 * _menhir_state * 'tv_op) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | TVNum _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv139 * _menhir_state * 'tv_op) = Obj.magic _menhir_stack in let (_v : ( # 22 "annot_parser.mly" (string) # 342 "annot_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv137 * _menhir_state * 'tv_op) = Obj.magic _menhir_stack in let ((_2 : ( # 22 "annot_parser.mly" (string) # 350 "annot_parser.ml" )) : ( # 22 "annot_parser.mly" (string) # 354 "annot_parser.ml" )) = _v in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_op)) = _menhir_stack in let _v : 'tv_version = # 62 "annot_parser.mly" ( _1,_2 ) # 360 "annot_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv135) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_version) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv133 * _menhir_state * 'tv_version) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | TComma -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv127 * _menhir_state * 'tv_version) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | EQ -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState10 | GE -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState10 | GT -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState10 | LE -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState10 | LT -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState10 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState10) : 'freshtv128) | EOF | EOL | TOTHER _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv129 * _menhir_state * 'tv_version) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_version)) = _menhir_stack in let _v : 'tv_separated_nonempty_list_TComma_version_ = # 241 "" ( [ x ] ) # 399 "annot_parser.ml" in _menhir_goto_separated_nonempty_list_TComma_version_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv130) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv131 * _menhir_state * 'tv_version) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv132)) : 'freshtv134)) : 'freshtv136)) : 'freshtv138)) : 'freshtv140) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv141 * _menhir_state * 'tv_op) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv142)) : 'freshtv144) and _menhir_goto_separated_nonempty_list_TComma_TIdent_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_separated_nonempty_list_TComma_TIdent_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState22 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv123 * _menhir_state * ( # 22 "annot_parser.mly" (string) # 426 "annot_parser.ml" ))) * _menhir_state * 'tv_separated_nonempty_list_TComma_TIdent_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv121 * _menhir_state * ( # 22 "annot_parser.mly" (string) # 432 "annot_parser.ml" ))) * _menhir_state * 'tv_separated_nonempty_list_TComma_TIdent_) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (x : ( # 22 "annot_parser.mly" (string) # 437 "annot_parser.ml" ))), _, (xs : 'tv_separated_nonempty_list_TComma_TIdent_)) = _menhir_stack in let _2 = () in let _v : 'tv_separated_nonempty_list_TComma_TIdent_ = # 243 "" ( x :: xs ) # 443 "annot_parser.ml" in _menhir_goto_separated_nonempty_list_TComma_TIdent_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv122)) : 'freshtv124) | MenhirState20 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv125)) * _menhir_state * 'tv_separated_nonempty_list_TComma_TIdent_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | EOF -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState24 | EOL -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState24 | TOTHER _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState24 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState24) : 'freshtv126) | _ -> _menhir_fail () and _menhir_goto_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__ : _menhir_env -> 'ttv_tail -> 'tv_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__ -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv119)) * ( # 22 "annot_parser.mly" (string) # 472 "annot_parser.ml" )) * 'tv_option_prim_annot_) * 'tv_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | EOF -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState46 | EOL -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState46 | TOTHER _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState46 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState46) : 'freshtv120) and _menhir_goto_loption_separated_nonempty_list_TComma_arg_annot__ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_loption_separated_nonempty_list_TComma_arg_annot__ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv117) * _menhir_state * 'tv_loption_separated_nonempty_list_TComma_arg_annot__) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | RPARENT -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv113) * _menhir_state * 'tv_loption_separated_nonempty_list_TComma_arg_annot__) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv111) * _menhir_state * 'tv_loption_separated_nonempty_list_TComma_arg_annot__) = Obj.magic _menhir_stack in ((let (_menhir_stack, _, (xs : 'tv_loption_separated_nonempty_list_TComma_arg_annot__)) = _menhir_stack in let _3 = () in let _1 = () in let _v : 'tv_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__ = let x = let x = # 232 "" ( xs ) # 509 "annot_parser.ml" in # 200 "" ( x ) # 514 "annot_parser.ml" in # 116 "" ( Some x ) # 520 "annot_parser.ml" in _menhir_goto_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__ _menhir_env _menhir_stack _v) : 'freshtv112)) : 'freshtv114) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv115) * _menhir_state * 'tv_loption_separated_nonempty_list_TComma_arg_annot__) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv116)) : 'freshtv118) and _menhir_run36 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv109) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_arg_annot = # 50 "annot_parser.mly" ( `Shallow_const) # 541 "annot_parser.ml" in _menhir_goto_arg_annot _menhir_env _menhir_stack _menhir_s _v) : 'freshtv110) and _menhir_run37 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv107) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_arg_annot = # 51 "annot_parser.mly" ( `Object_literal) # 555 "annot_parser.ml" in _menhir_goto_arg_annot _menhir_env _menhir_stack _menhir_s _v) : 'freshtv108) and _menhir_run38 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv105) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_arg_annot = # 52 "annot_parser.mly" ( `Mutable) # 569 "annot_parser.ml" in _menhir_goto_arg_annot _menhir_env _menhir_stack _menhir_s _v) : 'freshtv106) and _menhir_run39 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv103) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_arg_annot = # 49 "annot_parser.mly" ( `Const ) # 583 "annot_parser.ml" in _menhir_goto_arg_annot _menhir_env _menhir_stack _menhir_s _v) : 'freshtv104) and _menhir_goto_annot : _menhir_env -> 'ttv_tail -> ( # 27 "annot_parser.mly" (Primitive.t) # 590 "annot_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv101) = Obj.magic _menhir_stack in let (_v : ( # 27 "annot_parser.mly" (Primitive.t) # 598 "annot_parser.ml" )) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv99) = Obj.magic _menhir_stack in let ((_1 : ( # 27 "annot_parser.mly" (Primitive.t) # 605 "annot_parser.ml" )) : ( # 27 "annot_parser.mly" (Primitive.t) # 609 "annot_parser.ml" )) = _v in (Obj.magic _1 : 'freshtv100)) : 'freshtv102) and _menhir_run4 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv97) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_op = # 56 "annot_parser.mly" ((<)) # 623 "annot_parser.ml" in _menhir_goto_op _menhir_env _menhir_stack _menhir_s _v) : 'freshtv98) and _menhir_run5 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv95) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_op = # 55 "annot_parser.mly" ((<=)) # 637 "annot_parser.ml" in _menhir_goto_op _menhir_env _menhir_stack _menhir_s _v) : 'freshtv96) and _menhir_run6 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv93) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_op = # 57 "annot_parser.mly" ((>)) # 651 "annot_parser.ml" in _menhir_goto_op _menhir_env _menhir_stack _menhir_s _v) : 'freshtv94) and _menhir_run7 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv91) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_op = # 58 "annot_parser.mly" ((>=)) # 665 "annot_parser.ml" in _menhir_goto_op _menhir_env _menhir_stack _menhir_s _v) : 'freshtv92) and _menhir_run8 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv89) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in ((let _1 = () in let _v : 'tv_op = # 59 "annot_parser.mly" ((=)) # 679 "annot_parser.ml" in _menhir_goto_op _menhir_env _menhir_stack _menhir_s _v) : 'freshtv90) and _menhir_errorcase : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> match _menhir_s with | MenhirState46 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv71)) * ( # 22 "annot_parser.mly" (string) # 691 "annot_parser.ml" )) * 'tv_option_prim_annot_) * 'tv_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv72) | MenhirState44 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv73 * _menhir_state * 'tv_arg_annot)) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv74) | MenhirState35 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv75) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv76) | MenhirState24 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv77)) * _menhir_state * 'tv_separated_nonempty_list_TComma_TIdent_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv78) | MenhirState22 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv79 * _menhir_state * ( # 22 "annot_parser.mly" (string) # 713 "annot_parser.ml" ))) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv80) | MenhirState20 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv81)) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv82) | MenhirState14 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv83)) * _menhir_state * 'tv_separated_nonempty_list_TComma_version_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv84) | MenhirState10 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv85 * _menhir_state * 'tv_version)) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv86) | MenhirState3 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv87)) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv88) and _menhir_run21 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 22 "annot_parser.mly" (string) # 739 "annot_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TComma -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv65 * _menhir_state * ( # 22 "annot_parser.mly" (string) # 751 "annot_parser.ml" )) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TIdent _v -> _menhir_run21 _menhir_env (Obj.magic _menhir_stack) MenhirState22 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState22) : 'freshtv66) | EOF | EOL | TOTHER _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv67 * _menhir_state * ( # 22 "annot_parser.mly" (string) # 767 "annot_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : ( # 22 "annot_parser.mly" (string) # 772 "annot_parser.ml" ))) = _menhir_stack in let _v : 'tv_separated_nonempty_list_TComma_TIdent_ = # 241 "" ( [ x ] ) # 777 "annot_parser.ml" in _menhir_goto_separated_nonempty_list_TComma_TIdent_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv68) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv69 * _menhir_state * ( # 22 "annot_parser.mly" (string) # 787 "annot_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv70) and _menhir_goto_option_prim_annot_ : _menhir_env -> 'ttv_tail -> 'tv_option_prim_annot_ -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv63)) * ( # 22 "annot_parser.mly" (string) # 799 "annot_parser.ml" )) * 'tv_option_prim_annot_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | LPARENT -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv57) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TA_Const -> _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState35 | TA_Mutable -> _menhir_run38 _menhir_env (Obj.magic _menhir_stack) MenhirState35 | TA_Object_literal -> _menhir_run37 _menhir_env (Obj.magic _menhir_stack) MenhirState35 | TA_Shallow -> _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState35 | RPARENT -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv55) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState35 in ((let _v : 'tv_loption_separated_nonempty_list_TComma_arg_annot__ = # 142 "" ( [] ) # 825 "annot_parser.ml" in _menhir_goto_loption_separated_nonempty_list_TComma_arg_annot__ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv56) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState35) : 'freshtv58) | EOF | EOL | TOTHER _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv59) = Obj.magic _menhir_stack in ((let _v : 'tv_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__ = # 114 "" ( None ) # 838 "annot_parser.ml" in _menhir_goto_option_delimited_LPARENT_separated_list_TComma_arg_annot__RPARENT__ _menhir_env _menhir_stack _v) : 'freshtv60) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv61)) * ( # 22 "annot_parser.mly" (string) # 848 "annot_parser.ml" )) * 'tv_option_prim_annot_) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv62)) : 'freshtv64) and _menhir_goto_prim_annot : _menhir_env -> 'ttv_tail -> 'tv_prim_annot -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv53) = Obj.magic _menhir_stack in let (_v : 'tv_prim_annot) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv51) = Obj.magic _menhir_stack in let ((x : 'tv_prim_annot) : 'tv_prim_annot) = _v in ((let _v : 'tv_option_prim_annot_ = # 116 "" ( Some x ) # 863 "annot_parser.ml" in _menhir_goto_option_prim_annot_ _menhir_env _menhir_stack _v) : 'freshtv52)) : 'freshtv54) and _menhir_discard : _menhir_env -> _menhir_env = fun _menhir_env -> let lexer = _menhir_env._menhir_lexer in let lexbuf = _menhir_env._menhir_lexbuf in let _tok = lexer lexbuf in { _menhir_lexer = lexer; _menhir_lexbuf = lexbuf; _menhir_token = _tok; _menhir_error = false; } and annot : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> ( # 27 "annot_parser.mly" (Primitive.t) # 882 "annot_parser.ml" ) = fun lexer lexbuf -> let _menhir_env = let (lexer : Lexing.lexbuf -> token) = lexer in let (lexbuf : Lexing.lexbuf) = lexbuf in ((let _tok = Obj.magic () in { _menhir_lexer = lexer; _menhir_lexbuf = lexbuf; _menhir_token = _tok; _menhir_error = false; }) : _menhir_env) in Obj.magic (let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv49) = ((), _menhir_env._menhir_lexbuf.Lexing.lex_curr_p) in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TProvides -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv29) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TSemi -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv25) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TIdent _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv21)) = Obj.magic _menhir_stack in let (_v : ( # 22 "annot_parser.mly" (string) # 919 "annot_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TA_Const -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv3) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1) = Obj.magic _menhir_stack in ((let _1 = () in let _v : 'tv_prim_annot = # 44 "annot_parser.mly" (`Pure) # 935 "annot_parser.ml" in _menhir_goto_prim_annot _menhir_env _menhir_stack _v) : 'freshtv2)) : 'freshtv4) | TA_Mutable -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv7) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv5) = Obj.magic _menhir_stack in ((let _1 = () in let _v : 'tv_prim_annot = # 45 "annot_parser.mly" (`Mutable) # 948 "annot_parser.ml" in _menhir_goto_prim_annot _menhir_env _menhir_stack _v) : 'freshtv6)) : 'freshtv8) | TA_Mutator -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv11) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv9) = Obj.magic _menhir_stack in ((let _1 = () in let _v : 'tv_prim_annot = # 46 "annot_parser.mly" (`Mutator) # 961 "annot_parser.ml" in _menhir_goto_prim_annot _menhir_env _menhir_stack _v) : 'freshtv10)) : 'freshtv12) | TA_Pure -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv15) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv13) = Obj.magic _menhir_stack in ((let _1 = () in let _v : 'tv_prim_annot = # 43 "annot_parser.mly" (`Pure) # 974 "annot_parser.ml" in _menhir_goto_prim_annot _menhir_env _menhir_stack _v) : 'freshtv14)) : 'freshtv16) | EOF | EOL | LPARENT | TOTHER _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv17) = Obj.magic _menhir_stack in ((let _v : 'tv_option_prim_annot_ = # 114 "" ( None ) # 983 "annot_parser.ml" in _menhir_goto_option_prim_annot_ _menhir_env _menhir_stack _v) : 'freshtv18) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv19)) * ( # 22 "annot_parser.mly" (string) # 993 "annot_parser.ml" )) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv20)) : 'freshtv22) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv23)) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv24)) : 'freshtv26) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv27) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv28)) : 'freshtv30) | TRequires -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv35) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TSemi -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv31) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TIdent _v -> _menhir_run21 _menhir_env (Obj.magic _menhir_stack) MenhirState20 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState20) : 'freshtv32) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv33) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv34)) : 'freshtv36) | TVersion -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv41) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | TSemi -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv37) = Obj.magic _menhir_stack in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | EQ -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState3 | GE -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState3 | GT -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState3 | LE -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState3 | LT -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState3 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState3) : 'freshtv38) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv39) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv40)) : 'freshtv42) | TWeakdef -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv45) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv43) = Obj.magic _menhir_stack in ((let _1 = () in let _v : ( # 27 "annot_parser.mly" (Primitive.t) # 1073 "annot_parser.ml" ) = # 40 "annot_parser.mly" ( `Weakdef None ) # 1077 "annot_parser.ml" in _menhir_goto_annot _menhir_env _menhir_stack _v) : 'freshtv44)) : 'freshtv46) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv47) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv48)) : 'freshtv50)) # 269 "" # 1090 "annot_parser.ml" js_of_ocaml-3.5.2/compiler/lib/annot_parser.mli000066400000000000000000000010241357507750000215600ustar00rootroot00000000000000 (* The type of tokens. *) type token = | TWeakdef | TVersion | TVNum of (string) | TSemi | TRequires | TProvides | TOTHER of (string) | TIdent of (string) | TComma | TA_Shallow | TA_Pure | TA_Object_literal | TA_Mutator | TA_Mutable | TA_Const | RPARENT | LT | LPARENT | LE | GT | GE | EQ | EOL | EOF (* This exception is raised by the monolithic API functions. *) exception Error (* The monolithic API. *) val annot: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Primitive.t) js_of_ocaml-3.5.2/compiler/lib/annot_parser.mly000066400000000000000000000037321357507750000216100ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) %token TProvides TRequires TVersion TWeakdef %token TA_Pure TA_Const TA_Mutable TA_Mutator TA_Shallow TA_Object_literal %token TIdent TVNum %token TComma TSemi EOF EOL LE LT GE GT EQ LPARENT RPARENT %token TOTHER %start annot %type annot %% annot: | TProvides TSemi id=TIdent opt=option(prim_annot) args=option(delimited(LPARENT, separated_list(TComma,arg_annot),RPARENT)) endline { `Provides (None,id,(match opt with None -> `Mutator | Some k -> k),args) } | TRequires TSemi l=separated_nonempty_list(TComma,TIdent) endline { `Requires (None,l) } | TVersion TSemi l=separated_nonempty_list(TComma,version) endline { `Version (None,l) } | TWeakdef { `Weakdef None } prim_annot: | TA_Pure {`Pure} | TA_Const {`Pure} | TA_Mutable {`Mutable} | TA_Mutator {`Mutator} arg_annot: | TA_Const { `Const } | TA_Shallow { `Shallow_const} | TA_Object_literal { `Object_literal} | TA_Mutable { `Mutable} op: | LE {(<=)} | LT {(<)} | GT {(>)} | GE {(>=)} | EQ {(=)} version: | op TVNum { $1,$2 } endline: | EOL { () } | EOF { () } | TOTHER { failwith $1 } js_of_ocaml-3.5.2/compiler/lib/base64.ml000066400000000000000000000240141357507750000200040ustar00rootroot00000000000000(* * Copyright (c) 2006-2009 Citrix Systems Inc. * Copyright (c) 2010 Thomas Gazagnaire * Copyright (c) 2014-2016 Anil Madhavapeddy * Copyright (c) 2016 David Kaloper Meršinjak * Copyright (c) 2018 Romain Calascibetta * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * *) open! Stdlib type ('a, 'b) result = | Ok of 'a | Error of 'b type alphabet = { emap : int array ; dmap : int array } type sub = string * int * int let ( // ) x y = if x > 0 then 1 + ((x - 1) / y) else 0 let unsafe_get_uint8 t off = Char.code (String.unsafe_get t off) let unsafe_set_uint8 t off v = Bytes.unsafe_set t off (Char.chr v) external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_string_set16u" [@@noalloc] external unsafe_get_uint16 : string -> int -> int = "%caml_string_get16u" [@@noalloc] external swap16 : int -> int = "%bswap16" [@@noalloc] let none = -1 (* We mostly want to have an optional array for [dmap] (e.g. [int option array]). So we consider the [none] value as [-1]. *) let make_alphabet alphabet = if String.length alphabet <> 64 then invalid_arg "Length of alphabet must be 64"; if String.contains alphabet '=' then invalid_arg "Alphabet can not contain padding character"; let emap = Array.init (String.length alphabet) ~f:(fun i -> Char.code alphabet.[i]) in let dmap = Array.make 256 none in String.iteri ~f:(fun idx chr -> dmap.(Char.code chr) <- idx) alphabet; { emap; dmap } let length_alphabet { emap; _ } = Array.length emap let alphabet { emap; _ } = emap let default_alphabet = make_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" let uri_safe_alphabet = make_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" let unsafe_set_be_uint16 = if Sys.big_endian then fun t off v -> unsafe_set_uint16 t off v else fun t off v -> unsafe_set_uint16 t off (swap16 v) (* We make this exception to ensure to keep a control about which exception we can raise and avoid appearance of unknown exceptions like an ex-nihilo magic rabbit (or magic money?). *) exception Out_of_bounds let get_uint8 t off = if off < 0 || off >= String.length t then raise Out_of_bounds; unsafe_get_uint8 t off let padding = int_of_char '=' let error_msgf fmt = Format.ksprintf (fun err -> Error (`Msg err)) fmt let encode_sub pad { emap; _ } ?(off = 0) ?len input = let len = match len with | Some len -> len | None -> String.length input - off in if len < 0 || off < 0 || off > String.length input - len then error_msgf "Invalid bounds" else let n = len in let n' = n // 3 * 4 in let res = Bytes.create n' in let emap i = Array.unsafe_get emap i in let emit b1 b2 b3 i = unsafe_set_be_uint16 res i ((emap ((b1 lsr 2) land 0x3f) lsl 8) lor emap ((b1 lsl 4) lor (b2 lsr 4) land 0x3f)); unsafe_set_be_uint16 res (i + 2) ((emap ((b2 lsl 2) lor (b3 lsr 6) land 0x3f) lsl 8) lor emap (b3 land 0x3f)) in let rec enc j i = if i = n then () else if i = n - 1 then emit (unsafe_get_uint8 input (off + i)) 0 0 j else if i = n - 2 then emit (unsafe_get_uint8 input (off + i)) (unsafe_get_uint8 input (off + i + 1)) 0 j else ( emit (unsafe_get_uint8 input (off + i)) (unsafe_get_uint8 input (off + i + 1)) (unsafe_get_uint8 input (off + i + 2)) j; enc (j + 4) (i + 3)) in let rec unsafe_fix = function | 0 -> () | i -> unsafe_set_uint8 res (n' - i) padding; unsafe_fix (i - 1) in enc 0 0; let pad_to_write = (3 - (n mod 3)) mod 3 in if pad then ( unsafe_fix pad_to_write; Ok (Bytes.unsafe_to_string res, 0, n')) else Ok (Bytes.unsafe_to_string res, 0, n' - pad_to_write) (* [pad = false], we don't want to write them. *) let encode ?(pad = true) ?(alphabet = default_alphabet) ?off ?len input = match encode_sub pad alphabet ?off ?len input with | Ok (res, off, len) -> Ok (String.sub res ~pos:off ~len) | Error _ as err -> err let encode_string ?pad ?alphabet input = match encode ?pad ?alphabet input with | Ok res -> res | Error _ -> assert false let encode_sub ?(pad = true) ?(alphabet = default_alphabet) ?off ?len input = encode_sub pad alphabet ?off ?len input let encode_exn ?pad ?alphabet ?off ?len input = match encode ?pad ?alphabet ?off ?len input with | Ok v -> v | Error (`Msg err) -> invalid_arg err let decode_sub ?(pad = true) { dmap; _ } ?(off = 0) ?len input = let len = match len with | Some len -> len | None -> String.length input - off in if len < 0 || off < 0 || off > String.length input - len then error_msgf "Invalid bounds" else let n = len // 4 * 4 in let n' = n // 4 * 3 in let res = Bytes.create n' in let get_uint8_or_padding = if pad then (fun t i -> if i >= len then raise Out_of_bounds; get_uint8 t (off + i)) else fun t i -> try if i < len then get_uint8 t (off + i) else padding with Out_of_bounds -> padding in let set_be_uint16 t off v = (* can not write 2 bytes. *) if off < 0 || off + 1 > Bytes.length t then () (* can not write 1 byte but can write 1 byte *) else if off < 0 || off + 2 > Bytes.length t then unsafe_set_uint8 t off (v lsr 8) (* can write 2 bytes. *) else unsafe_set_be_uint16 t off v in let set_uint8 t off v = if off < 0 || off >= Bytes.length t then () else unsafe_set_uint8 t off v in let emit a b c d j = let x = (a lsl 18) lor (b lsl 12) lor (c lsl 6) lor d in set_be_uint16 res j (x lsr 8); set_uint8 res (j + 2) (x land 0xff) in let dmap i = let x = Array.unsafe_get dmap i in if x = none then raise Not_found; x in let only_padding pad idx = (* because we round length of [res] to the upper bound of how many characters we should have from [input], we got at this stage only padding characters and we need to delete them, so for each [====], we delete 3 bytes. *) let pad = ref (pad + 3) in let idx = ref idx in while !idx + 4 < len do (* use [unsafe_get_uint16] instead [unsafe_get_uint32] to avoid allocation of [int32]. Of course, [3d3d3d3d] is [====]. *) if unsafe_get_uint16 input (off + !idx) <> 0x3d3d || unsafe_get_uint16 input (off + !idx + 2) <> 0x3d3d then raise Not_found; (* We got something bad, should be a valid character according to [alphabet] but outside the scope. *) idx := !idx + 4; pad := !pad + 3 done; while !idx < len do if unsafe_get_uint8 input (off + !idx) <> padding then raise Not_found; incr idx done; !pad in let rec dec j i = if i = n then 0 else let d, pad = let x = get_uint8_or_padding input (i + 3) in try dmap x, 0 with Not_found when x = padding -> 0, 1 in (* [Not_found] iff [x ∉ alphabet and x <> '='] can leak. *) let c, pad = let x = get_uint8_or_padding input (i + 2) in try dmap x, pad with Not_found when x = padding && pad = 1 -> 0, 2 in (* [Not_found] iff [x ∉ alphabet and x <> '='] can leak. *) let b, pad = let x = get_uint8_or_padding input (i + 1) in try dmap x, pad with Not_found when x = padding && pad = 2 -> 0, 3 in (* [Not_found] iff [x ∉ alphabet and x <> '='] can leak. *) let a, pad = let x = get_uint8_or_padding input i in try dmap x, pad with Not_found when x = padding && pad = 3 -> 0, 4 in (* [Not_found] iff [x ∉ alphabet and x <> '='] can leak. *) emit a b c d j; if i + 4 = n (* end of input in anyway *) then match pad with | 0 -> 0 | 4 -> 3 (* [get_uint8] lies and if we get [4], that mean we got one or more (at most 4) padding character. In this situation, because we round length of [res] (see [n // 4]), we need to delete 3 bytes. *) | pad -> pad else match pad with | 0 -> dec (j + 3) (i + 4) | 4 -> only_padding 3 (i + 4) (* Same situation than above but we should get only more padding characters then. *) | pad -> only_padding pad (i + 4) in match dec 0 0 with | 0 -> Ok (Bytes.unsafe_to_string res, 0, n') | pad -> Ok (Bytes.unsafe_to_string res, 0, n' - pad) | exception Out_of_bounds -> error_msgf "Wrong padding" (* appear only when [pad = true] and when length of input is not a multiple of 4. *) | exception Not_found -> (* appear when one character of [input] ∉ [alphabet] and this character <> '=' *) error_msgf "Malformed input" let decode ?pad ?(alphabet = default_alphabet) ?off ?len input = match decode_sub ?pad alphabet ?off ?len input with | Ok (res, off, len) -> Ok (String.sub res ~pos:off ~len) | Error _ as err -> err let decode_sub ?pad ?(alphabet = default_alphabet) ?off ?len input = decode_sub ?pad alphabet ?off ?len input let decode_exn ?pad ?alphabet ?off ?len input = match decode ?pad ?alphabet ?off ?len input with | Ok res -> res | Error (`Msg err) -> invalid_arg err js_of_ocaml-3.5.2/compiler/lib/base64.mli000066400000000000000000000105651357507750000201630ustar00rootroot00000000000000(* * Copyright (c) 2006-2009 Citrix Systems Inc. * Copyright (c) 2010 Thomas Gazagnaire * Copyright (c) 2014-2016 Anil Madhavapeddy * Copyright (c) 2018 Romain Calascibetta * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * *) (** Base64 RFC4648 implementation. Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. It is specified in RFC 4648. {e Release %%VERSION%% - %%PKG_HOMEPAGE%%} *) type ('a, 'b) result = | Ok of 'a | Error of 'b type alphabet (** Type of alphabet. *) type sub = string * int * int (** Type of sub-string: [str, off, len]. *) val default_alphabet : alphabet (** A 64-character alphabet specifying the regular Base64 alphabet. *) val uri_safe_alphabet : alphabet (** A 64-character alphabet specifying the URI- and filename-safe Base64 alphabet. *) val make_alphabet : string -> alphabet (** Make a new alphabet. *) val length_alphabet : alphabet -> int (** Returns length of the alphabet, should be 64. *) val alphabet : alphabet -> int array (** Returns the alphabet. *) val decode_exn : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> string (** [decode_exn ?off ?len s] decodes [len] bytes (defaults to [String.length s - off]) of the string [s] starting from [off] (defaults to [0]) that is encoded in Base64 format. Will leave trailing NULLs on the string, padding it out to a multiple of 3 characters. [alphabet] defaults to {!default_alphabet}. [pad = true] specifies to check if [s] is padded or not, otherwise, it raises an exception. Decoder can fail when character of [s] is not a part of [alphabet] or is not [padding] character. If input is not padded correctly, decoder does the best-effort but it does not ensure [decode_exn (encode ~pad:false x) = x]. @raise if Invalid_argument [s] is not a valid Base64 string. *) val decode_sub : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> (sub, [ `Msg of string ]) result (** Same as {!decode_exn} but it returns a result type instead to raise an exception. Then, it returns a {!sub} string. Decoded input [(str, off, len)] will starting to [off] and will have [len] bytes - by this way, we ensure to allocate only one time result. *) val decode : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> (string, [ `Msg of string ]) result (** Same as {!decode_exn}, but returns an explicit error message {!result} if it fails. *) val encode : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> (string, [ `Msg of string ]) result (** [encode s] encodes the string [s] into base64. If [pad] is false, no trailing padding is added. [pad] defaults to [true], and [alphabet] to {!default_alphabet}. [encode] fails when [off] and [len] do not designate a valid range of [s]. *) val encode_string : ?pad:bool -> ?alphabet:alphabet -> string -> string (** [encode_string s] encodes the string [s] into base64. If [pad] is false, no trailing padding is added. [pad] defaults to [true], and [alphabet] to {!default_alphabet}. *) val encode_sub : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> (sub, [ `Msg of string ]) result (** Same as {!encode} but return a {!sub}-string instead a plain result. By this way, we ensure to allocate only one time result. *) val encode_exn : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> string (** Same as {!encode} but raises an invalid argument exception if we retrieve an error. *) js_of_ocaml-3.5.2/compiler/lib/build_path_prefix_map.ml000066400000000000000000000101231357507750000232410ustar00rootroot00000000000000(**************************************************************************) (* *) (* OCaml *) (* *) (* Gabriel Scherer, projet Parsifal, INRIA Saclay *) (* *) (* Copyright 2017 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) open! Stdlib type path = string type path_prefix = string type error_message = string type ('a, 'b) result = | Ok of 'a | Error of 'b let errorf fmt = Printf.kprintf (fun err -> Error err) fmt let encode_prefix str = let buf = Buffer.create (String.length str) in let push_char = function | '%' -> Buffer.add_string buf "%#" | '=' -> Buffer.add_string buf "%+" | ':' -> Buffer.add_string buf "%." | c -> Buffer.add_char buf c in String.iter ~f:push_char str; Buffer.contents buf let decode_prefix str = let buf = Buffer.create (String.length str) in let rec loop i = if i >= String.length str then Ok (Buffer.contents buf) else match str.[i] with | ('=' | ':') as c -> errorf "invalid character '%c' in key or value" c | '%' -> ( let push c = Buffer.add_char buf c; loop (i + 2) in if i + 1 = String.length str then errorf "invalid encoded string %S (trailing '%%')" str else match str.[i + 1] with | '#' -> push '%' | '+' -> push '=' | '.' -> push ':' | c -> errorf "invalid %%-escaped character '%c'" c) | c -> Buffer.add_char buf c; loop (i + 1) in loop 0 type pair = { target : path_prefix ; source : path_prefix } let encode_pair { target; source } = String.concat ~sep:"=" [ encode_prefix target; encode_prefix source ] let decode_pair str = match String.lsplit2 str ~on:'=' with | None -> errorf "invalid key/value pair %S, no '=' separator" str | Some (encoded_target, encoded_source) -> ( match decode_prefix encoded_target, decode_prefix encoded_source with | Ok target, Ok source -> Ok { target; source } | (Error _ as err), _ | _, (Error _ as err) -> err) type map = pair option list let encode_map map = let encode_elem = function | None -> "" | Some pair -> encode_pair pair in List.map ~f:encode_elem map |> String.concat ~sep:":" exception Shortcut of error_message let decode_map str = let decode_or_empty = function | "" -> None | pair -> ( match decode_pair pair with | Ok str -> Some str | Error err -> raise (Shortcut err)) in let pairs = Stdlib.String.split_char ~sep:':' str in match List.map ~f:decode_or_empty pairs with | exception Shortcut err -> Error err | map -> Ok map let rewrite_opt prefix_map path = let is_prefix = function | None -> false | Some { target = _; source } -> String.is_prefix path ~prefix:source in match List.find ~f:is_prefix (* read key/value pairs from right to left, as the spec demands *) (List.rev prefix_map) with | exception Not_found -> None | None -> None | Some { source; target } -> Some (target ^ String.sub path ~pos:(String.length source) ~len:(String.length path - String.length source)) let rewrite prefix_map path = match rewrite_opt prefix_map path with | None -> path | Some path -> path js_of_ocaml-3.5.2/compiler/lib/build_path_prefix_map.mli000066400000000000000000000037541357507750000234260ustar00rootroot00000000000000(**************************************************************************) (* *) (* OCaml *) (* *) (* Gabriel Scherer, projet Parsifal, INRIA Saclay *) (* *) (* Copyright 2017 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** Rewrite paths for reproducible builds {b Warning:} this module is unstable and part of {{!Compiler_libs}compiler-libs}. *) type path = string type path_prefix = string type error_message = string type ('a, 'b) result = | Ok of 'a | Error of 'b val encode_prefix : path_prefix -> string val decode_prefix : string -> (path_prefix, error_message) result type pair = { target : path_prefix ; source : path_prefix } val encode_pair : pair -> string val decode_pair : string -> (pair, error_message) result type map = pair option list val encode_map : map -> string val decode_map : string -> (map, error_message) result val rewrite_opt : map -> path -> path option (** [rewrite_opt map path] tries to find a source in [map] that is a prefix of the input [path]. If it succeeds, it replaces this prefix with the corresponding target. If it fails, it just returns [None]. *) val rewrite : map -> path -> path js_of_ocaml-3.5.2/compiler/lib/code.ml000066400000000000000000000375071357507750000176450ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib module Addr = struct type t = int module Set = Set.Make (Int) module Map = Map.Make (Int) let to_string = string_of_int let zero = 0 let pred = pred let succ = succ end module DebugAddr : sig type t = private Addr.t val of_addr : Addr.t -> t val to_addr : t -> Addr.t val no : t end = struct type t = int let of_addr (x : Addr.t) : t = x let no = 0 let to_addr (x : t) : Addr.t = x end module Var : sig type t val print : Format.formatter -> t -> unit val equal : t -> t -> bool val idx : t -> int val of_idx : int -> t val to_string : ?origin:t -> t -> string val fresh : unit -> t val fresh_n : string -> t val fork : t -> t val count : unit -> int val compare : t -> t -> int val get_loc : t -> Parse_info.t option val loc : t -> Parse_info.t -> unit val name : t -> string -> unit val get_name : t -> string option val propagate_name : t -> t -> unit val reset : unit -> unit val set_pretty : bool -> unit val set_stable : bool -> unit module Set : Set.S with type elt = t module Map : Map.S with type key = t module Tbl : sig type key = t type 'a t type size = unit val get : 'a t -> key -> 'a val set : 'a t -> key -> 'a -> unit val make : size -> 'a -> 'a t end module ISet : sig type elt = t type t val empty : unit -> t val iter : (elt -> unit) -> t -> unit val mem : t -> elt -> bool val add : t -> elt -> unit val remove : t -> elt -> unit val copy : t -> t end end = struct module T = struct type t = int let compare : t -> t -> int = compare let equal (a : t) (b : t) = a = b end include T let printer = VarPrinter.create VarPrinter.Alphabet.javascript let locations = Hashtbl.create 17 let last_var = ref 0 let reset () = last_var := 0; Hashtbl.clear locations; VarPrinter.reset printer let to_string ?origin i = VarPrinter.to_string printer ?origin i let print f x = Format.fprintf f "v%d" x (* Format.fprintf f "%s" (to_string x) *) let name i nm = VarPrinter.name printer i nm let loc i pi = Hashtbl.add locations i pi (*; Format.eprintf "loc for %d : %d-%d\n%!" i pi.Parse_info.line pi.Parse_info.col *) let get_loc i = try Some (Hashtbl.find locations i) with Not_found -> None let fresh () = incr last_var; !last_var let fresh_n nm = incr last_var; name !last_var nm; !last_var let count () = !last_var + 1 let idx v = v let of_idx v = v let get_name i = VarPrinter.get_name printer i let propagate_name i j = VarPrinter.propagate_name printer i j; match get_loc i with | None -> () | Some l -> loc j l let set_pretty b = VarPrinter.set_pretty printer b let set_stable b = VarPrinter.set_stable printer b let fork o = let n = fresh () in propagate_name o n; n let dummy = -1 module Set = Set.Make (T) module Map = Map.Make (T) module Tbl = struct type 'a t = 'a array type key = T.t type size = unit let get t x = t.(x) let set t x v = t.(x) <- v let make () v = Array.make (count ()) v end module ISet = struct type t = T.t array type elt = T.t let iter f t = for i = 0 to Array.length t - 1 do let x = t.(i) in if compare x dummy <> 0 then f x done let mem t x = compare t.(x) dummy <> 0 let add t x = t.(x) <- x let remove t x = t.(x) <- dummy let copy = Array.copy let empty _v = Array.make (count ()) dummy end end type cont = Addr.t * Var.t list type prim = | Vectlength | Array_get | Extern of string | Not | IsInt | Eq | Neq | Lt | Le | Ult type array_or_not = | Array | NotArray | Unknown type constant = | String of string | IString of string | Float of float | Float_array of float array | Int64 of int64 | Tuple of int * constant array * array_or_not | Int of int32 type prim_arg = | Pv of Var.t | Pc of constant type expr = | Const of int32 | Apply of Var.t * Var.t list * bool | Block of int * Var.t array * array_or_not | Field of Var.t * int | Closure of Var.t list * cont | Constant of constant | Prim of prim * prim_arg list type instr = | Let of Var.t * expr | Set_field of Var.t * int * Var.t | Offset_ref of Var.t * int | Array_set of Var.t * Var.t * Var.t type cond = | IsTrue | CEq of int32 | CLt of int32 | CLe of int32 | CUlt of int32 type last = | Return of Var.t | Raise of Var.t * [ `Normal | `Notrace | `Reraise ] | Stop | Branch of cont | Cond of cond * Var.t * cont * cont | Switch of Var.t * cont array * cont array | Pushtrap of cont * Var.t * cont * Addr.Set.t | Poptrap of cont * Addr.t type block = { params : Var.t list ; handler : (Var.t * cont) option ; body : instr list ; branch : last } type program = Addr.t * block Addr.Map.t * Addr.t (****) let rec print_list pr f l = match l with | [] -> () | [ x ] -> pr f x | x :: r -> Format.fprintf f "%a, %a" pr x (print_list pr) r let print_var_list = print_list Var.print let print_cont f (pc, args) = Format.fprintf f "%d (%a)" pc print_var_list args let rec print_constant f x = match x with | String s -> Format.fprintf f "%S" s | IString s -> Format.fprintf f "%S" s | Float fl -> Format.fprintf f "%.12g" fl | Float_array a -> Format.fprintf f "[|"; for i = 0 to Array.length a - 1 do if i > 0 then Format.fprintf f ", "; Format.fprintf f "%.12g" a.(i) done; Format.fprintf f "|]" | Int64 i -> Format.fprintf f "%LdL" i | Tuple (tag, a, _) -> ( Format.fprintf f "<%d>" tag; match Array.length a with | 0 -> () | 1 -> Format.fprintf f "("; print_constant f a.(0); Format.fprintf f ")" | n -> Format.fprintf f "("; print_constant f a.(0); for i = 1 to n - 1 do Format.fprintf f ", "; print_constant f a.(i) done; Format.fprintf f ")") | Int i -> Format.fprintf f "%ld" i let print_arg f a = match a with | Pv x -> Var.print f x | Pc c -> print_constant f c let binop s = match s with | "%int_add" -> "+" | "%int_sub" -> "-" | "%int_mul" -> "*" | "%int_div" -> "/" | "%int_mod" -> "%" | "%int_and" -> "&" | "%int_or" -> "|" | "%int_xor" -> "^" | "%int_lsl" -> "<<" | "%int_lsr" -> ">>>" | "%int_asr" -> ">>" | _ -> raise Not_found let unop s = match s with | "%int_neg" -> "-" | _ -> raise Not_found let print_prim f p l = match p, l with | Vectlength, [ x ] -> Format.fprintf f "%a.length" print_arg x | Array_get, [ x; y ] -> Format.fprintf f "%a[%a]" print_arg x print_arg y | Extern s, [ x; y ] -> ( try Format.fprintf f "%a %s %a" print_arg x (binop s) print_arg y with Not_found -> Format.fprintf f "\"%s\"(%a)" s (print_list print_arg) l) | Extern s, [ x ] -> ( try Format.fprintf f "%s %a" (unop s) print_arg x with Not_found -> Format.fprintf f "\"%s\"(%a)" s (print_list print_arg) l) | Extern s, _ -> Format.fprintf f "\"%s\"(%a)" s (print_list print_arg) l | Not, [ x ] -> Format.fprintf f "!%a" print_arg x | IsInt, [ x ] -> Format.fprintf f "is_int(%a)" print_arg x | Eq, [ x; y ] -> Format.fprintf f "%a === %a" print_arg x print_arg y | Neq, [ x; y ] -> Format.fprintf f "!(%a === %a)" print_arg x print_arg y | Lt, [ x; y ] -> Format.fprintf f "%a < %a" print_arg x print_arg y | Le, [ x; y ] -> Format.fprintf f "%a <= %a" print_arg x print_arg y | Ult, [ x; y ] -> Format.fprintf f "%a <= %a" print_arg x print_arg y | _ -> assert false let print_expr f e = match e with | Const i -> Format.fprintf f "%ld" i | Apply (g, l, exact) -> if exact then Format.fprintf f "%a!(%a)" Var.print g print_var_list l else Format.fprintf f "%a(%a)" Var.print g print_var_list l | Block (t, a, _) -> Format.fprintf f "{tag=%d" t; for i = 0 to Array.length a - 1 do Format.fprintf f "; %d = %a" i Var.print a.(i) done; Format.fprintf f "}" | Field (x, i) -> Format.fprintf f "%a[%d]" Var.print x i | Closure (l, cont) -> Format.fprintf f "fun(%a){%a}" print_var_list l print_cont cont | Constant c -> Format.fprintf f "CONST{%a}" print_constant c | Prim (p, l) -> print_prim f p l let print_instr f i = match i with | Let (x, e) -> Format.fprintf f "%a = %a" Var.print x print_expr e | Set_field (x, i, y) -> Format.fprintf f "%a[%d] = %a" Var.print x i Var.print y | Offset_ref (x, i) -> Format.fprintf f "%a[0] += %d" Var.print x i | Array_set (x, y, z) -> Format.fprintf f "%a[%a] = %a" Var.print x Var.print y Var.print z let print_cond f (c, x) = match c with | IsTrue -> Var.print f x | CEq n -> Format.fprintf f "%ld = %a" n Var.print x | CLt n -> Format.fprintf f "%ld < %a" n Var.print x | CLe n -> Format.fprintf f "%ld <= %a" n Var.print x | CUlt n -> Format.fprintf f "%ld < %a" n Var.print x let print_last f l = match l with | Return x -> Format.fprintf f "return %a" Var.print x | Raise (x, `Normal) -> Format.fprintf f "raise %a" Var.print x | Raise (x, `Reraise) -> Format.fprintf f "reraise %a" Var.print x | Raise (x, `Notrace) -> Format.fprintf f "raise_notrace %a" Var.print x | Stop -> Format.fprintf f "stop" | Branch cont -> Format.fprintf f "branch %a" print_cont cont | Cond (cond, x, cont1, cont2) -> Format.fprintf f "if %a then %a else %a" print_cond (cond, x) print_cont cont1 print_cont cont2 | Switch (x, a1, a2) -> Format.fprintf f "switch %a {" Var.print x; Array.iteri a1 ~f:(fun i cont -> Format.fprintf f "int %d -> %a; " i print_cont cont); Array.iteri a2 ~f:(fun i cont -> Format.fprintf f "tag %d -> %a; " i print_cont cont); Format.fprintf f "}" | Pushtrap (cont1, x, cont2, pcs) -> Format.fprintf f "pushtrap %a handler %a => %a continuation %s" print_cont cont1 Var.print x print_cont cont2 (String.concat ~sep:", " (List.map (Addr.Set.elements pcs) ~f:string_of_int)) | Poptrap (cont, _) -> Format.fprintf f "poptrap %a" print_cont cont type xinstr = | Instr of instr | Last of last let print_block annot pc block = Format.eprintf "==== %d (%a) ====@." pc print_var_list block.params; (match block.handler with | Some (x, cont) -> Format.eprintf " handler %a => %a@." Var.print x print_cont cont | None -> ()); List.iter block.body ~f:(fun i -> Format.eprintf " %s %a@." (annot pc (Instr i)) print_instr i); Format.eprintf " %s %a@." (annot pc (Last block.branch)) print_last block.branch; Format.eprintf "@." let print_program annot (pc, blocks, _) = Format.eprintf "Entry point: %d@.@." pc; Addr.Map.iter (print_block annot) blocks (****) let fold_closures (pc, blocks, _) f accu = Addr.Map.fold (fun _ block accu -> List.fold_left block.body ~init:accu ~f:(fun accu i -> match i with | Let (x, Closure (params, cont)) -> f (Some x) params cont accu | _ -> accu)) blocks (f None [] (pc, []) accu) (****) let prepend ((start, blocks, free_pc) as p) body = match body with | [] -> p | _ -> let new_start = free_pc in let branch = if Addr.Map.mem start blocks then Branch (start, []) else Stop in let blocks = Addr.Map.add new_start { params = []; handler = None; body; branch } blocks in let free_pc = free_pc + 1 in new_start, blocks, free_pc let empty = let start = 0 in let free = 1 in let blocks = Addr.Map.singleton start { params = []; handler = None; body = []; branch = Stop } in start, blocks, free let ( >> ) x f = f x let fold_children blocks pc f accu = let block = Addr.Map.find pc blocks in let accu = match block.handler with | Some (_, (pc, _)) -> f pc accu | None -> accu in match block.branch with | Return _ | Raise _ | Stop -> accu | Branch (pc', _) | Poptrap ((pc', _), _) | Pushtrap ((pc', _), _, _, _) -> f pc' accu | Cond (_, _, (pc1, _), (pc2, _)) -> f pc1 accu >> f pc1 >> f pc2 | Switch (_, a1, a2) -> let accu = Array.fold_right ~init:accu ~f:(fun (pc, _) accu -> f pc accu) a1 in let accu = Array.fold_right ~init:accu ~f:(fun (pc, _) accu -> f pc accu) a2 in accu let rec traverse' fold f pc visited blocks acc = if not (Addr.Set.mem pc visited) then let visited = Addr.Set.add pc visited in let visited, acc = fold blocks pc (fun pc (visited, acc) -> let visited, acc = traverse' fold f pc visited blocks acc in visited, acc) (visited, acc) in let acc = f pc acc in visited, acc else visited, acc let traverse fold f pc blocks acc = snd (traverse' fold f pc Addr.Set.empty blocks acc) let eq (pc1, blocks1, _) (pc2, blocks2, _) = pc1 = pc2 && Addr.Map.cardinal blocks1 = Addr.Map.cardinal blocks2 && Addr.Map.fold (fun pc block1 b -> b && try let block2 = Addr.Map.find pc blocks2 in Poly.(block1.params = block2.params) && Poly.(block1.branch = block2.branch) && Poly.(block1.body = block2.body) with Not_found -> false) blocks1 true let with_invariant = Debug.find "invariant" let check_defs = false let invariant (_, blocks, _) = if with_invariant () then let defs = Array.make (Var.count ()) false in let check_cont (cont, args) = let b = Addr.Map.find cont blocks in assert (List.length args >= List.length b.params) in let define x = if check_defs then ( assert (not defs.(Var.idx x)); defs.(Var.idx x) <- true) in let check_expr = function | Const _ -> () | Apply (_, _, _) -> () | Block (_, _, _) -> () | Field (_, _) -> () | Closure (l, cont) -> List.iter l ~f:define; check_cont cont | Constant _ -> () | Prim (_, _) -> () in let check_instr = function | Let (x, e) -> define x; check_expr e | Set_field (_, _i, _) -> () | Offset_ref (_x, _i) -> () | Array_set (_x, _y, _z) -> () in let check_last = function | Return _ -> () | Raise _ -> () | Stop -> () | Branch cont -> check_cont cont | Cond (_cond, _x, cont1, cont2) -> check_cont cont1; check_cont cont2 | Switch (_x, a1, a2) -> Array.iteri a1 ~f:(fun _ cont -> check_cont cont); Array.iteri a2 ~f:(fun _ cont -> check_cont cont) | Pushtrap (cont1, _x, cont2, _pcs) -> check_cont cont1; check_cont cont2 | Poptrap (cont, _) -> check_cont cont in Addr.Map.iter (fun _pc block -> List.iter block.params ~f:define; Option.iter block.handler ~f:(fun (_, cont) -> check_cont cont); List.iter block.body ~f:check_instr; check_last block.branch) blocks js_of_ocaml-3.5.2/compiler/lib/code.mli000066400000000000000000000114221357507750000200020ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib module Addr : sig type t = int val to_string : t -> string val zero : t val succ : t -> t val pred : t -> t module Set : Set.S with type elt = t module Map : Map.S with type key = t end module DebugAddr : sig type t = private int val of_addr : Addr.t -> t val to_addr : t -> Addr.t val no : t end module Var : sig type t val print : Format.formatter -> t -> unit val equal : t -> t -> bool val idx : t -> int val of_idx : int -> t val to_string : ?origin:t -> t -> string val fresh : unit -> t val fresh_n : string -> t val fork : t -> t val count : unit -> int val compare : t -> t -> int val loc : t -> Parse_info.t -> unit val get_loc : t -> Parse_info.t option val get_name : t -> string option val name : t -> string -> unit val propagate_name : t -> t -> unit val reset : unit -> unit val set_pretty : bool -> unit val set_stable : bool -> unit module Set : Set.S with type elt = t module Map : Map.S with type key = t module Tbl : sig type key = t type 'a t type size = unit val get : 'a t -> key -> 'a val set : 'a t -> key -> 'a -> unit val make : size -> 'a -> 'a t end module ISet : sig type elt = t type t val empty : unit -> t val iter : (elt -> unit) -> t -> unit val mem : t -> elt -> bool val add : t -> elt -> unit val remove : t -> elt -> unit val copy : t -> t end end type cont = Addr.t * Var.t list type prim = | Vectlength | Array_get | Extern of string | Not | IsInt | Eq | Neq | Lt | Le | Ult type array_or_not = | Array | NotArray | Unknown type constant = | String of string | IString of string | Float of float | Float_array of float array | Int64 of int64 | Tuple of int * constant array * array_or_not | Int of int32 type prim_arg = | Pv of Var.t | Pc of constant type expr = | Const of int32 | Apply of Var.t * Var.t list * bool (* if true, then # of arguments = # of parameters *) | Block of int * Var.t array * array_or_not | Field of Var.t * int | Closure of Var.t list * cont | Constant of constant (*XXX REMOVE *) | Prim of prim * prim_arg list (*XXX prim * Var.t list * constant list *) type instr = | Let of Var.t * expr | Set_field of Var.t * int * Var.t | Offset_ref of Var.t * int | Array_set of Var.t * Var.t * Var.t (*XXX REMOVE *) type cond = | IsTrue | CEq of int32 | CLt of int32 | CLe of int32 | CUlt of int32 type last = | Return of Var.t | Raise of Var.t * [ `Normal | `Notrace | `Reraise ] | Stop | Branch of cont | Cond of cond * Var.t * cont * cont | Switch of Var.t * cont array * cont array | Pushtrap of cont * Var.t * cont * Addr.Set.t | Poptrap of cont * Addr.t type block = { params : Var.t list ; handler : (Var.t * cont) option ; body : instr list ; branch : last } type program = Addr.t * block Addr.Map.t * Addr.t type xinstr = | Instr of instr | Last of last val print_var_list : Format.formatter -> Var.t list -> unit val print_instr : Format.formatter -> instr -> unit val print_block : (Addr.Map.key -> xinstr -> string) -> int -> block -> unit val print_program : (Addr.Map.key -> xinstr -> string) -> program -> unit val print_last : Format.formatter -> last -> unit val print_cont : Format.formatter -> cont -> unit val fold_closures : program -> (Var.t option -> Var.t list -> cont -> 'd -> 'd) -> 'd -> 'd val fold_children : block Addr.Map.t -> Addr.t -> (Addr.t -> 'c -> 'c) -> 'c -> 'c val traverse : ( block Addr.Map.t -> Addr.t -> (Addr.t -> Addr.Set.t * 'c -> Addr.Set.t * 'c) -> Addr.Set.t * 'c -> Addr.Set.t * 'c) -> (Addr.t -> 'c -> 'c) -> Addr.t -> block Addr.Map.t -> 'c -> 'c val prepend : program -> instr list -> program val empty : program val eq : program -> program -> bool val invariant : program -> unit js_of_ocaml-3.5.2/compiler/lib/compiler_version.mli000066400000000000000000000017051357507750000224520ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val s : string val git_version : string js_of_ocaml-3.5.2/compiler/lib/config.ml000066400000000000000000000103211357507750000201610ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib module Flag = struct let optims = ref [] let available () = List.map ~f:fst !optims let o ~name ~default = let state = try List.assoc name !optims with Not_found -> let state = ref default in optims := (name, state) :: !optims; state in fun () -> !state let disable s = try List.assoc s !optims := false with Not_found -> failwith (Printf.sprintf "The option named %S doesn't exist" s) let enable s = try List.assoc s !optims := true with Not_found -> failwith (Printf.sprintf "The option named %S doesn't exist" s) let pretty = o ~name:"pretty" ~default:false let stable_var = o ~name:"stable_var" ~default:false let debuginfo = o ~name:"debuginfo" ~default:false let deadcode = o ~name:"deadcode" ~default:true let shortvar = o ~name:"shortvar" ~default:true let compact = o ~name:"compact" ~default:true let optcall = o ~name:"optcall" ~default:true let inline = o ~name:"inline" ~default:true let staticeval = o ~name:"staticeval" ~default:true let share_constant = o ~name:"share" ~default:true let strictmode = o ~name:"strict" ~default:true let debugger = o ~name:"debugger" ~default:true let genprim = o ~name:"genprim" ~default:true let excwrap = o ~name:"excwrap" ~default:true let improved_stacktrace = o ~name:"with-js-error" ~default:false let include_cmis = o ~name:"withcmi" ~default:true let warn_unused = o ~name:"warn-unused" ~default:false let inline_callgen = o ~name:"callgen" ~default:false let safe_string = o ~name:"safestring" ~default:true let check_magic = o ~name:"check-magic-number" ~default:true (* this does not optimize properly *) let compact_vardecl = o ~name:"vardecl" ~default:false end module Param = struct let int default = default, int_of_string let enum : (string * 'a) list -> _ = function | (_, v) :: _ as l -> v, fun x -> List.assoc x l | _ -> assert false let params : (string * _) list ref = ref [] let p ~name ~desc (default, convert) = assert (not (List.mem_assoc name ~map:!params)); let state = ref default in let set : string -> unit = fun v -> try state := convert v with _ -> warn "Warning: malformed option %s=%s. IGNORE@." name v in params := (name, (set, desc)) :: !params; fun () -> !state let set s v = try fst (List.assoc s !params) v with Not_found -> failwith (Printf.sprintf "The option named %S doesn't exist" s) let all () = List.map !params ~f:(fun (n, (_, d)) -> n, d) (* V8 "optimize" switches with less than 128 case. 60 seams to perform well. *) let switch_max_case = p ~name:"switch_size" ~desc:"set the maximum number of case in a switch" (int 60) let tailcall_max_depth = p ~name:"tc_depth" ~desc:"set the maximum number of recursive tailcalls defore returning a trampoline" (int 50) let constant_max_depth = p ~name:"cst_depth" ~desc:"set the maximum depth of generated literal JavaScript values" (int 10) type tc = | TcNone | TcTrampoline (* | TcWhile *) let tc_default = TcTrampoline let _tc_all = tc_default :: List.filter [ TcNone; TcTrampoline ] ~f:(Poly.( <> ) tc_default) let tailcall_optim = p ~name:"tc" ~desc:"Set tailcall optimisation" (enum [ "trampoline", TcTrampoline; (* default *) "none", TcNone ]) end js_of_ocaml-3.5.2/compiler/lib/config.mli000066400000000000000000000037221357507750000203410ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Flag : sig val available : unit -> string list val deadcode : unit -> bool val optcall : unit -> bool val shortvar : unit -> bool val compact : unit -> bool val inline : unit -> bool val share_constant : unit -> bool val staticeval : unit -> bool val genprim : unit -> bool val strictmode : unit -> bool val compact_vardecl : unit -> bool val debugger : unit -> bool val pretty : unit -> bool val stable_var : unit -> bool val debuginfo : unit -> bool val excwrap : unit -> bool val include_cmis : unit -> bool val improved_stacktrace : unit -> bool val warn_unused : unit -> bool val inline_callgen : unit -> bool val safe_string : unit -> bool val check_magic : unit -> bool val enable : string -> unit val disable : string -> unit end module Param : sig val set : string -> string -> unit val all : unit -> (string * string) list val switch_max_case : unit -> int val tailcall_max_depth : unit -> int val constant_max_depth : unit -> int type tc = | TcNone | TcTrampoline (* | TcWhile *) val tailcall_optim : unit -> tc end js_of_ocaml-3.5.2/compiler/lib/constant.ml000066400000000000000000000020641357507750000205520ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let global_object = "joo_global_object" let extra_js_files = [ "+graphics.js" ; "+toplevel.js" ; "+nat.js" ; "+dynlink.js" ; "+bigstring-core_kernel.js" ; "+bigstring-base_bigstring.js" ; "+bigstring-ctruct.js" ] js_of_ocaml-3.5.2/compiler/lib/deadcode.ml000066400000000000000000000166411357507750000204570ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let debug = Debug.find "deadcode" let times = Debug.find "times" open Code type def = | Expr of expr | Var of Var.t type t = { blocks : block Addr.Map.t ; live : int array ; defs : def list array ; mutable reachable_blocks : Addr.Set.t ; pure_funs : Var.Set.t } (****) let pure_expr pure_funs e = Pure_fun.pure_expr pure_funs e && Config.Flag.deadcode () (****) let rec mark_var st x = let x = Var.idx x in st.live.(x) <- st.live.(x) + 1; if st.live.(x) = 1 then List.iter st.defs.(x) ~f:(fun e -> mark_def st e) and mark_def st d = match d with | Var x -> mark_var st x | Expr e -> if pure_expr st.pure_funs e then mark_expr st e and mark_expr st e = match e with | Const _ | Constant _ -> () | Apply (f, l, _) -> mark_var st f; List.iter l ~f:(fun x -> mark_var st x) | Block (_, a, _) -> Array.iter a ~f:(fun x -> mark_var st x) | Field (x, _) -> mark_var st x | Closure (_, (pc, _)) -> mark_reachable st pc | Prim (_, l) -> List.iter l ~f:(fun x -> match x with | Pv x -> mark_var st x | _ -> ()) and mark_cont_reachable st (pc, _param) = mark_reachable st pc and mark_reachable st pc = if not (Addr.Set.mem pc st.reachable_blocks) then ( st.reachable_blocks <- Addr.Set.add pc st.reachable_blocks; let block = Addr.Map.find pc st.blocks in List.iter block.body ~f:(fun i -> match i with | Let (_, e) -> if not (pure_expr st.pure_funs e) then mark_expr st e | Set_field (x, _, y) -> mark_var st x; mark_var st y | Array_set (x, y, z) -> mark_var st x; mark_var st y; mark_var st z | Offset_ref (x, _) -> mark_var st x); match block.branch with | Return x | Raise (x, _) -> mark_var st x | Stop -> () | Branch cont | Poptrap (cont, _) -> mark_cont_reachable st cont | Cond (_, x, cont1, cont2) -> mark_var st x; mark_cont_reachable st cont1; mark_cont_reachable st cont2 | Switch (x, a1, a2) -> mark_var st x; Array.iter a1 ~f:(fun cont -> mark_cont_reachable st cont); Array.iter a2 ~f:(fun cont -> mark_cont_reachable st cont) | Pushtrap (cont1, _, cont2, _) -> mark_cont_reachable st cont1; mark_cont_reachable st cont2) (****) let live_instr st i = match i with | Let (x, e) -> st.live.(Var.idx x) > 0 || not (pure_expr st.pure_funs e) | Set_field _ | Offset_ref _ | Array_set _ -> true let rec filter_args st pl al = match pl, al with | x :: pl, y :: al -> if st.live.(Var.idx x) > 0 then y :: filter_args st pl al else filter_args st pl al | [], _ -> [] | _ -> assert false let filter_cont blocks st (pc, args) = let params = (Addr.Map.find pc blocks).params in pc, filter_args st params args let filter_closure blocks st i = match i with | Let (x, Closure (l, cont)) -> Let (x, Closure (l, filter_cont blocks st cont)) | _ -> i let filter_live_last blocks st l = match l with | Return _ | Raise _ | Stop -> l | Branch cont -> Branch (filter_cont blocks st cont) | Cond (c, x, cont1, cont2) -> Cond (c, x, filter_cont blocks st cont1, filter_cont blocks st cont2) | Switch (x, a1, a2) -> Switch ( x , Array.map a1 ~f:(fun cont -> filter_cont blocks st cont) , Array.map a2 ~f:(fun cont -> filter_cont blocks st cont) ) | Pushtrap (cont1, x, cont2, pcs) -> Pushtrap ( filter_cont blocks st cont1 , x , filter_cont blocks st cont2 , Addr.Set.inter pcs st.reachable_blocks ) | Poptrap (cont, addr) -> Poptrap (filter_cont blocks st cont, addr) (****) let ref_count st i = match i with | Let (x, _) -> st.live.(Var.idx x) | _ -> 0 let annot st pc xi = if not (Addr.Set.mem pc st.reachable_blocks) then "x" else match xi with | Last _ -> " " | Instr i -> let c = ref_count st i in if c > 0 then Format.sprintf "%d" c else if live_instr st i then " " else "x" (****) let add_def defs x i = let idx = Var.idx x in defs.(idx) <- i :: defs.(idx) let rec add_arg_dep defs params args = match params, args with | x :: params, y :: args -> add_def defs x (Var y); add_arg_dep defs params args | _ -> () let add_cont_dep blocks defs (pc, args) = match try Some (Addr.Map.find pc blocks) with Not_found -> None with | Some block -> add_arg_dep defs block.params args | None -> () (* Dead continuation *) let f ((pc, blocks, free_pc) as program) = let t = Timer.make () in let nv = Var.count () in let defs = Array.make nv [] in let live = Array.make nv 0 in let pure_funs = Pure_fun.f program in Addr.Map.iter (fun _ block -> List.iter block.body ~f:(fun i -> match i with | Let (x, e) -> add_def defs x (Expr e) | Set_field (_, _, _) | Array_set (_, _, _) | Offset_ref (_, _) -> ()); Option.iter block.handler ~f:(fun (_, cont) -> add_cont_dep blocks defs cont); match block.branch with | Return _ | Raise _ | Stop -> () | Branch cont -> add_cont_dep blocks defs cont | Cond (_, _, cont1, cont2) -> add_cont_dep blocks defs cont1; add_cont_dep blocks defs cont2 | Switch (_, a1, a2) -> Array.iter a1 ~f:(fun cont -> add_cont_dep blocks defs cont); Array.iter a2 ~f:(fun cont -> add_cont_dep blocks defs cont) | Pushtrap (cont, _, _, _) -> add_cont_dep blocks defs cont | Poptrap (cont, _) -> add_cont_dep blocks defs cont) blocks; let st = { live; defs; blocks; reachable_blocks = Addr.Set.empty; pure_funs } in mark_reachable st pc; if debug () then print_program (fun pc xi -> annot st pc xi) (pc, blocks, free_pc); let all_blocks = blocks in let blocks = Addr.Map.fold (fun pc block blocks -> if not (Addr.Set.mem pc st.reachable_blocks) then blocks else Addr.Map.add pc { params = List.filter block.params ~f:(fun x -> st.live.(Var.idx x) > 0) ; handler = Option.map block.handler ~f:(fun (x, cont) -> x, filter_cont all_blocks st cont) ; body = List.map (List.filter block.body ~f:(fun i -> live_instr st i)) ~f:(fun i -> filter_closure all_blocks st i) ; branch = filter_live_last all_blocks st block.branch } blocks) blocks Addr.Map.empty in if times () then Format.eprintf " dead code elim.: %a@." Timer.print t; (pc, blocks, free_pc), st.live js_of_ocaml-3.5.2/compiler/lib/deadcode.mli000066400000000000000000000017151357507750000206240ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Code.program -> Code.program * int array js_of_ocaml-3.5.2/compiler/lib/debug.ml000066400000000000000000000036761357507750000200210ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let series = ref None let stop_profiling () = match !series with | Some _x -> (* Spacetime.Series.save_and_close x; *) series := None | None -> () let start_profiling name = let path = name ^ ".spacetime" in stop_profiling (); Format.eprintf "Start profiling %s\n%!" path; (* series := Some (Spacetime.Series.create ~path); *) () let take_snapshot () = match !series with | None -> () | Some _series -> Gc.minor (); (* Spacetime.Snapshot.take series; *) () let debugs : (string * bool ref) list ref = ref [] let available () = List.map !debugs ~f:fst let find s = let state = try List.assoc s !debugs with Not_found -> let state = ref false in debugs := (s, state) :: !debugs; state in fun () -> if String.equal s "times" then take_snapshot (); (not !quiet) && !state let enable s = try List.assoc s !debugs := true with Not_found -> failwith (Printf.sprintf "The debug named %S doesn't exist" s) let disable s = try List.assoc s !debugs := false with Not_found -> failwith (Printf.sprintf "The debug named %S doesn't exist" s) js_of_ocaml-3.5.2/compiler/lib/debug.mli000066400000000000000000000020121357507750000201510ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val available : unit -> string list val find : string -> unit -> bool val enable : string -> unit val disable : string -> unit val stop_profiling : unit -> unit val start_profiling : string -> unit js_of_ocaml-3.5.2/compiler/lib/dgraph.ml000066400000000000000000000142651357507750000201740ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib module Make (N : sig type t end) (NSet : Set.S with type elt = N.t) (NMap : Map.S with type key = N.t) = struct type t = { domain : NSet.t ; fold_children : 'a. (N.t -> 'a -> 'a) -> N.t -> 'a -> 'a } let successors g x = try NMap.find x g with Not_found -> NSet.empty let add_edge g x y = let l = successors g x in NMap.add x (NSet.add y l) g let invert g = let h = NSet.fold (fun x h -> g.fold_children (fun y h -> add_edge h y x) x h) g.domain NMap.empty in { domain = g.domain; fold_children = (fun f x a -> NSet.fold f (successors h x) a) } module type DOMAIN = sig type t val equal : t -> t -> bool val bot : t end module Solver (D : DOMAIN) = struct let n = ref 0 let m = ref 0 type stack = { stack : N.t Stack.t ; mutable set : NSet.t } let is_empty st = Stack.is_empty st.stack let pop st = let x = Stack.pop st.stack in st.set <- NSet.remove x st.set; x let push x st = if not (NSet.mem x st.set) then ( Stack.push x st.stack; st.set <- NSet.add x st.set) let rec iterate g f v w = if is_empty w then v else let x = pop w in let a = NMap.find x v in incr m; let b = f v x in let v = NMap.add x b v in if not (D.equal a b) then ( g.fold_children (fun y () -> push y w) x (); iterate g f v w) else iterate g f v w let rec traverse g visited stack x = if not (NSet.mem x visited) then ( let visited = NSet.add x visited in let visited = g.fold_children (fun y visited -> traverse g visited stack y) x visited in Stack.push x stack; visited) else visited let traverse_all g = let stack = Stack.create () in let visited = NSet.fold (fun x visited -> traverse g visited stack x) g.domain NSet.empty in assert (NSet.equal g.domain visited); stack let f g f = n := 0; m := 0; (* let t1 = Timer.make () in *) let v = NSet.fold (fun x v -> incr n; NMap.add x D.bot v) g.domain NMap.empty in (* let t1 = Timer.get t1 in let t2 = Timer.make () in *) let w = { set = g.domain; stack = traverse_all g } in (* let t2 = Timer.get t2 in let t3 = Timer.make () in *) let res = iterate g f v w in (* let t3 = Timer.get t3 in Format.eprintf "YYY %.2f %.2f %.2f@." t1 t2 t3; Format.eprintf "YYY %d %d (%f)@." !m !n (float !m /. float !n); *) res end end module type ISet = sig type t type elt val iter : (elt -> unit) -> t -> unit val mem : t -> elt -> bool val add : t -> elt -> unit val remove : t -> elt -> unit val copy : t -> t end module type Tbl = sig type 'a t type key type size val get : 'a t -> key -> 'a val set : 'a t -> key -> 'a -> unit val make : size -> 'a -> 'a t end module Make_Imperative (N : sig type t end) (NSet : ISet with type elt = N.t) (NTbl : Tbl with type key = N.t) = struct type t = { domain : NSet.t ; iter_children : (N.t -> unit) -> N.t -> unit } let successors g x = NTbl.get g x let add_edge g x y = NTbl.set g x (y :: successors g x) let invert size g = let h = NTbl.make size [] in NSet.iter (fun x -> g.iter_children (fun y -> add_edge h y x) x) g.domain; { domain = g.domain; iter_children = (fun f x -> List.iter ~f (successors h x)) } module type DOMAIN = sig type t val equal : t -> t -> bool val bot : t end module Solver (D : DOMAIN) = struct let n = ref 0 let m = ref 0 type stack = { stack : N.t Stack.t ; mutable set : NSet.t } let is_empty st = Stack.is_empty st.stack let pop st = let x = Stack.pop st.stack in NSet.add st.set x; x let push x st = if NSet.mem st.set x then ( Stack.push x st.stack; NSet.remove st.set x) let rec iterate g f v w = if is_empty w then v else let x = pop w in let a = NTbl.get v x in incr m; let b = f v x in NTbl.set v x b; if not (D.equal a b) then ( g.iter_children (fun y -> push y w) x; iterate g f v w) else iterate g f v w let rec traverse g to_visit stack x = if NSet.mem to_visit x then ( NSet.remove to_visit x; incr n; g.iter_children (fun y -> traverse g to_visit stack y) x; Stack.push x stack) let traverse_all g = let stack = Stack.create () in let to_visit = NSet.copy g.domain in NSet.iter (fun x -> traverse g to_visit stack x) g.domain; { stack; set = to_visit } let f size g f = n := 0; m := 0; (* let t1 = Timer.make () in *) let v = NTbl.make size D.bot in (* let t1 = Timer.get t1 in let t2 = Timer.make () in *) let w = traverse_all g in (* let t2 = Timer.get t2 in let t3 = Timer.make () in *) let res = iterate g f v w in (* let t3 = Timer.get t3 in Format.eprintf "YYY %.2f %.2f %.2f@." t1 t2 t3; Format.eprintf "YYY %d %d (%f)@." !m !n (float !m /. float !n); *) res end end js_of_ocaml-3.5.2/compiler/lib/dgraph.mli000066400000000000000000000042111357507750000203330ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Make (N : sig type t end) (NSet : Set.S with type elt = N.t) (NMap : Map.S with type key = N.t) : sig type t = { domain : NSet.t ; fold_children : 'a. (N.t -> 'a -> 'a) -> N.t -> 'a -> 'a } val invert : t -> t module type DOMAIN = sig type t val equal : t -> t -> bool val bot : t end module Solver (D : DOMAIN) : sig val f : t -> (D.t NMap.t -> N.t -> D.t) -> D.t NMap.t end end module type ISet = sig type t type elt val iter : (elt -> unit) -> t -> unit val mem : t -> elt -> bool val add : t -> elt -> unit val remove : t -> elt -> unit val copy : t -> t end module type Tbl = sig type 'a t type key type size val get : 'a t -> key -> 'a val set : 'a t -> key -> 'a -> unit val make : size -> 'a -> 'a t end module Make_Imperative (N : sig type t end) (NSet : ISet with type elt = N.t) (NTbl : Tbl with type key = N.t) : sig type t = { domain : NSet.t ; iter_children : (N.t -> unit) -> N.t -> unit } val invert : NTbl.size -> t -> t module type DOMAIN = sig type t val equal : t -> t -> bool val bot : t end module Solver (D : DOMAIN) : sig val f : NTbl.size -> t -> (D.t NTbl.t -> N.t -> D.t) -> D.t NTbl.t end end js_of_ocaml-3.5.2/compiler/lib/driver.ml000066400000000000000000000341761357507750000202250ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let debug = Debug.find "main" let times = Debug.find "times" let tailcall p = if debug () then Format.eprintf "Tail-call optimization...@."; Tailcall.f p let deadcode' p = if debug () then Format.eprintf "Dead-code...@."; Deadcode.f p let deadcode p = let r, _ = deadcode' p in r let inline p = if Config.Flag.inline () && Config.Flag.deadcode () then ( let p, live_vars = deadcode' p in if debug () then Format.eprintf "Inlining...@."; Inline.f p live_vars) else p let specialize_1 (p, info) = if debug () then Format.eprintf "Specialize...@."; Specialize.f info p let specialize_js (p, info) = if debug () then Format.eprintf "Specialize js...@."; Specialize_js.f info p let specialize_js_once p = if debug () then Format.eprintf "Specialize js once...@."; Specialize_js.f_once p let specialize' (p, info) = let p = specialize_1 (p, info) in let p = specialize_js (p, info) in p, info let specialize p = fst (specialize' p) let eval (p, info) = if Config.Flag.staticeval () then Eval.f info p else p let flow p = if debug () then Format.eprintf "Data flow...@."; Flow.f p let flow_simple p = if debug () then Format.eprintf "Data flow...@."; Flow.f ~skip_param:true p let phi p = if debug () then Format.eprintf "Variable passing simplification...@."; Phisimpl.f p let print p = if debug () then Code.print_program (fun _ _ -> "") p; p let ( >> ) f g x = g (f x) let rec loop max name round i (p : 'a) : 'a = let p' = round p in if i >= max || Code.eq p' p then p' else ( if times () then Format.eprintf "Start Iteration (%s) %d...@." name i; loop max name round (i + 1) p') let identity x = x (* o1 *) let o1 : 'a -> 'a = print >> tailcall >> flow_simple >> (* flow simple to keep information for future tailcall opt *) specialize' >> eval >> inline >> (* inlining may reveal new tailcall opt *) deadcode >> tailcall >> phi >> flow >> specialize' >> eval >> inline >> deadcode >> print >> flow >> specialize' >> eval >> inline >> deadcode >> phi >> flow >> specialize >> identity (* o2 *) let o2 : 'a -> 'a = loop 10 "o1" o1 1 >> print (* o3 *) let round1 : 'a -> 'a = print >> tailcall >> inline >> (* inlining may reveal new tailcall opt *) deadcode >> (* deadcode required before flow simple -> provided by constant *) flow_simple >> (* flow simple to keep information for future tailcall opt *) specialize' >> eval >> identity let round2 = flow >> specialize' >> eval >> deadcode >> o1 let o3 = loop 10 "tailcall+inline" round1 1 >> loop 10 "flow" round2 1 >> print let generate d ~exported_runtime (p, live_vars) = if times () then Format.eprintf "Start Generation...@."; Generate.f p ~exported_runtime live_vars d let header formatter ~custom_header = (match custom_header with | None -> () | Some c -> Pretty_print.string formatter (c ^ "\n")); let version = match Compiler_version.git_version with | "" -> Compiler_version.s | v -> Printf.sprintf "%s+git-%s" Compiler_version.s v in Pretty_print.string formatter ("// Generated by js_of_ocaml " ^ version ^ "\n") let debug_linker = Debug.find "linker" let global_object = Constant.global_object let extra_js_files = lazy (List.fold_left Constant.extra_js_files ~init:[] ~f:(fun acc file -> try let ss = List.fold_left (Linker.parse_file file) ~init:StringSet.empty ~f:(fun ss { Linker.provides; _ } -> match provides with | Some (_, name, _, _) -> StringSet.add name ss | _ -> ss) in (file, ss) :: acc with _ -> acc)) let report_missing_primitives missing = let missing = List.fold_left (Lazy.force extra_js_files) ~init:missing ~f:(fun missing (file, pro) -> let d = StringSet.inter missing pro in if not (StringSet.is_empty d) then ( warn "Missing primitives provided by %s:@." file; StringSet.iter (fun nm -> warn " %s@." nm) d; StringSet.diff missing pro) else missing) in if not (StringSet.is_empty missing) then ( warn "Missing primitives:@."; StringSet.iter (fun nm -> warn " %s@." nm) missing) let gen_missing js missing = let open Javascript in let miss = StringSet.fold (fun prim acc -> let p = ident prim in ( p , Some ( ECond ( EBin ( NotEqEq , EDot (EVar (ident global_object), prim) , EVar (ident "undefined") ) , EDot (EVar (ident global_object), prim) , EFun ( None , [] , [ ( Statement (Expression_statement (ECall ( EVar (ident "caml_failwith") , [ EBin ( Plus , EStr (prim, `Utf8) , EStr (" not implemented", `Utf8) ) ] , N ))) , N ) ] , N ) ) , N ) ) :: acc) missing [] in if not (StringSet.is_empty missing) then ( warn "There are some missing primitives@."; warn "Dummy implementations (raising 'Failure' exception) "; warn "will be used if they are not available at runtime.@."; warn "You can prevent the generation of dummy implementations with "; warn "the commandline option '--disable genprim'@."; report_missing_primitives missing); (Statement (Variable_statement miss), N) :: js let link ~standalone ~linkall ~export_runtime (js : Javascript.source_elements) : Linker.output = if not standalone then { runtime_code = js; always_required_codes = [] } else let t = Timer.make () in if times () then Format.eprintf "Start Linking...@."; let traverse = new Js_traverse.free in let js = traverse#program js in let free = traverse#get_free_name in let prim = Primitive.get_external () in let prov = Linker.get_provided () in let all_external = StringSet.union prim prov in let used = StringSet.inter free all_external in let linkinfos = Linker.init () in let linkinfos, missing = Linker.resolve_deps ~linkall linkinfos used in (* gen_missing may use caml_failwith *) let linkinfos, missing = if (not (StringSet.is_empty missing)) && Config.Flag.genprim () then let linkinfos, missing2 = Linker.resolve_deps linkinfos (StringSet.singleton "caml_failwith") in linkinfos, StringSet.union missing missing2 else linkinfos, missing in let js = if Config.Flag.genprim () then gen_missing js missing else js in if times () then Format.eprintf " linking: %a@." Timer.print t; let js = if export_runtime then let open Javascript in let all = Linker.all linkinfos in let all = List.map all ~f:(fun name -> PNI name, EVar (ident name)) in ( Statement (Expression_statement (EBin (Eq, EDot (EVar (ident global_object), "jsoo_runtime"), EObj all))) , N ) :: js else js in Linker.link js linkinfos let check_js js = let t = Timer.make () in if times () then Format.eprintf "Start Checks...@."; let traverse = new Js_traverse.free in let js = traverse#program js in let free = traverse#get_free_name in let prim = Primitive.get_external () in let prov = Linker.get_provided () in let all_external = StringSet.union prim prov in let missing = StringSet.inter free all_external in let missing = StringSet.diff missing Reserved.provided in let other = StringSet.diff free missing in let res = VarPrinter.get_reserved () in let other = StringSet.diff other res in if not (StringSet.is_empty missing) then report_missing_primitives missing; let probably_prov = StringSet.inter other Reserved.provided in let other = StringSet.diff other probably_prov in if (not (StringSet.is_empty other)) && debug_linker () then ( warn "Missing variables:@."; StringSet.iter (fun nm -> warn " %s@." nm) other); if (not (StringSet.is_empty probably_prov)) && debug_linker () then ( warn "Variables provided by the browser:@."; StringSet.iter (fun nm -> warn " %s@." nm) probably_prov); if times () then Format.eprintf " checks: %a@." Timer.print t; js let coloring js = let t = Timer.make () in if times () then Format.eprintf "Start Coloring...@."; let traverse = new Js_traverse.free in let js = traverse#program js in let free = traverse#get_free_name in VarPrinter.add_reserved (StringSet.elements free); let js = Js_assign.program js in if times () then Format.eprintf " coloring: %a@." Timer.print t; js let output formatter ~standalone ~custom_header ?source_map () js = let t = Timer.make () in if times () then Format.eprintf "Start Writing file...@."; if standalone then header ~custom_header formatter; Js_output.program formatter ?source_map js; if times () then Format.eprintf " write: %a@." Timer.print t let pack ~global { Linker.runtime_code = js; always_required_codes } = let module J = Javascript in let t = Timer.make () in if times () then Format.eprintf "Start Flagizing js...@."; (* pre pack optim *) let js = if Config.Flag.share_constant () then ( let t1 = Timer.make () in let js = (new Js_traverse.share_constant)#program js in if times () then Format.eprintf " share constant: %a@." Timer.print t1; js) else js in let js = if Config.Flag.compact_vardecl () then ( let t2 = Timer.make () in let js = (new Js_traverse.compact_vardecl)#program js in if times () then Format.eprintf " compact var decl: %a@." Timer.print t2; js) else js in (* pack *) let use_strict js ~can_use_strict = if Config.Flag.strictmode () && can_use_strict then (J.Statement (J.Expression_statement (J.EStr ("use strict", `Utf8))), J.N) :: js else js in let wrap_in_iifa ~can_use_strict js = let f = J.EFun (None, [ J.ident global_object ], use_strict js ~can_use_strict, J.U) in let expr = match global with | `Function -> f | `Bind_to _ -> f | `Custom name -> J.ECall (f, [ J.EVar (J.ident name) ], J.N) | `Auto -> let global = J.ECall ( J.EFun ( None , [] , [ ( J.Statement (J.Return_statement (Some (J.EVar (J.ident "this")))) , J.N ) ] , J.N ) , [] , J.N ) in J.ECall (f, [ global ], J.N) in match global with | `Bind_to name -> [ J.Statement (J.Variable_statement [ J.ident name, Some (expr, J.N) ]), J.N ] | _ -> [ J.Statement (J.Expression_statement expr), J.N ] in let always_required_js = (* CR-someday hheuzard: consider adding a comments in the generated file with original location. e.g. {v //# 1 polyfill/classlist.js v} *) List.map always_required_codes ~f:(fun { Linker.program; filename = _ } -> wrap_in_iifa ~can_use_strict:false program) in let runtime_js = wrap_in_iifa ~can_use_strict:true js in let js = List.flatten always_required_js @ runtime_js in (* post pack optim *) let t3 = Timer.make () in let js = (new Js_traverse.simpl)#program js in if times () then Format.eprintf " simpl: %a@." Timer.print t3; let t4 = Timer.make () in let js = (new Js_traverse.clean)#program js in if times () then Format.eprintf " clean: %a@." Timer.print t4; let js = if Config.Flag.shortvar () then ( let t5 = Timer.make () in let keep = StringSet.empty in let js = (new Js_traverse.rename_variable keep)#program js in if times () then Format.eprintf " shortten vars: %a@." Timer.print t5; js) else js in if times () then Format.eprintf " optimizing: %a@." Timer.print t; js let configure formatter p = let pretty = Config.Flag.pretty () in Pretty_print.set_compact formatter (not pretty); Code.Var.set_pretty (pretty && not (Config.Flag.shortvar ())); Code.Var.set_stable (Config.Flag.stable_var ()); p type profile = Code.program -> Code.program let f ?(standalone = true) ?(global = `Auto) ?(profile = o1) ?(dynlink = false) ?(linkall = false) ?source_map ?custom_header formatter d = let exported_runtime = not standalone in let linkall = linkall || dynlink in configure formatter >> specialize_js_once >> profile >> Generate_closure.f >> deadcode' >> generate d ~exported_runtime >> link ~standalone ~linkall ~export_runtime:dynlink >> pack ~global >> coloring >> check_js >> output formatter ~standalone ~custom_header ?source_map () let from_string prims s formatter = let p, d = Parse_bytecode.from_string prims s in f ~standalone:false ~global:`Function formatter d p let profiles = [ 1, o1; 2, o2; 3, o3 ] let profile i = try Some (List.assoc i profiles) with Not_found -> None js_of_ocaml-3.5.2/compiler/lib/driver.mli000066400000000000000000000025631357507750000203710ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type profile val f : ?standalone:bool -> ?global:[ `Auto | `Function | `Bind_to of string | `Custom of string ] -> ?profile:profile -> ?dynlink:bool -> ?linkall:bool -> ?source_map:string option * Source_map.t -> ?custom_header:string -> Pretty_print.t -> Parse_bytecode.Debug.t -> Code.program -> unit val from_string : string array -> string -> Pretty_print.t -> unit val profiles : (int * profile) list val profile : int -> profile option js_of_ocaml-3.5.2/compiler/lib/dune000066400000000000000000000026461357507750000172530ustar00rootroot00000000000000(library (name js_of_ocaml_compiler) (public_name js_of_ocaml-compiler) (synopsis "Js_of_ocaml compiler library") (libraries compiler-libs.common compiler-libs.bytecomp bytes (select source_map_io.ml from (yojson -> source_map_yojson.ml.in) ( -> source_map_unsupported.ml.in)) ) (flags (:standard -w -7-37 -safe-string)) (preprocess (pps ppx_optcomp_light)) ) (rule (targets js_lexer.ml) (mode promote) (action (chdir %{workspace_root} (run %{bin:ocamllex} -q %{dep:js_lexer.mll} -o %{targets})))) (rule (targets annot_lexer.ml) (mode promote) (action (chdir %{workspace_root} (run %{bin:ocamllex} -q %{dep:annot_lexer.mll} -o %{targets})))) ;; cp $(ocamlfind printconf path)/menhir/standard.mly standard.mly ;; menhir is just noisy, both because this parser has conflicts, or ;; because we don't use --infer (to avoid having to write manually and ;; badly specified dependencieds), so we just discard stderr. (rule (targets js_parser.mli js_parser.ml) (deps standard.mly) (mode promote) (action (ignore-stderr (run menhir --stdlib . --external-tokens Js_token --explain %{dep:js_parser.mly})))) (rule (targets annot_parser.mli annot_parser.ml) (deps standard.mly) (mode promote) (action (ignore-stderr (run menhir --stdlib . --explain %{dep:annot_parser.mly})))) (rule (targets compiler_version.ml) (deps (:input-file ../../version.ml.in)) (action (copy %{input-file} %{targets}))) js_of_ocaml-3.5.2/compiler/lib/eval.ml000066400000000000000000000365621357507750000176620ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Code open Flow let static_env = Hashtbl.create 17 let clear_static_env () = Hashtbl.clear static_env let set_static_env s value = Hashtbl.add static_env s value let get_static_env s = try Some (Hashtbl.find static_env s) with Not_found -> None module Int = Int32 let int_binop l f = match l with | [ Int i; Int j ] -> Some (Int (f i j)) | _ -> None let shift l f = match l with | [ Int i; Int j ] -> Some (Int (f i (Int32.to_int j land 0x1f))) | _ -> None let float_binop_aux l f = let args = match l with | [ Float i; Float j ] -> Some (i, j) | [ Int i; Int j ] -> Some (Int32.to_float i, Int32.to_float j) | [ Int i; Float j ] -> Some (Int32.to_float i, j) | [ Float i; Int j ] -> Some (i, Int32.to_float j) | _ -> None in match args with | None -> None | Some (i, j) -> Some (f i j) let float_binop l f = match float_binop_aux l f with | Some x -> Some (Float x) | None -> None let float_unop l f = match l with | [ Float i ] -> Some (Float (f i)) | [ Int i ] -> Some (Float (f (Int32.to_float i))) | _ -> None let float_binop_bool l f = match float_binop_aux l f with | Some true -> Some (Int 1l) | Some false -> Some (Int 0l) | None -> None let bool b = Some (Int (if b then 1l else 0l)) let eval_prim x = match x with | Not, [ Int i ] -> bool Int32.(i = 0l) | Lt, [ Int i; Int j ] -> bool Int32.(i < j) | Le, [ Int i; Int j ] -> bool Int32.(i <= j) | Eq, [ Int i; Int j ] -> bool Int32.(i = j) | Neq, [ Int i; Int j ] -> bool Int32.(i <> j) | Ult, [ Int i; Int j ] -> bool (Int32.(j < 0l) || Int32.(i < j)) | Extern name, l -> ( let name = Primitive.resolve name in match name, l with (* int *) | "%int_add", _ -> int_binop l Int.add | "%int_sub", _ -> int_binop l Int.sub | "%direct_int_mul", _ -> int_binop l Int.mul | "%direct_int_div", [ _; Int 0l ] -> None | "%direct_int_div", _ -> int_binop l Int.div | "%direct_int_mod", _ -> int_binop l Int.rem | "%int_and", _ -> int_binop l Int.logand | "%int_or", _ -> int_binop l Int.logor | "%int_xor", _ -> int_binop l Int.logxor | "%int_lsl", _ -> shift l Int.shift_left | "%int_lsr", _ -> shift l Int.shift_right_logical | "%int_asr", _ -> shift l Int.shift_right | "%int_neg", [ Int i ] -> Some (Int (Int.neg i)) (* float *) | "caml_eq_float", _ -> float_binop_bool l Float.( = ) | "caml_neq_float", _ -> float_binop_bool l Float.( <> ) | "caml_ge_float", _ -> float_binop_bool l Float.( >= ) | "caml_le_float", _ -> float_binop_bool l Float.( <= ) | "caml_gt_float", _ -> float_binop_bool l Float.( > ) | "caml_lt_float", _ -> float_binop_bool l Float.( < ) | "caml_add_float", _ -> float_binop l ( +. ) | "caml_sub_float", _ -> float_binop l ( -. ) | "caml_mul_float", _ -> float_binop l ( *. ) | "caml_div_float", _ -> float_binop l ( /. ) | "caml_fmod_float", _ -> float_binop l mod_float | "caml_int_of_float", [ Float f ] -> Some (Int (Int32.of_float f)) | "to_int", [ Float f ] -> Some (Int (Int32.of_float f)) | "to_int", [ Int i ] -> Some (Int i) (* Math *) | "caml_neg_float", _ -> float_unop l ( ~-. ) | "caml_abs_float", _ -> float_unop l abs_float | "caml_acos_float", _ -> float_unop l acos | "caml_asin_float", _ -> float_unop l asin | "caml_atan_float", _ -> float_unop l atan | "caml_atan2_float", _ -> float_binop l atan2 | "caml_ceil_float", _ -> float_unop l ceil | "caml_cos_float", _ -> float_unop l cos | "caml_exp_float", _ -> float_unop l exp | "caml_floor_float", _ -> float_unop l floor | "caml_log_float", _ -> float_unop l log | "caml_power_float", _ -> float_binop l ( ** ) | "caml_sin_float", _ -> float_unop l sin | "caml_sqrt_float", _ -> float_unop l sqrt | "caml_tan_float", _ -> float_unop l tan | ( ("caml_string_get" | "caml_string_unsafe_get") , [ (String s | IString s); Int pos ] ) -> let pos = Int.to_int pos in if Config.Flag.safe_string () && pos >= 0 && pos < String.length s then Some (Int (Int.of_int (Char.code s.[pos]))) else None | "caml_string_equal", [ String s1; String s2 ] -> bool (String.equal s1 s2) | "caml_string_notequal", [ String s1; String s2 ] -> bool (not (String.equal s1 s2)) | "caml_sys_getenv", [ String s ] -> ( match get_static_env s with | Some env -> Some (String env) | None -> None) | "caml_sys_const_word_size", [ _ ] -> Some (Int 32l) | "caml_sys_const_int_size", [ _ ] -> Some (Int 32l) | "caml_sys_const_big_endian", [ _ ] -> Some (Int 0l) | _ -> None) | _ -> None let the_length_of info x = get_approx info (fun x -> match info.info_defs.(Var.idx x) with | Expr (Constant (String s)) | Expr (Constant (IString s)) -> Some (Int32.of_int (String.length s)) | Expr (Prim (Extern "caml_create_string", [ arg ])) | Expr (Prim (Extern "caml_create_bytes", [ arg ])) -> the_int info arg | _ -> None) None (fun u v -> match u, v with | Some l, Some l' when Int32.(l = l') -> Some l | _ -> None) x type is_int = | Y | N | Unknown let is_int info x = match x with | Pv x -> get_approx info (fun x -> match info.info_defs.(Var.idx x) with | Expr (Const _) | Expr (Constant (Int _)) -> Y | Expr (Block (_, _, _)) | Expr (Constant _) -> N | _ -> Unknown) Unknown (fun u v -> match u, v with | Y, Y -> Y | N, N -> N | _ -> Unknown) x | Pc (Int _) -> Y | Pc _ -> N let rec constant_equal a b = match a, b with | String a, String b -> Some (String.equal a b) | IString a, IString b -> Some (String.equal a b) | Tuple (ta, a, _), Tuple (tb, b, _) -> if ta <> tb || Array.length a <> Array.length b then Some false else let same = ref (Some true) in for i = 0 to Array.length a - 1 do match !same, constant_equal a.(i) b.(i) with | None, _ -> () | _, None -> same := None | Some s, Some c -> same := Some (s && c) done; !same | Int64 a, Int64 b -> Some (Poly.equal a b) | Float_array a, Float_array b -> Some Poly.(a = b) | Int a, Int b -> Some (Poly.equal a b) | Float a, Float b -> Some (Float.equal a b) | String _, IString _ | IString _, String _ -> None | Int _, Float _ | Float _, Int _ -> None | Tuple ((0 | 254), _, _), Float_array _ -> None | Float_array _, Tuple ((0 | 254), _, _) -> None | Tuple _, (String _ | IString _ | Int64 _ | Int _ | Float _ | Float_array _) -> Some false | Float_array _, (String _ | IString _ | Int64 _ | Int _ | Float _ | Tuple _) -> Some false | String _, (Int64 _ | Int _ | Float _ | Tuple _ | Float_array _) -> Some false | IString _, (Int64 _ | Int _ | Float _ | Tuple _ | Float_array _) -> Some false | Int64 _, (String _ | IString _ | Int _ | Float _ | Tuple _ | Float_array _) -> Some false | Float _, (String _ | IString _ | Float_array _ | Int64 _ | Tuple (_, _, _)) -> Some false | Int _, (String _ | IString _ | Float_array _ | Int64 _ | Tuple (_, _, _)) -> Some false let eval_instr info i = match i with | Let (x, Prim (Extern ("caml_js_equals" | "caml_equal"), [ y; z ])) -> ( match the_const_of info y, the_const_of info z with | Some e1, Some e2 -> ( match constant_equal e1 e2 with | None -> i | Some c -> let c = if c then 1l else 0l in let c = Constant (Int c) in Flow.update_def info x c; Let (x, c)) | _ -> i) | Let (x, Prim (Extern "caml_ml_string_length", [ s ])) -> ( let c = match s with | Pc (String s) | Pc (IString s) -> Some (Int32.of_int (String.length s)) | Pv v -> the_length_of info v | _ -> None in match c with | None -> i | Some c -> let c = Constant (Int c) in Flow.update_def info x c; Let (x, c)) | Let (_, Prim (Extern ("caml_array_unsafe_get" | "caml_array_unsafe_set"), _)) -> (* Fresh parameters can be introduced for these primitives in Specialize_js, which would make the call to [the_const_of] below fail. *) i | Let (x, Prim (IsInt, [ y ])) -> ( match is_int info y with | Unknown -> i | (Y | N) as b -> let b = if Poly.(b = N) then 0l else 1l in let c = Constant (Int b) in Flow.update_def info x c; Let (x, c)) | Let (x, Prim (prim, prim_args)) -> ( let prim_args' = List.map prim_args ~f:(fun x -> the_const_of info x) in let res = if List.for_all prim_args' ~f:(function | Some _ -> true | _ -> false) then eval_prim ( prim , List.map prim_args' ~f:(function | Some c -> c | None -> assert false) ) else None in match res with | Some c -> let c = Constant c in Flow.update_def info x c; Let (x, c) | _ -> Let ( x , Prim ( prim , List.map2 prim_args prim_args' ~f:(fun arg c -> match c with | Some ((Int _ | Float _) as c) -> Pc c | Some _ (* do not be duplicated other constant as they're not represented with constant in javascript. *) | None -> arg) ) )) | _ -> i type case_of = | CConst of int | CTag of int | Unknown let the_case_of info x = match x with | Pv x -> get_approx info (fun x -> match info.info_defs.(Var.idx x) with | Expr (Const i) | Expr (Constant (Int i)) -> CConst (Int32.to_int i) | Expr (Block (j, _, _)) -> if info.info_possibly_mutable.(Var.idx x) then Unknown else CTag j | Expr (Constant (Tuple (j, _, _))) -> CTag j | _ -> Unknown) Unknown (fun u v -> match u, v with | CTag i, CTag j when i = j -> u | CConst i, CConst j when i = j -> u | _ -> Unknown) x | Pc (Int i) -> CConst (Int32.to_int i) | Pc (Tuple (j, _, _)) -> CTag j | _ -> Unknown let eval_branch info = function | Cond (cond, x, ftrue, ffalse) as b -> ( match the_int info (Pv x) with | Some j -> ( let res = match cond with | IsTrue -> ( match j with | 0l -> false (* https://github.com/ocaml/ocaml/blob/trunk/byterun/interp.c#L798 *) | _ -> true) | CEq i -> Int32.(i = j) | CLt i -> Int32.(i < j) | CLe i -> Int32.(i <= j) | CUlt i -> Int32.(j < 0l) || Int32.(i < j) in match res with | true -> Branch ftrue | false -> Branch ffalse) | _ -> b) | Switch (x, const, tags) as b -> ( (* [the_case_of info (Pv x)] might be meaningless when we're inside a dead code. The proper fix would be to remove the deadcode entirely. Meanwhile, add guards to prevent Invalid_argument("index out of bounds") see https://github.com/ocsigen/js_of_ocaml/issues/485 *) match the_case_of info (Pv x) with | CConst j when j < Array.length const -> Branch const.(j) | CTag j when j < Array.length tags -> Branch tags.(j) | CConst _ | CTag _ | Unknown -> b) | _ as b -> b exception May_raise let rec do_not_raise pc visited blocks = if Addr.Set.mem pc visited then visited else let visited = Addr.Set.add pc visited in let b = Addr.Map.find pc blocks in List.iter b.body ~f:(function | Array_set (_, _, _) | Offset_ref (_, _) | Set_field (_, _, _) -> () | Let (_, e) -> ( match e with | Const _ | Block (_, _, _) | Field (_, _) | Constant _ | Closure _ -> () | Apply (_, _, _) -> raise May_raise | Prim (Extern name, _) when Primitive.is_pure name -> () | Prim (Extern _, _) -> raise May_raise | Prim (_, _) -> ())); match b.branch with | Raise _ -> raise May_raise | Stop | Return _ | Poptrap _ -> visited | Branch (pc, _) -> do_not_raise pc visited blocks | Cond (_, _, (pc1, _), (pc2, _)) -> let visited = do_not_raise pc1 visited blocks in let visited = do_not_raise pc2 visited blocks in visited | Switch (_, a1, a2) -> let visited = Array.fold_left a1 ~init:visited ~f:(fun visited (pc, _) -> do_not_raise pc visited blocks) in let visited = Array.fold_left a2 ~init:visited ~f:(fun visited (pc, _) -> do_not_raise pc visited blocks) in visited | Pushtrap _ -> raise May_raise let drop_exception_handler blocks = Addr.Map.fold (fun pc _ blocks -> match Addr.Map.find pc blocks with | { branch = Pushtrap (((addr, _) as cont1), _x, _cont2, addrset) ; handler = parent_hander ; _ } as b -> ( try let visited = do_not_raise addr Addr.Set.empty blocks in let b = { b with branch = Branch cont1 } in let blocks = Addr.Map.add pc b blocks in let blocks = Addr.Set.fold (fun pc2 blocks -> let b = Addr.Map.find pc2 blocks in assert (Poly.(b.handler <> parent_hander)); let branch = match b.branch with | Poptrap (((addr, _) as cont), _) -> assert (Addr.Set.mem addr addrset); Branch cont | x -> x in let b = { b with branch; handler = parent_hander } in Addr.Map.add pc2 b blocks) visited blocks in blocks with May_raise -> blocks) | _ -> blocks) blocks blocks let eval info blocks = Addr.Map.map (fun block -> let body = List.map block.body ~f:(eval_instr info) in let branch = eval_branch info block.branch in { block with Code.body; Code.branch }) blocks let f info (pc, blocks, free_pc) = let blocks = eval info blocks in let blocks = drop_exception_handler blocks in pc, blocks, free_pc js_of_ocaml-3.5.2/compiler/lib/eval.mli000066400000000000000000000017511357507750000200230ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val clear_static_env : unit -> unit val set_static_env : string -> string -> unit val f : Flow.info -> Code.program -> Code.program js_of_ocaml-3.5.2/compiler/lib/findlib.ml000066400000000000000000000026711357507750000203340ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let find_pkg_dir_ref = ref (fun _ -> raise Not_found) let set_find_pkg_dir f = find_pkg_dir_ref := f let find_pkg_dir pkg = !find_pkg_dir_ref pkg let path_require_findlib path = String.drop_prefix path ~prefix:"+" let rec find_in_findlib_paths ?(pkg = "stdlib") paths name = match paths with | [] -> raise Not_found | path :: rem -> let file = match path_require_findlib path with | Some path -> Filename.concat (Filename.concat (find_pkg_dir pkg) path) name | None -> Filename.concat path name in if Sys.file_exists file then file else find_in_findlib_paths rem name js_of_ocaml-3.5.2/compiler/lib/findlib.mli000066400000000000000000000020271357507750000205000ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val path_require_findlib : string -> string option val set_find_pkg_dir : (string -> string) -> unit val find_pkg_dir : string -> string val find_in_findlib_paths : ?pkg:string -> string list -> string -> string js_of_ocaml-3.5.2/compiler/lib/flow.ml000066400000000000000000000330121357507750000176650ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let debug = Debug.find "flow" let times = Debug.find "times" open Code (****) let add_var = Var.ISet.add type def = | Phi of Var.Set.t | Expr of Code.expr | Param type info = { info_defs : def array ; info_known_origins : Code.Var.Set.t Code.Var.Tbl.t ; info_maybe_unknown : bool Code.Var.Tbl.t ; info_possibly_mutable : bool array } let update_def { info_defs; _ } x exp = let idx = Code.Var.idx x in info_defs.(idx) <- Expr exp let undefined = Phi Var.Set.empty let is_undefined d = match d with | Phi s -> Var.Set.is_empty s | _ -> false let add_expr_def defs x e = let idx = Var.idx x in assert (is_undefined defs.(idx)); defs.(idx) <- Expr e let add_assign_def vars defs x y = add_var vars x; let idx = Var.idx x in match defs.(idx) with | Expr _ | Param -> assert false | Phi s -> defs.(idx) <- Phi (Var.Set.add y s) let add_param_def vars defs x = add_var vars x; let idx = Var.idx x in assert (is_undefined defs.(idx) || Poly.(defs.(idx) = Param)); defs.(idx) <- Param (* x depends on y *) let add_dep deps x y = let idx = Var.idx y in deps.(idx) <- Var.Set.add x deps.(idx) let rec arg_deps vars deps defs params args = match params, args with | x :: params, y :: args -> add_dep deps x y; add_assign_def vars defs x y; arg_deps vars deps defs params args | _ -> () let cont_deps blocks vars deps defs (pc, args) = let block = Addr.Map.find pc blocks in arg_deps vars deps defs block.params args let expr_deps blocks vars deps defs x e = match e with | Const _ | Constant _ | Apply _ | Prim _ -> () | Closure (l, cont) -> List.iter l ~f:(fun x -> add_param_def vars defs x); cont_deps blocks vars deps defs cont | Block (_, a, _) -> Array.iter a ~f:(fun y -> add_dep deps x y) | Field (y, _) -> add_dep deps x y let program_deps (_, blocks, _) = let nv = Var.count () in let vars = Var.ISet.empty () in let deps = Array.make nv Var.Set.empty in let defs = Array.make nv undefined in Addr.Map.iter (fun _ block -> List.iter block.body ~f:(fun i -> match i with | Let (x, e) -> add_var vars x; add_expr_def defs x e; expr_deps blocks vars deps defs x e | Set_field _ | Array_set _ | Offset_ref _ -> ()); Option.iter block.handler ~f:(fun (x, cont) -> add_param_def vars defs x; cont_deps blocks vars deps defs cont); match block.branch with | Return _ | Raise _ | Stop -> () | Branch cont | Poptrap (cont, _) -> cont_deps blocks vars deps defs cont | Cond (_, _, cont1, cont2) -> cont_deps blocks vars deps defs cont1; cont_deps blocks vars deps defs cont2 | Switch (_, a1, a2) -> Array.iter a1 ~f:(fun cont -> cont_deps blocks vars deps defs cont); Array.iter a2 ~f:(fun cont -> cont_deps blocks vars deps defs cont) | Pushtrap (cont, _, _, _) -> cont_deps blocks vars deps defs cont) blocks; vars, deps, defs let var_set_lift f s = Var.Set.fold (fun y s -> Var.Set.union (f y) s) s Var.Set.empty let propagate1 deps defs st x = match defs.(Var.idx x) with | Param -> Var.Set.singleton x | Phi s -> var_set_lift (fun y -> Var.Tbl.get st y) s | Expr e -> ( match e with | Const _ | Constant _ | Apply _ | Prim _ | Closure _ | Block _ -> Var.Set.singleton x | Field (y, n) -> var_set_lift (fun z -> match defs.(Var.idx z) with | Expr (Block (_, a, _)) when n < Array.length a -> let t = a.(n) in add_dep deps x t; Var.Tbl.get st t | Phi _ | Param | Expr _ -> Var.Set.empty) (Var.Tbl.get st y)) module G = Dgraph.Make_Imperative (Var) (Var.ISet) (Var.Tbl) module Domain1 = struct type t = Var.Set.t let equal = Var.Set.equal let bot = Var.Set.empty end module Solver1 = G.Solver (Domain1) let solver1 vars deps defs = let g = { G.domain = vars; G.iter_children = (fun f x -> Var.Set.iter f deps.(Var.idx x)) } in Solver1.f () g (propagate1 deps defs) (****) type mutability_state = { defs : def array ; known_origins : Code.Var.Set.t Code.Var.Tbl.t ; may_escape : bool array ; possibly_mutable : bool array } let rec block_escape st x = Var.Set.iter (fun y -> let idx = Var.idx y in if not st.may_escape.(idx) then ( st.may_escape.(idx) <- true; st.possibly_mutable.(idx) <- true; match st.defs.(Var.idx y) with | Expr (Block (_, l, _)) -> Array.iter l ~f:(fun z -> block_escape st z) | _ -> ())) (Var.Tbl.get st.known_origins x) let expr_escape st _x e = match e with | Const _ | Constant _ | Closure _ | Block _ | Field _ -> () | Apply (_, l, _) -> List.iter l ~f:(fun x -> block_escape st x) | Prim ((Vectlength | Array_get | Not | IsInt | Eq | Neq | Lt | Le | Ult), _) -> () | Prim (Extern name, l) -> let ka = match Primitive.kind_args name with | Some l -> l | None -> ( match Primitive.kind name with | `Mutable | `Mutator -> [] | `Pure -> List.map l ~f:(fun _ -> `Const)) in let rec loop args ka = match args, ka with | [], _ -> () | Pc _ :: ax, [] -> loop ax [] | Pv a :: ax, [] -> block_escape st a; loop ax [] | a :: ax, k :: kx -> (match a, k with | _, `Const | Pc _, _ -> () | Pv v, `Shallow_const -> ( match st.defs.(Var.idx v) with | Expr (Block (_, a, _)) -> Array.iter a ~f:(fun x -> block_escape st x) | _ -> block_escape st v) | Pv v, `Object_literal -> ( match st.defs.(Var.idx v) with | Expr (Block (_, a, _)) -> Array.iter a ~f:(fun x -> match st.defs.(Var.idx x) with | Expr (Block (_, [| _k; v |], _)) -> block_escape st v | _ -> block_escape st x) | _ -> block_escape st v) | Pv v, `Mutable -> block_escape st v); loop ax kx in loop l ka let program_escape defs known_origins (_, blocks, _) = let nv = Var.count () in let may_escape = Array.make nv false in let possibly_mutable = Array.make nv false in let st = { defs; known_origins; may_escape; possibly_mutable } in Addr.Map.iter (fun _ block -> List.iter block.body ~f:(fun i -> match i with | Let (x, e) -> expr_escape st x e | Set_field (x, _, y) | Array_set (x, _, y) -> Var.Set.iter (fun y -> possibly_mutable.(Var.idx y) <- true) (Var.Tbl.get known_origins x); block_escape st y | Offset_ref (x, _) -> Var.Set.iter (fun y -> possibly_mutable.(Var.idx y) <- true) (Var.Tbl.get known_origins x)); match block.branch with | Return x | Raise (x, _) -> block_escape st x | Stop | Branch _ | Cond _ | Switch _ | Pushtrap _ | Poptrap _ -> ()) blocks; possibly_mutable (****) let propagate2 ?(skip_param = false) defs known_origins possibly_mutable st x = match defs.(Var.idx x) with | Param -> skip_param | Phi s -> Var.Set.exists (fun y -> Var.Tbl.get st y) s | Expr e -> ( match e with | Const _ | Constant _ | Closure _ | Apply _ | Prim _ | Block _ -> false | Field (y, n) -> Var.Tbl.get st y || Var.Set.exists (fun z -> match defs.(Var.idx z) with | Expr (Block (_, a, _)) -> n >= Array.length a || possibly_mutable.(Var.idx z) || Var.Tbl.get st a.(n) | Phi _ | Param | Expr _ -> true) (Var.Tbl.get known_origins y)) module Domain2 = struct type t = bool let equal = Bool.equal let bot = false end module Solver2 = G.Solver (Domain2) let solver2 ?skip_param vars deps defs known_origins possibly_mutable = let g = { G.domain = vars; G.iter_children = (fun f x -> Var.Set.iter f deps.(Var.idx x)) } in Solver2.f () g (propagate2 ?skip_param defs known_origins possibly_mutable) let get_approx { info_defs = _; info_known_origins; info_maybe_unknown; _ } f top join x = let s = Var.Tbl.get info_known_origins x in if Var.Tbl.get info_maybe_unknown x then top else match Var.Set.cardinal s with | 0 -> top | 1 -> f (Var.Set.choose s) | _ -> Var.Set.fold (fun x u -> join (f x) u) s (f (Var.Set.choose s)) let the_def_of info x = match x with | Pv x -> get_approx info (fun x -> match info.info_defs.(Var.idx x) with | Expr (Const _ as e) -> Some e | Expr (Constant (Float _ | Int _ | IString _) as e) -> Some e | Expr (Constant (String _) as e) when Config.Flag.safe_string () -> Some e | Expr e -> if info.info_possibly_mutable.(Var.idx x) then None else Some e | _ -> None) None (fun _ _ -> None) x | Pc c -> Some (Constant c) let the_const_of info x = match x with | Pv x -> get_approx info (fun x -> match info.info_defs.(Var.idx x) with | Expr (Const i) -> Some (Int i) | Expr (Constant ((Float _ | Int _ | IString _) as c)) -> Some c | Expr (Constant (String _ as c)) when Config.Flag.safe_string () -> Some c | Expr (Constant c) -> if info.info_possibly_mutable.(Var.idx x) then None else Some c | _ -> None) None (fun u v -> match u, v with | Some i, Some j when Poly.(i = j) -> u | _ -> None) x | Pc c -> Some c let the_int info x = match the_const_of info x with | Some (Int i) -> Some i | _ -> None let the_string_of info x = match the_const_of info x with | Some (String i | IString i) -> Some i | _ -> None (*XXX Maybe we could iterate? *) let direct_approx info x = match info.info_defs.(Var.idx x) with | Expr (Field (y, n)) -> get_approx info (fun z -> if info.info_possibly_mutable.(Var.idx z) then None else match info.info_defs.(Var.idx z) with | Expr (Block (_, a, _)) when n < Array.length a -> Some a.(n) | _ -> None) None (fun u v -> match u, v with | Some n, Some m when Var.compare n m = 0 -> u | _ -> None) y | _ -> None let build_subst info vars = let nv = Var.count () in let subst = Array.make nv None in Var.ISet.iter (fun x -> let u = Var.Tbl.get info.info_maybe_unknown x in (if not u then let s = Var.Tbl.get info.info_known_origins x in if Var.Set.cardinal s = 1 then subst.(Var.idx x) <- Some (Var.Set.choose s)); if Option.is_none subst.(Var.idx x) then subst.(Var.idx x) <- direct_approx info x; match subst.(Var.idx x) with | None -> () | Some y -> Var.propagate_name x y) vars; subst (****) let f ?skip_param p = Code.invariant p; let t = Timer.make () in let t1 = Timer.make () in let vars, deps, defs = program_deps p in if times () then Format.eprintf " flow analysis 1: %a@." Timer.print t1; let t2 = Timer.make () in let known_origins = solver1 vars deps defs in if times () then Format.eprintf " flow analysis 2: %a@." Timer.print t2; let t3 = Timer.make () in let possibly_mutable = program_escape defs known_origins p in if times () then Format.eprintf " flow analysis 3: %a@." Timer.print t3; let t4 = Timer.make () in let maybe_unknown = solver2 ?skip_param vars deps defs known_origins possibly_mutable in if times () then Format.eprintf " flow analysis 4: %a@." Timer.print t4; if debug () then Var.ISet.iter (fun x -> let s = Var.Tbl.get known_origins x in if not (Var.Set.is_empty s) (*&& Var.Set.choose s <> x*) then Format.eprintf "%a: {%a} / %s@." Var.print x Code.print_var_list (Var.Set.elements s) (if Var.Tbl.get maybe_unknown x then "any" else "known")) vars; let t5 = Timer.make () in let info = { info_defs = defs ; info_known_origins = known_origins ; info_maybe_unknown = maybe_unknown ; info_possibly_mutable = possibly_mutable } in let s = build_subst info vars in let p = Subst.program (Subst.from_array s) p in if times () then Format.eprintf " flow analysis 5: %a@." Timer.print t5; if times () then Format.eprintf " flow analysis: %a@." Timer.print t; Code.invariant p; p, info js_of_ocaml-3.5.2/compiler/lib/flow.mli000066400000000000000000000035671357507750000200520ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* type 'a flat = Void | Known of 'a | Unknown type v = | Blk of t list | Cst of int and t = Code.Var.t flat * v flat val approx_to_string : t -> string val get_field : t -> int -> t val get_const : t -> int option val get_label : t -> Code.Var.t option *) type def = | Phi of Code.Var.Set.t | Expr of Code.expr | Param type info = { info_defs : def array ; info_known_origins : Code.Var.Set.t Code.Var.Tbl.t ; info_maybe_unknown : bool Code.Var.Tbl.t ; info_possibly_mutable : bool array } val get_approx : info -> (Code.Var.Set.elt -> 'b) -> 'b -> ('b -> 'b -> 'b) -> Code.Var.Tbl.key -> 'b val the_def_of : info -> Code.prim_arg -> Code.expr option val the_const_of : info -> Code.prim_arg -> Code.constant option val the_string_of : info -> Code.prim_arg -> string option val the_int : info -> Code.prim_arg -> int32 option val update_def : info -> Code.Var.t -> Code.expr -> unit val f : ?skip_param:bool -> Code.program -> Code.program * info js_of_ocaml-3.5.2/compiler/lib/freevars.ml000066400000000000000000000150071357507750000205370ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let times = Debug.find "times" open Code (****) let iter_cont_free_vars f (_, l) = List.iter ~f l let iter_expr_free_vars f e = match e with | Const _ | Constant _ -> () | Apply (x, l, _) -> f x; List.iter ~f l | Block (_, a, _) -> Array.iter ~f a | Field (x, _) -> f x | Closure _ -> () | Prim (_, l) -> List.iter l ~f:(fun x -> match x with | Pv x -> f x | Pc _ -> ()) let iter_instr_free_vars f i = match i with | Let (_, e) -> iter_expr_free_vars f e | Set_field (x, _, y) -> f x; f y | Offset_ref (x, _) -> f x | Array_set (x, y, z) -> f x; f y; f z let iter_last_free_var f l = match l with | Return x | Raise (x, _) -> f x | Stop -> () | Branch cont | Poptrap (cont, _) -> iter_cont_free_vars f cont | Cond (_, x, cont1, cont2) -> f x; iter_cont_free_vars f cont1; iter_cont_free_vars f cont2 | Switch (x, a1, a2) -> f x; Array.iter a1 ~f:(fun c -> iter_cont_free_vars f c); Array.iter a2 ~f:(fun c -> iter_cont_free_vars f c) | Pushtrap (cont1, _, cont2, _) -> iter_cont_free_vars f cont1; iter_cont_free_vars f cont2 let iter_block_free_vars f block = List.iter block.body ~f:(fun i -> iter_instr_free_vars f i); iter_last_free_var f block.branch let iter_instr_bound_vars f i = match i with | Let (x, _) -> f x | Set_field _ | Offset_ref _ | Array_set _ -> () let iter_last_bound_vars f l = match l with | Return _ | Raise _ | Stop | Branch _ | Cond _ | Switch _ | Poptrap _ -> () | Pushtrap (_, x, _, _) -> f x let iter_block_bound_vars f block = List.iter ~f block.params; List.iter block.body ~f:(fun i -> iter_instr_bound_vars f i); iter_last_bound_vars f block.branch (****) type st = { index : int ; mutable lowlink : int ; mutable in_stack : bool } let find_loops ((_, blocks, _) as prog) = let in_loop = ref Addr.Map.empty in let index = ref 0 in let state = ref Addr.Map.empty in let stack = Stack.create () in let rec traverse pc = let st = { index = !index; lowlink = !index; in_stack = true } in state := Addr.Map.add pc st !state; incr index; Stack.push pc stack; Code.fold_children blocks pc (fun pc' () -> try let st' = Addr.Map.find pc' !state in if st'.in_stack then st.lowlink <- min st.lowlink st'.index with Not_found -> traverse pc'; let st' = Addr.Map.find pc' !state in st.lowlink <- min st.lowlink st'.lowlink) (); if st.index = st.lowlink then ( let l = ref [] in while let pc' = Stack.pop stack in l := pc' :: !l; (Addr.Map.find pc' !state).in_stack <- false; pc' <> pc do () done; if List.length !l > 1 then List.iter !l ~f:(fun pc' -> in_loop := Addr.Map.add pc' pc !in_loop)) in Code.fold_closures prog (fun _ _ (pc, _) () -> traverse pc) (); !in_loop let mark_variables in_loop (pc, blocks, free_pc) = let vars = Var.Tbl.make () (-1) in let visited = Array.make free_pc false in let rec traverse pc = if not visited.(pc) then ( visited.(pc) <- true; let block = Addr.Map.find pc blocks in (try let pc' = Addr.Map.find pc in_loop in iter_block_bound_vars (fun x -> (* Format.eprintf "!%a: %d@." Var.print x pc'; *) Var.Tbl.set vars x pc') block with Not_found -> ()); List.iter block.body ~f:(fun i -> match i with | Let (_, Closure (_, (pc', _))) -> traverse pc' | _ -> ()); Code.fold_children blocks pc (fun pc' () -> traverse pc') ()) in traverse pc; vars let free_variables vars in_loop (pc, blocks, free_pc) = let all_freevars = ref Addr.Map.empty in let freevars = ref Addr.Map.empty in let visited = Array.make free_pc false in let rec traverse pc = if not visited.(pc) then ( visited.(pc) <- true; let block = Addr.Map.find pc blocks in iter_block_free_vars (fun x -> let pc' = Var.Tbl.get vars x in (* Format.eprintf "%a: %d@." Var.print x pc'; *) if pc' <> -1 then let fv = try Addr.Map.find pc' !all_freevars with Not_found -> Var.Set.empty in let s = Var.Set.add x fv in all_freevars := Addr.Map.add pc' s !all_freevars) block; (try let pc'' = Addr.Map.find pc in_loop in all_freevars := Addr.Map.remove pc'' !all_freevars with Not_found -> ()); List.iter block.body ~f:(fun i -> match i with | Let (_, Closure (_, (pc', _))) -> ( traverse pc'; try let pc'' = Addr.Map.find pc in_loop in let fv = try Addr.Map.find pc'' !all_freevars with Not_found -> Var.Set.empty in freevars := Addr.Map.add pc' fv !freevars; all_freevars := Addr.Map.remove pc'' !all_freevars with Not_found -> freevars := Addr.Map.add pc' Var.Set.empty !freevars) | _ -> ()); Code.fold_children blocks pc (fun pc' () -> traverse pc') ()) in traverse pc; (* Addr.Map.iter (fun pc fv -> if Var.Set.cardinal fv > 0 then Format.eprintf ">> %d: %d@." pc (Var.Set.cardinal fv)) !freevars; *) !freevars let f p = Code.invariant p; let t = Timer.make () in let in_loop = find_loops p in let vars = mark_variables in_loop p in let free_vars = free_variables vars in_loop p in if times () then Format.eprintf " free vars: %a@." Timer.print t; free_vars js_of_ocaml-3.5.2/compiler/lib/freevars.mli000066400000000000000000000017401357507750000207070ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib val f : Code.program -> Code.Var.Set.t Code.Addr.Map.t js_of_ocaml-3.5.2/compiler/lib/fs.ml000066400000000000000000000032251357507750000173310ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let rec find_in_path paths name = match paths with | [] -> raise Not_found | path :: rem -> let file = Filename.concat path name in if Sys.file_exists file then file else find_in_path rem name let find_in_path paths name = if String.is_empty name || String.equal name "." then raise Not_found else if Filename.is_relative name then find_in_path paths name else if Sys.file_exists name then name else raise Not_found let absolute_path f = if Filename.is_relative f then Filename.concat (Sys.getcwd ()) f else f let read_file f = try let ic = open_in_bin f in let n = in_channel_length ic in let s = Bytes.create n in really_input ic s 0 n; close_in ic; Bytes.unsafe_to_string s with e -> failwith (Printf.sprintf "Cannot read content of %s.\n%s" f (Printexc.to_string e)) js_of_ocaml-3.5.2/compiler/lib/fs.mli000066400000000000000000000016731357507750000175070ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val find_in_path : string list -> string -> string val absolute_path : string -> string val read_file : string -> string js_of_ocaml-3.5.2/compiler/lib/generate.ml000066400000000000000000002053401357507750000205150ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (*XXX Patterns: => loops should avoid absorbing the whole continuation... (detect when the continuation does not loop anymore and close the loop at this point) => should have special code for switches that include the preceding if statement when possible => if e1 then {if e2 then P else Q} else {if e3 then P else Q} => if e then return e1; return e2 => if e then var x = e1; else var x = e2; => while (true) {.... if (e) continue; break; } - CLEAN UP!!! *) open! Stdlib let debug = Debug.find "gen" let times = Debug.find "times" open Code module J = Javascript (****) let string_of_set s = String.concat ~sep:", " (List.map ~f:Addr.to_string (Addr.Set.elements s)) let rec list_group_rec f g l b m n = match l with | [] -> List.rev ((b, List.rev m) :: n) | a :: r -> let fa = f a in if Poly.(fa = b) then list_group_rec f g r b (g a :: m) n else list_group_rec f g r fa [ g a ] ((b, List.rev m) :: n) let list_group f g l = match l with | [] -> [] | a :: r -> list_group_rec f g r (f a) [ g a ] [] (* like [List.map] except that it calls the function with an additional argument to indicate whether we're mapping over the last element of the list *) let rec map_last f l = match l with | [] -> assert false | [ x ] -> [ f true x ] | x :: xs -> f false x :: map_last f xs (****) module Share = struct type 'a aux = { strings : 'a StringMap.t ; applies : 'a IntMap.t ; prims : 'a StringMap.t } let empty_aux = { prims = StringMap.empty; strings = StringMap.empty; applies = IntMap.empty } type t = { mutable count : int aux ; mutable vars : J.ident aux ; alias_prims : bool ; alias_strings : bool ; alias_apply : bool } let add_string s t = let n = try StringMap.find s t.strings with Not_found -> 0 in { t with strings = StringMap.add s (n + 1) t.strings } let add_prim s t = let n = try StringMap.find s t.prims with Not_found -> 0 in { t with prims = StringMap.add s (n + 1) t.prims } let add_special_prim_if_exists s t = if Primitive.exists s then { t with prims = StringMap.add s (-1) t.prims } else t let add_apply i t = let n = try IntMap.find i t.applies with Not_found -> 0 in { t with applies = IntMap.add i (n + 1) t.applies } let add_code_string s share = let share = add_string s share in add_prim "caml_new_string" share let add_code_istring s share = add_string s share let rec get_constant c t = match c with | String s -> add_code_string s t | IString s -> add_code_istring s t | Tuple (_, args, _) -> Array.fold_left args ~init:t ~f:(fun t c -> get_constant c t) | _ -> t let add_args args t = List.fold_left args ~init:t ~f:(fun t a -> match a with | Pc c -> get_constant c t | _ -> t) let get ?(alias_strings = false) ?(alias_prims = false) ?(alias_apply = true) (_, blocks, _) : t = let count = Addr.Map.fold (fun _ block share -> List.fold_left block.body ~init:share ~f:(fun share i -> match i with | Let (_, Constant c) -> get_constant c share | Let (_, Apply (_, args, false)) -> add_apply (List.length args) share | Let (_, Prim (Extern "%closure", [ Pc (IString name | String name) ])) -> let name = Primitive.resolve name in let share = if Primitive.exists name then add_prim name share else share in share | Let (_, Prim (Extern name, args)) -> let name = Primitive.resolve name in let share = if Primitive.exists name then add_prim name share else share in add_args args share | Let (_, Prim (_, args)) -> add_args args share | _ -> share)) blocks empty_aux in let count = List.fold_left [ "caml_trampoline" ; "caml_trampoline_return" ; "caml_wrap_exception" ; "caml_list_of_js_array" ; "caml_exn_with_js_backtrace" ] ~init:count ~f:(fun acc x -> add_special_prim_if_exists x acc) in { count; vars = empty_aux; alias_strings; alias_prims; alias_apply } let get_string gen s t = if not t.alias_strings then gen s else try let c = StringMap.find s t.count.strings in if c > 1 then ( try J.EVar (StringMap.find s t.vars.strings) with Not_found -> let x = Var.fresh_n "str" in let v = J.V x in t.vars <- { t.vars with strings = StringMap.add s v t.vars.strings }; J.EVar v) else gen s with Not_found -> gen s let get_prim gen s t = let s = Primitive.resolve s in if not t.alias_prims then gen s else try let c = StringMap.find s t.count.prims in if c > 1 || c = -1 then ( try J.EVar (StringMap.find s t.vars.prims) with Not_found -> let x = Var.fresh_n s in let v = J.V x in t.vars <- { t.vars with prims = StringMap.add s v t.vars.prims }; J.EVar v) else gen s with Not_found -> gen s let get_apply gen n t = if not t.alias_apply then gen n else try J.EVar (IntMap.find n t.vars.applies) with Not_found -> let x = Var.fresh_n (Printf.sprintf "caml_call%d" n) in let v = J.V x in t.vars <- { t.vars with applies = IntMap.add n v t.vars.applies }; J.EVar v end module Ctx = struct type t = { mutable blocks : block Addr.Map.t ; live : int array ; share : Share.t ; debug : Parse_bytecode.Debug.t ; exported_runtime : Code.Var.t option } let initial ~exported_runtime blocks live share debug = { blocks; live; share; debug; exported_runtime } end let var x = J.EVar (J.V x) let int n = J.ENum (J.Num.of_int32 (Int32.of_int n)) let int32 n = J.ENum (J.Num.of_int32 n) let unsigned x = J.EBin (J.Lsr, x, int 0) let one = int 1 let zero = int 0 let plus_int x y = match x, y with | J.ENum y, x when J.Num.is_zero y -> x | x, J.ENum y when J.Num.is_zero y -> x | J.ENum x, J.ENum y -> J.ENum (J.Num.add x y) | x, y -> J.EBin (J.Plus, x, y) let bool e = J.ECond (e, one, zero) (*let boolnot e = J.ECond (e, zero, one)*) let val_float f = f (*J.EArr [Some (J.ENum 253.); Some f]*) let float_val e = e (****) let source_location ctx ?after pc = match Parse_bytecode.Debug.find_loc ctx.Ctx.debug ?after pc with | Some pi -> J.Pi pi | None -> J.N (****) let float_const f = val_float (J.ENum (J.Num.of_float f)) let s_var name = J.EVar (J.ident name) let runtime_fun ctx name = match ctx.Ctx.exported_runtime with | Some runtime -> J.EDot (J.EVar (J.V runtime), name) | None -> s_var name let str_js s = J.EStr (s, `Bytes) (****) (* Some variables are constant: x = 1 Some may change after effectful operations : x = y[z] There can be at most one effectful operations in the queue at once let (e, expr_queue) = ... in flush_queue expr_queue e *) let const_p = 0 let mutable_p = 1 let mutator_p = 2 let flush_p = 3 let or_p p q = max p q let is_mutable p = p >= mutable_p (*let is_mutator p = p >= mutator_p*) let kind k = match k with | `Pure -> const_p | `Mutable -> mutable_p | `Mutator -> mutator_p let rec constant_rec ~ctx x level instrs = match x with | String s -> let e = Share.get_string str_js s ctx.Ctx.share in let p = Share.get_prim (runtime_fun ctx) "caml_new_string" ctx.Ctx.share in J.ECall (p, [ e ], J.N), instrs | IString s -> Share.get_string str_js s ctx.Ctx.share, instrs | Float f -> float_const f, instrs | Float_array a -> ( Mlvalue.Array.make ~tag:Obj.double_array_tag ~args:(Array.to_list (Array.map a ~f:float_const)) , instrs ) | Int64 i -> let p = Share.get_prim (runtime_fun ctx) "caml_int64_create_lo_mi_hi" ctx.Ctx.share in let lo = int (Int64.to_int i land 0xffffff) and mi = int (Int64.to_int (Int64.shift_right i 24) land 0xffffff) and hi = int (Int64.to_int (Int64.shift_right i 48) land 0xffff) in J.ECall (p, [ lo; mi; hi ], J.N), instrs | Tuple (tag, a, _) -> ( let constant_max_depth = Config.Param.constant_max_depth () in let rec detect_list n acc = function | Tuple (0, [| x; l |], _) -> detect_list (succ n) (x :: acc) l | Int 0l -> if n > constant_max_depth then Some acc else None | _ -> None in match detect_list 0 [] x with | Some elts_rev -> let arr, instrs = List.fold_left elts_rev ~init:([], instrs) ~f:(fun (arr, instrs) elt -> let js, instrs = constant_rec ~ctx elt level instrs in Some js :: arr, instrs) in let p = Share.get_prim (runtime_fun ctx) "caml_list_of_js_array" ctx.Ctx.share in J.ECall (p, [ J.EArr arr ], J.N), instrs | None -> let split = level = constant_max_depth in let level = if split then 0 else level + 1 in let l, instrs = List.fold_left (Array.to_list a) ~init:([], instrs) ~f:(fun (l, instrs) cc -> let js, instrs = constant_rec ~ctx cc level instrs in js :: l, instrs) in let l, instrs = if split then List.fold_left l ~init:([], instrs) ~f:(fun (acc, instrs) js -> match js with | J.EArr _ -> let v = Code.Var.fresh_n "partial" in let instrs = (J.Variable_statement [ J.V v, Some (js, J.N) ], J.N) :: instrs in J.EVar (J.V v) :: acc, instrs | _ -> js :: acc, instrs) else List.rev l, instrs in Mlvalue.Block.make ~tag ~args:l, instrs) | Int i -> int32 i, instrs let constant ~ctx x level = let expr, instr = constant_rec ~ctx x level [] in expr, List.rev instr type queue_elt = { prop : int ; cardinal : int ; ce : J.expression ; loc : J.location ; deps : Code.Var.Set.t } let access_queue queue x = try let elt = List.assoc x queue in if elt.cardinal = 1 then (elt.prop, elt.ce), List.remove_assoc x queue else ( (elt.prop, elt.ce) , List.map queue ~f:(function | x', elt when Var.equal x x' -> x', { elt with cardinal = pred elt.cardinal } | x -> x) ) with Not_found -> (const_p, var x), queue let access_queue' ~ctx queue x = match x with | Pc c -> let js, instrs = constant ~ctx c (Config.Param.constant_max_depth ()) in assert (List.is_empty instrs); (* We only have simple constants here *) (const_p, js), queue | Pv x -> access_queue queue x let access_queue_may_flush queue v x = let tx, queue = access_queue queue x in let _, instrs, queue = List.fold_left queue ~init:(Code.Var.Set.singleton v, [], []) ~f:(fun (deps, instrs, queue) ((y, elt) as eq) -> if Code.Var.Set.exists (fun p -> Code.Var.Set.mem p deps) elt.deps then ( Code.Var.Set.add y deps , (J.Variable_statement [ J.V y, Some (elt.ce, elt.loc) ], elt.loc) :: instrs , queue ) else deps, instrs, eq :: queue) in instrs, (tx, List.rev queue) let should_flush cond prop = cond <> const_p && cond + prop >= flush_p let flush_queue expr_queue prop (l : J.statement_list) = let instrs, expr_queue = if prop >= flush_p then expr_queue, [] else List.partition ~f:(fun (_, elt) -> should_flush prop elt.prop) expr_queue in let instrs = List.map instrs ~f:(fun (x, elt) -> J.Variable_statement [ J.V x, Some (elt.ce, elt.loc) ], elt.loc) in List.rev_append instrs l, expr_queue let flush_all expr_queue l = fst (flush_queue expr_queue flush_p l) let enqueue expr_queue prop x ce loc cardinal acc = let instrs, expr_queue = if Config.Flag.compact () then if is_mutable prop then flush_queue expr_queue prop [] else [], expr_queue else flush_queue expr_queue flush_p [] in let deps = Js_simpl.get_variable Code.Var.Set.empty ce in let deps = List.fold_left expr_queue ~init:deps ~f:(fun deps (x', elt) -> if Code.Var.Set.mem x' deps then Code.Var.Set.union elt.deps deps else deps) in instrs @ acc, (x, { prop; ce; loc; cardinal; deps }) :: expr_queue (****) type state = { all_succs : (int, Addr.Set.t) Hashtbl.t ; (* not used *) succs : (int, int list) Hashtbl.t ; backs : (int, Addr.Set.t) Hashtbl.t ; preds : (int, int) Hashtbl.t ; mutable loops : Addr.Set.t ; mutable loop_stack : (Addr.t * (J.Label.t * bool ref)) list ; mutable visited_blocks : Addr.Set.t ; mutable interm_idx : int ; ctx : Ctx.t ; mutable blocks : Code.block Addr.Map.t ; at_toplevel : bool } let get_preds st pc = try Hashtbl.find st.preds pc with Not_found -> 0 let incr_preds st pc = Hashtbl.replace st.preds pc (get_preds st pc + 1) let decr_preds st pc = Hashtbl.replace st.preds pc (get_preds st pc - 1) let protect_preds st pc = Hashtbl.replace st.preds pc (get_preds st pc + 1000000) let unprotect_preds st pc = Hashtbl.replace st.preds pc (get_preds st pc - 1000000) let ( >> ) x f = f x (* This as to be kept in sync with the way we build conditionals and switches! *) module DTree = struct type 'a t = | If of Code.cond * 'a t * 'a t | Switch of (int list * 'a t) array | Branch of 'a | Empty let normalize a = a >> Array.to_list >> List.stable_sort ~cmp:(fun (cont1, _) (cont2, _) -> Poly.compare cont1 cont2) >> list_group fst snd >> List.map ~f:(fun (cont1, l1) -> cont1, List.flatten l1) >> List.stable_sort ~cmp:(fun (_, l1) (_, l2) -> compare (List.length l1) (List.length l2)) >> Array.of_list let build_if cond b1 b2 = If (cond, Branch b1, Branch b2) let build_switch (a : cont array) : 'a t = let m = Config.Param.switch_max_case () in let ai = Array.mapi a ~f:(fun i x -> x, i) in (* group the contiguous cases with the same continuation *) let ai : (Code.cont * int list) array = Array.of_list (list_group fst snd (Array.to_list ai)) in let rec loop low up = let array_norm : (Code.cont * int list) array = normalize (Array.sub ai ~pos:low ~len:(up - low + 1)) in let array_len = Array.length array_norm in if array_len = 1 (* remaining cases all jump to the same branch *) then Branch (fst array_norm.(0)) else try (* try to optimize when there are only 2 branch *) match array_norm with | [| (b1, [ i1 ]); (b2, _l2) |] -> If (CEq (Int32.of_int i1), Branch b1, Branch b2) | [| (b1, _l1); (b2, [ i2 ]) |] -> If (CEq (Int32.of_int i2), Branch b2, Branch b1) | [| (b1, l1); (b2, l2) |] -> let bound l1 = match l1, List.rev l1 with | min :: _, max :: _ -> min, max | _ -> assert false in let min1, max1 = bound l1 in let min2, max2 = bound l2 in if max1 < min2 then If (CLt (Int32.of_int max1), Branch b2, Branch b1) else if max2 < min1 then If (CLt (Int32.of_int max2), Branch b1, Branch b2) else raise Not_found | _ -> raise Not_found with Not_found -> ( (* do we have to split again ? *) (* we count the number of cases, default/last case count for one *) let nbcases = ref 1 (* default case *) in for i = 0 to array_len - 2 do nbcases := !nbcases + List.length (snd array_norm.(i)) done; if !nbcases <= m then Switch (Array.map array_norm ~f:(fun (x, l) -> l, Branch x)) else let h = (up + low) / 2 in let b1 = loop low h and b2 = loop (succ h) up in let range1 = snd ai.(h) and range2 = snd ai.(succ h) in match range1, range2 with | [], _ | _, [] -> assert false | _, lower_bound2 :: _ -> If (Code.CLe (Int32.of_int lower_bound2), b2, b1)) in let len = Array.length ai in if len = 0 then Empty else loop 0 (len - 1) let rec fold_cont f b acc = match b with | If (_, b1, b2) -> acc >> fold_cont f b1 >> fold_cont f b2 | Switch a -> Array.fold_left a ~init:acc ~f:(fun acc (_, b) -> fold_cont f b acc) | Branch (pc, _) -> f pc acc | Empty -> acc let nbcomp a = let rec loop c = function | Empty -> c | Branch _ -> c | If (_, a, b) -> let c = succ c in let c = loop c a in let c = loop c b in c | Switch a -> let c = succ c in Array.fold_left a ~init:c ~f:(fun acc (_, b) -> loop acc b) in loop 0 a end let fold_children blocks pc f accu = let block = Addr.Map.find pc blocks in match block.branch with | Return _ | Raise _ | Stop -> accu | Branch (pc', _) | Poptrap ((pc', _), _) -> f pc' accu | Pushtrap ((pc1, _), _, (pc2, _), _) -> accu >> f pc1 >> f pc2 | Cond (cond, _, cont1, cont2) -> DTree.fold_cont f (DTree.build_if cond cont1 cont2) accu | Switch (_, a1, a2) -> let a1 = DTree.build_switch a1 and a2 = DTree.build_switch a2 in accu >> DTree.fold_cont f a1 >> DTree.fold_cont f a2 let rec build_graph st pc anc = if not (Addr.Set.mem pc st.visited_blocks) then ( st.visited_blocks <- Addr.Set.add pc st.visited_blocks; let anc = Addr.Set.add pc anc in let s = Code.fold_children st.blocks pc Addr.Set.add Addr.Set.empty in Hashtbl.add st.all_succs pc s; let backs = Addr.Set.inter s anc in Hashtbl.add st.backs pc backs; let s = fold_children st.blocks pc (fun x l -> x :: l) [] in let succs = List.filter s ~f:(fun pc -> not (Addr.Set.mem pc anc)) in Hashtbl.add st.succs pc succs; Addr.Set.iter (fun pc' -> st.loops <- Addr.Set.add pc' st.loops) backs; List.iter succs ~f:(fun pc' -> build_graph st pc' anc); List.iter succs ~f:(fun pc' -> incr_preds st pc')) let rec dominance_frontier_rec st pc visited grey = let n = get_preds st pc in let v = try Addr.Map.find pc visited with Not_found -> 0 in if v < n then let v = v + 1 in let visited = Addr.Map.add pc v visited in if v = n then let grey = Addr.Set.remove pc grey in let s = Hashtbl.find st.succs pc in List.fold_right s ~init:(visited, grey) ~f:(fun pc' (visited, grey) -> dominance_frontier_rec st pc' visited grey) else visited, if v = 1 then Addr.Set.add pc grey else grey else visited, grey let dominance_frontier st pc = snd (dominance_frontier_rec st pc Addr.Map.empty Addr.Set.empty) let rec resolve_node interm pc = try resolve_node interm (fst (Addr.Map.find pc interm)) with Not_found -> pc let resolve_nodes interm s = Addr.Set.fold (fun pc s' -> Addr.Set.add (resolve_node interm pc) s') s Addr.Set.empty (****) let rec visit visited prev s m x l = if not (Var.Set.mem x visited) then let visited = Var.Set.add x visited in let y = Var.Map.find x m in if Code.Var.compare x y = 0 then visited, None, l else if Var.Set.mem y prev then let t = Code.Var.fresh () in visited, Some (y, t), (x, t) :: l else if Var.Set.mem y s then let visited, aliases, l = visit visited (Var.Set.add x prev) s m y l in match aliases with | Some (a, b) when Code.Var.compare a x = 0 -> visited, None, (b, a) :: (x, y) :: l | _ -> visited, aliases, (x, y) :: l else visited, None, (x, y) :: l else visited, None, l let visit_all params args = let m = Subst.build_mapping params args in let s = List.fold_left params ~init:Var.Set.empty ~f:(fun s x -> Var.Set.add x s) in let _, l = Var.Set.fold (fun x (visited, l) -> let visited, _, l = visit visited Var.Set.empty s m x l in visited, l) s (Var.Set.empty, []) in l let parallel_renaming params args continuation queue = let l = List.rev (visit_all params args) in List.fold_left l ~f:(fun continuation (y, x) queue -> let instrs, ((px, cx), queue) = access_queue_may_flush queue y x in let st, queue = flush_queue queue px (instrs @ [ J.Variable_statement [ J.V y, Some (cx, J.N) ], J.N ]) in st @ continuation queue) ~init:continuation queue (****) let apply_fun_raw ctx f params = let n = List.length params in J.ECond ( J.EBin (J.EqEq, J.EDot (f, "length"), int n) , J.ECall (f, params, J.N) , J.ECall ( runtime_fun ctx "caml_call_gen" , [ f; J.EArr (List.map params ~f:(fun x -> Some x)) ] , J.N ) ) let generate_apply_fun ctx n = let f' = Var.fresh_n "f" in let f = J.V f' in let params = Array.to_list (Array.init n ~f:(fun i -> let a = Var.fresh_n (Printf.sprintf "a%d" i) in J.V a)) in let f' = J.EVar f in let params' = List.map params ~f:(fun x -> J.EVar x) in J.EFun ( None , f :: params , [ J.Statement (J.Return_statement (Some (apply_fun_raw ctx f' params'))), J.N ] , J.N ) let apply_fun ctx f params loc = if Config.Flag.inline_callgen () then apply_fun_raw ctx f params else let y = Share.get_apply (generate_apply_fun ctx) (List.length params) ctx.Ctx.share in J.ECall (y, f :: params, loc) (****) let to_int cx = J.EBin (J.Bor, cx, int 0) (* 32 bit ints *) let _ = List.iter ~f:(fun (nm, nm') -> Primitive.alias nm nm') [ "%int_mul", "caml_mul" ; "%int_div", "caml_div" ; "%int_mod", "caml_mod" ; "caml_int32_neg", "%int_neg" ; "caml_int32_add", "%int_add" ; "caml_int32_sub", "%int_sub" ; "caml_int32_mul", "%int_mul" ; "caml_int32_div", "%int_div" ; "caml_int32_mod", "%int_mod" ; "caml_int32_and", "%int_and" ; "caml_int32_or", "%int_or" ; "caml_int32_xor", "%int_xor" ; "caml_int32_shift_left", "%int_lsl" ; "caml_int32_shift_right", "%int_asr" ; "caml_int32_shift_right_unsigned", "%int_lsr" ; "caml_int32_of_int", "%identity" ; "caml_int32_to_int", "%identity" ; "caml_int32_of_float", "caml_int_of_float" ; "caml_int32_to_float", "%identity" ; "caml_int32_format", "caml_format_int" ; "caml_int32_of_string", "caml_int_of_string" ; "caml_int32_compare", "caml_int_compare" ; "caml_nativeint_neg", "%int_neg" ; "caml_nativeint_add", "%int_add" ; "caml_nativeint_sub", "%int_sub" ; "caml_nativeint_mul", "%int_mul" ; "caml_nativeint_div", "%int_div" ; "caml_nativeint_mod", "%int_mod" ; "caml_nativeint_and", "%int_and" ; "caml_nativeint_or", "%int_or" ; "caml_nativeint_xor", "%int_xor" ; "caml_nativeint_shift_left", "%int_lsl" ; "caml_nativeint_shift_right", "%int_asr" ; "caml_nativeint_shift_right_unsigned", "%int_lsr" ; "caml_nativeint_of_int", "%identity" ; "caml_nativeint_to_int", "%identity" ; "caml_nativeint_of_float", "caml_int_of_float" ; "caml_nativeint_to_float", "%identity" ; "caml_nativeint_of_int32", "%identity" ; "caml_nativeint_to_int32", "%identity" ; "caml_nativeint_format", "caml_format_int" ; "caml_nativeint_of_string", "caml_int_of_string" ; "caml_nativeint_compare", "caml_int_compare" ; "caml_nativeint_bswap", "caml_int32_bswap" ; "caml_int64_of_int", "caml_int64_of_int32" ; "caml_int64_to_int", "caml_int64_to_int32" ; "caml_int64_of_nativeint", "caml_int64_of_int32" ; "caml_int64_to_nativeint", "caml_int64_to_int32" ; "caml_float_of_int", "%identity" ; "caml_array_get_float", "caml_array_get" ; "caml_floatarray_get", "caml_array_get" ; "caml_array_get_addr", "caml_array_get" ; "caml_array_set_float", "caml_array_set" ; "caml_floatarray_set", "caml_array_set" ; "caml_array_set_addr", "caml_array_set" ; "caml_array_unsafe_get_float", "caml_array_unsafe_get" ; "caml_floatarray_unsafe_get", "caml_array_unsafe_get" ; "caml_array_unsafe_set_float", "caml_array_unsafe_set" ; "caml_floatarray_unsafe_set", "caml_array_unsafe_set" ; "caml_alloc_dummy_float", "caml_alloc_dummy" ; "caml_make_array", "%identity" ; "caml_ensure_stack_capacity", "%identity" ; "caml_js_from_float", "%identity" ; "caml_js_to_float", "%identity" ] let internal_primitives = Hashtbl.create 31 let internal_prim name = try Hashtbl.find internal_primitives name with Not_found -> None let register_prim name k f = Primitive.register name k None None; Hashtbl.add internal_primitives name (Some f) let register_un_prim name k f = register_prim name k (fun l queue ctx loc -> match l with | [ x ] -> let (px, cx), queue = access_queue' ~ctx queue x in f cx loc, or_p (kind k) px, queue | _ -> assert false) let register_un_prim_ctx name k f = register_prim name k (fun l queue ctx loc -> match l with | [ x ] -> let (px, cx), queue = access_queue' ~ctx queue x in f ctx cx loc, or_p (kind k) px, queue | _ -> assert false) let register_bin_prim name k f = register_prim name k (fun l queue ctx loc -> match l with | [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in f cx cy loc, or_p (kind k) (or_p px py), queue | _ -> assert false) let register_tern_prim name f = register_prim name `Mutator (fun l queue ctx loc -> match l with | [ x; y; z ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in let (pz, cz), queue = access_queue' ~ctx queue z in f cx cy cz loc, or_p mutator_p (or_p px (or_p py pz)), queue | _ -> assert false) let register_un_math_prim name prim = register_un_prim name `Pure (fun cx loc -> J.ECall (J.EDot (s_var "Math", prim), [ cx ], loc)) let register_bin_math_prim name prim = register_bin_prim name `Pure (fun cx cy loc -> J.ECall (J.EDot (s_var "Math", prim), [ cx; cy ], loc)) let _ = register_un_prim_ctx "%caml_format_int_special" `Pure (fun ctx cx loc -> let p = Share.get_prim (runtime_fun ctx) "caml_new_string" ctx.Ctx.share in J.ECall (p, [ J.EBin (J.Plus, str_js "", cx) ], loc)); register_bin_prim "caml_array_unsafe_get" `Mutable (fun cx cy _ -> Mlvalue.Array.field cx cy); register_bin_prim "%int_add" `Pure (fun cx cy _ -> to_int (plus_int cx cy)); register_bin_prim "%int_sub" `Pure (fun cx cy _ -> to_int (J.EBin (J.Minus, cx, cy))); register_bin_prim "%direct_int_mul" `Pure (fun cx cy _ -> to_int (J.EBin (J.Mul, cx, cy))); register_bin_prim "%direct_int_div" `Pure (fun cx cy _ -> to_int (J.EBin (J.Div, cx, cy))); register_bin_prim "%direct_int_mod" `Pure (fun cx cy _ -> to_int (J.EBin (J.Mod, cx, cy))); register_bin_prim "%int_and" `Pure (fun cx cy _ -> J.EBin (J.Band, cx, cy)); register_bin_prim "%int_or" `Pure (fun cx cy _ -> J.EBin (J.Bor, cx, cy)); register_bin_prim "%int_xor" `Pure (fun cx cy _ -> J.EBin (J.Bxor, cx, cy)); register_bin_prim "%int_lsl" `Pure (fun cx cy _ -> J.EBin (J.Lsl, cx, cy)); register_bin_prim "%int_lsr" `Pure (fun cx cy _ -> to_int (J.EBin (J.Lsr, cx, cy))); register_bin_prim "%int_asr" `Pure (fun cx cy _ -> J.EBin (J.Asr, cx, cy)); register_un_prim "%int_neg" `Pure (fun cx _ -> to_int (J.EUn (J.Neg, cx))); register_bin_prim "caml_eq_float" `Pure (fun cx cy _ -> bool (J.EBin (J.EqEq, float_val cx, float_val cy))); register_bin_prim "caml_neq_float" `Pure (fun cx cy _ -> bool (J.EBin (J.NotEq, float_val cx, float_val cy))); register_bin_prim "caml_ge_float" `Pure (fun cx cy _ -> bool (J.EBin (J.Le, float_val cy, float_val cx))); register_bin_prim "caml_le_float" `Pure (fun cx cy _ -> bool (J.EBin (J.Le, float_val cx, float_val cy))); register_bin_prim "caml_gt_float" `Pure (fun cx cy _ -> bool (J.EBin (J.Lt, float_val cy, float_val cx))); register_bin_prim "caml_lt_float" `Pure (fun cx cy _ -> bool (J.EBin (J.Lt, float_val cx, float_val cy))); register_bin_prim "caml_add_float" `Pure (fun cx cy _ -> val_float (J.EBin (J.Plus, float_val cx, float_val cy))); register_bin_prim "caml_sub_float" `Pure (fun cx cy _ -> val_float (J.EBin (J.Minus, float_val cx, float_val cy))); register_bin_prim "caml_mul_float" `Pure (fun cx cy _ -> val_float (J.EBin (J.Mul, float_val cx, float_val cy))); register_bin_prim "caml_div_float" `Pure (fun cx cy _ -> val_float (J.EBin (J.Div, float_val cx, float_val cy))); register_un_prim "caml_neg_float" `Pure (fun cx _ -> val_float (J.EUn (J.Neg, float_val cx))); register_bin_prim "caml_fmod_float" `Pure (fun cx cy _ -> val_float (J.EBin (J.Mod, float_val cx, float_val cy))); register_tern_prim "caml_array_unsafe_set" (fun cx cy cz _ -> J.EBin (J.Eq, Mlvalue.Array.field cx cy, cz)); register_un_prim "caml_alloc_dummy" `Pure (fun _ _ -> J.EArr []); register_un_prim "caml_obj_dup" `Mutable (fun cx loc -> J.ECall (J.EDot (cx, "slice"), [], loc)); register_un_prim "caml_int_of_float" `Pure (fun cx _loc -> to_int cx); register_un_math_prim "caml_abs_float" "abs"; register_un_math_prim "caml_acos_float" "acos"; register_un_math_prim "caml_asin_float" "asin"; register_un_math_prim "caml_atan_float" "atan"; register_bin_math_prim "caml_atan2_float" "atan2"; register_un_math_prim "caml_ceil_float" "ceil"; register_un_math_prim "caml_cos_float" "cos"; register_un_math_prim "caml_exp_float" "exp"; register_un_math_prim "caml_floor_float" "floor"; register_un_math_prim "caml_log_float" "log"; register_bin_math_prim "caml_power_float" "pow"; register_un_math_prim "caml_sin_float" "sin"; register_un_math_prim "caml_sqrt_float" "sqrt"; register_un_math_prim "caml_tan_float" "tan"; register_un_prim "caml_js_from_bool" `Pure (fun cx _ -> J.EUn (J.Not, J.EUn (J.Not, cx))); register_un_prim "caml_js_to_bool" `Pure (fun cx _ -> to_int cx); register_un_prim "caml_js_from_string" `Mutable (fun cx loc -> J.ECall (J.EDot (cx, "toString"), [], loc)); register_tern_prim "caml_js_set" (fun cx cy cz _ -> J.EBin (J.Eq, J.EAccess (cx, cy), cz)); register_bin_prim "caml_js_get" `Mutable (fun cx cy _ -> J.EAccess (cx, cy)); register_bin_prim "caml_js_delete" `Mutable (fun cx cy _ -> J.EUn (J.Delete, J.EAccess (cx, cy))); register_bin_prim "caml_js_equals" `Mutable (fun cx cy _ -> bool (J.EBin (J.EqEq, cx, cy))); register_bin_prim "caml_js_instanceof" `Pure (fun cx cy _ -> bool (J.EBin (J.InstanceOf, cx, cy))); register_un_prim "caml_js_typeof" `Pure (fun cx _ -> J.EUn (J.Typeof, cx)) (****) (* when raising ocaml exception and [improved_stacktrace] is enabled, tag the ocaml exception with a Javascript error (that contain js stacktrace). {[ throw e ]} becomes {[ throw (caml_exn_with_js_backtrace(e,false)) ]} *) let throw_statement ctx cx k loc = match (k : [ `Normal | `Reraise | `Notrace ]) with | _ when not (Config.Flag.improved_stacktrace ()) -> [ J.Throw_statement cx, loc ] | `Notrace -> [ J.Throw_statement cx, loc ] | `Normal -> [ ( J.Throw_statement (J.ECall (runtime_fun ctx "caml_exn_with_js_backtrace", [ cx; bool (int 1) ], loc)) , loc ) ] | `Reraise -> [ ( J.Throw_statement (J.ECall (runtime_fun ctx "caml_exn_with_js_backtrace", [ cx; bool (int 0) ], loc)) , loc ) ] let rec translate_expr ctx queue loc _x e level : _ * J.statement_list = match e with | Const i -> (int32 i, const_p, queue), [] | Apply (x, l, true) -> let (px, cx), queue = access_queue queue x in let args, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue queue x in cx :: args, or_p prop prop', queue) l ~init:([], or_p px mutator_p, queue) in (J.ECall (cx, args, loc), prop, queue), [] | Apply (x, l, false) -> let args, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue queue x in cx :: args, or_p prop prop', queue) l ~init:([], mutator_p, queue) in let (prop', f), queue = access_queue queue x in let prop = or_p prop prop' in let e = apply_fun ctx f args loc in (e, prop, queue), [] | Block (tag, a, array_or_not) -> let contents, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue queue x in cx :: args, or_p prop prop', queue) (Array.to_list a) ~init:([], const_p, queue) in let x = match array_or_not with | Array -> Mlvalue.Array.make ~tag ~args:contents | NotArray | Unknown -> Mlvalue.Block.make ~tag ~args:contents in (x, prop, queue), [] | Field (x, n) -> let (px, cx), queue = access_queue queue x in (Mlvalue.Block.field cx n, or_p px mutable_p, queue), [] | Closure (args, ((pc, _) as cont)) -> let loc = source_location ctx ~after:true pc in let clo = compile_closure ctx false cont in let clo = match clo with | (st, J.N) :: rem -> (st, J.U) :: rem | _ -> clo in let clo = J.EFun (None, List.map args ~f:(fun v -> J.V v), clo, loc) in (clo, flush_p, queue), [] | Constant c -> let js, instrs = constant ~ctx c level in (js, const_p, queue), instrs | Prim (Extern "debugger", _) -> let ins = if Config.Flag.debugger () then J.Debugger_statement else J.Empty_statement in (int 0, const_p, queue), [ ins, loc ] | Prim (p, l) -> let res = match p, l with | Vectlength, [ x ] -> let (px, cx), queue = access_queue' ~ctx queue x in Mlvalue.Array.length cx, px, queue | Array_get, [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in Mlvalue.Array.field cx cy, or_p mutable_p (or_p px py), queue | Extern "caml_js_var", [ Pc (String nm | IString nm) ] | Extern ("caml_js_expr" | "caml_pure_js_expr"), [ Pc (String nm | IString nm) ] -> ( try let offset = match loc with | J.N | J.U -> None | J.Pi pi -> Some pi in let lex = Parse_js.lexer_from_string ?offset nm in let e = Parse_js.parse_expr lex in e, const_p, queue with Parse_js.Parsing_error pi -> failwith (Printf.sprintf "Parsing error %S at l:%d col:%d" nm (pi.Parse_info.line + 1) pi.Parse_info.col)) | Extern "%js_array", l -> let args, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue' ~ctx queue x in cx :: args, or_p prop prop', queue) l ~init:([], const_p, queue) in J.EArr (List.map args ~f:(fun x -> Some x)), prop, queue | Extern "%closure", [ Pc (IString name | String name) ] -> let prim = Share.get_prim (runtime_fun ctx) name ctx.Ctx.share in prim, const_p, queue | Extern "%caml_js_opt_call", f :: o :: l -> let (pf, cf), queue = access_queue' ~ctx queue f in let (po, co), queue = access_queue' ~ctx queue o in let args, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue' ~ctx queue x in cx :: args, or_p prop prop', queue) l ~init:([], mutator_p, queue) in J.ECall (J.EDot (cf, "call"), co :: args, loc), or_p (or_p pf po) prop, queue | Extern "%caml_js_opt_fun_call", f :: l -> let (pf, cf), queue = access_queue' ~ctx queue f in let args, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue' ~ctx queue x in cx :: args, or_p prop prop', queue) l ~init:([], mutator_p, queue) in J.ECall (cf, args, loc), or_p pf prop, queue | Extern "%caml_js_opt_meth_call", o :: Pc (String m | IString m) :: l -> let (po, co), queue = access_queue' ~ctx queue o in let args, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue' ~ctx queue x in cx :: args, or_p prop prop', queue) l ~init:([], mutator_p, queue) in J.ECall (J.EDot (co, m), args, loc), or_p po prop, queue | Extern "%caml_js_opt_new", c :: l -> let (pc, cc), queue = access_queue' ~ctx queue c in let args, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue' ~ctx queue x in cx :: args, or_p prop prop', queue) l ~init:([], mutator_p, queue) in ( J.ENew (cc, if List.is_empty args then None else Some args) , or_p pc prop , queue ) | Extern "caml_js_get", [ Pv o; Pc (String f | IString f) ] when J.is_ident f -> let (po, co), queue = access_queue queue o in J.EDot (co, f), or_p po mutable_p, queue | Extern "caml_js_set", [ Pv o; Pc (String f | IString f); v ] when J.is_ident f -> let (po, co), queue = access_queue queue o in let (pv, cv), queue = access_queue' ~ctx queue v in J.EBin (J.Eq, J.EDot (co, f), cv), or_p (or_p po pv) mutator_p, queue | Extern "caml_js_delete", [ Pv o; Pc (String f | IString f) ] when J.is_ident f -> let (po, co), queue = access_queue queue o in J.EUn (J.Delete, J.EDot (co, f)), or_p po mutator_p, queue | Extern "%overrideMod", [ Pc (String m | IString m); Pc (String f | IString f) ] -> runtime_fun ctx (Printf.sprintf "caml_%s_%s" m f), const_p, queue | Extern "%overrideMod", _ -> assert false | Extern "%caml_js_opt_object", fields -> let rec build_fields queue l = match l with | [] -> const_p, [], queue | Pc (String nm | IString nm) :: x :: r -> let (prop, cx), queue = access_queue' ~ctx queue x in let prop', r', queue = build_fields queue r in or_p prop prop', (J.PNS nm, cx) :: r', queue | _ -> assert false in let prop, fields, queue = build_fields queue fields in J.EObj fields, prop, queue | Extern "caml_alloc_dummy_function", [ _; size ] -> let i, queue = let (_px, cx), queue = access_queue' ~ctx queue size in match cx with | J.ENum i -> Int32.to_int (J.Num.to_int32 i), queue | _ -> assert false in let args = Array.to_list (Array.init i ~f:(fun _ -> J.V (Var.fresh ()))) in let f = J.V (Var.fresh ()) in let call = J.ECall (J.EDot (J.EVar f, "fun"), List.map args ~f:(fun v -> J.EVar v), loc) in let e = J.EFun (Some f, args, [ J.Statement (J.Return_statement (Some call)), J.N ], J.N) in e, const_p, queue | Extern "caml_alloc_dummy_function", _ -> assert false | Extern name, l -> ( let name = Primitive.resolve name in match internal_prim name with | Some f -> f l queue ctx loc | None -> if String.is_prefix name ~prefix:"%" then failwith (Printf.sprintf "Unresolved internal primitive: %s" name); let prim = Share.get_prim (runtime_fun ctx) name ctx.Ctx.share in let prim_kind = kind (Primitive.kind name) in let args, prop, queue = List.fold_right ~f:(fun x (args, prop, queue) -> let (prop', cx), queue = access_queue' ~ctx queue x in cx :: args, or_p prop prop', queue) l ~init:([], prim_kind, queue) in J.ECall (prim, args, loc), prop, queue) | Not, [ x ] -> let (px, cx), queue = access_queue' ~ctx queue x in J.EBin (J.Minus, one, cx), px, queue | Lt, [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in bool (J.EBin (J.Lt, cx, cy)), or_p px py, queue | Le, [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in bool (J.EBin (J.Le, cx, cy)), or_p px py, queue | Eq, [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in bool (J.EBin (J.EqEqEq, cx, cy)), or_p px py, queue | Neq, [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in bool (J.EBin (J.NotEqEq, cx, cy)), or_p px py, queue | IsInt, [ x ] -> let (px, cx), queue = access_queue' ~ctx queue x in bool (Mlvalue.is_immediate cx), px, queue | Ult, [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in bool (J.EBin (J.Lt, unsigned cx, unsigned cy)), or_p px py, queue | (Vectlength | Array_get | Not | IsInt | Eq | Neq | Lt | Le | Ult), _ -> assert false in res, [] and translate_instr ctx expr_queue loc instr = match instr with | Let (x, e) -> ( let (ce, prop, expr_queue), instrs = translate_expr ctx expr_queue loc x e 0 in let keep_name x = match Code.Var.get_name x with | None -> false | Some s -> not (String.is_prefix s ~prefix:"jsoo_") in match ctx.Ctx.live.(Var.idx x), e with | 0, _ -> (* deadcode is off *) flush_queue expr_queue prop (instrs @ [ J.Expression_statement ce, loc ]) | 1, _ when Config.Flag.compact () && ((not (Config.Flag.pretty ())) || not (keep_name x)) -> enqueue expr_queue prop x ce loc 1 instrs (* We could inline more. size_v : length of the variable after serialization size_c : length of the constant after serialization num : number of occurrence size_c * n < size_v * n + size_v + 1 + size_c *) | n, (Const _ | Constant (Int _ | Float _)) -> enqueue expr_queue prop x ce loc n instrs | _ -> flush_queue expr_queue prop (instrs @ [ J.Variable_statement [ J.V x, Some (ce, loc) ], loc ])) | Set_field (x, n, y) -> let (_px, cx), expr_queue = access_queue expr_queue x in let (_py, cy), expr_queue = access_queue expr_queue y in flush_queue expr_queue mutator_p [ J.Expression_statement (J.EBin (J.Eq, Mlvalue.Block.field cx n, cy)), loc ] | Offset_ref (x, 1) -> (* FIX: may overflow.. *) let (_px, cx), expr_queue = access_queue expr_queue x in flush_queue expr_queue mutator_p [ J.Expression_statement (J.EUn (J.IncrA, Mlvalue.Block.field cx 0)), loc ] | Offset_ref (x, n) -> (* FIX: may overflow.. *) let (_px, cx), expr_queue = access_queue expr_queue x in flush_queue expr_queue mutator_p [ J.Expression_statement (J.EBin (J.PlusEq, Mlvalue.Block.field cx 0, int n)), loc ] | Array_set (x, y, z) -> let (_px, cx), expr_queue = access_queue expr_queue x in let (_py, cy), expr_queue = access_queue expr_queue y in let (_pz, cz), expr_queue = access_queue expr_queue z in flush_queue expr_queue mutator_p [ J.Expression_statement (J.EBin (J.Eq, Mlvalue.Array.field cx cy, cz)), loc ] and translate_instrs ctx expr_queue loc instr = match instr with | [] -> [], expr_queue | instr :: rem -> let st, expr_queue = translate_instr ctx expr_queue loc instr in let instrs, expr_queue = translate_instrs ctx expr_queue loc rem in st @ instrs, expr_queue and compile_block st queue (pc : Addr.t) frontier interm = if (not (List.is_empty queue)) && (Addr.Set.mem pc st.loops || not (Config.Flag.inline ())) then flush_all queue (compile_block st [] pc frontier interm) else ( if pc >= 0 then ( if Addr.Set.mem pc st.visited_blocks then ( Format.eprintf "Trying to compile a block twice !!!! %d@." pc; assert false); st.visited_blocks <- Addr.Set.add pc st.visited_blocks); if debug () then ( if Addr.Set.mem pc st.loops then Format.eprintf "@[<2>for(;;){@,"; Format.eprintf "block %d;@ @?" pc); (if Addr.Set.mem pc st.loops then let lab = match st.loop_stack with | (_, (l, _)) :: _ -> J.Label.succ l | [] -> J.Label.zero in st.loop_stack <- (pc, (lab, ref false)) :: st.loop_stack); let succs = Hashtbl.find st.succs pc in let backs = Hashtbl.find st.backs pc in (* Remove limit *) if pc < 0 then List.iter succs ~f:(fun pc -> unprotect_preds st pc); let succs = List.map succs ~f:(fun pc -> pc, dominance_frontier st pc) in let grey = List.fold_right ~f:(fun (_, frontier) grey -> Addr.Set.union frontier grey) succs ~init:Addr.Set.empty in let new_frontier = resolve_nodes interm grey in let block = Addr.Map.find pc st.blocks in let seq, queue = translate_instrs st.ctx queue (source_location st.ctx pc) block.body in let body = seq @ match block.branch with | Code.Pushtrap ((pc1, args1), x, (pc2, args2), pc3s) -> (* FIX: document this *) let pc2s = resolve_nodes interm (dominance_frontier st pc2) in let pc3s = Addr.Set.fold (fun pc3 acc -> (* We need to make sure that pc3 is live (indeed, the continuation may have been optimized away by inlining) *) if Hashtbl.mem st.succs pc3 then (* no need to limit body for simple flow with no instruction. eg return and branch *) let rec limit pc = if Addr.Set.mem pc pc2s then false else let block = Addr.Map.find pc st.blocks in (not (List.is_empty block.body)) || match block.branch with | Return _ -> false | Poptrap ((pc', _), _) | Branch (pc', _) -> limit pc' | _ -> true in if limit pc3 then Addr.Set.add pc3 acc else acc else acc) pc3s Addr.Set.empty in let grey = Addr.Set.union pc2s pc3s in Addr.Set.iter (incr_preds st) grey; let grey', new_interm = colapse_frontier st grey interm in assert (Addr.Set.cardinal grey' <= 1); let inner_frontier = Addr.Set.union new_frontier grey' in if debug () then Format.eprintf "@[<2>try {@,"; let body = compile_branch st [] (pc1, args1) None Addr.Set.empty inner_frontier new_interm in if debug () then Format.eprintf "} catch {@,"; let x = let block2 = Addr.Map.find pc2 st.blocks in let m = Subst.build_mapping args2 block2.params in try Var.Map.find x m with Not_found -> x in let handler = compile_block st [] pc2 inner_frontier new_interm in if debug () then Format.eprintf "}@]@ "; Addr.Set.iter (decr_preds st) grey; let after, exn_escape = if not (Addr.Set.is_empty grey') then let pc = Addr.Set.choose grey' in let exn_escape = let x' = Var.fork x in let found = ref false in let map_var y = if Code.Var.equal x y then ( found := true; x') else y in let subst_block pc blocks = Addr.Map.add pc (Subst.block map_var (Addr.Map.find pc blocks)) blocks in let blocks = Code.traverse Code.fold_children subst_block pc st.blocks st.blocks in if !found then st.blocks <- blocks; if !found then Some x' else None in if Addr.Set.mem pc frontier then [], exn_escape else compile_block st [] pc frontier interm, exn_escape else [], None in let handler = if st.ctx.Ctx.live.(Var.idx x) > 0 && Config.Flag.excwrap () then ( J.Expression_statement (J.EBin ( J.Eq , J.EVar (J.V x) , J.ECall ( Share.get_prim (runtime_fun st.ctx) "caml_wrap_exception" st.ctx.Ctx.share , [ J.EVar (J.V x) ] , J.N ) )) , J.N ) :: handler else handler in let handler = match exn_escape with | Some x' -> handler @ [ J.Variable_statement [ J.V x', Some (EVar (J.V x), J.N) ], J.N ] | None -> handler in flush_all queue (( J.Try_statement (body, Some (J.V x, handler), None) , source_location st.ctx pc ) :: after) | _ -> let new_frontier, new_interm = colapse_frontier st new_frontier interm in assert (Addr.Set.cardinal new_frontier <= 1); (* Beware evaluation order! *) let cond = compile_conditional st queue pc block.branch block.handler backs new_frontier new_interm succs in cond @ if Addr.Set.cardinal new_frontier = 0 then [] else let pc = Addr.Set.choose new_frontier in if Addr.Set.mem pc frontier then [] else compile_block st [] pc frontier interm in if Addr.Set.mem pc st.loops then let label = match st.loop_stack with | (_, (l, used)) :: r -> st.loop_stack <- r; if !used then Some l else None | [] -> assert false in let st = ( J.For_statement ( J.Left None , None , None , ( J.Block (if Addr.Set.cardinal frontier > 0 then ( if debug () then Format.eprintf "@ break (%d); }@]" (Addr.Set.choose new_frontier); body @ [ J.Break_statement None, J.N ]) else ( if debug () then Format.eprintf "}@]"; body)) , J.N ) ) , source_location st.ctx pc ) in match label with | None -> [ st ] | Some label -> [ J.Labelled_statement (label, st), J.N ] else body) and colapse_frontier st new_frontier interm = if Addr.Set.cardinal new_frontier > 1 then ( if debug () then Format.eprintf "colapse frontier into %d: %s@." st.interm_idx (string_of_set new_frontier); let x = Code.Var.fresh_n "switch" in let a = Array.of_list (Addr.Set.elements new_frontier) in if debug () then Format.eprintf "@ var %a;" Code.Var.print x; let idx = st.interm_idx in st.interm_idx <- idx - 1; let cases = Array.map a ~f:(fun pc -> pc, []) in let switch = if Array.length cases > 2 then Code.Switch (x, cases, [||]) else Code.Cond (IsTrue, x, cases.(1), cases.(0)) in st.blocks <- Addr.Map.add idx { params = []; handler = None; body = []; branch = switch } st.blocks; (* There is a branch from this switch to the members of the frontier. *) Addr.Set.iter (fun pc -> incr_preds st pc) new_frontier; (* Put a limit: we are going to remove other branches to the members of the frontier (in compile_conditional), but they should remain in the frontier. *) Addr.Set.iter (fun pc -> protect_preds st pc) new_frontier; Hashtbl.add st.succs idx (Addr.Set.elements new_frontier); Hashtbl.add st.all_succs idx new_frontier; Hashtbl.add st.backs idx Addr.Set.empty; ( Addr.Set.singleton idx , Array.fold_right (Array.mapi ~f:(fun i pc -> pc, i) a) ~init:interm ~f:(fun (pc, i) interm -> Addr.Map.add pc (idx, (x, i)) interm) )) else new_frontier, interm and compile_decision_tree st _queue handler backs frontier interm succs loc cx dtree = (* Some changes here may require corresponding changes in function [DTree.fold_cont] above. *) let rec loop cx = function | DTree.Empty -> assert false | DTree.Branch ((pc, _) as cont) -> (* Block of code that never continues (either returns, throws an exception or loops back) *) (* If not found in successors, this is a backward edge *) let never = let d = try List.assoc pc succs with Not_found -> Addr.Set.empty in (not (Addr.Set.mem pc frontier || Addr.Map.mem pc interm)) && Addr.Set.is_empty d in never, compile_branch st [] cont handler backs frontier interm | DTree.If (cond, cont1, cont2) -> let never1, iftrue = loop cx cont1 in let never2, iffalse = loop cx cont2 in let e' = match cond with | IsTrue -> cx | CEq n -> J.EBin (J.EqEqEq, int32 n, cx) | CLt n -> J.EBin (J.Lt, int32 n, cx) | CUlt n -> let n' = if Int32.(n < 0l) then unsigned (int32 n) else int32 n in J.EBin (J.Lt, n', unsigned cx) | CLe n -> J.EBin (J.Le, int32 n, cx) in ( never1 && never2 , Js_simpl.if_statement e' loc (J.Block iftrue, J.N) never1 (J.Block iffalse, J.N) never2 ) | DTree.Switch a -> let all_never = ref true in let len = Array.length a in let last_index = len - 1 in let arr = Array.mapi a ~f:(fun i (ints, cont) -> let never, cont = loop cx cont in if not never then all_never := false; let cont = if never || (* default case *) i = last_index then cont else cont @ [ J.Break_statement None, J.N ] in ints, cont) in let _, last = arr.(last_index) in let l = Array.to_list (Array.sub arr ~pos:0 ~len:(len - 1)) in let l = List.flatten (List.map l ~f:(fun (ints, br) -> map_last (fun last i -> int i, if last then br else []) ints)) in !all_never, [ J.Switch_statement (cx, l, Some last, []), loc ] in let cx, binds = match cx with | (J.EVar _ | _) when DTree.nbcomp dtree <= 1 -> cx, [] | _ -> let v = J.V (Code.Var.fresh ()) in J.EVar v, [ J.Variable_statement [ v, Some (cx, J.N) ], J.N ] in binds @ snd (loop cx dtree) and compile_conditional st queue pc last handler backs frontier interm succs = List.iter succs ~f:(fun (pc, _) -> if Addr.Map.mem pc interm then decr_preds st pc); (if debug () then match last with | Branch _ | Poptrap _ | Pushtrap _ -> () | Return _ -> Format.eprintf "ret" | Raise _ -> Format.eprintf "raise" | Stop -> Format.eprintf "stop" | Cond _ -> Format.eprintf "@[cond{@," | Switch _ -> Format.eprintf "@[switch{@,"); let loc = source_location st.ctx pc in let res = match last with | Return x -> let (_px, cx), queue = access_queue queue x in flush_all queue [ J.Return_statement (Some cx), loc ] | Raise (x, k) -> let (_px, cx), queue = access_queue queue x in flush_all queue (throw_statement st.ctx cx k loc) | Stop -> flush_all queue [ J.Return_statement None, loc ] | Branch cont -> compile_branch st queue cont handler backs frontier interm | Pushtrap _ -> assert false | Poptrap (cont, _) -> flush_all queue (compile_branch st [] cont None backs frontier interm) | Cond (cond, x, c1, c2) -> let (_px, cx), queue = access_queue queue x in let b = compile_decision_tree st queue handler backs frontier interm succs loc cx (DTree.build_if cond c1 c2) in flush_all queue b | Switch (x, [||], a2) -> let (_px, cx), queue = access_queue queue x in let code = compile_decision_tree st queue handler backs frontier interm succs loc (Mlvalue.Block.tag cx) (DTree.build_switch a2) in flush_all queue code | Switch (x, a1, [||]) -> let (_px, cx), queue = access_queue queue x in let code = compile_decision_tree st queue handler backs frontier interm succs loc cx (DTree.build_switch a1) in flush_all queue code | Switch (x, a1, a2) -> (* The variable x is accessed several times, so we can directly refer to it *) (* We do not want to share the string "number". See comment for IsInt *) let b1 = compile_decision_tree st queue handler backs frontier interm succs loc (var x) (DTree.build_switch a1) in let b2 = compile_decision_tree st queue handler backs frontier interm succs loc (Mlvalue.Block.tag (var x)) (DTree.build_switch a2) in let code = Js_simpl.if_statement (Mlvalue.is_immediate (var x)) loc (Js_simpl.block b1) false (Js_simpl.block b2) false in flush_all queue code in (if debug () then match last with | Branch _ | Poptrap _ | Pushtrap _ | Return _ | Raise _ | Stop -> () | Switch _ | Cond _ -> Format.eprintf "}@]@ "); res and compile_argument_passing ctx queue (pc, args) _backs continuation = if List.is_empty args then continuation queue else let block = Addr.Map.find pc ctx.Ctx.blocks in parallel_renaming block.params args continuation queue and compile_exn_handling ctx queue (pc, args) handler continuation = if pc < 0 then continuation queue else let block = Addr.Map.find pc ctx.Ctx.blocks in match block.handler with | None -> continuation queue | Some (x0, (h_pc, h_args)) -> let old_args = match handler with | Some (y, (old_pc, old_args)) -> assert ( Var.compare x0 y = 0 && old_pc = h_pc && List.length old_args = List.length h_args); old_args | None -> [] in (* When an extra block is inserted during code generation, args is [] *) let m = Subst.build_mapping (if List.is_empty args then [] else block.params) args in let h_block = Addr.Map.find h_pc ctx.Ctx.blocks in let rec loop continuation old args params queue = match args, params with | [], [] -> continuation queue | x :: args, y :: params -> let z, old = match old with | [] -> None, [] | z :: old -> Some z, old in let x' = try Some (Var.Map.find x m) with Not_found -> Some x in if Var.compare x x0 = 0 || Option.equal Var.equal x' z then loop continuation old args params queue else let (px, cx), queue = access_queue queue x in let st, queue = (*FIX: we should flush only the variables we need rather than doing this; do the same for closure free variables *) match 2 (*ctx.Ctx.live.(Var.idx y)*) with | 0 -> assert false | 1 -> enqueue queue px y cx (source_location ctx pc) 1 [] | _ -> flush_queue queue px [ (let loc = source_location ctx pc in J.Variable_statement [ J.V y, Some (cx, loc) ], loc) ] in st @ loop continuation old args params queue | _ -> assert false in loop continuation old_args h_args h_block.params queue and compile_branch st queue ((pc, _) as cont) handler backs frontier interm = compile_argument_passing st.ctx queue cont backs (fun queue -> compile_exn_handling st.ctx queue cont handler (fun queue -> if Addr.Set.mem pc backs then ( let label = match st.loop_stack with | [] -> assert false | (pc', _) :: rem -> if pc = pc' then None else let lab, used = List.assoc pc rem in used := true; Some lab in if debug () then if Option.is_none label then Format.eprintf "continue;@ " else Format.eprintf "continue (%d);@ " pc; flush_all queue [ J.Continue_statement label, J.N ]) else if Addr.Set.mem pc frontier || Addr.Map.mem pc interm then ( if debug () then Format.eprintf "(br %d)@ " pc; flush_all queue (compile_branch_selection pc interm)) else compile_block st queue pc frontier interm)) and compile_branch_selection pc interm = try let pc, (x, i) = Addr.Map.find pc interm in if debug () then Format.eprintf "@ %a=%d;" Code.Var.print x i; (J.Variable_statement [ J.V x, Some (int i, J.N) ], J.N) :: compile_branch_selection pc interm with Not_found -> [] and compile_closure ctx at_toplevel (pc, args) = let st = { visited_blocks = Addr.Set.empty ; loops = Addr.Set.empty ; loop_stack = [] ; all_succs = Hashtbl.create 17 ; succs = Hashtbl.create 17 ; backs = Hashtbl.create 17 ; preds = Hashtbl.create 17 ; interm_idx = -1 ; ctx ; blocks = ctx.Ctx.blocks ; at_toplevel } in build_graph st pc Addr.Set.empty; let current_blocks = st.visited_blocks in st.visited_blocks <- Addr.Set.empty; if debug () then Format.eprintf "@[closure{@,"; let res = compile_branch st [] (pc, args) None Addr.Set.empty Addr.Set.empty Addr.Map.empty in if Addr.Set.cardinal st.visited_blocks <> Addr.Set.cardinal current_blocks then ( let missing = Addr.Set.diff current_blocks st.visited_blocks in Format.eprintf "Some blocks not compiled %s!@." (string_of_set missing); assert false); if debug () then Format.eprintf "}@]@ "; List.map res ~f:(fun (st, loc) -> J.Statement st, loc) let generate_shared_value ctx = let strings = ( J.Statement (J.Variable_statement ((match ctx.Ctx.exported_runtime with | None -> [] | Some v -> [ J.V v, Some (J.EDot (s_var Constant.global_object, "jsoo_runtime"), J.N) ]) @ List.map (StringMap.bindings ctx.Ctx.share.Share.vars.Share.strings) ~f:(fun (s, v) -> v, Some (str_js s, J.N)) @ List.map (StringMap.bindings ctx.Ctx.share.Share.vars.Share.prims) ~f:(fun (s, v) -> v, Some (runtime_fun ctx s, J.N)))) , J.U ) in if not (Config.Flag.inline_callgen ()) then let applies = List.map (IntMap.bindings ctx.Ctx.share.Share.vars.Share.applies) ~f:(fun (n, v) -> match generate_apply_fun ctx n with | J.EFun (_, param, body, nid) -> J.Function_declaration (v, param, body, nid), J.U | _ -> assert false) in strings :: applies else [ strings ] let compile_program ctx pc = let res = compile_closure ctx true (pc, []) in let res = generate_shared_value ctx @ res in if debug () then Format.eprintf "@.@."; res let f ((pc, blocks, _) as p) ~exported_runtime live_vars debug = let t' = Timer.make () in let share = Share.get ~alias_prims:exported_runtime p in let exported_runtime = if exported_runtime then Some (Code.Var.fresh_n "runtime") else None in let ctx = Ctx.initial ~exported_runtime blocks live_vars share debug in let p = compile_program ctx pc in if times () then Format.eprintf " code gen.: %a@." Timer.print t'; p js_of_ocaml-3.5.2/compiler/lib/generate.mli000066400000000000000000000020241357507750000206600ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Code.program -> exported_runtime:bool -> int array -> Parse_bytecode.Debug.t -> Javascript.program js_of_ocaml-3.5.2/compiler/lib/generate_closure.ml000066400000000000000000000353731357507750000222600ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Code let debug_tc = Debug.find "gen_tc" type closure_info = { f_name : Code.Var.t ; args : Code.Var.t list ; cont : Code.cont ; tc : Code.Addr.Set.t Code.Var.Map.t } type 'a int_ext = { int : 'a ; ext : 'a } module SCC = Strongly_connected_components.Make (Var) let add_multi k v map = let set = try Var.Map.find k map with Not_found -> Addr.Set.empty in Var.Map.add k (Addr.Set.add v set) map let rec tailcall pc blocks visited tc = if Addr.Set.mem pc visited then visited, tc else let visited = Addr.Set.add pc visited in let block = Addr.Map.find pc blocks in let tc_opt = match block.branch with | Return x -> ( match List.last block.body with | Some (Let (y, Apply (z, _, true))) when Code.Var.compare x y = 0 -> Some (add_multi z pc tc) | None -> None | Some _ -> None) | _ -> None in match tc_opt with | Some tc -> visited, tc | None -> Code.fold_children blocks pc (fun pc (visited, tc) -> tailcall pc blocks visited tc) (visited, tc) let rec collect_closures blocks l = match l with | Let (f_name, Closure (args, ((pc, _) as cont))) :: rem -> let tc = snd (tailcall pc blocks Addr.Set.empty Var.Map.empty) in let l, rem = collect_closures blocks rem in { f_name; args; cont; tc } :: l, rem | rem -> [], rem let group_closures closures = let names = List.fold_left closures ~init:Var.Set.empty ~f:(fun names x -> Var.Set.add x.f_name names) in let closures_map = List.fold_left closures ~init:Var.Map.empty ~f:(fun closures_map x -> Var.Map.add x.f_name x closures_map) in let graph = List.fold_left closures ~init:Var.Map.empty ~f:(fun graph x -> let tc = Var.Map.fold (fun x _ tc -> Var.Set.add x tc) x.tc Var.Set.empty in let tc = Var.Set.inter names tc in Var.Map.add x.f_name tc graph) in closures_map, SCC.connected_components_sorted_from_roots_to_leaf graph module Trampoline = struct let direct_call_block block ~counter ~x ~f ~args = let counter_plus_1 = Code.Var.fork counter in let return = Code.Var.fork x in { block with params = [] ; body = [ Let (counter_plus_1, Prim (Extern "%int_add", [ Pv counter; Pc (Int 1l) ])) ; Let (return, Apply (f, counter_plus_1 :: args, true)) ] ; branch = Return return } let bounce_call_block block ~x ~f ~args = let return = Code.Var.fork x in let new_args = Code.Var.fresh () in { block with params = [] ; body = [ Let ( new_args , Prim (Extern "%js_array", Pc (Int 0l) :: List.map args ~f:(fun x -> Pv x)) ) ; Let (return, Prim (Extern "caml_trampoline_return", [ Pv f; Pv new_args ])) ] ; branch = Return return } let wrapper_block f ~args ~counter = let result1 = Code.Var.fresh () in let result2 = Code.Var.fresh () in let block = { params = [] ; handler = None ; body = [ Let (counter, Constant (Int 0l)) ; Let (result1, Apply (f, counter :: args, true)) ; Let (result2, Prim (Extern "caml_trampoline", [ Pv result1 ])) ] ; branch = Return result2 } in block let wrapper_closure pc args = Closure (args, (pc, [])) let f free_pc blocks closures_map component = match component with | SCC.No_loop id -> let ci = Var.Map.find id closures_map in let instr = Let (ci.f_name, Closure (ci.args, ci.cont)) in free_pc, blocks, { int = []; ext = [ instr ] } | SCC.Has_loop all -> if debug_tc () then ( Format.eprintf "Detect cycles of size (%d).\n%!" (List.length all); Format.eprintf "%s\n%!" (String.concat ~sep:", " (List.map all ~f:(fun x -> Var.to_string x)))); let all = List.map all ~f:(fun id -> Code.Var.fresh_n "counter", Var.Map.find id closures_map) in let blocks, free_pc, instrs, instrs_wrapper = List.fold_left all ~init:(blocks, free_pc, [], []) ~f:(fun (blocks, free_pc, instrs, instrs_wrapper) (counter, ci) -> if debug_tc () then Format.eprintf "Rewriting for %s\n%!" (Var.to_string ci.f_name); let new_f = Code.Var.fork ci.f_name in let new_args = List.map ci.args ~f:Code.Var.fork in let wrapper_pc = free_pc in let free_pc = free_pc + 1 in let new_counter = Code.Var.fork counter in let wrapper_block = wrapper_block new_f ~args:new_args ~counter:new_counter in let blocks = Addr.Map.add wrapper_pc wrapper_block blocks in let instr_wrapper = Let (ci.f_name, wrapper_closure wrapper_pc new_args) in let instr_real = Let (new_f, Closure (counter :: ci.args, ci.cont)) in let counter_and_pc = List.fold_left all ~init:[] ~f:(fun acc (counter, ci2) -> try let pcs = Addr.Set.elements (Var.Map.find ci.f_name ci2.tc) in List.map pcs ~f:(fun x -> counter, x) @ acc with Not_found -> acc) in let blocks, free_pc = List.fold_left counter_and_pc ~init:(blocks, free_pc) ~f:(fun (blocks, free_pc) (counter, pc) -> if debug_tc () then Format.eprintf "Rewriting tc in %d\n%!" pc; let block = Addr.Map.find pc blocks in let direct_call_pc = free_pc in let bounce_call_pc = free_pc + 1 in let free_pc = free_pc + 2 in match List.rev block.body with | Let (x, Apply (f, args, true)) :: rem_rev -> assert (Var.equal f ci.f_name); let blocks = Addr.Map.add direct_call_pc (direct_call_block block ~counter ~x ~f:new_f ~args) blocks in let blocks = Addr.Map.add bounce_call_pc (bounce_call_block block ~x ~f:new_f ~args) blocks in let direct = Code.Var.fresh () in let branch = Cond (IsTrue, direct, (direct_call_pc, []), (bounce_call_pc, [])) in let last = Let ( direct , Prim ( Lt , [ Pv counter ; Pc (Int (Int32.of_int (Config.Param.tailcall_max_depth ()))) ] ) ) in let block = { block with body = List.rev (last :: rem_rev); branch } in let blocks = Addr.Map.remove pc blocks in Addr.Map.add pc block blocks, free_pc | _ -> assert false) in blocks, free_pc, instr_real :: instrs, instr_wrapper :: instrs_wrapper) in free_pc, blocks, { int = instrs; ext = instrs_wrapper } end module Ident = struct let f free_pc blocks closures_map component = match component with | SCC.No_loop id -> let ci = Var.Map.find id closures_map in let instr = Let (ci.f_name, Closure (ci.args, ci.cont)) in free_pc, blocks, { int = []; ext = [ instr ] } | SCC.Has_loop ids -> let instrs = List.map ids ~f:(fun id -> let ci = Var.Map.find id closures_map in let instr = Let (ci.f_name, Closure (ci.args, ci.cont)) in instr) in free_pc, blocks, { int = []; ext = instrs } end let rewrite_tc free_pc blocks closures_map component = let open Config.Param in match tailcall_optim () with | TcNone -> Ident.f free_pc blocks closures_map component | TcTrampoline -> Trampoline.f free_pc blocks closures_map component let rewrite_mutable free_pc blocks mutated_vars rewrite_list { int = closures_intern; ext = closures_extern } = let internal_and_external = closures_intern @ closures_extern in assert (not (List.is_empty closures_extern)); let all_mut, names = List.fold_left internal_and_external ~init:(Var.Set.empty, Var.Set.empty) ~f:(fun (all_mut, names) i -> match i with | Let (x, Closure (_, (pc, _))) -> let all_mut = try Var.Set.union all_mut (Addr.Map.find pc mutated_vars) with Not_found -> all_mut in let names = Var.Set.add x names in all_mut, names | _ -> assert false) in let vars = Var.Set.elements (Var.Set.diff all_mut names) in if List.is_empty vars then free_pc, blocks, internal_and_external else match internal_and_external with | [ Let (x, Closure (params, (pc, pc_args))) ] -> let new_pc = free_pc in let free_pc = free_pc + 1 in let closure = Code.Var.fork x in let args = List.map vars ~f:Code.Var.fork in let new_x = Code.Var.fork x in let mapping = Subst.from_map (Subst.build_mapping (x :: vars) (new_x :: args)) in rewrite_list := (mapping, pc) :: !rewrite_list; let new_block = { params = [] ; handler = None ; body = [ Let (new_x, Closure (params, (pc, List.map pc_args ~f:mapping))) ] ; branch = Return new_x } in let blocks = Addr.Map.add new_pc new_block blocks in let body = [ Let (closure, Closure (args, (new_pc, []))) ; Let (x, Apply (closure, vars, true)) ] in free_pc, blocks, body | _ -> let new_pc = free_pc in let free_pc = free_pc + 1 in let closure = Code.Var.fresh_n "closures" in let closure' = Code.Var.fresh_n "closures" in let b = Code.Var.fresh_n "block" in let args = List.map vars ~f:Code.Var.fork in let pcs = List.map internal_and_external ~f:(function | Let (_, Closure (_, (pc, _))) -> pc | _ -> assert false) in let old_xs = List.map closures_extern ~f:(function | Let (x, Closure _) -> x | _ -> assert false) in let new_xs = List.map old_xs ~f:Code.Var.fork in let mapping = Subst.from_map (Subst.build_mapping (old_xs @ vars) (new_xs @ args)) in rewrite_list := List.map pcs ~f:(fun pc -> mapping, pc) @ !rewrite_list; let new_block = let proj = List.map2 closures_extern new_xs ~f:(fun cl new_x -> match cl with | Let (_, Closure (params, (pc, pc_args))) -> Let (new_x, Closure (params, (pc, List.map pc_args ~f:mapping))) | _ -> assert false) in { params = [] ; handler = None ; body = closures_intern @ proj @ [ Let (b, Block (0, Array.of_list new_xs, NotArray)) ] ; branch = Return b } in let blocks = Addr.Map.add new_pc new_block blocks in let body = [ Let (closure, Closure (args, (new_pc, []))) ; Let (closure', Apply (closure, vars, true)) ] @ List.mapi closures_extern ~f:(fun i x -> match x with | Let (x, Closure _) -> Let (x, Field (closure', i)) | _ -> assert false) in free_pc, blocks, body let rec rewrite_closures mutated_vars rewrite_list free_pc blocks body : int * _ * _ list = match body with | Let (_, Closure _) :: _ -> let closures, rem = collect_closures blocks body in let closures_map, components = group_closures closures in let free_pc, blocks, closures = List.fold_left (Array.to_list components) ~init:(free_pc, blocks, []) ~f:(fun (free_pc, blocks, acc) component -> let free_pc, blocks, closures = rewrite_tc free_pc blocks closures_map component in let free_pc, blocks, intrs = rewrite_mutable free_pc blocks mutated_vars rewrite_list closures in free_pc, blocks, intrs :: acc) in let free_pc, blocks, rem = rewrite_closures mutated_vars rewrite_list free_pc blocks rem in free_pc, blocks, List.flatten closures @ rem | i :: rem -> let free_pc, blocks, rem = rewrite_closures mutated_vars rewrite_list free_pc blocks rem in free_pc, blocks, i :: rem | [] -> free_pc, blocks, [] let f ((pc, blocks, free_pc) as p) : Code.program = Code.invariant p; let mutated_vars = Freevars.f p in let rewrite_list = ref [] in let blocks, free_pc = Addr.Map.fold (fun pc _ (blocks, free_pc) -> (* make sure we have the latest version *) let block = Addr.Map.find pc blocks in let free_pc, blocks, body = rewrite_closures mutated_vars rewrite_list free_pc blocks block.body in Addr.Map.add pc { block with body } blocks, free_pc) blocks (blocks, free_pc) in (* Code.invariant (pc, blocks, free_pc); *) let p = List.fold_left !rewrite_list ~init:(pc, blocks, free_pc) ~f:(fun program (mapping, pc) -> Subst.cont mapping pc program) in Code.invariant p; p js_of_ocaml-3.5.2/compiler/lib/generate_closure.mli000066400000000000000000000017021357507750000224160ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Code val f : program -> program js_of_ocaml-3.5.2/compiler/lib/inline.ml000066400000000000000000000253001357507750000201750ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Code let optimizable blocks pc _ = Code.traverse Code.fold_children (fun pc acc -> if not acc then acc else let b = Addr.Map.find pc blocks in match b with | { handler = Some _; _ } | { branch = Pushtrap _; _ } | { branch = Poptrap _; _ } -> false | _ -> List.for_all b.body ~f:(function | Let (_, Prim (Extern "caml_js_eval_string", _)) -> false | Let (_, Prim (Extern "debugger", _)) -> false | Let ( _ , Prim (Extern ("caml_js_var" | "caml_js_expr" | "caml_pure_js_expr"), _) ) -> (* TODO: we should smarter here and look the generated js *) (* let's consider it this opmiziable *) true | _ -> true)) pc blocks true let rec follow_branch_rec seen blocks = function | (pc, []) as k -> ( let seen = Addr.Set.add pc seen in try match Addr.Map.find pc blocks with | { body = []; branch = Branch (pc, []); _ } when not (Addr.Set.mem pc seen) -> follow_branch_rec seen blocks (pc, []) | _ -> k with Not_found -> k) | k -> k let follow_branch = follow_branch_rec Addr.Set.empty let get_closures (_, blocks, _) = Addr.Map.fold (fun _ block closures -> List.fold_left block.body ~init:closures ~f:(fun closures i -> match i with | Let (x, Closure (l, cont)) -> let cont = follow_branch blocks cont in (* we can compute this once during the pass as the property won't change with inlining *) let f_optimizable = optimizable blocks (fst cont) true in Var.Map.add x (l, cont, f_optimizable) closures | _ -> closures)) blocks Var.Map.empty (****) let rewrite_block (pc', handler) pc blocks = let block = Addr.Map.find pc blocks in assert (Option.is_none block.handler); let block = { block with handler } in let block = match block.branch, pc' with | Return y, Some pc' -> { block with branch = Branch (pc', [ y ]) } | _ -> block in Addr.Map.add pc block blocks let ( >> ) x f = f x (* Skip try body *) let fold_children blocks pc f accu = let block = Addr.Map.find pc blocks in match block.branch with | Return _ | Raise _ | Stop -> accu | Branch (pc', _) | Poptrap ((pc', _), _) -> f pc' accu | Pushtrap (_, _, (pc1, _), pcs) -> f pc1 (Addr.Set.fold f pcs accu) | Cond (_, _, (pc1, _), (pc2, _)) -> accu >> f pc1 >> f pc2 | Switch (_, a1, a2) -> let accu = Array.fold_right a1 ~init:accu ~f:(fun (pc, _) accu -> f pc accu) in let accu = Array.fold_right a2 ~init:accu ~f:(fun (pc, _) accu -> f pc accu) in accu let rewrite_closure blocks cont_pc clos_pc handler = Code.traverse fold_children (rewrite_block (cont_pc, handler)) clos_pc blocks blocks (****) (* get new location put continuation at new location update closure body to return to this location make current block continuation jump to closure body *) let rec find_mapping mapping x = match mapping with | [] -> x | ([], []) :: rest -> find_mapping rest x | (a :: _, b :: _) :: rest when Code.Var.compare a x = 0 -> find_mapping rest b | (_ :: ax, _ :: bx) :: rest -> find_mapping ((ax, bx) :: rest) x | ([], _ | _, []) :: _ -> assert false let simple blocks cont mapping = let map_var mapping x = let x' = find_mapping mapping x in if Var.equal x x' then raise Not_found else x' in let map_prim_arg mapping = function | Pc c -> Pc c | Pv x -> Pv (map_var mapping x) in let rec follow (pc, args) (instr : [ `Empty | `Ok of 'a ]) mapping = let b = Addr.Map.find pc blocks in let mapping = (b.params, args) :: mapping in let instr : [ `Empty | `Ok of 'a | `Fail ] = match b.body, instr with | [], _ -> (instr :> [ `Empty | `Ok of 'a | `Fail ]) | [ Let (y, exp) ], `Empty -> `Ok (y, exp) | _, _ -> `Fail in match instr, b.branch with | `Fail, _ -> `Fail | `Empty, Return ret -> `Alias (map_var mapping ret) | `Ok (x, exp), Return ret when Code.Var.compare x (find_mapping mapping ret) = 0 -> ( match exp with | Const _ -> `Exp exp | Constant (Float _ | Int64 _ | Int _ | IString _) -> `Exp exp | Apply (f, args, true) -> `Exp (Apply (map_var mapping f, List.map args ~f:(map_var mapping), true)) | Prim (prim, args) -> `Exp (Prim (prim, List.map args ~f:(map_prim_arg mapping))) | Block (tag, args, aon) -> `Exp (Block (tag, Array.map args ~f:(map_var mapping), aon)) | Field (x, i) -> `Exp (Field (map_var mapping x, i)) | Closure _ -> `Fail | Constant _ -> `Fail | Apply _ -> `Fail) | ((`Empty | `Ok _) as instr), Branch cont -> follow cont instr mapping | (`Empty | `Ok _), _ -> `Fail in try follow cont `Empty mapping with Not_found -> `Fail let rec args_equal xs ys = match xs, ys with | [], [] -> true | x :: xs, Pv y :: ys -> Code.Var.compare x y = 0 && args_equal xs ys | _ -> false let inline closures live_vars outer_optimizable pc (blocks, free_pc) = let block = Addr.Map.find pc blocks in let body, (branch, blocks, free_pc) = List.fold_right block.body ~init:([], (block.branch, blocks, free_pc)) ~f:(fun i (rem, state) -> match i with | Let (x, Apply (f, args, true)) when Var.Map.mem f closures -> ( let branch, blocks, free_pc = state in let params, clos_cont, f_optimizable = Var.Map.find f closures in match simple blocks clos_cont [ params, args ] with | `Alias arg -> ( match rem, branch with | [], Return y when Var.compare x y = 0 -> [], (Return arg, blocks, free_pc) | _ -> let blocks = Addr.Map.add free_pc { params = [ x ]; handler = block.handler; body = rem; branch } blocks in [], (Branch (free_pc, [ arg ]), blocks, free_pc + 1)) | `Exp exp -> Let (x, exp) :: rem, state | `Fail -> if live_vars.(Var.idx f) = 1 && Bool.equal outer_optimizable f_optimizable (* inlining the code of an optimizable function could make this code unoptimized. (wrt to Jit compilers) At the moment, V8 doesn't optimize function containing try..catch. We disable inlining if the inner and outer functions don't have the same "contain_try_catch" property *) then let blocks, cont_pc = match rem, branch with | [], Return y when Var.compare x y = 0 -> (* We do not need a continuation block for tail calls *) blocks, None | _ -> ( Addr.Map.add free_pc { params = [ x ] ; handler = block.handler ; body = rem ; branch } blocks , Some free_pc ) in let blocks = rewrite_closure blocks cont_pc (fst clos_cont) block.handler in (* We do not really need this intermediate block. It just avoid the need to find which function parameters are used in the function body. *) let blocks = Addr.Map.add (free_pc + 1) { params ; handler = block.handler ; body = [] ; branch = Branch clos_cont } blocks in [], (Branch (free_pc + 1, args), blocks, free_pc + 2) else (* Format.eprintf "Do not inline because inner:%b outer:%b@." f_has_handler outer_has_handler; *) i :: rem, state) | Let (x, Closure (l, (pc, []))) -> ( let block = Addr.Map.find pc blocks in match block with | { body = [ Let (y, Prim (Extern prim, args)) ] ; branch = Return y' ; handler = None ; params = [] } -> let len = List.length l in if Code.Var.compare y y' = 0 && Primitive.has_arity prim len && args_equal l args then Let (x, Prim (Extern "%closure", [ Pc (IString prim) ])) :: rem, state else i :: rem, state | _ -> i :: rem, state) | _ -> i :: rem, state) in Addr.Map.add pc { block with body; branch } blocks, free_pc (****) let times = Debug.find "times" let f ((pc, blocks, free_pc) as p) live_vars = Code.invariant p; let t = Timer.make () in let closures = get_closures p in let blocks, free_pc = Code.fold_closures p (fun name _ (pc, _) (blocks, free_pc) -> let outer_optimizable = match name with | None -> optimizable blocks pc true | Some x -> let _, _, b = Var.Map.find x closures in b in Code.traverse Code.fold_children (inline closures live_vars outer_optimizable) pc blocks (blocks, free_pc)) (blocks, free_pc) in if times () then Format.eprintf " inlining: %a@." Timer.print t; let p = pc, blocks, free_pc in Code.invariant p; p js_of_ocaml-3.5.2/compiler/lib/inline.mli000066400000000000000000000017161357507750000203530ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Code.program -> int array -> Code.program js_of_ocaml-3.5.2/compiler/lib/instr.ml000066400000000000000000000236241357507750000200650ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type t = | ACC0 | ACC1 | ACC2 | ACC3 | ACC4 | ACC5 | ACC6 | ACC7 | ACC | PUSH | PUSHACC0 | PUSHACC1 | PUSHACC2 | PUSHACC3 | PUSHACC4 | PUSHACC5 | PUSHACC6 | PUSHACC7 | PUSHACC | POP | ASSIGN | ENVACC1 | ENVACC2 | ENVACC3 | ENVACC4 | ENVACC | PUSHENVACC1 | PUSHENVACC2 | PUSHENVACC3 | PUSHENVACC4 | PUSHENVACC | PUSH_RETADDR | APPLY | APPLY1 | APPLY2 | APPLY3 | APPTERM | APPTERM1 | APPTERM2 | APPTERM3 | RETURN | RESTART | GRAB | CLOSURE | CLOSUREREC | OFFSETCLOSUREM2 | OFFSETCLOSURE0 | OFFSETCLOSURE2 | OFFSETCLOSURE | PUSHOFFSETCLOSUREM2 | PUSHOFFSETCLOSURE0 | PUSHOFFSETCLOSURE2 | PUSHOFFSETCLOSURE | GETGLOBAL | PUSHGETGLOBAL | GETGLOBALFIELD | PUSHGETGLOBALFIELD | SETGLOBAL | ATOM0 | ATOM | PUSHATOM0 | PUSHATOM | MAKEBLOCK | MAKEBLOCK1 | MAKEBLOCK2 | MAKEBLOCK3 | MAKEFLOATBLOCK | GETFIELD0 | GETFIELD1 | GETFIELD2 | GETFIELD3 | GETFIELD | GETFLOATFIELD | SETFIELD0 | SETFIELD1 | SETFIELD2 | SETFIELD3 | SETFIELD | SETFLOATFIELD | VECTLENGTH | GETVECTITEM | SETVECTITEM | GETBYTESCHAR | SETBYTESCHAR | BRANCH | BRANCHIF | BRANCHIFNOT | SWITCH | BOOLNOT | PUSHTRAP | POPTRAP | RAISE | CHECK_SIGNALS | C_CALL1 | C_CALL2 | C_CALL3 | C_CALL4 | C_CALL5 | C_CALLN | CONST0 | CONST1 | CONST2 | CONST3 | CONSTINT | PUSHCONST0 | PUSHCONST1 | PUSHCONST2 | PUSHCONST3 | PUSHCONSTINT | NEGINT | ADDINT | SUBINT | MULINT | DIVINT | MODINT | ANDINT | ORINT | XORINT | LSLINT | LSRINT | ASRINT | EQ | NEQ | LTINT | LEINT | GTINT | GEINT | OFFSETINT | OFFSETREF | ISINT | GETMETHOD | BEQ | BNEQ | BLTINT | BLEINT | BGTINT | BGEINT | ULTINT | UGEINT | BULTINT | BUGEINT | GETPUBMET | GETDYNMET | STOP | EVENT | BREAK | RERAISE | RAISE_NOTRACE | GETSTRINGCHAR | FIRST_UNIMPLEMENTED_OP type kind = | KNullary | KUnary | KBinary | KJump | KCond_jump | KCmp_jump | KSwitch | KClosurerec | KClosure | KNullaryCall | KUnaryCall | KBinaryCall | KStop of int | K_will_not_happen type desc = { code : t ; kind : kind ; name : string ; opcode : int } let ops = let if_v407 = match Ocaml_version.v with | `V4_02 | `V4_03 | `V4_04 | `V4_06 -> fun _ -> K_will_not_happen | `V4_07 | `V4_08 | `V4_09 | `V4_10 -> fun k -> k in let instrs = [| ACC0, KNullary, "ACC0" ; ACC1, KNullary, "ACC1" ; ACC2, KNullary, "ACC2" ; ACC3, KNullary, "ACC3" ; ACC4, KNullary, "ACC4" ; ACC5, KNullary, "ACC5" ; ACC6, KNullary, "ACC6" ; ACC7, KNullary, "ACC7" ; ACC, KUnary, "ACC" ; PUSH, KNullary, "PUSH" ; PUSHACC0, KNullary, "PUSHACC0" ; PUSHACC1, KNullary, "PUSHACC1" ; PUSHACC2, KNullary, "PUSHACC2" ; PUSHACC3, KNullary, "PUSHACC3" ; PUSHACC4, KNullary, "PUSHACC4" ; PUSHACC5, KNullary, "PUSHACC5" ; PUSHACC6, KNullary, "PUSHACC6" ; PUSHACC7, KNullary, "PUSHACC7" ; PUSHACC, KUnary, "PUSHACC" ; POP, KUnary, "POP" ; ASSIGN, KUnary, "ASSIGN" ; ENVACC1, KNullary, "ENVACC1" ; ENVACC2, KNullary, "ENVACC2" ; ENVACC3, KNullary, "ENVACC3" ; ENVACC4, KNullary, "ENVACC4" ; ENVACC, KUnary, "ENVACC" ; PUSHENVACC1, KNullary, "PUSHENVACC1" ; PUSHENVACC2, KNullary, "PUSHENVACC2" ; PUSHENVACC3, KNullary, "PUSHENVACC3" ; PUSHENVACC4, KNullary, "PUSHENVACC4" ; PUSHENVACC, KUnary, "PUSHENVACC" ; PUSH_RETADDR, KUnary, "PUSH_RETADDR" ; APPLY, KUnaryCall, "APPLY" ; APPLY1, KNullaryCall, "APPLY1" ; APPLY2, KNullaryCall, "APPLY2" ; APPLY3, KNullaryCall, "APPLY3" ; APPTERM, KStop 2, "APPTERM" ; APPTERM1, KStop 1, "APPTERM1" ; APPTERM2, KStop 1, "APPTERM2" ; APPTERM3, KStop 1, "APPTERM3" ; RETURN, KStop 1, "RETURN" ; RESTART, KNullary, "RESTART" ; GRAB, KUnary, "GRAB" ; CLOSURE, KClosure, "CLOSURE" ; CLOSUREREC, KClosurerec, "CLOSUREREC" ; OFFSETCLOSUREM2, KNullary, "OFFSETCLOSUREM2" ; OFFSETCLOSURE0, KNullary, "OFFSETCLOSURE0" ; OFFSETCLOSURE2, KNullary, "OFFSETCLOSURE2" ; OFFSETCLOSURE, KUnary, "OFFSETCLOSURE" ; PUSHOFFSETCLOSUREM2, KNullary, "PUSHOFFSETCLOSUREM2" ; PUSHOFFSETCLOSURE0, KNullary, "PUSHOFFSETCLOSURE0" ; PUSHOFFSETCLOSURE2, KNullary, "PUSHOFFSETCLOSURE2" ; PUSHOFFSETCLOSURE, KUnary, "PUSHOFFSETCLOSURE" ; GETGLOBAL, KUnary, "GETGLOBAL" ; PUSHGETGLOBAL, KUnary, "PUSHGETGLOBAL" ; GETGLOBALFIELD, KBinary, "GETGLOBALFIELD" ; PUSHGETGLOBALFIELD, KBinary, "PUSHGETGLOBALFIELD" ; SETGLOBAL, KUnary, "SETGLOBAL" ; ATOM0, KNullary, "ATOM0" ; ATOM, KUnary, "ATOM" ; PUSHATOM0, KNullary, "PUSHATOM0" ; PUSHATOM, KUnary, "PUSHATOM" ; MAKEBLOCK, KBinary, "MAKEBLOCK" ; MAKEBLOCK1, KUnary, "MAKEBLOCK1" ; MAKEBLOCK2, KUnary, "MAKEBLOCK2" ; MAKEBLOCK3, KUnary, "MAKEBLOCK3" ; MAKEFLOATBLOCK, KUnary, "MAKEFLOATBLOCK" ; GETFIELD0, KNullary, "GETFIELD0" ; GETFIELD1, KNullary, "GETFIELD1" ; GETFIELD2, KNullary, "GETFIELD2" ; GETFIELD3, KNullary, "GETFIELD3" ; GETFIELD, KUnary, "GETFIELD" ; GETFLOATFIELD, KUnary, "GETFLOATFIELD" ; SETFIELD0, KNullary, "SETFIELD0" ; SETFIELD1, KNullary, "SETFIELD1" ; SETFIELD2, KNullary, "SETFIELD2" ; SETFIELD3, KNullary, "SETFIELD3" ; SETFIELD, KUnary, "SETFIELD" ; SETFLOATFIELD, KUnary, "SETFLOATFIELD" ; VECTLENGTH, KNullary, "VECTLENGTH" ; GETVECTITEM, KNullary, "GETVECTITEM" ; SETVECTITEM, KNullary, "SETVECTITEM" ; GETBYTESCHAR, KNullary, "GETBYTESCHAR" ; SETBYTESCHAR, KNullary, "SETBYTESCHAR" ; BRANCH, KJump, "BRANCH" ; BRANCHIF, KCond_jump, "BRANCHIF" ; BRANCHIFNOT, KCond_jump, "BRANCHIFNOT" ; SWITCH, KSwitch, "SWITCH" ; BOOLNOT, KNullary, "BOOLNOT" ; PUSHTRAP, KCond_jump, "PUSHTRAP" ; POPTRAP, KNullary, "POPTRAP" ; RAISE, KStop 0, "RAISE" ; CHECK_SIGNALS, KNullary, "CHECK_SIGNALS" ; C_CALL1, KUnaryCall, "C_CALL1" ; C_CALL2, KUnaryCall, "C_CALL2" ; C_CALL3, KUnaryCall, "C_CALL3" ; C_CALL4, KUnaryCall, "C_CALL4" ; C_CALL5, KUnaryCall, "C_CALL5" ; C_CALLN, KBinaryCall, "C_CALLN" ; CONST0, KNullary, "CONST0" ; CONST1, KNullary, "CONST1" ; CONST2, KNullary, "CONST2" ; CONST3, KNullary, "CONST3" ; CONSTINT, KUnary, "CONSTINT" ; PUSHCONST0, KNullary, "PUSHCONST0" ; PUSHCONST1, KNullary, "PUSHCONST1" ; PUSHCONST2, KNullary, "PUSHCONST2" ; PUSHCONST3, KNullary, "PUSHCONST3" ; PUSHCONSTINT, KUnary, "PUSHCONSTINT" ; NEGINT, KNullary, "NEGINT" ; ADDINT, KNullary, "ADDINT" ; SUBINT, KNullary, "SUBINT" ; MULINT, KNullary, "MULINT" ; DIVINT, KNullary, "DIVINT" ; MODINT, KNullary, "MODINT" ; ANDINT, KNullary, "ANDINT" ; ORINT, KNullary, "ORINT" ; XORINT, KNullary, "XORINT" ; LSLINT, KNullary, "LSLINT" ; LSRINT, KNullary, "LSRINT" ; ASRINT, KNullary, "ASRINT" ; EQ, KNullary, "EQ" ; NEQ, KNullary, "NEQ" ; LTINT, KNullary, "LTINT" ; LEINT, KNullary, "LEINT" ; GTINT, KNullary, "GTINT" ; GEINT, KNullary, "GEINT" ; OFFSETINT, KUnary, "OFFSETINT" ; OFFSETREF, KUnary, "OFFSETREF" ; ISINT, KNullary, "ISINT" ; GETMETHOD, KNullary, "GETMETHOD" ; BEQ, KCmp_jump, "BEQ" ; BNEQ, KCmp_jump, "BNEQ" ; BLTINT, KCmp_jump, "BLTINT" ; BLEINT, KCmp_jump, "BLEINT" ; BGTINT, KCmp_jump, "BGTINT" ; BGEINT, KCmp_jump, "BGEINT" ; ULTINT, KNullary, "ULTINT" ; UGEINT, KNullary, "UGEINT" ; BULTINT, KCmp_jump, "BULTINT" ; BUGEINT, KCmp_jump, "BUGEINT" ; GETPUBMET, KBinary, "GETPUBMET" ; GETDYNMET, KNullary, "GETDYNMET" ; STOP, KStop 0, "STOP" ; EVENT, K_will_not_happen, "EVENT" ; BREAK, K_will_not_happen, "BREAK" ; RERAISE, KStop 0, "RERAISE" ; RAISE_NOTRACE, KStop 0, "RAISE_NOTRACE" ; GETSTRINGCHAR, if_v407 KNullary, "GETSTRINGCHAR" ; FIRST_UNIMPLEMENTED_OP, K_will_not_happen, "FIRST_UNIMPLEMENTED_OP" |] in let ops = Array.mapi ~f:(fun i (c, k, n) -> { code = c; kind = k; name = n; opcode = i }) instrs in ops let get code i = Char.code code.[i] let getu code pc = let i = pc * 4 in let b1 = get code i in let b2 = get code (i + 1) in let b3 = get code (i + 2) in let b4 = get code (i + 3) in (b4 lsl 24) + (b3 lsl 16) + (b2 lsl 8) + b1 let getu32 code pc = Int32.of_int (getu code pc) let gets code pc = let i = pc * 4 in let b1 = get code i in let b2 = get code (i + 1) in let b3 = get code (i + 2) in let b4 = get code (i + 3) in let b4' = if b4 >= 128 then b4 - 256 else b4 in (b4' lsl 24) + (b3 lsl 16) + (b2 lsl 8) + b1 let gets32 code pc = Int32.of_int (gets code pc) exception Bad_instruction of int let get_instr_exn code pc = let i = getu code pc in if i < 0 || i >= Array.length ops then raise (Bad_instruction i); let ins = ops.(i) in if Poly.(ins.kind = K_will_not_happen) then raise (Bad_instruction i); ins js_of_ocaml-3.5.2/compiler/lib/instr.mli000066400000000000000000000064631357507750000202400ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type t = | ACC0 | ACC1 | ACC2 | ACC3 | ACC4 | ACC5 | ACC6 | ACC7 | ACC | PUSH | PUSHACC0 | PUSHACC1 | PUSHACC2 | PUSHACC3 | PUSHACC4 | PUSHACC5 | PUSHACC6 | PUSHACC7 | PUSHACC | POP | ASSIGN | ENVACC1 | ENVACC2 | ENVACC3 | ENVACC4 | ENVACC | PUSHENVACC1 | PUSHENVACC2 | PUSHENVACC3 | PUSHENVACC4 | PUSHENVACC | PUSH_RETADDR | APPLY | APPLY1 | APPLY2 | APPLY3 | APPTERM | APPTERM1 | APPTERM2 | APPTERM3 | RETURN | RESTART | GRAB | CLOSURE | CLOSUREREC | OFFSETCLOSUREM2 | OFFSETCLOSURE0 | OFFSETCLOSURE2 | OFFSETCLOSURE | PUSHOFFSETCLOSUREM2 | PUSHOFFSETCLOSURE0 | PUSHOFFSETCLOSURE2 | PUSHOFFSETCLOSURE | GETGLOBAL | PUSHGETGLOBAL | GETGLOBALFIELD | PUSHGETGLOBALFIELD | SETGLOBAL | ATOM0 | ATOM | PUSHATOM0 | PUSHATOM | MAKEBLOCK | MAKEBLOCK1 | MAKEBLOCK2 | MAKEBLOCK3 | MAKEFLOATBLOCK | GETFIELD0 | GETFIELD1 | GETFIELD2 | GETFIELD3 | GETFIELD | GETFLOATFIELD | SETFIELD0 | SETFIELD1 | SETFIELD2 | SETFIELD3 | SETFIELD | SETFLOATFIELD | VECTLENGTH | GETVECTITEM | SETVECTITEM | GETBYTESCHAR | SETBYTESCHAR | BRANCH | BRANCHIF | BRANCHIFNOT | SWITCH | BOOLNOT | PUSHTRAP | POPTRAP | RAISE | CHECK_SIGNALS | C_CALL1 | C_CALL2 | C_CALL3 | C_CALL4 | C_CALL5 | C_CALLN | CONST0 | CONST1 | CONST2 | CONST3 | CONSTINT | PUSHCONST0 | PUSHCONST1 | PUSHCONST2 | PUSHCONST3 | PUSHCONSTINT | NEGINT | ADDINT | SUBINT | MULINT | DIVINT | MODINT | ANDINT | ORINT | XORINT | LSLINT | LSRINT | ASRINT | EQ | NEQ | LTINT | LEINT | GTINT | GEINT | OFFSETINT | OFFSETREF | ISINT | GETMETHOD | BEQ | BNEQ | BLTINT | BLEINT | BGTINT | BGEINT | ULTINT | UGEINT | BULTINT | BUGEINT | GETPUBMET | GETDYNMET | STOP | EVENT | BREAK | RERAISE | RAISE_NOTRACE | GETSTRINGCHAR | FIRST_UNIMPLEMENTED_OP type kind = | KNullary | KUnary | KBinary | KJump | KCond_jump | KCmp_jump | KSwitch | KClosurerec | KClosure | KNullaryCall | KUnaryCall | KBinaryCall | KStop of int | K_will_not_happen type desc = { code : t ; kind : kind ; name : string ; opcode : int } val get_instr_exn : string -> int -> desc val gets : string -> int -> int val getu : string -> int -> int val gets32 : string -> int -> int32 val getu32 : string -> int -> int32 js_of_ocaml-3.5.2/compiler/lib/javascript.ml000066400000000000000000000170201357507750000210650ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib module Num : sig type t (** Conversions *) val of_string_unsafe : string -> t val of_int32 : int32 -> t val of_float : float -> t val to_string : t -> string val to_int32 : t -> int32 (** Predicates *) val is_zero : t -> bool val is_one : t -> bool val is_neg : t -> bool (** Arithmetic *) val add : t -> t -> t val neg : t -> t end = struct type t = string let of_string_unsafe s = s let to_string s = s let to_int32 s = if String.is_prefix s ~prefix:"0" && String.length s > 1 && String.for_all s ~f:(function | '0' .. '7' -> true | _ -> false) then (* octal notation *) Int32.of_string ("0o" ^ s) else Int32.of_string s let of_int32 = Int32.to_string let of_float v = match Float.classify_float v with | FP_nan -> "NaN" | FP_zero -> (* [1/-0] < 0. seems to be the only way to detect -0 in JavaScript *) if Float.(1. /. v < 0.) then "-0." else "0." | FP_infinite -> if Float.(v < 0.) then "-Infinity" else "Infinity" | FP_normal | FP_subnormal -> let vint = int_of_float v in if Float.equal (float_of_int vint) v then Printf.sprintf "%d." vint else let s1 = Printf.sprintf "%.12g" v in if Float.equal v (float_of_string s1) then s1 else let s2 = Printf.sprintf "%.15g" v in if Float.equal v (float_of_string s2) then s2 else Printf.sprintf "%.18g" v let is_zero s = String.equal s "0" let is_one s = String.equal s "1" let is_neg s = Char.equal s.[0] '-' let neg s = match String.drop_prefix s ~prefix:"-" with | None -> "-" ^ s | Some s -> s let add a b = of_int32 (Int32.add (to_int32 a) (to_int32 b)) end module Label = struct type t = | L of int | S of string let printer = VarPrinter.create VarPrinter.Alphabet.javascript let zero = L 0 let succ = function | L t -> L (succ t) | S _ -> assert false let to_string = function | L t -> VarPrinter.to_string printer t | S s -> s let of_string s = S s end type location = | Pi of Parse_info.t | N | U type identifier = string type ident_string = { name : identifier ; var : Code.Var.t option ; loc : location } type ident = | S of ident_string | V of Code.Var.t (* A.3 Expressions *) and array_litteral = element_list and element_list = expression option list and binop = | Eq | StarEq | SlashEq | ModEq | PlusEq | MinusEq | LslEq | AsrEq | LsrEq | BandEq | BxorEq | BorEq | Or | And | Bor | Bxor | Band | EqEq | NotEq | EqEqEq | NotEqEq | Lt | Le | Gt | Ge | InstanceOf | In | Lsl | Lsr | Asr | Plus | Minus | Mul | Div | Mod and unop = | Not | Neg | Pl | Typeof | Void | Delete | Bnot | IncrA | DecrA | IncrB | DecrB and arguments = expression list and property_name_and_value_list = (property_name * expression) list and property_name = | PNI of identifier | PNS of string | PNN of Num.t and expression = | ESeq of expression * expression | ECond of expression * expression * expression | EBin of binop * expression * expression | EUn of unop * expression | ECall of expression * arguments * location | EAccess of expression * expression | EDot of expression * identifier | ENew of expression * arguments option | EVar of ident | EFun of function_expression | EStr of string * [ `Bytes | `Utf8 ] | EArr of array_litteral | EBool of bool | ENum of Num.t | EObj of property_name_and_value_list | EQuote of string | ERegexp of string * string option (****) (* A.4 Statements *) and statement = | Block of block | Variable_statement of variable_declaration list | Empty_statement | Expression_statement of expression | If_statement of expression * (statement * location) * (statement * location) option | Do_while_statement of (statement * location) * expression | While_statement of expression * (statement * location) | For_statement of (expression option, variable_declaration list) either * expression option * expression option * (statement * location) | ForIn_statement of (expression, variable_declaration) either * expression * (statement * location) | Continue_statement of Label.t option | Break_statement of Label.t option | Return_statement of expression option (* | With_statement of expression * statement *) | Labelled_statement of Label.t * (statement * location) | Switch_statement of expression * case_clause list * statement_list option * case_clause list | Throw_statement of expression | Try_statement of block * (ident * block) option * block option | Debugger_statement and ('left, 'right) either = | Left of 'left | Right of 'right and block = statement_list and statement_list = (statement * location) list and variable_declaration = ident * initialiser option and case_clause = expression * statement_list and initialiser = expression * location (****) (* A.5 Functions and programs *) and function_declaration = ident * formal_parameter_list * function_body * location and function_expression = ident option * formal_parameter_list * function_body * location and formal_parameter_list = ident list and function_body = source_elements and program = source_elements and source_elements = (source_element * location) list and source_element = | Statement of statement | Function_declaration of function_declaration let compare_ident t1 t2 = match t1, t2 with | V v1, V v2 -> Code.Var.compare v1 v2 | S { name = s1; var = v1; loc = l1 }, S { name = s2; var = v2; loc = l2 } -> ( match String.compare s1 s2 with | 0 -> ( match Option.compare Code.Var.compare v1 v2 with | 0 -> Poly.compare l1 l2 | n -> n) | n -> n) | S _, V _ -> -1 | V _, S _ -> 1 exception Not_an_ident let is_ident = let l = Array.init 256 ~f:(fun i -> let c = Char.chr i in match c with | 'a' .. 'z' | 'A' .. 'Z' | '_' | '$' -> 1 | '0' .. '9' -> 2 | _ -> 0) in fun s -> (not (StringSet.mem s Reserved.keyword)) && try for i = 0 to String.length s - 1 do let code = l.(Char.code s.[i]) in if i = 0 then (if code <> 1 then raise Not_an_ident) else if code < 1 then raise Not_an_ident done; true with Not_an_ident -> false let ident ?(loc = N) ?var name = S { name; var; loc } module IdentSet = Set.Make (struct type t = ident let compare = compare_ident end) module IdentMap = Map.Make (struct type t = ident let compare = compare_ident end) js_of_ocaml-3.5.2/compiler/lib/javascript.mli000066400000000000000000000122771357507750000212470ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Num : sig type t (** Conversions *) val of_string_unsafe : string -> t val of_int32 : int32 -> t val of_float : float -> t val to_string : t -> string val to_int32 : t -> int32 (** Predicates *) val is_zero : t -> bool val is_one : t -> bool val is_neg : t -> bool (** Arithmetic *) val add : t -> t -> t val neg : t -> t end module Label : sig type t val zero : t val succ : t -> t val to_string : t -> string val of_string : string -> t end type location = | Pi of Parse_info.t | N (* No location; use the one above *) | U (* Unknown location *) (* A.3 Expressions *) type identifier = string type ident_string = { name : identifier ; var : Code.Var.t option ; loc : location } type ident = | S of ident_string | V of Code.Var.t and array_litteral = element_list and element_list = expression option list and binop = | Eq | StarEq | SlashEq | ModEq | PlusEq | MinusEq | LslEq | AsrEq | LsrEq | BandEq | BxorEq | BorEq | Or | And | Bor | Bxor | Band | EqEq | NotEq | EqEqEq | NotEqEq | Lt | Le | Gt | Ge | InstanceOf | In | Lsl | Lsr | Asr | Plus | Minus | Mul | Div | Mod and unop = | Not | Neg | Pl | Typeof | Void | Delete | Bnot | IncrA | DecrA | IncrB | DecrB and arguments = expression list and property_name_and_value_list = (property_name * expression) list and property_name = | PNI of identifier | PNS of string | PNN of Num.t and expression = | ESeq of expression * expression | ECond of expression * expression * expression | EBin of binop * expression * expression | EUn of unop * expression | ECall of expression * arguments * location | EAccess of expression * expression | EDot of expression * identifier | ENew of expression * arguments option | EVar of ident | EFun of function_expression | EStr of string * [ `Bytes | `Utf8 ] (* A string can either be composed of a sequence of bytes, or be UTF-8 encoded. In the second case, the string may contain escape sequences. *) | EArr of array_litteral | EBool of bool | ENum of Num.t | EObj of property_name_and_value_list | EQuote of string | ERegexp of string * string option (****) (* A.4 Statements *) and statement = | Block of block | Variable_statement of variable_declaration list | Empty_statement | Expression_statement of expression | If_statement of expression * (statement * location) * (statement * location) option | Do_while_statement of (statement * location) * expression | While_statement of expression * (statement * location) | For_statement of (expression option, variable_declaration list) either * expression option * expression option * (statement * location) | ForIn_statement of (expression, variable_declaration) either * expression * (statement * location) | Continue_statement of Label.t option | Break_statement of Label.t option | Return_statement of expression option (* | With_statement *) | Labelled_statement of Label.t * (statement * location) | Switch_statement of expression * case_clause list * statement_list option * case_clause list | Throw_statement of expression | Try_statement of block * (ident * block) option * block option | Debugger_statement and ('left, 'right) either = | Left of 'left | Right of 'right and block = statement_list and statement_list = (statement * location) list and variable_declaration = ident * initialiser option and case_clause = expression * statement_list and initialiser = expression * location (****) (* A.5 Functions and programs *) and function_declaration = ident * formal_parameter_list * function_body * location and function_expression = ident option * formal_parameter_list * function_body * location and formal_parameter_list = ident list and function_body = source_elements and program = source_elements and source_elements = (source_element * location) list and source_element = | Statement of statement | Function_declaration of function_declaration val compare_ident : ident -> ident -> int val is_ident : string -> bool val ident : ?loc:location -> ?var:Code.Var.t -> identifier -> ident module IdentSet : Set.S with type elt = ident module IdentMap : Map.S with type key = ident js_of_ocaml-3.5.2/compiler/lib/js_assign.ml000066400000000000000000000307671357507750000207140ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Jérôme Vouillon * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Javascript let debug = Debug.find "shortvar" module S = Code.Var.Set module Var = Code.Var module type Strategy = sig type t val create : int -> t val record_block : t -> Js_traverse.t -> catch:bool -> Javascript.ident list -> unit val allocate_variables : t -> count:int Javascript.IdentMap.t -> string array end module Min : Strategy = struct (* We are trying to achieve the following goals: (1) variable names should be as short as possible (2) one should reuse as much as possible a small subsets of variable names (3) function parameters should be: function(a,b,...){...} (4) for longer variable names, variable which are closed from one another should share a same prefix Point (1) minimizes the size of uncompressed files, while point (2) to (4) improve compression. We use the following strategy. We maintain the constraint that variables occurring in a function should keep different names. We first assign names a, b, ... (in order) to function parameters, starting from inner functions, skipping variables which have a conflict with a previously names variable (goal 3). Then, we order the remaining variables by their number of occurrences, then by their index (goal 4), and greedily assigned name to them. For that, we use for each variable the smallest possible name still available (goal 1/2). This algorithm seems effective. Here are some statistics gathered while compiling the OCaml toplevel: (1) We get 132025 occurrences of one-char variables out of 169728 occurrences while the optimal number (determined using a mixed integer linear programming solver) is 132105 occurrences (80 more occurrences). (2) Variable names are heavily biased toward character a: among variables, we have about 34000 occurrences of character a, less than 5000 occurrences of character i (9th character, out of the 54 characters that can start an identifier), and about 1500 occurrences of character A. (3) About 6% of the function parameters are not assigned as wanted; it is not clear we can do any better: there are a lot of nested functions. (4) We save 8181 bytes on the compressed file (1.8%) by sorting variables using their index as a secondary key rather that just based on their weights (the size of the uncompressed file remains unchanged) *) type alloc = { mutable first_free : int ; mutable used : BitSet.t } let make_alloc_table () = { first_free = 0; used = BitSet.create () } let next_available a i = BitSet.next_free a.used (max i a.first_free) let allocate a i = BitSet.set a.used i; if a.first_free = i then a.first_free <- BitSet.next_free a.used a.first_free let is_available l i = List.for_all l ~f:(fun a -> BitSet.mem a.used i) let first_available l = let rec find_rec n l = let n' = List.fold_left l ~init:n ~f:(fun n a -> next_available a n) in if n = n' then n else find_rec n' l in find_rec 0 l let mark_allocated l i = List.iter l ~f:(fun a -> allocate a i) type t = { constr : alloc list array ; (* Constraints on variables *) mutable parameters : Var.t list array ; (* Function parameters *) mutable constraints : S.t list } (* For debugging *) let create nv = { constr = Array.make nv []; parameters = [| [] |]; constraints = [] } (* let output_debug_information t count = * * * let weight v = (IdentMap.find (V v) count) in * * let usage = * List.fold_left * (fun u s -> * S.fold * (fun v u -> VM.add v (try 1 + VM.find v u with Not_found -> 1) u) * s u) * VM.empty t.constraints * in * * let l = List.map fst (VM.bindings usage) in * * let ch = open_out "/tmp/weights.txt" in * List.iter * (fun v -> * Printf.fprintf ch "%d / %d / %d\n" (weight v) * (VM.find v usage) (Var.idx v)) * l; * close_out ch; * * let ch = open_out "/tmp/problem.txt" in * Printf.fprintf ch "Maximize\n"; * let a = Array.of_list l in * Printf.fprintf ch " "; * for i = 0 to Array.length a - 1 do * let v = a.(i) in * let w = weight v in * if i > 0 then Printf.fprintf ch " + "; * Printf.fprintf ch "%d x%d" w (Var.idx v) * done; * Printf.fprintf ch "\n"; * Printf.fprintf ch "Subject To\n"; * List.iter * (fun s -> * if S.cardinal s > 0 then begin * Printf.fprintf ch " "; * let a = Array.of_list (S.elements s) in * for i = 0 to Array.length a - 1 do * if i > 0 then Printf.fprintf ch " + "; * Printf.fprintf ch "x%d" (Var.idx a.(i)) * done; * Printf.fprintf ch "<= 54\n" * end) * t.constraints; * Printf.fprintf ch "Binary\n "; * List.iter (fun v -> Printf.fprintf ch " x%d" (Var.idx v)) l; * Printf.fprintf ch "\nEnd\n"; * close_out ch; * * let ch = open_out "/tmp/problem2" in * let var x = string_of_int (Var.idx x) in * let a = List.map (fun v -> (var v, weight v)) l in * let b = * List.map (fun s -> List.map var (S.elements s)) t.constraints in * let c = List.map var l in * output_value ch * ((a, b, c) : (string * int) list * string list list * string list); * close_out ch *) let allocate_variables t ~count = let weight v = try IdentMap.find (V (Var.of_idx v)) count with Not_found -> 0 in let constr = t.constr in let len = Array.length constr in let idx = Array.make len 0 in for i = 0 to len - 1 do idx.(i) <- i done; Array.stable_sort idx ~cmp:(fun i j -> compare (weight j) (weight i)); let name = Array.make len "" in let n0 = ref 0 in let n1 = ref 0 in let n2 = ref 0 in let n3 = ref 0 in let stats i n = incr n0; if n < 54 then ( incr n1; n2 := !n2 + weight i); n3 := !n3 + weight i in let nm ~origin n = name.(origin) <- Var.to_string ~origin:(Var.of_idx origin) (Var.of_idx n) in let total = ref 0 in let bad = ref 0 in for i = 0 to Array.length t.parameters - 1 do List.iter (List.rev t.parameters.(i)) ~f:(fun x -> incr total; let idx = Var.idx x in let l = constr.(idx) in if is_available l i then ( nm ~origin:idx i; mark_allocated l i; stats idx i) else incr bad) done; if debug () then Format.eprintf "Function parameter properly assigned: %d/%d@." (!total - !bad) !total; for i = 0 to len - 1 do let l = constr.(idx.(i)) in if (not (List.is_empty l)) && String.length name.(idx.(i)) = 0 then ( let n = first_available l in let idx = idx.(i) in nm ~origin:idx n; mark_allocated l n; stats idx n); if List.is_empty l then assert (weight idx.(i) = 0) done; if debug () then ( Format.eprintf "short variable count: %d/%d@." !n1 !n0; Format.eprintf "short variable occurrences: %d/%d@." !n2 !n3); name let add_constraints global u ?(offset = 0) params = let constr = global.constr in let c = make_alloc_table () in S.iter (fun v -> let i = Var.idx v in constr.(i) <- c :: constr.(i)) u; let params = Array.of_list params in let len = Array.length params in let len_max = len + offset in if Array.length global.parameters < len_max then ( let a = Array.make (2 * len_max) [] in Array.blit ~src:global.parameters ~src_pos:0 ~dst:a ~dst_pos:0 ~len:(Array.length global.parameters); global.parameters <- a); for i = 0 to len - 1 do match params.(i) with | V x -> global.parameters.(i + offset) <- x :: global.parameters.(i + offset) | _ -> () done; global.constraints <- u :: global.constraints let record_block state scope ~catch params = let offset = if catch then 5 else 0 in let all = S.union scope.Js_traverse.def scope.Js_traverse.use in add_constraints state all ~offset params end module Preserve : Strategy = struct (* Try to preserve variable names. - Assign the origin name if present: "{original_name}" - If present but not available, derive a similar name: "{original_name}${n}" (eg. result$3). - If not present, make up a name: "$${n}" Color variables one scope/block at a time - outer scope first. *) type t = { size : int ; mutable scopes : (S.t * Js_traverse.t) list } let create size = { size; scopes = [] } let record_block t scope ~catch param = let defs = match catch, param with | true, [ V x ] -> S.singleton x | true, [ S _ ] -> S.empty | true, _ -> assert false | false, _ -> scope.Js_traverse.def in t.scopes <- (defs, scope) :: t.scopes let allocate_variables t ~count:_ = let names = Array.make t.size "" in List.iter t.scopes ~f:(fun (defs, state) -> let assigned = List.fold_left ~f:StringSet.union ~init:StringSet.empty [ state.Js_traverse.def_name; state.Js_traverse.use_name; Reserved.keyword ] in let assigned = S.fold (fun var acc -> let name = names.(Var.idx var) in if not (String.is_empty name) then StringSet.add name acc else acc) (S.union state.Js_traverse.use state.Js_traverse.def) assigned in let _assigned = S.fold (fun var assigned -> assert (String.is_empty names.(Var.idx var)); let name = match Var.get_name var with | Some expected_name -> assert (not (String.is_empty expected_name)); if not (StringSet.mem expected_name assigned) then expected_name else let i = ref 0 in while StringSet.mem (Printf.sprintf "%s$%d" expected_name !i) assigned do incr i done; Printf.sprintf "%s$%d" expected_name !i | None -> Var.to_string var in names.(Var.idx var) <- name; StringSet.add name assigned) defs assigned in ()); names end class traverse record_block = object (m) inherit Js_traverse.free as super method! block ?(catch = false) params = record_block m#state ~catch params; super#block params end let program' (module Strategy : Strategy) p = let nv = Var.count () in let state = Strategy.create nv in let mapper = new traverse (Strategy.record_block state) in let p = mapper#program p in mapper#block []; if S.cardinal mapper#get_free <> 0 then if true then failwith_ "Some variables escaped (#%d)" (S.cardinal mapper#get_free) else ( Format.eprintf "Some variables escaped (#%d)" (S.cardinal mapper#get_free); S.iter (fun s -> Format.eprintf "%s@." (Var.to_string s)) mapper#get_free); let names = Strategy.allocate_variables state ~count:mapper#state.Js_traverse.count in (* if debug () then output_debug_information state coloring#state.Js_traverse.count; *) let color = function | V v -> let name = names.(Var.idx v) in assert (not (String.is_empty name)); ident ~var:v name | x -> x in (new Js_traverse.subst color)#program p let program p = if Config.Flag.shortvar () then program' (module Min) p else program' (module Preserve) p js_of_ocaml-3.5.2/compiler/lib/js_assign.mli000066400000000000000000000015671357507750000210610ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val program : Javascript.program -> Javascript.program js_of_ocaml-3.5.2/compiler/lib/js_lexer.ml000066400000000000000000001360541357507750000205430ustar00rootroot00000000000000# 1 "compiler/lib/js_lexer.mll" (* Js_of_ocaml compiler * Copyright (C) 2013 Hugo Heuzard *) (* Yoann Padioleau * * Copyright (C) 2010 Facebook * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation, with the * special exception on linking described in file license.txt. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * license.txt for more details. *) open Js_token let tok lexbuf = Lexing.lexeme lexbuf let keyword_table = let h = Hashtbl.create 17 in List.iter (fun (s,f) -> Hashtbl.add h s f ) [ "break", (fun ii -> T_BREAK ii); "case", (fun ii -> T_CASE ii); "catch", (fun ii -> T_CATCH ii); "continue", (fun ii -> T_CONTINUE ii); "debugger", (fun ii -> T_DEBUGGER ii); "default", (fun ii -> T_DEFAULT ii); "delete", (fun ii -> T_DELETE ii); "do", (fun ii -> T_DO ii); "else", (fun ii -> T_ELSE ii); "false", (fun ii -> T_FALSE ii); "finally", (fun ii -> T_FINALLY ii); "for", (fun ii -> T_FOR ii); "function", (fun ii -> T_FUNCTION ii); "if", (fun ii -> T_IF ii); "in", (fun ii -> T_IN ii); "instanceof", (fun ii -> T_INSTANCEOF ii); "new", (fun ii -> T_NEW ii); "null", (fun ii -> T_NULL ii); "return", (fun ii -> T_RETURN ii); "switch", (fun ii -> T_SWITCH ii); "this", (fun ii -> T_THIS ii); "throw", (fun ii -> T_THROW ii); "true", (fun ii -> T_TRUE ii); "try", (fun ii -> T_TRY ii); "typeof", (fun ii -> T_TYPEOF ii); "var", (fun ii -> T_VAR ii); "void", (fun ii -> T_VOID ii); "while", (fun ii -> T_WHILE ii); "while", (fun ii -> T_WHILE ii); "with", (fun ii -> T_WITH ii); ]; h # 65 "compiler/lib/js_lexer.ml" let __ocaml_lex_tables = { Lexing.lex_base = "\000\000\197\255\198\255\200\255\081\000\103\000\160\000\207\255\ \003\000\031\000\035\000\083\000\100\000\078\000\081\000\084\000\ \085\000\127\000\109\000\241\255\242\255\243\255\244\255\235\000\ \246\255\247\255\248\255\249\255\250\255\251\255\252\255\001\000\ \003\000\120\000\199\255\153\000\255\255\245\000\011\001\021\001\ \031\001\220\255\240\255\219\255\239\255\087\000\238\255\103\000\ \237\255\104\000\236\255\230\255\107\000\235\255\110\000\228\255\ \227\255\224\255\232\255\223\255\231\255\222\255\221\255\218\255\ \043\001\055\001\065\001\120\001\102\000\252\255\253\255\143\001\ \181\001\255\255\204\001\254\255\242\001\009\002\047\002\161\000\ \251\255\252\255\004\000\255\255\254\255\129\000\251\255\252\255\ \253\255\254\255\047\000\255\255\214\000\252\255\253\255\048\000\ \255\255\254\255\053\002\166\002\251\255\167\002\254\255\005\000\ \126\000\255\255\139\000\166\000\169\002\179\002\116\001\255\255\ "; Lexing.lex_backtrk = "\255\255\255\255\255\255\255\255\054\000\054\000\050\000\255\255\ \046\000\043\000\042\000\041\000\040\000\039\000\038\000\047\000\ \049\000\044\000\045\000\255\255\255\255\255\255\255\255\010\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\003\000\ \002\000\056\000\255\255\001\000\255\255\054\000\255\255\053\000\ \255\255\255\255\255\255\255\255\255\255\021\000\255\255\022\000\ \255\255\026\000\255\255\255\255\030\000\255\255\029\000\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \054\000\052\000\255\255\051\000\255\255\255\255\255\255\002\000\ \002\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\002\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\003\000\255\255\255\255\255\255\255\255\002\000\ \255\255\255\255\000\000\255\255\255\255\002\000\255\255\001\000\ \003\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ "; Lexing.lex_default = "\001\000\000\000\000\000\000\000\255\255\255\255\255\255\000\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\000\000\000\000\000\000\000\000\255\255\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\255\255\ \255\255\255\255\000\000\035\000\000\000\255\255\255\255\255\255\ \255\255\000\000\000\000\000\000\000\000\255\255\000\000\255\255\ \000\000\255\255\000\000\000\000\255\255\000\000\255\255\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \255\255\255\255\255\255\255\255\070\000\000\000\000\000\255\255\ \255\255\000\000\255\255\000\000\255\255\255\255\255\255\081\000\ \000\000\000\000\255\255\000\000\000\000\087\000\000\000\000\000\ \000\000\000\000\091\000\000\000\094\000\000\000\000\000\097\000\ \000\000\000\000\255\255\101\000\000\000\101\000\000\000\255\255\ \255\255\000\000\255\255\255\255\255\255\255\255\255\255\000\000\ "; Lexing.lex_trans = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\032\000\030\000\030\000\032\000\031\000\084\000\102\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \032\000\015\000\003\000\032\000\006\000\009\000\018\000\003\000\ \027\000\026\000\010\000\012\000\021\000\011\000\023\000\033\000\ \005\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\ \004\000\004\000\020\000\022\000\014\000\016\000\013\000\019\000\ \063\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\025\000\062\000\024\000\008\000\006\000\ \061\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\029\000\017\000\028\000\007\000\064\000\ \060\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\ \004\000\004\000\004\000\053\000\052\000\049\000\050\000\058\000\ \059\000\047\000\045\000\042\000\046\000\064\000\038\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\004\000\ \004\000\057\000\036\000\255\255\048\000\051\000\255\255\035\000\ \055\000\054\000\041\000\056\000\038\000\105\000\107\000\108\000\ \089\000\000\000\000\000\000\000\000\000\034\000\038\000\000\000\ \000\000\000\000\000\000\000\000\043\000\000\000\000\000\066\000\ \000\000\000\000\073\000\083\000\006\000\000\000\108\000\000\000\ \083\000\000\000\000\000\000\000\038\000\000\000\000\000\000\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\000\000\071\000\088\000\090\000\072\000\066\000\ \000\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\044\000\000\000\082\000\000\000\006\000\ \002\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\037\000\037\000\037\000\255\255\ \255\255\000\000\095\000\096\000\000\000\000\000\040\000\000\000\ \040\000\000\000\038\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\039\000\ \039\000\000\000\038\000\037\000\037\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\037\000\064\000\069\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\004\000\ \004\000\067\000\067\000\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\000\000\038\000\110\000\000\000\000\000\ \000\000\086\000\067\000\067\000\067\000\067\000\067\000\067\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\110\000\000\000\111\000\000\000\ \000\000\255\255\000\000\111\000\038\000\000\000\000\000\000\000\ \000\000\080\000\067\000\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\067\000\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\067\000\067\000\067\000\067\000\067\000\067\000\076\000\ \076\000\076\000\076\000\076\000\076\000\076\000\076\000\076\000\ \076\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \076\000\076\000\076\000\076\000\076\000\076\000\093\000\000\000\ \000\000\067\000\067\000\067\000\067\000\067\000\067\000\000\000\ \000\000\000\000\000\000\000\000\000\000\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\074\000\000\000\ \076\000\076\000\076\000\076\000\076\000\076\000\074\000\074\000\ \074\000\074\000\074\000\074\000\075\000\075\000\075\000\075\000\ \075\000\075\000\075\000\075\000\075\000\075\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\075\000\075\000\075\000\ \075\000\075\000\075\000\000\000\000\000\000\000\074\000\074\000\ \074\000\074\000\074\000\074\000\000\000\000\000\000\000\000\000\ \000\000\000\000\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\077\000\000\000\075\000\075\000\075\000\ \075\000\075\000\075\000\077\000\077\000\077\000\077\000\077\000\ \077\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\078\000\078\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\078\000\078\000\078\000\078\000\078\000\078\000\ \000\000\000\000\000\000\077\000\077\000\077\000\077\000\077\000\ \077\000\000\000\000\000\000\000\000\000\000\000\000\000\075\000\ \075\000\075\000\075\000\075\000\075\000\075\000\075\000\075\000\ \075\000\000\000\078\000\078\000\078\000\078\000\078\000\078\000\ \075\000\075\000\075\000\075\000\075\000\075\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \075\000\075\000\075\000\075\000\075\000\075\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \102\000\255\255\108\000\103\000\255\255\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\110\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\108\000\000\000\000\000\000\000\000\000\000\000\000\000\ \104\000\255\255\000\000\110\000\000\000\000\000\000\000\000\000\ \000\000\109\000\109\000\109\000\109\000\109\000\109\000\109\000\ \109\000\109\000\109\000\109\000\109\000\109\000\109\000\109\000\ \109\000\109\000\109\000\109\000\109\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\100\000\255\255\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000"; Lexing.lex_check = "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\000\000\000\000\031\000\032\000\000\000\082\000\103\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \000\000\000\000\000\000\032\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \008\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\009\000\000\000\000\000\000\000\ \010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000\ \011\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\ \004\000\004\000\004\000\013\000\013\000\014\000\014\000\012\000\ \011\000\015\000\016\000\018\000\045\000\005\000\004\000\005\000\ \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\ \005\000\012\000\033\000\035\000\047\000\049\000\035\000\033\000\ \052\000\052\000\018\000\054\000\005\000\104\000\106\000\107\000\ \085\000\255\255\255\255\255\255\255\255\033\000\004\000\255\255\ \255\255\255\255\255\255\255\255\017\000\255\255\255\255\005\000\ \255\255\255\255\068\000\079\000\006\000\255\255\107\000\255\255\ \079\000\255\255\255\255\255\255\005\000\255\255\255\255\255\255\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\255\255\068\000\085\000\085\000\068\000\005\000\ \255\255\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\017\000\255\255\079\000\255\255\006\000\ \000\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\023\000\023\000\023\000\023\000\023\000\ \023\000\023\000\023\000\023\000\023\000\037\000\037\000\037\000\ \037\000\037\000\037\000\037\000\037\000\037\000\037\000\090\000\ \095\000\255\255\092\000\092\000\255\255\255\255\038\000\255\255\ \038\000\255\255\037\000\038\000\038\000\038\000\038\000\038\000\ \038\000\038\000\038\000\038\000\038\000\039\000\039\000\039\000\ \039\000\039\000\039\000\039\000\039\000\039\000\039\000\040\000\ \040\000\040\000\040\000\040\000\040\000\040\000\040\000\040\000\ \040\000\255\255\037\000\064\000\064\000\064\000\064\000\064\000\ \064\000\064\000\064\000\064\000\064\000\065\000\068\000\065\000\ \065\000\065\000\065\000\065\000\065\000\065\000\065\000\065\000\ \065\000\066\000\066\000\066\000\066\000\066\000\066\000\066\000\ \066\000\066\000\066\000\255\255\065\000\110\000\255\255\255\255\ \255\255\085\000\066\000\066\000\066\000\066\000\066\000\066\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\110\000\255\255\110\000\255\255\ \255\255\035\000\255\255\110\000\065\000\255\255\255\255\255\255\ \255\255\079\000\066\000\066\000\066\000\066\000\066\000\066\000\ \067\000\067\000\067\000\067\000\067\000\067\000\067\000\067\000\ \067\000\067\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\067\000\067\000\067\000\067\000\067\000\067\000\071\000\ \071\000\071\000\071\000\071\000\071\000\071\000\071\000\071\000\ \071\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \071\000\071\000\071\000\071\000\071\000\071\000\092\000\255\255\ \255\255\067\000\067\000\067\000\067\000\067\000\067\000\255\255\ \255\255\255\255\255\255\255\255\255\255\072\000\072\000\072\000\ \072\000\072\000\072\000\072\000\072\000\072\000\072\000\255\255\ \071\000\071\000\071\000\071\000\071\000\071\000\072\000\072\000\ \072\000\072\000\072\000\072\000\074\000\074\000\074\000\074\000\ \074\000\074\000\074\000\074\000\074\000\074\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\074\000\074\000\074\000\ \074\000\074\000\074\000\255\255\255\255\255\255\072\000\072\000\ \072\000\072\000\072\000\072\000\255\255\255\255\255\255\255\255\ \255\255\255\255\076\000\076\000\076\000\076\000\076\000\076\000\ \076\000\076\000\076\000\076\000\255\255\074\000\074\000\074\000\ \074\000\074\000\074\000\076\000\076\000\076\000\076\000\076\000\ \076\000\077\000\077\000\077\000\077\000\077\000\077\000\077\000\ \077\000\077\000\077\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\077\000\077\000\077\000\077\000\077\000\077\000\ \255\255\255\255\255\255\076\000\076\000\076\000\076\000\076\000\ \076\000\255\255\255\255\255\255\255\255\255\255\255\255\078\000\ \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\ \078\000\255\255\077\000\077\000\077\000\077\000\077\000\077\000\ \078\000\078\000\078\000\078\000\078\000\078\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \078\000\078\000\078\000\078\000\078\000\078\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \098\000\098\000\098\000\098\000\098\000\098\000\098\000\098\000\ \099\000\101\000\108\000\099\000\101\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\109\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\108\000\255\255\255\255\255\255\255\255\255\255\255\255\ \099\000\101\000\255\255\109\000\255\255\255\255\255\255\255\255\ \255\255\108\000\108\000\108\000\108\000\108\000\108\000\108\000\ \108\000\108\000\108\000\109\000\109\000\109\000\109\000\109\000\ \109\000\109\000\109\000\109\000\109\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\099\000\101\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255"; Lexing.lex_base_code = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\001\000\011\000\000\000\007\000\ "; Lexing.lex_backtrk_code = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ "; Lexing.lex_default_code = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ "; Lexing.lex_trans_code = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\001\000\001\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \001\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\ \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\ \004\000\004\000\004\000\004\000\004\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000"; Lexing.lex_check_code = "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\107\000\108\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \107\000\108\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\108\000\108\000\108\000\108\000\108\000\108\000\108\000\ \108\000\108\000\108\000\109\000\109\000\109\000\109\000\109\000\ \109\000\109\000\109\000\109\000\109\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255"; Lexing.lex_code = "\255\002\255\255\003\255\255\000\002\001\003\255"; } let rec initial tokinfo prev lexbuf = __ocaml_lex_initial_rec tokinfo prev lexbuf 0 and __ocaml_lex_initial_rec tokinfo prev lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 76 "compiler/lib/js_lexer.mll" ( let info = tokinfo lexbuf in let buf = Buffer.create 127 in let nl = ref false in st_comment buf nl lexbuf; let content = Buffer.contents buf in if !nl then TCommentML(info,content) else TComment(info,content) ) # 493 "compiler/lib/js_lexer.ml" | 1 -> let # 87 "compiler/lib/js_lexer.mll" cmt # 499 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 2) lexbuf.Lexing.lex_curr_pos in # 87 "compiler/lib/js_lexer.mll" ( TComment(tokinfo lexbuf,cmt) ) # 503 "compiler/lib/js_lexer.ml" | 2 -> let # 89 "compiler/lib/js_lexer.mll" cmt # 509 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in # 89 "compiler/lib/js_lexer.mll" ( TCommentSpace(tokinfo lexbuf,cmt) ) # 513 "compiler/lib/js_lexer.ml" | 3 -> # 90 "compiler/lib/js_lexer.mll" ( lexbuf.Lexing.lex_curr_p <- { lexbuf.Lexing.lex_curr_p with Lexing.pos_lnum = lexbuf.Lexing.lex_curr_p.Lexing.pos_lnum + 1 }; TCommentNewline(tokinfo lexbuf,"") ) # 521 "compiler/lib/js_lexer.ml" | 4 -> # 99 "compiler/lib/js_lexer.mll" ( T_LCURLY (tokinfo lexbuf); ) # 526 "compiler/lib/js_lexer.ml" | 5 -> # 100 "compiler/lib/js_lexer.mll" ( T_RCURLY (tokinfo lexbuf); ) # 531 "compiler/lib/js_lexer.ml" | 6 -> # 102 "compiler/lib/js_lexer.mll" ( T_LPAREN (tokinfo lexbuf); ) # 536 "compiler/lib/js_lexer.ml" | 7 -> # 103 "compiler/lib/js_lexer.mll" ( T_RPAREN (tokinfo lexbuf); ) # 541 "compiler/lib/js_lexer.ml" | 8 -> # 105 "compiler/lib/js_lexer.mll" ( T_LBRACKET (tokinfo lexbuf); ) # 546 "compiler/lib/js_lexer.ml" | 9 -> # 106 "compiler/lib/js_lexer.mll" ( T_RBRACKET (tokinfo lexbuf); ) # 551 "compiler/lib/js_lexer.ml" | 10 -> # 107 "compiler/lib/js_lexer.mll" ( T_PERIOD (tokinfo lexbuf); ) # 556 "compiler/lib/js_lexer.ml" | 11 -> # 108 "compiler/lib/js_lexer.mll" ( T_SEMICOLON (tokinfo lexbuf); ) # 561 "compiler/lib/js_lexer.ml" | 12 -> # 109 "compiler/lib/js_lexer.mll" ( T_COMMA (tokinfo lexbuf); ) # 566 "compiler/lib/js_lexer.ml" | 13 -> # 110 "compiler/lib/js_lexer.mll" ( T_COLON (tokinfo lexbuf); ) # 571 "compiler/lib/js_lexer.ml" | 14 -> # 111 "compiler/lib/js_lexer.mll" ( T_PLING (tokinfo lexbuf); ) # 576 "compiler/lib/js_lexer.ml" | 15 -> # 112 "compiler/lib/js_lexer.mll" ( T_AND (tokinfo lexbuf); ) # 581 "compiler/lib/js_lexer.ml" | 16 -> # 113 "compiler/lib/js_lexer.mll" ( T_OR (tokinfo lexbuf); ) # 586 "compiler/lib/js_lexer.ml" | 17 -> # 114 "compiler/lib/js_lexer.mll" ( T_STRICT_EQUAL (tokinfo lexbuf); ) # 591 "compiler/lib/js_lexer.ml" | 18 -> # 115 "compiler/lib/js_lexer.mll" ( T_STRICT_NOT_EQUAL (tokinfo lexbuf); ) # 596 "compiler/lib/js_lexer.ml" | 19 -> # 116 "compiler/lib/js_lexer.mll" ( T_LESS_THAN_EQUAL (tokinfo lexbuf); ) # 601 "compiler/lib/js_lexer.ml" | 20 -> # 117 "compiler/lib/js_lexer.mll" ( T_GREATER_THAN_EQUAL (tokinfo lexbuf); ) # 606 "compiler/lib/js_lexer.ml" | 21 -> # 118 "compiler/lib/js_lexer.mll" ( T_EQUAL (tokinfo lexbuf); ) # 611 "compiler/lib/js_lexer.ml" | 22 -> # 119 "compiler/lib/js_lexer.mll" ( T_NOT_EQUAL (tokinfo lexbuf); ) # 616 "compiler/lib/js_lexer.ml" | 23 -> # 120 "compiler/lib/js_lexer.mll" ( let cpi = tokinfo lexbuf in match prev with | Some p when (Js_token.info_of_tok p).Parse_info.line = cpi.Parse_info.line -> T_INCR_NB(cpi) | _ -> T_INCR(cpi) ) # 626 "compiler/lib/js_lexer.ml" | 24 -> # 126 "compiler/lib/js_lexer.mll" ( let cpi = tokinfo lexbuf in match prev with | Some p when (Js_token.info_of_tok p).Parse_info.line = cpi.Parse_info.line -> T_DECR_NB(cpi) | _ -> T_DECR(cpi) ) # 636 "compiler/lib/js_lexer.ml" | 25 -> # 132 "compiler/lib/js_lexer.mll" ( T_LSHIFT_ASSIGN (tokinfo lexbuf); ) # 641 "compiler/lib/js_lexer.ml" | 26 -> # 133 "compiler/lib/js_lexer.mll" ( T_LSHIFT (tokinfo lexbuf); ) # 646 "compiler/lib/js_lexer.ml" | 27 -> # 134 "compiler/lib/js_lexer.mll" ( T_RSHIFT_ASSIGN (tokinfo lexbuf); ) # 651 "compiler/lib/js_lexer.ml" | 28 -> # 135 "compiler/lib/js_lexer.mll" ( T_RSHIFT3_ASSIGN (tokinfo lexbuf); ) # 656 "compiler/lib/js_lexer.ml" | 29 -> # 136 "compiler/lib/js_lexer.mll" ( T_RSHIFT3 (tokinfo lexbuf); ) # 661 "compiler/lib/js_lexer.ml" | 30 -> # 137 "compiler/lib/js_lexer.mll" ( T_RSHIFT (tokinfo lexbuf); ) # 666 "compiler/lib/js_lexer.ml" | 31 -> # 138 "compiler/lib/js_lexer.mll" ( T_PLUS_ASSIGN (tokinfo lexbuf); ) # 671 "compiler/lib/js_lexer.ml" | 32 -> # 139 "compiler/lib/js_lexer.mll" ( T_MINUS_ASSIGN (tokinfo lexbuf); ) # 676 "compiler/lib/js_lexer.ml" | 33 -> # 141 "compiler/lib/js_lexer.mll" ( T_MULT_ASSIGN (tokinfo lexbuf); ) # 681 "compiler/lib/js_lexer.ml" | 34 -> # 142 "compiler/lib/js_lexer.mll" ( T_MOD_ASSIGN (tokinfo lexbuf); ) # 686 "compiler/lib/js_lexer.ml" | 35 -> # 143 "compiler/lib/js_lexer.mll" ( T_BIT_AND_ASSIGN (tokinfo lexbuf); ) # 691 "compiler/lib/js_lexer.ml" | 36 -> # 144 "compiler/lib/js_lexer.mll" ( T_BIT_OR_ASSIGN (tokinfo lexbuf); ) # 696 "compiler/lib/js_lexer.ml" | 37 -> # 145 "compiler/lib/js_lexer.mll" ( T_BIT_XOR_ASSIGN (tokinfo lexbuf); ) # 701 "compiler/lib/js_lexer.ml" | 38 -> # 146 "compiler/lib/js_lexer.mll" ( T_LESS_THAN (tokinfo lexbuf); ) # 706 "compiler/lib/js_lexer.ml" | 39 -> # 147 "compiler/lib/js_lexer.mll" ( T_GREATER_THAN (tokinfo lexbuf); ) # 711 "compiler/lib/js_lexer.ml" | 40 -> # 148 "compiler/lib/js_lexer.mll" ( T_PLUS (tokinfo lexbuf); ) # 716 "compiler/lib/js_lexer.ml" | 41 -> # 149 "compiler/lib/js_lexer.mll" ( T_MINUS (tokinfo lexbuf); ) # 721 "compiler/lib/js_lexer.ml" | 42 -> # 150 "compiler/lib/js_lexer.mll" ( T_MULT (tokinfo lexbuf); ) # 726 "compiler/lib/js_lexer.ml" | 43 -> # 152 "compiler/lib/js_lexer.mll" ( T_MOD (tokinfo lexbuf); ) # 731 "compiler/lib/js_lexer.ml" | 44 -> # 153 "compiler/lib/js_lexer.mll" ( T_BIT_OR (tokinfo lexbuf); ) # 736 "compiler/lib/js_lexer.ml" | 45 -> # 154 "compiler/lib/js_lexer.mll" ( T_BIT_AND (tokinfo lexbuf); ) # 741 "compiler/lib/js_lexer.ml" | 46 -> # 155 "compiler/lib/js_lexer.mll" ( T_BIT_XOR (tokinfo lexbuf); ) # 746 "compiler/lib/js_lexer.ml" | 47 -> # 156 "compiler/lib/js_lexer.mll" ( T_NOT (tokinfo lexbuf); ) # 751 "compiler/lib/js_lexer.ml" | 48 -> # 157 "compiler/lib/js_lexer.mll" ( T_BIT_NOT (tokinfo lexbuf); ) # 756 "compiler/lib/js_lexer.ml" | 49 -> # 158 "compiler/lib/js_lexer.mll" ( T_ASSIGN (tokinfo lexbuf); ) # 761 "compiler/lib/js_lexer.ml" | 50 -> # 163 "compiler/lib/js_lexer.mll" ( let s = tok lexbuf in let info = tokinfo lexbuf in try let f = Hashtbl.find keyword_table s in f info (* need case insensitive ? *) with | Not_found -> T_IDENTIFIER (s, info) ) # 774 "compiler/lib/js_lexer.ml" | 51 -> # 177 "compiler/lib/js_lexer.mll" ( let s = tok lexbuf in let info = tokinfo lexbuf in T_NUMBER (s, info) ) # 783 "compiler/lib/js_lexer.ml" | 52 -> # 182 "compiler/lib/js_lexer.mll" ( let s = tok lexbuf in let info = tokinfo lexbuf in T_NUMBER (s, info) ) # 792 "compiler/lib/js_lexer.ml" | 53 -> # 188 "compiler/lib/js_lexer.mll" ( let s = tok lexbuf in let info = tokinfo lexbuf in T_NUMBER (s, info) ) # 801 "compiler/lib/js_lexer.ml" | 54 -> # 195 "compiler/lib/js_lexer.mll" ( let s = tok lexbuf in let info = tokinfo lexbuf in T_NUMBER (s, info) ) # 810 "compiler/lib/js_lexer.ml" | 55 -> let # 204 "compiler/lib/js_lexer.mll" quote # 816 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in # 204 "compiler/lib/js_lexer.mll" ( let info = tokinfo lexbuf in let buf = Buffer.create 127 in string_quote quote buf lexbuf; let s = Buffer.contents buf in (* s does not contain the enclosing "'" but the info does *) T_STRING (s, info) ) # 827 "compiler/lib/js_lexer.ml" | 56 -> # 229 "compiler/lib/js_lexer.mll" ( let s = tok lexbuf in let info = tokinfo lexbuf in match prev with | Some ( T_IDENTIFIER _ | T_NUMBER _ | T_STRING _ | T_REGEX _ | T_FALSE _ | T_TRUE _ | T_NULL _ | T_THIS _ | T_INCR _ | T_DECR _ | T_RBRACKET _ | T_RPAREN _ ) -> begin match s with | "/" -> T_DIV (info); | "/=" -> T_DIV_ASSIGN info | _ -> assert false end | _ -> (* raise (Token t); *) let buf = Buffer.create 127 in Buffer.add_string buf s; regexp buf lexbuf; T_REGEX (Buffer.contents buf, info) ) # 855 "compiler/lib/js_lexer.ml" | 57 -> # 258 "compiler/lib/js_lexer.mll" ( EOF (tokinfo lexbuf) ) # 860 "compiler/lib/js_lexer.ml" | 58 -> # 260 "compiler/lib/js_lexer.mll" ( (* Format.eprintf "LEXER:unrecognised symbol, in token rule: %s@." (tok lexbuf); *) TUnknown (tokinfo lexbuf, tok lexbuf) ) # 868 "compiler/lib/js_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_initial_rec tokinfo prev lexbuf __ocaml_lex_state and string_escape quote buf lexbuf = __ocaml_lex_string_escape_rec quote buf lexbuf 68 and __ocaml_lex_string_escape_rec quote buf lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 267 "compiler/lib/js_lexer.mll" ( Buffer.add_string buf "\\\\" ) # 880 "compiler/lib/js_lexer.ml" | 1 -> # 269 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf '\\'; Buffer.add_string buf (Lexing.lexeme lexbuf) ) # 887 "compiler/lib/js_lexer.ml" | 2 -> let # 272 "compiler/lib/js_lexer.mll" c # 893 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in # 273 "compiler/lib/js_lexer.mll" ( if c <> '\'' && c <> '\"' then Buffer.add_char buf '\\'; Buffer.add_char buf c ) # 898 "compiler/lib/js_lexer.ml" | 3 -> # 275 "compiler/lib/js_lexer.mll" ( Format.eprintf "LEXER: WEIRD end of file in string_escape@."; ()) # 903 "compiler/lib/js_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_string_escape_rec quote buf lexbuf __ocaml_lex_state and string_quote q buf lexbuf = __ocaml_lex_string_quote_rec q buf lexbuf 79 and __ocaml_lex_string_quote_rec q buf lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> let # 278 "compiler/lib/js_lexer.mll" q' # 916 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in # 278 "compiler/lib/js_lexer.mll" ( if q = q' then () else (Buffer.add_char buf q'; string_quote q buf lexbuf) ) # 923 "compiler/lib/js_lexer.ml" | 1 -> # 282 "compiler/lib/js_lexer.mll" ( string_quote q buf lexbuf ) # 928 "compiler/lib/js_lexer.ml" | 2 -> # 283 "compiler/lib/js_lexer.mll" ( string_escape q buf lexbuf; string_quote q buf lexbuf ) # 936 "compiler/lib/js_lexer.ml" | 3 -> let # 287 "compiler/lib/js_lexer.mll" x # 942 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in # 287 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf x; string_quote q buf lexbuf ) # 946 "compiler/lib/js_lexer.ml" | 4 -> # 288 "compiler/lib/js_lexer.mll" ( Format.eprintf "LEXER: WEIRD end of file in quoted string@."; ()) # 951 "compiler/lib/js_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_string_quote_rec q buf lexbuf __ocaml_lex_state and regexp buf lexbuf = __ocaml_lex_regexp_rec buf lexbuf 85 and __ocaml_lex_regexp_rec buf lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> let # 292 "compiler/lib/js_lexer.mll" x # 964 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in # 292 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf '\\'; Buffer.add_char buf x; regexp buf lexbuf ) # 970 "compiler/lib/js_lexer.ml" | 1 -> # 295 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf '/'; regexp_maybe_ident buf lexbuf ) # 975 "compiler/lib/js_lexer.ml" | 2 -> # 296 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf '['; regexp_class buf lexbuf ) # 980 "compiler/lib/js_lexer.ml" | 3 -> let # 297 "compiler/lib/js_lexer.mll" x # 986 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in # 297 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf x; regexp buf lexbuf ) # 990 "compiler/lib/js_lexer.ml" | 4 -> # 298 "compiler/lib/js_lexer.mll" ( Format.eprintf "LEXER: WEIRD end of file in regexp@."; ()) # 995 "compiler/lib/js_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_regexp_rec buf lexbuf __ocaml_lex_state and regexp_class buf lexbuf = __ocaml_lex_regexp_class_rec buf lexbuf 92 and __ocaml_lex_regexp_class_rec buf lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 301 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf ']'; regexp buf lexbuf ) # 1008 "compiler/lib/js_lexer.ml" | 1 -> let # 303 "compiler/lib/js_lexer.mll" x # 1014 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in # 303 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf '\\'; Buffer.add_char buf x; regexp_class buf lexbuf ) # 1020 "compiler/lib/js_lexer.ml" | 2 -> let # 306 "compiler/lib/js_lexer.mll" x # 1026 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in # 306 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf x; regexp_class buf lexbuf ) # 1030 "compiler/lib/js_lexer.ml" | 3 -> # 307 "compiler/lib/js_lexer.mll" ( Format.eprintf "LEXER: WEIRD end of file in regexp_class@."; ()) # 1035 "compiler/lib/js_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_regexp_class_rec buf lexbuf __ocaml_lex_state and regexp_maybe_ident buf lexbuf = __ocaml_lex_regexp_maybe_ident_rec buf lexbuf 98 and __ocaml_lex_regexp_maybe_ident_rec buf lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 310 "compiler/lib/js_lexer.mll" ( Buffer.add_string buf (tok lexbuf) ) # 1047 "compiler/lib/js_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_regexp_maybe_ident_rec buf lexbuf __ocaml_lex_state and st_comment buf nl lexbuf = __ocaml_lex_st_comment_rec buf nl lexbuf 99 and __ocaml_lex_st_comment_rec buf nl lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 315 "compiler/lib/js_lexer.mll" ( Buffer.add_string buf (tok lexbuf) ) # 1059 "compiler/lib/js_lexer.ml" | 1 -> # 318 "compiler/lib/js_lexer.mll" ( Buffer.add_string buf (tok lexbuf); nl := true; st_comment buf nl lexbuf ) # 1066 "compiler/lib/js_lexer.ml" | 2 -> # 321 "compiler/lib/js_lexer.mll" ( Buffer.add_string buf (tok lexbuf);st_comment buf nl lexbuf ) # 1071 "compiler/lib/js_lexer.ml" | 3 -> # 322 "compiler/lib/js_lexer.mll" ( Buffer.add_char buf '*';st_comment buf nl lexbuf ) # 1076 "compiler/lib/js_lexer.ml" | 4 -> # 324 "compiler/lib/js_lexer.mll" ( Format.eprintf "LEXER: end of file in comment@."; Buffer.add_string buf "*/") # 1081 "compiler/lib/js_lexer.ml" | 5 -> # 325 "compiler/lib/js_lexer.mll" ( let s = tok lexbuf in Format.eprintf "LEXER: unrecognised symbol in comment: %s@." s; Buffer.add_string buf s; st_comment buf nl lexbuf ) # 1091 "compiler/lib/js_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_st_comment_rec buf nl lexbuf __ocaml_lex_state and pos lexbuf = lexbuf.Lexing.lex_mem <- Array.make 4 (-1); __ocaml_lex_pos_rec lexbuf 106 and __ocaml_lex_pos_rec lexbuf __ocaml_lex_state = match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> let # 333 "compiler/lib/js_lexer.mll" line # 1104 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_mem.(0) lexbuf.Lexing.lex_mem.(1) and # 333 "compiler/lib/js_lexer.mll" quote # 1109 "compiler/lib/js_lexer.ml" = Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_curr_pos + -1) in # 333 "compiler/lib/js_lexer.mll" ( let buf = Buffer.create 127 in string_quote quote buf lexbuf; Buffer.contents buf, int_of_string line ) # 1116 "compiler/lib/js_lexer.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_pos_rec lexbuf __ocaml_lex_state ;; js_of_ocaml-3.5.2/compiler/lib/js_lexer.mli000066400000000000000000000014261357507750000207060ustar00rootroot00000000000000(* Js_of_ocaml compiler * Copyright (C) 2013 Hugo Heuzard *) (* Yoann Padioleau * * Copyright (C) 2010 Facebook * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation, with the * special exception on linking described in file license.txt. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * license.txt for more details. *) val initial : (Lexing.lexbuf -> Parse_info.t) -> Js_token.token option -> Lexing.lexbuf -> Js_token.token val pos : Lexing.lexbuf -> string * int js_of_ocaml-3.5.2/compiler/lib/js_lexer.mll000066400000000000000000000267511357507750000207210ustar00rootroot00000000000000{ (* Js_of_ocaml compiler * Copyright (C) 2013 Hugo Heuzard *) (* Yoann Padioleau * * Copyright (C) 2010 Facebook * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation, with the * special exception on linking described in file license.txt. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * license.txt for more details. *) open Js_token let tok lexbuf = Lexing.lexeme lexbuf let keyword_table = let h = Hashtbl.create 17 in List.iter (fun (s,f) -> Hashtbl.add h s f ) [ "break", (fun ii -> T_BREAK ii); "case", (fun ii -> T_CASE ii); "catch", (fun ii -> T_CATCH ii); "continue", (fun ii -> T_CONTINUE ii); "debugger", (fun ii -> T_DEBUGGER ii); "default", (fun ii -> T_DEFAULT ii); "delete", (fun ii -> T_DELETE ii); "do", (fun ii -> T_DO ii); "else", (fun ii -> T_ELSE ii); "false", (fun ii -> T_FALSE ii); "finally", (fun ii -> T_FINALLY ii); "for", (fun ii -> T_FOR ii); "function", (fun ii -> T_FUNCTION ii); "if", (fun ii -> T_IF ii); "in", (fun ii -> T_IN ii); "instanceof", (fun ii -> T_INSTANCEOF ii); "new", (fun ii -> T_NEW ii); "null", (fun ii -> T_NULL ii); "return", (fun ii -> T_RETURN ii); "switch", (fun ii -> T_SWITCH ii); "this", (fun ii -> T_THIS ii); "throw", (fun ii -> T_THROW ii); "true", (fun ii -> T_TRUE ii); "try", (fun ii -> T_TRY ii); "typeof", (fun ii -> T_TYPEOF ii); "var", (fun ii -> T_VAR ii); "void", (fun ii -> T_VOID ii); "while", (fun ii -> T_WHILE ii); "while", (fun ii -> T_WHILE ii); "with", (fun ii -> T_WITH ii); ]; h } (*****************************************************************************) let NEWLINE = ("\r"|"\n"|"\r\n") let hexa = ['0'-'9''a'-'f''A'-'F'] let inputCharacter = [^ '\r' '\n' ] (*****************************************************************************) rule initial tokinfo prev = parse (* ----------------------------------------------------------------------- *) (* spacing/comments *) (* ----------------------------------------------------------------------- *) | "/*" { let info = tokinfo lexbuf in let buf = Buffer.create 127 in let nl = ref false in st_comment buf nl lexbuf; let content = Buffer.contents buf in if !nl then TCommentML(info,content) else TComment(info,content) } (* don't keep the trailing \n; it will be in another token *) | "//" (inputCharacter* as cmt) { TComment(tokinfo lexbuf,cmt) } | ([' ' '\t' ]+ as cmt) { TCommentSpace(tokinfo lexbuf,cmt) } | NEWLINE { lexbuf.Lexing.lex_curr_p <- { lexbuf.Lexing.lex_curr_p with Lexing.pos_lnum = lexbuf.Lexing.lex_curr_p.Lexing.pos_lnum + 1 }; TCommentNewline(tokinfo lexbuf,"") } (* ----------------------------------------------------------------------- *) (* symbols *) (* ----------------------------------------------------------------------- *) | "{" { T_LCURLY (tokinfo lexbuf); } | "}" { T_RCURLY (tokinfo lexbuf); } | "(" { T_LPAREN (tokinfo lexbuf); } | ")" { T_RPAREN (tokinfo lexbuf); } | "[" { T_LBRACKET (tokinfo lexbuf); } | "]" { T_RBRACKET (tokinfo lexbuf); } | "." { T_PERIOD (tokinfo lexbuf); } | ";" { T_SEMICOLON (tokinfo lexbuf); } | "," { T_COMMA (tokinfo lexbuf); } | ":" { T_COLON (tokinfo lexbuf); } | "?" { T_PLING (tokinfo lexbuf); } | "&&" { T_AND (tokinfo lexbuf); } | "||" { T_OR (tokinfo lexbuf); } | "===" { T_STRICT_EQUAL (tokinfo lexbuf); } | "!==" { T_STRICT_NOT_EQUAL (tokinfo lexbuf); } | "<=" { T_LESS_THAN_EQUAL (tokinfo lexbuf); } | ">=" { T_GREATER_THAN_EQUAL (tokinfo lexbuf); } | "==" { T_EQUAL (tokinfo lexbuf); } | "!=" { T_NOT_EQUAL (tokinfo lexbuf); } | "++" { let cpi = tokinfo lexbuf in match prev with | Some p when (Js_token.info_of_tok p).Parse_info.line = cpi.Parse_info.line -> T_INCR_NB(cpi) | _ -> T_INCR(cpi) } | "--" { let cpi = tokinfo lexbuf in match prev with | Some p when (Js_token.info_of_tok p).Parse_info.line = cpi.Parse_info.line -> T_DECR_NB(cpi) | _ -> T_DECR(cpi) } | "<<=" { T_LSHIFT_ASSIGN (tokinfo lexbuf); } | "<<" { T_LSHIFT (tokinfo lexbuf); } | ">>=" { T_RSHIFT_ASSIGN (tokinfo lexbuf); } | ">>>=" { T_RSHIFT3_ASSIGN (tokinfo lexbuf); } | ">>>" { T_RSHIFT3 (tokinfo lexbuf); } | ">>" { T_RSHIFT (tokinfo lexbuf); } | "+=" { T_PLUS_ASSIGN (tokinfo lexbuf); } | "-=" { T_MINUS_ASSIGN (tokinfo lexbuf); } | "*=" { T_MULT_ASSIGN (tokinfo lexbuf); } | "%=" { T_MOD_ASSIGN (tokinfo lexbuf); } | "&=" { T_BIT_AND_ASSIGN (tokinfo lexbuf); } | "|=" { T_BIT_OR_ASSIGN (tokinfo lexbuf); } | "^=" { T_BIT_XOR_ASSIGN (tokinfo lexbuf); } | "<" { T_LESS_THAN (tokinfo lexbuf); } | ">" { T_GREATER_THAN (tokinfo lexbuf); } | "+" { T_PLUS (tokinfo lexbuf); } | "-" { T_MINUS (tokinfo lexbuf); } | "*" { T_MULT (tokinfo lexbuf); } (* for '/' see below the regexp handling *) | "%" { T_MOD (tokinfo lexbuf); } | "|" { T_BIT_OR (tokinfo lexbuf); } | "&" { T_BIT_AND (tokinfo lexbuf); } | "^" { T_BIT_XOR (tokinfo lexbuf); } | "!" { T_NOT (tokinfo lexbuf); } | "~" { T_BIT_NOT (tokinfo lexbuf); } | "=" { T_ASSIGN (tokinfo lexbuf); } (* ----------------------------------------------------------------------- *) (* Keywords and ident *) (* ----------------------------------------------------------------------- *) | ['a'-'z''A'-'Z''$''_']['a'-'z''A'-'Z''$''_''0'-'9']* { let s = tok lexbuf in let info = tokinfo lexbuf in try let f = Hashtbl.find keyword_table s in f info (* need case insensitive ? *) with | Not_found -> T_IDENTIFIER (s, info) } (* ----------------------------------------------------------------------- *) (* Constant *) (* ----------------------------------------------------------------------- *) | "0" ['X''x'] hexa+ { let s = tok lexbuf in let info = tokinfo lexbuf in T_NUMBER (s, info) } | '0'['0'-'7']+ { let s = tok lexbuf in let info = tokinfo lexbuf in T_NUMBER (s, info) } | ['0'-'9']*'.'?['0'-'9']+['e''E']['-''+']?['0'-'9']+ (* {1,3} *) { let s = tok lexbuf in let info = tokinfo lexbuf in T_NUMBER (s, info) } | ['0'-'9']+'.'? | ['0'-'9']*'.'['0'-'9']+ { let s = tok lexbuf in let info = tokinfo lexbuf in T_NUMBER (s, info) } (* ----------------------------------------------------------------------- *) (* Strings *) (* ----------------------------------------------------------------------- *) | ("'"|'"') as quote { let info = tokinfo lexbuf in let buf = Buffer.create 127 in string_quote quote buf lexbuf; let s = Buffer.contents buf in (* s does not contain the enclosing "'" but the info does *) T_STRING (s, info) } (* ----------------------------------------------------------------------- *) (* Regexp *) (* ----------------------------------------------------------------------- *) (* take care of ambiguity with start of comment //, and with * '/' as a divisor operator * * it can not be '/' [^ '/']* '/' because then * comments will not be recognized as lex tries * to find the longest match. * * It can not be * '/' [^'*''/'] ([^'/''\n'])* '/' ['A'-'Z''a'-'z']* * because a / (b/c) will be recognized as a regexp. * *) | "/" | "/=" { let s = tok lexbuf in let info = tokinfo lexbuf in match prev with | Some ( T_IDENTIFIER _ | T_NUMBER _ | T_STRING _ | T_REGEX _ | T_FALSE _ | T_TRUE _ | T_NULL _ | T_THIS _ | T_INCR _ | T_DECR _ | T_RBRACKET _ | T_RPAREN _ ) -> begin match s with | "/" -> T_DIV (info); | "/=" -> T_DIV_ASSIGN info | _ -> assert false end | _ -> (* raise (Token t); *) let buf = Buffer.create 127 in Buffer.add_string buf s; regexp buf lexbuf; T_REGEX (Buffer.contents buf, info) } (* ----------------------------------------------------------------------- *) (* eof *) (* ----------------------------------------------------------------------- *) | eof { EOF (tokinfo lexbuf) } | _ { (* Format.eprintf "LEXER:unrecognised symbol, in token rule: %s@." (tok lexbuf); *) TUnknown (tokinfo lexbuf, tok lexbuf) } (*****************************************************************************) and string_escape quote buf = parse | '\\'{ Buffer.add_string buf "\\\\" } | 'x' hexa hexa | 'u' hexa hexa hexa hexa { Buffer.add_char buf '\\'; Buffer.add_string buf (Lexing.lexeme lexbuf) } | (_ as c) { if c <> '\'' && c <> '\"' then Buffer.add_char buf '\\'; Buffer.add_char buf c } | eof { Format.eprintf "LEXER: WEIRD end of file in string_escape@."; ()} and string_quote q buf = parse | ("'"|'"') as q' { if q = q' then () else (Buffer.add_char buf q'; string_quote q buf lexbuf) } | "\\\n" { string_quote q buf lexbuf } | '\\' { string_escape q buf lexbuf; string_quote q buf lexbuf } | (_ as x) { Buffer.add_char buf x; string_quote q buf lexbuf } | eof { Format.eprintf "LEXER: WEIRD end of file in quoted string@."; ()} (*****************************************************************************) and regexp buf = parse | '\\' (_ as x) { Buffer.add_char buf '\\'; Buffer.add_char buf x; regexp buf lexbuf } | '/' { Buffer.add_char buf '/'; regexp_maybe_ident buf lexbuf } | '[' { Buffer.add_char buf '['; regexp_class buf lexbuf } | (_ as x) { Buffer.add_char buf x; regexp buf lexbuf } | eof { Format.eprintf "LEXER: WEIRD end of file in regexp@."; ()} and regexp_class buf = parse | ']' { Buffer.add_char buf ']'; regexp buf lexbuf } | '\\' (_ as x) { Buffer.add_char buf '\\'; Buffer.add_char buf x; regexp_class buf lexbuf } | (_ as x) { Buffer.add_char buf x; regexp_class buf lexbuf } | eof { Format.eprintf "LEXER: WEIRD end of file in regexp_class@."; ()} and regexp_maybe_ident buf = parse | ['A'-'Z''a'-'z']* { Buffer.add_string buf (tok lexbuf) } (*****************************************************************************) and st_comment buf nl = parse | "*/" { Buffer.add_string buf (tok lexbuf) } (* noteopti: *) | NEWLINE { Buffer.add_string buf (tok lexbuf); nl := true; st_comment buf nl lexbuf } | [^'*' '\n' '\r' ]+ { Buffer.add_string buf (tok lexbuf);st_comment buf nl lexbuf } | '*' { Buffer.add_char buf '*';st_comment buf nl lexbuf } | eof { Format.eprintf "LEXER: end of file in comment@."; Buffer.add_string buf "*/"} | _ { let s = tok lexbuf in Format.eprintf "LEXER: unrecognised symbol in comment: %s@." s; Buffer.add_string buf s; st_comment buf nl lexbuf } and pos = parse | '#' [' ' '\t' ]+ (['0'-'9']+ as line) [' ' '\t' ]+ (("'"|'"') as quote) { let buf = Buffer.create 127 in string_quote quote buf lexbuf; Buffer.contents buf, int_of_string line } js_of_ocaml-3.5.2/compiler/lib/js_output.ml000066400000000000000000001041571357507750000207630ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* XXX Beware automatic semi-colon insertion... a=b ++c is not the same as a=b ++c ===> see so-called "restricted productions": the space cannot be replaced by a newline in the following expressions: e ++, e --, continue e, break e, return e, throw e *) open! Stdlib let stats = Debug.find "output" open Javascript module PP = Pretty_print module Make (D : sig val source_map : Source_map.t option end) = struct let temp_mappings = ref [] let push_mapping, get_file_index, get_name_index, source_map_enabled = let idx_files = ref 0 in let idx_names = ref 0 in let files = Hashtbl.create 17 in let names = Hashtbl.create 17 in match D.source_map with | None -> (fun _ _ -> ()), (fun _ -> -1), (fun _ -> -1), false | Some sm -> List.iter (List.rev sm.Source_map.sources) ~f:(fun f -> Hashtbl.add files f !idx_files; incr idx_files); ( (fun pos m -> temp_mappings := (pos, m) :: !temp_mappings) , (fun file -> try Hashtbl.find files file with Not_found -> let pos = !idx_files in Hashtbl.add files file pos; incr idx_files; sm.Source_map.sources <- file :: sm.Source_map.sources; pos) , (fun name -> try Hashtbl.find names name with Not_found -> let pos = !idx_names in Hashtbl.add names name pos; incr idx_names; sm.Source_map.names <- name :: sm.Source_map.names; pos) , true ) let debug_enabled = Config.Flag.debuginfo () let output_debug_info f loc = (if debug_enabled then match loc with | Pi { Parse_info.name = Some file; line; col; _ } | Pi { Parse_info.src = Some file; line; col; _ } -> PP.non_breaking_space f; PP.string f (Format.sprintf "/*<<%s %d %d>>*/" file (line + 1) col); PP.non_breaking_space f | N -> () | U | Pi _ -> PP.non_breaking_space f; PP.string f "/*<>*/"; PP.non_breaking_space f); if source_map_enabled then match loc with | N -> () | U | Pi { Parse_info.src = None; _ } -> push_mapping (PP.pos f) { Source_map.gen_line = -1 ; gen_col = -1 ; ori_source = -1 ; ori_line = -1 ; ori_col = -1 ; ori_name = None } | Pi { Parse_info.src = Some file; line; col; _ } -> push_mapping (PP.pos f) { Source_map.gen_line = -1 ; gen_col = -1 ; ori_source = get_file_index file ; ori_line = line ; ori_col = col ; ori_name = None } let output_debug_info_ident f nm loc = if source_map_enabled then match loc with | None -> () | Some { Parse_info.src = Some file; line; col; _ } -> push_mapping (PP.pos f) { Source_map.gen_line = -1 ; gen_col = -1 ; ori_source = get_file_index file ; ori_line = line ; ori_col = col ; ori_name = Some (get_name_index nm) } | Some _ -> () let ident f = function | S { name; var = Some v; _ } -> output_debug_info_ident f name (Code.Var.get_loc v); PP.string f name | S { name; var = None; loc = Pi pi } -> output_debug_info_ident f name (Some pi); PP.string f name | S { name; var = None; loc = U | N } -> PP.string f name | V _v -> assert false let opt_identifier f i = match i with | None -> () | Some i -> PP.space f; ident f i let rec formal_parameter_list f l = match l with | [] -> () | [ i ] -> ident f i | i :: r -> ident f i; PP.string f ","; PP.break f; formal_parameter_list f r (* 0 Expression 1 AssignementExpression 2 ConditionalExpression 3 LogicalORExpression 4 LogicalANDExpression 5 BitwiseORExpression 6 BitwiseXORExpression 7 BitwiseANDExpression 8 EqualityExpression 9 RelationalExpression 10 ShiftExpression 11 AdditiveExpression 12 MultiplicativeExpression 13 UnaryExpression 14 PostfixExpression 15 LeftHandsideExpression NewExpression CallExpression 16 MemberExpression FunctionExpression PrimaryExpression *) let op_prec op = match op with | Eq | StarEq | SlashEq | ModEq | PlusEq | MinusEq | LslEq | AsrEq | LsrEq | BandEq | BxorEq | BorEq -> 1, 13, 1 (* | Or -> 3, 3, 4 | And -> 4, 4, 5 | Bor -> 5, 5, 6 | Bxor -> 6, 6, 7 | Band -> 7, 7, 8 *) | Or -> 3, 3, 3 | And -> 4, 4, 4 | Bor -> 5, 5, 5 | Bxor -> 6, 6, 6 | Band -> 7, 7, 7 | EqEq | NotEq | EqEqEq | NotEqEq -> 8, 8, 9 | Gt | Ge | Lt | Le | InstanceOf | In -> 9, 9, 10 | Lsl | Lsr | Asr -> 10, 10, 11 | Plus | Minus -> 11, 11, 12 | Mul | Div | Mod -> 12, 12, 13 let op_str op = match op with | Eq -> "=" | StarEq -> "*=" | SlashEq -> "/=" | ModEq -> "%=" | PlusEq -> "+=" | MinusEq -> "-=" | Or -> "||" | And -> "&&" | Bor -> "|" | Bxor -> "^" | Band -> "&" | EqEq -> "==" | NotEq -> "!=" | EqEqEq -> "===" | NotEqEq -> "!==" | LslEq -> "<<=" | AsrEq -> ">>=" | LsrEq -> ">>>=" | BandEq -> "&=" | BxorEq -> "^=" | BorEq -> "|=" | Lt -> "<" | Le -> "<=" | Gt -> ">" | Ge -> ">=" | Lsl -> "<<" | Lsr -> ">>>" | Asr -> ">>" | Plus -> "+" | Minus -> "-" | Mul -> "*" | Div -> "/" | Mod -> "%" | InstanceOf | In -> assert false let unop_str op = match op with | Not -> "!" | Neg -> "-" | Pl -> "+" | Bnot -> "~" | IncrA | IncrB | DecrA | DecrB | Typeof | Void | Delete -> assert false (*XXX May need to be updated... *) let rec ends_with_if_without_else st = match fst st with | If_statement (_, _, Some st) | While_statement (_, st) | For_statement (_, _, _, st) | ForIn_statement (_, _, st) -> ends_with_if_without_else st | If_statement (_, _, None) -> true | _ -> false let rec need_paren l e = match e with | ESeq (e, _) -> l <= 0 && need_paren 0 e | ECond (e, _, _) -> l <= 2 && need_paren 3 e | EBin (op, e, _) -> let out, lft, _rght = op_prec op in l <= out && need_paren lft e | ECall (e, _, _) | EAccess (e, _) | EDot (e, _) -> l <= 15 && need_paren 15 e | EVar _ | EStr _ | EArr _ | EBool _ | ENum _ | EQuote _ | ERegexp _ | EUn _ | ENew _ -> false | EFun _ | EObj _ -> true let best_string_quote s = let simple = ref 0 and double = ref 0 in for i = 0 to String.length s - 1 do match s.[i] with | '\'' -> incr simple | '"' -> incr double | _ -> () done; if !simple < !double then '\'' else '"' let array_str1 = Array.init 256 ~f:(fun i -> String.make 1 (Char.chr i)) let array_conv = Array.init 16 ~f:(fun i -> String.make 1 "0123456789abcdef".[i]) let pp_string f ?(quote = '"') ?(utf = false) s = let quote_s = String.make 1 quote in PP.string f quote_s; let l = String.length s in for i = 0 to l - 1 do let c = s.[i] in match c with | '\000' when i = l - 1 || not (Char.is_num s.[i + 1]) -> PP.string f "\\0" | '\b' -> PP.string f "\\b" | '\t' -> PP.string f "\\t" | '\n' -> PP.string f "\\n" (* This escape sequence is not supported by IE < 9 | '\011' -> "\\v" *) | '\012' -> PP.string f "\\f" (* https://github.com/ocsigen/js_of_ocaml/issues/898 *) | '/' when i > 0 && Char.equal s.[i - 1] '<' -> PP.string f "\\/" | '\\' when not utf -> PP.string f "\\\\" | '\r' -> PP.string f "\\r" | '\000' .. '\031' | '\127' -> let c = Char.code c in PP.string f "\\x"; PP.string f (Array.unsafe_get array_conv (c lsr 4)); PP.string f (Array.unsafe_get array_conv (c land 0xf)) | '\128' .. '\255' when not utf -> let c = Char.code c in PP.string f "\\x"; PP.string f (Array.unsafe_get array_conv (c lsr 4)); PP.string f (Array.unsafe_get array_conv (c land 0xf)) | _ -> if Char.equal c quote then ( PP.string f "\\"; PP.string f (Array.unsafe_get array_str1 (Char.code c))) else PP.string f (Array.unsafe_get array_str1 (Char.code c)) done; PP.string f quote_s let rec expression l f e = match e with | EVar v -> ident f v | ESeq (e1, e2) -> if l > 0 then ( PP.start_group f 1; PP.string f "("); expression 0 f e1; PP.string f ","; PP.break f; expression 0 f e2; if l > 0 then ( PP.string f ")"; PP.end_group f) | EFun (i, l, b, pc) -> PP.start_group f 1; PP.start_group f 0; PP.start_group f 0; PP.string f "function"; opt_identifier f i; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f "("; formal_parameter_list f l; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f "{"; function_body f b; output_debug_info f pc; PP.string f "}"; PP.end_group f; PP.end_group f | ECall (e, el, loc) -> if l > 15 then ( PP.start_group f 1; PP.string f "("); output_debug_info f loc; PP.start_group f 1; expression 15 f e; PP.break f; PP.start_group f 1; PP.string f "("; arguments f el; PP.string f ")"; PP.end_group f; PP.end_group f; if l > 15 then ( PP.string f ")"; PP.end_group f) | EStr (s, kind) -> let quote = best_string_quote s in pp_string f ~utf:Poly.(kind = `Utf8) ~quote s | EBool b -> PP.string f (if b then "true" else "false") | ENum num -> let s = Num.to_string num in let need_parent = if Num.is_neg num then l > 13 (* Negative numbers may need to be parenthesized. *) else l = 15 (* Parenthesize as well when followed by a dot. *) && (not (Char.equal s.[0] 'I')) (* Infinity *) && not (Char.equal s.[0] 'N') (* NaN *) in if need_parent then PP.string f "("; PP.string f s; if need_parent then PP.string f ")" | EUn (Typeof, e) -> if l > 13 then ( PP.start_group f 1; PP.string f "("); PP.start_group f 0; PP.string f "typeof"; PP.space f; expression 13 f e; PP.end_group f; if l > 13 then ( PP.string f ")"; PP.end_group f) | EUn (Void, e) -> if l > 13 then ( PP.start_group f 1; PP.string f "("); PP.start_group f 0; PP.string f "void"; PP.space f; expression 13 f e; PP.end_group f; if l > 13 then ( PP.string f ")"; PP.end_group f) | EUn (Delete, e) -> if l > 13 then ( PP.start_group f 1; PP.string f "("); PP.start_group f 0; PP.string f "delete"; PP.space f; expression 13 f e; PP.end_group f; if l > 13 then ( PP.string f ")"; PP.end_group f) | EUn (((IncrA | DecrA | IncrB | DecrB) as op), e) -> if l > 13 then ( PP.start_group f 1; PP.string f "("); if Poly.(op = IncrA) || Poly.(op = DecrA) then expression 13 f e; if Poly.(op = IncrA) || Poly.(op = IncrB) then PP.string f "++" else PP.string f "--"; if Poly.(op = IncrB) || Poly.(op = DecrB) then expression 13 f e; if l > 13 then ( PP.string f ")"; PP.end_group f) | EUn (op, e) -> if l > 13 then ( PP.start_group f 1; PP.string f "("); PP.string f (unop_str op); PP.space f; expression 13 f e; if l > 13 then ( PP.string f ")"; PP.end_group f) | EBin (InstanceOf, e1, e2) -> let out, lft, rght = op_prec InstanceOf in if l > out then ( PP.start_group f 1; PP.string f "("); PP.start_group f 0; expression lft f e1; PP.space f; PP.string f "instanceof"; PP.space f; expression rght f e2; PP.end_group f; if l > out then ( PP.string f ")"; PP.end_group f) | EBin (In, e1, e2) -> let out, lft, rght = op_prec InstanceOf in if l > out then ( PP.start_group f 1; PP.string f "("); PP.start_group f 0; expression lft f e1; PP.space f; PP.string f "in"; PP.space f; expression rght f e2; PP.end_group f; if l > out then ( PP.string f ")"; PP.end_group f) | EBin (op, e1, e2) -> let out, lft, rght = op_prec op in if l > out then ( PP.start_group f 1; PP.string f "("); expression lft f e1; PP.space f; PP.string f (op_str op); PP.space f; expression rght f e2; if l > out then ( PP.string f ")"; PP.end_group f) | EArr el -> PP.start_group f 1; PP.string f "["; element_list f el; PP.string f "]"; PP.end_group f | EAccess (e, e') -> if l > 15 then ( PP.start_group f 1; PP.string f "("); PP.start_group f 1; expression 15 f e; PP.break f; PP.start_group f 1; PP.string f "["; expression 0 f e'; PP.string f "]"; PP.end_group f; PP.end_group f; if l > 15 then ( PP.string f ")"; PP.end_group f) | EDot (e, nm) -> if l > 15 then ( PP.start_group f 1; PP.string f "("); expression 15 f e; PP.string f "."; PP.string f nm; if l > 15 then ( PP.string f ")"; PP.end_group f) | ENew (e, None) -> (*FIX: should omit parentheses when possible*) if l > 15 then ( PP.start_group f 1; PP.string f "("); PP.start_group f 1; PP.string f "new"; PP.space f; expression 16 f e; PP.break f; PP.string f "()"; PP.end_group f; if l > 15 then ( PP.string f ")"; PP.end_group f) | ENew (e, Some el) -> if l > 15 then ( PP.start_group f 1; PP.string f "("); PP.start_group f 1; PP.string f "new"; PP.space f; expression 16 f e; PP.break f; PP.start_group f 1; PP.string f "("; arguments f el; PP.string f ")"; PP.end_group f; PP.end_group f; if l > 15 then ( PP.string f ")"; PP.end_group f) | ECond (e, e1, e2) -> if l > 2 then ( PP.start_group f 1; PP.string f "("); PP.start_group f 1; PP.start_group f 0; expression 3 f e; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f "?"; expression 1 f e1; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f ":"; expression 1 f e2; PP.end_group f; PP.end_group f; if l > 2 then ( PP.string f ")"; PP.end_group f) | EObj lst -> PP.start_group f 1; PP.string f "{"; property_name_and_value_list f lst; PP.string f "}"; PP.end_group f | ERegexp (s, opt) -> ( PP.string f "/"; PP.string f s; PP.string f "/"; match opt with | None -> () | Some o -> PP.string f o) | EQuote s -> PP.string f "("; PP.string f s; PP.string f ")" and property_name f n = match n with | PNI s -> PP.string f s | PNS s -> let quote = best_string_quote s in pp_string f ~utf:true ~quote s | PNN v -> expression 0 f (ENum v) and property_name_and_value_list f l = match l with | [] -> () | [ (pn, e) ] -> PP.start_group f 0; property_name f pn; PP.string f ":"; PP.break f; expression 1 f e; PP.end_group f | (pn, e) :: r -> PP.start_group f 0; property_name f pn; PP.string f ":"; PP.break f; expression 1 f e; PP.end_group f; PP.string f ","; PP.break f; property_name_and_value_list f r and element_list f el = match el with | [] -> () | [ e ] -> ( match e with | None -> PP.string f "," | Some e -> PP.start_group f 0; expression 1 f e; PP.end_group f) | e :: r -> (match e with | None -> () | Some e -> PP.start_group f 0; expression 1 f e; PP.end_group f); PP.string f ","; PP.break f; element_list f r and function_body f b = source_elements f ~skip_last_semi:true b and arguments f l = match l with | [] -> () | [ e ] -> PP.start_group f 0; expression 1 f e; PP.end_group f | e :: r -> PP.start_group f 0; expression 1 f e; PP.end_group f; PP.string f ","; PP.break f; arguments f r and variable_declaration f (i, init) = match init with | None -> ident f i | Some (e, pc) -> PP.start_group f 1; output_debug_info f pc; ident f i; PP.string f "="; PP.break f; expression 1 f e; PP.end_group f and variable_declaration_list_aux f l = match l with | [] -> assert false | [ d ] -> variable_declaration f d | d :: r -> variable_declaration f d; PP.string f ","; PP.break f; variable_declaration_list_aux f r and variable_declaration_list close f = function | [] -> () | [ (i, None) ] -> PP.start_group f 1; PP.string f "var"; PP.space f; ident f i; if close then PP.string f ";"; PP.end_group f | [ (i, Some (e, pc)) ] -> PP.start_group f 1; output_debug_info f pc; PP.string f "var"; PP.space f; ident f i; PP.string f "="; PP.break1 f; PP.start_group f 0; expression 1 f e; if close then PP.string f ";"; PP.end_group f; PP.end_group f | l -> PP.start_group f 1; PP.string f "var"; PP.space f; variable_declaration_list_aux f l; if close then PP.string f ";"; PP.end_group f and opt_expression l f e = match e with | None -> () | Some e -> expression l f e and statement ?(last = false) f (s, loc) = let last_semi () = if last then () else PP.string f ";" in output_debug_info f loc; match s with | Block b -> block f b | Variable_statement l -> variable_declaration_list (not last) f l | Empty_statement -> PP.string f ";" | Debugger_statement -> PP.string f "debugger"; last_semi () | Expression_statement (EVar _) -> last_semi () | Expression_statement e -> (* Parentheses are required when the expression starts syntactically with "{" or "function" *) if need_paren 0 e then ( PP.start_group f 1; PP.string f "("; expression 0 f e; PP.string f ")"; last_semi (); PP.end_group f) else ( PP.start_group f 0; expression 0 f e; last_semi (); PP.end_group f) | If_statement (e, s1, (Some _ as s2)) when ends_with_if_without_else s1 -> (* Dangling else issue... *) statement ~last f (If_statement (e, (Block [ s1 ], N), s2), N) | If_statement (e, s1, Some ((Block _, _) as s2)) -> PP.start_group f 0; PP.start_group f 1; PP.string f "if"; PP.break f; PP.start_group f 1; PP.string f "("; expression 0 f e; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break1 f; PP.start_group f 0; statement f s1; PP.end_group f; PP.break f; PP.string f "else"; PP.break1 f; PP.start_group f 0; statement ~last f s2; PP.end_group f; PP.end_group f | If_statement (e, s1, Some s2) -> PP.start_group f 0; PP.start_group f 1; PP.string f "if"; PP.break f; PP.start_group f 1; PP.string f "("; expression 0 f e; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break1 f; PP.start_group f 0; statement f s1; PP.end_group f; PP.break f; PP.string f "else"; PP.space ~indent:1 f; PP.start_group f 0; statement ~last f s2; PP.end_group f; PP.end_group f | If_statement (e, s1, None) -> PP.start_group f 1; PP.start_group f 0; PP.string f "if"; PP.break f; PP.start_group f 1; PP.string f "("; expression 0 f e; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break f; PP.start_group f 0; statement ~last f s1; PP.end_group f; PP.end_group f | While_statement (e, s) -> PP.start_group f 1; PP.start_group f 0; PP.string f "while"; PP.break f; PP.start_group f 1; PP.string f "("; expression 0 f e; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break f; PP.start_group f 0; statement ~last f s; PP.end_group f; PP.end_group f | Do_while_statement (((Block _, _) as s), e) -> PP.start_group f 0; PP.string f "do"; PP.break1 f; PP.start_group f 0; statement f s; PP.end_group f; PP.break f; PP.string f "while"; PP.break1 f; PP.start_group f 1; PP.string f "("; expression 0 f e; PP.string f ")"; last_semi (); PP.end_group f; PP.end_group f | Do_while_statement (s, e) -> PP.start_group f 0; PP.string f "do"; PP.space ~indent:1 f; PP.start_group f 0; statement f s; PP.end_group f; PP.break f; PP.string f "while"; PP.break f; PP.start_group f 1; PP.string f "("; expression 0 f e; PP.string f ")"; last_semi (); PP.end_group f; PP.end_group f | For_statement (e1, e2, e3, s) -> PP.start_group f 1; PP.start_group f 0; PP.string f "for"; PP.break f; PP.start_group f 1; PP.string f "("; (match e1 with | Left e -> opt_expression 0 f e | Right l -> variable_declaration_list false f l); PP.string f ";"; PP.break f; opt_expression 0 f e2; PP.string f ";"; PP.break f; opt_expression 0 f e3; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break f; PP.start_group f 0; statement ~last f s; PP.end_group f; PP.end_group f | ForIn_statement (e1, e2, s) -> PP.start_group f 1; PP.start_group f 0; PP.string f "for"; PP.break f; PP.start_group f 1; PP.string f "("; (match e1 with | Left e -> expression 0 f e | Right v -> variable_declaration_list false f [ v ]); PP.space f; PP.string f "in"; PP.break f; PP.space f; expression 0 f e2; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break f; PP.start_group f 0; statement ~last f s; PP.end_group f; PP.end_group f | Continue_statement None -> PP.string f "continue"; last_semi () | Continue_statement (Some s) -> PP.string f "continue "; PP.string f (Javascript.Label.to_string s); last_semi () | Break_statement None -> PP.string f "break"; last_semi () | Break_statement (Some s) -> PP.string f "break "; PP.string f (Javascript.Label.to_string s); last_semi () | Return_statement e -> ( match e with | None -> PP.string f "return"; last_semi () | Some (EFun (i, l, b, pc)) -> PP.start_group f 1; PP.start_group f 0; PP.start_group f 0; PP.string f "return function"; opt_identifier f i; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f "("; formal_parameter_list f l; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f "{"; function_body f b; output_debug_info f pc; PP.string f "}"; last_semi (); PP.end_group f; PP.end_group f | Some e -> PP.start_group f 7; PP.string f "return"; PP.non_breaking_space f; PP.start_group f 0; expression 0 f e; last_semi (); PP.end_group f; PP.end_group f (* There MUST be a space between the return and its argument. A line return will not work *) ) | Labelled_statement (i, s) -> PP.string f (Javascript.Label.to_string i); PP.string f ":"; PP.break f; statement ~last f s | Switch_statement (e, cc, def, cc') -> PP.start_group f 1; PP.start_group f 0; PP.string f "switch"; PP.break f; PP.start_group f 1; PP.string f "("; expression 0 f e; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f "{"; let output_one last (e, sl) = PP.start_group f 1; PP.start_group f 1; PP.string f "case"; PP.space f; expression 0 f e; PP.string f ":"; PP.end_group f; PP.break f; PP.start_group f 0; statement_list ~skip_last_semi:last f sl; PP.end_group f; PP.end_group f; PP.break f in let rec loop last = function | [] -> () | [ x ] -> output_one last x | x :: xs -> output_one false x; loop last xs in loop (Option.is_none def && List.is_empty cc') cc; (match def with | None -> () | Some def -> PP.start_group f 1; PP.string f "default:"; PP.break f; PP.start_group f 0; statement_list ~skip_last_semi:(List.is_empty cc') f def; PP.end_group f; PP.end_group f); loop true cc'; PP.string f "}"; PP.end_group f; PP.end_group f | Throw_statement e -> PP.start_group f 6; PP.string f "throw"; PP.non_breaking_space f; PP.start_group f 0; expression 0 f e; last_semi (); PP.end_group f; PP.end_group f (* There must be a space between the return and its argument. A line return would not work *) | Try_statement (b, ctch, fin) -> PP.start_group f 0; PP.string f "try"; PP.space ~indent:1 f; block f b; (match ctch with | None -> () | Some (i, b) -> PP.break f; PP.start_group f 1; PP.string f "catch("; ident f i; PP.string f ")"; PP.break f; block f b; PP.end_group f); (match fin with | None -> () | Some b -> PP.break f; PP.start_group f 1; PP.string f "finally"; PP.space f; block f b; PP.end_group f); PP.end_group f and statement_list f ?skip_last_semi b = match b with | [] -> () | [ s ] -> statement f ?last:skip_last_semi s | s :: r -> statement f s; PP.break f; statement_list f ?skip_last_semi r and block f b = PP.start_group f 1; PP.string f "{"; statement_list ~skip_last_semi:true f b; PP.string f "}"; PP.end_group f and source_element f ?skip_last_semi se = match se with | Statement s, loc -> statement f ?last:skip_last_semi (s, loc) | Function_declaration (i, l, b, loc'), loc -> output_debug_info f loc; PP.start_group f 1; PP.start_group f 0; PP.start_group f 0; PP.string f "function"; PP.space f; ident f i; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f "("; formal_parameter_list f l; PP.string f ")"; PP.end_group f; PP.end_group f; PP.break f; PP.start_group f 1; PP.string f "{"; function_body f b; output_debug_info f loc'; PP.string f "}"; PP.end_group f; PP.end_group f and source_elements f ?skip_last_semi se = match se with | [] -> () | [ s ] -> source_element f ?skip_last_semi s | s :: r -> source_element f s; PP.break f; source_elements f ?skip_last_semi r and program f s = source_elements f s end let part_of_ident = let a = Array.init 256 ~f:(fun i -> match Char.chr i with | 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '$' -> true | _ -> false) in fun c -> Array.unsafe_get a (Char.code c) let need_space a b = (* do not concat 2 different identifier *) (part_of_ident a && part_of_ident b) (* do not generate end_of_line_comment. handle the case of "num / /* comment */ b " *) || match a, b with | '/', '/' (* https://github.com/ocsigen/js_of_ocaml/issues/507 *) | '-', '-' | '+', '+' -> true | _, _ -> false let program f ?source_map p = let smo = match source_map with | None -> None | Some (_, sm) -> Some sm in let module O = Make (struct let source_map = smo end) in PP.set_needed_space_function f need_space; PP.start_group f 0; O.program f p; PP.end_group f; PP.newline f; (match source_map with | None -> () | Some (out_file, sm) -> let sm = { sm with Source_map.sources = List.rev sm.Source_map.sources ; Source_map.names = List.rev sm.Source_map.names } in let sources = sm.Source_map.sources in let sources_content = match sm.Source_map.sources_content with | None -> None | Some [] -> Some (List.map sources ~f:(fun file -> if Sys.file_exists file then let content = Fs.read_file file in Some content else None)) | Some _ -> assert false in let mappings = List.map !O.temp_mappings ~f:(fun (pos, m) -> { m with Source_map.gen_line = pos.PP.p_line ; Source_map.gen_col = pos.PP.p_col }) in let sources = match sm.Source_map.sourceroot with | None -> sources | Some root -> let script_file = Filename.chop_extension sm.Source_map.file ^ ".make-sourcemap-links.sh" in let oc = open_out script_file in let printf fmt = Printf.fprintf oc fmt in let targets = List.map sources ~f:(fun src -> Filename.basename src) in printf "#! /bin/bash\n"; printf "mkdir -p %s\n" root; List.iter2 sources targets ~f:(fun src tg -> printf "ln -s %s %s\n" src (Filename.concat root tg)); close_out oc; warn "Source-map info: run 'sh %s' to create links to sources in %s.\n%!" script_file root; targets in let sm = { sm with Source_map.sources; sources_content; mappings } in let urlData = match out_file with | None -> let data = Source_map_io.to_string sm in "data:application/json;base64," ^ Base64.encode_exn data | Some out_file -> Source_map_io.to_file sm out_file; Filename.basename out_file in PP.newline f; PP.string f (Printf.sprintf "//# sourceMappingURL=%s\n" urlData)); if stats () then let size i = Printf.sprintf "%.2fKo" (float_of_int i /. 1024.) in let _percent n d = Printf.sprintf "%.1f%%" (float_of_int n *. 100. /. float_of_int d) in let total_s = PP.total f in Format.eprintf "total size : %s@." (size total_s) js_of_ocaml-3.5.2/compiler/lib/js_output.mli000066400000000000000000000020051357507750000211210ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val program : Pretty_print.t -> ?source_map:string option * Source_map.t -> Javascript.program -> unit js_of_ocaml-3.5.2/compiler/lib/js_parser.conflicts000066400000000000000000000466411357507750000222760ustar00rootroot00000000000000 ** Conflict (shift/reduce) in state 487. ** Tokens involved: T_LPAREN T_LBRACKET ** The following explanations concentrate on token T_LPAREN. ** This state is reached from program after reading: T_VOID T_NEW member_expression ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 487, looking ahead at T_LPAREN, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) expression_statement expression_no_statement assignment_expression_no_statement conditional_expression_no_statement post_in_expression_no_statement pre_in_expression_no_statement T_VOID pre_in_expression left_hand_side_expression new_expression member_expression T_NEW member_expression arguments . T_LPAREN loption(separated_nonempty_list(T_COMMA,assignment_expression)) T_RPAREN ** In state 487, looking ahead at T_LPAREN, reducing production ** new_expression -> member_expression ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_LPAREN statement // lookahead token is inherited statement_need_semi // lookahead token is inherited expression_statement // lookahead token is inherited expression_no_statement // lookahead token is inherited assignment_expression_no_statement // lookahead token is inherited conditional_expression_no_statement // lookahead token is inherited post_in_expression_no_statement // lookahead token is inherited pre_in_expression_no_statement // lookahead token is inherited T_VOID pre_in_expression // lookahead token is inherited left_hand_side_expression // lookahead token is inherited new_expression // lookahead token is inherited T_NEW new_expression // lookahead token is inherited member_expression . ** Conflict (shift/reduce) in state 377. ** Tokens involved: T_LPAREN T_LBRACKET ** The following explanations concentrate on token T_LPAREN. ** This state is reached from program after reading: call_expression_no_statement ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 377, looking ahead at T_LPAREN, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) expression_statement expression_no_statement assignment_expression_no_statement left_hand_side_expression_no_statement assignment_operator assignment_expression call_expression_no_statement call_expression_no_statement arguments . T_LPAREN loption(separated_nonempty_list(T_COMMA,assignment_expression)) T_RPAREN ** In state 377, looking ahead at T_LPAREN, reducing production ** left_hand_side_expression_no_statement -> call_expression_no_statement ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_LPAREN statement // lookahead token is inherited statement_need_semi // lookahead token is inherited expression_statement // lookahead token is inherited expression_no_statement // lookahead token is inherited assignment_expression_no_statement // lookahead token is inherited conditional_expression_no_statement // lookahead token is inherited post_in_expression_no_statement // lookahead token is inherited pre_in_expression_no_statement // lookahead token is inherited left_hand_side_expression_no_statement // lookahead token is inherited call_expression_no_statement . ** Conflict (shift/reduce) in state 350. ** Tokens involved: T_LPAREN T_LBRACKET ** The following explanations concentrate on token T_LPAREN. ** This state is reached from program after reading: member_expression_no_statement ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 350, looking ahead at T_LPAREN, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) expression_statement expression_no_statement assignment_expression_no_statement left_hand_side_expression_no_statement assignment_operator assignment_expression call_expression_no_statement member_expression_no_statement arguments . T_LPAREN loption(separated_nonempty_list(T_COMMA,assignment_expression)) T_RPAREN ** In state 350, looking ahead at T_LPAREN, reducing production ** new_expression_no_statement -> member_expression_no_statement ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_LPAREN statement // lookahead token is inherited statement_need_semi // lookahead token is inherited expression_statement // lookahead token is inherited expression_no_statement // lookahead token is inherited assignment_expression_no_statement // lookahead token is inherited conditional_expression_no_statement // lookahead token is inherited post_in_expression_no_statement // lookahead token is inherited pre_in_expression_no_statement // lookahead token is inherited left_hand_side_expression_no_statement // lookahead token is inherited new_expression_no_statement // lookahead token is inherited member_expression_no_statement . ** Conflict (shift/reduce) in state 296. ** Tokens involved: T_PLUS T_MINUS T_INCR_NB T_DECR_NB ** The following explanations concentrate on token T_PLUS. ** This state is reached from program after reading: pre_in_expression_no_statement ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 296, looking ahead at T_PLUS, reducing production ** post_in_expression_no_statement -> pre_in_expression_no_statement ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_PLUS statement // lookahead token is inherited statement_need_semi // lookahead token is inherited expression_statement // lookahead token is inherited expression_no_statement // lookahead token is inherited assignment_expression_no_statement // lookahead token is inherited conditional_expression_no_statement // lookahead token is inherited post_in_expression_no_statement // lookahead token is inherited pre_in_expression_no_statement . ** In state 296, looking ahead at T_PLUS, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) expression_statement expression_no_statement assignment_expression_no_statement conditional_expression_no_statement post_in_expression_no_statement pre_in_expression_no_statement pre_in_expression_no_statement . T_PLUS pre_in_expression ** Conflict (shift/reduce) in state 285. ** Token involved: T_SEMICOLON ** This state is reached from program after reading: statement_need_semi ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 285, looking ahead at T_SEMICOLON, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) . T_SEMICOLON ** In state 285, looking ahead at T_SEMICOLON, reducing production ** statement -> statement_need_semi ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_SEMICOLON statement // lookahead token is inherited statement_need_semi . ** Conflict (shift/reduce) in state 273. ** Token involved: T_IDENTIFIER ** This state is reached from program after reading: T_BREAK ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 273, looking ahead at T_IDENTIFIER, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) break_statement T_BREAK option(label) label identifier . T_IDENTIFIER ** In state 273, looking ahead at T_IDENTIFIER, reducing production ** option(label) -> ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_IDENTIFIER statement // lookahead token is inherited statement_need_semi // lookahead token is inherited break_statement // lookahead token is inherited T_BREAK option(label) // lookahead token is inherited . ** Conflict (shift/reduce) in state 269. ** Token involved: T_IDENTIFIER ** This state is reached from program after reading: T_CONTINUE ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 269, looking ahead at T_IDENTIFIER, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) continue_statement T_CONTINUE option(label) label identifier . T_IDENTIFIER ** In state 269, looking ahead at T_IDENTIFIER, reducing production ** option(label) -> ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_IDENTIFIER statement // lookahead token is inherited statement_need_semi // lookahead token is inherited continue_statement // lookahead token is inherited T_CONTINUE option(label) // lookahead token is inherited . ** Conflict (shift/reduce) in state 199. ** Tokens involved: T_LPAREN T_LBRACKET ** The following explanations concentrate on token T_LPAREN. ** This state is reached from program after reading: T_NEW member_expression ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 199, looking ahead at T_LPAREN, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) expression_statement expression_no_statement assignment_expression_no_statement left_hand_side_expression_no_statement assignment_operator assignment_expression new_expression_no_statement member_expression_no_statement T_NEW member_expression arguments . T_LPAREN loption(separated_nonempty_list(T_COMMA,assignment_expression)) T_RPAREN ** In state 199, looking ahead at T_LPAREN, reducing production ** new_expression -> member_expression ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_LPAREN statement // lookahead token is inherited statement_need_semi // lookahead token is inherited expression_statement // lookahead token is inherited expression_no_statement // lookahead token is inherited assignment_expression_no_statement // lookahead token is inherited conditional_expression_no_statement // lookahead token is inherited post_in_expression_no_statement // lookahead token is inherited pre_in_expression_no_statement // lookahead token is inherited left_hand_side_expression_no_statement // lookahead token is inherited new_expression_no_statement // lookahead token is inherited T_NEW new_expression // lookahead token is inherited member_expression . ** Conflict (shift/reduce) in state 190. ** Tokens involved: T_VOID T_TYPEOF T_TRUE T_THIS T_STRING T_REGEX T_PLUS T_NUMBER T_NULL T_NOT T_NEW T_MINUS T_LPAREN T_LCURLY T_LBRACKET T_INCR_NB T_INCR T_IDENTIFIER T_FUNCTION T_FALSE T_DELETE T_DECR_NB T_DECR T_BIT_NOT ** The following explanations concentrate on token T_VOID. ** This state is reached from program after reading: T_RETURN ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 190, looking ahead at T_VOID, reducing production ** option(expression) -> ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_VOID statement // lookahead token is inherited statement_need_semi // lookahead token is inherited return_statement // lookahead token is inherited T_RETURN option(expression) // lookahead token is inherited . ** In state 190, looking ahead at T_VOID, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) return_statement T_RETURN option(expression) expression assignment_expression conditional_expression post_in_expression pre_in_expression . T_VOID pre_in_expression ** Conflict (shift/reduce) in state 77. ** Tokens involved: T_LPAREN T_LBRACKET ** The following explanations concentrate on token T_LPAREN. ** This state is reached from program after reading: T_VOID call_expression ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 77, looking ahead at T_LPAREN, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) expression_statement expression_no_statement assignment_expression_no_statement conditional_expression_no_statement post_in_expression_no_statement pre_in_expression_no_statement T_VOID pre_in_expression left_hand_side_expression call_expression call_expression arguments . T_LPAREN loption(separated_nonempty_list(T_COMMA,assignment_expression)) T_RPAREN ** In state 77, looking ahead at T_LPAREN, reducing production ** left_hand_side_expression -> call_expression ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_LPAREN statement // lookahead token is inherited statement_need_semi // lookahead token is inherited expression_statement // lookahead token is inherited expression_no_statement // lookahead token is inherited assignment_expression_no_statement // lookahead token is inherited conditional_expression_no_statement // lookahead token is inherited post_in_expression_no_statement // lookahead token is inherited pre_in_expression_no_statement // lookahead token is inherited T_VOID pre_in_expression // lookahead token is inherited left_hand_side_expression // lookahead token is inherited call_expression . ** Conflict (shift/reduce) in state 66. ** Tokens involved: T_PLUS T_MINUS T_INCR_NB T_DECR_NB ** The following explanations concentrate on token T_PLUS. ** This state is reached from program after reading: T_THROW pre_in_expression ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 66, looking ahead at T_PLUS, reducing production ** post_in_expression -> pre_in_expression ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_PLUS statement // lookahead token is inherited statement_need_semi // lookahead token is inherited throw_statement // lookahead token is inherited T_THROW expression // lookahead token is inherited assignment_expression // lookahead token is inherited conditional_expression // lookahead token is inherited post_in_expression // lookahead token is inherited pre_in_expression . ** In state 66, looking ahead at T_PLUS, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) throw_statement T_THROW expression assignment_expression conditional_expression post_in_expression pre_in_expression pre_in_expression . T_PLUS pre_in_expression ** Conflict (shift/reduce) in state 60. ** Tokens involved: T_LPAREN T_LBRACKET ** The following explanations concentrate on token T_LPAREN. ** This state is reached from program after reading: T_VOID member_expression ** The derivations that appear below have the following common factor: ** (The question mark symbol (?) represents the spot where the derivations begin to differ.) program list(source_element) EOF (?) ** In state 60, looking ahead at T_LPAREN, shifting is permitted ** because of the following sub-derivation: source_element list(source_element) statement statement_need_semi either(T_SEMICOLON,T_VIRTUAL_SEMICOLON) expression_statement expression_no_statement assignment_expression_no_statement conditional_expression_no_statement post_in_expression_no_statement pre_in_expression_no_statement T_VOID pre_in_expression left_hand_side_expression call_expression member_expression arguments . T_LPAREN loption(separated_nonempty_list(T_COMMA,assignment_expression)) T_RPAREN ** In state 60, looking ahead at T_LPAREN, reducing production ** new_expression -> member_expression ** is permitted because of the following sub-derivation: source_element list(source_element) // lookahead token appears because list(source_element) can begin with T_LPAREN statement // lookahead token is inherited statement_need_semi // lookahead token is inherited expression_statement // lookahead token is inherited expression_no_statement // lookahead token is inherited assignment_expression_no_statement // lookahead token is inherited conditional_expression_no_statement // lookahead token is inherited post_in_expression_no_statement // lookahead token is inherited pre_in_expression_no_statement // lookahead token is inherited T_VOID pre_in_expression // lookahead token is inherited left_hand_side_expression // lookahead token is inherited new_expression // lookahead token is inherited member_expression . js_of_ocaml-3.5.2/compiler/lib/js_parser.ml000066400000000000000000050006061357507750000207160ustar00rootroot00000000000000 module MenhirBasics = struct exception Error type token = Js_token.token end include MenhirBasics let _eRR = MenhirBasics.Error type _menhir_env = { _menhir_lexer: Lexing.lexbuf -> token; _menhir_lexbuf: Lexing.lexbuf; _menhir_token: token; mutable _menhir_error: bool } and _menhir_state = | MenhirState528 | MenhirState523 | MenhirState521 | MenhirState520 | MenhirState519 | MenhirState518 | MenhirState516 | MenhirState512 | MenhirState506 | MenhirState499 | MenhirState496 | MenhirState493 | MenhirState491 | MenhirState489 | MenhirState488 | MenhirState482 | MenhirState479 | MenhirState477 | MenhirState475 | MenhirState471 | MenhirState468 | MenhirState466 | MenhirState463 | MenhirState462 | MenhirState457 | MenhirState455 | MenhirState451 | MenhirState446 | MenhirState444 | MenhirState440 | MenhirState437 | MenhirState435 | MenhirState434 | MenhirState432 | MenhirState430 | MenhirState428 | MenhirState425 | MenhirState423 | MenhirState421 | MenhirState416 | MenhirState415 | MenhirState408 | MenhirState406 | MenhirState405 | MenhirState397 | MenhirState390 | MenhirState386 | MenhirState385 | MenhirState381 | MenhirState379 | MenhirState378 | MenhirState375 | MenhirState373 | MenhirState371 | MenhirState369 | MenhirState367 | MenhirState365 | MenhirState363 | MenhirState361 | MenhirState359 | MenhirState357 | MenhirState355 | MenhirState353 | MenhirState351 | MenhirState349 | MenhirState347 | MenhirState345 | MenhirState343 | MenhirState340 | MenhirState339 | MenhirState338 | MenhirState337 | MenhirState336 | MenhirState335 | MenhirState334 | MenhirState333 | MenhirState332 | MenhirState331 | MenhirState330 | MenhirState329 | MenhirState328 | MenhirState327 | MenhirState326 | MenhirState325 | MenhirState324 | MenhirState319 | MenhirState304 | MenhirState303 | MenhirState301 | MenhirState297 | MenhirState295 | MenhirState294 | MenhirState293 | MenhirState292 | MenhirState291 | MenhirState290 | MenhirState289 | MenhirState288 | MenhirState286 | MenhirState282 | MenhirState280 | MenhirState278 | MenhirState276 | MenhirState274 | MenhirState272 | MenhirState270 | MenhirState268 | MenhirState266 | MenhirState264 | MenhirState262 | MenhirState260 | MenhirState258 | MenhirState254 | MenhirState253 | MenhirState252 | MenhirState250 | MenhirState248 | MenhirState246 | MenhirState244 | MenhirState243 | MenhirState242 | MenhirState241 | MenhirState238 | MenhirState236 | MenhirState234 | MenhirState233 | MenhirState232 | MenhirState231 | MenhirState230 | MenhirState229 | MenhirState227 | MenhirState225 | MenhirState224 | MenhirState223 | MenhirState222 | MenhirState221 | MenhirState218 | MenhirState216 | MenhirState214 | MenhirState213 | MenhirState210 | MenhirState207 | MenhirState206 | MenhirState205 | MenhirState204 | MenhirState203 | MenhirState199 | MenhirState196 | MenhirState194 | MenhirState193 | MenhirState192 | MenhirState191 | MenhirState189 | MenhirState188 | MenhirState187 | MenhirState183 | MenhirState181 | MenhirState177 | MenhirState176 | MenhirState175 | MenhirState174 | MenhirState173 | MenhirState172 | MenhirState171 | MenhirState170 | MenhirState169 | MenhirState168 | MenhirState164 | MenhirState160 | MenhirState158 | MenhirState156 | MenhirState154 | MenhirState152 | MenhirState150 | MenhirState148 | MenhirState146 | MenhirState142 | MenhirState129 | MenhirState128 | MenhirState126 | MenhirState124 | MenhirState122 | MenhirState120 | MenhirState118 | MenhirState116 | MenhirState112 | MenhirState110 | MenhirState108 | MenhirState106 | MenhirState105 | MenhirState100 | MenhirState99 | MenhirState98 | MenhirState97 | MenhirState96 | MenhirState95 | MenhirState94 | MenhirState91 | MenhirState89 | MenhirState88 | MenhirState80 | MenhirState75 | MenhirState74 | MenhirState73 | MenhirState72 | MenhirState70 | MenhirState68 | MenhirState67 | MenhirState63 | MenhirState61 | MenhirState57 | MenhirState55 | MenhirState54 | MenhirState52 | MenhirState51 | MenhirState16 | MenhirState15 | MenhirState14 | MenhirState13 | MenhirState12 | MenhirState9 | MenhirState4 | MenhirState3 | MenhirState2 | MenhirState0 # 18 "js_parser.mly" (* * src: ocamlyaccified from Marcel Laverdet 'fbjs2' via emacs macros, itself * extracted from the official ECMAscript specification at: * http://www.ecma-international.org/publications/standards/ecma-262.htm * * see also http://en.wikipedia.org/wiki/ECMAScript_syntax * * related work: * - http://marijnhaverbeke.nl/parse-js/, js parser in common lisp * (which has been since ported to javascript by nodejs people) * - jslint *) module J = Javascript open Js_token let var pi name = J.ident ~loc:(Pi pi) name (* This is need to fake menhir while using `--infer`. *) let _tok = EOF Parse_info.zero # 274 "js_parser.ml" let rec _menhir_run164 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_expression -> ( # 68 "js_parser.mly" (Parse_info.t) # 279 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState164 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState164 and _menhir_goto_expression_no_in : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_expression_no_in -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2129 * _menhir_state * 'tv_expression_no_in) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2123 * _menhir_state * 'tv_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 353 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState440 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState440) : 'freshtv2124) | Js_token.T_SEMICOLON _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2125 * _menhir_state * 'tv_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_expression_no_in)) = _menhir_stack in let _v : 'tv_option_expression_no_in_ = # 116 "" ( Some x ) # 418 "js_parser.ml" in _menhir_goto_option_expression_no_in_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2126) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2127 * _menhir_state * 'tv_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2128)) : 'freshtv2130) and _menhir_goto_separated_or_terminated_list_T_COMMA_object_key_value_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_separated_or_terminated_list_T_COMMA_object_key_value_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState16 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2117 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 438 "js_parser.ml" )) * _menhir_state * 'tv_separated_or_terminated_list_T_COMMA_object_key_value_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RCURLY _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2113 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 448 "js_parser.ml" )) * _menhir_state * 'tv_separated_or_terminated_list_T_COMMA_object_key_value_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 453 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2111 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 460 "js_parser.ml" )) * _menhir_state * 'tv_separated_or_terminated_list_T_COMMA_object_key_value_) = Obj.magic _menhir_stack in let ((pi2 : ( # 68 "js_parser.mly" (Parse_info.t) # 465 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 469 "js_parser.ml" )) = _v in ((let ((_menhir_stack, _menhir_s, (pi1 : ( # 68 "js_parser.mly" (Parse_info.t) # 474 "js_parser.ml" ))), _, (x : 'tv_separated_or_terminated_list_T_COMMA_object_key_value_)) = _menhir_stack in let _v : 'tv_curly_block_separated_or_terminated_list_T_COMMA_object_key_value__ = # 649 "js_parser.mly" ( (x, pi1, pi2) ) # 479 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2109) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_separated_or_terminated_list_T_COMMA_object_key_value__) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2107) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_separated_or_terminated_list_T_COMMA_object_key_value__) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2105) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((block : 'tv_curly_block_separated_or_terminated_list_T_COMMA_object_key_value__) : 'tv_curly_block_separated_or_terminated_list_T_COMMA_object_key_value__) = _v in ((let _v : 'tv_object_literal = # 566 "js_parser.mly" ( let pairs, pi_start, _pi_end = block in pi_start, J.EObj pairs ) # 496 "js_parser.ml" in _menhir_goto_object_literal _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2106)) : 'freshtv2108)) : 'freshtv2110)) : 'freshtv2112)) : 'freshtv2114) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2115 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 506 "js_parser.ml" )) * _menhir_state * 'tv_separated_or_terminated_list_T_COMMA_object_key_value_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2116)) : 'freshtv2118) | MenhirState506 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2121 * _menhir_state * 'tv_object_key_value) * ( # 68 "js_parser.mly" (Parse_info.t) # 515 "js_parser.ml" )) * _menhir_state * 'tv_separated_or_terminated_list_T_COMMA_object_key_value_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2119 * _menhir_state * 'tv_object_key_value) * ( # 68 "js_parser.mly" (Parse_info.t) # 521 "js_parser.ml" )) * _menhir_state * 'tv_separated_or_terminated_list_T_COMMA_object_key_value_) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (x : 'tv_object_key_value)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 526 "js_parser.ml" ))), _, (xs : 'tv_separated_or_terminated_list_T_COMMA_object_key_value_)) = _menhir_stack in let _v : 'tv_separated_or_terminated_list_T_COMMA_object_key_value_ = # 727 "js_parser.mly" ( x :: xs ) # 531 "js_parser.ml" in _menhir_goto_separated_or_terminated_list_T_COMMA_object_key_value_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2120)) : 'freshtv2122) | _ -> _menhir_fail () and _menhir_goto_element_list_rev : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_element_list_rev -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2103 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 544 "js_parser.ml" )) * _menhir_state * 'tv_element_list_rev) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run490 _menhir_env (Obj.magic _menhir_stack) MenhirState496 _v | Js_token.T_RBRACKET _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2101 * _menhir_state * 'tv_element_list_rev) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_element_list_rev)) = _menhir_stack in let _v : 'tv_element_list = # 555 "js_parser.mly" ( List.rev _1 ) # 558 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2099) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_element_list) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2097 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 569 "js_parser.ml" )) * _menhir_state * 'tv_element_list) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2093 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 579 "js_parser.ml" )) * _menhir_state * 'tv_element_list) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 584 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2091 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 591 "js_parser.ml" )) * _menhir_state * 'tv_element_list) = Obj.magic _menhir_stack in let ((_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 596 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 600 "js_parser.ml" )) = _v in ((let ((_menhir_stack, _menhir_s, (pi : ( # 68 "js_parser.mly" (Parse_info.t) # 605 "js_parser.ml" ))), _, (_2 : 'tv_element_list)) = _menhir_stack in let _v : 'tv_array_literal = # 550 "js_parser.mly" ( (pi, J.EArr _2) ) # 610 "js_parser.ml" in _menhir_goto_array_literal _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2092)) : 'freshtv2094) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2095 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 620 "js_parser.ml" )) * _menhir_state * 'tv_element_list) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2096)) : 'freshtv2098)) : 'freshtv2100)) : 'freshtv2102) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState496) : 'freshtv2104) and _menhir_goto_separated_nonempty_list_T_COMMA_assignment_expression_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_separated_nonempty_list_T_COMMA_assignment_expression_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState91 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2085) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_separated_nonempty_list_T_COMMA_assignment_expression_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2083) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((x : 'tv_separated_nonempty_list_T_COMMA_assignment_expression_) : 'tv_separated_nonempty_list_T_COMMA_assignment_expression_) = _v in ((let _v : 'tv_loption_separated_nonempty_list_T_COMMA_assignment_expression__ = # 144 "" ( x ) # 644 "js_parser.ml" in _menhir_goto_loption_separated_nonempty_list_T_COMMA_assignment_expression__ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2084)) : 'freshtv2086) | MenhirState181 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2089 * _menhir_state * 'tv_assignment_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 652 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_separated_nonempty_list_T_COMMA_assignment_expression_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2087 * _menhir_state * 'tv_assignment_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 660 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((xs : 'tv_separated_nonempty_list_T_COMMA_assignment_expression_) : 'tv_separated_nonempty_list_T_COMMA_assignment_expression_) = _v in ((let ((_menhir_stack, _menhir_s, (x : 'tv_assignment_expression)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 667 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_separated_nonempty_list_T_COMMA_assignment_expression_ = # 243 "" ( x :: xs ) # 672 "js_parser.ml" in _menhir_goto_separated_nonempty_list_T_COMMA_assignment_expression_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2088)) : 'freshtv2090) | _ -> _menhir_fail () and _menhir_goto_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState108 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1957 * _menhir_state * 'tv_call_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 687 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1953 * _menhir_state * 'tv_call_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 699 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 704 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1951 * _menhir_state * 'tv_call_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 711 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let ((_4 : ( # 68 "js_parser.mly" (Parse_info.t) # 716 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 720 "js_parser.ml" )) = _v in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_call_expression)), _, (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 725 "js_parser.ml" ))), _, (_3 : 'tv_expression)) = _menhir_stack in let _v : 'tv_call_expression = # 390 "js_parser.mly" ( let (start, e) = _1 in (start, J.EAccess (e, _3)) ) # 730 "js_parser.ml" in _menhir_goto_call_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1952)) : 'freshtv1954) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1955 * _menhir_state * 'tv_call_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 740 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1956)) : 'freshtv1958) | MenhirState183 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1965 * _menhir_state * 'tv_member_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 749 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1961 * _menhir_state * 'tv_member_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 761 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 766 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1959 * _menhir_state * 'tv_member_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 773 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let ((_4 : ( # 68 "js_parser.mly" (Parse_info.t) # 778 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 782 "js_parser.ml" )) = _v in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_member_expression)), _, (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 787 "js_parser.ml" ))), _, (e2 : 'tv_expression)) = _menhir_stack in let _v : 'tv_member_expression = # 402 "js_parser.mly" ( let (start, e1) = _1 in (start, J.EAccess (e1,e2)) ) # 792 "js_parser.ml" in _menhir_goto_member_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1960)) : 'freshtv1962) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1963 * _menhir_state * 'tv_member_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 802 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1964)) : 'freshtv1966) | MenhirState70 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1971 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 811 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 815 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1967 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 827 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 831 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 836 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState191 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState191) : 'freshtv1968) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1969 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 927 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 931 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1970)) : 'freshtv1972) | MenhirState207 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1983 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 940 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1979 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 952 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 957 "js_parser.ml" ))), _, (_2 : 'tv_expression)) = _menhir_stack in let _v : 'tv_throw_statement = # 302 "js_parser.mly" ( (J.Throw_statement _2, J.Pi pi) ) # 962 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1977) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_throw_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1975) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_throw_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1973) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_throw_statement) : 'tv_throw_statement) = _v in ((let _v : 'tv_statement_need_semi = # 183 "js_parser.mly" ( s ) # 979 "js_parser.ml" in _menhir_goto_statement_need_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1974)) : 'freshtv1976)) : 'freshtv1978)) : 'freshtv1980) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1981 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 989 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1982)) : 'freshtv1984) | MenhirState210 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1993 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 998 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1002 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1989 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1014 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1018 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1023 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LCURLY _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1985 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1034 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1038 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 1042 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1047 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_CASE _v -> _menhir_run214 _menhir_env (Obj.magic _menhir_stack) MenhirState213 _v | Js_token.T_DEFAULT _ | Js_token.T_RCURLY _ -> _menhir_reduce119 _menhir_env (Obj.magic _menhir_stack) MenhirState213 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState213) : 'freshtv1986) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1987 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1068 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1072 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 1076 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1988)) : 'freshtv1990) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1991 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1087 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1091 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1992)) : 'freshtv1994) | MenhirState214 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1999 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1100 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1995 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1110 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 1115 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState216 _v | Js_token.T_CASE _ | Js_token.T_DEFAULT _ | Js_token.T_RCURLY _ -> _menhir_reduce123 _menhir_env (Obj.magic _menhir_stack) MenhirState216 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState216) : 'freshtv1996) | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1997 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1210 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1998)) : 'freshtv2000) | MenhirState428 | MenhirState430 | MenhirState421 | MenhirState423 | MenhirState218 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2005 * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2001 * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_expression)) = _menhir_stack in let _v : 'tv_option_expression_ = # 116 "" ( Some x ) # 1229 "js_parser.ml" in _menhir_goto_option_expression_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2002) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2003 * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2004)) : 'freshtv2006) | MenhirState236 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2011 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1244 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1248 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2007 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1260 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1264 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1269 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState238 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState238) : 'freshtv2008) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2009 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1360 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1364 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2010)) : 'freshtv2012) | MenhirState286 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv2017 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1373 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1377 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1381 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 82 "js_parser.mly" (Parse_info.t) # 1385 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv2013 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1397 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1401 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1405 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 82 "js_parser.mly" (Parse_info.t) # 1409 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1414 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState288 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState288) : 'freshtv2014) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv2015 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1505 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1509 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1513 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 82 "js_parser.mly" (Parse_info.t) # 1517 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2016)) : 'freshtv2018) | MenhirState319 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv2031 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1526 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 57 "js_parser.mly" (Parse_info.t) # 1530 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1534 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv2027 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1546 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 57 "js_parser.mly" (Parse_info.t) # 1550 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1554 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1559 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv2025 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1566 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 57 "js_parser.mly" (Parse_info.t) # 1570 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1574 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let ((_3_inlined1 : ( # 68 "js_parser.mly" (Parse_info.t) # 1579 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 1583 "js_parser.ml" )) = _v in ((let (((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 1588 "js_parser.ml" ))), _, (body : 'tv_statement)), (_3 : ( # 57 "js_parser.mly" (Parse_info.t) # 1592 "js_parser.ml" ))), (_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 1596 "js_parser.ml" ))), _, (item : 'tv_expression)) = _menhir_stack in let _v : 'tv_do_while_statement = let condition = let _3 = _3_inlined1 in # 722 "js_parser.mly" ( item ) # 1603 "js_parser.ml" in # 251 "js_parser.mly" ( (J.Do_while_statement (body, condition), J.Pi pi) ) # 1609 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2023) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_do_while_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2021) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_do_while_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2019) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_do_while_statement) : 'tv_do_while_statement) = _v in ((let _v : 'tv_statement_need_semi = # 183 "js_parser.mly" ( s ) # 1626 "js_parser.ml" in _menhir_goto_statement_need_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2020)) : 'freshtv2022)) : 'freshtv2024)) : 'freshtv2026)) : 'freshtv2028) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv2029 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1636 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 57 "js_parser.mly" (Parse_info.t) # 1640 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1644 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2030)) : 'freshtv2032) | MenhirState381 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2039 * _menhir_state * 'tv_member_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1653 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2035 * _menhir_state * 'tv_member_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1665 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1670 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2033 * _menhir_state * 'tv_member_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1677 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let ((_4 : ( # 68 "js_parser.mly" (Parse_info.t) # 1682 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 1686 "js_parser.ml" )) = _v in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_member_expression_no_statement)), _, (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 1691 "js_parser.ml" ))), _, (e2 : 'tv_expression)) = _menhir_stack in let _v : 'tv_member_expression_no_statement = # 506 "js_parser.mly" ( let (start, e1) = _1 in (start, J.EAccess(e1, e2)) ) # 1696 "js_parser.ml" in _menhir_goto_member_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2034)) : 'freshtv2036) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2037 * _menhir_state * 'tv_member_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1706 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2038)) : 'freshtv2040) | MenhirState408 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2047 * _menhir_state * 'tv_call_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1715 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2043 * _menhir_state * 'tv_call_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1727 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1732 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2041 * _menhir_state * 'tv_call_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1739 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let ((_4 : ( # 68 "js_parser.mly" (Parse_info.t) # 1744 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 1748 "js_parser.ml" )) = _v in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_call_expression_no_statement)), _, (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 1753 "js_parser.ml" ))), _, (_3 : 'tv_expression)) = _menhir_stack in let _v : 'tv_call_expression_no_statement = # 498 "js_parser.mly" ( let (start, e) = _1 in (start, J.EAccess(e, _3)) ) # 1758 "js_parser.ml" in _menhir_goto_call_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2042)) : 'freshtv2044) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2045 * _menhir_state * 'tv_call_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1768 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2046)) : 'freshtv2048) | MenhirState435 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv2053 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1777 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1781 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 1785 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv2049 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1797 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1801 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 1805 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1810 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState437 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState437) : 'freshtv2050) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv2051 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1901 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1905 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 1909 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2052)) : 'freshtv2054) | MenhirState14 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2061 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1918 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2057 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1930 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 1935 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2055 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1942 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let ((_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 1947 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 1951 "js_parser.ml" )) = _v in ((let ((_menhir_stack, _menhir_s, (pi : ( # 68 "js_parser.mly" (Parse_info.t) # 1956 "js_parser.ml" ))), _, (e : 'tv_expression)) = _menhir_stack in let _v : 'tv_primary_expression_no_statement = # 423 "js_parser.mly" ( (pi, e) ) # 1961 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv2056)) : 'freshtv2058) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv2059 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 1971 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2060)) : 'freshtv2062) | MenhirState2 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2067 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1980 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 1984 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2063 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 1996 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 2000 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 2005 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState523 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState523) : 'freshtv2064) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv2065 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 2096 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 2100 "js_parser.ml" )) * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2066)) : 'freshtv2068) | MenhirState528 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2081 * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.EOF _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2077 * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let (_v : ( # 104 "js_parser.mly" (Parse_info.t) # 2116 "js_parser.ml" )) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2075 * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in let ((_2 : ( # 104 "js_parser.mly" (Parse_info.t) # 2123 "js_parser.ml" )) : ( # 104 "js_parser.mly" (Parse_info.t) # 2127 "js_parser.ml" )) = _v in ((let (_menhir_stack, _menhir_s, (e : 'tv_expression)) = _menhir_stack in let _v : ( # 133 "js_parser.mly" (Javascript.expression) # 2133 "js_parser.ml" ) = # 145 "js_parser.mly" ( e ) # 2137 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2073) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : ( # 133 "js_parser.mly" (Javascript.expression) # 2145 "js_parser.ml" )) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2071) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : ( # 133 "js_parser.mly" (Javascript.expression) # 2153 "js_parser.ml" )) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2069) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 133 "js_parser.mly" (Javascript.expression) # 2161 "js_parser.ml" )) : ( # 133 "js_parser.mly" (Javascript.expression) # 2165 "js_parser.ml" )) = _v in (Obj.magic _1 : 'freshtv2070)) : 'freshtv2072)) : 'freshtv2074)) : 'freshtv2076)) : 'freshtv2078) | Js_token.T_COMMA _v -> _menhir_run164 _menhir_env (Obj.magic _menhir_stack) _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv2079 * _menhir_state * 'tv_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv2080)) : 'freshtv2082) | _ -> _menhir_fail () and _menhir_goto_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1949 * _menhir_state * 'tv_expression_no_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1937 * _menhir_state * 'tv_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 2194 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState397 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState397) : 'freshtv1938) | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1945 * _menhir_state * 'tv_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_expression_no_statement)) = _menhir_stack in let _v : 'tv_expression_statement = # 241 "js_parser.mly" ( J.Expression_statement _1, J.N ) # 2259 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1943) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_expression_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1941) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_expression_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1939) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_expression_statement) : 'tv_expression_statement) = _v in ((let _v : 'tv_statement_need_semi = # 183 "js_parser.mly" ( s ) # 2276 "js_parser.ml" in _menhir_goto_statement_need_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1940)) : 'freshtv1942)) : 'freshtv1944)) : 'freshtv1946) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1947 * _menhir_state * 'tv_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1948)) : 'freshtv1950) and _menhir_goto_assignment_expression_no_in : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_assignment_expression_no_in -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState254 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1901 * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * 'tv_assignment_operator) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1899 * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * 'tv_assignment_operator) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_left_hand_side_expression)), _, (_2 : 'tv_assignment_operator)), _, (_3 : 'tv_assignment_expression_no_in)) = _menhir_stack in let _v : 'tv_assignment_expression_no_in = # 436 "js_parser.mly" ( J.EBin(_2,_1,_3) ) # 2300 "js_parser.ml" in _menhir_goto_assignment_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1900)) : 'freshtv1902) | MenhirState252 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1907 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 2308 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1903 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 2318 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 2323 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState258 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState258) : 'freshtv1904) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1905 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 2388 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1906)) : 'freshtv1908) | MenhirState258 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1917 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 2397 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 2401 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1915 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 2407 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 2411 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (((((_menhir_stack, _menhir_s, (condition : 'tv_post_in_expression_no_in)), (_2 : ( # 82 "js_parser.mly" (Parse_info.t) # 2416 "js_parser.ml" ))), _, (consequence : 'tv_assignment_expression_no_in)), (_4 : ( # 82 "js_parser.mly" (Parse_info.t) # 2420 "js_parser.ml" ))), _, (alternative : 'tv_assignment_expression_no_in)) = _menhir_stack in let _v : 'tv_ternary_post_in_expression_no_in_assignment_expression_no_in_ = # 364 "js_parser.mly" ( J.ECond (condition, consequence, alternative) ) # 2425 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1913) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_ternary_post_in_expression_no_in_assignment_expression_no_in_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1911) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_ternary_post_in_expression_no_in_assignment_expression_no_in_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1909) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_ternary_post_in_expression_no_in_assignment_expression_no_in_) : 'tv_ternary_post_in_expression_no_in_assignment_expression_no_in_) = _v in ((let _v : 'tv_conditional_expression_no_in = # 440 "js_parser.mly" ( _1 ) # 2442 "js_parser.ml" in _menhir_goto_conditional_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1910)) : 'freshtv1912)) : 'freshtv1914)) : 'freshtv1916)) : 'freshtv1918) | MenhirState244 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1927 * _menhir_state * ( # 77 "js_parser.mly" (Parse_info.t) # 2450 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1925 * _menhir_state * ( # 77 "js_parser.mly" (Parse_info.t) # 2456 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 2461 "js_parser.ml" ))), _, (_2 : 'tv_assignment_expression_no_in)) = _menhir_stack in let _v : 'tv_initializer_no_in = # 277 "js_parser.mly" ( _2, J.Pi _1 ) # 2466 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1923) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_initializer_no_in) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1921) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_initializer_no_in) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1919) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((x : 'tv_initializer_no_in) : 'tv_initializer_no_in) = _v in ((let _v : 'tv_option_initializer_no_in_ = # 116 "" ( Some x ) # 2483 "js_parser.ml" in _menhir_goto_option_initializer_no_in_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1920)) : 'freshtv1922)) : 'freshtv1924)) : 'freshtv1926)) : 'freshtv1928) | MenhirState440 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1931 * _menhir_state * 'tv_expression_no_in) * ( # 68 "js_parser.mly" (Parse_info.t) # 2491 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1929 * _menhir_state * 'tv_expression_no_in) * ( # 68 "js_parser.mly" (Parse_info.t) # 2497 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_expression_no_in)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 2502 "js_parser.ml" ))), _, (_3 : 'tv_assignment_expression_no_in)) = _menhir_stack in let _v : 'tv_expression_no_in = # 431 "js_parser.mly" ( J.ESeq (_1, _3) ) # 2507 "js_parser.ml" in _menhir_goto_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1930)) : 'freshtv1932) | MenhirState241 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1935 * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1933 * _menhir_state * 'tv_assignment_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_assignment_expression_no_in)) = _menhir_stack in let _v : 'tv_expression_no_in = # 430 "js_parser.mly" ( _1 ) # 2519 "js_parser.ml" in _menhir_goto_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1934)) : 'freshtv1936) | _ -> _menhir_fail () and _menhir_goto_assignment_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_assignment_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState142 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1803 * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * 'tv_assignment_operator) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1801 * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * 'tv_assignment_operator) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_left_hand_side_expression)), _, (_2 : 'tv_assignment_operator)), _, (_3 : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_assignment_expression = # 351 "js_parser.mly" ( J.EBin (_2, _1, _3) ) # 2538 "js_parser.ml" in _menhir_goto_assignment_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1802)) : 'freshtv1804) | MenhirState128 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1809 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2546 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1805 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2556 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 2561 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState146 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState146) : 'freshtv1806) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1807 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2626 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1808)) : 'freshtv1810) | MenhirState146 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1819 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2635 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2639 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1817 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2645 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2649 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (((((_menhir_stack, _menhir_s, (condition : 'tv_post_in_expression)), (_2 : ( # 82 "js_parser.mly" (Parse_info.t) # 2654 "js_parser.ml" ))), _, (consequence : 'tv_assignment_expression)), (_4 : ( # 82 "js_parser.mly" (Parse_info.t) # 2658 "js_parser.ml" ))), _, (alternative : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_ternary_post_in_expression_assignment_expression_ = # 364 "js_parser.mly" ( J.ECond (condition, consequence, alternative) ) # 2663 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1815) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_ternary_post_in_expression_assignment_expression_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1813) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_ternary_post_in_expression_assignment_expression_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1811) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_ternary_post_in_expression_assignment_expression_) : 'tv_ternary_post_in_expression_assignment_expression_) = _v in ((let _v : 'tv_conditional_expression = # 359 "js_parser.mly" ( _1 ) # 2680 "js_parser.ml" in _menhir_goto_conditional_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1812)) : 'freshtv1814)) : 'freshtv1816)) : 'freshtv1818)) : 'freshtv1820) | MenhirState164 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1823 * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 2688 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1821 * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 2694 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_expression)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 2699 "js_parser.ml" ))), _, (_3 : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_expression = # 346 "js_parser.mly" ( J.ESeq (_1, _3) ) # 2704 "js_parser.ml" in _menhir_goto_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1822)) : 'freshtv1824) | MenhirState528 | MenhirState2 | MenhirState14 | MenhirState70 | MenhirState210 | MenhirState214 | MenhirState236 | MenhirState435 | MenhirState428 | MenhirState430 | MenhirState421 | MenhirState423 | MenhirState286 | MenhirState408 | MenhirState381 | MenhirState319 | MenhirState218 | MenhirState207 | MenhirState183 | MenhirState108 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1827 * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1825 * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_expression = # 345 "js_parser.mly" ( _1 ) # 2716 "js_parser.ml" in _menhir_goto_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1826)) : 'freshtv1828) | MenhirState181 | MenhirState91 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1835 * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1829 * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 2731 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState181 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState181) : 'freshtv1830) | Js_token.T_RPAREN _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1831 * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_separated_nonempty_list_T_COMMA_assignment_expression_ = # 241 "" ( [ x ] ) # 2796 "js_parser.ml" in _menhir_goto_separated_nonempty_list_T_COMMA_assignment_expression_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1832) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1833 * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1834)) : 'freshtv1836) | MenhirState196 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1845 * ( # 77 "js_parser.mly" (Parse_info.t) # 2811 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1843 * ( # 77 "js_parser.mly" (Parse_info.t) # 2817 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, (pi : ( # 77 "js_parser.mly" (Parse_info.t) # 2822 "js_parser.ml" ))), _, (e : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_initializer_ = # 232 "js_parser.mly" ( e, J.Pi pi ) # 2827 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1841) = _menhir_stack in let (_v : 'tv_initializer_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1839) = Obj.magic _menhir_stack in let (_v : 'tv_initializer_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1837) = Obj.magic _menhir_stack in let ((x : 'tv_initializer_) : 'tv_initializer_) = _v in ((let _v : 'tv_option_initializer__ = # 116 "" ( Some x ) # 2841 "js_parser.ml" in _menhir_goto_option_initializer__ _menhir_env _menhir_stack _v) : 'freshtv1838)) : 'freshtv1840)) : 'freshtv1842)) : 'freshtv1844)) : 'freshtv1846) | MenhirState347 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1851 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 2849 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1847 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 2859 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 2864 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState349 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState349) : 'freshtv1848) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1849 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 2929 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1850)) : 'freshtv1852) | MenhirState349 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1861 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 2938 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2942 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1859 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 2948 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 2952 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (((((_menhir_stack, _menhir_s, (condition : 'tv_post_in_expression_no_statement)), (_2 : ( # 82 "js_parser.mly" (Parse_info.t) # 2957 "js_parser.ml" ))), _, (consequence : 'tv_assignment_expression)), (_4 : ( # 82 "js_parser.mly" (Parse_info.t) # 2961 "js_parser.ml" ))), _, (alternative : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_ternary_post_in_expression_no_statement_assignment_expression_ = # 364 "js_parser.mly" ( J.ECond (condition, consequence, alternative) ) # 2966 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1857) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_ternary_post_in_expression_no_statement_assignment_expression_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1855) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_ternary_post_in_expression_no_statement_assignment_expression_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1853) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_ternary_post_in_expression_no_statement_assignment_expression_) : 'tv_ternary_post_in_expression_no_statement_assignment_expression_) = _v in ((let _v : 'tv_conditional_expression_no_statement = # 464 "js_parser.mly" ( _1 ) # 2983 "js_parser.ml" in _menhir_goto_conditional_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1854)) : 'freshtv1856)) : 'freshtv1858)) : 'freshtv1860)) : 'freshtv1862) | MenhirState386 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1865 * _menhir_state * 'tv_left_hand_side_expression_no_statement) * _menhir_state * 'tv_assignment_operator) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1863 * _menhir_state * 'tv_left_hand_side_expression_no_statement) * _menhir_state * 'tv_assignment_operator) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_left_hand_side_expression_no_statement)), _, (_2 : 'tv_assignment_operator)), _, (_3 : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_assignment_expression_no_statement = # 460 "js_parser.mly" ( J.EBin (_2,_1,_3) ) # 2995 "js_parser.ml" in _menhir_goto_assignment_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1864)) : 'freshtv1866) | MenhirState397 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1869 * _menhir_state * 'tv_expression_no_statement) * ( # 68 "js_parser.mly" (Parse_info.t) # 3003 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1867 * _menhir_state * 'tv_expression_no_statement) * ( # 68 "js_parser.mly" (Parse_info.t) # 3009 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_expression_no_statement)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 3014 "js_parser.ml" ))), _, (_3 : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_expression_no_statement = # 455 "js_parser.mly" ( J.ESeq(_1,_3) ) # 3019 "js_parser.ml" in _menhir_goto_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1868)) : 'freshtv1870) | MenhirState491 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1873 * _menhir_state * 'tv_elison_rev) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1871 * _menhir_state * 'tv_elison_rev) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : 'tv_elison_rev)), _, (_2 : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_element_list_rev = # 558 "js_parser.mly" ( (Some _2)::_1 ) # 3031 "js_parser.ml" in _menhir_goto_element_list_rev _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1872)) : 'freshtv1874) | MenhirState499 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1877 * _menhir_state * 'tv_element_list_rev) * _menhir_state * 'tv_elison) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1875 * _menhir_state * 'tv_element_list_rev) * _menhir_state * 'tv_elison) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (_1 : 'tv_element_list_rev)), _, (_2 : 'tv_elison)), _, (_3 : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_element_list_rev = # 560 "js_parser.mly" ( (Some _3) :: (List.rev_append _2 _1) ) # 3043 "js_parser.ml" in _menhir_goto_element_list_rev _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1876)) : 'freshtv1878) | MenhirState52 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1881 * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1879 * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_element_list_rev = # 559 "js_parser.mly" ( [Some _1] ) # 3055 "js_parser.ml" in _menhir_goto_element_list_rev _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1880)) : 'freshtv1882) | MenhirState51 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1897 * _menhir_state * 'tv_property_name) * ( # 82 "js_parser.mly" (Parse_info.t) # 3063 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1895 * _menhir_state * 'tv_property_name) * ( # 82 "js_parser.mly" (Parse_info.t) # 3069 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (x : 'tv_property_name)), (_2 : ( # 82 "js_parser.mly" (Parse_info.t) # 3074 "js_parser.ml" ))), _, (y : 'tv_assignment_expression)) = _menhir_stack in let _v : 'tv_object_key_value = let pair = # 175 "" ( (x, y) ) # 3079 "js_parser.ml" in # 569 "js_parser.mly" ( pair ) # 3084 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1893) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_object_key_value) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1891 * _menhir_state * 'tv_object_key_value) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1885 * _menhir_state * 'tv_object_key_value) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 3102 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BREAK _v -> _menhir_run47 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_CASE _v -> _menhir_run46 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_CATCH _v -> _menhir_run45 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_CONTINUE _v -> _menhir_run44 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_DEBUGGER _v -> _menhir_run43 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_DEFAULT _v -> _menhir_run42 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_DELETE _v -> _menhir_run41 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_DO _v -> _menhir_run40 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_ELSE _v -> _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_FALSE _v -> _menhir_run38 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_FINALLY _v -> _menhir_run37 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_FOR _v -> _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_FUNCTION _v -> _menhir_run35 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_IDENTIFIER _v -> _menhir_run34 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_IF _v -> _menhir_run33 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_IN _v -> _menhir_run32 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_INSTANCEOF _v -> _menhir_run31 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_NEW _v -> _menhir_run30 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_NULL _v -> _menhir_run29 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_RETURN _v -> _menhir_run28 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_STRING _v -> _menhir_run27 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_SWITCH _v -> _menhir_run26 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_THIS _v -> _menhir_run25 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_THROW _v -> _menhir_run24 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_TRUE _v -> _menhir_run23 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_TRY _v -> _menhir_run22 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_TYPEOF _v -> _menhir_run21 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_VAR _v -> _menhir_run20 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_VOID _v -> _menhir_run19 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_WHILE _v -> _menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_WITH _v -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState506 _v | Js_token.T_RCURLY _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1883 * _menhir_state * 'tv_object_key_value) * ( # 68 "js_parser.mly" (Parse_info.t) # 3177 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (x : 'tv_object_key_value)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 3182 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_separated_or_terminated_list_T_COMMA_object_key_value_ = # 726 "js_parser.mly" ( [x] ) # 3187 "js_parser.ml" in _menhir_goto_separated_or_terminated_list_T_COMMA_object_key_value_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1884) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState506) : 'freshtv1886) | Js_token.T_RCURLY _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1887 * _menhir_state * 'tv_object_key_value) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_object_key_value)) = _menhir_stack in let _v : 'tv_separated_or_terminated_list_T_COMMA_object_key_value_ = # 725 "js_parser.mly" ( [x] ) # 3201 "js_parser.ml" in _menhir_goto_separated_or_terminated_list_T_COMMA_object_key_value_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1888) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1889 * _menhir_state * 'tv_object_key_value) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1890)) : 'freshtv1892)) : 'freshtv1894)) : 'freshtv1896)) : 'freshtv1898) | _ -> _menhir_fail () and _menhir_goto_assignment_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_assignment_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1799) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_assignment_expression_no_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1797) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_assignment_expression_no_statement) : 'tv_assignment_expression_no_statement) = _v in ((let _v : 'tv_expression_no_statement = # 454 "js_parser.mly" ( _1 ) # 3227 "js_parser.ml" in _menhir_goto_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1798)) : 'freshtv1800) and _menhir_goto_conditional_expression_no_in : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_conditional_expression_no_in -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1795) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_conditional_expression_no_in) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1793) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_conditional_expression_no_in) : 'tv_conditional_expression_no_in) = _v in ((let _v : 'tv_assignment_expression_no_in = # 434 "js_parser.mly" ( _1 ) # 3244 "js_parser.ml" in _menhir_goto_assignment_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1794)) : 'freshtv1796) and _menhir_goto_conditional_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_conditional_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1791) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_conditional_expression) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1789) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_conditional_expression) : 'tv_conditional_expression) = _v in ((let _v : 'tv_assignment_expression = # 349 "js_parser.mly" ( _1 ) # 3261 "js_parser.ml" in _menhir_goto_assignment_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1790)) : 'freshtv1792) and _menhir_run110 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3268 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState110 and _menhir_run126 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3331 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState126 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState126 and _menhir_run150 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3394 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState150 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState150 and _menhir_run112 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3457 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState112 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState112 and _menhir_run116 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3520 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState116 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState116 and _menhir_run118 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3583 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState118 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState118 and _menhir_run120 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3646 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState120 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState120 and _menhir_run122 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3709 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState122 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState122 and _menhir_run124 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3772 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState124 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState124 and _menhir_run152 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3835 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState152 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState152 and _menhir_run154 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3898 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState154 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState154 and _menhir_run158 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 3961 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState158 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState158 and _menhir_run156 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 4024 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState156 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState156 and _menhir_run160 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_post_in_expression -> ( # 82 "js_parser.mly" (Parse_info.t) # 4087 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState160 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState160 and _menhir_goto_conditional_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_conditional_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1787) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_conditional_expression_no_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1785) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_conditional_expression_no_statement) : 'tv_conditional_expression_no_statement) = _v in ((let _v : 'tv_assignment_expression_no_statement = # 458 "js_parser.mly" ( _1 ) # 4160 "js_parser.ml" in _menhir_goto_assignment_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1786)) : 'freshtv1788) and _menhir_goto_postfix_operator : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_postfix_operator -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState521 | MenhirState520 | MenhirState519 | MenhirState518 | MenhirState512 | MenhirState489 | MenhirState488 | MenhirState340 | MenhirState338 | MenhirState336 | MenhirState334 | MenhirState332 | MenhirState330 | MenhirState328 | MenhirState326 | MenhirState304 | MenhirState295 | MenhirState293 | MenhirState291 | MenhirState246 | MenhirState234 | MenhirState232 | MenhirState230 | MenhirState224 | MenhirState222 | MenhirState204 | MenhirState193 | MenhirState189 | MenhirState188 | MenhirState187 | MenhirState94 | MenhirState177 | MenhirState175 | MenhirState96 | MenhirState173 | MenhirState98 | MenhirState171 | MenhirState169 | MenhirState100 | MenhirState80 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1779 * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_postfix_operator) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1777 * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((op : 'tv_postfix_operator) : 'tv_postfix_operator) = _v in ((let (_menhir_stack, _menhir_s, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = # 378 "js_parser.mly" ( J.EUn (op, e) ) # 4180 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1778)) : 'freshtv1780) | MenhirState324 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1783 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_postfix_operator) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1781 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((op : 'tv_postfix_operator) : 'tv_postfix_operator) = _v in ((let (_menhir_stack, _menhir_s, (e : 'tv_pre_in_expression_no_statement)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = # 478 "js_parser.mly" ( J.EUn (op, e) ) # 4196 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1782)) : 'freshtv1784) | _ -> _menhir_fail () and _menhir_goto_post_in_expression_no_in : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_post_in_expression_no_in -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1775 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_AND _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1741 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4216 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState282 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState282) : 'freshtv1742) | Js_token.T_BIT_AND _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1743 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4280 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState280 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState280) : 'freshtv1744) | Js_token.T_BIT_OR _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1745 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4344 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState278 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState278) : 'freshtv1746) | Js_token.T_BIT_XOR _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1747 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4408 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState276 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState276) : 'freshtv1748) | Js_token.T_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1749 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4472 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState274 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState274) : 'freshtv1750) | Js_token.T_GREATER_THAN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1751 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4536 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState272 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState272) : 'freshtv1752) | Js_token.T_GREATER_THAN_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1753 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4600 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState270 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState270) : 'freshtv1754) | Js_token.T_INSTANCEOF _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1755 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4664 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState268 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState268) : 'freshtv1756) | Js_token.T_LESS_THAN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1757 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4728 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState266 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState266) : 'freshtv1758) | Js_token.T_LESS_THAN_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1759 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4792 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState264 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState264) : 'freshtv1760) | Js_token.T_NOT_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1761 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4856 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState262 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState262) : 'freshtv1762) | Js_token.T_OR _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1763 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4920 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState260 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState260) : 'freshtv1764) | Js_token.T_PLING _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1765 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 4984 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState252 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState252) : 'freshtv1766) | Js_token.T_STRICT_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1767 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 5048 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState250 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState250) : 'freshtv1768) | Js_token.T_STRICT_NOT_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1769 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 5112 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState248 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState248) : 'freshtv1770) | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_IN _ | Js_token.T_SEMICOLON _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1771 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_post_in_expression_no_in)) = _menhir_stack in let _v : 'tv_conditional_expression_no_in = # 439 "js_parser.mly" ( _1 ) # 5177 "js_parser.ml" in _menhir_goto_conditional_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1772) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1773 * _menhir_state * 'tv_post_in_expression_no_in) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1774)) : 'freshtv1776) and _menhir_goto_post_in_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_post_in_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState528 | MenhirState2 | MenhirState14 | MenhirState51 | MenhirState499 | MenhirState491 | MenhirState52 | MenhirState435 | MenhirState430 | MenhirState428 | MenhirState423 | MenhirState421 | MenhirState408 | MenhirState397 | MenhirState386 | MenhirState381 | MenhirState349 | MenhirState347 | MenhirState319 | MenhirState286 | MenhirState236 | MenhirState218 | MenhirState214 | MenhirState210 | MenhirState207 | MenhirState196 | MenhirState70 | MenhirState183 | MenhirState181 | MenhirState91 | MenhirState164 | MenhirState146 | MenhirState142 | MenhirState128 | MenhirState108 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1509 * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_AND _v -> _menhir_run160 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_OR _v -> _menhir_run158 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_OR _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1501 * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 5228 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState148 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState148) : 'freshtv1502) | Js_token.T_PLING _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1503 * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 5292 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState128 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState128) : 'freshtv1504) | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1505 * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_conditional_expression = # 358 "js_parser.mly" ( _1 ) # 5361 "js_parser.ml" in _menhir_goto_conditional_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1506) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1507 * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1508)) : 'freshtv1510) | MenhirState110 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1515 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5376 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1511 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5398 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5403 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 664 "js_parser.mly" ( J.NotEqEq ) # 5409 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5414 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5420 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1512) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1513 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5430 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1514)) : 'freshtv1516) | MenhirState112 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1519 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5439 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1517 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5445 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5450 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 658 "js_parser.mly" ( J.Le ) # 5456 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5461 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5467 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1518)) : 'freshtv1520) | MenhirState116 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1523 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5475 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1521 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5481 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5486 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 656 "js_parser.mly" ( J.Lt ) # 5492 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5497 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5503 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1522)) : 'freshtv1524) | MenhirState118 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1527 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5511 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1525 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5517 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5522 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 660 "js_parser.mly" ( J.InstanceOf ) # 5528 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5533 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5539 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1526)) : 'freshtv1528) | MenhirState120 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1531 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5547 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1529 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5553 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5558 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = # 673 "js_parser.mly" ( J.In ) # 5563 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5568 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1530)) : 'freshtv1532) | MenhirState122 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1535 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5576 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1533 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5582 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5587 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 659 "js_parser.mly" ( J.Ge ) # 5593 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5598 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5604 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1534)) : 'freshtv1536) | MenhirState124 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1539 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5612 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1537 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5618 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5623 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 657 "js_parser.mly" ( J.Gt ) # 5629 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5634 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5640 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1538)) : 'freshtv1540) | MenhirState126 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1545 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5648 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1541 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5670 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5675 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 663 "js_parser.mly" ( J.EqEqEq ) # 5681 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5686 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5692 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1542) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1543 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5702 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1544)) : 'freshtv1546) | MenhirState148 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1551 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5711 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_AND _v -> _menhir_run160 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_OR _v -> _menhir_run158 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1547 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5749 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5754 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 669 "js_parser.mly" ( J.Or ) # 5760 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5765 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5771 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1548) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1549 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5781 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1550)) : 'freshtv1552) | MenhirState150 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1557 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5790 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1553 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5812 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5817 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 662 "js_parser.mly" ( J.NotEq ) # 5823 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5828 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5834 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1554) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1555 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5844 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1556)) : 'freshtv1558) | MenhirState152 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1563 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5853 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1559 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5875 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5880 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 661 "js_parser.mly" ( J.EqEq ) # 5886 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5891 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5897 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1560) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1561 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5907 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1562)) : 'freshtv1564) | MenhirState154 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1569 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5916 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1565 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5948 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 5953 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 666 "js_parser.mly" ( J.Bxor ) # 5959 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 5964 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 5970 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1566) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1567 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5980 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1568)) : 'freshtv1570) | MenhirState156 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1575 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 5989 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1571 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 6019 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6024 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 665 "js_parser.mly" ( J.Band ) # 6030 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 6035 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 6041 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1572) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1573 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 6051 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1574)) : 'freshtv1576) | MenhirState158 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1581 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 6060 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1577 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 6094 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6099 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 667 "js_parser.mly" ( J.Bor ) # 6105 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 6110 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 6116 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1578) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1579 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 6126 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1580)) : 'freshtv1582) | MenhirState160 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1587 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 6135 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_OR _v -> _menhir_run158 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1583 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 6171 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6176 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = let op = let op = # 668 "js_parser.mly" ( J.And ) # 6182 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 6187 "js_parser.ml" in # 371 "js_parser.mly" ( J.EBin (op, left, right) ) # 6193 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1584) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1585 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 6203 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1586)) : 'freshtv1588) | MenhirState248 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1593 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6212 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_EQUAL _ | Js_token.T_NOT_EQUAL _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1589 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6234 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6239 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 664 "js_parser.mly" ( J.NotEqEq ) # 6244 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6249 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1590) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1591 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6259 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1592)) : 'freshtv1594) | MenhirState250 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1599 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6268 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_EQUAL _ | Js_token.T_NOT_EQUAL _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1595 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6290 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6295 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 663 "js_parser.mly" ( J.EqEqEq ) # 6300 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6305 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1596) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1597 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6315 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1598)) : 'freshtv1600) | MenhirState260 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1605 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6324 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_AND _v -> _menhir_run160 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_OR _v -> _menhir_run158 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1601 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6362 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6367 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 669 "js_parser.mly" ( J.Or ) # 6372 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6377 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1602) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1603 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6387 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1604)) : 'freshtv1606) | MenhirState262 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1611 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6396 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_EQUAL _ | Js_token.T_NOT_EQUAL _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1607 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6418 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6423 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 662 "js_parser.mly" ( J.NotEq ) # 6428 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6433 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1608) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1609 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6443 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1610)) : 'freshtv1612) | MenhirState264 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1615 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6452 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1613 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6458 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6463 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 658 "js_parser.mly" ( J.Le ) # 6468 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6473 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1614)) : 'freshtv1616) | MenhirState266 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1619 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6481 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1617 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6487 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6492 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 656 "js_parser.mly" ( J.Lt ) # 6497 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6502 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1618)) : 'freshtv1620) | MenhirState268 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1623 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6510 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1621 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6516 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6521 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 660 "js_parser.mly" ( J.InstanceOf ) # 6526 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6531 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1622)) : 'freshtv1624) | MenhirState270 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1627 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6539 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1625 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6545 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6550 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 659 "js_parser.mly" ( J.Ge ) # 6555 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6560 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1626)) : 'freshtv1628) | MenhirState272 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1631 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6568 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1629 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6574 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6579 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 657 "js_parser.mly" ( J.Gt ) # 6584 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6589 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1630)) : 'freshtv1632) | MenhirState274 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1637 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6597 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_EQUAL _ | Js_token.T_NOT_EQUAL _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1633 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6619 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6624 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 661 "js_parser.mly" ( J.EqEq ) # 6629 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6634 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1634) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1635 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6644 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1636)) : 'freshtv1638) | MenhirState276 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1643 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6653 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1639 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6685 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6690 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 666 "js_parser.mly" ( J.Bxor ) # 6695 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6700 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1640) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1641 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6710 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1642)) : 'freshtv1644) | MenhirState278 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1649 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6719 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_AND _ | Js_token.T_BIT_OR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1645 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6753 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6758 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 667 "js_parser.mly" ( J.Bor ) # 6763 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6768 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1646) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1647 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6778 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1648)) : 'freshtv1650) | MenhirState280 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1655 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6787 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1651 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6817 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6822 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 665 "js_parser.mly" ( J.Band ) # 6827 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6832 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1652) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1653 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6842 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1654)) : 'freshtv1656) | MenhirState282 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1661 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6851 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_OR _v -> _menhir_run158 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_AND _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1657 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6887 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_in)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6892 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = let op = # 668 "js_parser.mly" ( J.And ) # 6897 "js_parser.ml" in # 447 "js_parser.mly" ( J.EBin (op, left, right) ) # 6902 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1658) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1659 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 6912 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1660)) : 'freshtv1662) | MenhirState343 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1667 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 6921 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1663 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 6943 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 6948 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 664 "js_parser.mly" ( J.NotEqEq ) # 6954 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 6959 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 6965 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1664) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1665 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 6975 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1666)) : 'freshtv1668) | MenhirState345 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1673 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 6984 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1669 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7006 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7011 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 663 "js_parser.mly" ( J.EqEqEq ) # 7017 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7022 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7028 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1670) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1671 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7038 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1672)) : 'freshtv1674) | MenhirState351 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1679 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7047 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_AND _v -> _menhir_run160 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_OR _v -> _menhir_run158 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1675 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7085 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7090 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 669 "js_parser.mly" ( J.Or ) # 7096 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7101 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7107 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1676) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1677 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7117 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1678)) : 'freshtv1680) | MenhirState353 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1685 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7126 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1681 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7148 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7153 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 662 "js_parser.mly" ( J.NotEq ) # 7159 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7164 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7170 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1682) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1683 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7180 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1684)) : 'freshtv1686) | MenhirState355 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1689 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7189 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1687 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7195 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7200 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 658 "js_parser.mly" ( J.Le ) # 7206 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7211 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7217 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1688)) : 'freshtv1690) | MenhirState357 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1693 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7225 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1691 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7231 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7236 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 656 "js_parser.mly" ( J.Lt ) # 7242 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7247 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7253 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1692)) : 'freshtv1694) | MenhirState359 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1697 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7261 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1695 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7267 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7272 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 660 "js_parser.mly" ( J.InstanceOf ) # 7278 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7283 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7289 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1696)) : 'freshtv1698) | MenhirState361 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1701 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7297 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1699 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7303 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7308 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = # 673 "js_parser.mly" ( J.In ) # 7313 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7318 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1700)) : 'freshtv1702) | MenhirState363 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1705 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7326 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1703 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7332 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7337 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 659 "js_parser.mly" ( J.Ge ) # 7343 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7348 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7354 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1704)) : 'freshtv1706) | MenhirState365 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1709 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7362 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1707 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7368 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7373 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 657 "js_parser.mly" ( J.Gt ) # 7379 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7384 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7390 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1708)) : 'freshtv1710) | MenhirState367 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1715 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7398 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1711 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7420 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7425 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 661 "js_parser.mly" ( J.EqEq ) # 7431 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7436 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7442 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1712) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1713 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7452 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1714)) : 'freshtv1716) | MenhirState369 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1721 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7461 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1717 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7493 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7498 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 666 "js_parser.mly" ( J.Bxor ) # 7504 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7509 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7515 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1718) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1719 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7525 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1720)) : 'freshtv1722) | MenhirState371 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1727 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7534 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1723 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7568 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7573 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 667 "js_parser.mly" ( J.Bor ) # 7579 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7584 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7590 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1724) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1725 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7600 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1726)) : 'freshtv1728) | MenhirState373 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1733 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7609 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1729 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7639 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7644 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 665 "js_parser.mly" ( J.Band ) # 7650 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7655 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7661 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1730) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1731 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7671 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1732)) : 'freshtv1734) | MenhirState375 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1739 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7680 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_AND _v -> _menhir_run156 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_OR _v -> _menhir_run158 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_BIT_XOR _v -> _menhir_run154 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_EQUAL _v -> _menhir_run152 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN _v -> _menhir_run124 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_GREATER_THAN_EQUAL _v -> _menhir_run122 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> _menhir_run120 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_INSTANCEOF _v -> _menhir_run118 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN _v -> _menhir_run116 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_LESS_THAN_EQUAL _v -> _menhir_run112 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_NOT_EQUAL _v -> _menhir_run150 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_EQUAL _v -> _menhir_run126 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_STRICT_NOT_EQUAL _v -> _menhir_run110 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1735 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7716 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_post_in_expression_no_statement)), (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 7721 "js_parser.ml" ))), _, (right : 'tv_post_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = let op = let op = # 668 "js_parser.mly" ( J.And ) # 7727 "js_parser.ml" in # 672 "js_parser.mly" ( op ) # 7732 "js_parser.ml" in # 471 "js_parser.mly" ( J.EBin (op, left, right) ) # 7738 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1736) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1737 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 7748 "js_parser.ml" )) * _menhir_state * 'tv_post_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1738)) : 'freshtv1740) | _ -> _menhir_fail () and _menhir_run95 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_pre_in_expression -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 7758 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState95 and _menhir_run174 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_pre_in_expression -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 7821 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState174 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState174 and _menhir_run97 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_pre_in_expression -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 7884 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState97 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState97 and _menhir_run99 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_pre_in_expression -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 7947 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState99 and _menhir_run168 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_pre_in_expression -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 8010 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState168 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState168 and _menhir_run172 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_pre_in_expression -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 8073 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState172 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState172 and _menhir_run176 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_pre_in_expression -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 8136 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState176 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState176 and _menhir_run170 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_pre_in_expression -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 8199 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState170 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState170 and _menhir_goto_post_in_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_post_in_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1499 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_AND _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1463 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8273 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState375 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState375) : 'freshtv1464) | Js_token.T_BIT_AND _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1465 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8337 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState373 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState373) : 'freshtv1466) | Js_token.T_BIT_OR _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1467 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8401 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState371 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState371) : 'freshtv1468) | Js_token.T_BIT_XOR _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1469 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8465 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState369 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState369) : 'freshtv1470) | Js_token.T_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1471 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8529 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState367 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState367) : 'freshtv1472) | Js_token.T_GREATER_THAN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1473 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8593 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState365 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState365) : 'freshtv1474) | Js_token.T_GREATER_THAN_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1475 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8657 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState363 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState363) : 'freshtv1476) | Js_token.T_IN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1477 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8721 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState361 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState361) : 'freshtv1478) | Js_token.T_INSTANCEOF _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1479 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8785 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState359 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState359) : 'freshtv1480) | Js_token.T_LESS_THAN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1481 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8849 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState357 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState357) : 'freshtv1482) | Js_token.T_LESS_THAN_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1483 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8913 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState355 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState355) : 'freshtv1484) | Js_token.T_NOT_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1485 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 8977 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState353 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState353) : 'freshtv1486) | Js_token.T_OR _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1487 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 9041 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState351 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState351) : 'freshtv1488) | Js_token.T_PLING _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1489 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 9105 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState347 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState347) : 'freshtv1490) | Js_token.T_STRICT_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1491 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 9169 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState345 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState345) : 'freshtv1492) | Js_token.T_STRICT_NOT_EQUAL _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1493 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 9233 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState343 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState343) : 'freshtv1494) | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1495 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_post_in_expression_no_statement)) = _menhir_stack in let _v : 'tv_conditional_expression_no_statement = # 463 "js_parser.mly" ( _1 ) # 9298 "js_parser.ml" in _menhir_goto_conditional_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1496) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1497 * _menhir_state * 'tv_post_in_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1498)) : 'freshtv1500) and _menhir_run81 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 9312 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1461) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9322 "js_parser.ml" )) : ( # 82 "js_parser.mly" (Parse_info.t) # 9326 "js_parser.ml" )) = _v in ((let _v : 'tv_postfix_operator = # 699 "js_parser.mly" ( J.IncrA ) # 9331 "js_parser.ml" in _menhir_goto_postfix_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1462) and _menhir_run82 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 9338 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1459) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9348 "js_parser.ml" )) : ( # 82 "js_parser.mly" (Parse_info.t) # 9352 "js_parser.ml" )) = _v in ((let _v : 'tv_postfix_operator = # 700 "js_parser.mly" ( J.DecrA ) # 9357 "js_parser.ml" in _menhir_goto_postfix_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1460) and _menhir_goto_assignment_operator : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_assignment_operator -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState129 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1453 * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * 'tv_assignment_operator) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState142 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState142) : 'freshtv1454) | MenhirState434 | MenhirState253 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1455 * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * 'tv_assignment_operator) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState254 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState254) : 'freshtv1456) | MenhirState385 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1457 * _menhir_state * 'tv_left_hand_side_expression_no_statement) * _menhir_state * 'tv_assignment_operator) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState386 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState386) : 'freshtv1458) | _ -> _menhir_fail () and _menhir_goto_pre_in_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_pre_in_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState75 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1295 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9551 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState80 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState80 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1293 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9565 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9570 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 695 "js_parser.mly" ( J.Bnot ) # 9575 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 9580 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1294) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState80) : 'freshtv1296) | MenhirState528 | MenhirState2 | MenhirState14 | MenhirState51 | MenhirState499 | MenhirState491 | MenhirState52 | MenhirState435 | MenhirState430 | MenhirState428 | MenhirState423 | MenhirState421 | MenhirState408 | MenhirState397 | MenhirState386 | MenhirState381 | MenhirState375 | MenhirState373 | MenhirState371 | MenhirState369 | MenhirState367 | MenhirState365 | MenhirState363 | MenhirState361 | MenhirState359 | MenhirState357 | MenhirState355 | MenhirState353 | MenhirState351 | MenhirState349 | MenhirState347 | MenhirState345 | MenhirState343 | MenhirState319 | MenhirState286 | MenhirState282 | MenhirState280 | MenhirState278 | MenhirState276 | MenhirState274 | MenhirState272 | MenhirState270 | MenhirState268 | MenhirState266 | MenhirState264 | MenhirState262 | MenhirState260 | MenhirState250 | MenhirState248 | MenhirState236 | MenhirState218 | MenhirState214 | MenhirState210 | MenhirState207 | MenhirState196 | MenhirState70 | MenhirState183 | MenhirState181 | MenhirState164 | MenhirState160 | MenhirState158 | MenhirState156 | MenhirState154 | MenhirState152 | MenhirState150 | MenhirState148 | MenhirState146 | MenhirState142 | MenhirState128 | MenhirState126 | MenhirState124 | MenhirState122 | MenhirState120 | MenhirState118 | MenhirState116 | MenhirState112 | MenhirState110 | MenhirState108 | MenhirState91 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1299 * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_LSHIFT _v -> _menhir_run176 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_MINUS _v -> _menhir_run172 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_PLUS _v -> _menhir_run97 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_RSHIFT _v -> _menhir_run174 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.T_RSHIFT3 _v -> _menhir_run95 _menhir_env (Obj.magic _menhir_stack) MenhirState94 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1297 * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression = # 367 "js_parser.mly" ( _1 ) # 9620 "js_parser.ml" in _menhir_goto_post_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1298) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState94) : 'freshtv1300) | MenhirState95 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1303 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9632 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState96 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState96 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState96 _v | Js_token.T_MINUS _v -> _menhir_run172 _menhir_env (Obj.magic _menhir_stack) MenhirState96 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState96 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState96 _v | Js_token.T_PLUS _v -> _menhir_run97 _menhir_env (Obj.magic _menhir_stack) MenhirState96 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1301 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9656 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9661 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 683 "js_parser.mly" ( J.Lsr ) # 9666 "js_parser.ml" in # 382 "js_parser.mly" ( J.EBin (op, left, right) ) # 9671 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1302) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState96) : 'freshtv1304) | MenhirState97 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1307 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9683 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState98 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState98 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState98 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState98 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState98 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1305 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9703 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9708 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 679 "js_parser.mly" ( J.Plus ) # 9713 "js_parser.ml" in # 382 "js_parser.mly" ( J.EBin (op, left, right) ) # 9718 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1306) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState98) : 'freshtv1308) | MenhirState99 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1311 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9730 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState100 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState100 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1309 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9744 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9749 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 676 "js_parser.mly" ( J.Mul ) # 9754 "js_parser.ml" in # 382 "js_parser.mly" ( J.EBin (op, left, right) ) # 9759 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1310) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState100) : 'freshtv1312) | MenhirState168 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1315 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9771 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState169 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState169 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1313 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9785 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9790 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 678 "js_parser.mly" ( J.Mod ) # 9795 "js_parser.ml" in # 382 "js_parser.mly" ( J.EBin (op, left, right) ) # 9800 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1314) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState169) : 'freshtv1316) | MenhirState170 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1319 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9812 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState171 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState171 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1317 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9826 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9831 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 677 "js_parser.mly" ( J.Div ) # 9836 "js_parser.ml" in # 382 "js_parser.mly" ( J.EBin (op, left, right) ) # 9841 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1318) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState171) : 'freshtv1320) | MenhirState172 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1323 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9853 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState173 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState173 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState173 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState173 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState173 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1321 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9873 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9878 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 680 "js_parser.mly" ( J.Minus ) # 9883 "js_parser.ml" in # 382 "js_parser.mly" ( J.EBin (op, left, right) ) # 9888 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1322) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState173) : 'freshtv1324) | MenhirState174 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1327 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9900 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState175 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState175 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState175 _v | Js_token.T_MINUS _v -> _menhir_run172 _menhir_env (Obj.magic _menhir_stack) MenhirState175 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState175 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState175 _v | Js_token.T_PLUS _v -> _menhir_run97 _menhir_env (Obj.magic _menhir_stack) MenhirState175 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1325 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9924 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9929 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 682 "js_parser.mly" ( J.Asr ) # 9934 "js_parser.ml" in # 382 "js_parser.mly" ( J.EBin (op, left, right) ) # 9939 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1326) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState175) : 'freshtv1328) | MenhirState176 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1331 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9951 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState177 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState177 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState177 _v | Js_token.T_MINUS _v -> _menhir_run172 _menhir_env (Obj.magic _menhir_stack) MenhirState177 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState177 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState177 _v | Js_token.T_PLUS _v -> _menhir_run97 _menhir_env (Obj.magic _menhir_stack) MenhirState177 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1329 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 9975 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 9980 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 681 "js_parser.mly" ( J.Lsl ) # 9985 "js_parser.ml" in # 382 "js_parser.mly" ( J.EBin (op, left, right) ) # 9990 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1330) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState177) : 'freshtv1332) | MenhirState74 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1335 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10002 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState187 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState187 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1333 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10016 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10021 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 691 "js_parser.mly" ( J.DecrB ) # 10026 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 10031 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1334) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState187) : 'freshtv1336) | MenhirState73 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1339 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10043 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState188 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState188 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1337 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10057 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10062 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 692 "js_parser.mly" ( J.DecrB ) # 10067 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 10072 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1338) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState188) : 'freshtv1340) | MenhirState72 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1343 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10084 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState189 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState189 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1341 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10098 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10103 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 686 "js_parser.mly" ( J.Delete ) # 10108 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 10113 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1342) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState189) : 'freshtv1344) | MenhirState192 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1347 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10125 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState193 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState193 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1345 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10139 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10144 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 687 "js_parser.mly" ( J.Void ) # 10149 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10154 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1346) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState193) : 'freshtv1348) | MenhirState203 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1351 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10166 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState204 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState204 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1349 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10180 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10185 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 688 "js_parser.mly" ( J.Typeof ) # 10190 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10195 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1350) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState204) : 'freshtv1352) | MenhirState221 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1355 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10207 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState222 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState222 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState222 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState222 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState222 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1353 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10227 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10232 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 693 "js_parser.mly" ( J.Pl ) # 10237 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10242 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1354) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState222) : 'freshtv1356) | MenhirState223 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1359 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10254 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState224 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState224 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1357 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10268 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10273 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 696 "js_parser.mly" ( J.Not ) # 10278 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10283 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1358) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState224) : 'freshtv1360) | MenhirState229 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1363 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10295 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState230 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState230 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState230 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState230 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState230 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1361 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10315 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10320 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 694 "js_parser.mly" ( J.Neg ) # 10325 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10330 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1362) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState230) : 'freshtv1364) | MenhirState231 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1367 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10342 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState232 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState232 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1365 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10356 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10361 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 690 "js_parser.mly" ( J.IncrB ) # 10366 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10371 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1366) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState232) : 'freshtv1368) | MenhirState233 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1371 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10383 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState234 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState234 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1369 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10397 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10402 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 689 "js_parser.mly" ( J.IncrB ) # 10407 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10412 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1370) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState234) : 'freshtv1372) | MenhirState440 | MenhirState241 | MenhirState258 | MenhirState254 | MenhirState252 | MenhirState244 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1375 * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_LSHIFT _v -> _menhir_run176 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_MINUS _v -> _menhir_run172 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_PLUS _v -> _menhir_run97 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_RSHIFT _v -> _menhir_run174 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_RSHIFT3 _v -> _menhir_run95 _menhir_env (Obj.magic _menhir_stack) MenhirState246 _v | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_EQUAL _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IN _ | Js_token.T_INSTANCEOF _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_NOT_EQUAL _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1373 * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_post_in_expression_no_in = # 443 "js_parser.mly" ( _1 ) # 10452 "js_parser.ml" in _menhir_goto_post_in_expression_no_in _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1374) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState246) : 'freshtv1376) | MenhirState290 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1379 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10464 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState291 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState291 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1377 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10478 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10483 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 686 "js_parser.mly" ( J.Delete ) # 10488 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10493 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1378) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState291) : 'freshtv1380) | MenhirState292 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1383 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10505 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState293 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState293 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1381 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10519 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10524 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 692 "js_parser.mly" ( J.DecrB ) # 10529 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10534 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1382) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState293) : 'freshtv1384) | MenhirState294 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1387 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10546 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState295 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState295 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1385 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10560 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10565 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 691 "js_parser.mly" ( J.DecrB ) # 10570 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10575 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1386) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState295) : 'freshtv1388) | MenhirState303 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1391 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10587 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState304 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState304 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1389 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10601 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10606 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 695 "js_parser.mly" ( J.Bnot ) # 10611 "js_parser.ml" in # 478 "js_parser.mly" ( J.EUn (op, e) ) # 10616 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1390) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState304) : 'freshtv1392) | MenhirState325 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1395 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10628 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState326 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState326 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState326 _v | Js_token.T_MINUS _v -> _menhir_run172 _menhir_env (Obj.magic _menhir_stack) MenhirState326 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState326 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState326 _v | Js_token.T_PLUS _v -> _menhir_run97 _menhir_env (Obj.magic _menhir_stack) MenhirState326 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1393 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10652 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression_no_statement)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10657 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 683 "js_parser.mly" ( J.Lsr ) # 10662 "js_parser.ml" in # 482 "js_parser.mly" ( J.EBin (op, left, right) ) # 10667 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1394) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState326) : 'freshtv1396) | MenhirState327 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1399 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10679 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState328 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState328 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState328 _v | Js_token.T_MINUS _v -> _menhir_run172 _menhir_env (Obj.magic _menhir_stack) MenhirState328 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState328 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState328 _v | Js_token.T_PLUS _v -> _menhir_run97 _menhir_env (Obj.magic _menhir_stack) MenhirState328 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1397 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10703 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression_no_statement)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10708 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 682 "js_parser.mly" ( J.Asr ) # 10713 "js_parser.ml" in # 482 "js_parser.mly" ( J.EBin (op, left, right) ) # 10718 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1398) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState328) : 'freshtv1400) | MenhirState329 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1403 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10730 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState330 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState330 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState330 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState330 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState330 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1401 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10750 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression_no_statement)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10755 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 679 "js_parser.mly" ( J.Plus ) # 10760 "js_parser.ml" in # 482 "js_parser.mly" ( J.EBin (op, left, right) ) # 10765 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1402) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState330) : 'freshtv1404) | MenhirState331 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1407 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10777 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState332 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState332 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1405 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10791 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression_no_statement)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10796 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 676 "js_parser.mly" ( J.Mul ) # 10801 "js_parser.ml" in # 482 "js_parser.mly" ( J.EBin (op, left, right) ) # 10806 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1406) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState332) : 'freshtv1408) | MenhirState333 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1411 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10818 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState334 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState334 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1409 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10832 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression_no_statement)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10837 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 678 "js_parser.mly" ( J.Mod ) # 10842 "js_parser.ml" in # 482 "js_parser.mly" ( J.EBin (op, left, right) ) # 10847 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1410) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState334) : 'freshtv1412) | MenhirState335 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1415 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10859 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState336 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState336 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState336 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState336 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState336 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1413 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10879 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression_no_statement)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10884 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 680 "js_parser.mly" ( J.Minus ) # 10889 "js_parser.ml" in # 482 "js_parser.mly" ( J.EBin (op, left, right) ) # 10894 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1414) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState336) : 'freshtv1416) | MenhirState337 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1419 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10906 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState338 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState338 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState338 _v | Js_token.T_MINUS _v -> _menhir_run172 _menhir_env (Obj.magic _menhir_stack) MenhirState338 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState338 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState338 _v | Js_token.T_PLUS _v -> _menhir_run97 _menhir_env (Obj.magic _menhir_stack) MenhirState338 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1417 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10930 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression_no_statement)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10935 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 681 "js_parser.mly" ( J.Lsl ) # 10940 "js_parser.ml" in # 482 "js_parser.mly" ( J.EBin (op, left, right) ) # 10945 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1418) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState338) : 'freshtv1420) | MenhirState339 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1423 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10957 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState340 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState340 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1421 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10971 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (left : 'tv_pre_in_expression_no_statement)), _, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 10976 "js_parser.ml" ))), _, (right : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = let op = # 677 "js_parser.mly" ( J.Div ) # 10981 "js_parser.ml" in # 482 "js_parser.mly" ( J.EBin (op, left, right) ) # 10986 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1422) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState340) : 'freshtv1424) | MenhirState55 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1427 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 10998 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState488 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState488 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1425 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11012 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 11017 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 689 "js_parser.mly" ( J.IncrB ) # 11022 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 11027 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1426) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState488) : 'freshtv1428) | MenhirState54 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1431 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11039 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState489 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState489 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1429 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11053 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 11058 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 690 "js_parser.mly" ( J.IncrB ) # 11063 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 11068 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1430) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState489) : 'freshtv1432) | MenhirState15 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1435 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11080 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState512 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState512 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState512 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState512 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState512 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1433 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11100 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 11105 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 694 "js_parser.mly" ( J.Neg ) # 11110 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 11115 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1434) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState512) : 'freshtv1436) | MenhirState12 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1439 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11127 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState518 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState518 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1437 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11141 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 11146 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 696 "js_parser.mly" ( J.Not ) # 11151 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 11156 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1438) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState518) : 'freshtv1440) | MenhirState9 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1443 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11168 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState519 _v | Js_token.T_DIV _v -> _menhir_run170 _menhir_env (Obj.magic _menhir_stack) MenhirState519 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState519 _v | Js_token.T_MOD _v -> _menhir_run168 _menhir_env (Obj.magic _menhir_stack) MenhirState519 _v | Js_token.T_MULT _v -> _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState519 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1441 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11188 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 11193 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 693 "js_parser.mly" ( J.Pl ) # 11198 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 11203 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1442) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState519) : 'freshtv1444) | MenhirState4 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1447 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11215 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState520 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState520 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1445 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11229 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 11234 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 688 "js_parser.mly" ( J.Typeof ) # 11239 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 11244 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1446) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState520) : 'freshtv1448) | MenhirState3 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1451 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11256 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState521 _v | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState521 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1449 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 11270 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 11275 "js_parser.ml" ))), _, (e : 'tv_pre_in_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = let op = # 687 "js_parser.mly" ( J.Void ) # 11280 "js_parser.ml" in # 378 "js_parser.mly" ( J.EUn (op, e) ) # 11285 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1450) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState521) : 'freshtv1452) | _ -> _menhir_fail () and _menhir_goto_option_pair_default_clause_list_case_clause___ : _menhir_env -> 'ttv_tail -> 'tv_option_pair_default_clause_list_case_clause___ -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv1291 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 11302 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 11306 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 11310 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 11314 "js_parser.ml" )) * _menhir_state * 'tv_list_case_clause_) * 'tv_option_pair_default_clause_list_case_clause___) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RCURLY _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv1287 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 11324 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 11328 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 11332 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 11336 "js_parser.ml" )) * _menhir_state * 'tv_list_case_clause_) * 'tv_option_pair_default_clause_list_case_clause___) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 11341 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv1285 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 11348 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 11352 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 11356 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 11360 "js_parser.ml" )) * _menhir_state * 'tv_list_case_clause_) * 'tv_option_pair_default_clause_list_case_clause___) = Obj.magic _menhir_stack in let ((_5 : ( # 68 "js_parser.mly" (Parse_info.t) # 11365 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 11369 "js_parser.ml" )) = _v in ((let (((((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 11374 "js_parser.ml" ))), (_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 11378 "js_parser.ml" ))), _, (item : 'tv_expression)), (_3_inlined1 : ( # 68 "js_parser.mly" (Parse_info.t) # 11382 "js_parser.ml" ))), (_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 11386 "js_parser.ml" ))), _, (x : 'tv_list_case_clause_)), (y : 'tv_option_pair_default_clause_list_case_clause___)) = _menhir_stack in let _v : 'tv_switch_statement = let pair = # 167 "" ( (x, y) ) # 11391 "js_parser.ml" in let subject = let _3 = _3_inlined1 in # 722 "js_parser.mly" ( item ) # 11398 "js_parser.ml" in # 294 "js_parser.mly" ( let switch = match pair with | cases, None -> J.Switch_statement (subject, cases, None, []) | cases, Some (default, more_cases) -> J.Switch_statement (subject, cases, Some default, more_cases) in switch, J.Pi pi ) # 11409 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1283) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_switch_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1281) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_switch_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1279) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_switch_statement) : 'tv_switch_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 11426 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1280)) : 'freshtv1282)) : 'freshtv1284)) : 'freshtv1286)) : 'freshtv1288) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv1289 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 11436 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 11440 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 11444 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 11448 "js_parser.ml" )) * _menhir_state * 'tv_list_case_clause_) * 'tv_option_pair_default_clause_list_case_clause___) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1290)) : 'freshtv1292) and _menhir_goto_pre_in_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_pre_in_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1277 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DECR_NB _v -> _menhir_run82 _menhir_env (Obj.magic _menhir_stack) MenhirState324 _v | Js_token.T_DIV _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1259 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState324 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 11470 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState339 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState339) : 'freshtv1260) | Js_token.T_INCR_NB _v -> _menhir_run81 _menhir_env (Obj.magic _menhir_stack) MenhirState324 _v | Js_token.T_LSHIFT _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1261 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState324 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 11537 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState337 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState337) : 'freshtv1262) | Js_token.T_MINUS _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1263 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState324 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 11602 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState335 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState335) : 'freshtv1264) | Js_token.T_MOD _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1265 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState324 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 11667 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState333 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState333) : 'freshtv1266) | Js_token.T_MULT _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1267 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState324 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 11732 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState331 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState331) : 'freshtv1268) | Js_token.T_PLUS _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1269 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState324 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 11797 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState329 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState329) : 'freshtv1270) | Js_token.T_RSHIFT _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1271 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState324 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 11862 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState327 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState327) : 'freshtv1272) | Js_token.T_RSHIFT3 _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1273 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState324 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 11927 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState325 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState325) : 'freshtv1274) | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1275 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_pre_in_expression_no_statement)) = _menhir_stack in let _v : 'tv_post_in_expression_no_statement = # 467 "js_parser.mly" ( _1 ) # 11992 "js_parser.ml" in _menhir_goto_post_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1276) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState324) : 'freshtv1278) and _menhir_run130 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12003 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1257) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12013 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12017 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 710 "js_parser.mly" ( J.AsrEq ) # 12022 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1258) and _menhir_run131 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12029 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1255) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12039 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12043 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 711 "js_parser.mly" ( J.LsrEq ) # 12048 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1256) and _menhir_run132 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12055 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1253) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12065 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12069 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 707 "js_parser.mly" ( J.PlusEq ) # 12074 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1254) and _menhir_run133 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12081 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1251) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12091 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12095 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 704 "js_parser.mly" ( J.StarEq ) # 12100 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1252) and _menhir_run134 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12107 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1249) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12117 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12121 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 706 "js_parser.mly" ( J.ModEq ) # 12126 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1250) and _menhir_run135 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12133 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1247) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12143 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12147 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 708 "js_parser.mly" ( J.MinusEq ) # 12152 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1248) and _menhir_run136 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12159 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1245) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12169 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12173 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 709 "js_parser.mly" ( J.LslEq ) # 12178 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1246) and _menhir_run137 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12185 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1243) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12195 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12199 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 705 "js_parser.mly" ( J.SlashEq ) # 12204 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1244) and _menhir_run138 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12211 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1241) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12221 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12225 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 713 "js_parser.mly" ( J.BxorEq ) # 12230 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1242) and _menhir_run139 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12237 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1239) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12247 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12251 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 714 "js_parser.mly" ( J.BorEq ) # 12256 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1240) and _menhir_run140 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12263 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1237) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12273 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12277 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 712 "js_parser.mly" ( J.BandEq ) # 12282 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1238) and _menhir_run141 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 12289 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1235) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 77 "js_parser.mly" (Parse_info.t) # 12299 "js_parser.ml" )) : ( # 77 "js_parser.mly" (Parse_info.t) # 12303 "js_parser.ml" )) = _v in ((let _v : 'tv_assignment_operator = # 703 "js_parser.mly" ( J.Eq ) # 12308 "js_parser.ml" in _menhir_goto_assignment_operator _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1236) and _menhir_reduce211 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_left_hand_side_expression -> 'ttv_return = fun _menhir_env _menhir_stack -> let (_menhir_stack, _menhir_s, (_1 : 'tv_left_hand_side_expression)) = _menhir_stack in let _v : 'tv_pre_in_expression = # 375 "js_parser.mly" ( _1 ) # 12318 "js_parser.ml" in _menhir_goto_pre_in_expression _menhir_env _menhir_stack _menhir_s _v and _menhir_goto_new_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_new_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState528 | MenhirState2 | MenhirState3 | MenhirState4 | MenhirState9 | MenhirState12 | MenhirState14 | MenhirState15 | MenhirState51 | MenhirState499 | MenhirState491 | MenhirState52 | MenhirState54 | MenhirState55 | MenhirState440 | MenhirState435 | MenhirState241 | MenhirState428 | MenhirState430 | MenhirState421 | MenhirState423 | MenhirState408 | MenhirState397 | MenhirState386 | MenhirState381 | MenhirState375 | MenhirState373 | MenhirState371 | MenhirState369 | MenhirState367 | MenhirState365 | MenhirState363 | MenhirState361 | MenhirState359 | MenhirState357 | MenhirState355 | MenhirState353 | MenhirState351 | MenhirState349 | MenhirState347 | MenhirState345 | MenhirState343 | MenhirState339 | MenhirState337 | MenhirState335 | MenhirState333 | MenhirState331 | MenhirState329 | MenhirState327 | MenhirState325 | MenhirState319 | MenhirState303 | MenhirState294 | MenhirState292 | MenhirState290 | MenhirState286 | MenhirState244 | MenhirState282 | MenhirState280 | MenhirState278 | MenhirState276 | MenhirState274 | MenhirState272 | MenhirState270 | MenhirState268 | MenhirState266 | MenhirState264 | MenhirState262 | MenhirState260 | MenhirState258 | MenhirState254 | MenhirState252 | MenhirState250 | MenhirState248 | MenhirState236 | MenhirState233 | MenhirState231 | MenhirState229 | MenhirState223 | MenhirState221 | MenhirState218 | MenhirState214 | MenhirState210 | MenhirState207 | MenhirState203 | MenhirState196 | MenhirState192 | MenhirState70 | MenhirState72 | MenhirState73 | MenhirState74 | MenhirState183 | MenhirState181 | MenhirState91 | MenhirState176 | MenhirState174 | MenhirState95 | MenhirState172 | MenhirState97 | MenhirState170 | MenhirState168 | MenhirState164 | MenhirState108 | MenhirState148 | MenhirState160 | MenhirState158 | MenhirState154 | MenhirState156 | MenhirState152 | MenhirState150 | MenhirState146 | MenhirState142 | MenhirState128 | MenhirState126 | MenhirState110 | MenhirState124 | MenhirState122 | MenhirState120 | MenhirState118 | MenhirState116 | MenhirState112 | MenhirState99 | MenhirState75 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1225) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_new_expression) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1223) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_new_expression) : 'tv_new_expression) = _v in ((let _v : 'tv_left_hand_side_expression = # 354 "js_parser.mly" ( snd _1 ) # 12337 "js_parser.ml" in _menhir_goto_left_hand_side_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1224)) : 'freshtv1226) | MenhirState225 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1229 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 12345 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_new_expression) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1227 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 12353 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : 'tv_new_expression) : 'tv_new_expression) = _v in ((let (_menhir_stack, _menhir_s, (pi : ( # 65 "js_parser.mly" (Parse_info.t) # 12360 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_new_expression_no_statement = # 490 "js_parser.mly" ( (pi, J.ENew (snd _2,None)) ) # 12365 "js_parser.ml" in _menhir_goto_new_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1228)) : 'freshtv1230) | MenhirState13 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1233 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 12373 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_new_expression) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1231 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 12381 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : 'tv_new_expression) : 'tv_new_expression) = _v in ((let (_menhir_stack, _menhir_s, (pi : ( # 65 "js_parser.mly" (Parse_info.t) # 12388 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_new_expression = # 396 "js_parser.mly" ( (pi, J.ENew (snd _2,None)) ) # 12393 "js_parser.ml" in _menhir_goto_new_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1232)) : 'freshtv1234) | _ -> _menhir_fail () and _menhir_goto_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState415 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1215 * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 12408 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1213 * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 12414 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) = Obj.magic _menhir_stack in ((let ((((_menhir_stack, _menhir_s, (x : 'tv_variable)), _, (y : 'tv_option_initializer_no_in_)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 12419 "js_parser.ml" ))), _, (xs : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___)) = _menhir_stack in let _v : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___ = let x = # 167 "" ( (x, y) ) # 12424 "js_parser.ml" in # 243 "" ( x :: xs ) # 12429 "js_parser.ml" in _menhir_goto_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1214)) : 'freshtv1216) | MenhirState242 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1221 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 12437 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 12441 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 12445 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_SEMICOLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1217 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 12455 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 12459 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 12463 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 12468 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState421 _v | Js_token.T_SEMICOLON _ -> _menhir_reduce146 _menhir_env (Obj.magic _menhir_stack) MenhirState421 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState421) : 'freshtv1218) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1219 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 12535 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 12539 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 12543 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1220)) : 'freshtv1222) | _ -> _menhir_fail () and _menhir_goto_list_case_clause_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_list_case_clause_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState213 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv1203 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 12559 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 12563 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 12567 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 12571 "js_parser.ml" )) * _menhir_state * 'tv_list_case_clause_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_DEFAULT _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1197) = Obj.magic _menhir_stack in let (_v : ( # 57 "js_parser.mly" (Parse_info.t) # 12582 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1193 * ( # 57 "js_parser.mly" (Parse_info.t) # 12593 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 12598 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState451 _v | Js_token.T_CASE _ | Js_token.T_RCURLY _ -> _menhir_reduce123 _menhir_env (Obj.magic _menhir_stack) MenhirState451 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState451) : 'freshtv1194) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1195 * ( # 57 "js_parser.mly" (Parse_info.t) # 12691 "js_parser.ml" )) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv1196)) : 'freshtv1198) | Js_token.T_RCURLY _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1199) = Obj.magic _menhir_stack in ((let _v : 'tv_option_pair_default_clause_list_case_clause___ = # 114 "" ( None ) # 12700 "js_parser.ml" in _menhir_goto_option_pair_default_clause_list_case_clause___ _menhir_env _menhir_stack _v) : 'freshtv1200) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv1201 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 12710 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 12714 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 12718 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 12722 "js_parser.ml" )) * _menhir_state * 'tv_list_case_clause_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1202)) : 'freshtv1204) | MenhirState455 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1207 * 'tv_default_clause) * _menhir_state * 'tv_list_case_clause_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1205 * 'tv_default_clause) * _menhir_state * 'tv_list_case_clause_) = Obj.magic _menhir_stack in ((let ((_menhir_stack, (x : 'tv_default_clause)), _, (y : 'tv_list_case_clause_)) = _menhir_stack in let _v : 'tv_option_pair_default_clause_list_case_clause___ = let x = # 167 "" ( (x, y) ) # 12735 "js_parser.ml" in # 116 "" ( Some x ) # 12740 "js_parser.ml" in _menhir_goto_option_pair_default_clause_list_case_clause___ _menhir_env _menhir_stack _v) : 'freshtv1206)) : 'freshtv1208) | MenhirState457 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1211 * _menhir_state * 'tv_case_clause) * _menhir_state * 'tv_list_case_clause_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1209 * _menhir_state * 'tv_case_clause) * _menhir_state * 'tv_list_case_clause_) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (x : 'tv_case_clause)), _, (xs : 'tv_list_case_clause_)) = _menhir_stack in let _v : 'tv_list_case_clause_ = # 213 "" ( x :: xs ) # 12752 "js_parser.ml" in _menhir_goto_list_case_clause_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1210)) : 'freshtv1212) | _ -> _menhir_fail () and _menhir_goto_loption_separated_nonempty_list_T_COMMA_assignment_expression__ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_loption_separated_nonempty_list_T_COMMA_assignment_expression__ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1191 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 12765 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_assignment_expression__) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1187 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 12775 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_assignment_expression__) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 12780 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1185 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 12787 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_assignment_expression__) = Obj.magic _menhir_stack in let ((_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 12792 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 12796 "js_parser.ml" )) = _v in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 12801 "js_parser.ml" ))), _, (xs : 'tv_loption_separated_nonempty_list_T_COMMA_assignment_expression__)) = _menhir_stack in let _v : 'tv_arguments = let args = let item = # 232 "" ( xs ) # 12807 "js_parser.ml" in # 722 "js_parser.mly" ( item ) # 12812 "js_parser.ml" in # 580 "js_parser.mly" ( args ) # 12818 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1183) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_arguments) = _v in ((match _menhir_s with | MenhirState105 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1161 * _menhir_state * 'tv_call_expression) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_arguments) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1159 * _menhir_state * 'tv_call_expression) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : 'tv_arguments) : 'tv_arguments) = _v in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_call_expression)) = _menhir_stack in let _v : 'tv_call_expression = # 388 "js_parser.mly" ( let (start, e) = _1 in (start, J.ECall(e, _2, J.Pi start)) ) # 12838 "js_parser.ml" in _menhir_goto_call_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1160)) : 'freshtv1162) | MenhirState88 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1165 * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_arguments) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1163 * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : 'tv_arguments) : 'tv_arguments) = _v in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_member_expression)) = _menhir_stack in let _v : 'tv_call_expression = # 386 "js_parser.mly" ( let (start, e) = _1 in (start, J.ECall(e, _2, J.Pi start)) ) # 12854 "js_parser.ml" in _menhir_goto_call_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1164)) : 'freshtv1166) | MenhirState227 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1169 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 12862 "js_parser.ml" )) * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_arguments) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1167 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 12870 "js_parser.ml" )) * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((a : 'tv_arguments) : 'tv_arguments) = _v in ((let ((_menhir_stack, _menhir_s, (pi : ( # 65 "js_parser.mly" (Parse_info.t) # 12877 "js_parser.ml" ))), _, (e : 'tv_member_expression)) = _menhir_stack in let _v : 'tv_member_expression_no_statement = # 510 "js_parser.mly" ( (pi, J.ENew(snd e,Some a)) ) # 12882 "js_parser.ml" in _menhir_goto_member_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1168)) : 'freshtv1170) | MenhirState378 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1173 * _menhir_state * 'tv_member_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_arguments) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1171 * _menhir_state * 'tv_member_expression_no_statement) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : 'tv_arguments) : 'tv_arguments) = _v in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_member_expression_no_statement)) = _menhir_stack in let _v : 'tv_call_expression_no_statement = # 494 "js_parser.mly" ( let (start, e) = _1 in (start, J.ECall(e, _2, J.Pi start)) ) # 12898 "js_parser.ml" in _menhir_goto_call_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1172)) : 'freshtv1174) | MenhirState405 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1177 * _menhir_state * 'tv_call_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_arguments) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1175 * _menhir_state * 'tv_call_expression_no_statement) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : 'tv_arguments) : 'tv_arguments) = _v in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_call_expression_no_statement)) = _menhir_stack in let _v : 'tv_call_expression_no_statement = # 496 "js_parser.mly" ( let (start, e) = _1 in (start, J.ECall(e, _2, J.Pi start)) ) # 12914 "js_parser.ml" in _menhir_goto_call_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1176)) : 'freshtv1178) | MenhirState516 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1181 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 12922 "js_parser.ml" )) * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_arguments) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1179 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 12930 "js_parser.ml" )) * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((a : 'tv_arguments) : 'tv_arguments) = _v in ((let ((_menhir_stack, _menhir_s, (pi : ( # 65 "js_parser.mly" (Parse_info.t) # 12937 "js_parser.ml" ))), _, (e1 : 'tv_member_expression)) = _menhir_stack in let _v : 'tv_member_expression = # 406 "js_parser.mly" ( (pi, J.ENew(snd e1, Some a)) ) # 12942 "js_parser.ml" in _menhir_goto_member_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1180)) : 'freshtv1182) | _ -> _menhir_fail ()) : 'freshtv1184)) : 'freshtv1186)) : 'freshtv1188) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1189 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 12954 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_assignment_expression__) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1190)) : 'freshtv1192) and _menhir_goto_left_hand_side_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_left_hand_side_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1157 * _menhir_state * 'tv_left_hand_side_expression_no_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_ASSIGN _v -> _menhir_run141 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_BIT_AND_ASSIGN _v -> _menhir_run140 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_BIT_OR_ASSIGN _v -> _menhir_run139 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_BIT_XOR_ASSIGN _v -> _menhir_run138 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_DIV_ASSIGN _v -> _menhir_run137 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_LSHIFT_ASSIGN _v -> _menhir_run136 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_MINUS_ASSIGN _v -> _menhir_run135 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_MOD_ASSIGN _v -> _menhir_run134 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_MULT_ASSIGN _v -> _menhir_run133 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_PLUS_ASSIGN _v -> _menhir_run132 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_RSHIFT3_ASSIGN _v -> _menhir_run131 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.T_RSHIFT_ASSIGN _v -> _menhir_run130 _menhir_env (Obj.magic _menhir_stack) MenhirState385 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1155 * _menhir_state * 'tv_left_hand_side_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_left_hand_side_expression_no_statement)) = _menhir_stack in let _v : 'tv_pre_in_expression_no_statement = # 475 "js_parser.mly" ( _1 ) # 12998 "js_parser.ml" in _menhir_goto_pre_in_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1156) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState385) : 'freshtv1158) and _menhir_goto_left_hand_side_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_left_hand_side_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState3 | MenhirState4 | MenhirState9 | MenhirState12 | MenhirState15 | MenhirState54 | MenhirState55 | MenhirState375 | MenhirState373 | MenhirState371 | MenhirState369 | MenhirState367 | MenhirState365 | MenhirState363 | MenhirState361 | MenhirState359 | MenhirState357 | MenhirState355 | MenhirState353 | MenhirState351 | MenhirState345 | MenhirState343 | MenhirState339 | MenhirState337 | MenhirState335 | MenhirState333 | MenhirState331 | MenhirState329 | MenhirState327 | MenhirState325 | MenhirState303 | MenhirState294 | MenhirState292 | MenhirState290 | MenhirState282 | MenhirState280 | MenhirState278 | MenhirState276 | MenhirState274 | MenhirState272 | MenhirState270 | MenhirState268 | MenhirState266 | MenhirState264 | MenhirState262 | MenhirState260 | MenhirState250 | MenhirState248 | MenhirState233 | MenhirState231 | MenhirState229 | MenhirState223 | MenhirState221 | MenhirState203 | MenhirState192 | MenhirState72 | MenhirState73 | MenhirState74 | MenhirState75 | MenhirState176 | MenhirState174 | MenhirState95 | MenhirState172 | MenhirState97 | MenhirState170 | MenhirState168 | MenhirState148 | MenhirState160 | MenhirState158 | MenhirState154 | MenhirState156 | MenhirState152 | MenhirState150 | MenhirState126 | MenhirState110 | MenhirState124 | MenhirState122 | MenhirState120 | MenhirState118 | MenhirState116 | MenhirState112 | MenhirState99 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1145 * _menhir_state * 'tv_left_hand_side_expression) = Obj.magic _menhir_stack in (_menhir_reduce211 _menhir_env (Obj.magic _menhir_stack) : 'freshtv1146) | MenhirState528 | MenhirState2 | MenhirState14 | MenhirState51 | MenhirState499 | MenhirState491 | MenhirState52 | MenhirState435 | MenhirState428 | MenhirState430 | MenhirState421 | MenhirState423 | MenhirState408 | MenhirState397 | MenhirState386 | MenhirState381 | MenhirState349 | MenhirState347 | MenhirState319 | MenhirState286 | MenhirState236 | MenhirState218 | MenhirState214 | MenhirState210 | MenhirState207 | MenhirState196 | MenhirState70 | MenhirState183 | MenhirState181 | MenhirState91 | MenhirState164 | MenhirState108 | MenhirState146 | MenhirState142 | MenhirState128 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1147 * _menhir_state * 'tv_left_hand_side_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_ASSIGN _v -> _menhir_run141 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_BIT_AND_ASSIGN _v -> _menhir_run140 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_BIT_OR_ASSIGN _v -> _menhir_run139 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_BIT_XOR_ASSIGN _v -> _menhir_run138 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_DIV_ASSIGN _v -> _menhir_run137 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_LSHIFT_ASSIGN _v -> _menhir_run136 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_MINUS_ASSIGN _v -> _menhir_run135 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_MOD_ASSIGN _v -> _menhir_run134 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_MULT_ASSIGN _v -> _menhir_run133 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_PLUS_ASSIGN _v -> _menhir_run132 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_RSHIFT3_ASSIGN _v -> _menhir_run131 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.T_RSHIFT_ASSIGN _v -> _menhir_run130 _menhir_env (Obj.magic _menhir_stack) MenhirState129 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> _menhir_reduce211 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState129) : 'freshtv1148) | MenhirState440 | MenhirState244 | MenhirState258 | MenhirState254 | MenhirState252 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1149 * _menhir_state * 'tv_left_hand_side_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_ASSIGN _v -> _menhir_run141 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_BIT_AND_ASSIGN _v -> _menhir_run140 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_BIT_OR_ASSIGN _v -> _menhir_run139 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_BIT_XOR_ASSIGN _v -> _menhir_run138 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_DIV_ASSIGN _v -> _menhir_run137 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_LSHIFT_ASSIGN _v -> _menhir_run136 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_MINUS_ASSIGN _v -> _menhir_run135 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_MOD_ASSIGN _v -> _menhir_run134 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_MULT_ASSIGN _v -> _menhir_run133 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_PLUS_ASSIGN _v -> _menhir_run132 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_RSHIFT3_ASSIGN _v -> _menhir_run131 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_RSHIFT_ASSIGN _v -> _menhir_run130 _menhir_env (Obj.magic _menhir_stack) MenhirState253 _v | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_DECR_NB _ | Js_token.T_DIV _ | Js_token.T_EQUAL _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IN _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ -> _menhir_reduce211 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState253) : 'freshtv1150) | MenhirState241 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1153 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 13091 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 13095 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_ASSIGN _v -> _menhir_run141 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_BIT_AND_ASSIGN _v -> _menhir_run140 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_BIT_OR_ASSIGN _v -> _menhir_run139 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_BIT_XOR_ASSIGN _v -> _menhir_run138 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_DIV_ASSIGN _v -> _menhir_run137 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_IN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1151 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 13115 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 13119 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState434 in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 13125 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState435 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState435) : 'freshtv1152) | Js_token.T_LSHIFT_ASSIGN _v -> _menhir_run136 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_MINUS_ASSIGN _v -> _menhir_run135 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_MOD_ASSIGN _v -> _menhir_run134 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_MULT_ASSIGN _v -> _menhir_run133 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_PLUS_ASSIGN _v -> _menhir_run132 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_RSHIFT3_ASSIGN _v -> _menhir_run131 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_RSHIFT_ASSIGN _v -> _menhir_run130 _menhir_env (Obj.magic _menhir_stack) MenhirState434 _v | Js_token.T_AND _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_XOR _ | Js_token.T_COMMA _ | Js_token.T_DECR_NB _ | Js_token.T_DIV _ | Js_token.T_EQUAL _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LSHIFT _ | Js_token.T_MINUS _ | Js_token.T_MOD _ | Js_token.T_MULT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ -> _menhir_reduce211 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState434) : 'freshtv1154) | _ -> _menhir_fail () and _menhir_reduce137 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_member_expression -> 'ttv_return = fun _menhir_env _menhir_stack -> let (_menhir_stack, _menhir_s, (_1 : 'tv_member_expression)) = _menhir_stack in let _v : 'tv_new_expression = # 395 "js_parser.mly" ( _1 ) # 13212 "js_parser.ml" in _menhir_goto_new_expression _menhir_env _menhir_stack _menhir_s _v and _menhir_run89 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_member_expression -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 13219 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BREAK _v -> _menhir_run47 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_CASE _v -> _menhir_run46 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_CATCH _v -> _menhir_run45 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_CONTINUE _v -> _menhir_run44 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_DEBUGGER _v -> _menhir_run43 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_DEFAULT _v -> _menhir_run42 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_DELETE _v -> _menhir_run41 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_DO _v -> _menhir_run40 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_ELSE _v -> _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_FALSE _v -> _menhir_run38 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_FINALLY _v -> _menhir_run37 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_FOR _v -> _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_FUNCTION _v -> _menhir_run35 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_IDENTIFIER _v -> _menhir_run34 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_IF _v -> _menhir_run33 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_IN _v -> _menhir_run32 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_INSTANCEOF _v -> _menhir_run31 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_NEW _v -> _menhir_run30 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_NULL _v -> _menhir_run29 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_RETURN _v -> _menhir_run28 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_SWITCH _v -> _menhir_run26 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_THIS _v -> _menhir_run25 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_THROW _v -> _menhir_run24 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_TRUE _v -> _menhir_run23 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_TRY _v -> _menhir_run22 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_TYPEOF _v -> _menhir_run21 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_VAR _v -> _menhir_run20 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_VOID _v -> _menhir_run19 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_WHILE _v -> _menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | Js_token.T_WITH _v -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState89 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState89 and _menhir_run183 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_member_expression -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 13294 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState183 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState183 and _menhir_run495 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_elison -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 13357 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1143 * _menhir_state * 'tv_elison) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 13367 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 13371 "js_parser.ml" )) = _v in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_elison)) = _menhir_stack in let _v : 'tv_elison_rev = # 643 "js_parser.mly" ( None :: _1 ) # 13377 "js_parser.ml" in _menhir_goto_elison_rev _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1144) and _menhir_reduce275 : _menhir_env -> ('ttv_tail * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_ -> 'ttv_return = fun _menhir_env _menhir_stack -> let ((_menhir_stack, _menhir_s, (x : 'tv_variable)), _, (y : 'tv_option_initializer_no_in_)) = _menhir_stack in let _v : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___ = let x = # 167 "" ( (x, y) ) # 13387 "js_parser.ml" in # 241 "" ( [ x ] ) # 13392 "js_parser.ml" in _menhir_goto_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___ _menhir_env _menhir_stack _menhir_s _v and _menhir_run415 : _menhir_env -> ('ttv_tail * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_ -> ( # 68 "js_parser.mly" (Parse_info.t) # 13399 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState415 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState415 and _menhir_run68 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 13416 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_FUNCTION _v -> _menhir_run475 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v | Js_token.T_RCURLY _ -> _menhir_reduce121 _menhir_env (Obj.magic _menhir_stack) MenhirState68 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState68 and _menhir_goto_option_finally_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_option_finally_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1141 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 13512 "js_parser.ml" )) * _menhir_state * 'tv_block) * _menhir_state * 'tv_catch) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_option_finally_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1139 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 13520 "js_parser.ml" )) * _menhir_state * 'tv_block) * _menhir_state * 'tv_catch) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_4 : 'tv_option_finally_) : 'tv_option_finally_) = _v in ((let (((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 13527 "js_parser.ml" ))), _, (_2 : 'tv_block)), _, (_3 : 'tv_catch)) = _menhir_stack in let _v : 'tv_try_statement = # 305 "js_parser.mly" ( (J.Try_statement (_2, Some _3, _4), J.Pi pi) ) # 13532 "js_parser.ml" in _menhir_goto_try_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1140)) : 'freshtv1142) and _menhir_goto_try_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_try_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1137) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_try_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1135) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_try_statement) : 'tv_try_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 13549 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1136)) : 'freshtv1138) and _menhir_run463 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 13556 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState463 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState463 and _menhir_reduce119 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _v : 'tv_list_case_clause_ = # 211 "" ( [] ) # 13575 "js_parser.ml" in _menhir_goto_list_case_clause_ _menhir_env _menhir_stack _menhir_s _v and _menhir_run214 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 13582 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState214 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState214 and _menhir_goto_if_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_if_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1133) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_if_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1131) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_if_statement) : 'tv_if_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 13655 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1132)) : 'freshtv1134) and _menhir_goto_for_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_for_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1129) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_for_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1127) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_for_statement) : 'tv_for_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 13672 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1128)) : 'freshtv1130) and _menhir_goto_for_in_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_for_in_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1125) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_for_in_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1123) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_for_in_statement) : 'tv_for_in_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 13689 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1124)) : 'freshtv1126) and _menhir_goto_new_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_new_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1121) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_new_expression_no_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1119) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_new_expression_no_statement) : 'tv_new_expression_no_statement) = _v in ((let _v : 'tv_left_hand_side_expression_no_statement = # 485 "js_parser.mly" ( snd _1 ) # 13706 "js_parser.ml" in _menhir_goto_left_hand_side_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1120)) : 'freshtv1122) and _menhir_run91 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 13713 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState91 _v | Js_token.T_RPAREN _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1117) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState91 in ((let _v : 'tv_loption_separated_nonempty_list_T_COMMA_assignment_expression__ = # 142 "" ( [] ) # 13775 "js_parser.ml" in _menhir_goto_loption_separated_nonempty_list_T_COMMA_assignment_expression__ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1118) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState91 and _menhir_goto_call_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_call_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1115 * _menhir_state * 'tv_call_expression_no_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1109 * _menhir_state * 'tv_call_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState405 in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 13798 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState408 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState408) : 'freshtv1110) | Js_token.T_LPAREN _v -> _menhir_run91 _menhir_env (Obj.magic _menhir_stack) MenhirState405 _v | Js_token.T_PERIOD _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1111 * _menhir_state * 'tv_call_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState405 in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 13865 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BREAK _v -> _menhir_run47 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_CASE _v -> _menhir_run46 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_CATCH _v -> _menhir_run45 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_CONTINUE _v -> _menhir_run44 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_DEBUGGER _v -> _menhir_run43 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_DEFAULT _v -> _menhir_run42 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_DELETE _v -> _menhir_run41 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_DO _v -> _menhir_run40 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_ELSE _v -> _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_FALSE _v -> _menhir_run38 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_FINALLY _v -> _menhir_run37 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_FOR _v -> _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_FUNCTION _v -> _menhir_run35 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_IDENTIFIER _v -> _menhir_run34 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_IF _v -> _menhir_run33 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_IN _v -> _menhir_run32 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_INSTANCEOF _v -> _menhir_run31 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_NEW _v -> _menhir_run30 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_NULL _v -> _menhir_run29 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_RETURN _v -> _menhir_run28 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_SWITCH _v -> _menhir_run26 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_THIS _v -> _menhir_run25 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_THROW _v -> _menhir_run24 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_TRUE _v -> _menhir_run23 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_TRY _v -> _menhir_run22 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_TYPEOF _v -> _menhir_run21 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_VAR _v -> _menhir_run20 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_VOID _v -> _menhir_run19 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_WHILE _v -> _menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | Js_token.T_WITH _v -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState406 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState406) : 'freshtv1112) | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_ASSIGN _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_AND_ASSIGN _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_OR_ASSIGN _ | Js_token.T_BIT_XOR _ | Js_token.T_BIT_XOR_ASSIGN _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DIV_ASSIGN _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LSHIFT _ | Js_token.T_LSHIFT_ASSIGN _ | Js_token.T_MINUS _ | Js_token.T_MINUS_ASSIGN _ | Js_token.T_MOD _ | Js_token.T_MOD_ASSIGN _ | Js_token.T_MULT _ | Js_token.T_MULT_ASSIGN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_PLUS_ASSIGN _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_RSHIFT3_ASSIGN _ | Js_token.T_RSHIFT_ASSIGN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1113 * _menhir_state * 'tv_call_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_call_expression_no_statement)) = _menhir_stack in let _v : 'tv_left_hand_side_expression_no_statement = # 486 "js_parser.mly" ( snd _1 ) # 13942 "js_parser.ml" in _menhir_goto_left_hand_side_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1114) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState405) : 'freshtv1116) and _menhir_goto_call_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_call_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1107 * _menhir_state * 'tv_call_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1101 * _menhir_state * 'tv_call_expression) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState105 in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 13965 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState108 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState108) : 'freshtv1102) | Js_token.T_LPAREN _v -> _menhir_run91 _menhir_env (Obj.magic _menhir_stack) MenhirState105 _v | Js_token.T_PERIOD _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1103 * _menhir_state * 'tv_call_expression) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState105 in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 14032 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BREAK _v -> _menhir_run47 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_CASE _v -> _menhir_run46 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_CATCH _v -> _menhir_run45 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_CONTINUE _v -> _menhir_run44 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_DEBUGGER _v -> _menhir_run43 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_DEFAULT _v -> _menhir_run42 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_DELETE _v -> _menhir_run41 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_DO _v -> _menhir_run40 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_ELSE _v -> _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_FALSE _v -> _menhir_run38 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_FINALLY _v -> _menhir_run37 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_FOR _v -> _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_FUNCTION _v -> _menhir_run35 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_IDENTIFIER _v -> _menhir_run34 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_IF _v -> _menhir_run33 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_IN _v -> _menhir_run32 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_INSTANCEOF _v -> _menhir_run31 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_NEW _v -> _menhir_run30 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_NULL _v -> _menhir_run29 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_RETURN _v -> _menhir_run28 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_SWITCH _v -> _menhir_run26 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_THIS _v -> _menhir_run25 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_THROW _v -> _menhir_run24 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_TRUE _v -> _menhir_run23 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_TRY _v -> _menhir_run22 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_TYPEOF _v -> _menhir_run21 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_VAR _v -> _menhir_run20 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_VOID _v -> _menhir_run19 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_WHILE _v -> _menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | Js_token.T_WITH _v -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState106 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState106) : 'freshtv1104) | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_ASSIGN _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_AND_ASSIGN _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_OR_ASSIGN _ | Js_token.T_BIT_XOR _ | Js_token.T_BIT_XOR_ASSIGN _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DIV_ASSIGN _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LSHIFT _ | Js_token.T_LSHIFT_ASSIGN _ | Js_token.T_MINUS _ | Js_token.T_MINUS_ASSIGN _ | Js_token.T_MOD _ | Js_token.T_MOD_ASSIGN _ | Js_token.T_MULT _ | Js_token.T_MULT_ASSIGN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_PLUS_ASSIGN _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_RSHIFT3_ASSIGN _ | Js_token.T_RSHIFT_ASSIGN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1105 * _menhir_state * 'tv_call_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_call_expression)) = _menhir_stack in let _v : 'tv_left_hand_side_expression = # 355 "js_parser.mly" ( snd _1 ) # 14109 "js_parser.ml" in _menhir_goto_left_hand_side_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1106) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState105) : 'freshtv1108) and _menhir_goto_member_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_member_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState528 | MenhirState2 | MenhirState3 | MenhirState4 | MenhirState9 | MenhirState12 | MenhirState14 | MenhirState15 | MenhirState51 | MenhirState499 | MenhirState491 | MenhirState52 | MenhirState54 | MenhirState55 | MenhirState440 | MenhirState435 | MenhirState241 | MenhirState428 | MenhirState430 | MenhirState421 | MenhirState423 | MenhirState408 | MenhirState397 | MenhirState386 | MenhirState381 | MenhirState375 | MenhirState373 | MenhirState371 | MenhirState369 | MenhirState367 | MenhirState365 | MenhirState363 | MenhirState361 | MenhirState359 | MenhirState357 | MenhirState355 | MenhirState353 | MenhirState351 | MenhirState349 | MenhirState347 | MenhirState345 | MenhirState343 | MenhirState339 | MenhirState337 | MenhirState335 | MenhirState333 | MenhirState331 | MenhirState329 | MenhirState327 | MenhirState325 | MenhirState319 | MenhirState303 | MenhirState294 | MenhirState292 | MenhirState290 | MenhirState286 | MenhirState244 | MenhirState282 | MenhirState280 | MenhirState278 | MenhirState276 | MenhirState274 | MenhirState272 | MenhirState270 | MenhirState268 | MenhirState266 | MenhirState264 | MenhirState262 | MenhirState260 | MenhirState258 | MenhirState254 | MenhirState252 | MenhirState250 | MenhirState248 | MenhirState236 | MenhirState233 | MenhirState231 | MenhirState229 | MenhirState223 | MenhirState221 | MenhirState218 | MenhirState214 | MenhirState210 | MenhirState207 | MenhirState203 | MenhirState196 | MenhirState192 | MenhirState70 | MenhirState72 | MenhirState73 | MenhirState74 | MenhirState183 | MenhirState181 | MenhirState91 | MenhirState176 | MenhirState174 | MenhirState95 | MenhirState172 | MenhirState97 | MenhirState170 | MenhirState168 | MenhirState164 | MenhirState108 | MenhirState148 | MenhirState160 | MenhirState158 | MenhirState154 | MenhirState156 | MenhirState152 | MenhirState150 | MenhirState146 | MenhirState142 | MenhirState128 | MenhirState126 | MenhirState110 | MenhirState124 | MenhirState122 | MenhirState120 | MenhirState118 | MenhirState116 | MenhirState112 | MenhirState99 | MenhirState75 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1095 * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LBRACKET _v -> _menhir_run183 _menhir_env (Obj.magic _menhir_stack) MenhirState88 _v | Js_token.T_LPAREN _v -> _menhir_run91 _menhir_env (Obj.magic _menhir_stack) MenhirState88 _v | Js_token.T_PERIOD _v -> _menhir_run89 _menhir_env (Obj.magic _menhir_stack) MenhirState88 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_ASSIGN _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_AND_ASSIGN _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_OR_ASSIGN _ | Js_token.T_BIT_XOR _ | Js_token.T_BIT_XOR_ASSIGN _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DIV_ASSIGN _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LSHIFT _ | Js_token.T_LSHIFT_ASSIGN _ | Js_token.T_MINUS _ | Js_token.T_MINUS_ASSIGN _ | Js_token.T_MOD _ | Js_token.T_MOD_ASSIGN _ | Js_token.T_MULT _ | Js_token.T_MULT_ASSIGN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_PLUS_ASSIGN _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_RSHIFT3_ASSIGN _ | Js_token.T_RSHIFT_ASSIGN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> _menhir_reduce137 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState88) : 'freshtv1096) | MenhirState225 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1097 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 14144 "js_parser.ml" )) * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LBRACKET _v -> _menhir_run183 _menhir_env (Obj.magic _menhir_stack) MenhirState227 _v | Js_token.T_LPAREN _v -> _menhir_run91 _menhir_env (Obj.magic _menhir_stack) MenhirState227 _v | Js_token.T_PERIOD _v -> _menhir_run89 _menhir_env (Obj.magic _menhir_stack) MenhirState227 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_ASSIGN _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_AND_ASSIGN _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_OR_ASSIGN _ | Js_token.T_BIT_XOR _ | Js_token.T_BIT_XOR_ASSIGN _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DIV_ASSIGN _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LSHIFT _ | Js_token.T_LSHIFT_ASSIGN _ | Js_token.T_MINUS _ | Js_token.T_MINUS_ASSIGN _ | Js_token.T_MOD _ | Js_token.T_MOD_ASSIGN _ | Js_token.T_MULT _ | Js_token.T_MULT_ASSIGN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_PLUS_ASSIGN _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_RSHIFT3_ASSIGN _ | Js_token.T_RSHIFT_ASSIGN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> _menhir_reduce137 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState227) : 'freshtv1098) | MenhirState13 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1099 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 14166 "js_parser.ml" )) * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LBRACKET _v -> _menhir_run183 _menhir_env (Obj.magic _menhir_stack) MenhirState516 _v | Js_token.T_LPAREN _v -> _menhir_run91 _menhir_env (Obj.magic _menhir_stack) MenhirState516 _v | Js_token.T_PERIOD _v -> _menhir_run89 _menhir_env (Obj.magic _menhir_stack) MenhirState516 _v | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_ASSIGN _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_AND_ASSIGN _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_OR_ASSIGN _ | Js_token.T_BIT_XOR _ | Js_token.T_BIT_XOR_ASSIGN _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COLON _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DIV_ASSIGN _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LSHIFT _ | Js_token.T_LSHIFT_ASSIGN _ | Js_token.T_MINUS _ | Js_token.T_MINUS_ASSIGN _ | Js_token.T_MOD _ | Js_token.T_MOD_ASSIGN _ | Js_token.T_MULT _ | Js_token.T_MULT_ASSIGN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_PLUS_ASSIGN _ | Js_token.T_RBRACKET _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RPAREN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_RSHIFT3_ASSIGN _ | Js_token.T_RSHIFT_ASSIGN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> _menhir_reduce137 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState516) : 'freshtv1100) | _ -> _menhir_fail () and _menhir_reduce59 : _menhir_env -> 'ttv_tail * _menhir_state * 'tv_elison_rev -> 'ttv_return = fun _menhir_env _menhir_stack -> let (_menhir_stack, _menhir_s, (_1 : 'tv_elison_rev)) = _menhir_stack in let _v : 'tv_elison = # 645 "js_parser.mly" (_1) # 14192 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1093) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_elison) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState52 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1089 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 14205 "js_parser.ml" )) * _menhir_state * 'tv_elison) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run495 _menhir_env (Obj.magic _menhir_stack) MenhirState493 _v | Js_token.T_RBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1087 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 14217 "js_parser.ml" )) * _menhir_state * 'tv_elison) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState493 in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 14223 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1085 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 14230 "js_parser.ml" )) * _menhir_state * 'tv_elison) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 14236 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 14240 "js_parser.ml" )) = _v in ((let ((_menhir_stack, _menhir_s, (pi : ( # 68 "js_parser.mly" (Parse_info.t) # 14245 "js_parser.ml" ))), _, (_2 : 'tv_elison)) = _menhir_stack in let _v : 'tv_array_literal = # 546 "js_parser.mly" ( (pi, J.EArr _2) ) # 14250 "js_parser.ml" in _menhir_goto_array_literal _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1086)) : 'freshtv1088) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState493) : 'freshtv1090) | MenhirState496 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1091 * _menhir_state * 'tv_element_list_rev) * _menhir_state * 'tv_elison) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_COMMA _v -> _menhir_run495 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState499 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState499) : 'freshtv1092) | _ -> _menhir_fail ()) : 'freshtv1094) and _menhir_goto_option_initializer_no_in_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_option_initializer_no_in_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState243 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1079 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14329 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 14333 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14337 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run415 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_IN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1075 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14349 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 14353 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14357 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 14362 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState286 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState286) : 'freshtv1076) | Js_token.T_SEMICOLON _ -> _menhir_reduce275 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1077 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14429 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 14433 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14437 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1078)) : 'freshtv1080) | MenhirState416 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1083 * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> _menhir_run415 _menhir_env (Obj.magic _menhir_stack) _v | Js_token.T_SEMICOLON _ -> _menhir_reduce275 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1081 * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1082)) : 'freshtv1084) | _ -> _menhir_fail () and _menhir_goto_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState199 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1063 * _menhir_state * 'tv_variable) * 'tv_option_initializer__) * ( # 68 "js_parser.mly" (Parse_info.t) # 14469 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv1061 * _menhir_state * 'tv_variable) * 'tv_option_initializer__) * ( # 68 "js_parser.mly" (Parse_info.t) # 14477 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((xs : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____) : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____) = _v in ((let (((_menhir_stack, _menhir_s, (x : 'tv_variable)), (y : 'tv_option_initializer__)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 14484 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____ = let x = # 167 "" ( (x, y) ) # 14489 "js_parser.ml" in # 243 "" ( x :: xs ) # 14494 "js_parser.ml" in _menhir_goto_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1062)) : 'freshtv1064) | MenhirState194 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1073 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14502 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1071 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14510 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((list : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____) : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____) = _v in ((let (_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 14517 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_variable_statement = # 229 "js_parser.mly" ( J.Variable_statement list, J.Pi pi ) # 14522 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1069) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_variable_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1067) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_variable_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1065) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_variable_statement) : 'tv_variable_statement) = _v in ((let _v : 'tv_statement_need_semi = # 183 "js_parser.mly" ( s ) # 14539 "js_parser.ml" in _menhir_goto_statement_need_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1066)) : 'freshtv1068)) : 'freshtv1070)) : 'freshtv1072)) : 'freshtv1074) | _ -> _menhir_fail () and _menhir_goto_loption_separated_nonempty_list_T_COMMA_variable__ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_loption_separated_nonempty_list_T_COMMA_variable__ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState61 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1053 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14554 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) * ( # 68 "js_parser.mly" (Parse_info.t) # 14558 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1049 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14568 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) * ( # 68 "js_parser.mly" (Parse_info.t) # 14572 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 14577 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LCURLY _v -> _menhir_run68 _menhir_env (Obj.magic _menhir_stack) MenhirState67 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState67) : 'freshtv1050) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1051 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14596 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) * ( # 68 "js_parser.mly" (Parse_info.t) # 14600 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1052)) : 'freshtv1054) | MenhirState477 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1059 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14609 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 14613 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1055 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14623 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 14627 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 14632 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LCURLY _v -> _menhir_run68 _menhir_env (Obj.magic _menhir_stack) MenhirState479 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState479) : 'freshtv1056) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv1057 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14651 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 14655 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1058)) : 'freshtv1060) | _ -> _menhir_fail () and _menhir_goto_source_element : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_source_element -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1047 * _menhir_state * 'tv_source_element) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_FUNCTION _v -> _menhir_run475 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState482 _v | Js_token.EOF _ | Js_token.T_RCURLY _ -> _menhir_reduce121 _menhir_env (Obj.magic _menhir_stack) MenhirState482 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState482) : 'freshtv1048) and _menhir_goto_option_expression_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_option_expression_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState218 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1021 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14762 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1019 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14768 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 14773 "js_parser.ml" ))), _, (_2 : 'tv_option_expression_)) = _menhir_stack in let _v : 'tv_return_statement = # 286 "js_parser.mly" ( (J.Return_statement _2, J.Pi pi) ) # 14778 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1017) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_return_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1015) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_return_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1013) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_return_statement) : 'tv_return_statement) = _v in ((let _v : 'tv_statement_need_semi = # 183 "js_parser.mly" ( s ) # 14795 "js_parser.ml" in _menhir_goto_statement_need_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv1014)) : 'freshtv1016)) : 'freshtv1018)) : 'freshtv1020)) : 'freshtv1022) | MenhirState421 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv1027 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14803 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 14807 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14811 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 14815 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_SEMICOLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv1023 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14825 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 14829 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14833 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 14837 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 14842 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState423 _v | Js_token.T_RPAREN _ -> _menhir_reduce146 _menhir_env (Obj.magic _menhir_stack) MenhirState423 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState423) : 'freshtv1024) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv1025 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14909 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 14913 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14917 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 14921 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1026)) : 'freshtv1028) | MenhirState423 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((((('freshtv1033 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14930 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 14934 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14938 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 14942 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 14946 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((((('freshtv1029 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14956 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 14960 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 14964 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 14968 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 14972 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 14977 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState425 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState425) : 'freshtv1030) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((((('freshtv1031 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15068 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15072 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15076 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 15080 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15084 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1032)) : 'freshtv1034) | MenhirState428 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1039 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15093 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15097 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15101 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_SEMICOLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1035 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15111 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15115 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15119 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 15124 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState430 _v | Js_token.T_RPAREN _ -> _menhir_reduce146 _menhir_env (Obj.magic _menhir_stack) MenhirState430 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState430) : 'freshtv1036) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv1037 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15191 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15195 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15199 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1038)) : 'freshtv1040) | MenhirState430 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv1045 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15208 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15212 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15216 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15220 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv1041 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15230 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15234 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15238 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15242 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 15247 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState432 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState432) : 'freshtv1042) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv1043 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15338 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15342 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15346 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 15350 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1044)) : 'freshtv1046) | _ -> _menhir_fail () and _menhir_goto_list_statement_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_list_statement_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState446 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv943 * _menhir_state * 'tv_statement) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv941 * _menhir_state * 'tv_statement) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (x : 'tv_statement)), _, (xs : 'tv_list_statement_)) = _menhir_stack in let _v : 'tv_list_statement_ = # 213 "" ( x :: xs ) # 15370 "js_parser.ml" in _menhir_goto_list_statement_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv942)) : 'freshtv944) | MenhirState216 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv951 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15378 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 15382 "js_parser.ml" )) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv949 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15388 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 15392 "js_parser.ml" )) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in ((let ((((_menhir_stack, _menhir_s, (_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 15397 "js_parser.ml" ))), _, (x : 'tv_expression)), (_2 : ( # 82 "js_parser.mly" (Parse_info.t) # 15401 "js_parser.ml" ))), _, (y : 'tv_list_statement_)) = _menhir_stack in let _v : 'tv_case_clause = let pair = # 175 "" ( (x, y) ) # 15406 "js_parser.ml" in # 319 "js_parser.mly" ( pair ) # 15411 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv947) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_case_clause) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv945 * _menhir_state * 'tv_case_clause) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_CASE _v -> _menhir_run214 _menhir_env (Obj.magic _menhir_stack) MenhirState457 _v | Js_token.T_DEFAULT _ | Js_token.T_RCURLY _ -> _menhir_reduce119 _menhir_env (Obj.magic _menhir_stack) MenhirState457 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState457) : 'freshtv946)) : 'freshtv948)) : 'freshtv950)) : 'freshtv952) | MenhirState451 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv959 * ( # 57 "js_parser.mly" (Parse_info.t) # 15436 "js_parser.ml" )) * ( # 82 "js_parser.mly" (Parse_info.t) # 15440 "js_parser.ml" )) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv957 * ( # 57 "js_parser.mly" (Parse_info.t) # 15446 "js_parser.ml" )) * ( # 82 "js_parser.mly" (Parse_info.t) # 15450 "js_parser.ml" )) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in ((let (((_menhir_stack, (_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 15455 "js_parser.ml" ))), (_2 : ( # 82 "js_parser.mly" (Parse_info.t) # 15459 "js_parser.ml" ))), _, (list : 'tv_list_statement_)) = _menhir_stack in let _v : 'tv_default_clause = # 322 "js_parser.mly" ( list ) # 15464 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv955) = _menhir_stack in let (_v : 'tv_default_clause) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv953 * 'tv_default_clause) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_CASE _v -> _menhir_run214 _menhir_env (Obj.magic _menhir_stack) MenhirState455 _v | Js_token.T_RCURLY _ -> _menhir_reduce119 _menhir_env (Obj.magic _menhir_stack) MenhirState455 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState455) : 'freshtv954)) : 'freshtv956)) : 'freshtv958)) : 'freshtv960) | MenhirState206 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1011 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 15488 "js_parser.ml" )) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RCURLY _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1007 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 15498 "js_parser.ml" )) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 15503 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1005 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 15510 "js_parser.ml" )) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in let ((pi2 : ( # 68 "js_parser.mly" (Parse_info.t) # 15515 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 15519 "js_parser.ml" )) = _v in ((let ((_menhir_stack, _menhir_s, (pi1 : ( # 68 "js_parser.mly" (Parse_info.t) # 15524 "js_parser.ml" ))), _, (x : 'tv_list_statement_)) = _menhir_stack in let _v : 'tv_curly_block_list_statement__ = # 649 "js_parser.mly" ( (x, pi1, pi2) ) # 15529 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1003) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_list_statement__) = _v in ((match _menhir_s with | MenhirState0 | MenhirState523 | MenhirState68 | MenhirState482 | MenhirState191 | MenhirState206 | MenhirState451 | MenhirState216 | MenhirState446 | MenhirState238 | MenhirState444 | MenhirState437 | MenhirState432 | MenhirState425 | MenhirState288 | MenhirState289 | MenhirState390 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv963) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_list_statement__) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv961) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((block : 'tv_curly_block_list_statement__) : 'tv_curly_block_list_statement__) = _v in ((let _v : 'tv_statement_no_semi = # 159 "js_parser.mly" ( let statements, pi_start, _pi_end = block in J.Block statements, J.Pi pi_start ) # 15549 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv962)) : 'freshtv964) | MenhirState468 | MenhirState463 | MenhirState205 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1001) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_list_statement__) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv999) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((block : 'tv_curly_block_list_statement__) : 'tv_curly_block_list_statement__) = _v in ((let _v : 'tv_block = # 225 "js_parser.mly" ( let statements, _, _ = block in statements ) # 15564 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv997) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_block) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState205 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv971 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15577 "js_parser.ml" )) * _menhir_state * 'tv_block) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_CATCH _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv969) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState462 in let (_v : ( # 57 "js_parser.mly" (Parse_info.t) # 15589 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv965 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15600 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 15605 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState466 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState466) : 'freshtv966) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv967 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15624 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv968)) : 'freshtv970) | Js_token.T_FINALLY _v -> _menhir_run463 _menhir_env (Obj.magic _menhir_stack) MenhirState462 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState462) : 'freshtv972) | MenhirState463 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv985 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15639 "js_parser.ml" )) * _menhir_state * 'tv_block) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv983 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15645 "js_parser.ml" )) * _menhir_state * 'tv_block) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 15650 "js_parser.ml" ))), _, (_2 : 'tv_block)) = _menhir_stack in let _v : 'tv_finally = # 312 "js_parser.mly" ( _2 ) # 15655 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv981) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_finally) = _v in ((match _menhir_s with | MenhirState462 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv975 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15667 "js_parser.ml" )) * _menhir_state * 'tv_block) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_finally) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv973 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15675 "js_parser.ml" )) * _menhir_state * 'tv_block) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_3 : 'tv_finally) : 'tv_finally) = _v in ((let ((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 15682 "js_parser.ml" ))), _, (_2 : 'tv_block)) = _menhir_stack in let _v : 'tv_try_statement = # 306 "js_parser.mly" ( (J.Try_statement (_2, None, Some _3), J.Pi pi) ) # 15687 "js_parser.ml" in _menhir_goto_try_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv974)) : 'freshtv976) | MenhirState471 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv979) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_finally) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv977) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((x : 'tv_finally) : 'tv_finally) = _v in ((let _v : 'tv_option_finally_ = # 116 "" ( Some x ) # 15702 "js_parser.ml" in _menhir_goto_option_finally_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv978)) : 'freshtv980) | _ -> _menhir_fail ()) : 'freshtv982)) : 'freshtv984)) : 'freshtv986) | MenhirState468 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv995 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15712 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15716 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 15720 "js_parser.ml" )) * _menhir_state * 'tv_block) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv993 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15726 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15730 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 15734 "js_parser.ml" )) * _menhir_state * 'tv_block) = Obj.magic _menhir_stack in ((let (((((_menhir_stack, _menhir_s, (_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 15739 "js_parser.ml" ))), (_1_inlined1 : ( # 68 "js_parser.mly" (Parse_info.t) # 15743 "js_parser.ml" ))), _, (item : 'tv_variable)), (_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 15747 "js_parser.ml" ))), _, (y : 'tv_block)) = _menhir_stack in let _v : 'tv_catch = let pair = let _1 = _1_inlined1 in let x = # 722 "js_parser.mly" ( item ) # 15754 "js_parser.ml" in # 167 "" ( (x, y) ) # 15759 "js_parser.ml" in # 309 "js_parser.mly" ( pair ) # 15765 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv991) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_catch) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv989 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15776 "js_parser.ml" )) * _menhir_state * 'tv_block) * _menhir_state * 'tv_catch) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_FINALLY _v -> _menhir_run463 _menhir_env (Obj.magic _menhir_stack) MenhirState471 _v | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv987) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState471 in ((let _v : 'tv_option_finally_ = # 114 "" ( None ) # 15790 "js_parser.ml" in _menhir_goto_option_finally_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv988) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState471) : 'freshtv990)) : 'freshtv992)) : 'freshtv994)) : 'freshtv996) | _ -> _menhir_fail ()) : 'freshtv998)) : 'freshtv1000)) : 'freshtv1002) | _ -> _menhir_fail ()) : 'freshtv1004)) : 'freshtv1006)) : 'freshtv1008) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv1009 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 15808 "js_parser.ml" )) * _menhir_state * 'tv_list_statement_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv1010)) : 'freshtv1012) | _ -> _menhir_fail () and _menhir_goto_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState289 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv875 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15824 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_WHILE _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv871 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15834 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in let (_v : ( # 57 "js_parser.mly" (Parse_info.t) # 15839 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv867 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15850 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 57 "js_parser.mly" (Parse_info.t) # 15854 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 15859 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState319 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState319) : 'freshtv868) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv869 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15924 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 57 "js_parser.mly" (Parse_info.t) # 15928 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv870)) : 'freshtv872) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv873 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15939 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv874)) : 'freshtv876) | MenhirState390 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv885 * _menhir_state * 'tv_label) * ( # 82 "js_parser.mly" (Parse_info.t) # 15948 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv883 * _menhir_state * 'tv_label) * ( # 82 "js_parser.mly" (Parse_info.t) # 15954 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, (l : 'tv_label)), (_2 : ( # 82 "js_parser.mly" (Parse_info.t) # 15959 "js_parser.ml" ))), _, (s : 'tv_statement)) = _menhir_stack in let _v : 'tv_labeled_statement = # 221 "js_parser.mly" ( J.Labelled_statement (l, s), J.N ) # 15964 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv881) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_labeled_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv879) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_labeled_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv877) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_labeled_statement) : 'tv_labeled_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 15981 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv878)) : 'freshtv880)) : 'freshtv882)) : 'freshtv884)) : 'freshtv886) | MenhirState288 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((((('freshtv889 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15989 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 15993 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 15997 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 82 "js_parser.mly" (Parse_info.t) # 16001 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16005 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((((('freshtv887 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16011 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16015 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16019 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 82 "js_parser.mly" (Parse_info.t) # 16023 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16027 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (((((((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16032 "js_parser.ml" ))), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 16036 "js_parser.ml" ))), _, (_3 : ( # 57 "js_parser.mly" (Parse_info.t) # 16040 "js_parser.ml" ))), _, (x : 'tv_variable)), _, (y : 'tv_option_initializer_no_in_)), (_5 : ( # 82 "js_parser.mly" (Parse_info.t) # 16044 "js_parser.ml" ))), _, (right : 'tv_expression)), (_7 : ( # 68 "js_parser.mly" (Parse_info.t) # 16048 "js_parser.ml" ))), _, (body : 'tv_statement)) = _menhir_stack in let _v : 'tv_for_in_statement = let left = # 167 "" ( (x, y) ) # 16053 "js_parser.ml" in # 274 "js_parser.mly" ( J.ForIn_statement (J.Right left, right, body), J.Pi pi ) # 16058 "js_parser.ml" in _menhir_goto_for_in_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv888)) : 'freshtv890) | MenhirState425 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((((((('freshtv893 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16066 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16070 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16074 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 16078 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16082 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16086 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((((((('freshtv891 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16092 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16096 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16100 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 16104 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16108 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16112 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let ((((((((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16117 "js_parser.ml" ))), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 16121 "js_parser.ml" ))), _, (_3 : ( # 57 "js_parser.mly" (Parse_info.t) # 16125 "js_parser.ml" ))), _, (initial : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___)), (_5 : ( # 68 "js_parser.mly" (Parse_info.t) # 16129 "js_parser.ml" ))), _, (condition : 'tv_option_expression_)), (_7 : ( # 68 "js_parser.mly" (Parse_info.t) # 16133 "js_parser.ml" ))), _, (increment : 'tv_option_expression_)), (_9 : ( # 68 "js_parser.mly" (Parse_info.t) # 16137 "js_parser.ml" ))), _, (statement : 'tv_statement)) = _menhir_stack in let _v : 'tv_for_statement = # 266 "js_parser.mly" ( J.For_statement (J.Right initial, condition, increment, statement), J.Pi pi ) # 16142 "js_parser.ml" in _menhir_goto_for_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv892)) : 'freshtv894) | MenhirState432 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((((('freshtv897 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16150 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16154 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16158 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16162 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16166 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((((('freshtv895 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16172 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16176 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16180 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16184 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 16188 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (((((((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16193 "js_parser.ml" ))), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 16197 "js_parser.ml" ))), _, (initial : 'tv_option_expression_no_in_)), (_4 : ( # 68 "js_parser.mly" (Parse_info.t) # 16201 "js_parser.ml" ))), _, (condition : 'tv_option_expression_)), (_6 : ( # 68 "js_parser.mly" (Parse_info.t) # 16205 "js_parser.ml" ))), _, (increment : 'tv_option_expression_)), (_8 : ( # 68 "js_parser.mly" (Parse_info.t) # 16209 "js_parser.ml" ))), _, (statement : 'tv_statement)) = _menhir_stack in let _v : 'tv_for_statement = # 261 "js_parser.mly" ( J.For_statement (J.Left initial, condition, increment, statement), J.Pi pi ) # 16214 "js_parser.ml" in _menhir_goto_for_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv896)) : 'freshtv898) | MenhirState437 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv901 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16222 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16226 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 16230 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16234 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv899 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16240 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16244 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 16248 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16252 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (((((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16257 "js_parser.ml" ))), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 16261 "js_parser.ml" ))), _, (left : 'tv_left_hand_side_expression)), _, (_4 : ( # 82 "js_parser.mly" (Parse_info.t) # 16265 "js_parser.ml" ))), _, (right : 'tv_expression)), (_6 : ( # 68 "js_parser.mly" (Parse_info.t) # 16269 "js_parser.ml" ))), _, (body : 'tv_statement)) = _menhir_stack in let _v : 'tv_for_in_statement = # 271 "js_parser.mly" ( J.ForIn_statement (J.Left left, right, body), J.Pi pi ) # 16274 "js_parser.ml" in _menhir_goto_for_in_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv900)) : 'freshtv902) | MenhirState238 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv909 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16282 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16286 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16290 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_ELSE _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv903 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16300 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16304 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16308 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in let (_v : ( # 63 "js_parser.mly" (Parse_info.t) # 16313 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState444 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState444) : 'freshtv904) | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv905 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16402 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16406 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16410 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16415 "js_parser.ml" ))), (_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 16419 "js_parser.ml" ))), _, (item : 'tv_expression)), (_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 16423 "js_parser.ml" ))), _, (t : 'tv_statement)) = _menhir_stack in let _v : 'tv_if_statement = let condition = # 722 "js_parser.mly" ( item ) # 16428 "js_parser.ml" in # 247 "js_parser.mly" ( (J.If_statement (condition, t, None), J.Pi pi) ) # 16433 "js_parser.ml" in _menhir_goto_if_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv906) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv907 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16443 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16447 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16451 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv908)) : 'freshtv910) | MenhirState444 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv913 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16460 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16464 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16468 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 63 "js_parser.mly" (Parse_info.t) # 16472 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv911 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16478 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16482 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16486 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 63 "js_parser.mly" (Parse_info.t) # 16490 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (((((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16495 "js_parser.ml" ))), (_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 16499 "js_parser.ml" ))), _, (item : 'tv_expression)), (_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 16503 "js_parser.ml" ))), _, (t : 'tv_statement)), (_4 : ( # 63 "js_parser.mly" (Parse_info.t) # 16507 "js_parser.ml" ))), _, (e : 'tv_statement)) = _menhir_stack in let _v : 'tv_if_statement = let condition = # 722 "js_parser.mly" ( item ) # 16512 "js_parser.ml" in # 245 "js_parser.mly" ( (J.If_statement (condition, t, Some e), J.Pi pi) ) # 16517 "js_parser.ml" in _menhir_goto_if_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv912)) : 'freshtv914) | MenhirState206 | MenhirState451 | MenhirState446 | MenhirState216 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv915 * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState446 _v | Js_token.T_CASE _ | Js_token.T_DEFAULT _ | Js_token.T_RCURLY _ -> _menhir_reduce123 _menhir_env (Obj.magic _menhir_stack) MenhirState446 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState446) : 'freshtv916) | MenhirState191 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv925 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16611 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16615 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16619 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv923 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16625 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16629 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16633 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16638 "js_parser.ml" ))), (_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 16642 "js_parser.ml" ))), _, (item : 'tv_expression)), (_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 16646 "js_parser.ml" ))), _, (body : 'tv_statement)) = _menhir_stack in let _v : 'tv_while_statement = let condition = # 722 "js_parser.mly" ( item ) # 16651 "js_parser.ml" in # 255 "js_parser.mly" ( (J.While_statement (condition, body), J.Pi pi) ) # 16656 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv921) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_while_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv919) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_while_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv917) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_while_statement) : 'tv_while_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 16673 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv918)) : 'freshtv920)) : 'freshtv922)) : 'freshtv924)) : 'freshtv926) | MenhirState0 | MenhirState482 | MenhirState68 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv929 * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv927 * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_statement)) = _menhir_stack in let _v : 'tv_source_element = # 149 "js_parser.mly" ( let statement, pi = _1 in J.Statement statement, pi ) # 16685 "js_parser.ml" in _menhir_goto_source_element _menhir_env _menhir_stack _menhir_s _v) : 'freshtv928)) : 'freshtv930) | MenhirState523 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv939 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16693 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16697 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16701 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv937 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16707 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 16711 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 16715 "js_parser.ml" )) * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (((((_menhir_stack, _menhir_s, (_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 16720 "js_parser.ml" ))), (_1_inlined1 : ( # 68 "js_parser.mly" (Parse_info.t) # 16724 "js_parser.ml" ))), _, (item : 'tv_expression)), (_3_inlined1 : ( # 68 "js_parser.mly" (Parse_info.t) # 16728 "js_parser.ml" ))), _, (_3 : 'tv_statement)) = _menhir_stack in let _v : 'tv_with_statement = let _2 = let (_3, _1) = (_3_inlined1, _1_inlined1) in # 722 "js_parser.mly" ( item ) # 16735 "js_parser.ml" in # 289 "js_parser.mly" ( assert false ) # 16741 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv935) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_with_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv933) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_with_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv931) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_with_statement) : 'tv_with_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 16758 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv932)) : 'freshtv934)) : 'freshtv936)) : 'freshtv938)) : 'freshtv940) | _ -> _menhir_fail () and _menhir_goto_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_ : _menhir_env -> 'ttv_tail -> 'tv_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_ -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv865 * _menhir_state * 'tv_statement_need_semi) = Obj.magic _menhir_stack in let (_v : 'tv_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv863 * _menhir_state * 'tv_statement_need_semi) = Obj.magic _menhir_stack in let ((_2 : 'tv_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_) : 'tv_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_) = _v in ((let (_menhir_stack, _menhir_s, (s : 'tv_statement_need_semi)) = _menhir_stack in let _v : 'tv_statement = # 187 "js_parser.mly" ( s ) # 16776 "js_parser.ml" in _menhir_goto_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv864)) : 'freshtv866) and _menhir_goto_option_label_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_option_label_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState297 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv851 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16788 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_option_label_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv849 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16796 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : 'tv_option_label_) : 'tv_option_label_) = _v in ((let (_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16803 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_continue_statement = # 280 "js_parser.mly" ( (J.Continue_statement _2,J.Pi pi) ) # 16808 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv847) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_continue_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv845) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_continue_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv843) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_continue_statement) : 'tv_continue_statement) = _v in ((let _v : 'tv_statement_need_semi = # 183 "js_parser.mly" ( s ) # 16825 "js_parser.ml" in _menhir_goto_statement_need_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv844)) : 'freshtv846)) : 'freshtv848)) : 'freshtv850)) : 'freshtv852) | MenhirState301 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv861 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16833 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_option_label_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv859 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 16841 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : 'tv_option_label_) : 'tv_option_label_) = _v in ((let (_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 16848 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_break_statement = # 283 "js_parser.mly" ( (J.Break_statement _2, J.Pi pi) ) # 16853 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv857) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_break_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv855) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_break_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv853) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_break_statement) : 'tv_break_statement) = _v in ((let _v : 'tv_statement_need_semi = # 183 "js_parser.mly" ( s ) # 16870 "js_parser.ml" in _menhir_goto_statement_need_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv854)) : 'freshtv856)) : 'freshtv858)) : 'freshtv860)) : 'freshtv862) | _ -> _menhir_fail () and _menhir_goto_member_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_member_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv841 * _menhir_state * 'tv_member_expression_no_statement) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv835 * _menhir_state * 'tv_member_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState378 in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 16891 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState381 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState381) : 'freshtv836) | Js_token.T_LPAREN _v -> _menhir_run91 _menhir_env (Obj.magic _menhir_stack) MenhirState378 _v | Js_token.T_PERIOD _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv837 * _menhir_state * 'tv_member_expression_no_statement) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState378 in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 16958 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BREAK _v -> _menhir_run47 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_CASE _v -> _menhir_run46 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_CATCH _v -> _menhir_run45 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_CONTINUE _v -> _menhir_run44 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_DEBUGGER _v -> _menhir_run43 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_DEFAULT _v -> _menhir_run42 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_DELETE _v -> _menhir_run41 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_DO _v -> _menhir_run40 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_ELSE _v -> _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_FALSE _v -> _menhir_run38 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_FINALLY _v -> _menhir_run37 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_FOR _v -> _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_FUNCTION _v -> _menhir_run35 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_IDENTIFIER _v -> _menhir_run34 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_IF _v -> _menhir_run33 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_IN _v -> _menhir_run32 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_INSTANCEOF _v -> _menhir_run31 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_NEW _v -> _menhir_run30 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_NULL _v -> _menhir_run29 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_RETURN _v -> _menhir_run28 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_SWITCH _v -> _menhir_run26 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_THIS _v -> _menhir_run25 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_THROW _v -> _menhir_run24 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_TRUE _v -> _menhir_run23 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_TRY _v -> _menhir_run22 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_TYPEOF _v -> _menhir_run21 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_VAR _v -> _menhir_run20 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_VOID _v -> _menhir_run19 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_WHILE _v -> _menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | Js_token.T_WITH _v -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState379 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState379) : 'freshtv838) | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_ASSIGN _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_AND_ASSIGN _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_OR_ASSIGN _ | Js_token.T_BIT_XOR _ | Js_token.T_BIT_XOR_ASSIGN _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DIV_ASSIGN _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LSHIFT _ | Js_token.T_LSHIFT_ASSIGN _ | Js_token.T_MINUS _ | Js_token.T_MINUS_ASSIGN _ | Js_token.T_MOD _ | Js_token.T_MOD_ASSIGN _ | Js_token.T_MULT _ | Js_token.T_MULT_ASSIGN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_PLUS_ASSIGN _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_RSHIFT3_ASSIGN _ | Js_token.T_RSHIFT_ASSIGN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv839 * _menhir_state * 'tv_member_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (_1 : 'tv_member_expression_no_statement)) = _menhir_stack in let _v : 'tv_new_expression_no_statement = # 489 "js_parser.mly" ( _1 ) # 17035 "js_parser.ml" in _menhir_goto_new_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv840) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState378) : 'freshtv842) and _menhir_goto_primary_expression : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_primary_expression -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv833) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_primary_expression) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv831) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((e : 'tv_primary_expression) : 'tv_primary_expression) = _v in ((let _v : 'tv_member_expression = # 400 "js_parser.mly" ( e ) # 17056 "js_parser.ml" in _menhir_goto_member_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv832)) : 'freshtv834) and _menhir_goto_identifier_or_kw : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_identifier_or_kw -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState89 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv813 * _menhir_state * 'tv_member_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17068 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_identifier_or_kw) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv811 * _menhir_state * 'tv_member_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17076 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((i : 'tv_identifier_or_kw) : 'tv_identifier_or_kw) = _v in ((let ((_menhir_stack, _menhir_s, (_1 : 'tv_member_expression)), _, (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 17083 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_member_expression = # 404 "js_parser.mly" ( let (start, e1) = _1 in (start, J.EDot(e1,i)) ) # 17088 "js_parser.ml" in _menhir_goto_member_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv812)) : 'freshtv814) | MenhirState106 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv817 * _menhir_state * 'tv_call_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17096 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_identifier_or_kw) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv815 * _menhir_state * 'tv_call_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17104 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_3 : 'tv_identifier_or_kw) : 'tv_identifier_or_kw) = _v in ((let ((_menhir_stack, _menhir_s, (_1 : 'tv_call_expression)), _, (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 17111 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_call_expression = # 392 "js_parser.mly" ( let (start, e) = _1 in (start, J.EDot (e, _3)) ) # 17116 "js_parser.ml" in _menhir_goto_call_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv816)) : 'freshtv818) | MenhirState379 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv821 * _menhir_state * 'tv_member_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17124 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_identifier_or_kw) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv819 * _menhir_state * 'tv_member_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17132 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((i : 'tv_identifier_or_kw) : 'tv_identifier_or_kw) = _v in ((let ((_menhir_stack, _menhir_s, (_1 : 'tv_member_expression_no_statement)), _, (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 17139 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_member_expression_no_statement = # 508 "js_parser.mly" ( let (start, e1) = _1 in (start, J.EDot(e1,i)) ) # 17144 "js_parser.ml" in _menhir_goto_member_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv820)) : 'freshtv822) | MenhirState406 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv825 * _menhir_state * 'tv_call_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17152 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_identifier_or_kw) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv823 * _menhir_state * 'tv_call_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17160 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_3 : 'tv_identifier_or_kw) : 'tv_identifier_or_kw) = _v in ((let ((_menhir_stack, _menhir_s, (_1 : 'tv_call_expression_no_statement)), _, (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 17167 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_call_expression_no_statement = # 500 "js_parser.mly" ( let (start, e) = _1 in (start, J.EDot(e,_3)) ) # 17172 "js_parser.ml" in _menhir_goto_call_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv824)) : 'freshtv826) | MenhirState16 | MenhirState506 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv829) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_identifier_or_kw) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv827) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((i : 'tv_identifier_or_kw) : 'tv_identifier_or_kw) = _v in ((let _v : 'tv_property_name = # 633 "js_parser.mly" ( J.PNI i ) # 17187 "js_parser.ml" in _menhir_goto_property_name _menhir_env _menhir_stack _menhir_s _v) : 'freshtv828)) : 'freshtv830) | _ -> _menhir_fail () and _menhir_goto_elison_rev : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_elison_rev -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState52 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv801 * _menhir_state * 'tv_elison_rev) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState491 _v | Js_token.T_COMMA _ | Js_token.T_RBRACKET _ -> _menhir_reduce59 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState491) : 'freshtv802) | MenhirState496 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv809 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17262 "js_parser.ml" )) * _menhir_state * 'tv_element_list_rev) * _menhir_state * 'tv_elison_rev) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv805 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17272 "js_parser.ml" )) * _menhir_state * 'tv_element_list_rev) * _menhir_state * 'tv_elison_rev) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 17277 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv803 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17284 "js_parser.ml" )) * _menhir_state * 'tv_element_list_rev) * _menhir_state * 'tv_elison_rev) = Obj.magic _menhir_stack in let ((_4 : ( # 68 "js_parser.mly" (Parse_info.t) # 17289 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 17293 "js_parser.ml" )) = _v in ((let (((_menhir_stack, _menhir_s, (pi : ( # 68 "js_parser.mly" (Parse_info.t) # 17298 "js_parser.ml" ))), _, (_2 : 'tv_element_list_rev)), _, (_3 : 'tv_elison_rev)) = _menhir_stack in let _v : 'tv_array_literal = # 552 "js_parser.mly" ( (pi, J.EArr (List.rev_append _2 (List.rev _3))) ) # 17303 "js_parser.ml" in _menhir_goto_array_literal _menhir_env _menhir_stack _menhir_s _v) : 'freshtv804)) : 'freshtv806) | Js_token.T_BIT_NOT _ | Js_token.T_COMMA _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DELETE _ | Js_token.T_FALSE _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_REGEX _ | Js_token.T_STRING _ | Js_token.T_THIS _ | Js_token.T_TRUE _ | Js_token.T_TYPEOF _ | Js_token.T_VOID _ -> _menhir_reduce59 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv807 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17315 "js_parser.ml" )) * _menhir_state * 'tv_element_list_rev) * _menhir_state * 'tv_elison_rev) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv808)) : 'freshtv810) | _ -> _menhir_fail () and _menhir_reduce154 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _v : 'tv_option_initializer_no_in_ = # 114 "" ( None ) # 17327 "js_parser.ml" in _menhir_goto_option_initializer_no_in_ _menhir_env _menhir_stack _menhir_s _v and _menhir_run244 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 77 "js_parser.mly" (Parse_info.t) # 17334 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState244 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState244 and _menhir_goto_option_initializer__ : _menhir_env -> 'ttv_tail -> 'tv_option_initializer__ -> 'ttv_return = fun _menhir_env _menhir_stack _v -> let _menhir_stack = (_menhir_stack, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv799 * _menhir_state * 'tv_variable) * 'tv_option_initializer__) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv793 * _menhir_state * 'tv_variable) * 'tv_option_initializer__) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 17408 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState199 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState199) : 'freshtv794) | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv795 * _menhir_state * 'tv_variable) * 'tv_option_initializer__) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (x : 'tv_variable)), (y : 'tv_option_initializer__)) = _menhir_stack in let _v : 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____ = let x = # 167 "" ( (x, y) ) # 17427 "js_parser.ml" in # 241 "" ( [ x ] ) # 17432 "js_parser.ml" in _menhir_goto_separated_nonempty_list_T_COMMA_pair_variable_option_initializer____ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv796) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv797 * _menhir_state * 'tv_variable) * 'tv_option_initializer__) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv798)) : 'freshtv800) and _menhir_goto_separated_nonempty_list_T_COMMA_variable_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_separated_nonempty_list_T_COMMA_variable_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState63 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv787 * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 17451 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_separated_nonempty_list_T_COMMA_variable_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv785 * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 17459 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((xs : 'tv_separated_nonempty_list_T_COMMA_variable_) : 'tv_separated_nonempty_list_T_COMMA_variable_) = _v in ((let ((_menhir_stack, _menhir_s, (x : 'tv_variable)), (_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 17466 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_separated_nonempty_list_T_COMMA_variable_ = # 243 "" ( x :: xs ) # 17471 "js_parser.ml" in _menhir_goto_separated_nonempty_list_T_COMMA_variable_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv786)) : 'freshtv788) | MenhirState477 | MenhirState61 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv791) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_separated_nonempty_list_T_COMMA_variable_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv789) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((x : 'tv_separated_nonempty_list_T_COMMA_variable_) : 'tv_separated_nonempty_list_T_COMMA_variable_) = _v in ((let _v : 'tv_loption_separated_nonempty_list_T_COMMA_variable__ = # 144 "" ( x ) # 17486 "js_parser.ml" in _menhir_goto_loption_separated_nonempty_list_T_COMMA_variable__ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv790)) : 'freshtv792) | _ -> _menhir_fail () and _menhir_reduce127 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _v : 'tv_loption_separated_nonempty_list_T_COMMA_variable__ = # 142 "" ( [] ) # 17497 "js_parser.ml" in _menhir_goto_loption_separated_nonempty_list_T_COMMA_variable__ _menhir_env _menhir_stack _menhir_s _v and _menhir_goto_list_source_element_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_list_source_element_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState482 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv739 * _menhir_state * 'tv_source_element) * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv737 * _menhir_state * 'tv_source_element) * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, (x : 'tv_source_element)), _, (xs : 'tv_list_source_element_)) = _menhir_stack in let _v : 'tv_list_source_element_ = # 213 "" ( x :: xs ) # 17514 "js_parser.ml" in _menhir_goto_list_source_element_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv738)) : 'freshtv740) | MenhirState68 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv769 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17522 "js_parser.ml" )) * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RCURLY _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv765 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17532 "js_parser.ml" )) * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 17537 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv763 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17544 "js_parser.ml" )) * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in let ((pi2 : ( # 68 "js_parser.mly" (Parse_info.t) # 17549 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 17553 "js_parser.ml" )) = _v in ((let ((_menhir_stack, _menhir_s, (pi1 : ( # 68 "js_parser.mly" (Parse_info.t) # 17558 "js_parser.ml" ))), _, (x : 'tv_list_source_element_)) = _menhir_stack in let _v : 'tv_curly_block_list_source_element__ = # 649 "js_parser.mly" ( (x, pi1, pi2) ) # 17563 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv761) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_list_source_element__) = _v in ((match _menhir_s with | MenhirState479 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv749 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 17575 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 17579 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) * ( # 68 "js_parser.mly" (Parse_info.t) # 17583 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_list_source_element__) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv747 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 17591 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 17595 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) * ( # 68 "js_parser.mly" (Parse_info.t) # 17599 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((block : 'tv_curly_block_list_source_element__) : 'tv_curly_block_list_source_element__) = _v in ((let (((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 17606 "js_parser.ml" ))), _, (name : 'tv_variable)), (_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 17610 "js_parser.ml" ))), _, (xs : 'tv_loption_separated_nonempty_list_T_COMMA_variable__)), (_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 17614 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_function_declaration = let args = let item = # 232 "" ( xs ) # 17620 "js_parser.ml" in # 722 "js_parser.mly" ( item ) # 17625 "js_parser.ml" in # 331 "js_parser.mly" ( let elements, _pi_start, pi_end = block in (name, args, elements, J.Pi pi_end), J.Pi pi ) # 17632 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv745) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_function_declaration) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv743) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_function_declaration) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv741) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_function_declaration) : 'tv_function_declaration) = _v in ((let _v : 'tv_source_element = # 151 "js_parser.mly" ( let declaration, pi = _1 in J.Function_declaration declaration, pi ) # 17649 "js_parser.ml" in _menhir_goto_source_element _menhir_env _menhir_stack _menhir_s _v) : 'freshtv742)) : 'freshtv744)) : 'freshtv746)) : 'freshtv748)) : 'freshtv750) | MenhirState67 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv759 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 17657 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) * ( # 68 "js_parser.mly" (Parse_info.t) # 17661 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) * ( # 68 "js_parser.mly" (Parse_info.t) # 17665 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_list_source_element__) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv757 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 17673 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) * ( # 68 "js_parser.mly" (Parse_info.t) # 17677 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) * ( # 68 "js_parser.mly" (Parse_info.t) # 17681 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((block : 'tv_curly_block_list_source_element__) : 'tv_curly_block_list_source_element__) = _v in ((let (((((_menhir_stack, _menhir_s, (pi : ( # 57 "js_parser.mly" (Parse_info.t) # 17688 "js_parser.ml" ))), _, (name : 'tv_option_variable_)), (_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 17692 "js_parser.ml" ))), _, (xs : 'tv_loption_separated_nonempty_list_T_COMMA_variable__)), (_3 : ( # 68 "js_parser.mly" (Parse_info.t) # 17696 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_function_expression = let args = let item = # 232 "" ( xs ) # 17702 "js_parser.ml" in # 722 "js_parser.mly" ( item ) # 17707 "js_parser.ml" in # 337 "js_parser.mly" ( let elements, _pi_start, _pi_end = block in pi, J.EFun (name, args, elements, J.Pi pi) ) # 17714 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv755) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_function_expression) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv753) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_function_expression) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv751) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((e : 'tv_function_expression) : 'tv_function_expression) = _v in ((let _v : 'tv_primary_expression = # 411 "js_parser.mly" ( e ) # 17731 "js_parser.ml" in _menhir_goto_primary_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv752)) : 'freshtv754)) : 'freshtv756)) : 'freshtv758)) : 'freshtv760) | _ -> _menhir_fail ()) : 'freshtv762)) : 'freshtv764)) : 'freshtv766) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv767 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 17743 "js_parser.ml" )) * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv768)) : 'freshtv770) | MenhirState0 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv783 * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.EOF _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv779 * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in let (_v : ( # 104 "js_parser.mly" (Parse_info.t) # 17759 "js_parser.ml" )) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv777 * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in let ((_2 : ( # 104 "js_parser.mly" (Parse_info.t) # 17766 "js_parser.ml" )) : ( # 104 "js_parser.mly" (Parse_info.t) # 17770 "js_parser.ml" )) = _v in ((let (_menhir_stack, _menhir_s, (l : 'tv_list_source_element_)) = _menhir_stack in let _v : ( # 132 "js_parser.mly" (Javascript.program) # 17776 "js_parser.ml" ) = # 142 "js_parser.mly" ( l ) # 17780 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv775) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : ( # 132 "js_parser.mly" (Javascript.program) # 17788 "js_parser.ml" )) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv773) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : ( # 132 "js_parser.mly" (Javascript.program) # 17796 "js_parser.ml" )) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv771) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 132 "js_parser.mly" (Javascript.program) # 17804 "js_parser.ml" )) : ( # 132 "js_parser.mly" (Javascript.program) # 17808 "js_parser.ml" )) = _v in (Obj.magic _1 : 'freshtv772)) : 'freshtv774)) : 'freshtv776)) : 'freshtv778)) : 'freshtv780) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv781 * _menhir_state * 'tv_list_source_element_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv782)) : 'freshtv784) | _ -> _menhir_fail () and _menhir_goto_statement_no_semi : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_statement_no_semi -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv735) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_statement_no_semi) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv733) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_statement_no_semi) : 'tv_statement_no_semi) = _v in ((let _v : 'tv_statement = # 186 "js_parser.mly" ( s ) # 17834 "js_parser.ml" in _menhir_goto_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv734)) : 'freshtv736) and _menhir_reduce146 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _v : 'tv_option_expression_ = # 114 "" ( None ) # 17843 "js_parser.ml" in _menhir_goto_option_expression_ _menhir_env _menhir_stack _menhir_s _v and _menhir_reduce123 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _v : 'tv_list_statement_ = # 211 "" ( [] ) # 17852 "js_parser.ml" in _menhir_goto_list_statement_ _menhir_env _menhir_stack _menhir_s _v and _menhir_reduce113 : _menhir_env -> 'ttv_tail * _menhir_state * ( # 52 "js_parser.mly" (string * Parse_info.t) # 17859 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack -> let (_menhir_stack, _menhir_s, (_1 : ( # 52 "js_parser.mly" (string * Parse_info.t) # 17865 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_label = # 630 "js_parser.mly" ( J.Label.of_string (fst _1) ) # 17870 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv731) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_label) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState301 | MenhirState297 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv723 * _menhir_state * 'tv_label) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv721 * _menhir_state * 'tv_label) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_label)) = _menhir_stack in let _v : 'tv_option_label_ = # 116 "" ( Some x ) # 17887 "js_parser.ml" in _menhir_goto_option_label_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv722)) : 'freshtv724) | MenhirState0 | MenhirState523 | MenhirState68 | MenhirState482 | MenhirState191 | MenhirState206 | MenhirState451 | MenhirState216 | MenhirState446 | MenhirState238 | MenhirState444 | MenhirState437 | MenhirState432 | MenhirState425 | MenhirState288 | MenhirState390 | MenhirState289 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv729 * _menhir_state * 'tv_label) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv725 * _menhir_state * 'tv_label) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 17902 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState390 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState390) : 'freshtv726) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv727 * _menhir_state * 'tv_label) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv728)) : 'freshtv730) | _ -> _menhir_fail ()) : 'freshtv732) and _menhir_goto_option_expression_no_in_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_option_expression_no_in_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv719 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 18003 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 18007 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_SEMICOLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv715 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 18017 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 18021 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 18026 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState428 _v | Js_token.T_SEMICOLON _ -> _menhir_reduce146 _menhir_env (Obj.magic _menhir_stack) MenhirState428 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState428) : 'freshtv716) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv717 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 18093 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 18097 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv718)) : 'freshtv720) and _menhir_goto_statement_need_semi : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_statement_need_semi -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv713 * _menhir_state * 'tv_statement_need_semi) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_SEMICOLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv703) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 18116 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv701) = Obj.magic _menhir_stack in let ((_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 18124 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 18128 "js_parser.ml" )) = _v in ((let _v : 'tv_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_ = # 718 "js_parser.mly" ( _1 ) # 18133 "js_parser.ml" in _menhir_goto_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_ _menhir_env _menhir_stack _v) : 'freshtv702)) : 'freshtv704) | Js_token.T_VIRTUAL_SEMICOLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv707) = Obj.magic _menhir_stack in let (_v : ( # 101 "js_parser.mly" (Parse_info.t) # 18142 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv705) = Obj.magic _menhir_stack in let ((_1 : ( # 101 "js_parser.mly" (Parse_info.t) # 18150 "js_parser.ml" )) : ( # 101 "js_parser.mly" (Parse_info.t) # 18154 "js_parser.ml" )) = _v in ((let _v : 'tv_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_ = # 718 "js_parser.mly" ( _1 ) # 18159 "js_parser.ml" in _menhir_goto_either_T_SEMICOLON_T_VIRTUAL_SEMICOLON_ _menhir_env _menhir_stack _v) : 'freshtv706)) : 'freshtv708) | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv709 * _menhir_state * 'tv_statement_need_semi) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (statement : 'tv_statement_need_semi)) = _menhir_stack in match try Some ( # 188 "js_parser.mly" ( (* 7.9.1 - 1 *) (* When, as the program is parsed from left to right, a token (called the offending token) is encountered that is not allowed by any production of the grammar, then a semicolon is automatically inserted before the offending token if one or more of the following conditions is true: - The offending token is }. - The offending token is separated from the previous token by at least one LineTerminator. *) (* 7.9.1 - 2 *) (* When, as the program is parsed from left to right, the end of the input stream of tokens *) (* is encountered and the parser is unable to parse the input token stream as a single *) (* complete ECMAScript Program, then a semicolon is automatically inserted at the end *) (* of the input stream. *) (* @@@@@@@@@ HACK @@@@@@@@@@ *) (* menhir internal's *) (* look the current token: *) (* - if it is on another line (linebreak in between), accept the statement *) (* - fail otherwise *) (* @@@@@@@@@ HACK @@@@@@@@@@ *) match _tok with | EOF _ | T_RCURLY _ -> statement | token -> let info = Js_token.info_of_tok token in match info.Parse_info.fol with | Some true -> statement | _ -> (raise _eRR) ) # 18200 "js_parser.ml" : 'tv_statement) with | Error -> None with | Some _v -> _menhir_goto_statement _menhir_env _menhir_stack _menhir_s _v | None -> _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv710) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv711 * _menhir_state * 'tv_statement_need_semi) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv712)) : 'freshtv714) and _menhir_reduce156 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _v : 'tv_option_label_ = # 114 "" ( None ) # 18223 "js_parser.ml" in _menhir_goto_option_label_ _menhir_env _menhir_stack _menhir_s _v and _menhir_run298 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 52 "js_parser.mly" (string * Parse_info.t) # 18230 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in _menhir_reduce113 _menhir_env (Obj.magic _menhir_stack) and _menhir_fail : unit -> 'a = fun () -> Printf.fprintf stderr "Internal failure -- please contact the parser generator's developers.\n%!"; assert false and _menhir_goto_property_name : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_property_name -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv699 * _menhir_state * 'tv_property_name) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COLON _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv695 * _menhir_state * 'tv_property_name) = Obj.magic _menhir_stack in let (_v : ( # 82 "js_parser.mly" (Parse_info.t) # 18256 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState51 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState51) : 'freshtv696) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv697 * _menhir_state * 'tv_property_name) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv698)) : 'freshtv700) and _menhir_goto_primary_expression_no_statement : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_primary_expression_no_statement -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> match _menhir_s with | MenhirState528 | MenhirState2 | MenhirState3 | MenhirState4 | MenhirState9 | MenhirState12 | MenhirState13 | MenhirState14 | MenhirState15 | MenhirState51 | MenhirState499 | MenhirState491 | MenhirState52 | MenhirState54 | MenhirState55 | MenhirState440 | MenhirState435 | MenhirState430 | MenhirState428 | MenhirState241 | MenhirState423 | MenhirState421 | MenhirState408 | MenhirState397 | MenhirState386 | MenhirState381 | MenhirState375 | MenhirState373 | MenhirState371 | MenhirState369 | MenhirState367 | MenhirState365 | MenhirState363 | MenhirState361 | MenhirState359 | MenhirState357 | MenhirState355 | MenhirState353 | MenhirState351 | MenhirState349 | MenhirState347 | MenhirState345 | MenhirState343 | MenhirState339 | MenhirState337 | MenhirState335 | MenhirState333 | MenhirState331 | MenhirState329 | MenhirState327 | MenhirState325 | MenhirState319 | MenhirState303 | MenhirState294 | MenhirState292 | MenhirState290 | MenhirState286 | MenhirState282 | MenhirState280 | MenhirState278 | MenhirState276 | MenhirState274 | MenhirState272 | MenhirState270 | MenhirState268 | MenhirState266 | MenhirState264 | MenhirState262 | MenhirState260 | MenhirState258 | MenhirState254 | MenhirState252 | MenhirState250 | MenhirState248 | MenhirState244 | MenhirState236 | MenhirState233 | MenhirState231 | MenhirState229 | MenhirState225 | MenhirState223 | MenhirState221 | MenhirState218 | MenhirState214 | MenhirState210 | MenhirState207 | MenhirState203 | MenhirState196 | MenhirState192 | MenhirState70 | MenhirState72 | MenhirState73 | MenhirState74 | MenhirState183 | MenhirState181 | MenhirState176 | MenhirState174 | MenhirState172 | MenhirState170 | MenhirState168 | MenhirState164 | MenhirState160 | MenhirState158 | MenhirState156 | MenhirState154 | MenhirState152 | MenhirState150 | MenhirState148 | MenhirState146 | MenhirState142 | MenhirState128 | MenhirState126 | MenhirState124 | MenhirState122 | MenhirState120 | MenhirState118 | MenhirState116 | MenhirState112 | MenhirState110 | MenhirState108 | MenhirState99 | MenhirState97 | MenhirState95 | MenhirState91 | MenhirState75 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv689) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_primary_expression_no_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv687) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((e : 'tv_primary_expression_no_statement) : 'tv_primary_expression_no_statement) = _v in ((let _v : 'tv_primary_expression = # 411 "js_parser.mly" ( e ) # 18337 "js_parser.ml" in _menhir_goto_primary_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv688)) : 'freshtv690) | MenhirState0 | MenhirState523 | MenhirState68 | MenhirState482 | MenhirState191 | MenhirState206 | MenhirState451 | MenhirState216 | MenhirState446 | MenhirState238 | MenhirState444 | MenhirState437 | MenhirState432 | MenhirState425 | MenhirState288 | MenhirState390 | MenhirState289 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv693) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_primary_expression_no_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv691) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((e : 'tv_primary_expression_no_statement) : 'tv_primary_expression_no_statement) = _v in ((let _v : 'tv_member_expression_no_statement = # 504 "js_parser.mly" ( e ) # 18352 "js_parser.ml" in _menhir_goto_member_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv692)) : 'freshtv694) | _ -> _menhir_fail () and _menhir_goto_object_literal : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_object_literal -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv685) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_object_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv683) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((e : 'tv_object_literal) : 'tv_object_literal) = _v in ((let _v : 'tv_primary_expression = # 411 "js_parser.mly" ( e ) # 18371 "js_parser.ml" in _menhir_goto_primary_expression _menhir_env _menhir_stack _menhir_s _v) : 'freshtv684)) : 'freshtv686) and _menhir_run17 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18378 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv681) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18388 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18392 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 617 "js_parser.mly" ( "with" ) # 18397 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv682) and _menhir_run18 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18404 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv679) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18414 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18418 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 597 "js_parser.mly" ( "while" ) # 18423 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv680) and _menhir_run19 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 18430 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv677) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 18440 "js_parser.ml" )) : ( # 82 "js_parser.mly" (Parse_info.t) # 18444 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 615 "js_parser.mly" ( "void" ) # 18449 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv678) and _menhir_run20 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18456 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv675) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18466 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18470 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 614 "js_parser.mly" ( "var" ) # 18475 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv676) and _menhir_run21 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 18482 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv673) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 18492 "js_parser.ml" )) : ( # 82 "js_parser.mly" (Parse_info.t) # 18496 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 613 "js_parser.mly" ( "typeof" ) # 18501 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv674) and _menhir_run22 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18508 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv671) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18518 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18522 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 612 "js_parser.mly" ( "try" ) # 18527 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv672) and _menhir_run23 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18534 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv669) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18544 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18548 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 620 "js_parser.mly" ( "true" ) # 18553 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv670) and _menhir_run24 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18560 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv667) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18570 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18574 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 611 "js_parser.mly" ( "throw" ) # 18579 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv668) and _menhir_run25 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18586 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv665) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18596 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18600 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 610 "js_parser.mly" ( "this" ) # 18605 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv666) and _menhir_run26 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18612 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv663) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18622 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18626 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 609 "js_parser.mly" ( "switch" ) # 18631 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv664) and _menhir_run27 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 53 "js_parser.mly" (string * Parse_info.t) # 18638 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv661) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : ( # 53 "js_parser.mly" (string * Parse_info.t) # 18648 "js_parser.ml" )) : ( # 53 "js_parser.mly" (string * Parse_info.t) # 18652 "js_parser.ml" )) = _v in ((let _v : 'tv_property_name = # 634 "js_parser.mly" ( J.PNS (fst s) ) # 18657 "js_parser.ml" in _menhir_goto_property_name _menhir_env _menhir_stack _menhir_s _v) : 'freshtv662) and _menhir_run28 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18664 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv659) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18674 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18678 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 608 "js_parser.mly" ( "return" ) # 18683 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv660) and _menhir_run29 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18690 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv657) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18700 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18704 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 618 "js_parser.mly" ( "null" ) # 18709 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv658) and _menhir_run30 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 65 "js_parser.mly" (Parse_info.t) # 18716 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv655) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 65 "js_parser.mly" (Parse_info.t) # 18726 "js_parser.ml" )) : ( # 65 "js_parser.mly" (Parse_info.t) # 18730 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 607 "js_parser.mly" ( "new" ) # 18735 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv656) and _menhir_run31 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 18742 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv653) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 18752 "js_parser.ml" )) : ( # 82 "js_parser.mly" (Parse_info.t) # 18756 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 595 "js_parser.mly" ( "instanceof" ) # 18761 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv654) and _menhir_run32 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 18768 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv651) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 18778 "js_parser.ml" )) : ( # 82 "js_parser.mly" (Parse_info.t) # 18782 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 594 "js_parser.mly" ( "in" ) # 18787 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv652) and _menhir_run33 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18794 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv649) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18804 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18808 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 606 "js_parser.mly" ( "if" ) # 18813 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv650) and _menhir_run34 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 52 "js_parser.mly" (string * Parse_info.t) # 18820 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv647) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 52 "js_parser.mly" (string * Parse_info.t) # 18830 "js_parser.ml" )) : ( # 52 "js_parser.mly" (string * Parse_info.t) # 18834 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 591 "js_parser.mly" ( fst _1 ) # 18839 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv648) and _menhir_run35 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18846 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv645) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18856 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18860 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 605 "js_parser.mly" ( "function" ) # 18865 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv646) and _menhir_run36 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18872 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv643) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18882 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18886 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 604 "js_parser.mly" ( "for" ) # 18891 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv644) and _menhir_run37 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18898 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv641) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18908 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18912 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 593 "js_parser.mly" ( "finally" ) # 18917 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv642) and _menhir_run38 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18924 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv639) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18934 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18938 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 619 "js_parser.mly" ( "false" ) # 18943 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv640) and _menhir_run39 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 63 "js_parser.mly" (Parse_info.t) # 18950 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv637) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 63 "js_parser.mly" (Parse_info.t) # 18960 "js_parser.ml" )) : ( # 63 "js_parser.mly" (Parse_info.t) # 18964 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 596 "js_parser.mly" ( "else" ) # 18969 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv638) and _menhir_run40 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 18976 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv635) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 18986 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 18990 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 603 "js_parser.mly" ( "do" ) # 18995 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv636) and _menhir_run41 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 19002 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv633) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 82 "js_parser.mly" (Parse_info.t) # 19012 "js_parser.ml" )) : ( # 82 "js_parser.mly" (Parse_info.t) # 19016 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 602 "js_parser.mly" ( "delete" ) # 19021 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv634) and _menhir_run42 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19028 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv631) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 19038 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 19042 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 601 "js_parser.mly" ( "default" ) # 19047 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv632) and _menhir_run43 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19054 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv629) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 19064 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 19068 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 621 "js_parser.mly" ( "debugger" ) # 19073 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv630) and _menhir_run44 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19080 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv627) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 19090 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 19094 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 600 "js_parser.mly" ( "continue" ) # 19099 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv628) and _menhir_run45 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19106 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv625) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 19116 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 19120 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 592 "js_parser.mly" ( "catch" ) # 19125 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv626) and _menhir_run46 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19132 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv623) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 19142 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 19146 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 599 "js_parser.mly" ( "case" ) # 19151 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv624) and _menhir_run47 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19158 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv621) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 57 "js_parser.mly" (Parse_info.t) # 19168 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 19172 "js_parser.ml" )) = _v in ((let _v : 'tv_identifier_or_kw = # 598 "js_parser.mly" ( "break" ) # 19177 "js_parser.ml" in _menhir_goto_identifier_or_kw _menhir_env _menhir_stack _menhir_s _v) : 'freshtv622) and _menhir_goto_array_literal : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_array_literal -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv619) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_array_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv617) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((a : 'tv_array_literal) : 'tv_array_literal) = _v in ((let _v : 'tv_primary_expression_no_statement = # 422 "js_parser.mly" ( a ) # 19194 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv618)) : 'freshtv620) and _menhir_run490 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 19201 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv615) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 68 "js_parser.mly" (Parse_info.t) # 19211 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 19215 "js_parser.ml" )) = _v in ((let _v : 'tv_elison_rev = # 642 "js_parser.mly" ( [] ) # 19220 "js_parser.ml" in _menhir_goto_elison_rev _menhir_env _menhir_stack _menhir_s _v) : 'freshtv616) and _menhir_reduce315 : _menhir_env -> 'ttv_tail * _menhir_state * ( # 52 "js_parser.mly" (string * Parse_info.t) # 19227 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack -> let (_menhir_stack, _menhir_s, (i : ( # 52 "js_parser.mly" (string * Parse_info.t) # 19233 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_variable_with_loc = # 627 "js_parser.mly" ( let name, pi = i in var pi name, pi ) # 19238 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv613) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_variable_with_loc) = _v in ((match _menhir_s with | MenhirState477 | MenhirState475 | MenhirState466 | MenhirState415 | MenhirState242 | MenhirState199 | MenhirState194 | MenhirState63 | MenhirState61 | MenhirState57 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv607) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_variable_with_loc) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv605) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((i : 'tv_variable_with_loc) : 'tv_variable_with_loc) = _v in ((let _v : 'tv_variable = # 624 "js_parser.mly" ( fst i ) # 19257 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv603) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_variable) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in match _menhir_s with | MenhirState57 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv569 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv567 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_variable)) = _menhir_stack in let _v : 'tv_option_variable_ = # 116 "" ( Some x ) # 19274 "js_parser.ml" in _menhir_goto_option_variable_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv568)) : 'freshtv570) | MenhirState477 | MenhirState63 | MenhirState61 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv577 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_COMMA _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv571 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 19289 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState63 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState63) : 'freshtv572) | Js_token.T_RPAREN _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv573 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, (x : 'tv_variable)) = _menhir_stack in let _v : 'tv_separated_nonempty_list_T_COMMA_variable_ = # 241 "" ( [ x ] ) # 19308 "js_parser.ml" in _menhir_goto_separated_nonempty_list_T_COMMA_variable_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv574) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv575 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv576)) : 'freshtv578) | MenhirState199 | MenhirState194 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv585 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_ASSIGN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv579) = Obj.magic _menhir_stack in let (_v : ( # 77 "js_parser.mly" (Parse_info.t) # 19330 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState196 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState196) : 'freshtv580) | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv581) = Obj.magic _menhir_stack in ((let _v : 'tv_option_initializer__ = # 114 "" ( None ) # 19394 "js_parser.ml" in _menhir_goto_option_initializer__ _menhir_env _menhir_stack _v) : 'freshtv582) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv583 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv584)) : 'freshtv586) | MenhirState242 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv587 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19409 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 19413 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19417 "js_parser.ml" )) * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_ASSIGN _v -> _menhir_run244 _menhir_env (Obj.magic _menhir_stack) MenhirState243 _v | Js_token.T_COMMA _ | Js_token.T_IN _ | Js_token.T_SEMICOLON _ -> _menhir_reduce154 _menhir_env (Obj.magic _menhir_stack) MenhirState243 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState243) : 'freshtv588) | MenhirState415 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv589 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_ASSIGN _v -> _menhir_run244 _menhir_env (Obj.magic _menhir_stack) MenhirState416 _v | Js_token.T_COMMA _ | Js_token.T_SEMICOLON _ -> _menhir_reduce154 _menhir_env (Obj.magic _menhir_stack) MenhirState416 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState416) : 'freshtv590) | MenhirState466 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv595 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19449 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 19453 "js_parser.ml" )) * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv591 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19463 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 19467 "js_parser.ml" )) * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 19472 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState468 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState468) : 'freshtv592) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv593 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19491 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 19495 "js_parser.ml" )) * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv594)) : 'freshtv596) | MenhirState475 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv601 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19504 "js_parser.ml" )) * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv597 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19514 "js_parser.ml" )) * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 19519 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState477 _v | Js_token.T_RPAREN _ -> _menhir_reduce127 _menhir_env (Obj.magic _menhir_stack) MenhirState477 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState477) : 'freshtv598) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv599 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19540 "js_parser.ml" )) * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv600)) : 'freshtv602) | _ -> _menhir_fail ()) : 'freshtv604)) : 'freshtv606)) : 'freshtv608) | MenhirState528 | MenhirState0 | MenhirState523 | MenhirState2 | MenhirState3 | MenhirState4 | MenhirState9 | MenhirState12 | MenhirState13 | MenhirState14 | MenhirState15 | MenhirState51 | MenhirState499 | MenhirState491 | MenhirState52 | MenhirState54 | MenhirState55 | MenhirState482 | MenhirState68 | MenhirState191 | MenhirState206 | MenhirState451 | MenhirState446 | MenhirState216 | MenhirState444 | MenhirState238 | MenhirState440 | MenhirState437 | MenhirState435 | MenhirState432 | MenhirState430 | MenhirState428 | MenhirState241 | MenhirState425 | MenhirState423 | MenhirState421 | MenhirState288 | MenhirState408 | MenhirState397 | MenhirState390 | MenhirState386 | MenhirState381 | MenhirState375 | MenhirState373 | MenhirState371 | MenhirState369 | MenhirState367 | MenhirState365 | MenhirState363 | MenhirState361 | MenhirState359 | MenhirState357 | MenhirState355 | MenhirState353 | MenhirState351 | MenhirState349 | MenhirState347 | MenhirState345 | MenhirState343 | MenhirState339 | MenhirState337 | MenhirState335 | MenhirState333 | MenhirState331 | MenhirState329 | MenhirState327 | MenhirState325 | MenhirState319 | MenhirState289 | MenhirState303 | MenhirState294 | MenhirState292 | MenhirState290 | MenhirState286 | MenhirState282 | MenhirState280 | MenhirState278 | MenhirState276 | MenhirState274 | MenhirState272 | MenhirState270 | MenhirState268 | MenhirState266 | MenhirState264 | MenhirState262 | MenhirState260 | MenhirState258 | MenhirState254 | MenhirState252 | MenhirState250 | MenhirState248 | MenhirState244 | MenhirState236 | MenhirState233 | MenhirState231 | MenhirState229 | MenhirState225 | MenhirState223 | MenhirState221 | MenhirState218 | MenhirState214 | MenhirState210 | MenhirState207 | MenhirState203 | MenhirState196 | MenhirState192 | MenhirState70 | MenhirState72 | MenhirState73 | MenhirState74 | MenhirState183 | MenhirState181 | MenhirState176 | MenhirState174 | MenhirState172 | MenhirState170 | MenhirState168 | MenhirState164 | MenhirState160 | MenhirState158 | MenhirState156 | MenhirState154 | MenhirState152 | MenhirState150 | MenhirState148 | MenhirState146 | MenhirState142 | MenhirState128 | MenhirState126 | MenhirState124 | MenhirState122 | MenhirState120 | MenhirState118 | MenhirState116 | MenhirState112 | MenhirState110 | MenhirState108 | MenhirState99 | MenhirState97 | MenhirState95 | MenhirState91 | MenhirState75 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv611) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_variable_with_loc) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv609) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_variable_with_loc) : 'tv_variable_with_loc) = _v in ((let _v : 'tv_primary_expression_no_statement = # 415 "js_parser.mly" ( let (i, pi) = _1 in (pi, J.EVar i) ) # 19558 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv610)) : 'freshtv612) | _ -> _menhir_fail ()) : 'freshtv614) and _menhir_goto_option_variable_ : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_option_variable_ -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv565 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19571 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv561 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19581 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 19586 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState61 _v | Js_token.T_RPAREN _ -> _menhir_reduce127 _menhir_env (Obj.magic _menhir_stack) MenhirState61 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState61) : 'freshtv562) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv563 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19607 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv564)) : 'freshtv566) and _menhir_goto_boolean_literal : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_boolean_literal -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv559) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_boolean_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv557) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((b : 'tv_boolean_literal) : 'tv_boolean_literal) = _v in ((let _v : 'tv_primary_expression_no_statement = # 417 "js_parser.mly" ( b ) # 19625 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv558)) : 'freshtv560) and _menhir_reduce121 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> let _v : 'tv_list_source_element_ = # 211 "" ( [] ) # 19634 "js_parser.ml" in _menhir_goto_list_source_element_ _menhir_env _menhir_stack _menhir_s _v and _menhir_run1 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19641 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv553 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19653 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 19658 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState2 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState2) : 'freshtv554) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv555 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19723 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv556) and _menhir_run69 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19731 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv549 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19743 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 19748 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState70 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState70) : 'freshtv550) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv551 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 19813 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv552) and _menhir_run192 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 19821 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState192 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState192 and _menhir_run194 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19884 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState194 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState194 and _menhir_run203 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 19901 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState203 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState203 and _menhir_run205 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19964 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState205 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState205 and _menhir_run207 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 19981 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState207 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState207 and _menhir_run209 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 20044 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv545 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 20056 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 20061 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState210 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState210) : 'freshtv546) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv547 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 20126 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv548) and _menhir_run217 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 20134 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv543) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((pi : ( # 68 "js_parser.mly" (Parse_info.t) # 20144 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 20148 "js_parser.ml" )) = _v in ((let _v : 'tv_empty_statement = # 235 "js_parser.mly" ( J.Empty_statement, J.Pi pi ) # 20153 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv541) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_empty_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv539) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_empty_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv537) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_empty_statement) : 'tv_empty_statement) = _v in ((let _v : 'tv_statement_no_semi = # 173 "js_parser.mly" ( s ) # 20170 "js_parser.ml" in _menhir_goto_statement_no_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv538)) : 'freshtv540)) : 'freshtv542)) : 'freshtv544) and _menhir_run218 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 20177 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState218 _v | Js_token.EOF _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DEFAULT _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FOR _ | Js_token.T_IF _ | Js_token.T_RCURLY _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_SWITCH _ | Js_token.T_THROW _ | Js_token.T_TRY _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> _menhir_reduce146 _menhir_env (Obj.magic _menhir_stack) MenhirState218 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState218 and _menhir_run221 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 20242 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState221 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState221 and _menhir_run223 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 20305 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState223 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState223 and _menhir_run225 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 65 "js_parser.mly" (Parse_info.t) # 20368 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState225 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState225 and _menhir_run229 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 20409 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState229 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState229 and _menhir_run206 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 20472 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState206 _v | Js_token.T_RCURLY _ -> _menhir_reduce123 _menhir_env (Obj.magic _menhir_stack) MenhirState206 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState206 and _menhir_run231 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 20563 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState231 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState231 and _menhir_run233 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 20626 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState233 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState233 and _menhir_run235 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 20689 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv533 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 20701 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 20706 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState236 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState236) : 'freshtv534) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv535 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 20771 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv536) and _menhir_run239 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 52 "js_parser.mly" (string * Parse_info.t) # 20779 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.EOF _ | Js_token.T_AND _ | Js_token.T_ASSIGN _ | Js_token.T_BIT_AND _ | Js_token.T_BIT_AND_ASSIGN _ | Js_token.T_BIT_NOT _ | Js_token.T_BIT_OR _ | Js_token.T_BIT_OR_ASSIGN _ | Js_token.T_BIT_XOR _ | Js_token.T_BIT_XOR_ASSIGN _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_COMMA _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DIV _ | Js_token.T_DIV_ASSIGN _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_EQUAL _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_GREATER_THAN _ | Js_token.T_GREATER_THAN_EQUAL _ | Js_token.T_IDENTIFIER _ | Js_token.T_IF _ | Js_token.T_IN _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_INSTANCEOF _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LESS_THAN _ | Js_token.T_LESS_THAN_EQUAL _ | Js_token.T_LPAREN _ | Js_token.T_LSHIFT _ | Js_token.T_LSHIFT_ASSIGN _ | Js_token.T_MINUS _ | Js_token.T_MINUS_ASSIGN _ | Js_token.T_MOD _ | Js_token.T_MOD_ASSIGN _ | Js_token.T_MULT _ | Js_token.T_MULT_ASSIGN _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NOT_EQUAL _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_OR _ | Js_token.T_PERIOD _ | Js_token.T_PLING _ | Js_token.T_PLUS _ | Js_token.T_PLUS_ASSIGN _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_RSHIFT _ | Js_token.T_RSHIFT3 _ | Js_token.T_RSHIFT3_ASSIGN _ | Js_token.T_RSHIFT_ASSIGN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRICT_EQUAL _ | Js_token.T_STRICT_NOT_EQUAL _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> _menhir_reduce315 _menhir_env (Obj.magic _menhir_stack) | Js_token.T_COLON _ -> _menhir_reduce113 _menhir_env (Obj.magic _menhir_stack) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv531 * _menhir_state * ( # 52 "js_parser.mly" (string * Parse_info.t) # 20797 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv532) and _menhir_run475 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 20805 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState475 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState475 and _menhir_run240 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 20822 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_LPAREN _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv527 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 20834 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 20839 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_VAR _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv523 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 20896 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 20900 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState241 in let (_v : ( # 57 "js_parser.mly" (Parse_info.t) # 20906 "js_parser.ml" )) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState242 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState242) : 'freshtv524) | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState241 _v | Js_token.T_SEMICOLON _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv525) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState241 in ((let _v : 'tv_option_expression_no_in_ = # 114 "" ( None ) # 20927 "js_parser.ml" in _menhir_goto_option_expression_no_in_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv526) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState241) : 'freshtv528) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv529 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 20941 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv530) and _menhir_run289 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 20949 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState289 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState289 and _menhir_run290 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 21038 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState290 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState290 and _menhir_run292 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 21101 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState292 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState292 and _menhir_run294 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 21164 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState294 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState294 and _menhir_run296 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 21227 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv521) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((pi : ( # 57 "js_parser.mly" (Parse_info.t) # 21237 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 21241 "js_parser.ml" )) = _v in ((let _v : 'tv_debugger_statement = # 238 "js_parser.mly" ( J.Debugger_statement, J.Pi pi ) # 21246 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv519) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_debugger_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv517) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_debugger_statement) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv515) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((s : 'tv_debugger_statement) : 'tv_debugger_statement) = _v in ((let _v : 'tv_statement_need_semi = # 183 "js_parser.mly" ( s ) # 21263 "js_parser.ml" in _menhir_goto_statement_need_semi _menhir_env _menhir_stack _menhir_s _v) : 'freshtv516)) : 'freshtv518)) : 'freshtv520)) : 'freshtv522) and _menhir_run297 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 21270 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run298 _menhir_env (Obj.magic _menhir_stack) MenhirState297 _v | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> _menhir_reduce156 _menhir_env (Obj.magic _menhir_stack) MenhirState297 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState297 and _menhir_run301 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 21289 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run298 _menhir_env (Obj.magic _menhir_stack) MenhirState301 _v | Js_token.EOF _ | Js_token.T_BIT_NOT _ | Js_token.T_BREAK _ | Js_token.T_CASE _ | Js_token.T_CONTINUE _ | Js_token.T_DEBUGGER _ | Js_token.T_DECR _ | Js_token.T_DECR_NB _ | Js_token.T_DEFAULT _ | Js_token.T_DELETE _ | Js_token.T_DO _ | Js_token.T_ELSE _ | Js_token.T_FALSE _ | Js_token.T_FOR _ | Js_token.T_FUNCTION _ | Js_token.T_IF _ | Js_token.T_INCR _ | Js_token.T_INCR_NB _ | Js_token.T_LBRACKET _ | Js_token.T_LCURLY _ | Js_token.T_LPAREN _ | Js_token.T_MINUS _ | Js_token.T_NEW _ | Js_token.T_NOT _ | Js_token.T_NULL _ | Js_token.T_NUMBER _ | Js_token.T_PLUS _ | Js_token.T_RCURLY _ | Js_token.T_REGEX _ | Js_token.T_RETURN _ | Js_token.T_SEMICOLON _ | Js_token.T_STRING _ | Js_token.T_SWITCH _ | Js_token.T_THIS _ | Js_token.T_THROW _ | Js_token.T_TRUE _ | Js_token.T_TRY _ | Js_token.T_TYPEOF _ | Js_token.T_VAR _ | Js_token.T_VIRTUAL_SEMICOLON _ | Js_token.T_VOID _ | Js_token.T_WHILE _ | Js_token.T_WITH _ -> _menhir_reduce156 _menhir_env (Obj.magic _menhir_stack) MenhirState301 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState301 and _menhir_run303 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 21308 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState303 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState303 and _menhir_errorcase : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s -> match _menhir_s with | MenhirState528 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv65) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv66) | MenhirState523 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv67 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21380 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21384 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 21388 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv68) | MenhirState521 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv69 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21397 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv70) | MenhirState520 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv71 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21406 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv72) | MenhirState519 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv73 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21415 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv74) | MenhirState518 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv75 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21424 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv76) | MenhirState516 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv77 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 21433 "js_parser.ml" )) * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv78) | MenhirState512 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv79 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21442 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv80) | MenhirState506 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv81 * _menhir_state * 'tv_object_key_value) * ( # 68 "js_parser.mly" (Parse_info.t) # 21451 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv82) | MenhirState499 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv83 * _menhir_state * 'tv_element_list_rev) * _menhir_state * 'tv_elison) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv84) | MenhirState496 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv85 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 21465 "js_parser.ml" )) * _menhir_state * 'tv_element_list_rev) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv86) | MenhirState493 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv87 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 21474 "js_parser.ml" )) * _menhir_state * 'tv_elison) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv88) | MenhirState491 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv89 * _menhir_state * 'tv_elison_rev) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv90) | MenhirState489 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv91 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21488 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv92) | MenhirState488 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv93 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21497 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv94) | MenhirState482 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv95 * _menhir_state * 'tv_source_element) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv96) | MenhirState479 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv97 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21511 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 21515 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) * ( # 68 "js_parser.mly" (Parse_info.t) # 21519 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv98) | MenhirState477 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv99 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21528 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 21532 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv100) | MenhirState475 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv101 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21541 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv102) | MenhirState471 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv103 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21550 "js_parser.ml" )) * _menhir_state * 'tv_block) * _menhir_state * 'tv_catch) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv104) | MenhirState468 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv105 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21559 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21563 "js_parser.ml" )) * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 21567 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv106) | MenhirState466 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv107 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21576 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21580 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv108) | MenhirState463 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv109 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21589 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv110) | MenhirState462 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv111 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21598 "js_parser.ml" )) * _menhir_state * 'tv_block) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv112) | MenhirState457 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv113 * _menhir_state * 'tv_case_clause) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv114) | MenhirState455 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv115 * 'tv_default_clause) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv116) | MenhirState451 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv117 * ( # 57 "js_parser.mly" (Parse_info.t) # 21616 "js_parser.ml" )) * ( # 82 "js_parser.mly" (Parse_info.t) # 21620 "js_parser.ml" )) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv118) | MenhirState446 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv119 * _menhir_state * 'tv_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv120) | MenhirState444 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv121 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21633 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21637 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 21641 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 63 "js_parser.mly" (Parse_info.t) # 21645 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv122) | MenhirState440 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv123 * _menhir_state * 'tv_expression_no_in) * ( # 68 "js_parser.mly" (Parse_info.t) # 21654 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv124) | MenhirState437 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv125 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21663 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21667 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21671 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 21675 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv126) | MenhirState435 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv127 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21684 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21688 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 21692 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv128) | MenhirState434 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv129 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21701 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21705 "js_parser.ml" )) * _menhir_state * 'tv_left_hand_side_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv130) | MenhirState432 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((((('freshtv131 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21714 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21718 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21722 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21726 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21730 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv132) | MenhirState430 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv133 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21739 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21743 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21747 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21751 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv134) | MenhirState428 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv135 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21760 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21764 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21768 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv136) | MenhirState425 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((((('freshtv137 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21777 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21781 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21785 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 21789 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21793 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21797 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv138) | MenhirState423 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((((('freshtv139 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21806 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21810 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21814 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 21818 "js_parser.ml" )) * _menhir_state * 'tv_option_expression_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21822 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv140) | MenhirState421 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv141 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21831 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 21835 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 21839 "js_parser.ml" )) * _menhir_state * 'tv_separated_nonempty_list_T_COMMA_pair_variable_option_initializer_no_in___) * ( # 68 "js_parser.mly" (Parse_info.t) # 21843 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv142) | MenhirState416 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv143 * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv144) | MenhirState415 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv145 * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 68 "js_parser.mly" (Parse_info.t) # 21857 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv146) | MenhirState408 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv147 * _menhir_state * 'tv_call_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 21866 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv148) | MenhirState406 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv149 * _menhir_state * 'tv_call_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 21875 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv150) | MenhirState405 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv151 * _menhir_state * 'tv_call_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv152) | MenhirState397 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv153 * _menhir_state * 'tv_expression_no_statement) * ( # 68 "js_parser.mly" (Parse_info.t) # 21889 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv154) | MenhirState390 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv155 * _menhir_state * 'tv_label) * ( # 82 "js_parser.mly" (Parse_info.t) # 21898 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv156) | MenhirState386 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv157 * _menhir_state * 'tv_left_hand_side_expression_no_statement) * _menhir_state * 'tv_assignment_operator) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv158) | MenhirState385 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv159 * _menhir_state * 'tv_left_hand_side_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv160) | MenhirState381 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv161 * _menhir_state * 'tv_member_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 21917 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv162) | MenhirState379 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv163 * _menhir_state * 'tv_member_expression_no_statement) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 21926 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv164) | MenhirState378 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv165 * _menhir_state * 'tv_member_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv166) | MenhirState375 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv167 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 21940 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv168) | MenhirState373 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv169 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 21949 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv170) | MenhirState371 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv171 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 21958 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv172) | MenhirState369 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv173 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 21967 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv174) | MenhirState367 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv175 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 21976 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv176) | MenhirState365 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv177 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 21985 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv178) | MenhirState363 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv179 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 21994 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv180) | MenhirState361 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv181 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22003 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv182) | MenhirState359 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv183 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22012 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv184) | MenhirState357 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv185 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22021 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv186) | MenhirState355 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv187 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22030 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv188) | MenhirState353 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv189 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22039 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv190) | MenhirState351 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv191 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22048 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv192) | MenhirState349 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv193 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22057 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 22061 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv194) | MenhirState347 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv195 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22070 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv196) | MenhirState345 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv197 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22079 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv198) | MenhirState343 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv199 * _menhir_state * 'tv_post_in_expression_no_statement) * ( # 82 "js_parser.mly" (Parse_info.t) # 22088 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv200) | MenhirState340 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv201 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22097 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv202) | MenhirState339 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv203 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22106 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv204) | MenhirState338 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv205 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22115 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv206) | MenhirState337 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv207 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22124 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv208) | MenhirState336 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv209 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22133 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv210) | MenhirState335 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv211 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22142 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv212) | MenhirState334 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv213 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22151 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv214) | MenhirState333 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv215 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22160 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv216) | MenhirState332 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv217 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22169 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv218) | MenhirState331 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv219 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22178 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv220) | MenhirState330 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv221 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22187 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv222) | MenhirState329 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv223 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22196 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv224) | MenhirState328 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv225 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22205 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv226) | MenhirState327 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv227 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22214 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv228) | MenhirState326 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv229 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22223 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv230) | MenhirState325 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv231 * _menhir_state * 'tv_pre_in_expression_no_statement) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22232 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv232) | MenhirState324 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv233 * _menhir_state * 'tv_pre_in_expression_no_statement) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv234) | MenhirState319 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv235 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22246 "js_parser.ml" )) * _menhir_state * 'tv_statement) * ( # 57 "js_parser.mly" (Parse_info.t) # 22250 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22254 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, _), _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv236) | MenhirState304 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv237 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22263 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv238) | MenhirState303 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv239 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22272 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv240) | MenhirState301 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv241 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22281 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv242) | MenhirState297 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv243 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22290 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv244) | MenhirState295 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv245 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22299 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv246) | MenhirState294 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv247 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22308 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv248) | MenhirState293 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv249 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22317 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv250) | MenhirState292 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv251 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22326 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv252) | MenhirState291 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv253 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22335 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv254) | MenhirState290 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv255 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22344 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv256) | MenhirState289 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv257 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22353 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv258) | MenhirState288 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((((('freshtv259 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22362 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22366 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22370 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 82 "js_parser.mly" (Parse_info.t) # 22374 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 22378 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv260) | MenhirState286 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((((('freshtv261 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22387 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22391 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22395 "js_parser.ml" )) * _menhir_state * 'tv_variable) * _menhir_state * 'tv_option_initializer_no_in_) * ( # 82 "js_parser.mly" (Parse_info.t) # 22399 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv262) | MenhirState282 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv263 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22408 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv264) | MenhirState280 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv265 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22417 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv266) | MenhirState278 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv267 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22426 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv268) | MenhirState276 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv269 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22435 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv270) | MenhirState274 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv271 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22444 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv272) | MenhirState272 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv273 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22453 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv274) | MenhirState270 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv275 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22462 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv276) | MenhirState268 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv277 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22471 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv278) | MenhirState266 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv279 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22480 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv280) | MenhirState264 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv281 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22489 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv282) | MenhirState262 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv283 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22498 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv284) | MenhirState260 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv285 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22507 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv286) | MenhirState258 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv287 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22516 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22520 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv288) | MenhirState254 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv289 * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * 'tv_assignment_operator) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv290) | MenhirState253 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv291 * _menhir_state * 'tv_left_hand_side_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv292) | MenhirState252 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv293 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22539 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv294) | MenhirState250 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv295 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22548 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv296) | MenhirState248 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv297 * _menhir_state * 'tv_post_in_expression_no_in) * ( # 82 "js_parser.mly" (Parse_info.t) # 22557 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv298) | MenhirState246 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv299 * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv300) | MenhirState244 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv301 * _menhir_state * ( # 77 "js_parser.mly" (Parse_info.t) # 22571 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv302) | MenhirState243 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv303 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22580 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22584 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22588 "js_parser.ml" )) * _menhir_state * 'tv_variable) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv304) | MenhirState242 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv305 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22597 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22601 "js_parser.ml" )) * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22605 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv306) | MenhirState241 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv307 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22614 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22618 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv308) | MenhirState238 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv309 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22627 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22631 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 22635 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv310) | MenhirState236 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv311 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22644 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22648 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv312) | MenhirState234 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv313 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22657 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv314) | MenhirState233 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv315 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22666 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv316) | MenhirState232 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv317 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22675 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv318) | MenhirState231 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv319 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22684 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv320) | MenhirState230 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv321 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22693 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv322) | MenhirState229 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv323 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22702 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv324) | MenhirState227 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv325 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 22711 "js_parser.ml" )) * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv326) | MenhirState225 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv327 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 22720 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv328) | MenhirState224 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv329 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22729 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv330) | MenhirState223 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv331 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22738 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv332) | MenhirState222 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv333 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22747 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv334) | MenhirState221 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv335 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22756 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv336) | MenhirState218 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv337 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22765 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv338) | MenhirState216 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv339 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22774 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 22778 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv340) | MenhirState214 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv341 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22787 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv342) | MenhirState213 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv343 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22796 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22800 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 22804 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22808 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, _), _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv344) | MenhirState210 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv345 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22817 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22821 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv346) | MenhirState207 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv347 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22830 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv348) | MenhirState206 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv349 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 22839 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv350) | MenhirState205 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv351 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22848 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv352) | MenhirState204 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv353 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22857 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv354) | MenhirState203 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv355 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22866 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv356) | MenhirState199 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv357 * _menhir_state * 'tv_variable) * 'tv_option_initializer__) * ( # 68 "js_parser.mly" (Parse_info.t) # 22875 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (((_menhir_stack, _menhir_s, _), _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv358) | MenhirState196 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv359 * ( # 77 "js_parser.mly" (Parse_info.t) # 22884 "js_parser.ml" )) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv360) | MenhirState194 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv361 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22892 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv362) | MenhirState193 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv363 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22901 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv364) | MenhirState192 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv365 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22910 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv366) | MenhirState191 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv367 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 22919 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 22923 "js_parser.ml" )) * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 22927 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv368) | MenhirState189 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv369 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22936 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv370) | MenhirState188 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv371 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22945 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv372) | MenhirState187 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv373 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22954 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv374) | MenhirState183 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv375 * _menhir_state * 'tv_member_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 22963 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv376) | MenhirState181 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv377 * _menhir_state * 'tv_assignment_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 22972 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv378) | MenhirState177 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv379 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22981 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv380) | MenhirState176 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv381 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22990 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv382) | MenhirState175 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv383 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 22999 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv384) | MenhirState174 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv385 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23008 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv386) | MenhirState173 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv387 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23017 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv388) | MenhirState172 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv389 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23026 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv390) | MenhirState171 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv391 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23035 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv392) | MenhirState170 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv393 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23044 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv394) | MenhirState169 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv395 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23053 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv396) | MenhirState168 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv397 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23062 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv398) | MenhirState164 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv399 * _menhir_state * 'tv_expression) * ( # 68 "js_parser.mly" (Parse_info.t) # 23071 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv400) | MenhirState160 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv401 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23080 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv402) | MenhirState158 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv403 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23089 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv404) | MenhirState156 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv405 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23098 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv406) | MenhirState154 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv407 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23107 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv408) | MenhirState152 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv409 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23116 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv410) | MenhirState150 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv411 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23125 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv412) | MenhirState148 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv413 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23134 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv414) | MenhirState146 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ((('freshtv415 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23143 "js_parser.ml" )) * _menhir_state * 'tv_assignment_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23147 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv416) | MenhirState142 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv417 * _menhir_state * 'tv_left_hand_side_expression) * _menhir_state * 'tv_assignment_operator) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv418) | MenhirState129 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv419 * _menhir_state * 'tv_left_hand_side_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv420) | MenhirState128 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv421 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23166 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv422) | MenhirState126 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv423 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23175 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv424) | MenhirState124 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv425 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23184 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv426) | MenhirState122 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv427 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23193 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv428) | MenhirState120 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv429 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23202 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv430) | MenhirState118 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv431 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23211 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv432) | MenhirState116 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv433 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23220 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv434) | MenhirState112 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv435 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23229 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv436) | MenhirState110 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv437 * _menhir_state * 'tv_post_in_expression) * ( # 82 "js_parser.mly" (Parse_info.t) # 23238 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv438) | MenhirState108 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv439 * _menhir_state * 'tv_call_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 23247 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv440) | MenhirState106 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv441 * _menhir_state * 'tv_call_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 23256 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv442) | MenhirState105 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv443 * _menhir_state * 'tv_call_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv444) | MenhirState100 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv445 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23270 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv446) | MenhirState99 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv447 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23279 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv448) | MenhirState98 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv449 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23288 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv450) | MenhirState97 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv451 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23297 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv452) | MenhirState96 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv453 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23306 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv454) | MenhirState95 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv455 * _menhir_state * 'tv_pre_in_expression) * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23315 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv456) | MenhirState94 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv457 * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv458) | MenhirState91 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv459 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 23329 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv460) | MenhirState89 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv461 * _menhir_state * 'tv_member_expression) * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 23338 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv462) | MenhirState88 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv463 * _menhir_state * 'tv_member_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv464) | MenhirState80 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv465 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23352 "js_parser.ml" )) * _menhir_state * 'tv_pre_in_expression) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv466) | MenhirState75 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv467 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23361 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv468) | MenhirState74 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv469 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23370 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv470) | MenhirState73 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv471 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23379 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv472) | MenhirState72 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv473 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23388 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv474) | MenhirState70 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv475 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 23397 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 23401 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv476) | MenhirState68 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv477 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 23410 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv478) | MenhirState67 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (((('freshtv479 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 23419 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) * ( # 68 "js_parser.mly" (Parse_info.t) # 23423 "js_parser.ml" )) * _menhir_state * 'tv_loption_separated_nonempty_list_T_COMMA_variable__) * ( # 68 "js_parser.mly" (Parse_info.t) # 23427 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv480) | MenhirState63 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv481 * _menhir_state * 'tv_variable) * ( # 68 "js_parser.mly" (Parse_info.t) # 23436 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv482) | MenhirState61 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : (('freshtv483 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 23445 "js_parser.ml" )) * _menhir_state * 'tv_option_variable_) * ( # 68 "js_parser.mly" (Parse_info.t) # 23449 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv484) | MenhirState57 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv485 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 23458 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv486) | MenhirState55 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv487 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23467 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv488) | MenhirState54 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv489 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23476 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv490) | MenhirState52 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv491 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 23485 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv492) | MenhirState51 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv493 * _menhir_state * 'tv_property_name) * ( # 82 "js_parser.mly" (Parse_info.t) # 23494 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv494) | MenhirState16 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv495 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 23503 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv496) | MenhirState15 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv497 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23512 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv498) | MenhirState14 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv499 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 23521 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv500) | MenhirState13 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv501 * _menhir_state * ( # 65 "js_parser.mly" (Parse_info.t) # 23530 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv502) | MenhirState12 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv503 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23539 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv504) | MenhirState9 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv505 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23548 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv506) | MenhirState4 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv507 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23557 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv508) | MenhirState3 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv509 * _menhir_state * ( # 82 "js_parser.mly" (Parse_info.t) # 23566 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv510) | MenhirState2 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv511 * _menhir_state * ( # 57 "js_parser.mly" (Parse_info.t) # 23575 "js_parser.ml" )) * ( # 68 "js_parser.mly" (Parse_info.t) # 23579 "js_parser.ml" )) = Obj.magic _menhir_stack in ((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv512) | MenhirState0 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv513) = Obj.magic _menhir_stack in (raise _eRR : 'freshtv514) and _menhir_run3 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 23591 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState3 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState3 and _menhir_run4 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 23654 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState4 and _menhir_run5 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 23717 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv63) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((pi : ( # 57 "js_parser.mly" (Parse_info.t) # 23727 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 23731 "js_parser.ml" )) = _v in ((let _v : 'tv_boolean_literal = # 520 "js_parser.mly" ( (pi, J.EBool true) ) # 23736 "js_parser.ml" in _menhir_goto_boolean_literal _menhir_env _menhir_stack _menhir_s _v) : 'freshtv64) and _menhir_run6 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 23743 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv61) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((pi : ( # 57 "js_parser.mly" (Parse_info.t) # 23753 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 23757 "js_parser.ml" )) = _v in ((let _v : 'tv_primary_expression_no_statement = # 414 "js_parser.mly" ( (pi, J.EVar (var pi "this")) ) # 23762 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv62) and _menhir_run7 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 53 "js_parser.mly" (string * Parse_info.t) # 23769 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv59) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 53 "js_parser.mly" (string * Parse_info.t) # 23779 "js_parser.ml" )) : ( # 53 "js_parser.mly" (string * Parse_info.t) # 23783 "js_parser.ml" )) = _v in ((let _v : 'tv_primary_expression_no_statement = # 419 "js_parser.mly" ( let (s, start) = _1 in (start, J.EStr (s, `Utf8)) ) # 23788 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv60) and _menhir_run8 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 54 "js_parser.mly" (string * Parse_info.t) # 23795 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv57) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 54 "js_parser.mly" (string * Parse_info.t) # 23805 "js_parser.ml" )) : ( # 54 "js_parser.mly" (string * Parse_info.t) # 23809 "js_parser.ml" )) = _v in ((let _v : 'tv_regex_literal = # 527 "js_parser.mly" ( let (s, pi) = _1 in let len = String.length s in let regexp, option = if s.[len - 1] = '/' then String.sub s 1 (len - 2),None else let i = String.rindex s '/' in String.sub s 1 (i - 1),Some (String.sub s (i+1) (len - i - 1)) in (pi, J.ERegexp (regexp, option)) ) # 23824 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv55) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_regex_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv53) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_regex_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv51) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((r : 'tv_regex_literal) : 'tv_regex_literal) = _v in ((let _v : 'tv_primary_expression_no_statement = # 421 "js_parser.mly" ( r ) # 23841 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv52)) : 'freshtv54)) : 'freshtv56)) : 'freshtv58) and _menhir_run9 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 23848 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState9 and _menhir_run10 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 51 "js_parser.mly" (string * Parse_info.t) # 23911 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv49) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : ( # 51 "js_parser.mly" (string * Parse_info.t) # 23921 "js_parser.ml" )) : ( # 51 "js_parser.mly" (string * Parse_info.t) # 23925 "js_parser.ml" )) = _v in ((let _v : 'tv_numeric_literal = # 524 "js_parser.mly" ( let (f, pi) = _1 in (pi, f) ) # 23930 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv47) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_numeric_literal) = _v in ((match _menhir_s with | MenhirState528 | MenhirState0 | MenhirState523 | MenhirState2 | MenhirState3 | MenhirState4 | MenhirState9 | MenhirState12 | MenhirState13 | MenhirState14 | MenhirState15 | MenhirState51 | MenhirState499 | MenhirState491 | MenhirState52 | MenhirState54 | MenhirState55 | MenhirState68 | MenhirState482 | MenhirState191 | MenhirState206 | MenhirState451 | MenhirState216 | MenhirState446 | MenhirState238 | MenhirState444 | MenhirState440 | MenhirState437 | MenhirState435 | MenhirState241 | MenhirState428 | MenhirState430 | MenhirState432 | MenhirState421 | MenhirState423 | MenhirState425 | MenhirState288 | MenhirState408 | MenhirState397 | MenhirState390 | MenhirState386 | MenhirState381 | MenhirState289 | MenhirState375 | MenhirState373 | MenhirState371 | MenhirState369 | MenhirState367 | MenhirState365 | MenhirState363 | MenhirState361 | MenhirState359 | MenhirState357 | MenhirState355 | MenhirState353 | MenhirState351 | MenhirState349 | MenhirState347 | MenhirState345 | MenhirState343 | MenhirState339 | MenhirState337 | MenhirState335 | MenhirState333 | MenhirState331 | MenhirState329 | MenhirState327 | MenhirState325 | MenhirState319 | MenhirState303 | MenhirState294 | MenhirState292 | MenhirState290 | MenhirState286 | MenhirState244 | MenhirState282 | MenhirState280 | MenhirState278 | MenhirState276 | MenhirState274 | MenhirState272 | MenhirState270 | MenhirState268 | MenhirState266 | MenhirState264 | MenhirState262 | MenhirState260 | MenhirState258 | MenhirState254 | MenhirState252 | MenhirState250 | MenhirState248 | MenhirState236 | MenhirState233 | MenhirState231 | MenhirState229 | MenhirState225 | MenhirState223 | MenhirState221 | MenhirState218 | MenhirState214 | MenhirState210 | MenhirState207 | MenhirState203 | MenhirState196 | MenhirState192 | MenhirState70 | MenhirState72 | MenhirState73 | MenhirState74 | MenhirState183 | MenhirState181 | MenhirState91 | MenhirState176 | MenhirState174 | MenhirState95 | MenhirState172 | MenhirState97 | MenhirState170 | MenhirState168 | MenhirState164 | MenhirState108 | MenhirState148 | MenhirState160 | MenhirState158 | MenhirState154 | MenhirState156 | MenhirState152 | MenhirState150 | MenhirState146 | MenhirState142 | MenhirState128 | MenhirState126 | MenhirState110 | MenhirState124 | MenhirState122 | MenhirState120 | MenhirState118 | MenhirState116 | MenhirState112 | MenhirState99 | MenhirState75 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv41) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_numeric_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv39) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((_1 : 'tv_numeric_literal) : 'tv_numeric_literal) = _v in ((let _v : 'tv_primary_expression_no_statement = # 418 "js_parser.mly" ( let (start, n) = _1 in (start, J.ENum (J.Num.of_string_unsafe n)) ) # 23949 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv40)) : 'freshtv42) | MenhirState16 | MenhirState506 -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv45) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_numeric_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv43) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((n : 'tv_numeric_literal) : 'tv_numeric_literal) = _v in ((let _v : 'tv_property_name = # 635 "js_parser.mly" ( J.PNN (J.Num.of_string_unsafe (snd n)) ) # 23964 "js_parser.ml" in _menhir_goto_property_name _menhir_env _menhir_stack _menhir_s _v) : 'freshtv44)) : 'freshtv46) | _ -> _menhir_fail ()) : 'freshtv48)) : 'freshtv50) and _menhir_run11 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 23973 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv37) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((pi : ( # 57 "js_parser.mly" (Parse_info.t) # 23983 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 23987 "js_parser.ml" )) = _v in ((let _v : 'tv_null_literal = # 517 "js_parser.mly" ( (pi, J.EVar (var pi "null")) ) # 23992 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv35) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_null_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv33) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_null_literal) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv31) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((n : 'tv_null_literal) : 'tv_null_literal) = _v in ((let _v : 'tv_primary_expression_no_statement = # 416 "js_parser.mly" ( n ) # 24009 "js_parser.ml" in _menhir_goto_primary_expression_no_statement _menhir_env _menhir_stack _menhir_s _v) : 'freshtv32)) : 'freshtv34)) : 'freshtv36)) : 'freshtv38) and _menhir_run12 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 24016 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState12 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState12 and _menhir_run13 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 65 "js_parser.mly" (Parse_info.t) # 24079 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState13 and _menhir_run15 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 24120 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState15 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState15 and _menhir_run14 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 24183 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState14 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState14 and _menhir_run16 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 24246 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BREAK _v -> _menhir_run47 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_CASE _v -> _menhir_run46 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_CATCH _v -> _menhir_run45 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_CONTINUE _v -> _menhir_run44 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_DEBUGGER _v -> _menhir_run43 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_DEFAULT _v -> _menhir_run42 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_DELETE _v -> _menhir_run41 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_DO _v -> _menhir_run40 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_ELSE _v -> _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_FALSE _v -> _menhir_run38 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_FINALLY _v -> _menhir_run37 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_FOR _v -> _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_FUNCTION _v -> _menhir_run35 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_IDENTIFIER _v -> _menhir_run34 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_IF _v -> _menhir_run33 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_IN _v -> _menhir_run32 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_INSTANCEOF _v -> _menhir_run31 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_NEW _v -> _menhir_run30 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_NULL _v -> _menhir_run29 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_RETURN _v -> _menhir_run28 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_STRING _v -> _menhir_run27 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_SWITCH _v -> _menhir_run26 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_THIS _v -> _menhir_run25 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_THROW _v -> _menhir_run24 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_TRUE _v -> _menhir_run23 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_TRY _v -> _menhir_run22 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_TYPEOF _v -> _menhir_run21 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_VAR _v -> _menhir_run20 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_VOID _v -> _menhir_run19 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_WHILE _v -> _menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_WITH _v -> _menhir_run17 _menhir_env (Obj.magic _menhir_stack) MenhirState16 _v | Js_token.T_RCURLY _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv29) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState16 in ((let _v : 'tv_empty = # 720 "js_parser.mly" () # 24324 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv27) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_empty) = _v in ((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv25 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 24335 "js_parser.ml" )) * _menhir_state * 'tv_empty) = Obj.magic _menhir_stack in ((assert (not _menhir_env._menhir_error); let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_RCURLY _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv21 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 24345 "js_parser.ml" )) * _menhir_state * 'tv_empty) = Obj.magic _menhir_stack in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 24350 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv19 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 24357 "js_parser.ml" )) * _menhir_state * 'tv_empty) = Obj.magic _menhir_stack in let ((pi2 : ( # 68 "js_parser.mly" (Parse_info.t) # 24362 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 24366 "js_parser.ml" )) = _v in ((let ((_menhir_stack, _menhir_s, (pi1 : ( # 68 "js_parser.mly" (Parse_info.t) # 24371 "js_parser.ml" ))), _, (x : 'tv_empty)) = _menhir_stack in let _v : 'tv_curly_block_empty_ = # 649 "js_parser.mly" ( (x, pi1, pi2) ) # 24376 "js_parser.ml" in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv17) = _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_empty_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv15) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let (_v : 'tv_curly_block_empty_) = _v in ((let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv13) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((block : 'tv_curly_block_empty_) : 'tv_curly_block_empty_) = _v in ((let _v : 'tv_object_literal = # 564 "js_parser.mly" ( let _pairs, pi_start, _pi_end = block in pi_start, J.EObj [] ) # 24393 "js_parser.ml" in _menhir_goto_object_literal _menhir_env _menhir_stack _menhir_s _v) : 'freshtv14)) : 'freshtv16)) : 'freshtv18)) : 'freshtv20)) : 'freshtv22) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : ('freshtv23 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 24403 "js_parser.ml" )) * _menhir_state * 'tv_empty) = Obj.magic _menhir_stack in ((let (_menhir_stack, _menhir_s, _) = _menhir_stack in _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv24)) : 'freshtv26)) : 'freshtv28)) : 'freshtv30) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState16 and _menhir_run52 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 68 "js_parser.mly" (Parse_info.t) # 24415 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_COMMA _v -> _menhir_run490 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_RBRACKET _v -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv11 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 24465 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState52 in let (_v : ( # 68 "js_parser.mly" (Parse_info.t) # 24471 "js_parser.ml" )) = _v in ((let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv9 * _menhir_state * ( # 68 "js_parser.mly" (Parse_info.t) # 24478 "js_parser.ml" )) = Obj.magic _menhir_stack in let (_ : _menhir_state) = _menhir_s in let ((_2 : ( # 68 "js_parser.mly" (Parse_info.t) # 24484 "js_parser.ml" )) : ( # 68 "js_parser.mly" (Parse_info.t) # 24488 "js_parser.ml" )) = _v in ((let (_menhir_stack, _menhir_s, (pi : ( # 68 "js_parser.mly" (Parse_info.t) # 24493 "js_parser.ml" ))) = _menhir_stack in let _v : 'tv_array_literal = # 548 "js_parser.mly" ( (pi, J.EArr []) ) # 24498 "js_parser.ml" in _menhir_goto_array_literal _menhir_env _menhir_stack _menhir_s _v) : 'freshtv10)) : 'freshtv12) | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState52 and _menhir_run54 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 24521 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState54 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState54 and _menhir_run55 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 24584 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState55 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState55 and _menhir_run56 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 52 "js_parser.mly" (string * Parse_info.t) # 24647 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in _menhir_reduce315 _menhir_env (Obj.magic _menhir_stack) and _menhir_run57 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 24657 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState57 _v | Js_token.T_LPAREN _ -> let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv7) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = MenhirState57 in ((let _v : 'tv_option_variable_ = # 114 "" ( None ) # 24673 "js_parser.ml" in _menhir_goto_option_variable_ _menhir_env _menhir_stack _menhir_s _v) : 'freshtv8) | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState57 and _menhir_run71 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 57 "js_parser.mly" (Parse_info.t) # 24684 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_env = _menhir_discard _menhir_env in let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv5) = Obj.magic _menhir_stack in let (_menhir_s : _menhir_state) = _menhir_s in let ((pi : ( # 57 "js_parser.mly" (Parse_info.t) # 24694 "js_parser.ml" )) : ( # 57 "js_parser.mly" (Parse_info.t) # 24698 "js_parser.ml" )) = _v in ((let _v : 'tv_boolean_literal = # 521 "js_parser.mly" ( (pi, J.EBool false) ) # 24703 "js_parser.ml" in _menhir_goto_boolean_literal _menhir_env _menhir_stack _menhir_s _v) : 'freshtv6) and _menhir_run72 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 24710 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState72 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState72 and _menhir_run73 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 24773 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState73 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState73 and _menhir_run74 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 24836 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState74 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState74 and _menhir_run75 : _menhir_env -> 'ttv_tail -> _menhir_state -> ( # 82 "js_parser.mly" (Parse_info.t) # 24899 "js_parser.ml" ) -> 'ttv_return = fun _menhir_env _menhir_stack _menhir_s _v -> let _menhir_stack = (_menhir_stack, _menhir_s, _v) in let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState75 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState75 and _menhir_discard : _menhir_env -> _menhir_env = fun _menhir_env -> let lexer = _menhir_env._menhir_lexer in let lexbuf = _menhir_env._menhir_lexbuf in let _tok = lexer lexbuf in { _menhir_lexer = lexer; _menhir_lexbuf = lexbuf; _menhir_token = _tok; _menhir_error = false; } and _menhir_init : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> _menhir_env = fun lexer lexbuf -> let _tok = Obj.magic () in { _menhir_lexer = lexer; _menhir_lexbuf = lexbuf; _menhir_token = _tok; _menhir_error = false; } and program : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> ( # 132 "js_parser.mly" (Javascript.program) # 24984 "js_parser.ml" ) = fun lexer lexbuf -> let _menhir_env = _menhir_init lexer lexbuf in Obj.magic (let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv3) = ((), _menhir_env._menhir_lexbuf.Lexing.lex_curr_p) in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run303 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_BREAK _v -> _menhir_run301 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_CONTINUE _v -> _menhir_run297 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_DEBUGGER _v -> _menhir_run296 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_DECR _v -> _menhir_run294 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_DECR_NB _v -> _menhir_run292 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_DELETE _v -> _menhir_run290 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_DO _v -> _menhir_run289 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_FOR _v -> _menhir_run240 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_FUNCTION _v -> _menhir_run475 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_IDENTIFIER _v -> _menhir_run239 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_IF _v -> _menhir_run235 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_INCR _v -> _menhir_run233 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_INCR_NB _v -> _menhir_run231 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_LCURLY _v -> _menhir_run206 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_MINUS _v -> _menhir_run229 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_NEW _v -> _menhir_run225 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_NOT _v -> _menhir_run223 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_PLUS _v -> _menhir_run221 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_RETURN _v -> _menhir_run218 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_SEMICOLON _v -> _menhir_run217 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_SWITCH _v -> _menhir_run209 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_THROW _v -> _menhir_run207 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_TRY _v -> _menhir_run205 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_TYPEOF _v -> _menhir_run203 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_VAR _v -> _menhir_run194 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_VOID _v -> _menhir_run192 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_WHILE _v -> _menhir_run69 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.T_WITH _v -> _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v | Js_token.EOF _ -> _menhir_reduce121 _menhir_env (Obj.magic _menhir_stack) MenhirState0 | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState0) : 'freshtv4)) and standalone_expression : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> ( # 133 "js_parser.mly" (Javascript.expression) # 25079 "js_parser.ml" ) = fun lexer lexbuf -> let _menhir_env = _menhir_init lexer lexbuf in Obj.magic (let (_menhir_env : _menhir_env) = _menhir_env in let (_menhir_stack : 'freshtv1) = ((), _menhir_env._menhir_lexbuf.Lexing.lex_curr_p) in ((let _menhir_env = _menhir_discard _menhir_env in let _tok = _menhir_env._menhir_token in match _tok with | Js_token.T_BIT_NOT _v -> _menhir_run75 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_DECR _v -> _menhir_run74 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_DECR_NB _v -> _menhir_run73 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_DELETE _v -> _menhir_run72 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_FALSE _v -> _menhir_run71 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_FUNCTION _v -> _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_IDENTIFIER _v -> _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_INCR _v -> _menhir_run55 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_INCR_NB _v -> _menhir_run54 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_LBRACKET _v -> _menhir_run52 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_LCURLY _v -> _menhir_run16 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_LPAREN _v -> _menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_MINUS _v -> _menhir_run15 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_NEW _v -> _menhir_run13 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_NOT _v -> _menhir_run12 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_NULL _v -> _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_NUMBER _v -> _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_PLUS _v -> _menhir_run9 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_REGEX _v -> _menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_STRING _v -> _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_THIS _v -> _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_TRUE _v -> _menhir_run5 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_TYPEOF _v -> _menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | Js_token.T_VOID _v -> _menhir_run3 _menhir_env (Obj.magic _menhir_stack) MenhirState528 _v | _ -> assert (not _menhir_env._menhir_error); _menhir_env._menhir_error <- true; _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState528) : 'freshtv2)) # 269 "" # 25144 "js_parser.ml" js_of_ocaml-3.5.2/compiler/lib/js_parser.mli000066400000000000000000000005261357507750000210630ustar00rootroot00000000000000 (* The type of tokens. *) type token = Js_token.token (* This exception is raised by the monolithic API functions. *) exception Error (* The monolithic API. *) val standalone_expression: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Javascript.expression) val program: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Javascript.program) js_of_ocaml-3.5.2/compiler/lib/js_parser.mly000066400000000000000000000552321357507750000211070ustar00rootroot00000000000000(* Js_of_ocaml compiler *) (* Copyright (C) 2013 Hugo Heuzard *) (* Yoann Padioleau *) (* Copyright (C) 2010 Facebook *) (* This library is free software; you can redistribute it and/or *) (* modify it under the terms of the GNU Lesser General Public License *) (* version 2.1 as published by the Free Software Foundation, with the *) (* special exception on linking described in file license.txt. *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of *) (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file *) (* license.txt for more details. *) %{ (* * src: ocamlyaccified from Marcel Laverdet 'fbjs2' via emacs macros, itself * extracted from the official ECMAscript specification at: * http://www.ecma-international.org/publications/standards/ecma-262.htm * * see also http://en.wikipedia.org/wiki/ECMAScript_syntax * * related work: * - http://marijnhaverbeke.nl/parse-js/, js parser in common lisp * (which has been since ported to javascript by nodejs people) * - jslint *) module J = Javascript open Js_token let var pi name = J.ident ~loc:(Pi pi) name (* This is need to fake menhir while using `--infer`. *) let _tok = EOF Parse_info.zero %} (*************************************************************************) (* 1 Tokens *) (*************************************************************************) (*-----------------------------------------*) (* 2 the normal tokens *) (*-----------------------------------------*) (* Tokens with a value *) %token T_NUMBER %token T_IDENTIFIER %token T_STRING %token T_REGEX (* Keywords tokens *) %token T_FUNCTION T_IF T_RETURN T_SWITCH T_THIS T_THROW T_TRY T_VAR T_WHILE T_WITH T_NULL T_FALSE T_TRUE T_BREAK T_CASE T_CATCH T_CONTINUE T_DEFAULT T_DO T_FINALLY T_FOR T_DEBUGGER %token T_ELSE %token T_NEW (* Syntax *) %token T_LCURLY T_RCURLY T_LPAREN T_RPAREN T_LBRACKET T_RBRACKET T_SEMICOLON T_COMMA T_PERIOD (* Operators *) %token T_RSHIFT3_ASSIGN T_RSHIFT_ASSIGN T_LSHIFT_ASSIGN T_BIT_XOR_ASSIGN T_BIT_OR_ASSIGN T_BIT_AND_ASSIGN T_MOD_ASSIGN T_DIV_ASSIGN T_MULT_ASSIGN T_MINUS_ASSIGN T_PLUS_ASSIGN T_ASSIGN %token T_PLING T_COLON T_OR T_AND T_BIT_OR T_BIT_XOR T_BIT_AND T_EQUAL T_NOT_EQUAL T_STRICT_EQUAL T_STRICT_NOT_EQUAL T_LESS_THAN_EQUAL T_GREATER_THAN_EQUAL T_LESS_THAN T_GREATER_THAN T_IN T_INSTANCEOF T_LSHIFT T_RSHIFT T_RSHIFT3 T_PLUS T_MINUS T_DIV T_MULT T_MOD T_NOT T_BIT_NOT T_INCR T_DECR T_INCR_NB T_DECR_NB T_DELETE T_TYPEOF T_VOID (*-----------------------------------------*) (* 2 extra tokens: *) (*-----------------------------------------*) %token T_VIRTUAL_SEMICOLON (* classic *) %token EOF (*-----------------------------------------*) (* 2 priorities *) (*-----------------------------------------*) (* Special if / else associativity*) %nonassoc p_IF %nonassoc T_ELSE %left T_OR %left T_AND %left T_BIT_OR %left T_BIT_XOR %left T_BIT_AND %left T_EQUAL T_NOT_EQUAL T_STRICT_EQUAL T_STRICT_NOT_EQUAL %left T_LESS_THAN_EQUAL T_GREATER_THAN_EQUAL T_LESS_THAN T_GREATER_THAN T_IN T_INSTANCEOF %left T_LSHIFT T_RSHIFT T_RSHIFT3 %left T_PLUS T_MINUS %left T_DIV T_MULT T_MOD %right T_NOT T_BIT_NOT T_INCR T_DECR T_INCR_NB T_DECR_NB T_DELETE T_TYPEOF T_VOID (*************************************************************************) (* 1 Rules type declaration *) (*************************************************************************) %start program %start standalone_expression %% (*************************************************************************) (* 1 Toplevel *) (*************************************************************************) program: | l=source_element* EOF { l } standalone_expression: | e=expression EOF { e } source_element: | statement { let statement, pi = $1 in J.Statement statement, pi } | function_declaration { let declaration, pi = $1 in J.Function_declaration declaration, pi } (*************************************************************************) (* 1 statement *) (*************************************************************************) statement_no_semi: | block=curly_block(statement*) { let statements, pi_start, _pi_end = block in J.Block statements, J.Pi pi_start } (* this is not allowed but some browsers accept it *) (* | function_declaration { *) (* let var,params,body,_ = $1 in *) (* J.Variable_statement [var,Some (J.EFun((None,params,body),None))]} *) | s=if_statement | s=while_statement | s=for_statement | s=for_in_statement | s=with_statement | s=switch_statement | s=try_statement | s=labeled_statement | s=empty_statement { s } statement_need_semi: | s=variable_statement | s=expression_statement | s=do_while_statement | s=continue_statement | s=break_statement | s=return_statement | s=throw_statement | s=debugger_statement { s } statement: | s=statement_no_semi { s } | s=statement_need_semi either(T_SEMICOLON, T_VIRTUAL_SEMICOLON) { s } | statement=statement_need_semi { (* 7.9.1 - 1 *) (* When, as the program is parsed from left to right, a token (called the offending token) is encountered that is not allowed by any production of the grammar, then a semicolon is automatically inserted before the offending token if one or more of the following conditions is true: - The offending token is }. - The offending token is separated from the previous token by at least one LineTerminator. *) (* 7.9.1 - 2 *) (* When, as the program is parsed from left to right, the end of the input stream of tokens *) (* is encountered and the parser is unable to parse the input token stream as a single *) (* complete ECMAScript Program, then a semicolon is automatically inserted at the end *) (* of the input stream. *) (* @@@@@@@@@ HACK @@@@@@@@@@ *) (* menhir internal's *) (* look the current token: *) (* - if it is on another line (linebreak in between), accept the statement *) (* - fail otherwise *) (* @@@@@@@@@ HACK @@@@@@@@@@ *) match _tok with | EOF _ | T_RCURLY _ -> statement | token -> let info = Js_token.info_of_tok token in match info.Parse_info.fol with | Some true -> statement | _ -> $syntaxerror } labeled_statement: | l=label T_COLON s=statement { J.Labelled_statement (l, s), J.N } block: | block=curly_block(statement*) { let statements, _, _ = block in statements } variable_statement: | pi=T_VAR list=separated_nonempty_list(T_COMMA, pair(variable, initializer_?)) { J.Variable_statement list, J.Pi pi } initializer_: | pi=T_ASSIGN e=assignment_expression { e, J.Pi pi } empty_statement: | pi=T_SEMICOLON { J.Empty_statement, J.Pi pi } debugger_statement: | pi=T_DEBUGGER { J.Debugger_statement, J.Pi pi } expression_statement: | expression_no_statement { J.Expression_statement $1, J.N } if_statement: | pi=T_IF condition=parenthesised(expression) t=statement T_ELSE e=statement { (J.If_statement (condition, t, Some e), J.Pi pi) } | pi=T_IF condition=parenthesised(expression) t=statement %prec p_IF { (J.If_statement (condition, t, None), J.Pi pi) } do_while_statement: | pi=T_DO body=statement T_WHILE condition=parenthesised(expression) { (J.Do_while_statement (body, condition), J.Pi pi) } while_statement: | pi=T_WHILE condition=parenthesised(expression) body=statement { (J.While_statement (condition, body), J.Pi pi) } for_statement: | pi=T_FOR T_LPAREN initial=expression_no_in? T_SEMICOLON condition=expression? T_SEMICOLON increment=expression? T_RPAREN statement=statement { J.For_statement (J.Left initial, condition, increment, statement), J.Pi pi } | pi=T_FOR T_LPAREN T_VAR initial=separated_nonempty_list(T_COMMA, pair(variable, initializer_no_in?)) T_SEMICOLON condition=expression? T_SEMICOLON increment=expression? T_RPAREN statement=statement { J.For_statement (J.Right initial, condition, increment, statement), J.Pi pi } for_in_statement: | pi=T_FOR T_LPAREN left=left_hand_side_expression T_IN right=expression T_RPAREN body=statement { J.ForIn_statement (J.Left left, right, body), J.Pi pi } | pi=T_FOR T_LPAREN T_VAR left=pair(variable, initializer_no_in?) T_IN right=expression T_RPAREN body=statement { J.ForIn_statement (J.Right left, right, body), J.Pi pi } initializer_no_in: | T_ASSIGN assignment_expression_no_in { $2, J.Pi $1 } continue_statement: | pi=T_CONTINUE label? { (J.Continue_statement $2,J.Pi pi) } break_statement: | pi=T_BREAK label? { (J.Break_statement $2, J.Pi pi) } return_statement: | pi=T_RETURN expression? { (J.Return_statement $2, J.Pi pi) } with_statement: | T_WITH parenthesised(expression) statement { assert false } switch_statement: | pi=T_SWITCH subject=parenthesised(expression) T_LCURLY pair=pair(case_clause*, pair(default_clause, case_clause*)?) T_RCURLY { let switch = match pair with | cases, None -> J.Switch_statement (subject, cases, None, []) | cases, Some (default, more_cases) -> J.Switch_statement (subject, cases, Some default, more_cases) in switch, J.Pi pi } throw_statement: | pi=T_THROW expression { (J.Throw_statement $2, J.Pi pi) } try_statement: | pi=T_TRY block catch finally? { (J.Try_statement ($2, Some $3, $4), J.Pi pi) } | pi=T_TRY block finally { (J.Try_statement ($2, None, Some $3), J.Pi pi) } catch: | T_CATCH pair=pair(parenthesised(variable), block) { pair } finally: | T_FINALLY block { $2 } (*----------------------------*) (* 2 auxiliary statements *) (*----------------------------*) case_clause: | T_CASE pair=separated_pair(expression, T_COLON, statement*) { pair } default_clause: | T_DEFAULT T_COLON list=statement* { list } (*************************************************************************) (* 1 function declaration *) (*************************************************************************) function_declaration: | pi=T_FUNCTION name=variable args=parenthesised(separated_list(T_COMMA, variable)) block=curly_block(source_element*) { let elements, _pi_start, pi_end = block in (name, args, elements, J.Pi pi_end), J.Pi pi } function_expression: | pi=T_FUNCTION name=variable? args=parenthesised(separated_list(T_COMMA, variable)) block=curly_block(source_element*) { let elements, _pi_start, _pi_end = block in pi, J.EFun (name, args, elements, J.Pi pi) } (*************************************************************************) (* 1 expression *) (*************************************************************************) expression: | assignment_expression { $1 } | expression T_COMMA assignment_expression { J.ESeq ($1, $3) } assignment_expression: | conditional_expression { $1 } | left_hand_side_expression assignment_operator assignment_expression { J.EBin ($2, $1, $3) } left_hand_side_expression: | new_expression { snd $1 } | call_expression { snd $1 } conditional_expression: | post_in_expression { $1 } | ternary(post_in_expression, assignment_expression) { $1 } ternary(condition, consequence): | condition=condition T_PLING consequence=consequence T_COLON alternative=consequence { J.ECond (condition, consequence, alternative) } post_in_expression: | pre_in_expression { $1 } | left=post_in_expression op=comparison_or_logical_or_bit_operator right=post_in_expression { J.EBin (op, left, right) } pre_in_expression: | left_hand_side_expression { $1 } | e=pre_in_expression op=postfix_operator | op=prefix_operator e=pre_in_expression { J.EUn (op, e) } | left=pre_in_expression op=arithmetic_or_shift_operator right=pre_in_expression { J.EBin (op, left, right) } call_expression: | member_expression arguments { let (start, e) = $1 in (start, J.ECall(e, $2, J.Pi start)) } | call_expression arguments { let (start, e) = $1 in (start, J.ECall(e, $2, J.Pi start)) } | call_expression T_LBRACKET expression T_RBRACKET { let (start, e) = $1 in (start, J.EAccess (e, $3)) } | call_expression T_PERIOD identifier_or_kw { let (start, e) = $1 in (start, J.EDot (e, $3)) } new_expression: | member_expression { $1 } | pi=T_NEW new_expression { (pi, J.ENew (snd $2,None)) } member_expression: | e=primary_expression { e } | member_expression T_LBRACKET e2=expression T_RBRACKET { let (start, e1) = $1 in (start, J.EAccess (e1,e2)) } | member_expression T_PERIOD i=identifier_or_kw { let (start, e1) = $1 in (start, J.EDot(e1,i)) } | pi=T_NEW e1=member_expression a=arguments { (pi, J.ENew(snd e1, Some a)) } primary_expression: | e=primary_expression_no_statement | e=object_literal | e=function_expression { e } primary_expression_no_statement: | pi=T_THIS { (pi, J.EVar (var pi "this")) } | variable_with_loc { let (i, pi) = $1 in (pi, J.EVar i) } | n=null_literal { n } | b=boolean_literal { b } | numeric_literal { let (start, n) = $1 in (start, J.ENum (J.Num.of_string_unsafe n)) } | T_STRING { let (s, start) = $1 in (start, J.EStr (s, `Utf8)) } (* marcel: this isn't an expansion of literal in ECMA-262... mistake? *) | r=regex_literal { r } | a=array_literal { a } | pi=T_LPAREN e=expression T_RPAREN { (pi, e) } (*----------------------------*) (* 2 no in *) (*----------------------------*) expression_no_in: | assignment_expression_no_in { $1 } | expression_no_in T_COMMA assignment_expression_no_in { J.ESeq ($1, $3) } assignment_expression_no_in: | conditional_expression_no_in { $1 } | left_hand_side_expression assignment_operator assignment_expression_no_in { J.EBin($2,$1,$3) } conditional_expression_no_in: | post_in_expression_no_in { $1 } | ternary(post_in_expression_no_in, assignment_expression_no_in) { $1 } post_in_expression_no_in: | pre_in_expression { $1 } | left=post_in_expression_no_in op=comparison_or_logical_or_bit_operator_except_in right=post_in_expression { J.EBin (op, left, right) } (*----------------------------*) (* 2 (no statement) *) (*----------------------------*) expression_no_statement: | assignment_expression_no_statement { $1 } | expression_no_statement T_COMMA assignment_expression { J.ESeq($1,$3) } assignment_expression_no_statement: | conditional_expression_no_statement { $1 } | left_hand_side_expression_no_statement assignment_operator assignment_expression { J.EBin ($2,$1,$3) } conditional_expression_no_statement: | post_in_expression_no_statement { $1 } | ternary(post_in_expression_no_statement, assignment_expression) { $1 } post_in_expression_no_statement: | pre_in_expression_no_statement { $1 } | left=post_in_expression_no_statement op=comparison_or_logical_or_bit_operator right=post_in_expression { J.EBin (op, left, right) } pre_in_expression_no_statement: | left_hand_side_expression_no_statement { $1 } | e=pre_in_expression_no_statement op=postfix_operator | op=prefix_operator e=pre_in_expression { J.EUn (op, e) } | left=pre_in_expression_no_statement op=arithmetic_or_shift_operator right=pre_in_expression { J.EBin (op, left, right) } left_hand_side_expression_no_statement: | new_expression_no_statement { snd $1 } | call_expression_no_statement { snd $1 } new_expression_no_statement: | member_expression_no_statement { $1 } | pi=T_NEW new_expression { (pi, J.ENew (snd $2,None)) } call_expression_no_statement: | member_expression_no_statement arguments { let (start, e) = $1 in (start, J.ECall(e, $2, J.Pi start)) } | call_expression_no_statement arguments { let (start, e) = $1 in (start, J.ECall(e, $2, J.Pi start)) } | call_expression_no_statement T_LBRACKET expression T_RBRACKET { let (start, e) = $1 in (start, J.EAccess(e, $3)) } | call_expression_no_statement T_PERIOD identifier_or_kw { let (start, e) = $1 in (start, J.EDot(e,$3)) } member_expression_no_statement: | e=primary_expression_no_statement { e } | member_expression_no_statement T_LBRACKET e2=expression T_RBRACKET { let (start, e1) = $1 in (start, J.EAccess(e1, e2)) } | member_expression_no_statement T_PERIOD i=identifier_or_kw { let (start, e1) = $1 in (start, J.EDot(e1,i)) } | pi=T_NEW e=member_expression a=arguments { (pi, J.ENew(snd e,Some a)) } (*----------------------------*) (* 2 scalar *) (*----------------------------*) null_literal: | pi=T_NULL { (pi, J.EVar (var pi "null")) } boolean_literal: | pi=T_TRUE { (pi, J.EBool true) } | pi=T_FALSE { (pi, J.EBool false) } numeric_literal: | T_NUMBER { let (f, pi) = $1 in (pi, f) } regex_literal: | T_REGEX { let (s, pi) = $1 in let len = String.length s in let regexp, option = if s.[len - 1] = '/' then String.sub s 1 (len - 2),None else let i = String.rindex s '/' in String.sub s 1 (i - 1),Some (String.sub s (i+1) (len - i - 1)) in (pi, J.ERegexp (regexp, option)) } (* J.ENew(J.EVar (var "RegExp"), Some (List.map (fun s -> J.EStr (s,`Bytes)) args)) } *) (*----------------------------*) (* 2 array *) (*----------------------------*) array_literal: | pi=T_LBRACKET elison T_RBRACKET { (pi, J.EArr $2) } | pi=T_LBRACKET T_RBRACKET { (pi, J.EArr []) } | pi=T_LBRACKET element_list T_RBRACKET { (pi, J.EArr $2) } | pi=T_LBRACKET element_list_rev elison_rev T_RBRACKET { (pi, J.EArr (List.rev_append $2 (List.rev $3))) } element_list: | element_list_rev { List.rev $1 } element_list_rev: | elison_rev assignment_expression { (Some $2)::$1 } | assignment_expression { [Some $1] } | element_list_rev elison assignment_expression { (Some $3) :: (List.rev_append $2 $1) } object_literal: | block=curly_block(empty) { let _pairs, pi_start, _pi_end = block in pi_start, J.EObj [] } | block=curly_block(separated_or_terminated_list(T_COMMA, object_key_value)) { let pairs, pi_start, _pi_end = block in pi_start, J.EObj pairs } object_key_value: | pair=separated_pair(property_name, T_COLON, assignment_expression) { pair } (*----------------------------*) (* 2 variable *) (*----------------------------*) (*----------------------------*) (* 2 function call *) (*----------------------------*) arguments: | args=parenthesised(separated_list(T_COMMA, assignment_expression)) { args } (*----------------------------*) (* 2 auxiliary bis *) (*----------------------------*) (*************************************************************************) (* 1 Entities, names *) (*************************************************************************) identifier_or_kw: | T_IDENTIFIER { fst $1 } | T_CATCH { "catch" } | T_FINALLY { "finally" } | T_IN { "in" } | T_INSTANCEOF { "instanceof" } | T_ELSE { "else" } | T_WHILE { "while" } | T_BREAK { "break" } | T_CASE { "case" } | T_CONTINUE { "continue" } | T_DEFAULT { "default" } | T_DELETE { "delete" } | T_DO { "do" } | T_FOR { "for" } | T_FUNCTION { "function" } | T_IF { "if" } | T_NEW { "new" } | T_RETURN { "return" } | T_SWITCH { "switch" } | T_THIS { "this" } | T_THROW { "throw" } | T_TRY { "try" } | T_TYPEOF { "typeof" } | T_VAR { "var" } | T_VOID { "void" } | T_WHILE { "while" } | T_WITH { "with" } | T_NULL { "null" } | T_FALSE { "false" } | T_TRUE { "true" } | T_DEBUGGER { "debugger" } variable: | i=variable_with_loc { fst i } variable_with_loc: | i=T_IDENTIFIER { let name, pi = i in var pi name, pi } label: | T_IDENTIFIER { J.Label.of_string (fst $1) } property_name: | i=identifier_or_kw { J.PNI i } | s=T_STRING { J.PNS (fst s) } | n=numeric_literal { J.PNN (J.Num.of_string_unsafe (snd n)) } (*************************************************************************) (* 1 xxx_opt, xxx_list *) (*************************************************************************) elison_rev: | T_COMMA { [] } | elison T_COMMA { None :: $1 } elison: elison_rev {$1} (* | elison_rev { List.rev $1} *) curly_block(X): | pi1=T_LCURLY x=X pi2=T_RCURLY { (x, pi1, pi2) } (*----------------------------*) (* Infix binary operators *) (*----------------------------*) %inline comparison_or_logical_or_bit_operator_except_in: | T_LESS_THAN { J.Lt } | T_GREATER_THAN { J.Gt } | T_LESS_THAN_EQUAL { J.Le } | T_GREATER_THAN_EQUAL { J.Ge } | T_INSTANCEOF { J.InstanceOf } | T_EQUAL { J.EqEq } | T_NOT_EQUAL { J.NotEq } | T_STRICT_EQUAL { J.EqEqEq } | T_STRICT_NOT_EQUAL { J.NotEqEq } | T_BIT_AND { J.Band } | T_BIT_XOR { J.Bxor } | T_BIT_OR { J.Bor } | T_AND { J.And } | T_OR { J.Or } %inline comparison_or_logical_or_bit_operator: | op=comparison_or_logical_or_bit_operator_except_in { op } | T_IN { J.In } %inline arithmetic_or_shift_operator: | T_MULT { J.Mul } | T_DIV { J.Div } | T_MOD { J.Mod } | T_PLUS { J.Plus } | T_MINUS { J.Minus } | T_LSHIFT { J.Lsl } | T_RSHIFT { J.Asr } | T_RSHIFT3 { J.Lsr } %inline prefix_operator: | T_DELETE { J.Delete } | T_VOID { J.Void } | T_TYPEOF { J.Typeof } | T_INCR { J.IncrB } | T_INCR_NB { J.IncrB } | T_DECR { J.DecrB } | T_DECR_NB { J.DecrB } | T_PLUS { J.Pl } | T_MINUS { J.Neg } | T_BIT_NOT { J.Bnot } | T_NOT { J.Not } postfix_operator: | T_INCR_NB { J.IncrA } | T_DECR_NB { J.DecrA } assignment_operator: | T_ASSIGN { J.Eq } | T_MULT_ASSIGN { J.StarEq } | T_DIV_ASSIGN { J.SlashEq } | T_MOD_ASSIGN { J.ModEq } | T_PLUS_ASSIGN { J.PlusEq } | T_MINUS_ASSIGN { J.MinusEq } | T_LSHIFT_ASSIGN { J.LslEq } | T_RSHIFT_ASSIGN { J.AsrEq } | T_RSHIFT3_ASSIGN { J.LsrEq } | T_BIT_AND_ASSIGN { J.BandEq } | T_BIT_XOR_ASSIGN { J.BxorEq } | T_BIT_OR_ASSIGN { J.BorEq } (* Library definitions *) either(a, b): a { $1 } | b { $1 } empty: {} %inline parenthesised(ITEM): T_LPAREN item=ITEM T_RPAREN { item } separated_or_terminated_list(separator, X): | x=X { [x] } | x=X separator { [x] } | x=X separator xs=separated_or_terminated_list(separator, X) { x :: xs } js_of_ocaml-3.5.2/compiler/lib/js_simpl.ml000066400000000000000000000163371357507750000205510ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib module J = Javascript let rec enot_rec e = let ((_, cost) as res) = match e with | J.ESeq (e1, e2) -> let e2', cost = enot_rec e2 in J.ESeq (e1, e2'), cost | J.ECond (e1, e2, e3) -> let e2', cost2 = enot_rec e2 in let e3', cost3 = enot_rec e3 in J.ECond (e1, e2', e3'), cost2 + cost3 | J.EBin (op, e1, e2) -> ( match op with | J.Or -> let e1', cost1 = enot_rec e1 in let e2', cost2 = enot_rec e2 in J.EBin (J.And, e1', e2'), cost1 + cost2 | J.And -> let e1', cost1 = enot_rec e1 in let e2', cost2 = enot_rec e2 in J.EBin (J.Or, e1', e2'), cost1 + cost2 | J.EqEq -> J.EBin (J.NotEq, e1, e2), 0 | J.NotEq -> J.EBin (J.EqEq, e1, e2), 0 | J.EqEqEq -> J.EBin (J.NotEqEq, e1, e2), 0 | J.NotEqEq -> J.EBin (J.EqEqEq, e1, e2), 0 (*Disabled: this is not correct! var x = 0/0; !(x < 0) and x >= 0 give different result | J.Lt -> (J.EBin (J.Le, e2, e1), 0) | J.Le -> (J.EBin (J.Lt, e2, e1), 0) *) | _ -> J.EUn (J.Not, e), 1) | J.EUn (J.Not, e) -> e, 0 | J.EUn ((J.Neg | J.Pl | J.Typeof | J.Void | J.Delete | J.Bnot), _) -> J.EUn (J.Not, e), 0 | J.EBool b -> J.EBool (not b), 0 | J.ECall _ | J.EAccess _ | J.EDot _ | J.ENew _ | J.EVar _ | J.EFun _ | J.EStr _ | J.EArr _ | J.ENum _ | J.EObj _ | J.EQuote _ | J.ERegexp _ | J.EUn ((J.IncrA | J.IncrB | J.DecrA | J.DecrB), _) -> J.EUn (J.Not, e), 1 in if cost <= 1 then res else J.EUn (J.Not, e), 1 let enot e = fst (enot_rec e) let unblock st = match st with | J.Block l, _ -> l | _ -> [ st ] let block l = match l with | [ x ] -> x | l -> J.Block l, J.N exception Not_expression let rec expression_of_statement_list l = match l with | (J.Return_statement (Some e), _) :: _ -> e | (J.Expression_statement e, _) :: rem -> J.ESeq (e, expression_of_statement_list rem) | _ -> raise Not_expression let expression_of_statement st = match fst st with | J.Return_statement (Some e) -> e | J.Block l -> expression_of_statement_list l | _ -> raise Not_expression exception Not_assignment let rec assignment_of_statement_list l = match l with | [ (J.Variable_statement [ (x, Some e) ], _) ] -> x, e | (J.Expression_statement e, _) :: rem -> let x, (e', nid) = assignment_of_statement_list rem in x, (J.ESeq (e, e'), nid) | _ -> raise Not_assignment let assignment_of_statement st = match fst st with | J.Variable_statement [ (x, Some e) ] -> x, e | J.Block l -> assignment_of_statement_list l | _ -> raise Not_assignment let simplify_condition = function (* | J.ECond _ -> J.ENum 1. *) | J.ECond (e, J.ENum one, J.ENum zero) when J.Num.is_one one && J.Num.is_zero zero -> e | J.ECond (e, J.ENum zero, J.ENum one) when J.Num.is_one one && J.Num.is_zero zero -> J.EUn (J.Not, e) | J.ECond (J.EBin ((J.NotEqEq | J.NotEq), J.ENum n, y), e1, e2) | J.ECond (J.EBin ((J.NotEqEq | J.NotEq), y, J.ENum n), e1, e2) -> J.ECond (J.EBin (J.Band, y, J.ENum n), e1, e2) | cond -> cond let rec if_statement_2 e loc iftrue truestop iffalse falsestop = let e = simplify_condition e in match fst iftrue, fst iffalse with (* Empty blocks *) | J.Block [], J.Block [] -> [ J.Expression_statement e, loc ] | J.Block [], _ -> if_statement_2 (enot e) loc iffalse falsestop iftrue truestop | _, J.Block [] -> [ J.If_statement (e, iftrue, None), loc ] | _ -> ( try (* Generates conditional *) let x1, (e1, _) = assignment_of_statement iftrue in let x2, (e2, _) = assignment_of_statement iffalse in if Poly.(x1 <> x2) then raise Not_assignment; let exp = if Poly.(e1 = e) then J.EBin (J.Or, e, e2) else J.ECond (e, e1, e2) in [ J.Variable_statement [ x1, Some (exp, loc) ], loc ] with Not_assignment -> ( try let e1 = expression_of_statement iftrue in let e2 = expression_of_statement iffalse in [ J.Return_statement (Some (J.ECond (e, e1, e2))), loc ] with Not_expression -> if truestop then (J.If_statement (e, iftrue, None), loc) :: unblock iffalse else if falsestop then (J.If_statement (enot e, iffalse, None), loc) :: unblock iftrue else [ J.If_statement (e, iftrue, Some iffalse), loc ])) let unopt b = match b with | Some b -> b | None -> J.Block [], J.N let if_statement e loc iftrue truestop iffalse falsestop = (*FIX: should be done at an earlier stage*) let e = simplify_condition e in match iftrue, iffalse with (* Shared statements *) | (J.If_statement (e', iftrue', iffalse'), loc), _ when Poly.(iffalse = unopt iffalse') -> if_statement_2 (J.EBin (J.And, e, e')) loc iftrue' truestop iffalse falsestop | (J.If_statement (e', iftrue', iffalse'), loc), _ when Poly.(iffalse = iftrue') -> if_statement_2 (J.EBin (J.And, e, J.EUn (J.Not, e'))) loc (unopt iffalse') truestop iffalse falsestop | _, (J.If_statement (e', iftrue', iffalse'), loc) when Poly.(iftrue = iftrue') -> if_statement_2 (J.EBin (J.Or, e, e')) loc iftrue truestop (unopt iffalse') falsestop | _, (J.If_statement (e', iftrue', iffalse'), loc) when Poly.(iftrue = unopt iffalse') -> if_statement_2 (J.EBin (J.Or, e, J.EUn (J.Not, e'))) loc iftrue truestop iftrue' falsestop | _ -> if_statement_2 e loc iftrue truestop iffalse falsestop let rec get_variable acc = function | J.ESeq (e1, e2) | J.EBin (_, e1, e2) | J.EAccess (e1, e2) -> get_variable (get_variable acc e1) e2 | J.ECond (e1, e2, e3) -> get_variable (get_variable (get_variable acc e1) e2) e3 | J.EUn (_, e1) | J.EDot (e1, _) | J.ENew (e1, None) -> get_variable acc e1 | J.ECall (e1, el, _) | J.ENew (e1, Some el) -> List.fold_left ~f:get_variable ~init:acc (e1 :: el) | J.EVar (J.V v) -> Code.Var.Set.add v acc | J.EVar (J.S _) -> acc | J.EFun _ | J.EStr _ | J.EBool _ | J.ENum _ | J.EQuote _ | J.ERegexp _ -> acc | J.EArr a -> List.fold_left ~f:(fun acc i -> match i with | None -> acc | Some e1 -> get_variable acc e1) ~init:acc a | J.EObj l -> List.fold_left ~f:(fun acc (_, e1) -> get_variable acc e1) ~init:acc l js_of_ocaml-3.5.2/compiler/lib/js_simpl.mli000066400000000000000000000024721357507750000207150ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Javascript val if_statement : expression -> location -> statement * location -> bool -> statement * location -> bool -> (statement * location) list val get_variable : Code.Var.Set.t -> expression -> Code.Var.Set.t val block : (Javascript.statement * location) list -> Javascript.statement * location val unblock : Javascript.statement * location -> (Javascript.statement * location) list js_of_ocaml-3.5.2/compiler/lib/js_token.ml000066400000000000000000000207021357507750000205340ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type token = | T_WITH of Parse_info.t | T_WHILE of Parse_info.t | T_VOID of Parse_info.t | T_VIRTUAL_SEMICOLON of Parse_info.t | T_VAR of Parse_info.t | T_TYPEOF of Parse_info.t | T_TRY of Parse_info.t | T_TRUE of Parse_info.t | T_THROW of Parse_info.t | T_THIS of Parse_info.t | T_SWITCH of Parse_info.t | T_STRING of (string * Parse_info.t) | T_STRICT_NOT_EQUAL of Parse_info.t | T_STRICT_EQUAL of Parse_info.t | T_SEMICOLON of Parse_info.t | T_RSHIFT_ASSIGN of Parse_info.t | T_RSHIFT3_ASSIGN of Parse_info.t | T_RSHIFT3 of Parse_info.t | T_RSHIFT of Parse_info.t | T_RPAREN of Parse_info.t | T_RETURN of Parse_info.t | T_REGEX of (string * Parse_info.t) | T_RCURLY of Parse_info.t | T_RBRACKET of Parse_info.t | T_PLUS_ASSIGN of Parse_info.t | T_PLUS of Parse_info.t | T_PLING of Parse_info.t | T_PERIOD of Parse_info.t | T_OR of Parse_info.t | T_NUMBER of (string * Parse_info.t) | T_NULL of Parse_info.t | T_NOT_EQUAL of Parse_info.t | T_NOT of Parse_info.t | T_NEW of Parse_info.t | T_MULT_ASSIGN of Parse_info.t | T_MULT of Parse_info.t | T_MOD_ASSIGN of Parse_info.t | T_MOD of Parse_info.t | T_MINUS_ASSIGN of Parse_info.t | T_MINUS of Parse_info.t | T_LSHIFT_ASSIGN of Parse_info.t | T_LSHIFT of Parse_info.t | T_LPAREN of Parse_info.t | T_LESS_THAN_EQUAL of Parse_info.t | T_LESS_THAN of Parse_info.t | T_LCURLY of Parse_info.t | T_LBRACKET of Parse_info.t | T_INSTANCEOF of Parse_info.t | T_INCR_NB of Parse_info.t | T_INCR of Parse_info.t | T_IN of Parse_info.t | T_IF of Parse_info.t | T_IDENTIFIER of (string * Parse_info.t) | T_GREATER_THAN_EQUAL of Parse_info.t | T_GREATER_THAN of Parse_info.t | T_FUNCTION of Parse_info.t | T_FOR of Parse_info.t | T_FINALLY of Parse_info.t | T_FALSE of Parse_info.t | T_EQUAL of Parse_info.t | T_ELSE of Parse_info.t | T_DO of Parse_info.t | T_DIV_ASSIGN of Parse_info.t | T_DIV of Parse_info.t | T_DELETE of Parse_info.t | T_DEFAULT of Parse_info.t | T_DECR_NB of Parse_info.t | T_DECR of Parse_info.t | T_CONTINUE of Parse_info.t | T_COMMA of Parse_info.t | T_COLON of Parse_info.t | T_CATCH of Parse_info.t | T_CASE of Parse_info.t | T_BREAK of Parse_info.t | T_BIT_XOR_ASSIGN of Parse_info.t | T_BIT_XOR of Parse_info.t | T_BIT_OR_ASSIGN of Parse_info.t | T_BIT_OR of Parse_info.t | T_BIT_NOT of Parse_info.t | T_BIT_AND_ASSIGN of Parse_info.t | T_BIT_AND of Parse_info.t | T_ASSIGN of Parse_info.t | T_AND of Parse_info.t | T_DEBUGGER of Parse_info.t | TUnknown of (Parse_info.t * string) | TCommentSpace of (Parse_info.t * string) | TCommentNewline of (Parse_info.t * string) | TCommentML of (Parse_info.t * string) | TComment of (Parse_info.t * string) | EOF of Parse_info.t let info_of_tok = function | TUnknown (ii, _) -> ii | TCommentSpace (ii, _) -> ii | TCommentNewline (ii, _) -> ii | TComment (ii, _) -> ii | TCommentML (ii, _) -> ii | EOF ii -> ii | T_DEBUGGER ii -> ii | T_NUMBER (_, ii) -> ii | T_IDENTIFIER (_, ii) -> ii | T_STRING (_, ii) -> ii | T_REGEX (_, ii) -> ii | T_FUNCTION ii -> ii | T_IF ii -> ii | T_IN ii -> ii | T_INSTANCEOF ii -> ii | T_RETURN ii -> ii | T_SWITCH ii -> ii | T_THIS ii -> ii | T_THROW ii -> ii | T_TRY ii -> ii | T_VAR ii -> ii | T_WHILE ii -> ii | T_WITH ii -> ii | T_NULL ii -> ii | T_FALSE ii -> ii | T_TRUE ii -> ii | T_BREAK ii -> ii | T_CASE ii -> ii | T_CATCH ii -> ii | T_CONTINUE ii -> ii | T_DEFAULT ii -> ii | T_DO ii -> ii | T_FINALLY ii -> ii | T_FOR ii -> ii | T_ELSE ii -> ii | T_NEW ii -> ii | T_LCURLY ii -> ii | T_RCURLY ii -> ii | T_LPAREN ii -> ii | T_RPAREN ii -> ii | T_LBRACKET ii -> ii | T_RBRACKET ii -> ii | T_SEMICOLON ii -> ii | T_COMMA ii -> ii | T_PERIOD ii -> ii | T_RSHIFT3_ASSIGN ii -> ii | T_RSHIFT_ASSIGN ii -> ii | T_LSHIFT_ASSIGN ii -> ii | T_BIT_XOR_ASSIGN ii -> ii | T_BIT_OR_ASSIGN ii -> ii | T_BIT_AND_ASSIGN ii -> ii | T_MOD_ASSIGN ii -> ii | T_DIV_ASSIGN ii -> ii | T_MULT_ASSIGN ii -> ii | T_MINUS_ASSIGN ii -> ii | T_PLUS_ASSIGN ii -> ii | T_ASSIGN ii -> ii | T_PLING ii -> ii | T_COLON ii -> ii | T_OR ii -> ii | T_AND ii -> ii | T_BIT_OR ii -> ii | T_BIT_XOR ii -> ii | T_BIT_AND ii -> ii | T_EQUAL ii -> ii | T_NOT_EQUAL ii -> ii | T_STRICT_EQUAL ii -> ii | T_STRICT_NOT_EQUAL ii -> ii | T_LESS_THAN_EQUAL ii -> ii | T_GREATER_THAN_EQUAL ii -> ii | T_LESS_THAN ii -> ii | T_GREATER_THAN ii -> ii | T_LSHIFT ii -> ii | T_RSHIFT ii -> ii | T_RSHIFT3 ii -> ii | T_PLUS ii -> ii | T_MINUS ii -> ii | T_DIV ii -> ii | T_MULT ii -> ii | T_MOD ii -> ii | T_NOT ii -> ii | T_BIT_NOT ii -> ii | T_INCR ii -> ii | T_DECR ii -> ii | T_INCR_NB ii -> ii | T_DECR_NB ii -> ii | T_DELETE ii -> ii | T_TYPEOF ii -> ii | T_VOID ii -> ii | T_VIRTUAL_SEMICOLON ii -> ii let string_of_tok = function | TUnknown (_, _) -> "COMMENT" | TCommentSpace (_, _) -> "COMMENT" | TCommentNewline (_, _) -> "COMMENT" | TComment (_, _) -> "COMMENT" | TCommentML (_, _) -> "COMMENT" | EOF _ -> "EOF" | T_DEBUGGER _ -> "DEBUGGER" | T_NUMBER (_, _) -> "T_NUMBER" | T_IDENTIFIER (_, _) -> "T_IDENTIFIER" | T_STRING (_, _) -> "T_STRING" | T_REGEX (_, _) -> "T_REGEX" | T_FUNCTION _ -> " T_FUNCTION" | T_IF _ -> "T_IF" | T_IN _ -> "T_IN" | T_INSTANCEOF _ -> "T_INSTANCEOF" | T_RETURN _ -> "T_RETURN" | T_SWITCH _ -> "T_SWITCH" | T_THIS _ -> "T_THIS" | T_THROW _ -> "T_THROW" | T_TRY _ -> "T_TRY" | T_VAR _ -> "T_VAR" | T_WHILE _ -> "T_WHILE" | T_WITH _ -> "T_WITH" | T_NULL _ -> "T_NULL" | T_FALSE _ -> "T_FALSE" | T_TRUE _ -> "T_TRUE" | T_BREAK _ -> "T_BREAK" | T_CASE _ -> "T_CASE" | T_CATCH _ -> "T_CATCH" | T_CONTINUE _ -> "T_CONTINUE" | T_DEFAULT _ -> "T_DEFAULT" | T_DO _ -> "T_DO" | T_FINALLY _ -> "T_FINALLY" | T_FOR _ -> "T_FOR" | T_ELSE _ -> "T_ELSE" | T_NEW _ -> "T_NEW" | T_LCURLY _ -> "T_LCURLY" | T_RCURLY _ -> "T_RCURLY" | T_LPAREN _ -> "T_LPAREN" | T_RPAREN _ -> "T_RPAREN" | T_LBRACKET _ -> "T_LBRACKET" | T_RBRACKET _ -> "T_RBRACKET" | T_SEMICOLON _ -> "T_SEMICOLON" | T_COMMA _ -> "T_COMMA" | T_PERIOD _ -> "T_PERIOD" | T_RSHIFT3_ASSIGN _ -> "T_RSHIFT3" | T_RSHIFT_ASSIGN _ -> "T_RSHIFT" | T_LSHIFT_ASSIGN _ -> "T_LSHIFT" | T_BIT_XOR_ASSIGN _ -> "T_BIT" | T_BIT_OR_ASSIGN _ -> "T_BIT" | T_BIT_AND_ASSIGN _ -> "T_BIT" | T_MOD_ASSIGN _ -> "T_MOD" | T_DIV_ASSIGN _ -> "T_DIV" | T_MULT_ASSIGN _ -> "T_MULT" | T_MINUS_ASSIGN _ -> "T_MINUS" | T_PLUS_ASSIGN _ -> "T_PLUS" | T_ASSIGN _ -> "T_ASSIGN" | T_PLING _ -> "T_PLING" | T_COLON _ -> "T_COLON" | T_OR _ -> "T_OR" | T_AND _ -> "T_AND" | T_BIT_OR _ -> "T_BIT" | T_BIT_XOR _ -> "T_BIT" | T_BIT_AND _ -> "T_BIT" | T_EQUAL _ -> "T_EQUAL" | T_NOT_EQUAL _ -> "T_NOT" | T_STRICT_EQUAL _ -> "T_STRICT" | T_STRICT_NOT_EQUAL _ -> "T_STRICT" | T_LESS_THAN_EQUAL _ -> "T_LESS" | T_GREATER_THAN_EQUAL _ -> "T_GREATER" | T_LESS_THAN _ -> "T_LESS" | T_GREATER_THAN _ -> "T_GREATER" | T_LSHIFT _ -> "T_LSHIFT" | T_RSHIFT _ -> "T_RSHIFT" | T_RSHIFT3 _ -> "T_RSHIFT3" | T_PLUS _ -> "T_PLUS" | T_MINUS _ -> "T_MINUS" | T_DIV _ -> "T_DIV" | T_MULT _ -> "T_MULT" | T_MOD _ -> "T_MOD" | T_NOT _ -> "T_NOT" | T_BIT_NOT _ -> "T_BIT" | T_INCR _ -> "T_INCR" | T_DECR _ -> "T_DECR" | T_INCR_NB _ -> "T_INCR" | T_DECR_NB _ -> "T_DECR" | T_DELETE _ -> "T_DELETE" | T_TYPEOF _ -> "T_TYPEOF" | T_VOID _ -> "T_VOID" | T_VIRTUAL_SEMICOLON _ -> "T_VIRTUAL" let is_comment = function | TCommentSpace _ | TCommentNewline _ | TComment _ | TCommentML _ -> true | _ -> false js_of_ocaml-3.5.2/compiler/lib/js_token.mli000066400000000000000000000072561357507750000207160ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type token = | T_WITH of Parse_info.t | T_WHILE of Parse_info.t | T_VOID of Parse_info.t | T_VIRTUAL_SEMICOLON of Parse_info.t | T_VAR of Parse_info.t | T_TYPEOF of Parse_info.t | T_TRY of Parse_info.t | T_TRUE of Parse_info.t | T_THROW of Parse_info.t | T_THIS of Parse_info.t | T_SWITCH of Parse_info.t | T_STRING of (string * Parse_info.t) | T_STRICT_NOT_EQUAL of Parse_info.t | T_STRICT_EQUAL of Parse_info.t | T_SEMICOLON of Parse_info.t | T_RSHIFT_ASSIGN of Parse_info.t | T_RSHIFT3_ASSIGN of Parse_info.t | T_RSHIFT3 of Parse_info.t | T_RSHIFT of Parse_info.t | T_RPAREN of Parse_info.t | T_RETURN of Parse_info.t | T_REGEX of (string * Parse_info.t) | T_RCURLY of Parse_info.t | T_RBRACKET of Parse_info.t | T_PLUS_ASSIGN of Parse_info.t | T_PLUS of Parse_info.t | T_PLING of Parse_info.t | T_PERIOD of Parse_info.t | T_OR of Parse_info.t | T_NUMBER of (string * Parse_info.t) | T_NULL of Parse_info.t | T_NOT_EQUAL of Parse_info.t | T_NOT of Parse_info.t | T_NEW of Parse_info.t | T_MULT_ASSIGN of Parse_info.t | T_MULT of Parse_info.t | T_MOD_ASSIGN of Parse_info.t | T_MOD of Parse_info.t | T_MINUS_ASSIGN of Parse_info.t | T_MINUS of Parse_info.t | T_LSHIFT_ASSIGN of Parse_info.t | T_LSHIFT of Parse_info.t | T_LPAREN of Parse_info.t | T_LESS_THAN_EQUAL of Parse_info.t | T_LESS_THAN of Parse_info.t | T_LCURLY of Parse_info.t | T_LBRACKET of Parse_info.t | T_INSTANCEOF of Parse_info.t | T_INCR_NB of Parse_info.t | T_INCR of Parse_info.t | T_IN of Parse_info.t | T_IF of Parse_info.t | T_IDENTIFIER of (string * Parse_info.t) | T_GREATER_THAN_EQUAL of Parse_info.t | T_GREATER_THAN of Parse_info.t | T_FUNCTION of Parse_info.t | T_FOR of Parse_info.t | T_FINALLY of Parse_info.t | T_FALSE of Parse_info.t | T_EQUAL of Parse_info.t | T_ELSE of Parse_info.t | T_DO of Parse_info.t | T_DIV_ASSIGN of Parse_info.t | T_DIV of Parse_info.t | T_DELETE of Parse_info.t | T_DEFAULT of Parse_info.t | T_DECR_NB of Parse_info.t | T_DECR of Parse_info.t | T_CONTINUE of Parse_info.t | T_COMMA of Parse_info.t | T_COLON of Parse_info.t | T_CATCH of Parse_info.t | T_CASE of Parse_info.t | T_BREAK of Parse_info.t | T_BIT_XOR_ASSIGN of Parse_info.t | T_BIT_XOR of Parse_info.t | T_BIT_OR_ASSIGN of Parse_info.t | T_BIT_OR of Parse_info.t | T_BIT_NOT of Parse_info.t | T_BIT_AND_ASSIGN of Parse_info.t | T_BIT_AND of Parse_info.t | T_ASSIGN of Parse_info.t | T_AND of Parse_info.t | T_DEBUGGER of Parse_info.t | TUnknown of (Parse_info.t * string) | TCommentSpace of (Parse_info.t * string) | TCommentNewline of (Parse_info.t * string) | TCommentML of (Parse_info.t * string) | TComment of (Parse_info.t * string) | EOF of Parse_info.t val info_of_tok : token -> Parse_info.t val string_of_tok : token -> string val is_comment : token -> bool js_of_ocaml-3.5.2/compiler/lib/js_traverse.ml000066400000000000000000000740421357507750000212550ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Javascript class type mapper = object method expression : Javascript.expression -> Javascript.expression method expression_o : Javascript.expression option -> Javascript.expression option method switch_case : Javascript.expression -> Javascript.expression method initialiser : Javascript.expression * Javascript.location -> Javascript.expression * Javascript.location method initialiser_o : (Javascript.expression * Javascript.location) option -> (Javascript.expression * Javascript.location) option method variable_declaration : Javascript.variable_declaration -> Javascript.variable_declaration method statement : Javascript.statement -> Javascript.statement method statement_o : (Javascript.statement * Javascript.location) option -> (Javascript.statement * Javascript.location) option method statements : Javascript.statement_list -> Javascript.statement_list method source : Javascript.source_element -> Javascript.source_element method sources : Javascript.source_elements -> Javascript.source_elements method ident : Javascript.ident -> Javascript.ident method program : Javascript.program -> Javascript.program end (* generic js ast walk/map *) class map : mapper = object (m) method ident i = i method statements l = List.map l ~f:(fun (s, pc) -> m#statement s, pc) method variable_declaration (id, eo) = m#ident id, m#initialiser_o eo method statement s = match s with | Block b -> Block (m#statements b) | Variable_statement l -> Variable_statement (List.map l ~f:m#variable_declaration) | Empty_statement -> Empty_statement | Debugger_statement -> Debugger_statement | Expression_statement e -> Expression_statement (m#expression e) | If_statement (e, (s, loc), sopt) -> If_statement (m#expression e, (m#statement s, loc), m#statement_o sopt) | Do_while_statement ((s, loc), e) -> Do_while_statement ((m#statement s, loc), m#expression e) | While_statement (e, (s, loc)) -> While_statement (m#expression e, (m#statement s, loc)) | For_statement (e1, e2, e3, (s, loc)) -> let e1 = match e1 with | Left o -> Left (m#expression_o o) | Right l -> Right (List.map l ~f:(fun (id, eo) -> m#ident id, m#initialiser_o eo)) in For_statement (e1, m#expression_o e2, m#expression_o e3, (m#statement s, loc)) | ForIn_statement (e1, e2, (s, loc)) -> let e1 = match e1 with | Left e -> Left (m#expression e) | Right (id, e) -> Right (m#ident id, m#initialiser_o e) in ForIn_statement (e1, m#expression e2, (m#statement s, loc)) | Continue_statement s -> Continue_statement s | Break_statement s -> Break_statement s | Return_statement e -> Return_statement (m#expression_o e) | Labelled_statement (l, (s, loc)) -> Labelled_statement (l, (m#statement s, loc)) | Throw_statement e -> Throw_statement (m#expression e) | Switch_statement (e, l, def, l') -> Switch_statement ( m#expression e , List.map l ~f:(fun (e, s) -> m#switch_case e, m#statements s) , (match def with | None -> None | Some l -> Some (m#statements l)) , List.map l' ~f:(fun (e, s) -> m#switch_case e, m#statements s) ) | Try_statement (b, catch, final) -> Try_statement ( m#statements b , (match catch with | None -> None | Some (id, b) -> Some (m#ident id, m#statements b)) , match final with | None -> None | Some s -> Some (m#statements s) ) method statement_o x = match x with | None -> None | Some (s, loc) -> Some (m#statement s, loc) method switch_case e = m#expression e method expression x = match x with | ESeq (e1, e2) -> ESeq (m#expression e1, m#expression e2) | ECond (e1, e2, e3) -> ECond (m#expression e1, m#expression e2, m#expression e3) | EBin (b, e1, e2) -> EBin (b, m#expression e1, m#expression e2) | EUn (b, e1) -> EUn (b, m#expression e1) | ECall (e1, e2, loc) -> ECall (m#expression e1, List.map e2 ~f:m#expression, loc) | EAccess (e1, e2) -> EAccess (m#expression e1, m#expression e2) | EDot (e1, id) -> EDot (m#expression e1, id) | ENew (e1, Some args) -> ENew (m#expression e1, Some (List.map args ~f:m#expression)) | ENew (e1, None) -> ENew (m#expression e1, None) | EVar v -> EVar (m#ident v) | EFun (idopt, params, body, nid) -> let idopt = match idopt with | None -> None | Some i -> Some (m#ident i) in EFun (idopt, List.map params ~f:m#ident, m#sources body, nid) | EArr l -> EArr (List.map l ~f:(fun x -> m#expression_o x)) | EObj l -> EObj (List.map l ~f:(fun (i, e) -> i, m#expression e)) | (EStr _ as x) | (EBool _ as x) | (ENum _ as x) | (EQuote _ as x) | (ERegexp _ as x) -> x method expression_o x = match x with | None -> None | Some s -> Some (m#expression s) method initialiser (e, pc) = m#expression e, pc method initialiser_o x = match x with | None -> None | Some i -> Some (m#initialiser i) method source x = match x with | Statement s -> Statement (m#statement s) | Function_declaration (id, params, body, nid) -> Function_declaration (m#ident id, List.map params ~f:m#ident, m#sources body, nid) method sources x = List.map x ~f:(fun (s, loc) -> m#source s, loc) method program x = m#sources x end (* var substitution *) class subst sub = object inherit map method ident x = sub x end class map_for_share_constant = object (m) inherit map as super method expression e = match e with (* JavaScript engines recognize the pattern 'typeof x==="number"'; if the string is shared, less efficient code is generated. *) | EBin (op, EUn (Typeof, e1), (EStr _ as e2)) -> EBin (op, EUn (Typeof, super#expression e1), e2) | EBin (op, (EStr _ as e1), EUn (Typeof, e2)) -> EBin (op, EUn (Typeof, e1), super#expression e2) (* Some js bundler get confused when the argument of 'require' is not a literal *) | ECall (EVar (S { var = None; name = "require"; _ }), [ EStr _ ], _) -> e | _ -> super#expression e (* do not replace constant in switch case *) method switch_case e = match e with | ENum _ | EStr _ -> e | _ -> m#expression e method sources l = match l with | [] -> [] | ((Statement (Expression_statement (EStr _)), _) as prolog) :: rest -> prolog :: List.map_tc rest ~f:(fun (x, loc) -> m#source x, loc) | rest -> List.map_tc rest ~f:(fun (x, loc) -> m#source x, loc) end class replace_expr f = object inherit map_for_share_constant as super method expression e = try EVar (f e) with Not_found -> super#expression e end (* this optimisation should be done at the lowest common scope *) class share_constant = object inherit map_for_share_constant as super val count = Hashtbl.create 17 method expression e = let e = match e with | EStr (s, `Utf8) when (not (String.has_backslash s)) && String.is_ascii s -> let e = EStr (s, `Bytes) in let n = try Hashtbl.find count e with Not_found -> 0 in Hashtbl.replace count e (n + 1); e | EStr (_, _) | ENum _ -> let n = try Hashtbl.find count e with Not_found -> 0 in Hashtbl.replace count e (n + 1); e | _ -> e in super#expression e method program p = let p = super#program p in let all = Hashtbl.create 17 in Hashtbl.iter (fun x n -> let shareit = match x with | EStr (s, _) when n > 1 -> if String.length s < 20 then Some ("str_" ^ s) else Some ("str_" ^ String.sub s ~pos:0 ~len:16 ^ "_abr") | ENum s when n > 1 -> let s = Javascript.Num.to_string s in let l = String.length s in if l > 2 then Some ("num_" ^ s) else None | _ -> None in match shareit with | Some name -> let v = Code.Var.fresh_n name in Hashtbl.add all x (V v) | _ -> ()) count; if Hashtbl.length all = 0 then p else let f = Hashtbl.find all in let p = (new replace_expr f)#program p in let all = Hashtbl.fold (fun e v acc -> (v, Some (e, N)) :: acc) all [] in (Statement (Variable_statement all), N) :: p end module S = Code.Var.Set type t = { use_name : StringSet.t ; def_name : StringSet.t ; def : S.t ; use : S.t ; count : int Javascript.IdentMap.t } let empty = { def = S.empty ; use = S.empty ; use_name = StringSet.empty ; def_name = StringSet.empty ; count = Javascript.IdentMap.empty } (* def/used/free variable *) class type freevar = object ('a) inherit mapper method merge_info : 'a -> unit method block : ?catch:bool -> Javascript.ident list -> unit method def_var : Javascript.ident -> unit method use_var : Javascript.ident -> unit method state : t method get_free_name : StringSet.t method get_free : Code.Var.Set.t method get_def_name : StringSet.t method get_def : Code.Var.Set.t method get_use_name : StringSet.t method get_use : Code.Var.Set.t end class free = object (m : 'test) inherit map as super val level : int = 0 val mutable state_ : t = empty method state = state_ method get_free = S.diff m#state.use m#state.def method get_def = m#state.def method get_free_name = StringSet.diff m#state.use_name m#state.def_name method get_def_name = m#state.def_name method get_use_name = m#state.use_name method get_use = m#state.use method merge_info from = let free_name = from#get_free_name in let free = from#get_free in let count = IdentMap.fold (fun v k acc -> let n = try IdentMap.find v acc with Not_found -> 0 in IdentMap.add v (k + n) acc) from#state.count m#state.count in state_ <- { state_ with use_name = StringSet.union state_.use_name free_name ; use = S.union state_.use free ; count } method use_var x = let n = try IdentMap.find x state_.count with Not_found -> 0 in let count = IdentMap.add x (succ n) state_.count in match x with | S { name; _ } -> state_ <- { state_ with use_name = StringSet.add name state_.use_name; count } | V v -> state_ <- { state_ with use = S.add v state_.use; count } method def_var x = let n = try IdentMap.find x state_.count with Not_found -> 0 in let count = IdentMap.add x (succ n) state_.count in match x with | S { name; _ } -> state_ <- { state_ with def_name = StringSet.add name state_.def_name; count } | V v -> state_ <- { state_ with def = S.add v state_.def; count } method expression x = match x with | EVar v -> m#use_var v; x | EFun (ident, params, body, nid) -> let tbody = ({} :> 'test) in let () = List.iter params ~f:tbody#def_var in let body = tbody#sources body in let ident = match ident with | Some (V v) when not (S.mem v tbody#state.use) -> None | Some (S { name; _ }) when not (StringSet.mem name tbody#state.use_name) -> None | Some id -> tbody#def_var id; ident | None -> None in tbody#block params; m#merge_info tbody; EFun (ident, params, body, nid) | _ -> super#expression x method source x = match x with | Function_declaration (id, params, body, nid) -> let tbody = {} in let () = List.iter params ~f:tbody#def_var in let body = tbody#sources body in tbody#block params; m#def_var id; m#merge_info tbody; Function_declaration (id, params, body, nid) | Statement _ -> super#source x method block ?catch:_ _ = () method statement x = match x with | Variable_statement l -> let l = List.map l ~f:(fun (id, eopt) -> m#def_var id; match eopt with | None -> id, None | Some (e, pc) -> let e = m#expression e in id, Some (e, pc)) in Variable_statement l | For_statement (Right l, e2, e3, (s, loc)) -> let l = List.map l ~f:(fun (id, eopt) -> m#def_var id; match eopt with | None -> id, None | Some (e, pc) -> let e = m#expression e in id, Some (e, pc)) in For_statement (Right l, m#expression_o e2, m#expression_o e3, (m#statement s, loc)) | ForIn_statement (Right (id, eopt), e2, (s, loc)) -> m#def_var id; let r = match eopt with | None -> id, None | Some (e, pc) -> let e = m#expression e in id, Some (e, pc) in ForIn_statement (Right r, m#expression e2, (m#statement s, loc)) | Try_statement (b, w, f) -> let b = m#statements b in let same_level = level in let tbody = {} in let w = match w with | None -> None | Some (id, block) -> let block = tbody#statements block in let () = tbody#def_var id in tbody#block ~catch:true [ id ]; (* special merge here *) (* we need to propagate both def and use .. *) (* .. except 'id' because its scope is limited to 'block' *) let clean set sets = match id with | S { name; _ } -> set, StringSet.remove name sets | V i -> S.remove i set, sets in let def, def_name = clean tbody#state.def tbody#state.def_name in let use, use_name = clean tbody#state.use tbody#state.use_name in let count = IdentMap.fold (fun v k acc -> let n = try IdentMap.find v acc with Not_found -> 0 in IdentMap.add v (k + n) acc) tbody#state.count m#state.count in state_ <- { use = S.union state_.use use ; use_name = StringSet.union state_.use_name use_name ; def = S.union state_.def def ; def_name = StringSet.union state_.def_name def_name ; count }; Some (id, block) in let f = match f with | None -> None | Some block -> Some (m#statements block) in Try_statement (b, w, f) | _ -> super#statement x end class rename_variable keeps = object inherit free as super val mutable sub_ = new subst (fun x -> x) method merge_info from = super#merge_info from; let h = Hashtbl.create 17 in let _ = StringSet.iter (fun name -> if StringSet.mem name keeps then () else let v = Code.Var.fresh_n name in Hashtbl.add h name v) from#state.def_name in let f = function | S { name; _ } when Hashtbl.mem h name -> V (Hashtbl.find h name) | s -> s in sub_ <- new subst f (* method block params *) method expression x = let x = super#expression x in match x with | EFun _ -> sub_#expression x | _ -> x method statement x = let x = super#statement x in match x with | Try_statement (b, w, f) -> let w = match w with | Some (S { name; _ }, block) -> let v = Code.Var.fresh_n name in let sub = function | S { name = name'; _ } when String.equal name' name -> V v | x -> x in let s = new subst sub in Some (V v, s#statements block) | x -> x in Try_statement (b, w, f) | _ -> x method source x = let x = super#source x in match x with | Function_declaration (id, params, body, nid) -> Function_declaration (id, List.map params ~f:sub_#ident, sub_#sources body, nid) | Statement _ -> x end class compact_vardecl = object (m) inherit free as super val mutable exc_ = IdentSet.empty val mutable insert_ = IdentSet.empty method exc = exc_ method private translate l = List.filter_map l ~f:(fun (id, eopt) -> match eopt with | None -> None | Some (e, _) -> Some (EBin (Eq, EVar id, e))) method private translate_st l = let l = m#translate l in match l with | [] -> Empty_statement | x :: l -> Expression_statement (List.fold_left l ~init:x ~f:(fun acc e -> ESeq (acc, e))) method private translate_ex l = let l = m#translate l in match l with | [] -> None | x :: l -> Some (List.fold_left l ~init:x ~f:(fun acc e -> ESeq (acc, e))) method private except e = exc_ <- IdentSet.add e exc_ method statement s = let s = super#statement s in match s with | Variable_statement l -> m#translate_st l | For_statement (Right l, e2, e3, s) -> For_statement (Left (m#translate_ex l), e2, e3, s) | ForIn_statement (Right (id, op), e2, s) -> (match op with | Some _ -> assert false | None -> ()); ForIn_statement (Left (EVar id), e2, s) | Try_statement (b, w, f) -> (match w with | None -> () | Some (id, _) -> m#except id); Try_statement (b, w, f) | s -> s method block ?(catch = false) params = ignore catch; List.iter params ~f:m#except; super#block params method merge_info from = super#merge_info from; let all = S.fold (fun e acc -> IdentSet.add (V e) acc) from#state.def IdentSet.empty in let all = StringSet.fold (fun e acc -> IdentSet.add (ident e) acc) from#state.def_name all in insert_ <- IdentSet.diff all from#exc method private split x = let rec loop = function | ESeq (e1, e2) -> loop e1 @ loop e2 | e -> [ e ] in loop x method private pack all sources = let may_flush rem vars s instr = if List.is_empty vars then rem, [], s :: instr else rem, [], s :: (Statement (Variable_statement (List.rev vars)), N) :: instr in let rem, vars, instr = List.fold_left sources ~init:(all, [], []) ~f:(fun (rem, vars, instr) (s, loc) -> match s with | Statement (Expression_statement e) -> let l = m#split e in List.fold_left l ~init:(rem, vars, instr) ~f:(fun (rem, vars, instr) e -> match e with | EBin (Eq, EVar id, exp) when IdentSet.mem id rem -> IdentSet.remove id rem, (id, Some (exp, N)) :: vars, instr | x -> may_flush rem vars (Statement (Expression_statement x), N) instr) | Statement _ as s -> may_flush rem vars (s, loc) instr | Function_declaration _ as x -> rem, vars, (x, loc) :: instr) in let instr = match vars with | [] -> List.rev instr | d -> let d = Statement (Variable_statement (List.rev d)) in List.rev ((d, N) :: instr) in let l = IdentSet.fold (fun x acc -> (x, None) :: acc) rem [] in match l, instr with | [], _ -> instr | l, (Statement (Variable_statement l'), loc) :: rest -> (Statement (Variable_statement (List.rev_append l l')), loc) :: rest | l, _ -> (Statement (Variable_statement l), N) :: instr method source x = let x = super#source x in match x with | Function_declaration (id, params, body, nid) -> let all = IdentSet.diff insert_ exc_ in let body = m#pack all body in m#except id; Function_declaration (id, params, body, nid) | Statement _ -> x method expression x = let x = super#expression x in match x with | EFun (ident, params, body, nid) -> let all = IdentSet.diff insert_ exc_ in let body = m#pack all body in (match ident with | Some id -> m#except id | None -> ()); EFun (ident, params, body, nid) | _ -> x method statements l = let l = super#statements l in let l = List.fold_left l ~init:[] ~f:(fun acc (x, loc) -> match x with | Expression_statement e -> let l = m#split e in let l = List.fold_left l ~init:acc ~f:(fun acc e -> (Expression_statement e, N) :: acc) in l | _ -> (x, loc) :: acc) in List.rev l end class clean = object (m) inherit map as super method statements l = let rev_append_st x l = match x with | Block b, _ -> List.rev_append b l | x -> x :: l in let l = super#statements l in let vars_rev, vars_loc, instr_rev = List.fold_left l ~init:([], N, []) ~f:(fun (vars_rev, vars_loc, instr_rev) (x, loc) -> match x with | Variable_statement l when Config.Flag.compact () -> let vars_loc = match vars_loc with | Pi _ as x -> x | _ -> loc in List.rev_append l vars_rev, vars_loc, instr_rev | Empty_statement | Expression_statement (EVar _) -> vars_rev, vars_loc, instr_rev | _ when List.is_empty vars_rev -> [], vars_loc, rev_append_st (x, loc) instr_rev | _ -> ( [] , vars_loc , rev_append_st (x, loc) ((Variable_statement (List.rev vars_rev), vars_loc) :: instr_rev) )) in let instr_rev = match vars_rev with | [] -> instr_rev | vars_rev -> (Variable_statement (List.rev vars_rev), vars_loc) :: instr_rev in List.rev instr_rev method statement s = let s = super#statement s in let b = function | Block [], loc -> Empty_statement, loc | Block [ x ], _ -> x | b -> b in let bopt = function | Some (Block [], _) -> None | Some (Block [ x ], _) -> Some x | Some b -> Some b | None -> None in match s with | If_statement (if', then', else') -> If_statement (if', b then', bopt else') | Do_while_statement (do', while') -> Do_while_statement (b do', while') | While_statement (cond, st) -> While_statement (cond, b st) | For_statement (p1, p2, p3, st) -> For_statement (p1, p2, p3, b st) | ForIn_statement (param, e, st) -> ForIn_statement (param, e, b st) | Switch_statement (e, l, Some [], []) -> Switch_statement (e, l, None, []) | s -> s method sources l = let append_st st_rev sources_rev = let st = m#statements (List.rev st_rev) in let st = List.map st ~f:(fun (s, loc) -> Statement s, loc) in List.rev_append st sources_rev in let st_rev, sources_rev = List.fold_left l ~init:([], []) ~f:(fun (st_rev, sources_rev) (x, loc) -> match x with | Statement s -> (s, loc) :: st_rev, sources_rev | Function_declaration _ as x when List.is_empty st_rev -> [], (m#source x, loc) :: sources_rev | Function_declaration _ as x -> [], (m#source x, loc) :: append_st st_rev sources_rev) in let sources_rev = match st_rev with | [] -> sources_rev | st_rev -> append_st st_rev sources_rev in List.rev sources_rev end let translate_assign_op = function | Div -> SlashEq | Mod -> ModEq | Lsl -> LslEq | Asr -> AsrEq | Lsr -> LsrEq | Band -> BandEq | Bor -> BorEq | Bxor -> BxorEq | Mul -> StarEq | Plus -> PlusEq | Minus -> MinusEq | _ -> assert false let is_one = function | ENum n -> Num.is_one n | _ -> false let assign_op = function | exp, EBin (Plus, exp', exp'') -> ( match Poly.(exp = exp'), Poly.(exp = exp'') with | false, false -> None | true, false -> if is_one exp'' then Some (EUn (IncrB, exp)) else Some (EBin (PlusEq, exp, exp'')) | false, true -> if is_one exp' then Some (EUn (IncrB, exp)) else Some (EBin (PlusEq, exp, exp')) | true, true -> Some (EBin (StarEq, exp, ENum (Num.of_int32 2l)))) | exp, EBin (Minus, exp', y) when Poly.(exp = exp') -> if is_one y then Some (EUn (DecrB, exp)) else Some (EBin (MinusEq, exp, y)) | exp, EBin (Mul, exp', exp'') -> ( match Poly.(exp = exp'), Poly.(exp = exp'') with | false, false -> None | true, _ -> Some (EBin (StarEq, exp, exp'')) | _, true -> Some (EBin (StarEq, exp, exp'))) | exp, EBin (((Div | Mod | Lsl | Asr | Lsr | Band | Bxor | Bor) as unop), exp', y) when Poly.(exp = exp') -> Some (EBin (translate_assign_op unop, exp, y)) | _ -> None class simpl = object (m) inherit map as super method expression e = let e = super#expression e in let is_zero x = match Num.to_string x with | "0" | "0." -> true | _ -> false in match e with | EBin (Plus, e1, e2) -> ( match e2, e1 with | ENum n, _ when Num.is_neg n -> EBin (Minus, e1, ENum (Num.neg n)) | _, ENum n when Num.is_neg n -> EBin (Minus, e2, ENum (Num.neg n)) | ENum zero, (ENum _ as x) when is_zero zero -> x | (ENum _ as x), ENum zero when is_zero zero -> x | _ -> e) | EBin (Minus, e1, e2) -> ( match e2, e1 with | ENum n, _ when Num.is_neg n -> EBin (Plus, e1, ENum (Num.neg n)) | (ENum _ as x), ENum zero when is_zero zero -> x | _ -> e) | _ -> e method statement s = let s = super#statement s in match s with | Block [ x ] -> fst x | _ -> s method statements s = let s = super#statements s in List.fold_right s ~init:[] ~f:(fun (st, loc) rem -> match st with | If_statement (cond, (Return_statement (Some e1), _), Some (Return_statement (Some e2), _)) -> (Return_statement (Some (ECond (cond, e1, e2))), loc) :: rem | If_statement ( cond , (Expression_statement (EBin (Eq, v1, e1)), _) , Some (Expression_statement (EBin (Eq, v2, e2)), _) ) when Poly.(v1 = v2) -> (Expression_statement (EBin (Eq, v1, ECond (cond, e1, e2))), loc) :: rem | Variable_statement l1 -> let x = List.map l1 ~f:(function | ident, None -> Variable_statement [ ident, None ], loc | ident, Some (exp, pc) -> ( match assign_op (EVar ident, exp) with | Some e -> Expression_statement e, loc | None -> Variable_statement [ ident, Some (exp, pc) ], loc)) in x @ rem | _ -> (st, loc) :: rem) method sources l = let append_st st_rev sources_rev = let st = m#statements (List.rev st_rev) in let st = List.map st ~f:(function | ( Variable_statement [ (addr, Some (EFun (None, params, body, loc'), loc)) ] , _ ) -> Function_declaration (addr, params, body, loc'), loc | s, loc -> Statement s, loc) in List.rev_append st sources_rev in let st_rev, sources_rev = List.fold_left l ~init:([], []) ~f:(fun (st_rev, sources_rev) x -> match x with | Statement s, loc -> (s, loc) :: st_rev, sources_rev | (Function_declaration _ as x), loc when List.is_empty st_rev -> [], (m#source x, loc) :: sources_rev | (Function_declaration _ as x), loc -> [], (m#source x, loc) :: append_st st_rev sources_rev) in let sources_rev = match st_rev with | [] -> sources_rev | st_rev -> append_st st_rev sources_rev in List.rev sources_rev end js_of_ocaml-3.5.2/compiler/lib/js_traverse.mli000066400000000000000000000052261357507750000214240ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Stdlib open Javascript class type mapper = object method expression : expression -> expression method expression_o : expression option -> expression option method switch_case : expression -> expression method initialiser : expression * location -> expression * location method initialiser_o : (expression * location) option -> (expression * location) option method variable_declaration : Javascript.variable_declaration -> Javascript.variable_declaration method statement : statement -> statement method statements : statement_list -> statement_list method statement_o : (statement * location) option -> (statement * location) option method source : source_element -> source_element method sources : source_elements -> source_elements method ident : ident -> ident method program : program -> program end class map : mapper class subst : (ident -> ident) -> object inherit mapper end type t = { use_name : StringSet.t ; def_name : StringSet.t ; def : Code.Var.Set.t ; use : Code.Var.Set.t ; count : int IdentMap.t } class type freevar = object ('a) inherit mapper method merge_info : 'a -> unit method block : ?catch:bool -> ident list -> unit method def_var : ident -> unit method use_var : ident -> unit method state : t method get_free_name : StringSet.t method get_free : Code.Var.Set.t method get_def_name : StringSet.t method get_def : Code.Var.Set.t method get_use_name : StringSet.t method get_use : Code.Var.Set.t end class free : freevar class rename_variable : StringSet.t -> freevar class share_constant : mapper class compact_vardecl : object ('a) inherit free method exc : IdentSet.t end class clean : mapper class simpl : mapper js_of_ocaml-3.5.2/compiler/lib/link_js.ml000066400000000000000000000063561357507750000203620ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let sourceMappingURL = "//# sourceMappingURL=" let sourceMappingURL_base64 = "//# sourceMappingURL=data:application/json;base64," let kind ~resolve_sourcemap_url file line = let s = match String.drop_prefix ~prefix:sourceMappingURL_base64 line with | Some base64 -> `Json_base64 base64 | None -> ( match String.drop_prefix ~prefix:sourceMappingURL line with | Some url -> `Url url | None -> `Other) in match s with | `Other -> `Other | `Json_base64 base64 -> `Source_map (Source_map_io.of_string (Base64.decode_exn base64)) | `Url _ when not resolve_sourcemap_url -> `Drop | `Url url -> let base = Filename.dirname file in let ic = open_in (Filename.concat base url) in let l = in_channel_length ic in let content = really_input_string ic l in close_in ic; `Source_map (Source_map_io.of_string content) let link ~output ~files ~resolve_sourcemap_url ~source_map = let sm = ref [] in let line_offset = ref 0 in let new_line () = output_string output "\n"; incr line_offset in let source_offset = ref 0 in List.iter ~f:(fun file -> let ic = open_in file in (try output_string output (Printf.sprintf "//# 1 %S" file); new_line (); let start_line = !line_offset in while true do let line = input_line ic in match kind ~resolve_sourcemap_url file line, source_map with | `Other, _ -> output_string output line; new_line () | `Drop, _ -> () | `Source_map _, None -> () | `Source_map x, Some _ -> source_offset := List.length x.Source_map.sources; sm := (start_line, file, x) :: !sm done with End_of_file -> ()); close_in ic; new_line ()) files; match source_map with | None -> () | Some (file, init_sm) -> ( match Source_map.merge ((0, "", init_sm) :: List.rev !sm) with | None -> () | Some sm -> ( match file with | None -> let data = Source_map_io.to_string sm in let s = sourceMappingURL_base64 ^ Base64.encode_exn data in output_string output s | Some file -> Source_map_io.to_file sm file; let s = sourceMappingURL ^ Filename.basename file in output_string output s)) js_of_ocaml-3.5.2/compiler/lib/link_js.mli000066400000000000000000000017751357507750000205330ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val link : output:out_channel -> files:string list -> resolve_sourcemap_url:bool -> source_map:(string option * Source_map.t) option -> unit js_of_ocaml-3.5.2/compiler/lib/linker.ml000066400000000000000000000341471357507750000202140ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type fragment = { provides : (Parse_info.t option * string * Primitive.kind * Primitive.kind_arg list option) option ; requires : string list ; version_constraint : ((int -> int -> bool) * string) list list ; weakdef : bool ; code : Javascript.program } let loc pi = match pi with | Some { Parse_info.src = Some src; line; _ } | Some { Parse_info.name = Some src; line; _ } -> Printf.sprintf "%s:%d" src line | None | Some _ -> "unknown location" let parse_annot loc s = let buf = Lexing.from_string s in try match Annot_parser.annot Annot_lexer.initial buf with | `Requires (_, l) -> Some (`Requires (Some loc, l)) | `Provides (_, n, k, ka) -> Some (`Provides (Some loc, n, k, ka)) | `Version (_, l) -> Some (`Version (Some loc, l)) | `Weakdef _ -> Some (`Weakdef (Some loc)) with | Not_found -> None | _exc -> (* Format.eprintf "Not found for %s : %s @." (Printexc.to_string exc) s; *) None let error s = Format.ksprintf (fun s -> failwith s) s let is_file_directive cmt = let lexbuf = Lexing.from_string cmt in try let _file, _line = Js_lexer.pos lexbuf in true with _ -> false let parse_from_lex ~filename lex = let status, lexs = Parse_js.lexer_fold (fun (status, lexs) t -> match t with | Js_token.TComment (_info, str) when is_file_directive str -> ( match status with | `Annot _ -> `Annot [], lexs | `Code (an, co) -> `Annot [], (List.rev an, List.rev co) :: lexs) | Js_token.TComment (info, str) -> ( match parse_annot info str with | None -> status, lexs | Some a -> ( match status with | `Annot annot -> `Annot (a :: annot), lexs | `Code (an, co) -> `Annot [ a ], (List.rev an, List.rev co) :: lexs)) | _ when Js_token.is_comment t -> status, lexs | Js_token.TUnknown (info, _) -> Format.eprintf "Unknown token while parsing JavaScript at %s@." (loc (Some info)); if not (Filename.check_suffix filename ".js") then Format.eprintf "%S doesn't look like a JavaScript file@." filename; failwith "Error while parsing JavaScript" | c -> ( match status with | `Code (annot, code) -> `Code (annot, c :: code), lexs | `Annot annot -> `Code (annot, [ c ]), lexs)) (`Annot [], []) lex in let lexs = match status with | `Annot _ -> lexs | `Code (annot, code) -> (List.rev annot, List.rev code) :: lexs in let res = List.rev_map lexs ~f:(fun (annot, code) -> let lex = Parse_js.lexer_from_list code in try let code = Parse_js.parse lex in let fragment = { provides = None ; requires = [] ; version_constraint = [] ; weakdef = false ; code } in List.fold_left annot ~init:fragment ~f:(fun fragment a -> match a with | `Provides (pi, name, kind, ka) -> { fragment with provides = Some (pi, name, kind, ka) } | `Requires (_, mn) -> { fragment with requires = mn @ fragment.requires } | `Version (_, l) -> { fragment with version_constraint = l :: fragment.version_constraint } | `Weakdef _ -> { fragment with weakdef = true }) with Parse_js.Parsing_error pi -> let name = match pi with | { Parse_info.src = Some x; _ } | { Parse_info.name = Some x; _ } -> x | _ -> "??" in error "cannot parse file %S (orig:%S from l:%d, c:%d)@." filename name pi.Parse_info.line pi.Parse_info.col) in res let parse_string string = let lex = Parse_js.lexer_from_string ~rm_comment:false string in parse_from_lex ~filename:"" lex let parse_file f = let file = try match Findlib.path_require_findlib f with | Some f -> let pkg, f' = match String.split ~sep:Filename.dir_sep f with | [] -> assert false | [ f ] -> "js_of_ocaml-compiler", f | pkg :: l -> pkg, List.fold_left l ~init:"" ~f:Filename.concat in Fs.absolute_path (Filename.concat (Findlib.find_pkg_dir pkg) f') | None -> Fs.absolute_path f with | Not_found -> error "cannot find file '%s'. @." f | Sys_error s -> error "%s@." s in let lex = Parse_js.lexer_from_file ~rm_comment:false file in parse_from_lex ~filename:file lex class check_and_warn name pi = object inherit Js_traverse.free as super method merge_info from = let def = from#get_def_name in let use = from#get_use_name in let diff = StringSet.diff def use in let diff = StringSet.remove name diff in let diff = StringSet.filter (fun s -> not (String.is_prefix s ~prefix:"_")) diff in if not (StringSet.is_empty diff) then warn "WARN unused for primitive %s at %s:@. %s@." name (loc pi) (String.concat ~sep:", " (StringSet.elements diff)); super#merge_info from end (* exception May_not_return let all_return p = let open Javascript in let rec loop_st = function | [] -> raise May_not_return | [Return_statement (Some _), _] -> () | [Return_statement None, _] -> raise May_not_return | [If_statement(_,th,el), _] -> loop_st [th]; (match el with | None -> raise May_not_return | Some x -> loop_st [x]) | [Do_while_statement(st,_), _] -> loop_st [st] | [While_statement(_,st), _] -> loop_st [st] | [For_statement (_,_,_,st), _] -> loop_st [st] | [Switch_statement (_,l,def), _] -> List.iter (fun (_,sts) -> loop_st sts) l | [Try_statement(b,_,_),_] -> loop_st b | [Throw_statement _, _] -> () | x::xs -> loop_st xs in let rec loop_sources = function | [] -> raise May_not_return | [(Statement x, loc)] -> loop_st [(x, loc)] | [_] -> raise May_not_return | x::xs -> loop_sources xs in let rec loop_all_sources = function | [] -> () | Statement x :: xs -> loop_all_sources xs | Function_declaration(_,_,b,_) :: xs -> loop_sources b; loop_all_sources xs in try loop_all_sources p; true with May_not_return -> false *) let check_primitive ~name pi ~code ~requires = let free = if Config.Flag.warn_unused () then new check_and_warn name pi else new Js_traverse.free in let _code = free#program code in let freename = free#get_free_name in let freename = List.fold_left requires ~init:freename ~f:(fun freename x -> StringSet.remove x freename) in let freename = StringSet.diff freename Reserved.keyword in let freename = StringSet.diff freename Reserved.provided in let freename = StringSet.remove Constant.global_object freename in if not (StringSet.mem name free#get_def_name) then warn "warning: primitive code does not define value with the expected name: %s (%s)@." name (loc pi); if not (StringSet.is_empty freename) then ( warn "warning: free variables in primitive code %S (%s)@." name (loc pi); warn "vars: %s@." (String.concat ~sep:", " (StringSet.elements freename))) (* ; *) (* return checks disabled *) (* if false && not (all_return code) *) (* then Format.eprintf "warning: returns may be missing for primitive code %S (%s)@." name (loc pi) *) let version_match = List.for_all ~f:(fun (op, str) -> op Ocaml_version.(compare current (split str)) 0) type always_required = { filename : string ; program : Javascript.program } type state = { ids : IntSet.t ; always_required_codes : always_required list ; codes : Javascript.program list } type output = { runtime_code : Javascript.program ; always_required_codes : always_required list } let last_code_id = ref 0 let provided = Hashtbl.create 31 let provided_rev = Hashtbl.create 31 let code_pieces = Hashtbl.create 31 let always_included = ref [] class traverse_and_find_named_values all = object inherit Js_traverse.map as self method expression x = let open Javascript in (match x with | ECall (EVar (S { name = "caml_named_value"; _ }), [ EStr (v, _) ], _) -> all := StringSet.add v !all | _ -> ()); self#expression x end let find_named_value code = let all = ref StringSet.empty in let p = new traverse_and_find_named_values all in ignore (p#program code); !all let load_fragment ~filename { provides; requires; version_constraint; weakdef; code } = let vmatch = match version_constraint with | [] -> true | l -> List.exists l ~f:version_match in if vmatch then ( incr last_code_id; let id = !last_code_id in match provides with | None -> always_included := { filename; program = code } :: !always_included | Some (pi, name, kind, ka) -> let code = Macro.f code in let module J = Javascript in let rec find = function | [] -> None | (J.Function_declaration (J.S { J.name = n; _ }, l, _, _), _) :: _ when String.equal name n -> Some (List.length l) | _ :: rem -> find rem in let arity = find code in let named_values = find_named_value code in Primitive.register name kind ka arity; StringSet.iter Primitive.register_named_value named_values; (if Hashtbl.mem provided name then let _, ploc, weakdef = Hashtbl.find provided name in if not weakdef then warn "warning: overriding primitive %S\n old: %s\n new: %s@." name (loc ploc) (loc pi)); Hashtbl.add provided name (id, pi, weakdef); Hashtbl.add provided_rev id (name, pi); check_primitive ~name pi ~code ~requires; Hashtbl.add code_pieces id (code, requires)) let add_file filename = List.iter (parse_file filename) ~f:(load_fragment ~filename) let get_provided () = Hashtbl.fold (fun k _ acc -> StringSet.add k acc) provided StringSet.empty let check_deps () = let provided = get_provided () in Hashtbl.iter (fun id (code, requires) -> let traverse = new Js_traverse.free in let _js = traverse#program code in let free = traverse#get_free_name in let requires = List.fold_right requires ~init:StringSet.empty ~f:StringSet.add in let real = StringSet.inter free provided in let missing = StringSet.diff real requires in if not (StringSet.is_empty missing) then try let name, ploc = Hashtbl.find provided_rev id in warn "code providing %s (%s) may miss dependencies: %s\n" name (loc ploc) (String.concat ~sep:", " (StringSet.elements missing)) with Not_found -> (* there is no //Provides for this piece of code *) (* FIXME handle missing deps in this case *) ()) code_pieces let load_files l = List.iter l ~f:add_file; check_deps () (* resolve *) let rec resolve_dep_name_rev visited path nm = let id = try let x, _, _ = Hashtbl.find provided nm in x with Not_found -> error "missing dependency '%s'@." nm in resolve_dep_id_rev visited path id and resolve_dep_id_rev visited path id = if IntSet.mem id visited.ids then ( if List.memq id ~set:path then error "circular dependency: %s" (String.concat ~sep:", " (List.map path ~f:(fun id -> fst (Hashtbl.find provided_rev id)))); visited) else let path = id :: path in let code, req = Hashtbl.find code_pieces id in let visited = { visited with ids = IntSet.add id visited.ids } in let visited = List.fold_left req ~init:visited ~f:(fun visited nm -> resolve_dep_name_rev visited path nm) in let visited = { visited with codes = code :: visited.codes } in visited let init () = { ids = IntSet.empty; always_required_codes = List.rev !always_included; codes = [] } let resolve_deps ?(linkall = false) visited_rev used = (* link the special files *) let missing, visited_rev = if linkall then (* link all primitives *) let prog, set = Hashtbl.fold (fun nm (_id, _, _) (visited, set) -> resolve_dep_name_rev visited [] nm, StringSet.add nm set) provided (visited_rev, StringSet.empty) in let missing = StringSet.diff used set in missing, prog else (* link used primitives *) StringSet.fold (fun nm (missing, visited) -> if Hashtbl.mem provided nm then missing, resolve_dep_name_rev visited [] nm else StringSet.add nm missing, visited) used (StringSet.empty, visited_rev) in visited_rev, missing let link program state = let runtime = List.flatten (List.rev (program :: state.codes)) in let always_required = state.always_required_codes in { runtime_code = runtime; always_required_codes = always_required } let all state = IntSet.fold (fun id acc -> try let name, _ = Hashtbl.find provided_rev id in name :: acc with Not_found -> acc) state.ids [] js_of_ocaml-3.5.2/compiler/lib/linker.mli000066400000000000000000000034421357507750000203570ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Stdlib type fragment = { provides : (Parse_info.t option * string * Primitive.kind * Primitive.kind_arg list option) option ; requires : string list ; version_constraint : ((int -> int -> bool) * string) list list ; weakdef : bool ; code : Javascript.program } val parse_file : string -> fragment list val parse_string : string -> fragment list val load_files : string list -> unit val load_fragment : filename:string -> fragment -> unit type state type always_required = { filename : string ; program : Javascript.program } type output = { runtime_code : Javascript.program ; always_required_codes : always_required list } val init : unit -> state val resolve_deps : ?linkall:bool -> state -> StringSet.t -> state * StringSet.t val link : Javascript.program -> state -> output val get_provided : unit -> StringSet.t val all : state -> string list js_of_ocaml-3.5.2/compiler/lib/macro.ml000066400000000000000000000041331357507750000200210ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby, Jane Street Group LLC * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib class macro_mapper = object (m) inherit Js_traverse.map as super method expression x = let module J = Javascript in match x with | J.ECall (J.EVar (J.S { name; _ }), args, _) -> ( match name, args with | "BLOCK", J.ENum tag :: (_ :: _ as args) -> let tag = Int32.to_int (J.Num.to_int32 tag) in let args = List.map args ~f:m#expression in Mlvalue.Block.make ~tag ~args | "TAG", [ e ] -> Mlvalue.Block.tag (m#expression e) | "LENGTH", [ e ] -> Mlvalue.Array.length (m#expression e) | "FIELD", [ e; J.ENum n ] -> let idx = Int32.to_int (J.Num.to_int32 n) in Mlvalue.Block.field (m#expression e) idx | "FIELD", [ _; J.EUn (J.Neg, _) ] -> failwith "Negative field indexes are not allowed" | "ISBLOCK", [ e ] -> Mlvalue.is_block (m#expression e) | ("BLOCK" | "TAG" | "LENGTH" | "FIELD" | "ISBLOCK"), _ -> failwith (Format.sprintf "macro %s called with inappropriate arguments" name) | _ -> super#expression x) | _ -> super#expression x end let f js = let trav = new macro_mapper in trav#program js js_of_ocaml-3.5.2/compiler/lib/macro.mli000066400000000000000000000016501357507750000201730ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby, Jane Street Group LLC * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Javascript.program -> Javascript.program js_of_ocaml-3.5.2/compiler/lib/magic_number.ml000066400000000000000000000050531357507750000213520ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type t = string * int exception Bad_magic_number of string exception Bad_magic_version of t let size = 12 let kind_of_string = function | "Caml1999X" -> "exe" | "Caml1999I" -> "cmi" | "Caml1999O" -> "cmo" | "Caml1999A" -> "cma" | "Caml1999Y" -> "cmx" | "Caml1999Z" -> "cmxa" | "Caml2007D" -> "cmxs" | "Caml2012T" -> "cmt" | "Caml1999M" -> "impl" | "Caml1999N" -> "intf" | _ -> raise Not_found let of_string s = try if String.length s <> size then raise Not_found; let kind = String.sub s ~pos:0 ~len:9 in let v = String.sub s ~pos:9 ~len:3 in let _ = kind_of_string kind in kind, int_of_string v with _ -> raise (Bad_magic_number s) let kind (s, _) = match kind_of_string s with | "exe" -> `Exe | "cmo" -> `Cmo | "cma" -> `Cma | other -> `Other other let to_string (k, v) = Printf.sprintf "%s%03d" k v let compare (p1, n1) (p2, n2) = if not (String.equal p1 p2) then raise Not_found; compare n1 n2 let equal a b = compare a b = 0 let current_exe = let v = match Ocaml_version.v with | `V4_02 | `V4_03 | `V4_04 -> 11 | `V4_06 -> 11 | `V4_07 -> 23 | `V4_08 -> 25 | `V4_09 -> 26 | `V4_10 -> 27 in "Caml1999X", v let current_cmo = let v = match Ocaml_version.v with | `V4_02 -> 10 | `V4_03 | `V4_04 -> 11 | `V4_06 -> 22 | `V4_07 -> 23 | `V4_08 -> 25 | `V4_09 -> 26 | `V4_10 -> 27 in "Caml1999O", v let current_cma = let v = match Ocaml_version.v with | `V4_02 -> 11 | `V4_03 | `V4_04 -> 12 | `V4_06 -> 22 | `V4_07 -> 23 | `V4_08 -> 25 | `V4_09 -> 26 | `V4_10 -> 27 in "Caml1999A", v let current = function | `Exe -> current_exe | `Cmo -> current_cmo | `Cma -> current_cma js_of_ocaml-3.5.2/compiler/lib/magic_number.mli000066400000000000000000000023161357507750000215220ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type t = private string * int exception Bad_magic_number of string exception Bad_magic_version of t val size : int val compare : t -> t -> int val equal : t -> t -> bool val of_string : string -> t val to_string : t -> string val kind : t -> [ `Cmo | `Cma | `Exe | `Other of string ] val current_exe : t val current_cmo : t val current_cma : t val current : [ `Cmo | `Cma | `Exe ] -> t js_of_ocaml-3.5.2/compiler/lib/mlvalue.ml000066400000000000000000000041221357507750000203630ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib module J = Javascript let zero = J.ENum (J.Num.of_int32 0l) let one = J.ENum (J.Num.of_int32 1l) (* JavaScript engines recognize the pattern 'typeof x==="number"'; if the string is shared, less efficient code is generated. *) let type_of_is_number binop e = J.EBin (binop, J.EUn (J.Typeof, e), J.EStr ("number", `Bytes)) let is_block e = type_of_is_number J.NotEqEq e let is_immediate e = type_of_is_number J.EqEqEq e module Block = struct let make ~tag ~args = J.EArr (List.map ~f:(fun x -> Some x) (J.ENum (J.Num.of_int32 (Int32.of_int tag)) :: args)) let tag e = J.EAccess (e, zero) let field e idx = let adjusted = J.ENum (J.Num.of_int32 (Int32.of_int (idx + 1))) in J.EAccess (e, adjusted) end module Array = struct let make = Block.make let length e = let underlying = J.EDot (e, "length") in J.EBin (J.Minus, underlying, one) let field e i = match i with | J.ENum n -> let idx = J.Num.to_int32 n in let adjusted = J.ENum (J.Num.of_int32 (Int32.add idx 1l)) in J.EAccess (e, adjusted) | J.EUn (J.Neg, _) -> failwith "Negative field indexes are not allowed" | _ -> let adjusted = J.EBin (J.Plus, one, i) in J.EAccess (e, adjusted) end js_of_ocaml-3.5.2/compiler/lib/mlvalue.mli000066400000000000000000000027151357507750000205420ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Block : sig val make : tag:int -> args:Javascript.expression list -> Javascript.expression val tag : Javascript.expression -> Javascript.expression val field : Javascript.expression -> int -> Javascript.expression end module Array : sig val make : tag:int -> args:Javascript.expression list -> Javascript.expression val length : Javascript.expression -> Javascript.expression val field : Javascript.expression -> Javascript.expression -> Javascript.expression end val is_block : Javascript.expression -> Javascript.expression val is_immediate : Javascript.expression -> Javascript.expression js_of_ocaml-3.5.2/compiler/lib/ocaml_compiler.ml000066400000000000000000000176761357507750000217250ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let rec constant_of_const : _ -> Code.constant = let open Lambda in let open Asttypes in function | Const_base (Const_int i) -> Int (Int32.of_int i) | Const_base (Const_char c) -> Int (Int32.of_int (Char.code c)) | Const_base (Const_string (s, _)) -> String s | Const_base (Const_float s) -> Float (float_of_string s) | Const_base (Const_int32 i) -> Int i | Const_base (Const_int64 i) -> Int64 i | Const_base (Const_nativeint i) -> Int (Nativeint.to_int32 i) | Const_immstring s -> String s | Const_float_array sl -> let l = List.map ~f:(fun f -> Code.Float (float_of_string f)) sl in Tuple (Obj.double_array_tag, Array.of_list l, Unknown) (* For bucklescript, - uncomment the two branches below - and comment out the two last ones {[ | Const_pointer (i,_) -> Int (Int32.of_int i) | Const_block (tag,_,l) -> let l = Array.of_list (List.map l ~f:constant_of_const) in Tuple (tag, l, Unknown) ]} *) | Const_pointer i -> Int (Int32.of_int i) | Const_block (tag, l) -> let l = Array.of_list (List.map l ~f:constant_of_const) in Tuple (tag, l, Unknown) let rec find_loc_in_summary ident' = function | Env.Env_empty -> None | Env.Env_value (_summary, ident, description) when Poly.(ident = ident') -> Some description.Types.val_loc | Env.Env_value (summary,_,_) | Env.Env_type (summary, _, _) | Env.Env_extension (summary, _, _) | (Env.Env_module (summary, _, _,_) [@if ocaml_version >= (4,8,0)]) | (Env.Env_module (summary, _, _) [@if ocaml_version < (4,8,0)]) | Env.Env_modtype (summary, _, _) | Env.Env_class (summary, _, _) | Env.Env_cltype (summary, _, _) | (Env.Env_open (summary, _) [@if ocaml_version >= (4,8,0)]) | (Env.Env_open (summary, _, _) [@if ocaml_version < (4,8,0)] [@if ocaml_version >= (4,7,0)]) | (Env.Env_open (summary, _) [@if ocaml_version < (4,7,0)]) | Env.Env_functor_arg (summary, _) | (Env.Env_constraints (summary, _) [@if ocaml_version >= (4,4,0)]) | (Env.Env_copy_types (summary, _) [@if ocaml_version >= (4,6,0)] [@if ocaml_version < (4,10,0)]) | (Env.Env_copy_types (summary) [@if ocaml_version >= (4,10,0)]) | (Env.Env_persistent (summary, _) [@if ocaml_version >= (4,8,0)]) | (Env.Env_value_unbound (summary, _, _) [@if ocaml_version >= (4,10,0)]) | (Env.Env_module_unbound (summary, _, _) [@if ocaml_version >= (4,10,0)]) -> find_loc_in_summary ident' summary [@@ocamlformat "disable"] (* Copied from ocaml/utils/tbl.ml *) module Tbl = struct open Poly type ('a, 'b) t = | Empty | Node of ('a, 'b) t * 'a * 'b * ('a, 'b) t * int let empty = Empty let height = function | Empty -> 0 | Node (_, _, _, _, h) -> h let create l x d r = let hl = height l and hr = height r in Node (l, x, d, r, if hl >= hr then hl + 1 else hr + 1) let bal l x d r = let hl = height l and hr = height r in if hl > hr + 1 then match l with | Node (ll, lv, ld, lr, _) when height ll >= height lr -> create ll lv ld (create lr x d r) | Node (ll, lv, ld, Node (lrl, lrv, lrd, lrr, _), _) -> create (create ll lv ld lrl) lrv lrd (create lrr x d r) | _ -> assert false else if hr > hl + 1 then match r with | Node (rl, rv, rd, rr, _) when height rr >= height rl -> create (create l x d rl) rv rd rr | Node (Node (rll, rlv, rld, rlr, _), rv, rd, rr, _) -> create (create l x d rll) rlv rld (create rlr rv rd rr) | _ -> assert false else create l x d r let rec add x data = function | Empty -> Node (Empty, x, data, Empty, 1) | Node (l, v, d, r, h) -> let c = compare x v in if c = 0 then Node (l, x, data, r, h) else if c < 0 then bal (add x data l) v d r else bal l v d (add x data r) let rec iter f = function | Empty -> () | Node (l, v, d, r, _) -> iter f l; f v d; iter f r let rec find compare x = function | Empty -> raise Not_found | Node (l, v, d, r, _) -> let c = compare x v in if c = 0 then d else find compare x (if c < 0 then l else r) let rec fold f m accu = match m with | Empty -> accu | Node (l, v, d, r, _) -> fold f r (f v d (fold f l accu)) end [@@if ocaml_version < (4, 8, 0)] module Symtable = struct type 'a numtable = { num_cnt : int ; num_tbl : ('a, int) Tbl.t } module GlobalMap = struct type t = Ident.t numtable let filter_global_map (p : Ident.t -> bool) gmap = let newtbl = ref Tbl.empty in Tbl.iter (fun id num -> if p id then newtbl := Tbl.add id num !newtbl) gmap.num_tbl; { num_cnt = gmap.num_cnt; num_tbl = !newtbl } let find nn t = Tbl.find (fun x1 x2 -> String.compare (Ident.name x1) (Ident.name x2)) nn t.num_tbl let iter nn t = Tbl.iter nn t.num_tbl let fold f t acc = Tbl.fold f t.num_tbl acc end let reloc_ident name = let buf = Bytes.create 4 in Symtable.patch_object buf [ Reloc_setglobal (Ident.create_persistent name), 0 ]; let get i = Char.code (Bytes.get buf i) in get 0 + (get 1 lsl 8) + (get 2 lsl 16) + (get 3 lsl 24) end [@@if ocaml_version < (4, 8, 0)] module Symtable = struct (* Copied from ocaml/bytecomp/symtable.ml *) module Num_tbl (M : Map.S) = struct [@@@ocaml.warning "-32"] type t = { cnt : int ; (* The next number *) tbl : int M.t (* The table of already numbered objects *) } let empty = { cnt = 0; tbl = M.empty } let find key nt = M.find key nt.tbl let iter f nt = M.iter f nt.tbl let fold f nt a = M.fold f nt.tbl a let enter nt key = let n = !nt.cnt in nt := { cnt = n + 1; tbl = M.add key n !nt.tbl }; n let incr nt = let n = !nt.cnt in nt := { cnt = n + 1; tbl = !nt.tbl }; n end module GlobalMap = struct module GlobalMap = Num_tbl (Ident.Map) include GlobalMap let filter_global_map (p : Ident.t -> bool) (gmap : t) = let newtbl = ref Ident.Map.empty in Ident.Map.iter (fun id num -> if p id then newtbl := Ident.Map.add id num !newtbl) gmap.tbl; { cnt = gmap.cnt; tbl = !newtbl } end let reloc_ident name = let buf = Bytes.create 4 in Symtable.patch_object [| buf |] [ Reloc_setglobal (Ident.create_persistent name), 0 ]; let get i = Char.code (Bytes.get buf i) in get 0 + (get 1 lsl 8) + (get 2 lsl 16) + (get 3 lsl 24) end [@@if ocaml_version >= (4, 8, 0)] module Ident = struct (* Copied from ocaml/typing/ident.ml *) type 'a tbl' = | Empty | Node of 'a tbl' * 'a data * 'a tbl' * int and 'a data = { ident : Ident.t ; data : 'a ; previous : 'a data option } type 'a tbl = 'a Ident.tbl let rec table_contents_rec sz t rem = match t with | Empty -> rem | Node (l, v, r, _) -> table_contents_rec sz l ((sz - v.data, Ident.name v.ident, v.ident) :: table_contents_rec sz r rem) let table_contents sz (t : 'a tbl) = List.sort ~cmp:(fun (i, _, _) (j, _, _) -> compare i j) (table_contents_rec sz (Obj.magic (t : 'a tbl) : 'a tbl') []) end js_of_ocaml-3.5.2/compiler/lib/ocaml_compiler.mli000066400000000000000000000026071357507750000220620ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val constant_of_const : Lambda.structured_constant -> Code.constant val find_loc_in_summary : Ident.t -> Env.summary -> Location.t option module Symtable : sig module GlobalMap : sig type t val filter_global_map : (Ident.t -> bool) -> t -> t val find : Ident.t -> t -> int val iter : (Ident.t -> int -> unit) -> t -> unit val fold : (Ident.t -> int -> 'a -> 'a) -> t -> 'a -> 'a end val reloc_ident : string -> int end module Ident : sig type 'a tbl = 'a Ident.tbl val table_contents : int -> int Ident.tbl -> (int * string * Ident.t) list end js_of_ocaml-3.5.2/compiler/lib/ocaml_version.ml000066400000000000000000000033041357507750000215570ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type t = int list let split v = match String.split_char ~sep:'+' v with | [] -> assert false | x :: _ -> List.map (String.split_char ~sep:'.' x) ~f:int_of_string let current = split Sys.ocaml_version let compint (a : int) b = compare a b let rec compare v v' = match v, v' with | [ x ], [ y ] -> compint x y | [], [] -> 0 | [], y :: _ -> compint 0 y | x :: _, [] -> compint x 0 | x :: xs, y :: ys -> ( match compint x y with | 0 -> compare xs ys | n -> n) let v = if compare current [ 4; 3 ] < 0 then `V4_02 else if compare current [ 4; 4 ] < 0 then `V4_03 else if compare current [ 4; 6 ] < 0 then `V4_04 else if compare current [ 4; 7 ] < 0 then `V4_06 else if compare current [ 4; 8 ] < 0 then `V4_07 else if compare current [ 4; 9 ] < 0 then `V4_08 else if compare current [ 4; 10 ] < 0 then `V4_09 else `V4_10 js_of_ocaml-3.5.2/compiler/lib/ocaml_version.mli000066400000000000000000000022231357507750000217270ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type t = int list val current : t val compare : t -> t -> int val split : string -> t val v : [ `V4_02 (* OCaml 4.02 *) | `V4_03 (* OCaml 4.03 *) | `V4_04 (* OCaml 4.04 / OCaml 4.05 *) | `V4_06 (* OCaml 4.06 *) | `V4_07 (* OCaml 4.07 *) | `V4_08 (* OCaml 4.08 *) | `V4_09 (* OCaml 4.09 *) | `V4_10 (* OCaml 4.10 *) ] js_of_ocaml-3.5.2/compiler/lib/parse_bytecode.ml000066400000000000000000002551231357507750000217170ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Code open Instr let debug_parser = Debug.find "parser" let debug_sourcemap = Debug.find "sourcemap" type bytecode = string let predefined_exceptions = [ 0, "Out_of_memory" ; 1, "Sys_error" ; 2, "Failure" ; 3, "Invalid_argument" ; 4, "End_of_file" ; 5, "Division_by_zero" ; 6, "Not_found" ; 7, "Match_failure" ; 8, "Stack_overflow" ; 9, "Sys_blocked_io" ; 10, "Assert_failure" ; 11, "Undefined_recursive_module" ] (* Read and manipulate debug section *) module Debug : sig type t val names : t -> bool val toplevel : t -> bool val enabled : t -> bool val is_empty : t -> bool val dbg_section_needed : t -> bool val propagate : Code.Var.t list -> Code.Var.t list -> unit val find : t -> Code.Addr.t -> (int * string * Ident.t) list * Env.summary val find_loc : t -> ?after:bool -> int -> Parse_info.t option val find_source : t -> string -> string option val mem : t -> Code.Addr.t -> bool val read : t -> crcs:(string * string option) list -> includes:string list -> in_channel -> unit val read_event_list : t -> crcs:(string * string option) list -> includes:string list -> orig:int -> in_channel -> unit val create : toplevel:bool -> bool -> t val fold : t -> (Code.Addr.t -> Instruct.debug_event -> 'a -> 'a) -> 'a -> 'a val paths : t -> units:StringSet.t -> StringSet.t end = struct open Instruct type ml_unit = { module_name : string ; fname : string ; crc : string option ; paths : string list ; source : string option } module String_table = Hashtbl.Make (String) module Int_table = Hashtbl.Make (Int) type t = { events_by_pc : (debug_event * ml_unit) Int_table.t ; units : (string * string, ml_unit) Hashtbl.t ; pos_fname_to_source : string String_table.t ; toplevel : bool ; names : bool ; enabled : bool } let names t = t.names let toplevel t = t.toplevel let enabled t = t.enabled let dbg_section_needed t = t.names || t.toplevel || t.enabled let relocate_event orig ev = ev.ev_pos <- (orig + ev.ev_pos) / 4 let create ~toplevel enabled = let names = enabled || Config.Flag.pretty () in { events_by_pc = Int_table.create 17 ; units = Hashtbl.create 17 ; pos_fname_to_source = String_table.create 17 ; names ; toplevel ; enabled } let is_empty t = Int_table.length t.events_by_pc = 0 let find_ml_in_paths paths name = let uname = String.uncapitalize_ascii name in try Some (Fs.find_in_path paths (uname ^ ".ml")) with Not_found -> ( try Some (Fs.find_in_path paths (name ^ ".ml")) with Not_found -> None) let read_event_list = let read_paths ic : string list = input_value ic in fun { events_by_pc; units; pos_fname_to_source; toplevel = _; names; enabled } ~crcs ~includes ~orig ic -> let crcs = let t = Hashtbl.create 17 in List.iter crcs ~f:(fun (m, crc) -> Hashtbl.add t m crc); t in let evl : debug_event list = input_value ic in let paths = read_paths ic @ includes in List.iter evl ~f:(fun ({ ev_module ; ev_loc = { Location.loc_start = { Lexing.pos_fname; _ }; _ } ; _ } as ev) -> let unit = try Hashtbl.find units (ev_module, pos_fname) with Not_found -> let crc = try Hashtbl.find crcs ev_module with Not_found -> None in let source = try Some (Fs.find_in_path paths pos_fname) with Not_found -> ( try Some (Fs.find_in_path paths (Filename.basename pos_fname)) with Not_found -> find_ml_in_paths paths ev_module) in if debug_sourcemap () then Format.eprintf "module:%s - source:%s - name:%s\n%!" ev_module (match source with | None -> "NONE" | Some x -> x) pos_fname; let u = { module_name = ev_module; fname = pos_fname; crc; source; paths } in (match pos_fname, source with | "_none_", _ | _, None -> () | pos_fname, Some source -> String_table.add pos_fname_to_source pos_fname source); Hashtbl.add units (ev_module, pos_fname) u; u in relocate_event orig ev; if enabled || names then Int_table.add events_by_pc ev.ev_pos (ev, unit); ()) let find_source { pos_fname_to_source; _ } pos_fname = match String_table.find_all pos_fname_to_source pos_fname with | [ x ] -> Some x | [] | _ :: _ :: _ -> None let read t ~crcs ~includes ic = let len = input_binary_int ic in for _i = 0 to len - 1 do let orig = input_binary_int ic in read_event_list t ~crcs ~includes ~orig ic done let find { events_by_pc; _ } pc = try let ev, _ = Int_table.find events_by_pc pc in ( Ocaml_compiler.Ident.table_contents ev.ev_stacksize ev.ev_compenv.ce_stack , ev.ev_typenv ) with Not_found -> [], Env.Env_empty let mem { events_by_pc; _ } = Int_table.mem events_by_pc let find_loc { events_by_pc; _ } ?(after = false) pc = try let before, (ev, unit) = try false, Int_table.find events_by_pc pc with Not_found -> ( ( true , try Int_table.find events_by_pc (pc + 1) with Not_found -> ( try Int_table.find events_by_pc (pc + 2) with Not_found -> Int_table.find events_by_pc (pc + 3)) )) in let loc = ev.ev_loc in if loc.Location.loc_ghost then None else let pos = if after then loc.Location.loc_end else if before then loc.Location.loc_start else match ev.ev_kind with | Event_after _ -> loc.Location.loc_end | _ -> loc.Location.loc_start in let src = unit.source in Some { Parse_info.name = Some pos.Lexing.pos_fname ; src ; line = pos.Lexing.pos_lnum - 1 ; col = pos.Lexing.pos_cnum - pos.Lexing.pos_bol ; idx = 0 ; fol = None } with Not_found -> None let rec propagate l1 l2 = match l1, l2 with | v1 :: r1, v2 :: r2 -> Var.propagate_name v1 v2; propagate r1 r2 | _ -> () let fold t f acc = Int_table.fold (fun k (e, _u) acc -> f k e acc) t.events_by_pc acc let paths t ~units = let paths = Hashtbl.fold (fun _ u acc -> if StringSet.mem u.module_name units then u.paths :: acc else acc) t.units [] in StringSet.of_list (List.concat paths) end (* Block analysis *) (* Detect each block *) module Blocks : sig type t val analyse : Debug.t -> bytecode -> t val add : t -> int -> t type u val finish_analysis : t -> u val next : u -> int -> int val is_empty : u -> bool end = struct type t = Addr.Set.t type u = int array let add blocks pc = Addr.Set.add pc blocks let rec scan debug blocks code pc len = if pc < len then match (get_instr_exn code pc).kind with | KNullary -> scan debug blocks code (pc + 1) len | KUnary -> scan debug blocks code (pc + 2) len | KBinary -> scan debug blocks code (pc + 3) len | KNullaryCall -> let blocks = if Debug.mem debug (pc + 1) then Addr.Set.add pc blocks else blocks in scan debug blocks code (pc + 1) len | KUnaryCall -> let blocks = if Debug.mem debug (pc + 2) then Addr.Set.add pc blocks else blocks in scan debug blocks code (pc + 2) len | KBinaryCall -> let blocks = if Debug.mem debug (pc + 3) then Addr.Set.add pc blocks else blocks in scan debug blocks code (pc + 3) len | KJump -> let offset = gets code (pc + 1) in let blocks = Addr.Set.add (pc + offset + 1) blocks in scan debug blocks code (pc + 2) len | KCond_jump -> let offset = gets code (pc + 1) in let blocks = Addr.Set.add (pc + offset + 1) blocks in scan debug blocks code (pc + 2) len | KCmp_jump -> let offset = gets code (pc + 2) in let blocks = Addr.Set.add (pc + offset + 2) blocks in scan debug blocks code (pc + 3) len | KSwitch -> let sz = getu code (pc + 1) in let blocks = ref blocks in for i = 0 to (sz land 0xffff) + (sz lsr 16) - 1 do let offset = gets code (pc + 2 + i) in blocks := Addr.Set.add (pc + offset + 2) !blocks done; scan debug !blocks code (pc + 2 + (sz land 0xffff) + (sz lsr 16)) len | KClosurerec -> let nfuncs = getu code (pc + 1) in scan debug blocks code (pc + nfuncs + 3) len | KClosure -> scan debug blocks code (pc + 3) len | KStop n -> scan debug blocks code (pc + n + 1) len | K_will_not_happen -> assert false else ( assert (pc = len); blocks) let finish_analysis blocks = Array.of_list (Addr.Set.elements blocks) (* invariant: a.(i) <= x < a.(j) *) let rec find a i j x = assert (i < j); if i + 1 = j then a.(j) else let k = (i + j) / 2 in if a.(k) <= x then find a k j x else find a i k x let next blocks pc = find blocks 0 (Array.length blocks - 1) pc let is_empty x = Array.length x <= 1 let analyse debug_data code = let debug_data = if Debug.enabled debug_data then debug_data else Debug.create ~toplevel:false false in let blocks = Addr.Set.empty in let len = String.length code / 4 in let blocks = add blocks 0 in let blocks = add blocks len in scan debug_data blocks code 0 len end (* Parse constants *) module Constants : sig val parse : Obj.t -> Code.constant val inlined : Code.constant -> bool end = struct let same_custom x y = Obj.field x 0 == Obj.field (Obj.repr y) 0 let warn_overflow i i32 = warn "Warning: integer overflow: integer %s truncated to 0x%lx (%ld); the generated \ code might be incorrect.@." i i32 i32 let rec parse x = if Obj.is_block x then let tag = Obj.tag x in if tag = Obj.string_tag then String (Obj.magic x : string) else if tag = Obj.double_tag then Float (Obj.magic x : float) else if tag = Obj.double_array_tag then Float_array (Obj.magic x : float array) else if tag = Obj.custom_tag && same_custom x 0l then Int (Obj.magic x : int32) else if tag = Obj.custom_tag && same_custom x 0n then ( let i : nativeint = Obj.magic x in let i32 = Nativeint.to_int32 i in let i' = Nativeint.of_int32 i32 in if Poly.(i' <> i) then warn_overflow (Printf.sprintf "0x%nx (%nd)" i i) i32; Int i32) else if tag = Obj.custom_tag && same_custom x 0L then Int64 (Obj.magic x : int64) else if tag < Obj.no_scan_tag then Tuple (tag, Array.init (Obj.size x) ~f:(fun i -> parse (Obj.field x i)), Unknown) else assert false else let i : int = Obj.magic x in let i32 = Int32.of_int i in let i' = Int32.to_int i32 in if i' <> i then warn_overflow (Printf.sprintf "0x%x (%d)" i i) i32; Int i32 let inlined = function | String _ | IString _ -> false | Float _ -> true | Float_array _ -> false | Int64 _ -> false | Tuple _ -> false | Int _ -> true end (* Globals *) type globals = { mutable vars : Var.t option array ; mutable is_const : bool array ; mutable is_exported : bool array ; mutable named_value : string option array ; mutable override : (Var.t -> Code.instr list -> Var.t * Code.instr list) option array ; constants : Code.constant array ; primitives : string array } let make_globals size constants primitives = { vars = Array.make size None ; is_const = Array.make size false ; is_exported = Array.make size false ; named_value = Array.make size None ; override = Array.make size None ; constants ; primitives } let resize_array a len def = let b = Array.make len def in Array.blit ~src:a ~src_pos:0 ~dst:b ~dst_pos:0 ~len:(Array.length a); b let resize_globals g size = g.vars <- resize_array g.vars size None; g.is_const <- resize_array g.is_const size false; g.is_exported <- resize_array g.is_exported size true; g.named_value <- resize_array g.named_value size None; g.override <- resize_array g.override size None (* State of the VM *) module State = struct type elt = | Var of Var.t | Dummy let elt_to_var e = match e with | Var x -> x | _ -> assert false let print_elt f v = match v with | Var x -> Format.fprintf f "%a" Var.print x | Dummy -> Format.fprintf f "???" type handler = { var : Var.t ; addr : Addr.t ; stack_len : int ; block_pc : Addr.t } type t = { accu : elt ; stack : elt list ; env : elt array ; env_offset : int ; handlers : handler list ; globals : globals ; current_pc : Addr.t } let fresh_var state = let x = Var.fresh () in x, { state with accu = Var x } let globals st = st.globals let size_globals st size = if size > Array.length st.globals.vars then resize_globals st.globals size let rec list_start n l = if n = 0 then [] else match l with | [] -> assert false | v :: r -> v :: list_start (n - 1) r let rec st_pop n st = if n = 0 then st else match st with | [] -> assert false | _ :: r -> st_pop (n - 1) r let push st = { st with stack = st.accu :: st.stack } let pop n st = { st with stack = st_pop n st.stack } let acc n st = { st with accu = List.nth st.stack n } let env_acc n st = { st with accu = st.env.(st.env_offset + n) } let accu st = elt_to_var st.accu let stack_vars st = List.fold_left (st.accu :: st.stack) ~init:[] ~f:(fun l e -> match e with | Var x -> x :: l | Dummy -> l) let set_accu st x = { st with accu = Var x } let clear_accu st = { st with accu = Dummy } let peek n st = elt_to_var (List.nth st.stack n) let grab n st = List.map (list_start n st.stack) ~f:elt_to_var, pop n st let rec st_assign s n x = match s with | [] -> assert false | y :: rem -> if n = 0 then x :: rem else y :: st_assign rem (n - 1) x let assign st n = { st with stack = st_assign st.stack n st.accu } let start_function state env offset = { state with accu = Dummy; stack = []; env; env_offset = offset; handlers = [] } let start_block current_pc state = let stack = List.fold_right state.stack ~init:[] ~f:(fun e stack -> match e with | Dummy -> Dummy :: stack | Var x -> let y = Var.fork x in Var y :: stack) in let state = { state with stack; current_pc } in match state.accu with | Dummy -> state | Var x -> let y, state = fresh_var state in Var.propagate_name x y; state let push_handler state x addr = { state with handlers = { block_pc = state.current_pc ; var = x ; addr ; stack_len = List.length state.stack } :: state.handlers } let pop_handler state = { state with handlers = List.tl state.handlers } let addr_of_current_handler state = match state.handlers with | [] -> assert false | x :: _ -> x.block_pc let current_handler state = match state.handlers with | [] -> None | { var; addr; stack_len; _ } :: _ -> let state = { state with accu = Var var ; stack = st_pop (List.length state.stack - stack_len) state.stack } in Some (var, (addr, stack_vars state)) let initial g = { accu = Dummy ; stack = [] ; env = [||] ; env_offset = 0 ; handlers = [] ; globals = g ; current_pc = -1 } let rec print_stack f l = match l with | [] -> () | v :: r -> Format.fprintf f "%a %a" print_elt v print_stack r let print_env f e = Array.iteri e ~f:(fun i v -> if i > 0 then Format.fprintf f " "; Format.fprintf f "%a" print_elt v) let print st = Format.eprintf "{ %a | %a | (%d) %a }@." print_elt st.accu print_stack st.stack st.env_offset print_env st.env let pi_of_loc debug location = let pos = location.Location.loc_start in let src = Debug.find_source debug pos.Lexing.pos_fname in { Parse_info.name = Some pos.Lexing.pos_fname ; src ; line = pos.Lexing.pos_lnum - 1 ; col = pos.Lexing.pos_cnum - pos.Lexing.pos_bol ; idx = 0 ; fol = None } let rec name_rec debug i l s summary = match l, s with | [], _ -> () | (j, nm, ident) :: lrem, Var v :: srem when i = j -> (match Ocaml_compiler.find_loc_in_summary ident summary with | None -> () | Some loc -> Var.loc v (pi_of_loc debug loc)); Var.name v nm; name_rec debug (i + 1) lrem srem summary | (j, _, _) :: _, _ :: srem when i < j -> name_rec debug (i + 1) l srem summary | _ -> assert false let name_vars st debug pc = if Debug.names debug then let l, summary = Debug.find debug pc in name_rec debug 0 l st.stack summary let rec make_stack i state = if i = 0 then [], state else let x, state = fresh_var state in let params, state = make_stack (pred i) (push state) in if debug_parser () then if i > 1 then Format.printf ", "; if debug_parser () then Format.printf "%a" Var.print x; x :: params, state end let primitive_name state i = let g = State.globals state in assert (i >= 0 && i <= Array.length g.primitives); let prim = g.primitives.(i) in Primitive.add_external prim; prim let access_global g i = match g.vars.(i) with | Some x -> x | None -> g.is_const.(i) <- true; let x = Var.fresh () in g.vars.(i) <- Some x; x let register_global ?(force = false) g i rem = if force || g.is_exported.(i) then let args = match g.named_value.(i) with | None -> [] | Some name -> Code.Var.name (access_global g i) name; [ Pc (IString name) ] in Let ( Var.fresh () , Prim ( Extern "caml_register_global" , Pc (Int (Int32.of_int i)) :: Pv (access_global g i) :: args ) ) :: rem else rem let get_global state instrs i = State.size_globals state (i + 1); let g = State.globals state in match g.vars.(i) with | Some x -> if debug_parser () then Format.printf "(global access %a)@." Var.print x; x, State.set_accu state x, instrs | None -> if i < Array.length g.constants && Constants.inlined g.constants.(i) then let x, state = State.fresh_var state in let cst = g.constants.(i) in x, state, Let (x, Constant cst) :: instrs else ( g.is_const.(i) <- true; let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = CONST(%d)@." Var.print x i; g.vars.(i) <- Some x; x, state, instrs) let tagged_blocks = ref Addr.Set.empty let compiled_blocks = ref Addr.Map.empty let method_cache_id = ref 1 type compile_info = { blocks : Blocks.u ; code : string ; limit : int ; debug : Debug.t } let rec compile_block blocks debug_data code pc state = if not (Addr.Set.mem pc !tagged_blocks) then ( let limit = Blocks.next blocks pc in assert (limit > pc); let string_of_addr addr = match Debug.find_loc debug_data addr with | None -> string_of_int addr | Some loc -> ( match loc.Parse_info.src with | None -> string_of_int addr | Some file -> Printf.sprintf "%s:%d:%d-%d" file loc.Parse_info.line loc.Parse_info.col (addr + 2)) in if debug_parser () then Format.eprintf "Compiling from %s to %d@." (string_of_addr pc) (limit - 1); let state = State.start_block pc state in tagged_blocks := Addr.Set.add pc !tagged_blocks; let instr, last, state' = compile { blocks; code; limit; debug = debug_data } pc state [] in assert (not (Addr.Map.mem pc !compiled_blocks)); compiled_blocks := Addr.Map.add pc (state, List.rev instr, last) !compiled_blocks; match last with | Branch (pc', _) | Poptrap ((pc', _), _) -> compile_block blocks debug_data code pc' state' | Cond (_, _, (pc1, _), (pc2, _)) -> compile_block blocks debug_data code pc1 state'; compile_block blocks debug_data code pc2 state' | Switch (_, l1, l2) -> Array.iter l1 ~f:(fun (pc', _) -> compile_block blocks debug_data code pc' state'); Array.iter l2 ~f:(fun (pc', _) -> compile_block blocks debug_data code pc' state') | Pushtrap _ | Raise _ | Return _ | Stop -> ()) and compile infos pc state instrs = if debug_parser () then State.print state; assert (pc <= infos.limit); if pc = infos.limit then if (* stop if we reach end_of_code (ie when compiling cmo) *) pc = String.length infos.code / 4 then ( if debug_parser () then Format.eprintf "Stop@."; instrs, Stop, state) else ( State.name_vars state infos.debug pc; let stack = State.stack_vars state in if debug_parser () then Format.eprintf "Branch %d (%a) @." pc print_var_list stack; instrs, Branch (pc, stack), state) else ( if debug_parser () then Format.eprintf "%4d " pc; State.name_vars state infos.debug pc; let code = infos.code in let instr = get_instr_exn code pc in if debug_parser () then Format.eprintf "%08x %s@." instr.opcode instr.name; match instr.Instr.code with | ACC0 -> compile infos (pc + 1) (State.acc 0 state) instrs | ACC1 -> compile infos (pc + 1) (State.acc 1 state) instrs | ACC2 -> compile infos (pc + 1) (State.acc 2 state) instrs | ACC3 -> compile infos (pc + 1) (State.acc 3 state) instrs | ACC4 -> compile infos (pc + 1) (State.acc 4 state) instrs | ACC5 -> compile infos (pc + 1) (State.acc 5 state) instrs | ACC6 -> compile infos (pc + 1) (State.acc 6 state) instrs | ACC7 -> compile infos (pc + 1) (State.acc 7 state) instrs | ACC -> let n = getu code (pc + 1) in compile infos (pc + 2) (State.acc n state) instrs | PUSH -> compile infos (pc + 1) (State.push state) instrs | PUSHACC0 -> compile infos (pc + 1) (State.acc 0 (State.push state)) instrs | PUSHACC1 -> compile infos (pc + 1) (State.acc 1 (State.push state)) instrs | PUSHACC2 -> compile infos (pc + 1) (State.acc 2 (State.push state)) instrs | PUSHACC3 -> compile infos (pc + 1) (State.acc 3 (State.push state)) instrs | PUSHACC4 -> compile infos (pc + 1) (State.acc 4 (State.push state)) instrs | PUSHACC5 -> compile infos (pc + 1) (State.acc 5 (State.push state)) instrs | PUSHACC6 -> compile infos (pc + 1) (State.acc 6 (State.push state)) instrs | PUSHACC7 -> compile infos (pc + 1) (State.acc 7 (State.push state)) instrs | PUSHACC -> let n = getu code (pc + 1) in compile infos (pc + 2) (State.acc n (State.push state)) instrs | POP -> let n = getu code (pc + 1) in compile infos (pc + 2) (State.pop n state) instrs | ASSIGN -> let n = getu code (pc + 1) in let state = State.assign state n in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; (* We switch to a different block as this may have changed the exception handler continuation *) compile_block infos.blocks infos.debug code (pc + 2) state; Let (x, Const 0l) :: instrs, Branch (pc + 2, State.stack_vars state), state | ENVACC1 -> compile infos (pc + 1) (State.env_acc 1 state) instrs | ENVACC2 -> compile infos (pc + 1) (State.env_acc 2 state) instrs | ENVACC3 -> compile infos (pc + 1) (State.env_acc 3 state) instrs | ENVACC4 -> compile infos (pc + 1) (State.env_acc 4 state) instrs | ENVACC -> let n = getu code (pc + 1) in compile infos (pc + 2) (State.env_acc n state) instrs | PUSHENVACC1 -> compile infos (pc + 1) (State.env_acc 1 (State.push state)) instrs | PUSHENVACC2 -> compile infos (pc + 1) (State.env_acc 2 (State.push state)) instrs | PUSHENVACC3 -> compile infos (pc + 1) (State.env_acc 3 (State.push state)) instrs | PUSHENVACC4 -> compile infos (pc + 1) (State.env_acc 4 (State.push state)) instrs | PUSHENVACC -> let n = getu code (pc + 1) in compile infos (pc + 2) (State.env_acc n (State.push state)) instrs | PUSH_RETADDR -> compile infos (pc + 2) { state with State.stack = State.Dummy :: State.Dummy :: State.Dummy :: state.State.stack } instrs | APPLY -> let n = getu code (pc + 1) in let f = State.accu state in let x, state = State.fresh_var state in let args, state = State.grab n state in if debug_parser () then ( Format.printf "%a = %a(" Var.print x Var.print f; for i = 0 to n - 1 do if i > 0 then Format.printf ", "; Format.printf "%a" Var.print (List.nth args i) done; Format.printf ")@."); compile infos (pc + 2) (State.pop 3 state) (Let (x, Apply (f, args, false)) :: instrs) | APPLY1 -> let f = State.accu state in let x, state = State.fresh_var state in let y = State.peek 0 state in if debug_parser () then Format.printf "%a = %a(%a)@." Var.print x Var.print f Var.print y; compile infos (pc + 1) (State.pop 1 state) (Let (x, Apply (f, [ y ], false)) :: instrs) | APPLY2 -> let f = State.accu state in let x, state = State.fresh_var state in let y = State.peek 0 state in let z = State.peek 1 state in if debug_parser () then Format.printf "%a = %a(%a, %a)@." Var.print x Var.print f Var.print y Var.print z; compile infos (pc + 1) (State.pop 2 state) (Let (x, Apply (f, [ y; z ], false)) :: instrs) | APPLY3 -> let f = State.accu state in let x, state = State.fresh_var state in let y = State.peek 0 state in let z = State.peek 1 state in let t = State.peek 2 state in if debug_parser () then Format.printf "%a = %a(%a, %a, %a)@." Var.print x Var.print f Var.print y Var.print z Var.print t; compile infos (pc + 1) (State.pop 3 state) (Let (x, Apply (f, [ y; z; t ], false)) :: instrs) | APPTERM -> let n = getu code (pc + 1) in let f = State.accu state in let l, state = State.grab n state in if debug_parser () then ( Format.printf "return %a(" Var.print f; for i = 0 to n - 1 do if i > 0 then Format.printf ", "; Format.printf "%a" Var.print (List.nth l i) done; Format.printf ")@."); let x, state = State.fresh_var state in Let (x, Apply (f, l, false)) :: instrs, Return x, state | APPTERM1 -> let f = State.accu state in let x = State.peek 0 state in if debug_parser () then Format.printf "return %a(%a)@." Var.print f Var.print x; let y, state = State.fresh_var state in Let (y, Apply (f, [ x ], false)) :: instrs, Return y, state | APPTERM2 -> let f = State.accu state in let x = State.peek 0 state in let y = State.peek 1 state in if debug_parser () then Format.printf "return %a(%a, %a)@." Var.print f Var.print x Var.print y; let z, state = State.fresh_var state in Let (z, Apply (f, [ x; y ], false)) :: instrs, Return z, state | APPTERM3 -> let f = State.accu state in let x = State.peek 0 state in let y = State.peek 1 state in let z = State.peek 2 state in if debug_parser () then Format.printf "return %a(%a, %a, %a)@." Var.print f Var.print x Var.print y Var.print z; let t, state = State.fresh_var state in Let (t, Apply (f, [ x; y; z ], false)) :: instrs, Return t, state | RETURN -> let x = State.accu state in if debug_parser () then Format.printf "return %a@." Var.print x; instrs, Return x, state | RESTART -> assert false | GRAB -> compile infos (pc + 2) state instrs | CLOSURE -> let nvars = getu code (pc + 1) in let addr = pc + gets code (pc + 2) + 2 in let state = if nvars > 0 then State.push state else state in let vals, state = State.grab nvars state in let x, state = State.fresh_var state in let env = Array.of_list (State.Dummy :: List.map vals ~f:(fun x -> State.Var x)) in if debug_parser () then Format.printf "fun %a (" Var.print x; let nparams = match (get_instr_exn code addr).Instr.code with | GRAB -> getu code (addr + 1) + 1 | _ -> 1 in let state' = State.start_function state env 0 in let params, state' = State.make_stack nparams state' in if debug_parser () then Format.printf ") {@."; let state' = State.clear_accu state' in compile_block infos.blocks infos.debug code addr state'; if debug_parser () then Format.printf "}@."; let args = State.stack_vars state' in let state'', _, _ = Addr.Map.find addr !compiled_blocks in Debug.propagate (State.stack_vars state'') args; compile infos (pc + 3) state (Let (x, Closure (List.rev params, (addr, args))) :: instrs) | CLOSUREREC -> let nfuncs = getu code (pc + 1) in let nvars = getu code (pc + 2) in let state = if nvars > 0 then State.push state else state in let vals, state = State.grab nvars state in let state = ref state in let vars = ref [] in for i = 0 to nfuncs - 1 do let x, st = State.fresh_var !state in vars := (i, x) :: !vars; state := State.push st done; let env = ref (List.map vals ~f:(fun x -> State.Var x)) in List.iter !vars ~f:(fun (i, x) -> env := State.Var x :: !env; if i > 0 then env := State.Dummy :: !env); let env = Array.of_list !env in let state = !state in let instrs = List.fold_left (List.rev !vars) ~init:instrs ~f:(fun instr (i, x) -> let addr = pc + 3 + gets code (pc + 3 + i) in if debug_parser () then Format.printf "fun %a (" Var.print x; let nparams = match (get_instr_exn code addr).Instr.code with | GRAB -> getu code (addr + 1) + 1 | _ -> 1 in let state' = State.start_function state env (i * 2) in let params, state' = State.make_stack nparams state' in if debug_parser () then Format.printf ") {@."; let state' = State.clear_accu state' in compile_block infos.blocks infos.debug code addr state'; if debug_parser () then Format.printf "}@."; let args = State.stack_vars state' in let state'', _, _ = Addr.Map.find addr !compiled_blocks in Debug.propagate (State.stack_vars state'') args; Let (x, Closure (List.rev params, (addr, args))) :: instr) in compile infos (pc + 3 + nfuncs) (State.acc (nfuncs - 1) state) instrs | OFFSETCLOSUREM2 -> compile infos (pc + 1) (State.env_acc (-2) state) instrs | OFFSETCLOSURE0 -> compile infos (pc + 1) (State.env_acc 0 state) instrs | OFFSETCLOSURE2 -> compile infos (pc + 1) (State.env_acc 2 state) instrs | OFFSETCLOSURE -> let n = gets code (pc + 1) in compile infos (pc + 2) (State.env_acc n state) instrs | PUSHOFFSETCLOSUREM2 -> let state = State.push state in compile infos (pc + 1) (State.env_acc (-2) state) instrs | PUSHOFFSETCLOSURE0 -> let state = State.push state in compile infos (pc + 1) (State.env_acc 0 state) instrs | PUSHOFFSETCLOSURE2 -> let state = State.push state in compile infos (pc + 1) (State.env_acc 2 state) instrs | PUSHOFFSETCLOSURE -> let state = State.push state in let n = gets code (pc + 1) in compile infos (pc + 2) (State.env_acc n state) instrs | GETGLOBAL -> let i = getu code (pc + 1) in let _, state, instrs = get_global state instrs i in compile infos (pc + 2) state instrs | PUSHGETGLOBAL -> let state = State.push state in let i = getu code (pc + 1) in let _, state, instrs = get_global state instrs i in compile infos (pc + 2) state instrs | GETGLOBALFIELD -> let i = getu code (pc + 1) in let x, state, instrs = get_global state instrs i in let j = getu code (pc + 2) in let y, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[%d]@." Var.print y Var.print x j; compile infos (pc + 3) state (Let (y, Field (x, j)) :: instrs) | PUSHGETGLOBALFIELD -> let state = State.push state in let i = getu code (pc + 1) in let x, state, instrs = get_global state instrs i in let j = getu code (pc + 2) in let y, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[%d]@." Var.print y Var.print x j; compile infos (pc + 3) state (Let (y, Field (x, j)) :: instrs) | SETGLOBAL -> let i = getu code (pc + 1) in State.size_globals state (i + 1); let y = State.accu state in let g = State.globals state in assert (Option.is_none g.vars.(i)); if debug_parser () then Format.printf "(global %d) = %a@." i Var.print y; let instrs = match g.override.(i) with | Some f -> let v, instrs = f y instrs in g.vars.(i) <- Some v; instrs | None -> g.vars.(i) <- Some y; instrs in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; let instrs = register_global g i instrs in compile infos (pc + 2) state (Let (x, Const 0l) :: instrs) | ATOM0 -> let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = ATOM(0)@." Var.print x; compile infos (pc + 1) state (Let (x, Block (0, [||], Unknown)) :: instrs) | ATOM -> let i = getu code (pc + 1) in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = ATOM(%d)@." Var.print x i; compile infos (pc + 2) state (Let (x, Block (i, [||], NotArray)) :: instrs) | PUSHATOM0 -> let state = State.push state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = ATOM(0)@." Var.print x; compile infos (pc + 1) state (Let (x, Block (0, [||], Unknown)) :: instrs) | PUSHATOM -> let state = State.push state in let i = getu code (pc + 1) in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = ATOM(%d)@." Var.print x i; compile infos (pc + 2) state (Let (x, Block (i, [||], NotArray)) :: instrs) | MAKEBLOCK -> let size = getu code (pc + 1) in let tag = getu code (pc + 2) in let state = State.push state in let x, state = State.fresh_var state in let contents, state = State.grab size state in if debug_parser () then ( Format.printf "%a = { " Var.print x; for i = 0 to size - 1 do Format.printf "%d = %a; " i Var.print (List.nth contents i) done; Format.printf "}@."); compile infos (pc + 3) state (Let (x, Block (tag, Array.of_list contents, Unknown)) :: instrs) | MAKEBLOCK1 -> let tag = getu code (pc + 1) in let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = { 0 = %a; }@." Var.print x Var.print y; compile infos (pc + 2) state (Let (x, Block (tag, [| y |], NotArray)) :: instrs) | MAKEBLOCK2 -> let tag = getu code (pc + 1) in let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = { 0 = %a; 1 = %a; }@." Var.print x Var.print y Var.print z; compile infos (pc + 2) (State.pop 1 state) (Let (x, Block (tag, [| y; z |], NotArray)) :: instrs) | MAKEBLOCK3 -> let tag = getu code (pc + 1) in let y = State.accu state in let z = State.peek 0 state in let t = State.peek 1 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = { 0 = %a; 1 = %a; 2 = %a }@." Var.print x Var.print y Var.print z Var.print t; compile infos (pc + 2) (State.pop 2 state) (Let (x, Block (tag, [| y; z; t |], NotArray)) :: instrs) | MAKEFLOATBLOCK -> let size = getu code (pc + 1) in let state = State.push state in let x, state = State.fresh_var state in let contents, state = State.grab size state in if debug_parser () then ( Format.printf "%a = { " Var.print x; for i = 0 to size - 1 do Format.printf "%d = %a; " i Var.print (List.nth contents i) done; Format.printf "}@."); compile infos (pc + 2) state (Let (x, Block (254, Array.of_list contents, Unknown)) :: instrs) | GETFIELD0 -> let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[0]@." Var.print x Var.print y; compile infos (pc + 1) state (Let (x, Field (y, 0)) :: instrs) | GETFIELD1 -> let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[1]@." Var.print x Var.print y; compile infos (pc + 1) state (Let (x, Field (y, 1)) :: instrs) | GETFIELD2 -> let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[2]@." Var.print x Var.print y; compile infos (pc + 1) state (Let (x, Field (y, 2)) :: instrs) | GETFIELD3 -> let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[3]@." Var.print x Var.print y; compile infos (pc + 1) state (Let (x, Field (y, 3)) :: instrs) | GETFIELD -> let y = State.accu state in let n = getu code (pc + 1) in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[%d]@." Var.print x Var.print y n; compile infos (pc + 2) state (Let (x, Field (y, n)) :: instrs) | GETFLOATFIELD -> let y = State.accu state in let n = getu code (pc + 1) in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[%d]@." Var.print x Var.print y n; compile infos (pc + 2) state (Let (x, Field (y, n)) :: instrs) | SETFIELD0 -> let y = State.accu state in let z = State.peek 0 state in if debug_parser () then Format.printf "%a[0] = %a@." Var.print y Var.print z; let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; compile infos (pc + 1) (State.pop 1 state) (Let (x, Const 0l) :: Set_field (y, 0, z) :: instrs) | SETFIELD1 -> let y = State.accu state in let z = State.peek 0 state in if debug_parser () then Format.printf "%a[1] = %a@." Var.print y Var.print z; let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; compile infos (pc + 1) (State.pop 1 state) (Let (x, Const 0l) :: Set_field (y, 1, z) :: instrs) | SETFIELD2 -> let y = State.accu state in let z = State.peek 0 state in if debug_parser () then Format.printf "%a[2] = %a@." Var.print y Var.print z; let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; compile infos (pc + 1) (State.pop 1 state) (Let (x, Const 0l) :: Set_field (y, 2, z) :: instrs) | SETFIELD3 -> let y = State.accu state in let z = State.peek 0 state in if debug_parser () then Format.printf "%a[3] = %a@." Var.print y Var.print z; let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; compile infos (pc + 1) (State.pop 1 state) (Let (x, Const 0l) :: Set_field (y, 3, z) :: instrs) | SETFIELD -> let y = State.accu state in let z = State.peek 0 state in let n = getu code (pc + 1) in if debug_parser () then Format.printf "%a[%d] = %a@." Var.print y n Var.print z; let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; compile infos (pc + 2) (State.pop 1 state) (Let (x, Const 0l) :: Set_field (y, n, z) :: instrs) | SETFLOATFIELD -> let y = State.accu state in let z = State.peek 0 state in let n = getu code (pc + 1) in if debug_parser () then Format.printf "%a[%d] = %a@." Var.print y n Var.print z; let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; compile infos (pc + 2) (State.pop 1 state) (Let (x, Const 0l) :: Set_field (y, n, z) :: instrs) | VECTLENGTH -> let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a.length@." Var.print x Var.print y; compile infos (pc + 1) state (Let (x, Prim (Vectlength, [ Pv y ])) :: instrs) | GETVECTITEM -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[%a]@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Array_get, [ Pv y; Pv z ])) :: instrs) | SETVECTITEM -> if debug_parser () then Format.printf "%a[%a] = %a@." Var.print (State.accu state) Var.print (State.peek 0 state) Var.print (State.peek 1 state); let instrs = Array_set (State.accu state, State.peek 0 state, State.peek 1 state) :: instrs in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; compile infos (pc + 1) (State.pop 2 state) (Let (x, Const 0l) :: instrs) | GETSTRINGCHAR -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[%a]@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "caml_string_unsafe_get", [ Pv y; Pv z ])) :: instrs) | GETBYTESCHAR -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a[%a]@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "caml_bytes_unsafe_get", [ Pv y; Pv z ])) :: instrs) | SETBYTESCHAR -> if debug_parser () then Format.printf "%a[%a] = %a@." Var.print (State.accu state) Var.print (State.peek 0 state) Var.print (State.peek 1 state); let x = State.accu state in let y = State.peek 0 state in let z = State.peek 1 state in let t, state = State.fresh_var state in let instrs = Let (t, Prim (Extern "caml_bytes_unsafe_set", [ Pv x; Pv y; Pv z ])) :: instrs in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = 0@." Var.print x; compile infos (pc + 1) (State.pop 2 state) (Let (x, Const 0l) :: instrs) | BRANCH -> let offset = gets code (pc + 1) in if debug_parser () then Format.printf "... (branch)@."; instrs, Branch (pc + offset + 1, State.stack_vars state), state | BRANCHIF -> let offset = gets code (pc + 1) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (IsTrue, x, (pc + offset + 1, args), (pc + 2, args)), state | BRANCHIFNOT -> let offset = gets code (pc + 1) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (IsTrue, x, (pc + 2, args), (pc + offset + 1, args)), state | SWITCH -> if debug_parser () then Format.printf "switch ...@."; let sz = getu code (pc + 1) in let x = State.accu state in let args = State.stack_vars state in let l = sz land 0xFFFF in let it = Array.init (sz land 0XFFFF) ~f:(fun i -> pc + 2 + gets code (pc + 2 + i), args) in let bt = Array.init (sz lsr 16) ~f:(fun i -> pc + 2 + gets code (pc + 2 + l + i), args) in instrs, Switch (x, it, bt), state | BOOLNOT -> let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = !%a@." Var.print x Var.print y; compile infos (pc + 1) state (Let (x, Prim (Not, [ Pv y ])) :: instrs) | PUSHTRAP -> let addr = pc + 1 + gets code (pc + 1) in let x, state' = State.fresh_var state in compile_block infos.blocks infos.debug code addr state'; compile_block infos.blocks infos.debug code (pc + 2) { (State.push_handler state x addr) with State.stack = State.Dummy :: State.Dummy :: State.Dummy :: State.Dummy :: state.State.stack }; ( instrs , Pushtrap ( (pc + 2, State.stack_vars state) , x , (addr, State.stack_vars state') , Addr.Set.empty ) , state ) | POPTRAP -> let addr = pc + 1 in let handler_addr = State.addr_of_current_handler state in compile_block infos.blocks infos.debug code addr (State.pop 4 (State.pop_handler state)); instrs, Poptrap ((addr, State.stack_vars state), handler_addr), state | RERAISE | RAISE_NOTRACE | RAISE -> let kind = match instr.Instr.code with | RERAISE -> `Reraise | RAISE_NOTRACE -> `Notrace | RAISE -> `Normal | _ -> assert false in if debug_parser () then Format.printf "throw(%a)@." Var.print (State.accu state); instrs, Raise (State.accu state, kind), state | CHECK_SIGNALS -> compile infos (pc + 1) state instrs | C_CALL1 -> let prim = primitive_name state (getu code (pc + 1)) in if String.equal (Primitive.resolve prim) "%identity" then (* This is a no-op *) compile infos (pc + 2) state instrs else let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = ccall \"%s\" (%a)@." Var.print x prim Var.print y; compile infos (pc + 2) state (Let (x, Prim (Extern prim, [ Pv y ])) :: instrs) | C_CALL2 -> let prim = primitive_name state (getu code (pc + 1)) in let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = ccall \"%s\" (%a, %a)@." Var.print x prim Var.print y Var.print z; compile infos (pc + 2) (State.pop 1 state) (Let (x, Prim (Extern prim, [ Pv y; Pv z ])) :: instrs) | C_CALL3 -> let prim = primitive_name state (getu code (pc + 1)) in let y = State.accu state in let z = State.peek 0 state in let t = State.peek 1 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = ccall \"%s\" (%a, %a, %a)@." Var.print x prim Var.print y Var.print z Var.print t; compile infos (pc + 2) (State.pop 2 state) (Let (x, Prim (Extern prim, [ Pv y; Pv z; Pv t ])) :: instrs) | C_CALL4 -> let nargs = 4 in let prim = primitive_name state (getu code (pc + 1)) in let state = State.push state in let x, state = State.fresh_var state in let args, state = State.grab nargs state in if debug_parser () then ( Format.printf "%a = ccal \"%s\" (" Var.print x prim; for i = 0 to nargs - 1 do if i > 0 then Format.printf ", "; Format.printf "%a" Var.print (List.nth args i) done; Format.printf ")@."); compile infos (pc + 2) state (Let (x, Prim (Extern prim, List.map args ~f:(fun x -> Pv x))) :: instrs) | C_CALL5 -> let nargs = 5 in let prim = primitive_name state (getu code (pc + 1)) in let state = State.push state in let x, state = State.fresh_var state in let args, state = State.grab nargs state in if debug_parser () then ( Format.printf "%a = ccal \"%s\" (" Var.print x prim; for i = 0 to nargs - 1 do if i > 0 then Format.printf ", "; Format.printf "%a" Var.print (List.nth args i) done; Format.printf ")@."); compile infos (pc + 2) state (Let (x, Prim (Extern prim, List.map args ~f:(fun x -> Pv x))) :: instrs) | C_CALLN -> let nargs = getu code (pc + 1) in let prim = primitive_name state (getu code (pc + 2)) in let state = State.push state in let x, state = State.fresh_var state in let args, state = State.grab nargs state in if debug_parser () then ( Format.printf "%a = ccal \"%s\" (" Var.print x prim; for i = 0 to nargs - 1 do if i > 0 then Format.printf ", "; Format.printf "%a" Var.print (List.nth args i) done; Format.printf ")@."); compile infos (pc + 3) state (Let (x, Prim (Extern prim, List.map args ~f:(fun x -> Pv x))) :: instrs) | (CONST0 | CONST1 | CONST2 | CONST3) as cc -> let x, state = State.fresh_var state in let n = match cc with | CONST0 -> 0l | CONST1 -> 1l | CONST2 -> 2l | CONST3 -> 3l | _ -> assert false in if debug_parser () then Format.printf "%a = %ld@." Var.print x n; compile infos (pc + 1) state (Let (x, Const n) :: instrs) | CONSTINT -> let n = gets32 code (pc + 1) in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %ld@." Var.print x n; compile infos (pc + 2) state (Let (x, Const n) :: instrs) | (PUSHCONST0 | PUSHCONST1 | PUSHCONST2 | PUSHCONST3) as cc -> let state = State.push state in let x, state = State.fresh_var state in let n = match cc with | PUSHCONST0 -> 0l | PUSHCONST1 -> 1l | PUSHCONST2 -> 2l | PUSHCONST3 -> 3l | _ -> assert false in if debug_parser () then Format.printf "%a = %ld@." Var.print x n; compile infos (pc + 1) state (Let (x, Const n) :: instrs) | PUSHCONSTINT -> let state = State.push state in let n = gets32 code (pc + 1) in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %ld@." Var.print x n; compile infos (pc + 2) state (Let (x, Const n) :: instrs) | NEGINT -> let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = -%a@." Var.print x Var.print y; compile infos (pc + 1) state (Let (x, Prim (Extern "%int_neg", [ Pv y ])) :: instrs) | ADDINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a + %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_add", [ Pv y; Pv z ])) :: instrs) | SUBINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a - %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_sub", [ Pv y; Pv z ])) :: instrs) | MULINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a * %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_mul", [ Pv y; Pv z ])) :: instrs) | DIVINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a / %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_div", [ Pv y; Pv z ])) :: instrs) | MODINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a %% %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_mod", [ Pv y; Pv z ])) :: instrs) | ANDINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a & %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_and", [ Pv y; Pv z ])) :: instrs) | ORINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a | %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_or", [ Pv y; Pv z ])) :: instrs) | XORINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a ^ %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_xor", [ Pv y; Pv z ])) :: instrs) | LSLINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a << %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_lsl", [ Pv y; Pv z ])) :: instrs) | LSRINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a >>> %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_lsr", [ Pv y; Pv z ])) :: instrs) | ASRINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a >> %a@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Extern "%int_asr", [ Pv y; Pv z ])) :: instrs) | EQ -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = mk_bool(%a == %a)@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Eq, [ Pv y; Pv z ])) :: instrs) | NEQ -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = mk_bool(%a != %a)@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Neq, [ Pv y; Pv z ])) :: instrs) | LTINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = mk_bool(%a < %a)@." Var.print x Var.print y Var.print (State.peek 0 state); compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Lt, [ Pv y; Pv z ])) :: instrs) | LEINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = mk_bool(%a <= %a)@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Le, [ Pv y; Pv z ])) :: instrs) | GTINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = mk_bool(%a > %a)@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Lt, [ Pv z; Pv y ])) :: instrs) | GEINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = mk_bool(%a >= %a)@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Le, [ Pv z; Pv y ])) :: instrs) | OFFSETINT -> let n = gets32 code (pc + 1) in let y = State.accu state in let z, state = State.fresh_var state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %a + %ld@." Var.print x Var.print y n; compile infos (pc + 2) state (Let (x, Prim (Extern "%int_add", [ Pv y; Pv z ])) :: Let (z, Const n) :: instrs) | OFFSETREF -> let n = gets code (pc + 1) in let x = State.accu state in if debug_parser () then Format.printf "%a += %d@." Var.print x n; let instrs = Offset_ref (x, n) :: instrs in let x, state = State.fresh_var state in if debug_parser () then Format.printf "x = 0@."; compile infos (pc + 2) state (Let (x, Const 0l) :: instrs) | ISINT -> let y = State.accu state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = !%a@." Var.print x Var.print y; compile infos (pc + 1) state (Let (x, Prim (IsInt, [ Pv y ])) :: instrs) | BEQ -> let n = gets32 code (pc + 1) in let offset = gets code (pc + 2) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (CEq n, x, (pc + offset + 2, args), (pc + 3, args)), state | BNEQ -> let n = gets32 code (pc + 1) in let offset = gets code (pc + 2) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (CEq n, x, (pc + 3, args), (pc + offset + 2, args)), state | BLTINT -> let n = gets32 code (pc + 1) in let offset = gets code (pc + 2) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (CLt n, x, (pc + offset + 2, args), (pc + 3, args)), state | BLEINT -> let n = gets32 code (pc + 1) in let offset = gets code (pc + 2) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (CLe n, x, (pc + offset + 2, args), (pc + 3, args)), state | BGTINT -> let n = gets32 code (pc + 1) in let offset = gets code (pc + 2) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (CLe n, x, (pc + 3, args), (pc + offset + 2, args)), state | BGEINT -> let n = gets32 code (pc + 1) in let offset = gets code (pc + 2) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (CLt n, x, (pc + 3, args), (pc + offset + 2, args)), state | BULTINT -> let n = getu32 code (pc + 1) in let offset = gets code (pc + 2) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (CUlt n, x, (pc + offset + 2, args), (pc + 3, args)), state | BUGEINT -> let n = getu32 code (pc + 1) in let offset = gets code (pc + 2) in let x = State.accu state in let args = State.stack_vars state in instrs, Cond (CUlt n, x, (pc + 3, args), (pc + offset + 2, args)), state | ULTINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = mk_bool(%a <= %a) (unsigned)@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Ult, [ Pv y; Pv z ])) :: instrs) | UGEINT -> let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in if debug_parser () then Format.printf "%a = mk_bool(%a >= %a)@." Var.print x Var.print y Var.print z; compile infos (pc + 1) (State.pop 1 state) (Let (x, Prim (Ult, [ Pv z; Pv y ])) :: instrs) | GETPUBMET -> let n = gets32 code (pc + 1) in let cache = !method_cache_id in incr method_cache_id; let obj = State.accu state in let state = State.push state in let tag, state = State.fresh_var state in let m, state = State.fresh_var state in if debug_parser () then Format.printf "%a = %ld@." Var.print tag n; if debug_parser () then Format.printf "%a = caml_get_public_method(%a, %a)@." Var.print m Var.print obj Var.print tag; compile infos (pc + 3) state (Let ( m , Prim ( Extern "caml_get_public_method" , [ Pv obj; Pv tag; Pc (Int (Int32.of_int cache)) ] ) ) :: Let (tag, Const n) :: instrs) | GETDYNMET -> let tag = State.accu state in let obj = State.peek 0 state in let m, state = State.fresh_var state in if debug_parser () then Format.printf "%a = caml_get_public_method(%a, %a)@." Var.print m Var.print obj Var.print tag; compile infos (pc + 1) state (Let (m, Prim (Extern "caml_get_public_method", [ Pv obj; Pv tag; Pc (Int 0l) ])) :: instrs) | GETMETHOD -> let lab = State.accu state in let obj = State.peek 0 state in let meths, state = State.fresh_var state in let m, state = State.fresh_var state in if debug_parser () then Format.printf "%a = lookup(%a, %a)@." Var.print m Var.print obj Var.print lab; compile infos (pc + 1) state (Let (m, Prim (Array_get, [ Pv meths; Pv lab ])) :: Let (meths, Field (obj, 0)) :: instrs) | STOP -> instrs, Stop, state | EVENT | BREAK | FIRST_UNIMPLEMENTED_OP -> assert false) (****) let match_exn_traps (blocks : 'a Addr.Map.t) = let map = Addr.Map.fold (fun _ block map -> match block.branch with | Poptrap ((cont, _), addr_push) -> let set = try Addr.Set.add cont (Addr.Map.find addr_push map) with Not_found -> Addr.Set.singleton cont in Addr.Map.add addr_push set map | _ -> map) blocks Addr.Map.empty in Addr.Map.fold (fun pc conts' blocks -> match Addr.Map.find pc blocks with | { branch = Pushtrap (cont1, x, cont2, conts); _ } as block -> assert (Addr.Set.is_empty conts); let branch = Pushtrap (cont1, x, cont2, conts') in Addr.Map.add pc { block with branch } blocks | _ -> assert false) map blocks (****) type one = { code : Code.program ; cmis : StringSet.t ; debug : Debug.t } let parse_bytecode code globals debug_data = let state = State.initial globals in Code.Var.reset (); let blocks = Blocks.analyse debug_data code in let blocks = (* Disabled. [pc] might not be an appropriate place to split blocks *) if false && Debug.enabled debug_data then Debug.fold debug_data (fun pc _ blocks -> Blocks.add blocks pc) blocks else blocks in let blocks' = Blocks.finish_analysis blocks in if not (Blocks.is_empty blocks') then compile_block blocks' debug_data code 0 state; let blocks = Addr.Map.mapi (fun _ (state, instr, last) -> { params = State.stack_vars state ; handler = State.current_handler state ; body = instr ; branch = last }) !compiled_blocks in compiled_blocks := Addr.Map.empty; tagged_blocks := Addr.Set.empty; let free_pc = String.length code / 4 in let blocks = match_exn_traps blocks in 0, blocks, free_pc (* HACK - override module *) let override_global = let jsmodule name func = Prim (Extern "%overrideMod", [ Pc (String name); Pc (String func) ]) in [ ( "CamlinternalMod" , fun _orig instrs -> let x = Var.fresh_n "internalMod" in let init_mod = Var.fresh_n "init_mod" in let update_mod = Var.fresh_n "update_mod" in ( x , Let (x, Block (0, [| init_mod; update_mod |], NotArray)) :: Let (init_mod, jsmodule "CamlinternalMod" "init_mod") :: Let (update_mod, jsmodule "CamlinternalMod" "update_mod") :: instrs ) ) ; ( "Int_misc" (* Until https://github.com/ocaml/num/pull/16 is merged and released *) , fun orig instrs -> let x = Var.fresh_n "int_misc" in let a0 = Var.fresh () in let a1 = Var.fresh () in let a2 = Var.fresh () in let a3 = Var.fresh () in let a_length_of_int = Var.fresh () in let a_biggest_int = Var.fresh () in let a_least_int = Var.fresh () in let a_monster_int = Var.fresh () in let length_of_int = 31 in let monster_int = Int32.shift_left 1l length_of_int in let biggest_int = Int32.sub monster_int 1l in let least_int = Int32.neg biggest_int in let map x i = Let (x, Field (orig, i)) in ( x , Let ( x , Block ( 0 , [| a0 ; a1 ; a2 ; a3 ; a_length_of_int ; a_biggest_int ; a_least_int ; a_monster_int |] , NotArray ) ) :: Let (a_monster_int, Const monster_int) :: Let (a_least_int, Const least_int) :: Let (a_biggest_int, Const biggest_int) :: Let (a_length_of_int, Const (Int32.of_int length_of_int)) :: map a3 3 :: map a2 2 :: map a1 1 :: map a0 0 :: instrs ) ) ] (* HACK END *) let seek_section toc ic name = let rec seek_sec curr_ofs = function | [] -> raise Not_found | (n, len) :: rem -> if String.equal n name then ( seek_in ic (curr_ofs - len); len) else seek_sec (curr_ofs - len) rem in seek_sec (in_channel_length ic - 16 - (8 * List.length toc)) toc let read_toc ic = let pos_trailer = in_channel_length ic - 16 in seek_in ic pos_trailer; let num_sections = input_binary_int ic in seek_in ic (pos_trailer - (8 * num_sections)); let section_table = ref [] in for _i = 1 to num_sections do let name = really_input_string ic 4 in let len = input_binary_int ic in section_table := (name, len) :: !section_table done; !section_table let from_exe ?(includes = []) ?(toplevel = false) ?exported_unit ?(dynlink = false) ?(debug = false) ic = let debug_data = Debug.create ~toplevel debug in let toc = read_toc ic in let prim_size = seek_section toc ic "PRIM" in let prim = really_input_string ic prim_size in let primitive_table = Array.of_list (String.split_char ~sep:'\000' prim) in let code_size = seek_section toc ic "CODE" in let code = really_input_string ic code_size in ignore (seek_section toc ic "DATA"); let init_data : Obj.t array = input_value ic in let init_data = Array.map ~f:Constants.parse init_data in ignore (seek_section toc ic "SYMB"); let orig_symbols : Ocaml_compiler.Symtable.GlobalMap.t = input_value ic in ignore (seek_section toc ic "CRCS"); let orig_crcs : (string * Digest.t option) list = input_value ic in let keeps = let t = Hashtbl.create 17 in List.iter ~f:(fun (_, s) -> Hashtbl.add t s ()) predefined_exceptions; List.iter ~f:(fun s -> Hashtbl.add t s ()) [ "Outcometree"; "Topdirs"; "Toploop" ]; t in let keep s = try Hashtbl.find keeps s; true with Not_found -> ( match exported_unit with | Some l -> List.mem s ~set:l | None -> true) in let crcs = List.filter ~f:(fun (unit, _crc) -> keep unit) orig_crcs in let symbols = Ocaml_compiler.Symtable.GlobalMap.filter_global_map (fun id -> keep (Ident.name id)) orig_symbols in (if not (Debug.dbg_section_needed debug_data) then () else try ignore (seek_section toc ic "DBUG"); Debug.read debug_data ~crcs ~includes ic with Not_found -> if Debug.enabled debug_data || Debug.toplevel debug_data then warn "Warning: Program not linked with -g, original variable names and locations \ not available.@."); let globals = make_globals (Array.length init_data) init_data primitive_table in (* Initialize module override mechanism *) List.iter override_global ~f:(fun (name, v) -> try let nn = Ident.create_persistent name in let i = Ocaml_compiler.Symtable.GlobalMap.find nn orig_symbols in globals.override.(i) <- Some v; if debug_parser () then Format.eprintf "overriding global %s@." name with Not_found -> ()); if toplevel || dynlink then (* export globals *) Ocaml_compiler.Symtable.GlobalMap.iter (fun id n -> globals.named_value.(n) <- Some (Ident.name id); globals.is_exported.(n) <- true) symbols (* @vouillon: *) (* we should then use the -linkall option to build the toplevel. *) (* The OCaml compiler can generate code using this primitive but *) (* does not use it itself. This is the only primitive in this case. *) (* Ideally, Js_of_ocaml should parse the .mli files for primitives as *) (* well as marking this primitive as potentially used. But *) (* the -linkall option is probably good enough. *) (* Primitive.mark_used "caml_string_greaterthan" *); let p = parse_bytecode code globals debug_data in (* register predefined exception *) let body = List.fold_left predefined_exceptions ~init:[] ~f:(fun body (i, name) -> globals.named_value.(i) <- Some name; let body = register_global ~force:true globals i body in globals.is_exported.(i) <- false; body) in let body = Array.fold_right_i globals.constants ~init:body ~f:(fun i _ l -> match globals.vars.(i) with | Some x when globals.is_const.(i) -> let l = register_global globals i l in Let (x, Constant globals.constants.(i)) :: l | _ -> l) in let body = if toplevel then (* Include linking information *) let toc = [ "SYMB", Obj.repr symbols; "CRCS", Obj.repr crcs; "PRIM", Obj.repr prim ] in let gdata = Var.fresh () in let infos = [ "toc", Constants.parse (Obj.repr toc) ; "prim_count", Int (Int32.of_int (Array.length globals.primitives)) ] in let body = List.fold_left infos ~init:body ~f:(fun rem (name, const) -> let c = Var.fresh () in Let (c, Constant const) :: Let ( Var.fresh () , Prim (Extern "caml_js_set", [ Pv gdata; Pc (String name); Pv c ]) ) :: rem) in Let (gdata, Prim (Extern "caml_get_global_data", [])) :: body else body in (* List interface files *) let is_module = let is_ident_char = function | 'A' .. 'Z' | 'a' .. 'z' | '_' | '\'' | '0' .. '9' -> true | _ -> false in let is_uppercase = function | 'A' .. 'Z' -> true | _ -> false in fun name -> try if String.length name = 0 then raise Exit; if not (is_uppercase name.[0]) then raise Exit; for i = 1 to String.length name - 1 do if not (is_ident_char name.[i]) then raise Exit done; true with Exit -> false in let cmis = let exception_ids = List.fold_left predefined_exceptions ~init:(-1) ~f:(fun acc (i, _) -> max acc i) in if toplevel && Config.Flag.include_cmis () then Ocaml_compiler.Symtable.GlobalMap.fold (fun id num acc -> if num > exception_ids && Ident.global id && is_module (Ident.name id) then StringSet.add (Ident.name id) acc else acc) symbols StringSet.empty else StringSet.empty in let cmis = match exported_unit with | None -> cmis | Some l -> if toplevel && Config.Flag.include_cmis () then List.fold_left l ~init:cmis ~f:(fun acc s -> StringSet.add s acc) else cmis in let code = prepend p body in Code.invariant code; { code; cmis; debug = debug_data } (* As input: list of primitives + size of global table *) let from_bytes primitives (code : bytecode) = let debug_data = Debug.create ~toplevel:false false in let globals = make_globals 0 [||] primitives in let p = parse_bytecode code globals debug_data in let gdata = Var.fresh () in let body = Array.fold_right_i globals.vars ~init:[] ~f:(fun i var l -> match var with | Some x when globals.is_const.(i) -> Let (x, Field (gdata, i)) :: l | _ -> l) in let body = Let (gdata, Prim (Extern "caml_get_global_data", [])) :: body in prepend p body, debug_data let from_string primitives (code : string) = from_bytes primitives code module Reloc = struct let gen_patch_int buff pos n = Bytes.set buff (pos + 0) (Char.unsafe_chr n); Bytes.set buff (pos + 1) (Char.unsafe_chr (n asr 8)); Bytes.set buff (pos + 2) (Char.unsafe_chr (n asr 16)); Bytes.set buff (pos + 3) (Char.unsafe_chr (n asr 24)) type t = { mutable pos : int ; mutable constants : Code.constant list ; mutable step2_started : bool ; names : (string, int) Hashtbl.t ; primitives : (string, int) Hashtbl.t } let create () = let constants = [] in { pos = List.length constants ; constants ; step2_started = false ; names = Hashtbl.create 17 ; primitives = Hashtbl.create 17 } (* We currently rely on constants to be relocated before globals. *) let step1 t compunit code = if t.step2_started then assert false; let open Cmo_format in List.iter compunit.cu_primitives ~f:(fun name -> Hashtbl.add t.primitives name (Hashtbl.length t.primitives)); let slot_for_literal sc = t.constants <- Ocaml_compiler.constant_of_const sc :: t.constants; let pos = t.pos in t.pos <- succ t.pos; pos in let num_of_prim name = try Hashtbl.find t.primitives name with Not_found -> let i = Hashtbl.length t.primitives in Hashtbl.add t.primitives name i; i in List.iter compunit.cu_reloc ~f:(function | Reloc_literal sc, pos -> gen_patch_int code pos (slot_for_literal sc) | Reloc_primitive name, pos -> gen_patch_int code pos (num_of_prim name) | _ -> ()) let step2 t compunit code = t.step2_started <- true; let open Cmo_format in let next id = let name = Ident.name id in try Hashtbl.find t.names name with Not_found -> let pos = t.pos in t.pos <- succ t.pos; Hashtbl.add t.names name pos; pos in let slot_for_getglobal id = next id in let slot_for_setglobal id = next id in List.iter compunit.cu_reloc ~f:(function | Reloc_getglobal id, pos -> gen_patch_int code pos (slot_for_getglobal id) | Reloc_setglobal id, pos -> gen_patch_int code pos (slot_for_setglobal id) | _ -> ()) let primitives t = let l = Hashtbl.length t.primitives in let a = Array.make l "" in Hashtbl.iter (fun name i -> a.(i) <- name) t.primitives; a let constants t = Array.of_list (List.rev t.constants) let make_globals t = let primitives = primitives t in let constants = constants t in let globals = make_globals (Array.length constants) constants primitives in resize_globals globals t.pos; Hashtbl.iter (fun name i -> globals.named_value.(i) <- Some name) t.names; (* Initialize module override mechanism *) List.iter override_global ~f:(fun (name, v) -> try let i = Hashtbl.find t.names name in globals.override.(i) <- Some v; if debug_parser () then Format.eprintf "overriding global %s@." name with Not_found -> ()); globals end let from_compilation_units ~includes:_ ~toplevel ~debug_data l = let reloc = Reloc.create () in List.iter l ~f:(fun (compunit, code) -> Reloc.step1 reloc compunit code); List.iter l ~f:(fun (compunit, code) -> Reloc.step2 reloc compunit code); let globals = Reloc.make_globals reloc in let code = let l = List.map l ~f:(fun (_, c) -> Bytes.to_string c) in String.concat ~sep:"" l in let prog = parse_bytecode code globals debug_data in let gdata = Var.fresh_n "global_data" in let body = Array.fold_right_i globals.vars ~init:[] ~f:(fun i var l -> match var with | Some x when globals.is_const.(i) -> ( match globals.named_value.(i) with | None -> let l = register_global globals i l in let cst = globals.constants.(i) in (match cst, Code.Var.get_name x with | (String str | IString str), None -> Code.Var.name x (Printf.sprintf "cst_%s" str) | _ -> ()); Let (x, Constant cst) :: l | Some name -> Var.name x name; Let (x, Prim (Extern "caml_js_get", [ Pv gdata; Pc (IString name) ])) :: l ) | _ -> l) in let body = Let (gdata, Prim (Extern "caml_get_global_data", [])) :: body in let cmis = if toplevel && Config.Flag.include_cmis () then List.fold_left l ~init:StringSet.empty ~f:(fun acc (compunit, _) -> StringSet.add compunit.Cmo_format.cu_name acc) else StringSet.empty in { code = prepend prog body; cmis; debug = debug_data } let from_cmo ?(includes = []) ?(toplevel = false) ?(debug = false) compunit ic = let debug_data = Debug.create ~toplevel debug in seek_in ic compunit.Cmo_format.cu_pos; let code = Bytes.create compunit.Cmo_format.cu_codesize in really_input ic code 0 compunit.Cmo_format.cu_codesize; if (not (Debug.dbg_section_needed debug_data)) || compunit.Cmo_format.cu_debug = 0 then () else ( seek_in ic compunit.Cmo_format.cu_debug; Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:0 ic); let p = from_compilation_units ~toplevel ~includes ~debug_data [ compunit, code ] in Code.invariant p.code; p let from_cma ?(includes = []) ?(toplevel = false) ?(debug = false) lib ic = let debug_data = Debug.create ~toplevel debug in let orig = ref 0 in let units = List.map lib.Cmo_format.lib_units ~f:(fun compunit -> seek_in ic compunit.Cmo_format.cu_pos; let code = Bytes.create compunit.Cmo_format.cu_codesize in really_input ic code 0 compunit.Cmo_format.cu_codesize; if (not (Debug.dbg_section_needed debug_data)) || compunit.Cmo_format.cu_debug = 0 then () else ( seek_in ic compunit.Cmo_format.cu_debug; Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:!orig ic); orig := !orig + compunit.Cmo_format.cu_codesize; compunit, code) in let p = from_compilation_units ~toplevel ~includes ~debug_data units in Code.invariant p.code; p let from_channel ic = let format = try let header = really_input_string ic Magic_number.size in `Pre (Magic_number.of_string header) with _ -> let pos_magic = in_channel_length ic - Magic_number.size in seek_in ic pos_magic; let header = really_input_string ic Magic_number.size in `Post (Magic_number.of_string header) in match format with | `Pre magic -> ( match Magic_number.kind magic with | `Cmo -> if Config.Flag.check_magic () && not (Magic_number.equal magic Magic_number.current_cmo) then raise Magic_number.(Bad_magic_version magic); let compunit_pos = input_binary_int ic in seek_in ic compunit_pos; let compunit : Cmo_format.compilation_unit = input_value ic in `Cmo compunit | `Cma -> if Config.Flag.check_magic () && not (Magic_number.equal magic Magic_number.current_cma) then raise Magic_number.(Bad_magic_version magic); let pos_toc = input_binary_int ic in (* Go to table of contents *) seek_in ic pos_toc; let lib : Cmo_format.library = input_value ic in `Cma lib | _ -> raise Magic_number.(Bad_magic_number (to_string magic))) | `Post magic -> ( match Magic_number.kind magic with | `Exe -> if Config.Flag.check_magic () && not (Magic_number.equal magic Magic_number.current_exe) then raise Magic_number.(Bad_magic_version magic); `Exe | _ -> raise Magic_number.(Bad_magic_number (to_string magic))) let predefined_exceptions () = let body = let open Code in List.map predefined_exceptions ~f:(fun (index, name) -> let exn = Var.fresh () in let v_name = Var.fresh () in let v_name_js = Var.fresh () in let v_index = Var.fresh () in [ Let (v_name, Constant (String name)) ; Let (v_name_js, Prim (Extern "caml_js_from_string", [ Pc (IString name) ])) ; Let (v_index, Constant (Int (Int32.of_int (-index)))) ; Let (exn, Block (248, [| v_name; v_index |], NotArray)) ; Let ( Var.fresh () , Prim ( Extern "caml_register_global" , [ Pc (Int (Int32.of_int index)); Pv exn; Pv v_name_js ] ) ) ]) |> List.concat in let block = { params = []; handler = None; body; branch = Stop } in 0, Addr.Map.singleton 0 block, 1 js_of_ocaml-3.5.2/compiler/lib/parse_bytecode.mli000066400000000000000000000035531357507750000220660ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Stdlib module Debug : sig type t val create : toplevel:bool -> bool -> t val find_loc : t -> ?after:bool -> int -> Parse_info.t option val is_empty : t -> bool val paths : t -> units:StringSet.t -> StringSet.t end type one = { code : Code.program ; cmis : StringSet.t ; debug : Debug.t } val from_exe : ?includes:string list -> ?toplevel:bool -> ?exported_unit:string list -> ?dynlink:bool -> ?debug:bool -> in_channel -> one val from_cmo : ?includes:string list -> ?toplevel:bool -> ?debug:bool -> Cmo_format.compilation_unit -> in_channel -> one val from_cma : ?includes:string list -> ?toplevel:bool -> ?debug:bool -> Cmo_format.library -> in_channel -> one val from_channel : in_channel -> [ `Cmo of Cmo_format.compilation_unit | `Cma of Cmo_format.library | `Exe ] val from_string : string array -> string -> Code.program * Debug.t val predefined_exceptions : unit -> Code.program js_of_ocaml-3.5.2/compiler/lib/parse_info.ml000066400000000000000000000101711357507750000210440ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type t = { src : string option ; name : string option ; col : int ; line : int ; idx : int ; fol : bool option } let zero = { src = None; name = None; col = 0; line = 0; idx = 0; fol = None } module Line_info = struct type t_above = t type t = { mutable acc_pos : int ; mutable acc_line : int ; offset : t_above option ; lines : int array ; name : string option ; src : string option } let rec compute lines acc line pos = if line >= Array.length lines then if pos = 0 then acc, line, 0 else assert false else if lines.(line) >= pos then acc, line, pos else compute lines (acc + lines.(line) + 1) (succ line) (pos - lines.(line) - 1) let get t pos = let acc, line, pos = if t.acc_pos <= pos then compute t.lines t.acc_pos t.acc_line (pos - t.acc_pos) else compute t.lines 0 0 pos in t.acc_pos <- acc; t.acc_line <- line; line, pos let from_file file = let ic = open_in file in let lines = ref [] in (try while true do lines := String.length (input_line ic) :: !lines done with End_of_file -> ()); let lines = Array.of_list (List.rev !lines) in let t = { acc_pos = 0 ; acc_line = 0 ; offset = None ; lines ; name = Some file ; src = Some file } in close_in ic; t let from_string ?offset str = let pos = ref 0 and lines = ref [] in (try while true do let idx = String.index_from str !pos '\n' in lines := (idx - !pos) :: !lines; pos := idx + 1 done with Not_found -> lines := (String.length str - !pos) :: !lines); let lines = Array.of_list (List.rev !lines) in { acc_pos = 0; acc_line = 0; offset; lines; name = None; src = None } let from_channel ic = let buf = Buffer.create 1024 in let lines = ref [] in (try while true do let l = input_line ic in Buffer.add_string buf l; Buffer.add_char buf '\n'; lines := String.length l :: !lines done with End_of_file -> ()); let lines = Array.of_list (List.rev !lines) in let t = { acc_pos = 0; acc_line = 0; offset = None; lines; name = None; src = None } in t, Buffer.contents buf end type lineinfo = Line_info.t let relative_path { Line_info.src; _ } file = match src with | None -> None | Some src -> Some Filename.(concat (dirname src) file) let make_lineinfo_from_file file = Line_info.from_file file let make_lineinfo_from_string ?offset str = Line_info.from_string ?offset str let make_lineinfo_from_channel c = Line_info.from_channel c let t_of_lexbuf line_info lexbuf : t = let idx = lexbuf.Lexing.lex_start_p.Lexing.pos_cnum in let line, col = Line_info.get line_info idx in let line, col = match line_info.Line_info.offset with | None -> line, col | Some { line = line_offset; col = col_offset; _ } -> line + line_offset, col + col_offset in let name = match line_info.Line_info.offset with | Some { name = Some _ as name; _ } -> name | _ -> line_info.Line_info.name in let src = match line_info.Line_info.offset with | Some { src = Some _ as src; _ } -> src | _ -> line_info.Line_info.src in { fol = None; idx; line; col; name; src } js_of_ocaml-3.5.2/compiler/lib/parse_info.mli000066400000000000000000000024371357507750000212230ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type t = { src : string option ; name : string option ; col : int ; line : int ; idx : int ; fol : bool option } val zero : t type lineinfo val make_lineinfo_from_file : string -> lineinfo val make_lineinfo_from_string : ?offset:t -> string -> lineinfo val make_lineinfo_from_channel : in_channel -> lineinfo * string val relative_path : lineinfo -> string -> string option val t_of_lexbuf : lineinfo -> Lexing.lexbuf -> t js_of_ocaml-3.5.2/compiler/lib/parse_js.ml000066400000000000000000000143661357507750000205370ustar00rootroot00000000000000(* Js_of_ocaml compiler * Copyright (C) 2013 Hugo Heuzard *) (* Yoann Padioleau * * Copyright (C) 2010 Facebook * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation, with the * special exception on linking described in file license.txt. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * license.txt for more details. *) open! Stdlib let strip_comment l = List.filter ~f:(fun x -> not (Js_token.is_comment x)) l let rec until_non_comment acc = function | [] -> acc, None | x :: xs -> if Js_token.is_comment x then until_non_comment (x :: acc) xs else acc, Some (x, xs) let adjust_tokens ?(keep_comment = true) l = match until_non_comment [] l with | acc, None when keep_comment -> List.rev acc | _, None -> [] | past, Some (first, rest) -> let open Js_token in let f prev x acc = match prev, x with (* restricted productions *) (* 7.9.1 - 3 *) (* When, as the program is parsed from left to right, a token is encountered *) (* that is allowed by some production of the grammar, but the production *) (* is a restricted production and the token would be the first token for a *) (* terminal or nonterminal immediately following the annotation [no LineTerminator here] *) (* within the restricted production (and therefore such a token is called a restricted token), *) (* and the restricted token is separated from the previous token by at least *) (* one LineTerminator, then a semicolon is automatically inserted before the *) (* restricted token. *) | ( (T_RETURN _ | T_CONTINUE _ | T_BREAK _ | T_THROW _) , (T_SEMICOLON _ | T_VIRTUAL_SEMICOLON _) ) -> x :: acc | (T_RETURN _ | T_CONTINUE _ | T_BREAK _ | T_THROW _), _ -> let x' = Js_token.info_of_tok x in let prev' = Js_token.info_of_tok prev in if prev'.Parse_info.line <> x'.Parse_info.line then x :: Js_token.T_VIRTUAL_SEMICOLON x' :: acc else x :: acc | _, _ -> x :: acc in let rec aux prev acc = function | [] -> List.rev acc | e :: l -> let nprev, nacc = if Js_token.is_comment e then if keep_comment then prev, e :: acc else prev, acc else e, f prev e acc in aux nprev nacc l in let past = if keep_comment then past else [] in aux first (first :: past) rest type lexer = Js_token.token list let lexer_aux ?(rm_comment = true) lines_info lexbuf = let rec loop lexbuf extra lines_info prev acc = let tokinfo lexbuf = let pi = Parse_info.t_of_lexbuf lines_info lexbuf in let pi = match prev with | None -> { pi with Parse_info.fol = Some true } | Some prev -> let prev_pi = Js_token.info_of_tok prev in if prev_pi.Parse_info.line <> pi.Parse_info.line then { pi with Parse_info.fol = Some true } else pi in match extra with | None -> pi | Some (file, offset) -> let src = Parse_info.relative_path lines_info file in { pi with Parse_info.src; name = Some file; line = pi.Parse_info.line - offset } in let t = Js_lexer.initial tokinfo prev lexbuf in match t with | Js_token.EOF _ -> List.rev acc | _ -> let extra = match t with | Js_token.TComment (ii, cmt) when String.is_prefix cmt ~prefix:"#" -> ( let lexbuf = Lexing.from_string cmt in try let file, line = Js_lexer.pos lexbuf in match extra with | None -> Some (file, ii.Parse_info.line - (line - 2)) | Some (_, offset) -> Some (file, ii.Parse_info.line - (line - 2) + offset) with _ -> extra) | _ -> extra in let prev = if Js_token.is_comment t then prev else Some t in loop lexbuf extra lines_info prev (t :: acc) in let toks = loop lexbuf None lines_info None [] in (* hack: adjust tokens *) adjust_tokens ~keep_comment:(not rm_comment) toks let lexer_from_file ?rm_comment file : lexer = let lines_info = Parse_info.make_lineinfo_from_file file in let ic = open_in file in let lexbuf = Lexing.from_channel ic in let lexer = lexer_aux ?rm_comment lines_info lexbuf in close_in ic; lexer let lexer_from_channel ?rm_comment ci : lexer = let lines_info, str = Parse_info.make_lineinfo_from_channel ci in let lexbuf = Lexing.from_string str in lexer_aux ?rm_comment lines_info lexbuf let lexer_from_string ?rm_comment ?offset str : lexer = let lines_info = Parse_info.make_lineinfo_from_string ?offset str in let lexbuf = Lexing.from_string str in lexer_aux ?rm_comment lines_info lexbuf let lexer_map f = List.map ~f let lexer_fold f acc l = List.fold_left ~f ~init:acc l let lexer_filter f l = List.filter ~f l let lexer_from_list l = adjust_tokens l exception Parsing_error of Parse_info.t type st = { mutable rest : Js_token.token list ; mutable current : Js_token.token ; mutable passed : Js_token.token list ; mutable eof : bool } let parse_aux the_parser toks = let state = match toks with | [] -> { rest = []; passed = []; current = Js_token.EOF Parse_info.zero; eof = false } | hd :: _ -> { rest = toks; passed = []; current = hd; eof = false } in let lexer_fun _lb = match state.rest with | [] when not state.eof -> state.eof <- true; let info = Js_token.info_of_tok state.current in Js_token.EOF info | [] -> assert false | x :: tl -> state.rest <- tl; state.current <- x; state.passed <- x :: state.passed; x in let lexbuf = Lexing.from_string "" in try the_parser lexer_fun lexbuf with Js_parser.Error | Parsing.Parse_error -> let pi = Js_token.info_of_tok state.current in raise (Parsing_error pi) let parse lex = parse_aux Js_parser.program lex let parse_expr lex = parse_aux Js_parser.standalone_expression lex js_of_ocaml-3.5.2/compiler/lib/parse_js.mli000066400000000000000000000027441357507750000207050ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type lexer exception Parsing_error of Parse_info.t val strip_comment : lexer -> lexer val lexer_from_file : ?rm_comment:bool -> string -> lexer val lexer_from_string : ?rm_comment:bool -> ?offset:Parse_info.t -> string -> lexer val lexer_from_channel : ?rm_comment:bool -> in_channel -> lexer val lexer_map : (Js_token.token -> Js_token.token) -> lexer -> lexer val lexer_fold : ('a -> Js_token.token -> 'a) -> 'a -> lexer -> 'a val lexer_filter : (Js_token.token -> bool) -> lexer -> lexer val lexer_from_list : Js_token.token list -> lexer val parse : lexer -> Javascript.program val parse_expr : lexer -> Javascript.expression js_of_ocaml-3.5.2/compiler/lib/phisimpl.ml000066400000000000000000000117271357507750000205540ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let times = Debug.find "times" open Code (****) let add_var = Var.ISet.add let add_def vars defs x y = add_var vars x; let idx = Var.idx x in defs.(idx) <- Var.Set.add y defs.(idx) let add_dep deps x y = let idx = Var.idx y in deps.(idx) <- Var.Set.add x deps.(idx) let rec arg_deps vars deps defs params args = match params, args with | x :: params, y :: args -> add_dep deps x y; add_def vars defs x y; arg_deps vars deps defs params args | _ -> () let cont_deps blocks vars deps defs (pc, args) = let block = Addr.Map.find pc blocks in arg_deps vars deps defs block.params args let expr_deps blocks vars deps defs x e = match e with | Const _ | Constant _ | Apply _ | Prim _ -> () | Closure (_, cont) -> cont_deps blocks vars deps defs cont | Block (_, a, _) -> Array.iter a ~f:(fun y -> add_dep deps x y) | Field (y, _) -> add_dep deps x y let program_deps (_, blocks, _) = let nv = Var.count () in let vars = Var.ISet.empty () in let deps = Array.make nv Var.Set.empty in let defs = Array.make nv Var.Set.empty in Addr.Map.iter (fun _pc block -> List.iter block.body ~f:(fun i -> match i with | Let (x, e) -> add_var vars x; expr_deps blocks vars deps defs x e | Set_field _ | Array_set _ | Offset_ref _ -> ()); Option.iter block.handler ~f:(fun (_, cont) -> cont_deps blocks vars deps defs cont); match block.branch with | Return _ | Raise _ | Stop -> () | Branch cont -> cont_deps blocks vars deps defs cont | Cond (_, _, cont1, cont2) -> cont_deps blocks vars deps defs cont1; cont_deps blocks vars deps defs cont2 | Switch (_, a1, a2) -> Array.iter a1 ~f:(fun cont -> cont_deps blocks vars deps defs cont); Array.iter a2 ~f:(fun cont -> cont_deps blocks vars deps defs cont) | Pushtrap (cont, _, _, _) -> cont_deps blocks vars deps defs cont | Poptrap (cont, _) -> cont_deps blocks vars deps defs cont) blocks; vars, deps, defs let rec repr' reprs x acc = let idx = Var.idx x in match reprs.(idx) with | None -> x, acc | Some y -> repr' reprs y (x :: acc) let repr reprs x = let last, l = repr' reprs x [] in List.iter l ~f:(fun v -> reprs.(Var.idx v) <- Some last); last let replace deps reprs x y = let yidx = Var.idx y in let xidx = Var.idx x in deps.(yidx) <- Var.Set.union deps.(yidx) deps.(xidx); reprs.(xidx) <- Some y; true let propagate1 deps defs reprs st x = let prev = Var.Tbl.get st x in if prev then prev else let idx = Var.idx x in let s = Var.Set.fold (fun x s -> Var.Set.add (repr reprs x) s) defs.(idx) Var.Set.empty in defs.(idx) <- s; match Var.Set.cardinal s with | 1 -> replace deps reprs x (Var.Set.choose s) | 2 -> ( match Var.Set.elements s with | [ y; z ] when Var.compare x y = 0 -> replace deps reprs x z | [ z; y ] when Var.compare x y = 0 -> replace deps reprs x z | _ -> false) | _ -> false module G = Dgraph.Make_Imperative (Var) (Var.ISet) (Var.Tbl) module Domain1 = struct type t = bool let equal = Bool.equal let bot = false end module Solver1 = G.Solver (Domain1) let solver1 vars deps defs = let nv = Var.count () in let reprs = Array.make nv None in let g = { G.domain = vars; G.iter_children = (fun f x -> Var.Set.iter f deps.(Var.idx x)) } in ignore (Solver1.f () g (propagate1 deps defs reprs)); Array.mapi reprs ~f:(fun idx y -> match y with | Some y -> let y = repr reprs y in if Var.idx y = idx then None else Some y | None -> None) let f p = let t = Timer.make () in let t' = Timer.make () in let vars, deps, defs = program_deps p in if times () then Format.eprintf " phi-simpl. 1: %a@." Timer.print t'; let t' = Timer.make () in let subst = solver1 vars deps defs in if times () then Format.eprintf " phi-simpl. 2: %a@." Timer.print t'; let p = Subst.program (Subst.from_array subst) p in if times () then Format.eprintf " phi-simpl.: %a@." Timer.print t; p js_of_ocaml-3.5.2/compiler/lib/phisimpl.mli000066400000000000000000000017011357507750000207140ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Code.program -> Code.program js_of_ocaml-3.5.2/compiler/lib/pretty_print.ml000066400000000000000000000152261357507750000214700ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type pos = { mutable p_line : int ; mutable p_col : int } type elt = | Text of string | Break of string * int | Start_group of int | End_group | Set_pos of pos type t = { mutable indent : int ; mutable box_indent : int ; mutable prev_indents : (int * int) list ; mutable limit : int ; mutable cur : int ; mutable l : elt list ; mutable n : int ; mutable w : int ; mutable compact : bool ; mutable needed_space : (char -> char -> bool) option ; mutable pending_space : string option ; mutable last_char : char option ; mutable line : int ; mutable col : int ; mutable total : int ; output : string -> int -> int -> unit } let spaces = String.make 80 ' ' let output st (s : string) l = (try let last = String.rindex_from s (l - 1) '\n' + 1 in let line = ref 0 in for i = 0 to l - 1 do if Char.equal s.[i] '\n' then incr line done; st.line <- st.line + !line; st.col <- l - last with Not_found -> st.col <- l + st.col); st.total <- st.total + String.length s; st.output s 0 l let rec output_spaces st n = output st spaces (min n 80); if n > 80 then output_spaces st (n - 80) let output_newline st = output st "\n" 1 let rec flat_render st l = match l with | Text s :: r | Break (s, _) :: r -> output st s (String.length s); flat_render st r | Set_pos p :: r -> p.p_line <- st.line; p.p_col <- st.col; flat_render st r | (Start_group _ | End_group) :: r -> flat_render st r | [] -> () let rec push st e = if st.n = 0 then ( (* Vertical rendering *) match e with | Text s -> output st s (String.length s); st.cur <- st.cur + String.length s | Set_pos p -> p.p_line <- st.line; p.p_col <- st.col | Break (_, offs) -> output_newline st; let indent = st.box_indent + offs in st.indent <- indent; output_spaces st indent; st.limit <- max (indent + 60) 78; st.cur <- st.indent | Start_group n -> st.n <- 1; st.w <- st.limit - st.cur; st.prev_indents <- (st.box_indent, st.indent) :: st.prev_indents; st.indent <- st.indent + n; st.box_indent <- st.indent | End_group -> st.box_indent <- fst (List.hd st.prev_indents); st.indent <- snd (List.hd st.prev_indents); st.prev_indents <- List.tl st.prev_indents) else ( (* Fits? *) st.l <- e :: st.l; match e with | Text s | Break (s, _) -> let w = st.w - String.length s in st.w <- w; if w < 0 then ( let l = List.rev st.l in st.l <- []; st.n <- 0; List.iter ~f:(fun e -> push st e) l) | Set_pos _ -> () | Start_group _ -> st.n <- st.n + 1 | End_group -> st.n <- st.n - 1; if st.n = 0 then ( flat_render st (List.rev st.l); st.box_indent <- fst (List.hd st.prev_indents); st.indent <- snd (List.hd st.prev_indents); st.prev_indents <- List.tl st.prev_indents; st.cur <- st.cur + st.w; st.l <- [])) (****) let string st (s : string) = if st.compact then ( let len = String.length s in if len <> 0 then ( (match st.pending_space with | None -> () | Some sp -> ( st.pending_space <- None; match st.last_char, st.needed_space with | Some last, Some f -> if f last s.[0] then output st sp 1 | _, None -> output st sp 1 | _ -> ())); output st s len; st.last_char <- Some s.[len - 1])) else push st (Text s) let genbreak st s n = if not st.compact then push st (Break (s, n)) let break_token = Break ("", 0) let break st = if not st.compact then push st break_token let break1 st = if not st.compact then push st (Break ("", 1)) let non_breaking_space_token = Text " " let non_breaking_space st = if st.compact then st.pending_space <- Some " " else push st non_breaking_space_token let space ?(indent = 0) st = if st.compact then st.pending_space <- Some "\n" else push st (Break (" ", indent)) let start_group st n = if not st.compact then push st (Start_group n) let end_group st = if not st.compact then push st End_group (* let render l = let st = { indent = 0; box_indent = 0; prev_indents = []; limit = 78; cur = 0; l = []; n = 0; w = 0; output = fun s i l -> output stdout s i l } in push st (Start_group 0); List.iter (fun e -> push st e) l; push st End_group; output_newline st let rec tree n = if n = 0 then [Text "Leaf"] else [Start_group 10; Text "Node.... ("] @ tree (n - 1) @ [Text ","; Break (" ", 0)] @ tree (n - 1) @ [Text ")"; End_group] let _ = for i = 1 to 10 do render (tree i) done *) let total t = t.total let pos t = if t.compact then { p_line = t.line; p_col = t.col } else let p = { p_line = -1; p_col = -1 } in push t (Set_pos p); p let newline st = output_newline st; st.indent <- 0; st.box_indent <- 0; st.prev_indents <- []; st.cur <- 0; st.l <- []; st.n <- 0; st.w <- 0 let to_out_channel ch = { indent = 0 ; box_indent = 0 ; prev_indents = [] ; limit = 78 ; cur = 0 ; l = [] ; n = 0 ; w = 0 ; col = 0 ; line = 0 ; total = 0 ; compact = false ; pending_space = None ; last_char = None ; needed_space = None ; output = output_substring ch } let to_buffer b = { indent = 0 ; box_indent = 0 ; prev_indents = [] ; limit = 78 ; cur = 0 ; l = [] ; n = 0 ; w = 0 ; col = 0 ; line = 0 ; total = 0 ; compact = false ; pending_space = None ; last_char = None ; needed_space = None ; output = (fun s i l -> Buffer.add_substring b s i l) } let set_compact st v = st.compact <- v let set_needed_space_function st f = st.needed_space <- Some f js_of_ocaml-3.5.2/compiler/lib/pretty_print.mli000066400000000000000000000027341357507750000216410ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type t type pos = { mutable p_line : int ; mutable p_col : int } val string : t -> string -> unit val genbreak : t -> string -> int -> unit val break : t -> unit val break1 : t -> unit val non_breaking_space : t -> unit val space : ?indent:int -> t -> unit val start_group : t -> int -> unit val end_group : t -> unit val newline : t -> unit val to_out_channel : out_channel -> t val to_buffer : Buffer.t -> t val pos : t -> pos val total : t -> int val set_compact : t -> bool -> unit val set_needed_space_function : t -> (char -> char -> bool) -> unit js_of_ocaml-3.5.2/compiler/lib/primitive.ml000066400000000000000000000050741357507750000207350ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let aliases = Hashtbl.create 17 let rec resolve nm = try resolve (Hashtbl.find aliases nm) with Not_found -> nm (****) type kind = [ `Pure | `Mutable | `Mutator ] type kind_arg = [ `Shallow_const | `Object_literal | `Const | `Mutable ] type t = [ `Requires of Parse_info.t option * string list | `Provides of Parse_info.t option * string * kind * kind_arg list option | `Version of Parse_info.t option * ((int -> int -> bool) * string) list | `Weakdef of Parse_info.t option ] let kinds = Hashtbl.create 37 let kind_args_tbl = Hashtbl.create 37 let arities = Hashtbl.create 37 let kind nm = try Hashtbl.find kinds (resolve nm) with Not_found -> `Mutator let kind_args nm = try Some (Hashtbl.find kind_args_tbl (resolve nm)) with Not_found -> None let arity nm = Hashtbl.find arities (resolve nm) let has_arity nm a = try Hashtbl.find arities (resolve nm) = a with Not_found -> false let is_pure nm = Poly.(kind nm <> `Mutator) let exists p = Hashtbl.mem kinds p let externals = ref StringSet.empty let add_external name = externals := StringSet.add name !externals let is_external name = StringSet.mem name !externals let get_external () = !externals let register p k kargs arity = add_external p; (match arity with | Some a -> Hashtbl.add arities p a | _ -> ()); (match kargs with | Some k -> Hashtbl.add kind_args_tbl p k | _ -> ()); Hashtbl.add kinds p k let alias nm nm' = add_external nm'; add_external nm; Hashtbl.add aliases nm nm' let named_values = ref StringSet.empty let need_named_value s = StringSet.mem s !named_values let register_named_value s = named_values := StringSet.add s !named_values js_of_ocaml-3.5.2/compiler/lib/primitive.mli000066400000000000000000000035061357507750000211040ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Stdlib val is_pure : string -> bool val exists : string -> bool type kind = [ `Pure | `Mutable | `Mutator ] type kind_arg = [ `Shallow_const | `Object_literal | `Const | `Mutable ] type t = [ `Requires of Parse_info.t option * string list | `Provides of Parse_info.t option * string * kind * kind_arg list option | `Version of Parse_info.t option * ((int -> int -> bool) * string) list | `Weakdef of Parse_info.t option ] val kind : string -> kind val kind_args : string -> kind_arg list option val register : string -> kind -> kind_arg list option -> int option -> unit val arity : string -> int val has_arity : string -> int -> bool val alias : string -> string -> unit val resolve : string -> string val add_external : string -> unit val is_external : string -> bool val get_external : unit -> StringSet.t val need_named_value : string -> bool val register_named_value : string -> unit js_of_ocaml-3.5.2/compiler/lib/pseudoFs.ml000066400000000000000000000105711357507750000205130ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let expand_path exts real virt = let rec loop realfile virtfile acc = if try Sys.is_directory realfile with _ -> false then Array.fold_left (Sys.readdir realfile) ~init:acc ~f:(fun acc s -> loop (Filename.concat realfile s) (Filename.concat virtfile s) acc) else try let exmatch = try let b = Filename.basename realfile in let i = String.rindex b '.' in let e = String.sub b ~pos:(i + 1) ~len:(String.length b - i - 1) in List.mem e ~set:exts with Not_found -> List.mem "" ~set:exts in if List.is_empty exts || exmatch then (virtfile, realfile) :: acc else acc with exc -> warn "ignoring %s: %s@." realfile (Printexc.to_string exc); acc in loop real virt [] let list_files name paths = let name, virtname = match String.lsplit2 name ~on:':' with | Some (src, dest) -> if String.length dest > 0 && not (Char.equal dest.[0] '/') then failwith (Printf.sprintf "path '%s' for file '%s' must be absolute" dest src); let virtname = if Char.equal dest.[String.length dest - 1] '/' then dest ^ Filename.basename src else dest in src, virtname | None -> (* by default, files are store in /static/ directory *) name, "/static/" ^ Filename.basename name in let name, exts (* extensions filter *) = match String.lsplit2 name ~on:'=' with | Some (name, exts) -> name, String.split_char ~sep:',' exts | None -> name, [] in let file = if Filename.is_relative name then try Findlib.find_in_findlib_paths paths name with Not_found -> failwith (Printf.sprintf "file '%s' not found" name) else name in expand_path exts file virtname let find_cmi paths base = let name, filename = try let name = String.uncapitalize_ascii base ^ ".cmi" in name, Findlib.find_in_findlib_paths paths name with Not_found -> let name = String.capitalize_ascii base ^ ".cmi" in name, Findlib.find_in_findlib_paths paths name in Filename.concat "/static/cmis" name, filename let instr_of_name_content prim ~name ~content = let open Code in Let (Var.fresh (), Prim (Extern prim, [ Pc (IString name); Pc (IString content) ])) let embed_file ~name ~filename = instr_of_name_content "caml_create_file_extern" ~name ~content:(Fs.read_file filename) let init () = Code.(Let (Var.fresh (), Prim (Extern "caml_fs_init", []))) let f ~prim ~cmis ~files ~paths = let prim = match prim with | `caml_create_file -> "caml_create_file" | `caml_create_file_extern -> "caml_create_file_extern" in let cmi_files, missing_cmis = StringSet.fold (fun s (acc, missing) -> try let name, filename = find_cmi paths s in (name, Fs.read_file filename) :: acc, missing with Not_found -> acc, s :: missing) cmis ([], []) in if not (List.is_empty missing_cmis) then ( warn "Some OCaml interface files were not found.@."; warn "Use [-I dir_of_cmis] option to bring them into scope@."; (* [`ocamlc -where`/expunge in.byte out.byte moduleA moduleB ... moduleN] *) List.iter missing_cmis ~f:(fun nm -> warn " %s@." nm)); let other_files = List.map files ~f:(fun f -> List.map (list_files f paths) ~f:(fun (name, filename) -> name, Fs.read_file filename)) |> List.concat in List.map (other_files @ cmi_files) ~f:(fun (name, content) -> instr_of_name_content prim ~name ~content) js_of_ocaml-3.5.2/compiler/lib/pseudoFs.mli000066400000000000000000000021521357507750000206600ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Stdlib val f : prim:[ `caml_create_file | `caml_create_file_extern ] -> cmis:StringSet.t -> files:string list -> paths:string list -> Code.instr list val embed_file : name:string -> filename:string -> Code.instr val init : unit -> Code.instr js_of_ocaml-3.5.2/compiler/lib/pure_fun.ml000066400000000000000000000050111357507750000205370ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Code (****) let pure_expr pure_funs e = match e with | Const _ | Block _ | Field _ | Closure _ | Constant _ -> true | Apply (f, _l, exact) -> exact && Var.Set.mem f pure_funs | Prim (p, _l) -> ( match p with | Extern f -> Primitive.is_pure f | _ -> true) let pure_instr pure_funs i = match i with | Let (_, e) -> pure_expr pure_funs e | Set_field _ | Offset_ref _ | Array_set _ -> false (****) let rec traverse blocks pc visited funs = try Addr.Map.find pc visited, visited, funs with Not_found -> let visited = Addr.Map.add pc false visited in let pure, visited, funs = fold_children blocks pc (fun pc (pure, visited, funs) -> let pure', visited, funs = traverse blocks pc visited funs in pure && pure', visited, funs) (true, visited, funs) in let pure, visited, funs = block blocks pc pure visited funs in pure, Addr.Map.add pc pure visited, funs and block blocks pc pure visited funs = let b = Addr.Map.find pc blocks in let pure = match b.branch with | Raise _ -> false | _ -> pure in List.fold_left b.body ~init:(pure, visited, funs) ~f:(fun (pure, visited, funs) i -> let visited, funs = match i with | Let (x, Closure (_, (pc, _))) -> let pure, visited, funs = traverse blocks pc visited funs in visited, if pure then Var.Set.add x funs else funs | _ -> visited, funs in pure && pure_instr funs i, visited, funs) let f (pc, blocks, _) = let _, _, funs = traverse blocks pc Addr.Map.empty Var.Set.empty in funs js_of_ocaml-3.5.2/compiler/lib/pure_fun.mli000066400000000000000000000020571357507750000207170ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val pure_expr : Code.Var.Set.t -> Code.expr -> bool val pure_instr : Code.Var.Set.t -> Code.instr -> bool val f : Code.program -> Code.Var.Set.t js_of_ocaml-3.5.2/compiler/lib/reserved.ml000066400000000000000000000055651357507750000205510ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let keyword = List.fold_left ~f:(fun acc x -> StringSet.add x acc) ~init:StringSet.empty [ (* keyword *) "break" ; "case" ; "catch" ; "continue" ; "debugger" ; "default" ; "delete" ; "do" ; "else" ; "finally" ; "for" ; "function" ; "if" ; "in" ; "instanceof" ; "new" ; "return" ; "switch" ; "this" ; "throw" ; "try" ; "typeof" ; "var" ; "void" ; "while" ; "with" ; (* reserved in ECMAScript 5 *) "class" ; "enum" ; "export" ; "extends" ; "import" ; "super" ; "implements" ; "interface" ; "let" ; "package" ; "private" ; "protected" ; "public" ; "static" ; "yield" ; (* other *) "null" ; "true" ; "false" ; "NaN" ; "undefined" ; "this" ; (* Unexpected eval or arguments in strict mode *) "eval" ; "arguments" ; (* also reserved in ECMAScript 3 *) "abstract" ; "boolean" ; "byte" ; "char" ; "const" ; "double" ; "final" ; "float" ; "goto" ; "int" ; "long" ; "native" ; "short" ; "synchronized" ; "throws" ; "transient" ; "volatile" ; (* also reserved in ECMAScript 6 *) "await" ] let provided = List.fold_left ~f:(fun acc x -> StringSet.add x acc) ~init:StringSet.empty [ "event" ; "location" ; "window" ; "document" ; "eval" ; "navigator" ; "self" ; "Array" ; "Function" ; "Date" ; "Math" ; "JSON" ; "Object" ; "RegExp" ; "String" ; "Boolean" ; "Number" ; "Infinity" ; "isFinite" ; "ActiveXObject" ; "XMLHttpRequest" ; "XDomainRequest" ; "DOMException" ; "Error" ; "SyntaxError" ; "TypeError" ; "arguments" ; "decodeURI" ; "decodeURIComponent" ; "encodeURI" ; "encodeURIComponent" ; "escape" ; "unescape" ; "isNaN" ; "parseFloat" ; "parseInt" ; "module" ; "require" ] js_of_ocaml-3.5.2/compiler/lib/reserved.mli000066400000000000000000000016451357507750000207150ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Stdlib val keyword : StringSet.t val provided : StringSet.t js_of_ocaml-3.5.2/compiler/lib/source_map.ml000066400000000000000000000177371357507750000210730ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type map = { gen_line : int ; gen_col : int ; ori_source : int ; ori_line : int ; ori_col : int ; ori_name : int option } type mapping = map list type t = { version : int ; file : string ; sourceroot : string option ; mutable sources : string list ; mutable sources_content : string option list option ; mutable names : string list ; mutable mappings : mapping } let string_of_mapping mapping = let a = Array.of_list mapping in let len = Array.length a in Array.stable_sort ~cmp:(fun t1 t2 -> match compare t1.gen_line t2.gen_line with | 0 -> compare t1.gen_col t2.gen_col | n -> n) a; let buf = Buffer.create 1024 in let gen_line = ref 0 in let gen_col = ref 0 in let ori_source = ref 0 in let ori_line = ref 0 in let ori_col = ref 0 in let ori_name = ref 0 in let rec loop prev i = if i < len then let c = a.(i) in if prev >= 0 && c.ori_source = a.(prev).ori_source && c.ori_line = a.(prev).ori_line && c.ori_col = a.(prev).ori_col then (* We already are at this location *) loop prev (i + 1) else if i + 1 < len && c.gen_line = a.(i + 1).gen_line && c.gen_col = a.(i + 1).gen_col then (* Only keep one source location per generated location *) loop prev (i + 1) else ( if !gen_line <> c.gen_line then ( assert (!gen_line < c.gen_line); for _i = !gen_line to c.gen_line - 1 do Buffer.add_char buf ';' done; gen_col := 0; gen_line := c.gen_line) else if i > 0 then Buffer.add_char buf ','; let l = (c.gen_col - !gen_col) :: (if c.ori_source = -1 then [] else (c.ori_source - !ori_source) :: (c.ori_line - !ori_line) :: (c.ori_col - !ori_col) :: (match c.ori_name with | None -> [] | Some n -> let n' = !ori_name in ori_name := n; [ n - n' ])) in gen_col := c.gen_col; if c.ori_source <> -1 then ( ori_source := c.ori_source; ori_line := c.ori_line; ori_col := c.ori_col); Vlq64.encode_l buf l; loop i (i + 1)) in loop (-1) 0; Buffer.contents buf let mapping_of_string str = let total_len = String.length str in let gen_col = ref 0 in let ori_source = ref 0 in let ori_line = ref 0 in let ori_col = ref 0 in let ori_name = ref 0 in let rec readline line pos acc = if pos >= total_len then acc else let last = try String.index_from str pos ';' with Not_found -> total_len in gen_col := 0; let pos, acc = read_tokens line pos last acc in readline (succ line) pos acc and read_tokens line start stop acc = let last = try min (String.index_from str start ',') stop with Not_found -> stop in let v = Vlq64.decode_l str ~pos:start ~len:(last - start) in match v with | [] -> last + 1, acc | v -> let v = match v with | [ g ] -> gen_col := !gen_col + g; { gen_line = line ; gen_col = !gen_col ; ori_source = -1 ; ori_line = -1 ; ori_col = -1 ; ori_name = None } | [ g; os; ol; oc ] -> gen_col := !gen_col + g; ori_source := !ori_source + os; ori_line := !ori_line + ol; ori_col := !ori_col + oc; { gen_line = line ; gen_col = !gen_col ; ori_source = !ori_source ; ori_line = !ori_line ; ori_col = !ori_col ; ori_name = None } | [ g; os; ol; oc; on ] -> gen_col := !gen_col + g; ori_source := !ori_source + os; ori_line := !ori_line + ol; ori_col := !ori_col + oc; ori_name := !ori_name + on; { gen_line = line ; gen_col = !gen_col ; ori_source = !ori_source ; ori_line = !ori_line ; ori_col = !ori_col ; ori_name = Some !ori_name } | _ -> invalid_arg "Source_map.mapping_of_string" in let acc = v :: acc in if last = stop then last + 1, acc else read_tokens line (last + 1) stop acc in readline 0 0 [] let () = let map_str = ";;;;EAEE,EAAE,EAAC,CAAE;ECQY,UACC" in let map = mapping_of_string map_str in let map_str' = string_of_mapping map in (* let map' = mapping_of_string map_str' in *) assert (String.equal map_str map_str') let merge_sources_content a b = match a, b with | Some a, Some b -> Some (a @ b) | _ -> None let maps ~gen_line_offset ~sources_offset ~names_offset x = let gen_line = x.gen_line + gen_line_offset in let ori_source = x.ori_source + sources_offset in let ori_name = match x.ori_name with | None -> None | Some ori_name -> Some (ori_name + names_offset) in { x with gen_line; ori_source; ori_name } let merge = function | [] -> None | (gen_line_offset, _file, x) :: rest -> let rec loop acc ~sources_offset ~names_offset l = match l with | [] -> acc | (gen_line_offset, _, sm) :: rest -> let acc = { acc with sources = acc.sources @ sm.sources ; names = acc.names @ sm.names ; sources_content = merge_sources_content acc.sources_content sm.sources_content ; mappings = acc.mappings @ List.map ~f:(maps ~gen_line_offset ~sources_offset ~names_offset) sm.mappings } in loop acc ~sources_offset:(sources_offset + List.length sm.sources) ~names_offset:(names_offset + List.length sm.names) rest in let acc = { x with mappings = List.map ~f:(maps ~gen_line_offset ~sources_offset:0 ~names_offset:0) x.mappings } in Some (loop acc ~sources_offset:(List.length x.sources) ~names_offset:(List.length x.names) rest) (* let empty = { version = 3; file = "file"; sourceroot = None; sources = []; sources_content = None; names = []; mappings = [] } let gen (gen_line, gen_col) (ori_line, ori_col) ori_source = { gen_line; gen_col; ori_source; ori_line; ori_col; ori_name = None; } let s1 = { empty with names = ["na";"nb";"nc"]; sources = ["sa";"sb"]; mappings = [ gen (1,1) (10,10) 1; gen (3,3) (20,20) 2; ] } let s2 = { empty with names = ["na2";"nb2"]; sources = ["sa2"]; mappings = [ gen (3,3) (5,5) 1; ] } let () = let m = merge [(0,"",s1);(20,"",s2)] in begin match m with | None -> () | Some sm -> assert (string_of_mapping sm.mappings = ";CCUU;;GCUU;;;;;;;;;;;;;;;;;;;;GCff") end; *) js_of_ocaml-3.5.2/compiler/lib/source_map.mli000066400000000000000000000025651357507750000212350ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type map = { gen_line : int ; gen_col : int ; ori_source : int ; ori_line : int ; ori_col : int ; ori_name : int option } type mapping = map list type t = { version : int ; file : string ; sourceroot : string option ; mutable sources : string list ; mutable sources_content : string option list option ; mutable names : string list ; mutable mappings : mapping } val merge : (int * string * t) list -> t option val mapping_of_string : string -> mapping val string_of_mapping : mapping -> string js_of_ocaml-3.5.2/compiler/lib/source_map_io.mli000066400000000000000000000017441357507750000217220ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Source_map val enabled : bool val to_string : t -> string val to_file : t -> string -> unit val of_string : string -> t js_of_ocaml-3.5.2/compiler/lib/source_map_unsupported.ml.in000066400000000000000000000020001357507750000241210ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) let fail () = failwith "Sourcemap support not available" let to_string _ = fail () let of_string _ = fail () let to_file _ _ = fail () let enabled = false js_of_ocaml-3.5.2/compiler/lib/source_map_yojson.ml.in000066400000000000000000000077601357507750000230740ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Source_map (* copied from ocaml/utils/misc.ml *) let get_build_path_prefix_map = let init = ref false in let map_cache = ref None in fun () -> if not !init then begin init := true; match Sys.getenv "BUILD_PATH_PREFIX_MAP" with | exception Not_found -> () | encoded_map -> match Build_path_prefix_map.decode_map encoded_map with | Error err -> failwith @@ Printf.sprintf "Invalid value for the environment variable \ BUILD_PATH_PREFIX_MAP: %s" err | Ok map -> map_cache := Some map end; !map_cache let json t = let rewrite_path path = if Filename.is_relative path then path else match get_build_path_prefix_map () with | Some map -> Build_path_prefix_map.rewrite map path | None -> path in `Assoc [ "version", `Float (float_of_int t.version); "file", `String (rewrite_path t.file); "sourceRoot", `String (match t.sourceroot with None -> "" | Some s -> rewrite_path s); "names", `List (List.map (fun s -> `String s) t.names); "mappings", `String (string_of_mapping t.mappings); "sources", `List (List.map (fun s -> `String (rewrite_path s)) t.sources); "sourcesContent",`List (match t.sources_content with | None -> [] | Some l -> List.map (function | None -> `Null | Some s -> `String s) l); ] let invalid () = invalid_arg "Source_map.of_json" let string name rest = try match List.assoc name rest with | `String s -> Some s | `Null -> None | _ -> invalid () with Not_found -> None let list_string name rest = try match List.assoc name rest with | `List l -> Some ( List.map (function | `String s -> s | _ -> invalid ()) l) | _ -> invalid () with Not_found -> None let list_string_opt name rest = try match List.assoc name rest with | `List l -> Some (List.map (function | `String s -> Some s | `Null -> None | _ -> invalid ()) l) | _ -> invalid () with Not_found -> None let of_json json = match json with | `Assoc (("version", `Float version) :: rest) when int_of_float version = 3 -> let def v d = match v with None -> d | Some v -> v in let file = string "file" rest in let sourceroot = string "sourceRoot" rest in let names = list_string "names" rest in let sources = list_string "sources" rest in let sources_content = list_string_opt "sourcesContent" rest in let mappings = string "mappings" rest in { version = int_of_float version; file = def file ""; sourceroot; names = def names []; sources_content = sources_content; sources = def sources []; mappings = mapping_of_string (def mappings ""); } | _ -> invalid () let of_string s = of_json (Yojson.Basic.from_string s) let to_string m = Yojson.Basic.to_string (json m) let to_file m file = Yojson.Basic.to_file file (json m) let enabled = true js_of_ocaml-3.5.2/compiler/lib/specialize.ml000066400000000000000000000071301357507750000210500ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Code open Flow let rec function_cardinality info x acc = get_approx info (fun x -> match info.info_defs.(Var.idx x) with | Expr (Closure (l, _)) -> Some (List.length l) | Expr (Prim (Extern "%closure", [ Pc (IString prim) ])) -> ( try Some (Primitive.arity prim) with Not_found -> None) | Expr (Apply (f, l, _)) -> ( if List.mem f ~set:acc then None else match function_cardinality info f (f :: acc) with | Some n -> let diff = n - List.length l in if diff > 0 then Some diff else None | None -> None) | _ -> None) None (fun u v -> match u, v with | Some n, Some m when n = m -> u | _ -> None) x let specialize_instr info (acc, free_pc, extra) i = match i with | Let (x, Apply (f, l, _)) when Config.Flag.optcall () -> ( let n' = List.length l in match function_cardinality info f [] with | None -> i :: acc, free_pc, extra | Some n when n = n' -> Let (x, Apply (f, l, true)) :: acc, free_pc, extra | Some n when n < n' -> let v = Code.Var.fresh () in let args, rest = Stdlib.List.take n l in ( Let (v, Apply (f, args, true)) :: Let (x, Apply (v, rest, false)) :: acc , free_pc , extra ) | Some n when n > n' -> let missing = Array.init (n - n') ~f:(fun _ -> Code.Var.fresh ()) in let missing = Array.to_list missing in let block = let params' = Array.init (n - n') ~f:(fun _ -> Code.Var.fresh ()) in let params' = Array.to_list params' in let return' = Code.Var.fresh () in { params = params' ; body = [ Let (return', Apply (f, l @ params', true)) ] ; branch = Return return' ; handler = None } in ( Let (x, Closure (missing, (free_pc, missing))) :: acc , free_pc + 1 , (free_pc, block) :: extra ) | _ -> i :: acc, free_pc, extra) | _ -> i :: acc, free_pc, extra let specialize_instrs info (pc, blocks, free_pc) = let blocks, free_pc = Addr.Map.fold (fun pc block (blocks, free_pc) -> let body, free_pc, extra = List.fold_right block.body ~init:([], free_pc, []) ~f:(fun i acc -> specialize_instr info acc i) in let blocks = List.fold_left extra ~init:blocks ~f:(fun blocks (pc, b) -> Addr.Map.add pc b blocks) in Addr.Map.add pc { block with Code.body } blocks, free_pc) blocks (Addr.Map.empty, free_pc) in pc, blocks, free_pc let f info p = specialize_instrs info p js_of_ocaml-3.5.2/compiler/lib/specialize.mli000066400000000000000000000017161357507750000212250ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Flow.info -> Code.program -> Code.program js_of_ocaml-3.5.2/compiler/lib/specialize_js.ml000066400000000000000000000212431357507750000215450ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Code open Flow let specialize_instr info i rem = match i with | Let (x, Prim (Extern "caml_format_int", [ y; z ])) -> (match the_string_of info y with | Some "%d" -> ( match the_int info z with | Some i -> Let (x, Constant (String (Int32.to_string i))) | None -> Let (x, Prim (Extern "%caml_format_int_special", [ z ]))) | _ -> i) :: rem | Let (x, Prim (Extern "%caml_format_int_special", [ z ])) -> (match the_int info z with | Some i -> Let (x, Constant (String (Int32.to_string i))) | None -> i) :: rem | Let ( x , Prim (Extern (("caml_js_var" | "caml_js_expr" | "caml_pure_js_expr") as prim), [ y ]) ) -> (match the_string_of info y with | Some s -> Let (x, Prim (Extern prim, [ Pc (String s) ])) | _ -> i) :: rem | Let (x, Prim (Extern ("caml_register_named_value" as prim), [ y; z ])) -> (match the_string_of info y with | Some s when Primitive.need_named_value s -> Let (x, Prim (Extern prim, [ Pc (String s); z ])) | Some _ -> (* Format.eprintf "Do not register named value %S@." s; *) Let (x, Constant (Int 0l)) | None -> i) :: rem | Let (x, Prim (Extern "caml_js_call", [ f; o; a ])) -> (match the_def_of info a with | Some (Block (_, a, _)) -> let a = Array.map a ~f:(fun x -> Pv x) in Let (x, Prim (Extern "%caml_js_opt_call", f :: o :: Array.to_list a)) | _ -> i) :: rem | Let (x, Prim (Extern "caml_js_fun_call", [ f; a ])) -> (match the_def_of info a with | Some (Block (_, a, _)) -> let a = Array.map a ~f:(fun x -> Pv x) in Let (x, Prim (Extern "%caml_js_opt_fun_call", f :: Array.to_list a)) | _ -> i) :: rem | Let (x, Prim (Extern "caml_js_meth_call", [ o; m; a ])) -> (match the_string_of info m with | Some m -> ( match the_def_of info a with | Some (Block (_, a, _)) -> let a = Array.map a ~f:(fun x -> Pv x) in Let ( x , Prim ( Extern "%caml_js_opt_meth_call" , o :: Pc (String m) :: Array.to_list a ) ) | _ -> i) | _ -> i) :: rem | Let (x, Prim (Extern "caml_js_new", [ c; a ])) -> (match the_def_of info a with | Some (Block (_, a, _)) -> let a = Array.map a ~f:(fun x -> Pv x) in Let (x, Prim (Extern "%caml_js_opt_new", c :: Array.to_list a)) | _ -> i) :: rem | Let (x, Prim (Extern "caml_js_object", [ a ])) -> (try let a = match the_def_of info a with | Some (Block (_, a, _)) -> a | _ -> raise Exit in let a = Array.map a ~f:(fun x -> match the_def_of info (Pv x) with | Some (Block (_, [| k; v |], _)) -> let k = match the_string_of info (Pv k) with | Some s -> Pc (String s) | _ -> raise Exit in [ k; Pv v ] | _ -> raise Exit) in Let (x, Prim (Extern "%caml_js_opt_object", List.flatten (Array.to_list a))) with Exit -> i) :: rem | Let (x, Prim (Extern "caml_js_get", [ o; f ])) -> (match the_string_of info f with | Some s -> Let (x, Prim (Extern "caml_js_get", [ o; Pc (String s) ])) | _ -> i) :: rem | Let (x, Prim (Extern "caml_js_set", [ o; f; v ])) -> (match the_string_of info f with | Some s -> Let (x, Prim (Extern "caml_js_set", [ o; Pc (String s); v ])) | _ -> i) :: rem | Let (x, Prim (Extern "caml_js_delete", [ o; f ])) -> (match the_string_of info f with | Some s -> Let (x, Prim (Extern "caml_js_delete", [ o; Pc (String s) ])) | _ -> i) :: rem | Let (x, Prim (Extern "caml_js_from_string", [ y ])) -> (match the_string_of info y with | Some s when String.is_ascii s -> Let (x, Constant (IString s)) | _ -> i) :: rem | Let (x, Prim (Extern "%int_mul", [ y; z ])) -> (match the_int info y, the_int info z with | Some j, _ when Int32.(abs j < 0x200000l) -> Let (x, Prim (Extern "%direct_int_mul", [ y; z ])) | _, Some j when Int32.(abs j < 0x200000l) -> Let (x, Prim (Extern "%direct_int_mul", [ y; z ])) | _ -> i) :: rem | Let (x, Prim (Extern "%int_div", [ y; z ])) -> (match the_int info z with | Some j when Int32.(j <> 0l) -> Let (x, Prim (Extern "%direct_int_div", [ y; z ])) | _ -> i) :: rem | Let (x, Prim (Extern "%int_mod", [ y; z ])) -> (match the_int info z with | Some j when Int32.(j <> 0l) -> Let (x, Prim (Extern "%direct_int_mod", [ y; z ])) | _ -> i) :: rem | _ -> i :: rem let rec specialize_instrs info checks l = match l with | [] -> [] | i :: r -> ( (* We make bound checking explicit. Then, we can remove duplicated bound checks. Also, it appears to be more efficient to inline the array access. The bound checking function returns the array, which allows to produce more compact code. *) match i with | Let (x, Prim (Extern "caml_array_get", [ y; z ])) | Let (x, Prim (Extern "caml_array_get_float", [ y; z ])) | Let (x, Prim (Extern "caml_array_get_addr", [ y; z ])) -> let idx = match the_int info z with | Some idx -> `Cst idx | None -> `Var z in if List.mem (y, idx) ~set:checks then Let (x, Prim (Extern "caml_array_unsafe_get", [ y; z ])) :: specialize_instrs info checks r else let y' = Code.Var.fresh () in Let (y', Prim (Extern "caml_check_bound", [ y; z ])) :: Let (x, Prim (Extern "caml_array_unsafe_get", [ Pv y'; z ])) :: specialize_instrs info ((y, idx) :: checks) r | Let (x, Prim (Extern "caml_array_set", [ y; z; t ])) | Let (x, Prim (Extern "caml_array_set_float", [ y; z; t ])) | Let (x, Prim (Extern "caml_array_set_addr", [ y; z; t ])) -> let idx = match the_int info z with | Some idx -> `Cst idx | None -> `Var z in if List.mem (y, idx) ~set:checks then Let (x, Prim (Extern "caml_array_unsafe_set", [ y; z; t ])) :: specialize_instrs info checks r else let y' = Code.Var.fresh () in Let (y', Prim (Extern "caml_check_bound", [ y; z ])) :: Let (x, Prim (Extern "caml_array_unsafe_set", [ Pv y'; z; t ])) :: specialize_instrs info ((y, idx) :: checks) r | _ -> specialize_instr info i (specialize_instrs info checks r)) let specialize_all_instrs info (pc, blocks, free_pc) = let blocks = Addr.Map.map (fun block -> { block with Code.body = specialize_instrs info [] block.body }) blocks in pc, blocks, free_pc (****) let f info p = specialize_all_instrs info p let f_once (pc, blocks, free_pc) = let rec loop l = match l with | [] -> [] | i :: r -> ( match i with | Let ( x , (Prim ( Extern ( "caml_array_set" | "caml_array_unsafe_set" | "caml_array_set_float" | "caml_array_set_addr" | "caml_array_unsafe_set_float" | "caml_floatarray_unsafe_set" ) , [ _; _; _ ] ) as p) ) -> let x' = Code.Var.fork x in Let (x, Constant (Int 0l)) :: Let (x', p) :: loop r | _ -> i :: loop r) in let blocks = Addr.Map.map (fun block -> { block with Code.body = loop block.body }) blocks in pc, blocks, free_pc js_of_ocaml-3.5.2/compiler/lib/specialize_js.mli000066400000000000000000000017711357507750000217220ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Flow.info -> Code.program -> Code.program val f_once : Code.program -> Code.program js_of_ocaml-3.5.2/compiler/lib/standard.mly000066400000000000000000000170501357507750000207130ustar00rootroot00000000000000/******************************************************************************/ /* */ /* Menhir */ /* */ /* François Pottier, Inria Paris */ /* Yann Régis-Gianas, PPS, Université Paris Diderot */ /* */ /* Copyright Inria. All rights reserved. This file is distributed under the */ /* terms of the GNU Library General Public License version 2, with a */ /* special exception on linking, as described in the file LICENSE. */ /* */ /******************************************************************************/ (* This is menhir's standard library. It offers a number of parameterized nonterminal definitions, such as options and lists, that should be useful in a number of circumstances. *) %% (* ------------------------------------------------------------------------- *) (* The identity. *) (* [endrule(X)] is the same as [X]. *) (* This allows placing an anonymous subrule in the middle of a rule, as in: cat endrule(dog { action1 }) cow { action2 } Because [endrule] is marked %inline, everything is expanded away. So, this is equivalent to: cat dog cow { action1; action2 } Note that [action1] moves to the end of the rule. The anonymous subrule can even have several branches, as in: cat endrule(dog { action1a } | fox { action1b }) cow { action2 } This is expanded to: cat dog cow { action1a; action2 } | cat fox cow { action1b; action2 } *) %public %inline endrule(X): x = X { x } (* [anonymous(X)] is a deprecated synonym for [endrule(X)]. It was never documented. *) %public %inline anonymous(X): x = X { x } (* [midrule(X)] is the same as [X]. *) (* This allows placing an anonymous subrule in the middle of a rule, as in: cat midrule(dog { action1 }) cow { action2 } Because [midrule] is not marked %inline, this is equivalent to: cat xxx cow { action2 } where the fresh nonterminal symbol [xxx] is separately defined by: xxx: dog { action1 } In particular, if there is no [dog], what we get is a semantic action embedded in the middle of a rule. For instance, cat midrule({ action1 }) cow { action2 } is equivalent to: cat xxx cow { action2 } where [xxx] is separately defined by the rule: xxx: { action1 } *) %public midrule(X): x = X { x } (* [embedded(X)] is a deprecated synonym for [midrule(X)]. It was never documented. *) %public embedded(X): x = X { x } (* ------------------------------------------------------------------------- *) (* Options. *) (* [option(X)] recognizes either nothing or [X]. It produces a value of type ['a option] if [X] produces a value of type ['a]. *) %public option(X): /* nothing */ { None } | x = X { Some x } (* [ioption(X)] is identical to [option(X)], except its definition is inlined. This has the effect of duplicating the production that refers to it, possibly eliminating an LR(1) conflict. *) %public %inline ioption(X): /* nothing */ { None } | x = X { Some x } (* [boption(X)] recognizes either nothing or [X]. It produces a value of type [bool]. *) %public boption(X): /* nothing */ { false } | X { true } (* [loption(X)] recognizes either nothing or [X]. It produces a value of type ['a list] if [X] produces a value of type ['a list]. *) %public loption(X): /* nothing */ { [] } | x = X { x } (* ------------------------------------------------------------------------- *) (* Sequences. *) (* [epsilon] recognizes the empty word. It can be used instead of the traditional /* empty */ comment. *) (* NOT YET ADDED because we first need to remove the limitation that every symbol must be reachable from the start symbol! %public %inline epsilon: /* empty */ { () } *) (* [pair(X, Y)] recognizes the sequence [X Y]. It produces a value of type ['a * 'b] if [X] and [Y] produce values of type ['a] and ['b], respectively. *) %public %inline pair(X, Y): x = X; y = Y { (x, y) } (* [separated_pair(X, sep, Y)] recognizes the sequence [X sep Y]. It produces a value of type ['a * 'b] if [X] and [Y] produce values of type ['a] and ['b], respectively. *) %public %inline separated_pair(X, sep, Y): x = X; sep; y = Y { (x, y) } (* [preceded(opening, X)] recognizes the sequence [opening X]. It passes on the value produced by [X], so that it produces a value of type ['a] if [X] produces a value of type ['a]. *) %public %inline preceded(opening, X): opening; x = X { x } (* [terminated(X, closing)] recognizes the sequence [X closing]. It passes on the value produced by [X], so that it produces a value of type ['a] if [X] produces a value of type ['a]. *) %public %inline terminated(X, closing): x = X; closing { x } (* [delimited(opening, X, closing)] recognizes the sequence [opening X closing]. It passes on the value produced by [X], so that it produces a value of type ['a] if [X] produces a value of type ['a]. *) %public %inline delimited(opening, X, closing): opening; x = X; closing { x } (* ------------------------------------------------------------------------- *) (* Lists. *) (* [list(X)] recognizes a possibly empty list of [X]'s. It produces a value of type ['a list] if [X] produces a value of type ['a]. The front element of the list is the first element that was parsed. *) %public list(X): /* nothing */ { [] } | x = X; xs = list(X) { x :: xs } (* [nonempty_list(X)] recognizes a nonempty list of [X]'s. It produces a value of type ['a list] if [X] produces a value of type ['a]. The front element of the list is the first element that was parsed. *) %public nonempty_list(X): x = X { [ x ] } | x = X; xs = nonempty_list(X) { x :: xs } (* [separated_list(separator, X)] recognizes a possibly empty list of [X]'s, separated with [separator]'s. It produces a value of type ['a list] if [X] produces a value of type ['a]. The front element of the list is the first element that was parsed. *) %public %inline separated_list(separator, X): xs = loption(separated_nonempty_list(separator, X)) { xs } (* [separated_nonempty_list(separator, X)] recognizes a nonempty list of [X]'s, separated with [separator]'s. It produces a value of type ['a list] if [X] produces a value of type ['a]. The front element of the list is the first element that was parsed. *) %public separated_nonempty_list(separator, X): x = X { [ x ] } | x = X; separator; xs = separated_nonempty_list(separator, X) { x :: xs } (* ------------------------------------------------------------------------- *) (* List manipulation and transformation. *) (* [rev(XS)] recognizes the same language as [XS], but reverses the resulting OCaml list. (20181005) *) %public %inline rev(XS): xs = XS { List.rev xs } (* [flatten(XSS)] recognizes the same language as [XSS], and flattens the resulting OCaml list of lists. (20181005) *) %public %inline flatten(XSS): xss = XSS { List.flatten xss } (* [append(XS, YS)] recognizes [XS YS], and appends (concatenates) the resulting OCaml lists. (20181005) *) %public %inline append(XS, YS): xs = XS ys = YS { xs @ ys } %% js_of_ocaml-3.5.2/compiler/lib/stdlib.ml000066400000000000000000000313571357507750000202110ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Poly = struct external ( < ) : 'a -> 'a -> bool = "%lessthan" external ( <= ) : 'a -> 'a -> bool = "%lessequal" external ( <> ) : 'a -> 'a -> bool = "%notequal" external ( = ) : 'a -> 'a -> bool = "%equal" external ( > ) : 'a -> 'a -> bool = "%greaterthan" external ( >= ) : 'a -> 'a -> bool = "%greaterequal" external compare : 'a -> 'a -> int = "%compare" external equal : 'a -> 'a -> bool = "%equal" end module Int_replace_polymorphic_compare = struct let ( < ) (x : int) y = x < y let ( <= ) (x : int) y = x <= y let ( <> ) (x : int) y = x <> y let ( = ) (x : int) y = x = y let ( > ) (x : int) y = x > y let ( >= ) (x : int) y = x >= y let compare (x : int) y = compare x y let equal (x : int) y = x = y let max (x : int) y = if x >= y then x else y let min (x : int) y = if x <= y then x else y end include Int_replace_polymorphic_compare let quiet = ref false let warn fmt = Format.ksprintf (fun s -> if not !quiet then Format.eprintf "%s%!" s) fmt let fail = ref true let failwith_ fmt = Printf.ksprintf (fun s -> if !fail then failwith s else Format.eprintf "%s@." s) fmt let raise_ exn = if !fail then raise exn else Format.eprintf "%s@." (Printexc.to_string exn) let int_num_bits = let size = ref 0 in let i = ref (-1) in while !i <> 0 do i := !i lsl 1; incr size done; !size module List = struct include ListLabels let filter_map ~f l = let l = List.fold_left (fun acc x -> match f x with | Some x -> x :: acc | None -> acc) [] l in List.rev l let map_tc ~f l = List.rev (List.rev_map f l) let rec take' acc n l = if n = 0 then acc, l else match l with | [] -> acc, [] | x :: xs -> take' (x :: acc) (pred n) xs let take n l = let x, xs = take' [] n l in List.rev x, xs let rec last = function | [] -> None | [ x ] -> Some x | _ :: xs -> last xs let sort_uniq ~compare l = let l = List.sort compare l in match l with | ([] | [ _ ]) as l -> l | x :: xs -> let rec loop prev = function | [] -> [ prev ] | x :: rest when compare x prev = 0 -> loop prev rest | x :: rest -> prev :: loop x rest in loop x xs let is_empty = function | [] -> true | _ -> false end module Int32 = struct include Int32 external ( < ) : int32 -> int32 -> bool = "%lessthan" external ( <= ) : int32 -> int32 -> bool = "%lessequal" external ( <> ) : int32 -> int32 -> bool = "%notequal" external ( = ) : int32 -> int32 -> bool = "%equal" external ( > ) : int32 -> int32 -> bool = "%greaterthan" external ( >= ) : int32 -> int32 -> bool = "%greaterequal" external compare : int32 -> int32 -> int = "%compare" external equal : int32 -> int32 -> bool = "%equal" end module Option = struct let map ~f x = match x with | None -> None | Some v -> Some (f v) let iter ~f x = match x with | None -> () | Some v -> f v let filter ~f x = match x with | None -> None | Some v -> if f v then Some v else None let compare compare_elt a b = match a, b with | None, None -> 0 | None, Some _ -> -1 | Some _, None -> 1 | Some a, Some b -> compare_elt a b let equal equal_elt a b = match a, b with | None, None -> true | Some a, Some b -> equal_elt a b | Some _, None | None, Some _ -> false let is_none = function | None -> true | Some _ -> false let is_some = function | None -> false | Some _ -> true end module Float = struct type t = float let equal (a : float) (b : float) = Poly.compare a b = 0 (* Re-defined here to stay compatible with OCaml 4.02 *) external classify_float : float -> fpclass = "caml_classify_float" external ( < ) : t -> t -> bool = "%lessthan" external ( <= ) : t -> t -> bool = "%lessequal" external ( <> ) : t -> t -> bool = "%notequal" external ( = ) : t -> t -> bool = "%equal" external ( > ) : t -> t -> bool = "%greaterthan" external ( >= ) : t -> t -> bool = "%greaterequal" end module Bool = struct external ( <> ) : bool -> bool -> bool = "%notequal" external ( = ) : bool -> bool -> bool = "%equal" external ( > ) : bool -> bool -> bool = "%greaterthan" external equal : bool -> bool -> bool = "%equal" end module Char = struct include Char external ( < ) : char -> char -> bool = "%lessthan" external ( <= ) : char -> char -> bool = "%lessequal" external ( <> ) : char -> char -> bool = "%notequal" external ( = ) : char -> char -> bool = "%equal" external ( > ) : char -> char -> bool = "%greaterthan" external ( >= ) : char -> char -> bool = "%greaterequal" external compare : char -> char -> int = "%compare" external equal : char -> char -> bool = "%equal" let is_alpha = function | 'a' .. 'z' | 'A' .. 'Z' -> true | _ -> false let is_num = function | '0' .. '9' -> true | _ -> false let lowercase_ascii c = match c with | 'A' .. 'Z' as c -> Char.unsafe_chr (Char.code c + 32) | _ -> c let uppercase_ascii c = match c with | 'a' .. 'z' as c -> Char.unsafe_chr (Char.code c - 32) | _ -> c end module Bytes = struct include BytesLabels let sub_string b ~pos:ofs ~len = unsafe_to_string (Bytes.sub b ofs len) end module String = struct include StringLabels let equal (a : string) (b : string) = Poly.(a = b) let hash (a : string) = Hashtbl.hash a let is_empty = function | "" -> true | _ -> false let is_prefix ~prefix s = let len_a = length prefix in let len_s = length s in if len_a > len_s then false else let max_idx_a = len_a - 1 in let rec loop i = if i > max_idx_a then true else if not (Char.equal (unsafe_get prefix i) (unsafe_get s i)) then false else loop (i + 1) in loop 0 let drop_prefix ~prefix s = let plen = String.length prefix in if plen > String.length s then None else try for i = 0 to String.length prefix - 1 do if not (Char.equal s.[i] prefix.[i]) then raise Exit done; Some (String.sub s plen (String.length s - plen)) with Exit -> None let for_all = let rec loop s ~f ~last i = if i > last then true else if f (String.unsafe_get s i) then loop s ~f ~last (i + 1) else false in fun s ~f -> loop s ~f ~last:(String.length s - 1) 0 let is_ascii s = let res = ref true in for i = 0 to String.length s - 1 do match s.[i] with | '\000' .. '\127' -> () | '\128' .. '\255' -> res := false done; !res let has_backslash s = let res = ref false in for i = 0 to String.length s - 1 do if Char.equal s.[i] '\\' then res := true done; !res let split_char ~sep p = let len = String.length p in let rec split beg cur = if cur >= len then if cur - beg > 0 then [ String.sub p beg (cur - beg) ] else [] else if Char.equal p.[cur] sep then String.sub p beg (cur - beg) :: split (cur + 1) (cur + 1) else split beg (cur + 1) in split 0 0 (* copied from https://github.com/ocaml/ocaml/pull/10 *) let split ~sep s = let sep_len = String.length sep in if sep_len = 1 then split_char ~sep:sep.[0] s else let sep_max = sep_len - 1 in if sep_max < 0 then invalid_arg "String.split: empty separator" else let s_max = String.length s - 1 in if s_max < 0 then [ "" ] else let acc = ref [] in let sub_start = ref 0 in let k = ref 0 in let i = ref 0 in (* We build the substrings by running from the start of [s] to the end with [i] trying to match the first character of [sep] in [s]. If this matches, we verify that the whole [sep] is matched using [k]. If this matches we extract a substring from the start of the current substring [sub_start] to [!i - 1] (the position before the [sep] we found). We then continue to try to match with [i] by starting after the [sep] we just found, this is also becomes the start position of the next substring. If [i] is such that no separator can be found we exit the loop and make a substring from [sub_start] until the end of the string. *) while !i + sep_max <= s_max do if not (Char.equal (String.unsafe_get s !i) (String.unsafe_get sep 0)) then incr i else ( (* Check remaining [sep] chars match, access to unsafe s (!i + !k) is guaranteed by loop invariant. *) k := 1; while !k <= sep_max && Char.equal (String.unsafe_get s (!i + !k)) (String.unsafe_get sep !k) do incr k done; if !k <= sep_max then (* no match *) incr i else let new_sub_start = !i + sep_max + 1 in let sub_end = !i - 1 in let sub_len = sub_end - !sub_start + 1 in acc := String.sub s !sub_start sub_len :: !acc; sub_start := new_sub_start; i := new_sub_start) done; List.rev (String.sub s !sub_start (s_max - !sub_start + 1) :: !acc) let apply1 f (s : string) : string = let b = Bytes.of_string s in if Bytes.length b = 0 then s else ( Bytes.unsafe_set b 0 (f (Bytes.unsafe_get b 0)); Bytes.to_string b) let lsplit2 line ~on:delim = try let pos = index line delim in Some (sub line ~pos:0 ~len:pos, sub line ~pos:(pos + 1) ~len:(length line - pos - 1)) with Not_found -> None let capitalize_ascii s = apply1 Char.uppercase_ascii s let uncapitalize_ascii s = apply1 Char.lowercase_ascii s end module Int = struct type t = int let compare (x : int) y = compare x y let equal (x : t) y = x = y let hash (x : t) = Hashtbl.hash x end module IntSet = Set.Make (Int) module IntMap = Map.Make (Int) module StringSet = Set.Make (String) module StringMap = Map.Make (String) module BitSet : sig type t val create : unit -> t val mem : t -> int -> bool val set : t -> int -> unit val unset : t -> int -> unit val copy : t -> t val iter : f:(int -> unit) -> t -> unit val size : t -> int val next_free : t -> int -> int val next_mem : t -> int -> int end = struct type t = { mutable arr : int array } let create () = { arr = Array.make 1 0 } let size t = Array.length t.arr * int_num_bits let mem { arr } i = let idx = i / int_num_bits in let off = i mod int_num_bits in idx < Array.length arr && Array.unsafe_get arr idx land (1 lsl off) <> 0 let set t i = let idx = i / int_num_bits in let off = i mod int_num_bits in let size = ref (Array.length t.arr) in while idx >= !size do size := !size * 2 done; if !size <> Array.length t.arr then ( let a = Array.make !size 0 in Array.blit t.arr 0 a 0 (Array.length t.arr); t.arr <- a); Array.unsafe_set t.arr idx (Array.unsafe_get t.arr idx lor (1 lsl off)) let unset t i = let idx = i / int_num_bits in let off = i mod int_num_bits in let size = Array.length t.arr in if idx >= size then () else if Array.unsafe_get t.arr idx land (1 lsl off) <> 0 then Array.unsafe_set t.arr idx (Array.unsafe_get t.arr idx lxor (1 lsl off)) let next_free t i = let x = ref i in while mem t !x do incr x done; !x let next_mem t i = let x = ref i in while not (mem t !x) do incr x done; !x let copy t = { arr = Array.copy t.arr } let iter ~f t = for i = 0 to size t do if mem t i then f i done end module Array = struct include ArrayLabels let fold_right_i a ~f ~init:x = let r = ref x in for i = Array.length a - 1 downto 0 do r := f i (Array.unsafe_get a i) !r done; !r end js_of_ocaml-3.5.2/compiler/lib/strongly_connected_components.ml000066400000000000000000000135711357507750000250760ustar00rootroot00000000000000(**************************************************************************) (* *) (* OCaml *) (* *) (* Pierre Chambart, OCamlPro *) (* Mark Shinwell and Leo White, Jane Street Europe *) (* *) (* Copyright 2013--2016 OCamlPro SAS *) (* Copyright 2014--2016 Jane Street Group LLC *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) open! Stdlib module IntSet = Set.Make (struct type t = int let compare = compare end) module Kosaraju : sig type component_graph = { sorted_connected_components : int list array ; component_edges : int list array } val component_graph : int list array -> component_graph end = struct let transpose graph = let size = Array.length graph in let transposed = Array.make size [] in let add src dst = transposed.(src) <- dst :: transposed.(src) in Array.iteri ~f:(fun src dsts -> List.iter ~f:(fun dst -> add dst src) dsts) graph; transposed let depth_first_order (graph : int list array) : int array = let size = Array.length graph in let marked = Array.make size false in let stack = Array.make size ~-1 in let pos = ref 0 in let push i = stack.(!pos) <- i; incr pos in let rec aux node = if not marked.(node) then ( marked.(node) <- true; List.iter ~f:aux graph.(node); push node) in for i = 0 to size - 1 do aux i done; stack let mark order graph = let size = Array.length graph in let graph = transpose graph in let marked = Array.make size false in let id = Array.make size ~-1 in let count = ref 0 in let rec aux node = if not marked.(node) then ( marked.(node) <- true; id.(node) <- !count; List.iter ~f:aux graph.(node)) in for i = size - 1 downto 0 do let node = order.(i) in if not marked.(node) then ( aux order.(i); incr count) done; id, !count let kosaraju graph = let dfo = depth_first_order graph in let components, ncomponents = mark dfo graph in ncomponents, components type component_graph = { sorted_connected_components : int list array ; component_edges : int list array } let component_graph graph = let ncomponents, components = kosaraju graph in let id_scc = Array.make ncomponents [] in let component_graph = Array.make ncomponents IntSet.empty in let add_component_dep node set = let node_deps = graph.(node) in List.fold_left ~f:(fun set dep -> IntSet.add components.(dep) set) ~init:set node_deps in Array.iteri ~f:(fun node component -> id_scc.(component) <- node :: id_scc.(component); component_graph.(component) <- add_component_dep node component_graph.(component)) components; { sorted_connected_components = id_scc ; component_edges = Array.map ~f:IntSet.elements component_graph } end module type S = sig module Id : sig type t module Map : Map.S with type key = t module Set : Set.S with type elt = t end type directed_graph = Id.Set.t Id.Map.t type component = | Has_loop of Id.t list | No_loop of Id.t val connected_components_sorted_from_roots_to_leaf : directed_graph -> component array val component_graph : directed_graph -> (component * int list) array end module Make (Id : sig type t module Map : Map.S with type key = t module Set : Set.S with type elt = t end) = struct module Id = Id type directed_graph = Id.Set.t Id.Map.t type component = | Has_loop of Id.t list | No_loop of Id.t type numbering = { back : int Id.Map.t ; forth : Id.t array } let number graph = let size = Id.Map.cardinal graph in let bindings = Id.Map.bindings graph in let a = Array.of_list bindings in let forth = Array.map ~f:fst a in let back = let back = ref Id.Map.empty in for i = 0 to size - 1 do back := Id.Map.add forth.(i) i !back done; !back in let integer_graph = Array.init size ~f:(fun i -> let _, dests = a.(i) in Id.Set.fold (fun dest acc -> let v = try Id.Map.find dest back with Not_found -> assert false in v :: acc) dests []) in { back; forth }, integer_graph let component_graph graph = let numbering, integer_graph = number graph in let { Kosaraju.sorted_connected_components; component_edges } = Kosaraju.component_graph integer_graph in Array.mapi ~f:(fun component nodes -> match nodes with | [] -> assert false | [ node ] -> ( (if List.mem node ~set:integer_graph.(node) then Has_loop [ numbering.forth.(node) ] else No_loop numbering.forth.(node)) , component_edges.(component) ) | _ :: _ -> ( Has_loop (List.map ~f:(fun node -> numbering.forth.(node)) nodes) , component_edges.(component) )) sorted_connected_components let connected_components_sorted_from_roots_to_leaf graph = Array.map ~f:fst (component_graph graph) end js_of_ocaml-3.5.2/compiler/lib/strongly_connected_components.mli000066400000000000000000000036671357507750000252540ustar00rootroot00000000000000(**************************************************************************) (* *) (* OCaml *) (* *) (* Pierre Chambart, OCamlPro *) (* Mark Shinwell and Leo White, Jane Street Europe *) (* *) (* Copyright 2013--2016 OCamlPro SAS *) (* Copyright 2014--2016 Jane Street Group LLC *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** Kosaraju's algorithm for strongly connected components. *) module type S = sig module Id : sig type t module Map : Map.S with type key = t module Set : Set.S with type elt = t end type directed_graph = Id.Set.t Id.Map.t (** If (a -> set) belongs to the map, it means that there are edges from [a] to every element of [set]. It is assumed that no edge points to a vertex not represented in the map. *) type component = | Has_loop of Id.t list | No_loop of Id.t val connected_components_sorted_from_roots_to_leaf : directed_graph -> component array val component_graph : directed_graph -> (component * int list) array end module Make (Id : sig type t module Map : Map.S with type key = t module Set : Set.S with type elt = t end) : S with module Id = Id js_of_ocaml-3.5.2/compiler/lib/subst.ml000066400000000000000000000072101357507750000200570ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib open Code let subst_cont s (pc, arg) = pc, List.map arg ~f:(fun x -> s x) let expr s e = match e with | Const _ | Constant _ -> e | Apply (f, l, n) -> Apply (s f, List.map l ~f:(fun x -> s x), n) | Block (n, a, k) -> Block (n, Array.map a ~f:(fun x -> s x), k) | Field (x, n) -> Field (s x, n) | Closure (l, pc) -> Closure (l, subst_cont s pc) | Prim (p, l) -> Prim ( p , List.map l ~f:(fun x -> match x with | Pv x -> Pv (s x) | Pc _ -> x) ) let instr s i = match i with | Let (x, e) -> Let (x, expr s e) | Set_field (x, n, y) -> Set_field (s x, n, s y) | Offset_ref (x, n) -> Offset_ref (s x, n) | Array_set (x, y, z) -> Array_set (s x, s y, s z) let instrs s l = List.map l ~f:(fun i -> instr s i) let last s l = match l with | Stop -> l | Branch cont -> Branch (subst_cont s cont) | Pushtrap (cont1, x, cont2, pcs) -> Pushtrap (subst_cont s cont1, x, subst_cont s cont2, pcs) | Return x -> Return (s x) | Raise (x, k) -> Raise (s x, k) | Cond (c, x, cont1, cont2) -> Cond (c, s x, subst_cont s cont1, subst_cont s cont2) | Switch (x, a1, a2) -> Switch ( s x , Array.map a1 ~f:(fun cont -> subst_cont s cont) , Array.map a2 ~f:(fun cont -> subst_cont s cont) ) | Poptrap (cont, addr) -> Poptrap (subst_cont s cont, addr) let block s block = { params = block.params ; handler = Option.map block.handler ~f:(fun (x, cont) -> x, subst_cont s cont) ; body = instrs s block.body ; branch = last s block.branch } let program s (pc, blocks, free_pc) = let blocks = Addr.Map.map (fun b -> block s b) blocks in pc, blocks, free_pc let rec cont' s pc blocks visited = if Addr.Set.mem pc visited then blocks, visited else let visited = Addr.Set.add pc visited in let b = Addr.Map.find pc blocks in let b = block s b in let blocks = Addr.Map.add pc b blocks in let blocks, visited = List.fold_left b.body ~init:(blocks, visited) ~f:(fun (blocks, visited) instr -> match instr with | Let (_, Closure (_, (pc, _))) -> cont' s pc blocks visited | _ -> blocks, visited) in Code.fold_children blocks pc (fun pc (blocks, visited) -> cont' s pc blocks visited) (blocks, visited) let cont s addr (pc, blocks, free_pc) = let blocks, _ = cont' s addr blocks Addr.Set.empty in pc, blocks, free_pc (****) let from_array s x = match s.(Var.idx x) with | Some y -> y | None -> x (****) let rec build_mapping params args = match params, args with | x :: params, y :: args -> Var.Map.add x y (build_mapping params args) | [], [] -> Var.Map.empty | _ -> assert false let from_map m x = try Var.Map.find x m with Not_found -> x js_of_ocaml-3.5.2/compiler/lib/subst.mli000066400000000000000000000026651357507750000202410ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Code val program : (Var.t -> Var.t) -> program -> program val expr : (Var.t -> Var.t) -> expr -> expr val instr : (Var.t -> Var.t) -> instr -> instr val instrs : (Var.t -> Var.t) -> instr list -> instr list val block : (Var.t -> Var.t) -> block -> block val last : (Var.t -> Var.t) -> last -> last val cont : (Var.t -> Var.t) -> int -> program -> program val from_array : Var.t option array -> Var.t -> Var.t val build_mapping : Var.t list -> Var.t list -> Var.t Var.Map.t val from_map : Var.t Var.Map.t -> Var.t -> Var.t js_of_ocaml-3.5.2/compiler/lib/tailcall.ml000066400000000000000000000071141357507750000205070ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let times = Debug.find "times" open Code (* FIX: it should be possible to deal with tail-recursion in exception handlers, but we have to adapt the code generator for that *) let rec remove_last l = match l with | [] -> assert false | [ _ ] -> [] | x :: r -> x :: remove_last r let rec tail_call x f l = match l with | [] -> None | [ Let (y, Apply (g, args, _)) ] when Var.compare x y = 0 && Var.compare f g = 0 -> Some args | _ :: rem -> tail_call x f rem let rewrite_block (f, f_params, f_pc, args) pc blocks = (*Format.eprintf "%d@." pc;*) let block = Addr.Map.find pc blocks in match block.branch with | Return x -> ( match tail_call x f block.body with | Some f_args when List.length f_params = List.length f_args -> let m = Subst.build_mapping f_params f_args in List.iter2 f_params f_args ~f:(fun p a -> Code.Var.propagate_name p a); Addr.Map.add pc { params = block.params ; handler = block.handler ; body = remove_last block.body ; branch = Branch (f_pc, List.map args ~f:(fun x -> Var.Map.find x m)) } blocks | _ -> blocks) | _ -> blocks let ( >> ) x f = f x (* Skip try body *) let fold_children blocks pc f accu = let block = Addr.Map.find pc blocks in match block.branch with | Return _ | Raise _ | Stop -> accu | Branch (pc', _) | Poptrap ((pc', _), _) -> f pc' accu | Pushtrap (_, _, (pc1, _), pcs) -> f pc1 (Addr.Set.fold f pcs accu) | Cond (_, _, (pc1, _), (pc2, _)) -> accu >> f pc1 >> f pc2 | Switch (_, a1, a2) -> let accu = Array.fold_right a1 ~init:accu ~f:(fun (pc, _) accu -> f pc accu) in let accu = Array.fold_right a2 ~init:accu ~f:(fun (pc, _) accu -> f pc accu) in accu let rec traverse f pc visited blocks = if not (Addr.Set.mem pc visited) then let visited = Addr.Set.add pc visited in let blocks = rewrite_block f pc blocks in let visited, blocks = fold_children blocks pc (fun pc (visited, blocks) -> let visited, blocks = traverse f pc visited blocks in visited, blocks) (visited, blocks) in visited, blocks else visited, blocks let f ((pc, blocks, free_pc) as p) = let t = Timer.make () in let blocks = fold_closures p (fun f params (pc, args) blocks -> match f with | Some f when List.length params = List.length args -> let _, blocks = traverse (f, params, pc, args) pc Addr.Set.empty blocks in blocks | _ -> blocks) blocks in if times () then Format.eprintf " tail calls: %a@." Timer.print t; pc, blocks, free_pc js_of_ocaml-3.5.2/compiler/lib/tailcall.mli000066400000000000000000000017011357507750000206540ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Code.program -> Code.program js_of_ocaml-3.5.2/compiler/lib/timer.ml000066400000000000000000000017731357507750000200470ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib type t = float let timer = ref (fun _ -> 0.) let init f = timer := f let make () = !timer () let get t = !timer () -. t let print f t = Format.fprintf f "%.2f" (get t) js_of_ocaml-3.5.2/compiler/lib/timer.mli000066400000000000000000000017021357507750000202100ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type t val init : (unit -> float) -> unit val make : unit -> t val get : t -> float val print : Format.formatter -> t -> unit js_of_ocaml-3.5.2/compiler/lib/varPrinter.ml000066400000000000000000000114571357507750000210630ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib module Alphabet = struct type t = { c1 : string ; c1_len : int ; cn : string ; cn_len : int } let create ~c1 ~cn = { c1; c1_len = String.length c1; cn; cn_len = String.length cn } let javascript = create ~c1:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$" ~cn:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$" let rec size t x acc = if x < t.c1_len then 1 + acc else size t ((x - t.c1_len) / t.cn_len) (acc + 1) let to_string (t : t) (x : int) = let size = size t x 0 in let buf = Bytes.create size in let rec loop i x = match i with | 0 -> assert (x < t.c1_len); Bytes.set buf i t.c1.[x]; Bytes.unsafe_to_string buf | i -> let x = x - t.c1_len in Bytes.set buf i t.cn.[x mod t.cn_len]; loop (pred i) (x / t.cn_len) in loop (size - 1) x end type t = { names : (int, string) Hashtbl.t ; known : (int, string) Hashtbl.t ; cache : (int * int, string) Hashtbl.t ; alphabet : Alphabet.t ; mutable last : int ; mutable pretty : bool ; mutable stable : bool } let name_raw t v nm = Hashtbl.add t.names v nm let propagate_name t v v' = try let name = Hashtbl.find t.names v in name_raw t v' name (* ; * (try * let n = Hashtbl.find t.names v' in * if n <> name * then Printf.eprintf "erasing name %s by %s\n%!" n name * with _ -> ()) *) with Not_found -> () let name t v nm_orig = let len = String.length nm_orig in if len > 0 then ( let buf = Buffer.create (String.length nm_orig) in let idx = ref 0 in while !idx < len && not (Char.is_alpha nm_orig.[!idx]) do incr idx done; let pending = ref false in if !idx >= len then ( pending := true; idx := 0); for i = !idx to len - 1 do if Char.is_alpha nm_orig.[i] || Char.is_num nm_orig.[i] then ( if !pending then Buffer.add_char buf '_'; Buffer.add_char buf nm_orig.[i]; pending := false) else pending := true done; let str = Buffer.contents buf in let str = match str, nm_orig with | "", ">>=" -> "symbol_bind" | "", ">>|" -> "symbol_map" | "", _ -> "symbol" | str, _ -> str in name_raw t v str) let get_name t v = try Some (Hashtbl.find t.names v) with Not_found -> None let format_var t i x = let s = Alphabet.to_string t.alphabet x in if t.stable then Format.sprintf "v%d" i else if t.pretty then Format.sprintf "_%s_" s else s let reserved = ref StringSet.empty let add_reserved s = reserved := List.fold_left s ~init:!reserved ~f:(fun acc x -> StringSet.add x acc) let _ = reserved := StringSet.union !reserved Reserved.keyword (* ; *) (* add_reserved Reserved.provided *) let get_reserved () = !reserved let is_reserved s = StringSet.mem s !reserved let rec to_string t ?origin i = let origin = match origin with | Some i when t.pretty -> i | _ -> i in try Hashtbl.find t.cache (i, origin) with Not_found -> let name = try Hashtbl.find t.known i with Not_found -> t.last <- t.last + 1; let j = t.last in let s = format_var t i j in if is_reserved s then to_string t i else ( Hashtbl.add t.known i s; s) in let name = if t.pretty then try let nm = Hashtbl.find t.names origin in nm ^ name with Not_found -> name else name in Hashtbl.add t.cache (i, origin) name; name let set_pretty t b = t.pretty <- b let set_stable t b = t.stable <- b let reset t = Hashtbl.clear t.names; Hashtbl.clear t.known; Hashtbl.clear t.cache; t.last <- -1 let create ?(pretty = false) ?(stable = false) alphabet = let t = { names = Hashtbl.create 107 ; known = Hashtbl.create 1001 ; cache = Hashtbl.create 1001 ; alphabet ; last = -1 ; pretty ; stable } in t js_of_ocaml-3.5.2/compiler/lib/varPrinter.mli000066400000000000000000000025201357507750000212230ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Stdlib module Alphabet : sig type t val javascript : t end type t val add_reserved : string list -> unit val get_reserved : unit -> StringSet.t val create : ?pretty:bool -> ?stable:bool -> Alphabet.t -> t val reset : t -> unit val to_string : t -> ?origin:int -> int -> string val name : t -> int -> string -> unit val get_name : t -> int -> string option val propagate_name : t -> int -> int -> unit val set_pretty : t -> bool -> unit val set_stable : t -> bool -> unit js_of_ocaml-3.5.2/compiler/lib/vlq64.ml000066400000000000000000000054571357507750000177060ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Stdlib let code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" let code_rev = let a = Array.make 255 (-1) in for i = 0 to String.length code - 1 do a.(Char.code code.[i]) <- i done; a let vlq_base_shift = 5 (* binary: 100000 *) let vlq_base = 1 lsl vlq_base_shift (* binary: 011111 *) let vlq_base_mask = vlq_base - 1 (* binary: 100000 *) let vlq_continuation_bit = vlq_base let toVLQSigned v = if v < 0 then (-v lsl 1) + 1 else v lsl 1 (* assert (toVLQSigned 1 = 2); *) (* assert (toVLQSigned 2 = 4); *) (* assert (toVLQSigned (-1) = 3); *) (* assert (toVLQSigned (-2) = 5);; *) let fromVLQSigned v = let is_neg = v land 1 = 1 in let shift = v lsr 1 in if is_neg then -shift else shift (* assert (fromVLQSigned 2 = 1); *) (* assert (fromVLQSigned 4 = 2); *) (* assert (fromVLQSigned 3 = -1); *) (* assert (fromVLQSigned 5 = -2);; *) let add_char buf x = Buffer.add_char buf code.[x] let rec encode' buf x = let digit = x land vlq_base_mask in let rest = x lsr vlq_base_shift in if rest = 0 then add_char buf digit else ( add_char buf (digit lor vlq_continuation_bit); encode' buf rest) let encode b x = let vql = toVLQSigned x in encode' b vql let encode_l b l = List.iter ~f:(encode b) l let rec decode' acc s start pos = let digit = code_rev.(Char.code s.[pos]) in if digit = -1 then invalid_arg "Vql64.decode'"; let cont = digit land vlq_continuation_bit = vlq_continuation_bit in let digit = digit land vlq_base_mask in let acc = acc + (digit lsl ((pos - start) * vlq_base_shift)) in if cont then decode' acc s start (succ pos) else acc, succ pos let decode s p = let d, i = decode' 0 s p p in fromVLQSigned d, i let decode_l s ~pos ~len = let rec aux pos acc len = if len = 0 then List.rev acc else if len < 0 then invalid_arg "Vlq64.decode_l" else let d, i = decode s pos in let len = len - (i - pos) in aux i (d :: acc) len in aux pos [] len js_of_ocaml-3.5.2/compiler/lib/vlq64.mli000066400000000000000000000017101357507750000200430ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val encode_l : Buffer.t -> int list -> unit val decode_l : string -> pos:int -> len:int -> int list js_of_ocaml-3.5.2/compiler/linkerArg.ml000066400000000000000000000101001357507750000200570ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Js_of_ocaml_compiler.Stdlib open Js_of_ocaml_compiler open Cmdliner type t = { source_map : (string option * Source_map.t) option ; js_files : string list ; output_file : string option ; resolve_sourcemap_url : bool } let options = let output_file = let doc = "Set output file name to [$(docv)]." in Arg.(value & opt (some string) None & info [ "o" ] ~docv:"FILE" ~doc) in let sourcemap = let doc = "Generate source map." in Arg.(value & flag & info [ "sourcemap"; "source-map" ] ~doc) in let sourcemap_inline_in_js = let doc = "Inline sourcemap in the generated JavaScript." in Arg.(value & flag & info [ "source-map-inline" ] ~doc) in let sourcemap_root = let doc = "root dir for source map." in Arg.(value & opt (some string) None & info [ "source-map-root" ] ~doc) in let resolve_sourcemap_url = let doc = "Resolve source map url." in Arg.(value & opt bool false & info [ "resolve-sourcemap-url" ] ~doc) in let js_files = let doc = "Link JavaScript files [$(docv)]." in Arg.(value & pos_all string [] & info [] ~docv:"JS_FILES" ~doc) in let build_t sourcemap sourcemap_inline_in_js sourcemap_root output_file resolve_sourcemap_url js_files = let chop_extension s = try Filename.chop_extension s with Invalid_argument _ -> s in let source_map = if sourcemap || sourcemap_inline_in_js then let file, sm_output_file = match output_file with | Some file when sourcemap_inline_in_js -> file, None | Some file -> file, Some (chop_extension file ^ ".map") | None -> "STDIN", None in Some ( sm_output_file , { Source_map.version = 3 ; file ; sourceroot = sourcemap_root ; sources = [] ; sources_content = Some [] ; names = [] ; mappings = [] } ) else None in `Ok { output_file; js_files; source_map; resolve_sourcemap_url } in let t = Term.( pure build_t $ sourcemap $ sourcemap_inline_in_js $ sourcemap_root $ output_file $ resolve_sourcemap_url $ js_files) in Term.ret t let info = let doc = "Js_of_ocaml linker" in let man = [ `S "DESCRIPTION" ; `P "jsoo_link is a JavaScript linker. It can concatenate multiple JavaScript files \ keeping sourcemap information." ; `S "BUGS" ; `P "Bugs are tracked on github at \ $(i,https://github.com/ocsigen/js_of_ocaml/issues)." ; `S "SEE ALSO" ; `P "ocaml(1)" ; `S "AUTHORS" ; `P "Jerome Vouillon, Hugo Heuzard." ; `S "LICENSE" ; `P "Copyright (C) 2010-2019." ; `P "jsoo_link is free software, you can redistribute it and/or modify it under the \ terms of the GNU Lesser General Public License as published by the Free \ Software Foundation, with linking exception; either version 2.1 of the License, \ or (at your option) any later version." ] in let version = match Compiler_version.git_version with | "" -> Compiler_version.s | v -> Printf.sprintf "%s+git-%s" Compiler_version.s v in Term.info "js_of_ocaml" ~version ~doc ~man js_of_ocaml-3.5.2/compiler/minifyArg.ml000066400000000000000000000050441357507750000201010ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Js_of_ocaml_compiler.Stdlib open Js_of_ocaml_compiler open Cmdliner type t = { common : CommonArg.t ; (* minify option *) use_stdin : bool ; output_file : string option ; files : string list } let options = let files = Arg.(value & pos_all file [] & info [] ~docv:"JS_FILES") in let output_file = let doc = "Set output file name to [$(docv)]." in Arg.(value & opt (some string) None & info [ "o" ] ~docv:"FILE" ~doc) in let use_stdin = let doc = "Read from standard input." in Arg.(value & flag & info [ "stdin" ] ~doc) in let build_t common files output_file use_stdin = `Ok { common; use_stdin; output_file; files } in let t = Term.(pure build_t $ CommonArg.t $ files $ output_file $ use_stdin) in Term.ret t let info = let doc = "JavaScript minifier" in let man = [ `S "DESCRIPTION" ; `P "jsoo_minify is a JavaScript minifier." ; `S "BUGS" ; `P "Bugs are tracked on github at \ $(i,https://github.com/ocsigen/js_of_ocaml/issues)." ; `S "SEE ALSO" ; `P "js_of_ocaml(1)" ; `S "AUTHORS" ; `P "Jerome Vouillon, Hugo Heuzard." ; `S "LICENSE" ; `P "Copyright (C) 2010-2019." ; `P "jsoo_minify is free software, you can redistribute it and/or modify it under \ the terms of the GNU Lesser General Public License as published by the Free \ Software Foundation, with linking exception; either version 2.1 of the License, \ or (at your option) any later version." ] in let version = match Compiler_version.git_version with | "" -> Compiler_version.s | v -> Printf.sprintf "%s+git-%s" Compiler_version.s v in Term.info "jsoo_minify" ~version ~doc ~man js_of_ocaml-3.5.2/compiler/minifyArg.mli000066400000000000000000000020561357507750000202520ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type t = { common : CommonArg.t ; (* minify option *) use_stdin : bool ; output_file : string option ; files : string list } val options : t Cmdliner.Term.t val info : Cmdliner.Term.info js_of_ocaml-3.5.2/compiler/num-testsuite/000077500000000000000000000000001357507750000204455ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/num-testsuite/.ocamlformat000066400000000000000000000000071357507750000227470ustar00rootroot00000000000000disablejs_of_ocaml-3.5.2/compiler/num-testsuite/dune000066400000000000000000000010211357507750000213150ustar00rootroot00000000000000(executable (name main) (libraries num) (modes native js) (flags (:standard -linkall -w -3-7-33-35-37 -safe-string -no-strict-sequence)) ) (rule (target main.referencejs) (deps main.bc.js) (action (with-stdout-to %{target} (run node ./main.bc.js)))) (rule (target main.reference) (deps main.exe) (action (with-stdout-to %{target} (run ./main.exe)))) (alias (name runtest) (deps main.reference main.referencejs) (action (diff main.reference main.referencejs))) js_of_ocaml-3.5.2/compiler/num-testsuite/main.ml000066400000000000000000000001721357507750000217230ustar00rootroot00000000000000include Test_nats include Test_big_ints include Test_ratios include Test_nums include Test_io let () = Test.end_tests () js_of_ocaml-3.5.2/compiler/num-testsuite/test.ml000066400000000000000000000053041357507750000217600ustar00rootroot00000000000000open Printf;; let flush_all () = flush stdout; flush stderr;; let message s = print_string s; print_newline ();; let error_occurred = ref false;; let immediate_failure = ref true;; let error () = if !immediate_failure then exit 2 else begin error_occurred := true; flush_all (); false end;; let success () = flush_all (); true;; let function_tested = ref "";; let testing_function s = flush_all (); function_tested := s; print_newline(); message s;; let test test_number eq_fun (answer, correct_answer) = flush_all (); if not (eq_fun answer correct_answer) then begin fprintf stderr ">>> Bad result (%s, test %d)\n" !function_tested test_number; error () end else begin printf " %d..." test_number; success () end;; let failure_test test_number fun_to_test arg = flush_all (); try fun_to_test arg; fprintf stderr ">>> Failure expected (%s, test %d)\n" !function_tested test_number; error () with _ -> printf " %d..." test_number; success ();; let failwith_test test_number fun_to_test arg correct_failure = flush_all (); try fun_to_test arg; fprintf stderr ">>> Failure expected (%s, test %d)\n" !function_tested test_number; error () with x -> if x = correct_failure then begin printf " %d..." test_number; success () end else begin fprintf stderr ">>> Bad failure (%s, test %d)\n" !function_tested test_number; error () end;; let end_tests () = flush_all (); print_newline (); if !error_occurred then begin print_endline "************* TESTS FAILED ****************"; exit 2 end else begin print_endline "************* TESTS COMPLETED SUCCESSFULLY ****************"; exit 0 end;; let eq = (==);; let eq_int (i: int) (j: int) = (i = j);; let eq_string (i: string) (j: string) = (i = j);; let eq_bytes (i: bytes) (j: bytes) = (i = j);; let eq_bytes_string (i: bytes) (j: string) = (i = Bytes.of_string j);; let eq_nativeint (i: nativeint) (j: nativeint) = (i = j);; let eq_int32 (i: int32) (j: int32) = (i = j);; let eq_int64 (i: int64) (j: int64) = (i = j);; let eq_float (x: float) (y: float) = Pervasives.compare x y = 0;; let sixtyfour = Sys.int_size > 32 let rec gcd_int i1 i2 = if i2 = 0 then abs i1 else gcd_int i2 (i1 mod i2);; let rec num_bits_int_aux n = if n = 0 then 0 else succ(num_bits_int_aux (n lsr 1));; let num_bits_int n = num_bits_int_aux (abs n);; let sign_int i = if i = 0 then 0 else if i > 0 then 1 else -1;; let length_of_int = Sys.int_size - 1;; let monster_int = 1 lsl length_of_int;; let biggest_int = monster_int - 1;; let least_int = - biggest_int;; let compare_int n1 n2 = if n1 == n2 then 0 else if n1 > n2 then 1 else -1;; js_of_ocaml-3.5.2/compiler/num-testsuite/test_big_ints.ml000066400000000000000000001110271357507750000236360ustar00rootroot00000000000000open Test;; open Nat;; open Big_int;; open List;; testing_function "compare_big_int";; test 1 eq_int (compare_big_int zero_big_int zero_big_int, 0);; test 2 eq_int (compare_big_int zero_big_int (big_int_of_int 1), (-1));; test 3 eq_int (compare_big_int zero_big_int (big_int_of_int (-1)), 1);; test 4 eq_int (compare_big_int (big_int_of_int 1) zero_big_int, 1);; test 5 eq_int (compare_big_int (big_int_of_int (-1)) zero_big_int, (-1));; test 6 eq_int (compare_big_int (big_int_of_int 1) (big_int_of_int 1), 0);; test 7 eq_int (compare_big_int (big_int_of_int (-1)) (big_int_of_int (-1)), 0);; test 8 eq_int (compare_big_int (big_int_of_int 1) (big_int_of_int (-1)), 1);; test 9 eq_int (compare_big_int (big_int_of_int (-1)) (big_int_of_int 1), (-1));; test 10 eq_int (compare_big_int (big_int_of_int 1) (big_int_of_int 2), (-1));; test 11 eq_int (compare_big_int (big_int_of_int 2) (big_int_of_int 1), 1);; test 12 eq_int (compare_big_int (big_int_of_int (-1)) (big_int_of_int (-2)), 1);; test 13 eq_int (compare_big_int (big_int_of_int (-2)) (big_int_of_int (-1)), (-1));; testing_function "pred_big_int";; test 1 eq_big_int (pred_big_int zero_big_int, big_int_of_int (-1));; test 2 eq_big_int (pred_big_int unit_big_int, zero_big_int);; test 3 eq_big_int (pred_big_int (big_int_of_int (-1)), big_int_of_int (-2));; testing_function "succ_big_int";; test 1 eq_big_int (succ_big_int zero_big_int, unit_big_int);; test 2 eq_big_int (succ_big_int unit_big_int, big_int_of_int 2);; test 3 eq_big_int (succ_big_int (big_int_of_int (-1)), zero_big_int);; testing_function "add_big_int";; test 1 eq_big_int (add_big_int zero_big_int zero_big_int, zero_big_int);; test 2 eq_big_int (add_big_int zero_big_int (big_int_of_int 1), big_int_of_int 1);; test 3 eq_big_int (add_big_int (big_int_of_int 1) zero_big_int, big_int_of_int 1);; test 4 eq_big_int (add_big_int zero_big_int (big_int_of_int (-1)), big_int_of_int (-1));; test 5 eq_big_int (add_big_int (big_int_of_int (-1)) zero_big_int, big_int_of_int (-1));; test 6 eq_big_int (add_big_int (big_int_of_int 1) (big_int_of_int 1), big_int_of_int 2);; test 7 eq_big_int (add_big_int (big_int_of_int 1) (big_int_of_int 2), big_int_of_int 3);; test 8 eq_big_int (add_big_int (big_int_of_int 2) (big_int_of_int 1), big_int_of_int 3);; test 9 eq_big_int (add_big_int (big_int_of_int (-1)) (big_int_of_int (-1)), big_int_of_int (-2));; test 10 eq_big_int (add_big_int (big_int_of_int (-1)) (big_int_of_int (-2)), big_int_of_int (-3));; test 11 eq_big_int (add_big_int (big_int_of_int (-2)) (big_int_of_int (-1)), big_int_of_int (-3));; test 12 eq_big_int (add_big_int (big_int_of_int 1) (big_int_of_int (-1)), zero_big_int);; test 13 eq_big_int (add_big_int (big_int_of_int (-1)) (big_int_of_int 1), zero_big_int);; test 14 eq_big_int (add_big_int (big_int_of_int 1) (big_int_of_int (-2)), big_int_of_int (-1));; test 15 eq_big_int (add_big_int (big_int_of_int (-2)) (big_int_of_int 1), big_int_of_int (-1));; test 16 eq_big_int (add_big_int (big_int_of_int (-1)) (big_int_of_int 2), big_int_of_int 1);; test 17 eq_big_int (add_big_int (big_int_of_int 2) (big_int_of_int (-1)), big_int_of_int 1);; testing_function "sub_big_int";; test 1 eq_big_int (sub_big_int zero_big_int zero_big_int, zero_big_int);; test 2 eq_big_int (sub_big_int zero_big_int (big_int_of_int 1), big_int_of_int (-1));; test 3 eq_big_int (sub_big_int (big_int_of_int 1) zero_big_int, big_int_of_int 1);; test 4 eq_big_int (sub_big_int zero_big_int (big_int_of_int (-1)), big_int_of_int 1);; test 5 eq_big_int (sub_big_int (big_int_of_int (-1)) zero_big_int, big_int_of_int (-1));; test 6 eq_big_int (sub_big_int (big_int_of_int 1) (big_int_of_int 1), zero_big_int);; test 7 eq_big_int (sub_big_int (big_int_of_int 1) (big_int_of_int 2), big_int_of_int (-1));; test 8 eq_big_int (sub_big_int (big_int_of_int 2) (big_int_of_int 1), big_int_of_int 1);; test 9 eq_big_int (sub_big_int (big_int_of_int (-1)) (big_int_of_int (-1)), zero_big_int);; test 10 eq_big_int (sub_big_int (big_int_of_int (-1)) (big_int_of_int (-2)), big_int_of_int 1);; test 11 eq_big_int (sub_big_int (big_int_of_int (-2)) (big_int_of_int (-1)), big_int_of_int (-1));; test 12 eq_big_int (sub_big_int (big_int_of_int 1) (big_int_of_int (-1)), big_int_of_int 2);; test 13 eq_big_int (sub_big_int (big_int_of_int (-1)) (big_int_of_int 1), big_int_of_int (-2));; test 14 eq_big_int (sub_big_int (big_int_of_int 1) (big_int_of_int (-2)), big_int_of_int 3);; test 15 eq_big_int (sub_big_int (big_int_of_int (-2)) (big_int_of_int 1), big_int_of_int (-3));; test 16 eq_big_int (sub_big_int (big_int_of_int (-1)) (big_int_of_int 2), big_int_of_int (-3));; test 17 eq_big_int (sub_big_int (big_int_of_int 2) (big_int_of_int (-1)), big_int_of_int 3);; testing_function "mult_int_big_int";; test 1 eq_big_int (mult_int_big_int 0 (big_int_of_int 3), zero_big_int);; test 2 eq_big_int (mult_int_big_int 1 (big_int_of_int 3), big_int_of_int 3);; test 3 eq_big_int (mult_int_big_int 1 zero_big_int, zero_big_int);; test 4 eq_big_int (mult_int_big_int 2 (big_int_of_int 3), big_int_of_int 6);; testing_function "mult_big_int";; test 1 eq_big_int (mult_big_int zero_big_int zero_big_int, zero_big_int);; test 2 eq_big_int (mult_big_int (big_int_of_int 2) (big_int_of_int 3), big_int_of_int 6);; test 3 eq_big_int (mult_big_int (big_int_of_int 2) (big_int_of_int (-3)), big_int_of_int (-6));; test 4 eq_big_int (mult_big_int (big_int_of_string "12724951") (big_int_of_string "81749606400"), big_int_of_string "1040259735709286400");; test 5 eq_big_int (mult_big_int (big_int_of_string "26542080") (big_int_of_string "81749606400"), big_int_of_string "2169804593037312000");; testing_function "quomod_big_int";; let (quotient, modulo) = quomod_big_int (big_int_of_int 1) (big_int_of_int 1) in test 1 eq_big_int (quotient, big_int_of_int 1) && test 2 eq_big_int (modulo, zero_big_int);; let (quotient, modulo) = quomod_big_int (big_int_of_int 1) (big_int_of_int (-1)) in test 3 eq_big_int (quotient, big_int_of_int (-1)) && test 4 eq_big_int (modulo, zero_big_int);; let (quotient, modulo) = quomod_big_int (big_int_of_int (-1)) (big_int_of_int 1) in test 5 eq_big_int (quotient, big_int_of_int (-1)) && test 6 eq_big_int (modulo, zero_big_int);; let (quotient, modulo) = quomod_big_int (big_int_of_int 3) (big_int_of_int 2) in test 7 eq_big_int (quotient, big_int_of_int 1) && test 8 eq_big_int (modulo, big_int_of_int 1);; let (quotient, modulo) = quomod_big_int (big_int_of_int 5) (big_int_of_int 3) in test 9 eq_big_int (quotient, big_int_of_int 1) && test 10 eq_big_int (modulo, big_int_of_int 2);; let (quotient, modulo) = quomod_big_int (big_int_of_int (-5)) (big_int_of_int 3) in test 11 eq_big_int (quotient, big_int_of_int (-2)) && test 12 eq_big_int (modulo, big_int_of_int 1);; let (quotient, modulo) = quomod_big_int (big_int_of_int 1) (big_int_of_int 2) in test 13 eq_big_int (quotient, zero_big_int) && test 14 eq_big_int (modulo, big_int_of_int 1);; let (quotient, modulo) = quomod_big_int (big_int_of_int (-1)) (big_int_of_int 3) in test 15 eq_big_int (quotient, minus_big_int unit_big_int) && test 16 eq_big_int (modulo, big_int_of_int 2);; failwith_test 17 (quomod_big_int (big_int_of_int 1)) zero_big_int Division_by_zero ;; let (quotient, modulo) = quomod_big_int (big_int_of_int 10) (big_int_of_int 20) in test 18 eq_big_int (quotient, big_int_of_int 0) && test 19 eq_big_int (modulo, big_int_of_int 10);; let (quotient, modulo) = quomod_big_int (big_int_of_int (-10)) (big_int_of_int 20) in test 20 eq_big_int (quotient, big_int_of_int (-1)) && test 21 eq_big_int (modulo, big_int_of_int 10);; let (quotient, modulo) = quomod_big_int (big_int_of_int 10) (big_int_of_int (-20)) in test 22 eq_big_int (quotient, big_int_of_int 0) && test 23 eq_big_int (modulo, big_int_of_int 10);; let (quotient, modulo) = quomod_big_int (big_int_of_int (-10)) (big_int_of_int (-20)) in test 24 eq_big_int (quotient, big_int_of_int 1) && test 25 eq_big_int (modulo, big_int_of_int 10);; testing_function "gcd_big_int";; test 1 eq_big_int (gcd_big_int zero_big_int zero_big_int, zero_big_int);; test 2 eq_big_int (gcd_big_int zero_big_int (big_int_of_int 1), big_int_of_int 1);; test 3 eq_big_int (gcd_big_int (big_int_of_int 1) zero_big_int, big_int_of_int 1);; test 4 eq_big_int (gcd_big_int (big_int_of_int 1) (big_int_of_int 2), big_int_of_int 1);; test 5 eq_big_int (gcd_big_int (big_int_of_int 2) (big_int_of_int 1), big_int_of_int 1);; test 6 eq_big_int (gcd_big_int (big_int_of_int 1) (big_int_of_int 1), big_int_of_int 1);; test 7 eq_big_int (gcd_big_int (big_int_of_int 9) (big_int_of_int 16), big_int_of_int 1);; test 8 eq_big_int (gcd_big_int (big_int_of_int 12) (big_int_of_int 16), big_int_of_int 4);; for i = 9 to 28 do let n1 = Random.int 1000000000 and n2 = Random.int 100000 in let _ = test i eq (int_of_big_int (gcd_big_int (big_int_of_int n1) (big_int_of_int n2)), gcd_int n1 n2) in () done;; testing_function "int_of_big_int";; test 1 eq_int (int_of_big_int (big_int_of_int 1), 1);; test 2 eq_int (int_of_big_int (big_int_of_int(-1)), -1);; test 3 eq_int (int_of_big_int zero_big_int, 0);; test 4 eq_int (int_of_big_int (big_int_of_int max_int), max_int);; test 5 eq_int (int_of_big_int (big_int_of_int min_int), min_int);; failwith_test 6 (fun () -> int_of_big_int (succ_big_int (big_int_of_int max_int))) () (Failure "int_of_big_int");; failwith_test 7 (fun () -> int_of_big_int (pred_big_int (big_int_of_int min_int))) () (Failure "int_of_big_int");; failwith_test 8 (fun () -> int_of_big_int (mult_big_int (big_int_of_int min_int) (big_int_of_int 2))) () (Failure "int_of_big_int");; testing_function "is_int_big_int";; test 1 eq (is_int_big_int (big_int_of_int 1), true);; test 2 eq (is_int_big_int (big_int_of_int (-1)), true);; test 3 eq (is_int_big_int (succ_big_int (big_int_of_int biggest_int)), false);; test 4 eq (int_of_big_int (big_int_of_int monster_int), monster_int);; (* Should be true *) test 5 eq (is_int_big_int (big_int_of_string (string_of_int biggest_int)), true);; test 6 eq (is_int_big_int (big_int_of_string (string_of_int least_int)), true);; test 7 eq (is_int_big_int (big_int_of_string (string_of_int monster_int)), true);; (* Should be false *) (* Successor of biggest_int is not an int *) test 8 eq (is_int_big_int (succ_big_int (big_int_of_int (biggest_int))), false);; test 9 eq (is_int_big_int (succ_big_int (succ_big_int (big_int_of_int (biggest_int)))), false);; (* Negation of monster_int (as a big_int) is not an int *) test 10 eq (is_int_big_int (minus_big_int (big_int_of_string (string_of_int monster_int))), false);; testing_function "sys_string_of_big_int";; test 1 eq_string (string_of_big_int (big_int_of_int 1), "1");; testing_function "big_int_of_string";; test 1 eq_big_int (big_int_of_string "1", big_int_of_int 1);; test 2 eq_big_int (big_int_of_string "-1", big_int_of_int (-1));; test 4 eq_big_int (big_int_of_string "0", zero_big_int);; failwith_test 5 big_int_of_string "sdjdkfighdgf" (Failure "invalid digit");; test 6 eq_big_int (big_int_of_string "123", big_int_of_int 123);; test 7 eq_big_int (big_int_of_string "+3456", big_int_of_int 3456);; test 9 eq_big_int (big_int_of_string "-3456", big_int_of_int (-3456));; let implode = List.fold_left (^) "";; (* To hell with efficiency *) let l = rev [ "174679877494298468451661416292903906557638850173895426081611831060970135303"; "044177587617233125776581034213405720474892937404345377707655788096850784519"; "539374048533324740018513057210881137248587265169064879918339714405948322501"; "445922724181830422326068913963858377101914542266807281471620827145038901025"; "322784396182858865537924078131032036927586614781817695777639491934361211399"; "888524140253852859555118862284235219972858420374290985423899099648066366558"; "238523612660414395240146528009203942793935957539186742012316630755300111472"; "852707974927265572257203394961525316215198438466177260614187266288417996647"; "132974072337956513457924431633191471716899014677585762010115338540738783163"; "739223806648361958204720897858193606022290696766988489073354139289154127309"; "916985231051926209439373780384293513938376175026016587144157313996556653811"; "793187841050456120649717382553450099049321059330947779485538381272648295449"; "847188233356805715432460040567660999184007627415398722991790542115164516290"; "619821378529926683447345857832940144982437162642295073360087284113248737998"; "046564369129742074737760485635495880623324782103052289938185453627547195245"; "688272436219215066430533447287305048225780425168823659431607654712261368560"; "702129351210471250717394128044019490336608558608922841794819375031757643448"; "32" ] in let bi1 = big_int_of_string (implode (rev l)) in let bi2 = big_int_of_string (implode (rev ("3" :: tl l))) in test 10 eq_big_int (bi1, (add_big_int (mult_big_int bi2 (big_int_of_string "10")) (big_int_of_string "2"))) (* test 11 && eq_big_int (bi1, (add_big_int (mult_big_int bi2 (big_int_of_string "10e0")) (big_int_of_string "20e-1"))) && test 12 eq_big_int (minus_big_int bi1, (add_big_int (mult_big_int bi2 (big_int_of_string "-10e0")) (big_int_of_string "-20e-1"))) && test 13 eq_big_int (bi1, (add_big_int (mult_big_int bi2 (big_int_of_string "+10e0")) (big_int_of_string "+20e-1"))) && test 14 eq_big_int (minus_big_int bi1, (add_big_int (mult_big_int bi2 (big_int_of_string "-10e+0")) (big_int_of_string "-20e-1"))) && test 15 eq_big_int (minus_big_int bi1, (add_big_int (mult_big_int bi2 (big_int_of_string "-1e+1")) (big_int_of_string "-2e-0"))) && test 16 eq_big_int (minus_big_int bi1, (add_big_int (mult_big_int bi2 (big_int_of_string "-0.1e+2")) (big_int_of_string "-2.0e-0"))) && test 17 eq_big_int (minus_big_int bi1, (add_big_int (mult_big_int bi2 (big_int_of_string "-1.000e+1")) (big_int_of_string "-0.02e2")))*) ;; test 18 eq_big_int (big_int_of_string "0xAbC", big_int_of_int 0xABC);; test 19 eq_big_int (big_int_of_string "-0o452", big_int_of_int (-0o452));; test 20 eq_big_int (big_int_of_string "0B110101", big_int_of_int 53);; test 21 eq_big_int (big_int_of_string "0b11_01_01", big_int_of_int 53);; testing_function "power_base_int";; test 1 eq_big_int (big_int_of_nat (power_base_int 10 0), unit_big_int) ;; test 2 eq_big_int (big_int_of_nat (power_base_int 10 8), big_int_of_int 100000000) ;; test 3 eq_big_int (big_int_of_nat (power_base_int 2 (Nat.length_of_digit)), big_int_of_nat (let nat = make_nat 2 in set_digit_nat nat 1 1; nat)) ;; testing_function "base_power_big_int";; test 1 eq_big_int (base_power_big_int 10 0 (big_int_of_int 2), big_int_of_int 2);; test 2 eq_big_int (base_power_big_int 10 2 (big_int_of_int 2), big_int_of_int 200);; test 3 eq_big_int (base_power_big_int 10 1 (big_int_of_int 123), big_int_of_int 1230) ;; testing_function "power_int_positive_big_int";; test 1 eq_big_int (power_int_positive_big_int 2 (big_int_of_int 10), big_int_of_int 1024);; test 2 eq_big_int (power_int_positive_big_int 2 (big_int_of_int 65), big_int_of_string "36893488147419103232");; test 3 eq_big_int (power_int_positive_big_int 3 (big_int_of_string "47"), big_int_of_string "26588814358957503287787");; test 4 eq_big_int (power_int_positive_big_int 1 (big_int_of_string "1000000000000000000000"), big_int_of_int 1);; test 5 eq_big_int (power_int_positive_big_int (-1) (big_int_of_string "1000000000000000000000"), big_int_of_int 1);; test 6 eq_big_int (power_int_positive_big_int (-1) (big_int_of_string "1000000000000000000001"), big_int_of_int (-1));; test 7 eq_big_int (power_int_positive_big_int 0 (big_int_of_string "1000000000000000000000"), big_int_of_int 0);; testing_function "power_big_int_positive_int";; test 1 eq_big_int (power_big_int_positive_int (big_int_of_int 2) 10, big_int_of_int 1024);; test 2 eq_big_int (power_big_int_positive_int (big_int_of_int 100) 20, big_int_of_string "10000000000000000000000000000000000000000");; test 3 eq_big_int (power_big_int_positive_int (big_int_of_string "3") 47, big_int_of_string "26588814358957503287787");; test 4 eq_big_int (power_big_int_positive_int (big_int_of_string "200000000000000") 34, big_int_of_string "17179869184000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000");; test 5 eq_big_int (power_big_int_positive_int (big_int_of_string "2197609328765") 243, big_int_of_string "12415638672345366257764851943822299490113545698929764576040102857365\ 27920436565335427676982530274588056944387957287793378051852205028658\ 73008292720317554332284838709453634119919368441951233982592586680844\ 20765201140575612595182857026804842796931784944918059630667794516774\ 58498235838834599150657873894983300999081942159304585449505963892008\ 97855706440206825609657816209327492197604711437269361628626691080334\ 38432768885637928268354258860147333786379766583179851226375449161073\ 10396958979998161989562418169797611757651190037273397850239552735199\ 63719988832594486235837899145390948533078339399890545062510060406048\ 61331200657727576638170520036143007285549092686618686739320973444703\ 33342725604091818763255601206325426337211467746377586080108631634250\ 11232258578207762608797108802386708549785680783113606089879687396654\ 54004281165259352412815385041917713969718327109245777066079665194617\ 29230093411050053217775067781725651590160086483960457766025246936489\ 92234225900994076609973190516835778346886551506344097474301175288686\ 25662752919718480402972207084177612056491949911377568680526080633587\ 33230060757162252611388973328501680433819585006035301408574879645573\ 47126018243568976860515247053858204554293343161581801846081341003624\ 22906934772131205632200433218165757307182816260714026614324014553342\ 77303133877636489457498062819003614421295692889321460150481573909330\ 77301946991278225819671075907191359721824291923283322225480199446258\ 03302645587072103949599624444368321734975586414930425964782010567575\ 43333331963876294983400462908871215572514487548352925949663431718284\ 14589547315559936497408670231851521193150991888789948397029796279240\ 53117024758684807981605608837291399377902947471927467827290844733264\ 70881963357258978768427852958888430774360783419404195056122644913454\ 24537375432013012467418602205343636983874410969339344956536142566292\ 67710105053213729008973121773436382170956191942409859915563249876601\ 97309463059908818473774872128141896864070835259683384180928526600888\ 17480854811931632353621014638284918544379784608050029606475137979896\ 79160729736625134310450643341951675749112836007180865039256361941093\ 99844921135320096085772541537129637055451495234892640418746420370197\ 76655592198723057553855194566534999101921182723711243608938705766658\ 35660299983828999383637476407321955462859142012030390036241831962713\ 40429407146441598507165243069127531565881439971034178400174881243483\ 00001434950666035560134867554719667076133414445044258086968145695386\ 00575860256380332451841441394317283433596457253185221717167880159573\ 60478649571700878049257386910142909926740023800166057094445463624601\ 79490246367497489548435683835329410376623483996271147060314994344869\ 89606855219181727424853876740423210027967733989284801813769926906846\ 45570461348452758744643550541290031199432061998646306091218518879810\ 17848488755494879341886158379140088252013009193050706458824793551984\ 39285914868159111542391208521561221610797141925061986437418522494485\ 59871215531081904861310222368465288125816137210222223075106739997863\ 76953125");; testing_function "power_big_int_positive_big_int";; test 1 eq_big_int (power_big_int_positive_big_int (big_int_of_int 2) (big_int_of_int 10), big_int_of_int 1024);; test 2 eq_big_int (power_big_int_positive_big_int (big_int_of_int 2) (big_int_of_int 65), big_int_of_string "36893488147419103232");; test 3 eq_big_int (power_big_int_positive_big_int (big_int_of_string "3") (big_int_of_string "47"), big_int_of_string "26588814358957503287787");; test 4 eq_big_int (power_big_int_positive_big_int (big_int_of_string "200000000000000") (big_int_of_int 34), big_int_of_string "17179869184000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000000000000000000000000000000000000000000000000000000000000\ 00000000000");; test 5 eq_big_int (power_big_int_positive_big_int (big_int_of_string "2197609328765") (big_int_of_string "243"), big_int_of_string "12415638672345366257764851943822299490113545698929764576040102857365\ 27920436565335427676982530274588056944387957287793378051852205028658\ 73008292720317554332284838709453634119919368441951233982592586680844\ 20765201140575612595182857026804842796931784944918059630667794516774\ 58498235838834599150657873894983300999081942159304585449505963892008\ 97855706440206825609657816209327492197604711437269361628626691080334\ 38432768885637928268354258860147333786379766583179851226375449161073\ 10396958979998161989562418169797611757651190037273397850239552735199\ 63719988832594486235837899145390948533078339399890545062510060406048\ 61331200657727576638170520036143007285549092686618686739320973444703\ 33342725604091818763255601206325426337211467746377586080108631634250\ 11232258578207762608797108802386708549785680783113606089879687396654\ 54004281165259352412815385041917713969718327109245777066079665194617\ 29230093411050053217775067781725651590160086483960457766025246936489\ 92234225900994076609973190516835778346886551506344097474301175288686\ 25662752919718480402972207084177612056491949911377568680526080633587\ 33230060757162252611388973328501680433819585006035301408574879645573\ 47126018243568976860515247053858204554293343161581801846081341003624\ 22906934772131205632200433218165757307182816260714026614324014553342\ 77303133877636489457498062819003614421295692889321460150481573909330\ 77301946991278225819671075907191359721824291923283322225480199446258\ 03302645587072103949599624444368321734975586414930425964782010567575\ 43333331963876294983400462908871215572514487548352925949663431718284\ 14589547315559936497408670231851521193150991888789948397029796279240\ 53117024758684807981605608837291399377902947471927467827290844733264\ 70881963357258978768427852958888430774360783419404195056122644913454\ 24537375432013012467418602205343636983874410969339344956536142566292\ 67710105053213729008973121773436382170956191942409859915563249876601\ 97309463059908818473774872128141896864070835259683384180928526600888\ 17480854811931632353621014638284918544379784608050029606475137979896\ 79160729736625134310450643341951675749112836007180865039256361941093\ 99844921135320096085772541537129637055451495234892640418746420370197\ 76655592198723057553855194566534999101921182723711243608938705766658\ 35660299983828999383637476407321955462859142012030390036241831962713\ 40429407146441598507165243069127531565881439971034178400174881243483\ 00001434950666035560134867554719667076133414445044258086968145695386\ 00575860256380332451841441394317283433596457253185221717167880159573\ 60478649571700878049257386910142909926740023800166057094445463624601\ 79490246367497489548435683835329410376623483996271147060314994344869\ 89606855219181727424853876740423210027967733989284801813769926906846\ 45570461348452758744643550541290031199432061998646306091218518879810\ 17848488755494879341886158379140088252013009193050706458824793551984\ 39285914868159111542391208521561221610797141925061986437418522494485\ 59871215531081904861310222368465288125816137210222223075106739997863\ 76953125");; test 6 eq_big_int (power_big_int_positive_big_int (big_int_of_int 1) (big_int_of_string "1000000000000000000000"), big_int_of_int 1);; test 7 eq_big_int (power_big_int_positive_big_int (big_int_of_int (-1)) (big_int_of_string "1000000000000000000000"), big_int_of_int 1);; test 8 eq_big_int (power_big_int_positive_big_int (big_int_of_int (-1)) (big_int_of_string "1000000000000000000001"), big_int_of_int (-1));; test 9 eq_big_int (power_big_int_positive_big_int (big_int_of_int 0) (big_int_of_string "1000000000000000000000"), big_int_of_int 0);; testing_function "square_big_int";; test 1 eq_big_int (square_big_int (big_int_of_string "0"), big_int_of_string "0");; test 2 eq_big_int (square_big_int (big_int_of_string "1"), big_int_of_string "1");; test 3 eq_big_int (square_big_int (big_int_of_string "-1"), big_int_of_string "1");; test 4 eq_big_int (square_big_int (big_int_of_string "-7"), big_int_of_string "49");; testing_function "big_int_of_nativeint";; test 1 eq_big_int (big_int_of_nativeint 0n, zero_big_int);; test 2 eq_big_int (big_int_of_nativeint 1234n, big_int_of_string "1234");; test 3 eq_big_int (big_int_of_nativeint (-1234n), big_int_of_string "-1234");; testing_function "nativeint_of_big_int";; test 1 eq_nativeint (nativeint_of_big_int zero_big_int, 0n);; test 2 eq_nativeint (nativeint_of_big_int (big_int_of_string "1234"), 1234n);; test 2 eq_nativeint (nativeint_of_big_int (big_int_of_string "-1234"), -1234n);; testing_function "big_int_of_int32";; test 1 eq_big_int (big_int_of_int32 0l, zero_big_int);; test 2 eq_big_int (big_int_of_int32 2147483647l, big_int_of_string "2147483647");; test 3 eq_big_int (big_int_of_int32 (-2147483648l), big_int_of_string "-2147483648");; testing_function "int32_of_big_int";; test 1 eq_int32 (int32_of_big_int zero_big_int, 0l);; test 2 eq_int32 (int32_of_big_int (big_int_of_string "2147483647"), 2147483647l);; test 3 eq_int32 (int32_of_big_int (big_int_of_string "-2147483648"), -2147483648l);; test 4 eq_int32 (int32_of_big_int (big_int_of_string "-2147"), -2147l);; let should_fail s = try ignore (int32_of_big_int (big_int_of_string s)); 0 with Failure _ -> 1;; test 5 eq_int (should_fail "2147483648", 1);; test 6 eq_int (should_fail "-2147483649", 1);; test 7 eq_int (should_fail "4294967296", 1);; test 8 eq_int (should_fail "18446744073709551616", 1);; testing_function "big_int_of_int64";; test 1 eq_big_int (big_int_of_int64 0L, zero_big_int);; test 2 eq_big_int (big_int_of_int64 9223372036854775807L, big_int_of_string "9223372036854775807");; test 3 eq_big_int (big_int_of_int64 (-9223372036854775808L), big_int_of_string "-9223372036854775808");; test 4 eq_big_int (*PR#4792*) (big_int_of_int64 (Int64.of_int32 Int32.min_int), big_int_of_string "-2147483648");; test 5 eq_big_int (big_int_of_int64 1234L, big_int_of_string "1234");; test 6 eq_big_int (big_int_of_int64 0x1234567890ABCDEFL, big_int_of_string "1311768467294899695");; test 7 eq_big_int (big_int_of_int64 (-1234L), big_int_of_string "-1234");; test 8 eq_big_int (big_int_of_int64 (-0x1234567890ABCDEFL), big_int_of_string "-1311768467294899695");; testing_function "int64_of_big_int";; test 1 eq_int64 (int64_of_big_int zero_big_int, 0L);; test 2 eq_int64 (int64_of_big_int (big_int_of_string "9223372036854775807"), 9223372036854775807L);; test 3 eq_int64 (int64_of_big_int (big_int_of_string "-9223372036854775808"), -9223372036854775808L);; test 4 eq_int64 (int64_of_big_int (big_int_of_string "-9223372036854775"), -9223372036854775L);; test 5 eq_int64 (* PR#4804 *) (int64_of_big_int (big_int_of_string "2147483648"), 2147483648L);; let should_fail s = try ignore (int64_of_big_int (big_int_of_string s)); 0 with Failure _ -> 1;; test 6 eq_int (should_fail "9223372036854775808", 1);; test 7 eq_int (should_fail "-9223372036854775809", 1);; test 8 eq_int (should_fail "18446744073709551616", 1);; (* build a 128-bit big int from two int64 *) let big_int_128 hi lo = add_big_int (mult_big_int (big_int_of_int64 hi) (big_int_of_string "18446744073709551616")) (big_int_of_int64 lo);; let h1 = 0x7fd05b7ee46a29f8L and h2 = 0x64b28b8ee70b6e6dL and h3 = 0x58546e563f5b44f0L and h4 = 0x1db72f6377ff3ec6L and h5 = 0x4f9bb0a19c543cb1L;; testing_function "and_big_int";; test 1 eq_big_int (and_big_int unit_big_int zero_big_int, zero_big_int);; test 2 eq_big_int (and_big_int zero_big_int unit_big_int, zero_big_int);; test 3 eq_big_int (and_big_int unit_big_int unit_big_int, unit_big_int);; test 4 eq_big_int (and_big_int (big_int_128 h1 h2) (big_int_128 h3 h4), big_int_128 (Int64.logand h1 h3) (Int64.logand h2 h4));; test 5 eq_big_int (and_big_int (big_int_128 h1 h2) (big_int_of_int64 h5), big_int_of_int64 (Int64.logand h2 h5));; test 6 eq_big_int (and_big_int (big_int_of_int64 h5) (big_int_128 h3 h4) , big_int_of_int64 (Int64.logand h5 h4));; testing_function "or_big_int";; test 1 eq_big_int (or_big_int unit_big_int zero_big_int, unit_big_int);; test 2 eq_big_int (or_big_int zero_big_int unit_big_int, unit_big_int);; test 3 eq_big_int (or_big_int unit_big_int unit_big_int, unit_big_int);; test 4 eq_big_int (or_big_int (big_int_128 h1 h2) (big_int_128 h3 h4), big_int_128 (Int64.logor h1 h3) (Int64.logor h2 h4));; test 5 eq_big_int (or_big_int (big_int_128 h1 h2) (big_int_of_int64 h5), big_int_128 h1 (Int64.logor h2 h5));; test 6 eq_big_int (or_big_int (big_int_of_int64 h5) (big_int_128 h3 h4) , big_int_128 h3 (Int64.logor h5 h4));; testing_function "xor_big_int";; test 1 eq_big_int (xor_big_int unit_big_int zero_big_int, unit_big_int);; test 2 eq_big_int (xor_big_int zero_big_int unit_big_int, unit_big_int);; test 3 eq_big_int (xor_big_int unit_big_int unit_big_int, zero_big_int);; test 4 eq_big_int (xor_big_int (big_int_128 h1 h2) (big_int_128 h3 h4), big_int_128 (Int64.logxor h1 h3) (Int64.logxor h2 h4));; test 5 eq_big_int (xor_big_int (big_int_128 h1 h2) (big_int_of_int64 h5), big_int_128 h1 (Int64.logxor h2 h5));; test 6 eq_big_int (xor_big_int (big_int_of_int64 h5) (big_int_128 h3 h4) , big_int_128 h3 (Int64.logxor h5 h4));; testing_function "shift_left_big_int";; test 1 eq_big_int (shift_left_big_int unit_big_int 0, unit_big_int);; test 2 eq_big_int (shift_left_big_int unit_big_int 1, big_int_of_int 2);; test 2 eq_big_int (shift_left_big_int unit_big_int 31, big_int_of_string "2147483648");; test 3 eq_big_int (shift_left_big_int unit_big_int 64, big_int_of_string "18446744073709551616");; test 4 eq_big_int (shift_left_big_int unit_big_int 95, big_int_of_string "39614081257132168796771975168");; test 5 eq_big_int (shift_left_big_int (big_int_of_string "39614081257132168796771975168") 67, big_int_of_string "5846006549323611672814739330865132078623730171904");; test 6 eq_big_int (shift_left_big_int (big_int_of_string "-39614081257132168796771975168") 67, big_int_of_string "-5846006549323611672814739330865132078623730171904");; testing_function "shift_right_big_int";; test 1 eq_big_int (shift_right_big_int unit_big_int 0, unit_big_int);; test 2 eq_big_int (shift_right_big_int (big_int_of_int 12345678) 3, big_int_of_int 1543209);; test 3 eq_big_int (shift_right_big_int (big_int_of_string "5299989648942") 32, big_int_of_int 1234);; test 4 eq_big_int (shift_right_big_int (big_int_of_string "5846006549323611672814739330865132078623730171904") 67, big_int_of_string "39614081257132168796771975168");; test 5 eq_big_int (shift_right_big_int (big_int_of_string "-5299989648942") 32, big_int_of_int (-1235));; test 6 eq_big_int (shift_right_big_int (big_int_of_string "-16570089876543209725755392") 27, big_int_of_string "-123456790123456789");; testing_function "shift_right_towards_zero_big_int";; test 1 eq_big_int (shift_right_towards_zero_big_int (big_int_of_string "-5299989648942") 32, big_int_of_int (-1234));; test 2 eq_big_int (shift_right_towards_zero_big_int (big_int_of_string "-16570089876543209725755392") 27, big_int_of_string "-123456790123456789");; testing_function "extract_big_int";; test 1 eq_big_int (extract_big_int (big_int_of_int64 0x123456789ABCDEFL) 3 13, big_int_of_int 6589);; test 2 eq_big_int (extract_big_int (big_int_128 h1 h2) 67 12, big_int_of_int 1343);; test 3 eq_big_int (extract_big_int (big_int_of_string "-1844674407370955178") 37 9, big_int_of_int 307);; test 4 eq_big_int (extract_big_int unit_big_int 2048 254, zero_big_int);; test 5 eq_big_int (extract_big_int (big_int_of_int64 0x123456789ABCDEFL) 0 32, big_int_of_int64 2309737967L);; test 6 eq_big_int (extract_big_int (big_int_of_int (-1)) 0 16, big_int_of_int 0xFFFF);; test 7 eq_big_int (extract_big_int (big_int_of_int (-1)) 1027 12, big_int_of_int 0xFFF);; test 8 eq_big_int (extract_big_int (big_int_of_int (-1234567)) 0 16, big_int_of_int 10617);; test 9 eq_big_int (extract_big_int (minus_big_int (power_int_positive_int 2 64)) 64 20, big_int_of_int 0xFFFFF);; test 10 eq_big_int (extract_big_int (pred_big_int (minus_big_int (power_int_positive_int 2 64))) 64 20, big_int_of_int 0xFFFFE);; testing_function "hashing of big integers";; test 1 eq_int (Hashtbl.hash zero_big_int, 955772237);; test 2 eq_int (Hashtbl.hash unit_big_int, 992063522);; test 3 eq_int (Hashtbl.hash (minus_big_int unit_big_int), 161678167);; test 4 eq_int (Hashtbl.hash (big_int_of_string "123456789123456789"), 755417385);; test 5 eq_int (Hashtbl.hash (sub_big_int (big_int_of_string "123456789123456789") (big_int_of_string "123456789123456789")), 955772237);; test 6 eq_int (Hashtbl.hash (sub_big_int (big_int_of_string "123456789123456789") (big_int_of_string "123456789123456788")), 992063522);; testing_function "float_of_big_int";; test 1 eq_float (float_of_big_int zero_big_int, 0.0);; test 2 eq_float (float_of_big_int unit_big_int, 1.0);; test 3 eq_float (float_of_big_int (minus_big_int unit_big_int), -1.0);; test 4 eq_float (float_of_big_int (shift_left_big_int unit_big_int 1024), infinity);; test 5 eq_float (float_of_big_int (shift_left_big_int unit_big_int 1023), ldexp 1.0 1023);; (* Some random int64 values *) let ok = ref true in for i = 1 to 100 do let n = Random.int64 Int64.max_int in if not (eq_float (float_of_big_int (big_int_of_int64 n)) (Int64.to_float n)) then ok := false; let n = Int64.neg n in if not (eq_float (float_of_big_int (big_int_of_int64 n)) (Int64.to_float n)) then ok := false done; test 6 eq (!ok, true);; (* Some random int64 values scaled by some random power of 2 *) let ok = ref true in for i = 1 to 1000 do let n = Random.int64 Int64.max_int in let exp = Random.int 1200 in if not (eq_float (float_of_big_int (shift_left_big_int (big_int_of_int64 n) exp)) (ldexp (Int64.to_float n) exp)) then ok := false; let n = Int64.neg n in if not (eq_float (float_of_big_int (shift_left_big_int (big_int_of_int64 n) exp)) (ldexp (Int64.to_float n) exp)) then ok := false done; test 7 eq (!ok, true);; (* Round to nearest even *) let ok = ref true in for i = 0 to 15 do let n = Int64.(add 0xfffffffffffff0L (of_int i)) in if not (eq_float (float_of_big_int (shift_left_big_int (big_int_of_int64 n) 32)) (ldexp (Int64.to_float n) 32)) then ok := false done; test 8 eq (!ok, true);; js_of_ocaml-3.5.2/compiler/num-testsuite/test_io.ml000066400000000000000000000025531357507750000224520ustar00rootroot00000000000000open Test open Nat open Big_int open Num let intern_extern obj = let f = Filename.temp_file "testnum" ".data" in let oc = open_out_bin f in output_value oc obj; close_out oc; let ic = open_in_bin f in let res = input_value ic in close_in ic; Sys.remove f; res ;; testing_function "output_value/input_value on nats";; let equal_nat n1 n2 = eq_nat n1 0 (length_nat n1) n2 0 (length_nat n2) ;; List.iter (fun (i, s) -> let n = nat_of_string s in ignore(test i equal_nat (n, intern_extern n))) [1, "0"; 2, "1234"; 3, "8589934592"; 4, "340282366920938463463374607431768211455"; 5, String.make 100 '3'; 6, String.make 1000 '9'; 7, String.make 20000 '8'] ;; testing_function "output_value/input_value on big ints";; List.iter (fun (i, s) -> let b = big_int_of_string s in ignore(test i eq_big_int (b, intern_extern b))) [1, "0"; 2, "1234"; 3, "-1234"; 4, "1040259735709286400"; 5, "-" ^ String.make 20000 '7'] ;; testing_function "output_value/input_value on nums";; List.iter (fun (i, s) -> let n = num_of_string s in ignore(test i eq_num (n, intern_extern n))) [1, "0"; 2, "1234"; 3, "-1234"; 4, "159873568791325097646845892426782"; 5, "1/4"; 6, "-15/2"; 7, "159873568791325097646845892426782/24098772507410987265987"; 8, String.make 10000 '3' ^ "/" ^ String.make 5000 '7'] ;; js_of_ocaml-3.5.2/compiler/num-testsuite/test_nats.ml000066400000000000000000000066021357507750000230070ustar00rootroot00000000000000open Test;; open Nat;; (* Can compare nats less than 2**32 *) let equal_nat n1 n2 = eq_nat n1 0 (num_digits_nat n1 0 1) n2 0 (num_digits_nat n2 0 1);; testing_function "num_digits_nat";; test (-1) eq (false,not true);; test 0 eq (true,not false);; test 1 eq_int (let r = make_nat 2 in set_digit_nat r 1 1; num_digits_nat r 0 1,1);; testing_function "length_nat";; test 1 eq_int (let r = make_nat 2 in set_digit_nat r 0 1; length_nat r,2);; testing_function "equal_nat";; let zero_nat = make_nat 1 in test 1 equal_nat (zero_nat,zero_nat);; test 2 equal_nat (nat_of_int 1,nat_of_int 1);; test 3 equal_nat (nat_of_string "2",nat_of_string "2");; test 4 eq (equal_nat (nat_of_string "2")(nat_of_string "3"),false);; testing_function "incr_nat";; let zero = nat_of_int 0 in let res = incr_nat zero 0 1 1 in test 1 equal_nat (zero, nat_of_int 1) && test 2 eq (res,0);; let n = nat_of_int 1 in let res = incr_nat n 0 1 1 in test 3 equal_nat (n, nat_of_int 2) && test 4 eq (res,0);; testing_function "decr_nat";; let n = nat_of_int 1 in let res = decr_nat n 0 1 0 in test 1 equal_nat (n, nat_of_int 0) && test 2 eq (res,1);; let n = nat_of_int 2 in let res = decr_nat n 0 1 0 in test 3 equal_nat (n, nat_of_int 1) && test 4 eq (res,1);; testing_function "is_zero_nat";; let n = nat_of_int 1 in test 1 eq (is_zero_nat n 0 1,false) && test 2 eq (is_zero_nat (make_nat 1) 0 1, true) && test 3 eq (is_zero_nat (make_nat 2) 0 2, true) && (let r = make_nat 2 in set_digit_nat r 1 1; test 4 eq (is_zero_nat r 0 1, true)) ;; testing_function "string_of_nat";; let n = make_nat 4;; test 1 eq_string (string_of_nat n, "0");; complement_nat n 0 (if sixtyfour then 2 else 4);; test 2 eq_string (string_of_nat n, "340282366920938463463374607431768211455");; testing_function "string_of_nat && nat_of_string";; for i = 1 to 20 do let s = "1" ^ String.make (i-1) '0' in ignore (test i eq_string (string_of_nat (nat_of_string s), s)) done;; let set_mult_digit_nat n1 d1 l1 n2 d2 l2 n3 d3 = ignore (mult_digit_nat n1 d1 l1 n2 d2 l2 n3 d3) ;; let s = "33333333333333333333333333333333333333333333333333333333333333333333\ 33333333333333333333333333333333333333333333333333333333333333333333" in test 21 equal_nat ( nat_of_string s, (let nat = make_nat 15 in set_digit_nat nat 0 3; set_mult_digit_nat nat 0 15 (nat_of_string (String.sub s 0 135)) 0 14 (nat_of_int 10) 0; nat)) ;; test 22 eq_string (string_of_nat(nat_of_string "1073741824"), "1073741824");; testing_function "gcd_nat";; for i = 1 to 20 do let n1 = Random.int 1000000000 and n2 = Random.int 100000 in let nat1 = nat_of_int n1 and nat2 = nat_of_int n2 in ignore (gcd_nat nat1 0 1 nat2 0 1); ignore (test i eq (int_of_nat nat1, gcd_int n1 n2)) done ;; testing_function "sqrt_nat";; test 1 equal_nat (sqrt_nat (nat_of_int 1) 0 1, nat_of_int 1);; test 2 equal_nat (let n = nat_of_string "8589934592" in sqrt_nat n 0 (length_nat n), nat_of_string "92681");; test 3 equal_nat (let n = nat_of_string "4294967295" in sqrt_nat n 0 (length_nat n), nat_of_string "65535");; test 4 equal_nat (let n = nat_of_string "18446744065119617025" in sqrt_nat n 0 (length_nat n), nat_of_string "4294967295");; test 5 equal_nat (sqrt_nat (nat_of_int 15) 0 1, nat_of_int 3);; js_of_ocaml-3.5.2/compiler/num-testsuite/test_nums.ml000066400000000000000000000153441357507750000230270ustar00rootroot00000000000000open Test;; open Nat;; open Big_int;; open Ratio;; open Num;; open Arith_status;; testing_function "add_num";; test 1 eq_num (add_num (Int 1) (Int 3), Int 4);; test 2 eq_num (add_num (Int 1) (Big_int (big_int_of_int 3)), Int 4);; test 3 eq_num (add_num (Int 1) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "7/4"));; test 4 eq_num (add_num (Big_int (big_int_of_int 1)) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "7/4"));; test 5 eq_num (add_num (Big_int (big_int_of_int 1)) (Big_int (big_int_of_int 3)), Int 4);; test 6 eq_num (add_num (Big_int (big_int_of_int 1)) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "7/4"));; test 7 eq_num (add_num (Ratio (ratio_of_string "2/3")) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "17/12"));; test 8 eq_num (add_num (Int least_int) (Int 1), Int (- (pred biggest_int)));; test 9 eq_num (add_num (Int biggest_int) (Int 1), Big_int (minus_big_int (pred_big_int (big_int_of_int least_int))));; testing_function "sub_num";; test 1 eq_num (sub_num (Int 1) (Int 3), Int (-2));; test 2 eq_num (sub_num (Int 1) (Big_int (big_int_of_int 3)), Int (-2));; test 3 eq_num (sub_num (Int 1) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "1/4"));; test 4 eq_num (sub_num (Big_int (big_int_of_int 1)) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "1/4"));; test 5 eq_num (sub_num (Big_int (big_int_of_int 1)) (Big_int (big_int_of_int 3)), Int (-2));; test 7 eq_num (sub_num (Big_int (big_int_of_int 1)) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "1/4"));; test 8 eq_num (sub_num (Ratio (ratio_of_string "2/3")) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "-1/12"));; test 9 eq_num (sub_num (Int least_int) (Int (-1)), Int (- (pred biggest_int)));; test 10 eq_num (sub_num (Int (-1)) (Int biggest_int), pred_num (Int least_int));; testing_function "mult_num";; test 1 eq_num (mult_num (Int 2) (Int 3), Int 6);; test 2 eq_num (mult_num (Int 127) (Int (int_of_string "257")), Int (int_of_string "32639"));; test 3 eq_num (mult_num (Int 257) (Int (int_of_string "260")), Big_int (big_int_of_string "66820"));; test 4 eq_num (mult_num (Int 2) (Big_int (big_int_of_int 3)), Int 6);; test 5 eq_num (mult_num (Int 10) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "15/2"));; test 6 eq_num (mult_num (Big_int (big_int_of_int 10)) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "15/2"));; test 7 eq_num (mult_num (Big_int (big_int_of_int 2)) (Big_int (big_int_of_int 3)), Int 6);; test 8 eq_num (mult_num (Big_int (big_int_of_int 10)) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "15/2"));; test 9 eq_num (mult_num (Ratio (ratio_of_string "2/3")) (Ratio (ratio_of_string "3/4")) , Ratio (ratio_of_string "1/2"));; testing_function "div_num";; test 1 eq_num (div_num (Int 6) (Int 3), Int 2);; test 2 eq_num (div_num (Int (int_of_string "32639")) (Int (int_of_string "257")), Int 127);; test 3 eq_num (div_num (Big_int (big_int_of_string "66820")) (Int (int_of_string "257")), Int 260);; test 4 eq_num (div_num (Int 6) (Big_int (big_int_of_int 3)), Int 2);; test 5 eq_num (div_num (Ratio (ratio_of_string "15/2")) (Int 10), Ratio (ratio_of_string "3/4"));; test 6 eq_num (div_num (Big_int (big_int_of_int 6)) (Big_int (big_int_of_int 3)), Int 2);; test 7 eq_num (div_num (Ratio (ratio_of_string "15/2")) (Big_int (big_int_of_int 10)), Ratio (ratio_of_string "3/4"));; test 8 eq_num (div_num (Ratio (ratio_of_string "15/2")) (Ratio (ratio_of_string "3/4")), Big_int (big_int_of_int 10));; test 9 eq_num (div_num (Ratio (ratio_of_string "1/2")) (Ratio (ratio_of_string "3/4")), Ratio (ratio_of_string "2/3"));; testing_function "is_integer_num";; test 1 eq (is_integer_num (Int 3),true);; test 2 eq (is_integer_num (Big_int (big_int_of_string "1234567890")),true);; test 3 eq (not (is_integer_num (Ratio (ratio_of_string "1/2"))),true);; test 4 eq (is_integer_num (Ratio (ratio_of_string "1073774590/32770")),true);; testing_function "num_of_ratio";; test 1 eq_num (num_of_ratio (ratio_of_string "4/2"), Int 2);; test 2 eq_num (num_of_ratio (ratio_of_string "11811160075/11"), Big_int (big_int_of_string "1073741825"));; test 3 eq_num (num_of_ratio (ratio_of_string "123456789012/1234"), Ratio (ratio_of_string "61728394506/617"));; testing_function "num_of_string";; test 1 eq_num (num_of_string "123/3456", Ratio (ratio_of_string "123/3456"));; (********* test 2 eq_num (num_of_string "12.3/34.56", Ratio (ratio_of_string "1230/3456"));; test 3 eq_num (num_of_string "1.23/325.6", Ratio (ratio_of_string "123/32560"));; test 4 eq_num (num_of_string "12.3/345.6", Ratio (ratio_of_string "123/3456"));; set_error_when_null_denominator false;; test 5 eq_num (num_of_string "12.3/0.0", Ratio (ratio_of_string "123/0"));; test 6 eq_num (num_of_string "0/0", Ratio (ratio_of_string "0/0"));; set_error_when_null_denominator true;; *********) test 7 eq_num (num_of_string "1234567890", Big_int (big_int_of_string "1234567890"));; test 8 eq_num (num_of_string "12345", Int (int_of_string "12345"));; (********* test 9 eq_num (num_of_string "0.23", Ratio (ratio_of_string "23/100"));; test 10 eq_num (num_of_string "0.23", Ratio (ratio_of_string "0.23/1"));; ********) failwith_test 11 num_of_string ("frlshjkurty") (Failure "num_of_string");; test 12 eq_num (num_of_string "0xAbCdEf", Big_int (big_int_of_int 0xabcdef));; test 13 eq_num (num_of_string "0b1101/0O1765", Ratio (ratio_of_string "0b1101/0o1765"));; test 14 eq_num (num_of_string "-12_34_56", Big_int (big_int_of_int (-123456)));; test 15 eq_num (num_of_string "0B101010", Big_int (big_int_of_int 42));; (******* testing_function "immediate numbers";; standard arith false;; let x = (1/2) in test 0 eq_string (string_of_num x, "1/2");; let y = 12345678901 in test 1 eq_string (string_of_num y, "12345678901");; testing_function "immediate numbers";; let x = (1/2) in test 0 eq_string (string_of_num x, "1/2");; let y = 12345678901 in test 1 eq_string (string_of_num y, "12345678901");; testing_function "pattern_matching on nums";; let f1 = function 0 -> true | _ -> false;; test 1 eq (f1 0, true);; test 2 eq (f1 1, false);; test 3 eq (f1 (0/1), true);; test 4 eq (f1 (let n = num_of_string "2000000000000000000000000" in n-n) , true);; test 5 eq (f1 (let n = num_of_string "2000000000000000000000000" in n/n-1) , true);; test 6 eq (f1 (let n = num_of_string "2000000000000000000000000" in n+1) , false);; test 7 eq (f1 (1/2), false);; **************) js_of_ocaml-3.5.2/compiler/num-testsuite/test_ratios.ml000066400000000000000000001031041357507750000233360ustar00rootroot00000000000000open Test;; open Nat;; open Big_int;; open Ratio;; open Arith_status;; set_error_when_null_denominator false ;; let infinite_failure = "infinite or undefined rational number";; testing_function "create_ratio" ;; let r = create_ratio (big_int_of_int 1) (big_int_of_int (-2)) in test 1 eq_big_int (numerator_ratio r, big_int_of_int (-1)) && test 2 eq_big_int (denominator_ratio r, big_int_of_int 2) ;; let r = create_ratio (big_int_of_int 2) (big_int_of_int 3) in test 3 eq_big_int (numerator_ratio r, big_int_of_int 2) && test 4 eq_big_int (denominator_ratio r, big_int_of_int 3) ;; set_normalize_ratio true ;; let r = create_ratio (big_int_of_int 12) (big_int_of_int (-16)) in test 5 eq_big_int (numerator_ratio r, big_int_of_int (-3)) && test 6 eq_big_int (denominator_ratio r, big_int_of_int 4) ;; set_normalize_ratio false ;; let r = create_ratio (big_int_of_int 0) (big_int_of_int 0) in test 7 eq_big_int (numerator_ratio r, big_int_of_int 0) && test 8 eq_big_int (denominator_ratio r, big_int_of_int 0) ;; testing_function "create_normalized_ratio" ;; let r = create_normalized_ratio (big_int_of_int 1) (big_int_of_int (-2)) in test 1 eq_big_int (numerator_ratio r, big_int_of_int (-1)) && test 2 eq_big_int (denominator_ratio r, big_int_of_int 2) ;; let r = create_normalized_ratio (big_int_of_int 2) (big_int_of_int 3) in test 3 eq_big_int (numerator_ratio r, big_int_of_int 2) && test 4 eq_big_int (denominator_ratio r, big_int_of_int 3) ;; set_normalize_ratio true ;; let r = create_normalized_ratio (big_int_of_int 12) (big_int_of_int (-16)) in test 5 eq_big_int (numerator_ratio r, big_int_of_int (-12)) && test 6 eq_big_int (denominator_ratio r, big_int_of_int 16) ;; set_normalize_ratio false ;; let r = create_normalized_ratio (big_int_of_int 1) (big_int_of_int 0) in test 7 eq_big_int (numerator_ratio r, big_int_of_int 1) && test 8 eq_big_int (denominator_ratio r, big_int_of_int 0) ;; let r = create_normalized_ratio (big_int_of_int 0) (big_int_of_int 0) in test 9 eq_big_int (numerator_ratio r, big_int_of_int 0) && test 10 eq_big_int (denominator_ratio r, big_int_of_int 0) ;; testing_function "null_denominator" ;; test 1 eq (null_denominator (create_ratio (big_int_of_int 1) (big_int_of_int (-2))), false) ;; test 2 eq (null_denominator (create_ratio (big_int_of_int 1) zero_big_int),true) ;; (***** testing_function "verify_null_denominator" ;; test 1 eq (verify_null_denominator (ratio_of_string "0/1"), false) ;; test 2 eq (verify_null_denominator (ratio_of_string "0/0"), true) ;; *****) testing_function "sign_ratio" ;; test 1 eq_int (sign_ratio (create_ratio (big_int_of_int (-2)) (big_int_of_int (-3))), 1) ;; test 2 eq_int (sign_ratio (create_ratio (big_int_of_int 2) (big_int_of_int (-3))), (-1)) ;; test 3 eq_int (sign_ratio (create_ratio zero_big_int (big_int_of_int (-3))), 0) ;; testing_function "normalize_ratio" ;; let r = create_ratio (big_int_of_int 12) (big_int_of_int (-16)) in ignore (normalize_ratio r); test 1 eq_big_int (numerator_ratio r, big_int_of_int (-3)) && test 2 eq_big_int (denominator_ratio r, big_int_of_int 4) ;; let r = create_ratio (big_int_of_int (-1)) zero_big_int in ignore (normalize_ratio r); test 3 eq_big_int (numerator_ratio r, big_int_of_int (-1)) && test 4 eq_big_int (denominator_ratio r, zero_big_int) ;; testing_function "report_sign_ratio" ;; test 1 eq_big_int (report_sign_ratio (create_ratio (big_int_of_int 2) (big_int_of_int (-3))) (big_int_of_int 1), big_int_of_int (-1)) ;; test 2 eq_big_int (report_sign_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (big_int_of_int 1), big_int_of_int 1) ;; testing_function "is_integer_ratio" ;; test 1 eq (is_integer_ratio (create_ratio (big_int_of_int 2) (big_int_of_int (-1))), true) ;; test 2 eq (is_integer_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)), false) ;; testing_function "add_ratio" ;; let r = add_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 2)) (create_ratio (big_int_of_int 2) (big_int_of_int 3)) in test 1 eq_big_int (numerator_ratio r, big_int_of_int 7) && test 2 eq_big_int (denominator_ratio r, big_int_of_int 6) ;; let r = add_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (create_ratio (big_int_of_int 1) (big_int_of_int (-2))) in test 3 eq_big_int (numerator_ratio r, big_int_of_int 1) && test 4 eq_big_int (denominator_ratio r, big_int_of_int 6) ;; let r = add_ratio (create_ratio (big_int_of_int 2) zero_big_int) (create_ratio (big_int_of_int 1) (big_int_of_int (-2))) in test 5 eq_big_int (numerator_ratio r, big_int_of_int 4) && test 6 eq_big_int (denominator_ratio r, zero_big_int) ;; let r = add_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (create_ratio (big_int_of_int 1) zero_big_int) in test 7 eq_big_int (numerator_ratio r, big_int_of_int 3) && test 8 eq_big_int (denominator_ratio r, zero_big_int) ;; let r = add_ratio (create_ratio (big_int_of_int 2) zero_big_int) (create_ratio (big_int_of_int 1) zero_big_int) in test 9 eq_big_int (numerator_ratio r, zero_big_int) && test 10 eq_big_int (denominator_ratio r, zero_big_int) ;; let r = add_ratio (create_ratio (big_int_of_string "12724951") (big_int_of_string "26542080")) (create_ratio (big_int_of_string "-1") (big_int_of_string "81749606400")) in test 11 eq_big_int (numerator_ratio r, big_int_of_string "1040259735682744320") && test 12 eq_big_int (denominator_ratio r, big_int_of_string "2169804593037312000") ;; let r1,r2 = (create_ratio (big_int_of_string "12724951") (big_int_of_string "26542080"), create_ratio (big_int_of_string "-1") (big_int_of_string "81749606400")) in let bi1 = mult_big_int (numerator_ratio r1) (denominator_ratio r2) and bi2 = mult_big_int (numerator_ratio r2) (denominator_ratio r1) in test 1 eq_big_int (bi1, big_int_of_string "1040259735709286400") && test 2 eq_big_int (bi2, big_int_of_string "-26542080") && test 3 eq_big_int (mult_big_int (denominator_ratio r1) (denominator_ratio r2), big_int_of_string "2169804593037312000") && test 4 eq_big_int (add_big_int bi1 bi2, big_int_of_string "1040259735682744320") ;; testing_function "sub_ratio" ;; let r = sub_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (create_ratio (big_int_of_int 1) (big_int_of_int 2)) in test 1 eq_big_int (numerator_ratio r, big_int_of_int 1) && test 2 eq_big_int (denominator_ratio r, big_int_of_int 6) ;; let r = sub_ratio (create_ratio (big_int_of_int 2) zero_big_int) (create_ratio (big_int_of_int 1) (big_int_of_int (-2))) in test 3 eq_big_int (numerator_ratio r, big_int_of_int 4) && test 4 eq_big_int (denominator_ratio r, zero_big_int) ;; let r = sub_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (create_ratio (big_int_of_int 1) zero_big_int) in test 5 eq_big_int (numerator_ratio r, big_int_of_int (-3)) && test 6 eq_big_int (denominator_ratio r, zero_big_int) ;; let r = sub_ratio (create_ratio (big_int_of_int 2) zero_big_int) (create_ratio (big_int_of_int 1) zero_big_int) in test 7 eq_big_int (numerator_ratio r, zero_big_int) && test 8 eq_big_int (denominator_ratio r, zero_big_int) ;; testing_function "mult_ratio" ;; let r = mult_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (create_ratio (big_int_of_int 7) (big_int_of_int 5)) in test 1 eq_big_int (numerator_ratio r, big_int_of_int 14) && test 2 eq_big_int (denominator_ratio r, big_int_of_int 15) ;; let r = mult_ratio (create_ratio (big_int_of_int 2) zero_big_int) (create_ratio (big_int_of_int 1) (big_int_of_int (-2))) in test 3 eq_big_int (numerator_ratio r, big_int_of_int (-2)) && test 4 eq_big_int (denominator_ratio r, zero_big_int) ;; let r = mult_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (create_ratio (big_int_of_int 1) zero_big_int) in test 5 eq_big_int (numerator_ratio r, big_int_of_int 2) && test 6 eq_big_int (denominator_ratio r, zero_big_int) ;; let r = mult_ratio (create_ratio (big_int_of_int 2) zero_big_int) (create_ratio (big_int_of_int 1) zero_big_int) in test 7 eq_big_int (numerator_ratio r, big_int_of_int 2) && test 8 eq_big_int (denominator_ratio r, zero_big_int) ;; testing_function "div_ratio" ;; let r = div_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (create_ratio (big_int_of_int 5) (big_int_of_int 7)) in test 1 eq_big_int (numerator_ratio r, big_int_of_int 14) && test 2 eq_big_int (denominator_ratio r, big_int_of_int 15) ;; let r = div_ratio (create_ratio (big_int_of_int 2) zero_big_int) (create_ratio (big_int_of_int 1) (big_int_of_int (-2))) in test 3 eq_big_int (numerator_ratio r, big_int_of_int (-4)) && test 4 eq_big_int (denominator_ratio r, zero_big_int) ;; let r = div_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 3)) (create_ratio (big_int_of_int 1) zero_big_int) in test 5 eq_big_int (numerator_ratio r, zero_big_int) && test 6 eq_big_int (denominator_ratio r, big_int_of_int 3) ;; let r = div_ratio (create_ratio (big_int_of_int 2) zero_big_int) (create_ratio (big_int_of_int 1) zero_big_int) in test 7 eq_big_int (numerator_ratio r, zero_big_int) && test 8 eq_big_int (denominator_ratio r, zero_big_int) ;; testing_function "integer_ratio" ;; test 1 eq_big_int (integer_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)), big_int_of_int 1) ;; test 2 eq_big_int (integer_ratio (create_ratio (big_int_of_int 5) (big_int_of_int (-3))), big_int_of_int (-1)) ;; test 3 eq_big_int (integer_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 2)), big_int_of_int 1) ;; test 4 eq_big_int (integer_ratio (create_ratio (big_int_of_int 3) (big_int_of_int (-2))), big_int_of_int (-1)) ;; failwith_test 5 integer_ratio (create_ratio (big_int_of_int 3) zero_big_int) (Failure("integer_ratio "^infinite_failure)) ;; testing_function "floor_ratio" ;; test 1 eq_big_int (floor_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)), big_int_of_int 1) ;; test 2 eq_big_int (floor_ratio (create_ratio (big_int_of_int 5) (big_int_of_int (-3))), big_int_of_int (-2)) ;; test 3 eq_big_int (floor_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 2)), big_int_of_int 1) ;; test 4 eq_big_int (floor_ratio (create_ratio (big_int_of_int 3) (big_int_of_int (-2))), big_int_of_int (-2)) ;; failwith_test 5 floor_ratio (create_ratio (big_int_of_int 3) zero_big_int) Division_by_zero ;; testing_function "round_ratio" ;; test 1 eq_big_int (round_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)), big_int_of_int 2) ;; test 2 eq_big_int (round_ratio (create_ratio (big_int_of_int 5) (big_int_of_int (-3))), big_int_of_int (-2)) ;; test 3 eq_big_int (round_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 2)), big_int_of_int 2) ;; test 4 eq_big_int (round_ratio (create_ratio (big_int_of_int 3) (big_int_of_int (-2))), big_int_of_int (-2)) ;; failwith_test 5 round_ratio (create_ratio (big_int_of_int 3) zero_big_int) Division_by_zero ;; testing_function "ceiling_ratio" ;; test 1 eq_big_int (ceiling_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)), big_int_of_int 2) ;; test 2 eq_big_int (ceiling_ratio (create_ratio (big_int_of_int 5) (big_int_of_int (-3))), big_int_of_int (-1)) ;; test 3 eq_big_int (ceiling_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 2)), big_int_of_int 2) ;; test 4 eq_big_int (ceiling_ratio (create_ratio (big_int_of_int 3) (big_int_of_int (-2))), big_int_of_int (-1)) ;; test 5 eq_big_int (ceiling_ratio (create_ratio (big_int_of_int 4) (big_int_of_int 2)), big_int_of_int 2) ;; failwith_test 6 ceiling_ratio (create_ratio (big_int_of_int 3) zero_big_int) Division_by_zero ;; testing_function "eq_ratio" ;; test 1 eq_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3), create_ratio (big_int_of_int (-20)) (big_int_of_int (-12))) ;; test 2 eq_ratio (create_ratio (big_int_of_int 1) zero_big_int, create_ratio (big_int_of_int 2) zero_big_int) ;; let neq_ratio x y = not (eq_ratio x y);; test 3 neq_ratio (create_ratio (big_int_of_int 1) zero_big_int, create_ratio (big_int_of_int (-1)) zero_big_int) ;; test 4 neq_ratio (create_ratio (big_int_of_int 1) zero_big_int, create_ratio zero_big_int zero_big_int) ;; test 5 eq_ratio (create_ratio zero_big_int zero_big_int, create_ratio zero_big_int zero_big_int) ;; testing_function "compare_ratio" ;; test 1 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 0)) (create_ratio (big_int_of_int 0) (big_int_of_int 0)), 0) ;; test 2 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 0)) (create_ratio (big_int_of_int 1) (big_int_of_int 0)), 0) ;; test 3 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 0)) (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)), 0) ;; test 4 eq_int (compare_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (create_ratio (big_int_of_int 0) (big_int_of_int 0)), 0) ;; test 5 eq_int (compare_ratio (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)) (create_ratio (big_int_of_int 0) (big_int_of_int 0)), 0) ;; test 6 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 0)) (create_ratio (big_int_of_int 5) (big_int_of_int 3)), 0) ;; test 7 eq_int (compare_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)) (create_ratio (big_int_of_int 0) (big_int_of_int 0)), 0) ;; test 8 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 0)) (create_ratio (big_int_of_int (-5)) (big_int_of_int 3)), 0) ;; test 9 eq_int (compare_ratio (create_ratio (big_int_of_int (-5)) (big_int_of_int 3)) (create_ratio (big_int_of_int 0) (big_int_of_int 0)), 0) ;; test 10 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 0)) (create_ratio (big_int_of_int 0) (big_int_of_int 1)), 0) ;; test 11 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 1)) (create_ratio (big_int_of_int 0) (big_int_of_int 0)), 0) ;; test 12 eq_int (compare_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (create_ratio (big_int_of_int 1) (big_int_of_int 0)), 0) ;; test 13 eq_int (compare_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (create_ratio (big_int_of_int 2) (big_int_of_int 0)), 0) ;; test 14 eq_int (compare_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)), 1) ;; test 15 eq_int (compare_ratio (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)) (create_ratio (big_int_of_int 1) (big_int_of_int 0)), (-1)) ;; test 16 eq_int (compare_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)) (create_ratio (big_int_of_int 1) (big_int_of_int 0)), (-1)) ;; test 17 eq_int (compare_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (create_ratio (big_int_of_int 5) (big_int_of_int 3)), 1) ;; test 18 eq_int (compare_ratio (create_ratio (big_int_of_int (-5)) (big_int_of_int 3)) (create_ratio (big_int_of_int 1) (big_int_of_int 0)), (-1)) ;; test 19 eq_int (compare_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (create_ratio (big_int_of_int (-5)) (big_int_of_int 3)), 1) ;; test 20 eq_int (compare_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (create_ratio (big_int_of_int 0) (big_int_of_int 3)), 1) ;; test 21 eq_int (compare_ratio (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)) (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)), 0) ;; test 22 eq_int (compare_ratio (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)) (create_ratio (big_int_of_int (-2)) (big_int_of_int 0)), 0) ;; test 23 eq_int (compare_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)) (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)), 1) ;; test 24 eq_int (compare_ratio (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)) (create_ratio (big_int_of_int 5) (big_int_of_int 3)), (-1)) ;; test 25 eq_int (compare_ratio (create_ratio (big_int_of_int (-5)) (big_int_of_int 3)) (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)), 1) ;; test 26 eq_int (compare_ratio (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)) (create_ratio (big_int_of_int (-5)) (big_int_of_int 3)), (-1)) ;; test 27 eq_int (compare_ratio (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)) (create_ratio (big_int_of_int 0) (big_int_of_int 3)), (-1)) ;; test 28 eq_int (compare_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)) (create_ratio (big_int_of_int 3) (big_int_of_int 2)), 1) ;; test 29 eq_int (compare_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 2)) (create_ratio (big_int_of_int 5) (big_int_of_int 3)), (-1)) ;; test 30 eq_int (compare_ratio (create_ratio (big_int_of_int 5) (big_int_of_int 3)) (create_ratio (big_int_of_int (-3)) (big_int_of_int 2)), 1) ;; test 31 eq_int (compare_ratio (create_ratio (big_int_of_int (-3)) (big_int_of_int 2)) (create_ratio (big_int_of_int 5) (big_int_of_int 3)), (-1)) ;; test 32 eq_int (compare_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 2)) (create_ratio (big_int_of_int 0) (big_int_of_int 3)), 1) ;; test 33 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 2)) (create_ratio (big_int_of_int 5) (big_int_of_int 3)), (-1)) ;; test 34 eq_int (compare_ratio (create_ratio (big_int_of_int (-3)) (big_int_of_int 2)) (create_ratio (big_int_of_int 0) (big_int_of_int 3)), (-1)) ;; test 35 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 2)) (create_ratio (big_int_of_int (-5)) (big_int_of_int 3)), 1) ;; test 36 eq_int (compare_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 2)) (create_ratio (big_int_of_int 0) (big_int_of_int 3)), 0) ;; testing_function "eq_big_int_ratio" ;; test 1 eq_big_int_ratio (big_int_of_int 3, (create_ratio (big_int_of_int 3) (big_int_of_int 1))) ;; test 2 eq (not (eq_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int 3) (big_int_of_int 1))), true) ;; test 3 eq (not (eq_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int 3) (big_int_of_int 2))), true) ;; test 4 eq (not (eq_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int 3) (big_int_of_int 0))), true) ;; test 5 eq (not (eq_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int (-3)) (big_int_of_int 2))), true) ;; testing_function "compare_big_int_ratio" ;; test 1 eq_int (compare_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int 3) (big_int_of_int 0)), (-1)) ;; test 2 eq_int (compare_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int 0) (big_int_of_int 0)), 0) ;; test 3 eq_int (compare_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int (-3)) (big_int_of_int 0)), 1) ;; test 4 eq_int (compare_big_int_ratio (big_int_of_int (-1)) (create_ratio (big_int_of_int 3) (big_int_of_int 0)), (-1)) ;; test 5 eq_int (compare_big_int_ratio (big_int_of_int (-1)) (create_ratio (big_int_of_int 0) (big_int_of_int 0)), 0) ;; test 6 eq_int (compare_big_int_ratio (big_int_of_int (-1)) (create_ratio (big_int_of_int (-3)) (big_int_of_int 0)), 1) ;; test 7 eq_int (compare_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int 1) (big_int_of_int 1)), 0) ;; test 8 eq_int (compare_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int 3) (big_int_of_int 2)), (-1)) ;; test 9 eq_int (compare_big_int_ratio (big_int_of_int 1) (create_ratio (big_int_of_int 2) (big_int_of_int 3)), 1) ;; testing_function "int_of_ratio" ;; test 1 eq_int (int_of_ratio (create_ratio (big_int_of_int 4) (big_int_of_int 2)), 2) ;; test 2 eq_int (int_of_ratio (create_ratio (big_int_of_int biggest_int) (big_int_of_int 1)), biggest_int) ;; failwith_test 3 int_of_ratio (create_ratio (big_int_of_int 4) (big_int_of_int 0)) (Failure "integer argument required") ;; failwith_test 4 int_of_ratio (create_ratio (succ_big_int (big_int_of_int biggest_int)) (big_int_of_int 1)) (Failure "integer argument required") ;; failwith_test 5 int_of_ratio (create_ratio (big_int_of_int 4) (big_int_of_int 3)) (Failure "integer argument required") ;; testing_function "ratio_of_int" ;; test 1 eq_ratio (ratio_of_int 3, create_ratio (big_int_of_int 3) (big_int_of_int 1)) ;; test 2 eq_ratio (ratio_of_nat (nat_of_int 2), create_ratio (big_int_of_int 2) (big_int_of_int 1)) ;; testing_function "nat_of_ratio" ;; let nat1 = nat_of_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 1)) and nat2 = nat_of_int 3 in test 1 eq (eq_nat nat1 0 (length_nat nat1) nat2 0 (length_nat nat2), true) ;; failwith_test 2 nat_of_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 0)) (Failure "nat_of_ratio") ;; failwith_test 3 nat_of_ratio (create_ratio (big_int_of_int (-3)) (big_int_of_int 1)) (Failure "nat_of_ratio") ;; failwith_test 4 nat_of_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 2)) (Failure "nat_of_ratio") ;; testing_function "ratio_of_big_int" ;; test 1 eq_ratio (ratio_of_big_int (big_int_of_int 3), create_ratio (big_int_of_int 3) (big_int_of_int 1)) ;; testing_function "big_int_of_ratio" ;; test 1 eq_big_int (big_int_of_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 1)), big_int_of_int 3) ;; test 2 eq_big_int (big_int_of_ratio (create_ratio (big_int_of_int (-3)) (big_int_of_int 1)), big_int_of_int (-3)) ;; failwith_test 3 big_int_of_ratio (create_ratio (big_int_of_int 3) (big_int_of_int 0)) (Failure "big_int_of_ratio") ;; testing_function "string_of_ratio" ;; test 1 eq_string (string_of_ratio (create_ratio (big_int_of_int 43) (big_int_of_int 35)), "43/35") ;; test 2 eq_string (string_of_ratio (create_ratio (big_int_of_int 42) (big_int_of_int 0)), "1/0") ;; set_normalize_ratio_when_printing false ;; test 3 eq_string (string_of_ratio (create_ratio (big_int_of_int 42) (big_int_of_int 35)), "42/35") ;; set_normalize_ratio_when_printing true ;; test 4 eq_string (string_of_ratio (create_ratio (big_int_of_int 42) (big_int_of_int 35)), "6/5") ;; testing_function "ratio_of_string" ;; test 1 eq_ratio (ratio_of_string ("123/3456"), create_ratio (big_int_of_int 123) (big_int_of_int 3456)) ;; (*********** test 2 eq_ratio (ratio_of_string ("12.3/34.56"), create_ratio (big_int_of_int 1230) (big_int_of_int 3456)) ;; test 3 eq_ratio (ratio_of_string ("1.23/325.6"), create_ratio (big_int_of_int 123) (big_int_of_int 32560)) ;; test 4 eq_ratio (ratio_of_string ("12.3/345.6"), create_ratio (big_int_of_int 123) (big_int_of_int 3456)) ;; test 5 eq_ratio (ratio_of_string ("12.3/0.0"), create_ratio (big_int_of_int 123) (big_int_of_int 0)) ;; ***********) test 6 eq_ratio (ratio_of_string ("0/0"), create_ratio (big_int_of_int 0) (big_int_of_int 0)) ;; test 7 eq_ratio (ratio_of_string "1234567890", create_ratio (big_int_of_string "1234567890") unit_big_int) ;; failwith_test 8 ratio_of_string "frlshjkurty" (Failure "invalid digit");; (*********** testing_function "msd_ratio" ;; test 1 eq_int (msd_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 1)), 0) ;; test 2 eq_int (msd_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 12)), (-2)) ;; test 3 eq_int (msd_ratio (create_ratio (big_int_of_int 12) (big_int_of_int 1)), 1) ;; test 4 eq_int (msd_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 2)), (-1)) ;; test 5 eq_int (msd_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 1)), 0) ;; test 6 eq_int (msd_ratio (create_ratio (big_int_of_int 25) (big_int_of_int 21)), 0) ;; test 7 eq_int (msd_ratio (create_ratio (big_int_of_int 35) (big_int_of_int 21)), 0) ;; test 8 eq_int (msd_ratio (create_ratio (big_int_of_int 215) (big_int_of_int 31)), 0) ;; test 9 eq_int (msd_ratio (create_ratio (big_int_of_int 2) (big_int_of_int 30)), (-2)) ;; test 10 eq_int (msd_ratio (create_ratio (big_int_of_int 2345) (big_int_of_int 23456)), (-2)) ;; test 11 eq_int (msd_ratio (create_ratio (big_int_of_int 2345) (big_int_of_int 2346)), (-1)) ;; test 12 eq_int (msd_ratio (create_ratio (big_int_of_int 2345) (big_int_of_int 2344)), 0) ;; test 13 eq_int (msd_ratio (create_ratio (big_int_of_int 23456) (big_int_of_int 2345)), 1) ;; test 14 eq_int (msd_ratio (create_ratio (big_int_of_int 23467) (big_int_of_int 2345)), 1) ;; failwith_test 15 msd_ratio (create_ratio (big_int_of_int 1) (big_int_of_int 0)) ("msd_ratio "^infinite_failure) ;; failwith_test 16 msd_ratio (create_ratio (big_int_of_int (-1)) (big_int_of_int 0)) ("msd_ratio "^infinite_failure) ;; failwith_test 17 msd_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 0)) ("msd_ratio "^infinite_failure) ;; *************************) testing_function "round_futur_last_digit" ;; let s = Bytes.of_string "+123456" in test 1 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && test 2 eq_bytes_string (s, "+123466") ;; let s = Bytes.of_string "123456" in test 3 eq (round_futur_last_digit s 0 (Bytes.length s), false) && test 4 eq_bytes_string (s, "123466") ;; let s = Bytes.of_string "-123456" in test 5 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && test 6 eq_bytes_string (s, "-123466") ;; let s = Bytes.of_string "+123496" in test 7 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && test 8 eq_bytes_string (s, "+123506") ;; let s = Bytes.of_string "123496" in test 9 eq (round_futur_last_digit s 0 (Bytes.length s), false) && test 10 eq_bytes_string (s, "123506") ;; let s = Bytes.of_string "-123496" in test 11 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && test 12 eq_bytes_string (s, "-123506") ;; let s = Bytes.of_string "+996" in test 13 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), true) && test 14 eq_bytes_string (s, "+006") ;; let s = Bytes.of_string "996" in test 15 eq (round_futur_last_digit s 0 (Bytes.length s), true) && test 16 eq_bytes_string (s, "006") ;; let s = Bytes.of_string "-996" in test 17 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), true) && test 18 eq_bytes_string (s, "-006") ;; let s = Bytes.of_string "+6666666" in test 19 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && test 20 eq_bytes_string (s, "+6666676") ;; let s = Bytes.of_string "6666666" in test 21 eq (round_futur_last_digit s 0 (Bytes.length s), false) && test 22 eq_bytes_string (s, "6666676") ;; let s = Bytes.of_string "-6666666" in test 23 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && test 24 eq_bytes_string (s, "-6666676") ;; testing_function "approx_ratio_fix" ;; let s = approx_ratio_fix 5 (create_ratio (big_int_of_int 2) (big_int_of_int 3)) in test 1 eq_string (s, "+0.66667") ;; test 2 eq_string (approx_ratio_fix 5 (create_ratio (big_int_of_int 20) (big_int_of_int 3)), "+6.66667") ;; test 3 eq_string (approx_ratio_fix 5 (create_ratio (big_int_of_int 2) (big_int_of_int 30)), "+0.06667") ;; test 4 eq_string (approx_ratio_fix 5 (create_ratio (big_int_of_string "999996") (big_int_of_string "1000000")), "+1.00000") ;; test 5 eq_string (approx_ratio_fix 5 (create_ratio (big_int_of_string "299996") (big_int_of_string "100000")), "+2.99996") ;; test 6 eq_string (approx_ratio_fix 5 (create_ratio (big_int_of_string "2999996") (big_int_of_string "1000000")), "+3.00000") ;; test 7 eq_string (approx_ratio_fix 4 (create_ratio (big_int_of_string "299996") (big_int_of_string "100000")), "+3.0000") ;; test 8 eq_string (approx_ratio_fix 5 (create_ratio (big_int_of_int 29996) (big_int_of_string "100000")), "+0.29996") ;; test 9 eq_string (approx_ratio_fix 5 (create_ratio (big_int_of_int 0) (big_int_of_int 1)), "+0") ;; failwith_test 10 (approx_ratio_fix 5) (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (Failure "approx_ratio_fix infinite or undefined rational number") ;; failwith_test 11 (approx_ratio_fix 5) (create_ratio (big_int_of_int 0) (big_int_of_int 0)) (Failure "approx_ratio_fix infinite or undefined rational number") ;; (* PR#4566 *) test 12 eq_string (approx_ratio_fix 8 (create_ratio (big_int_of_int 9603) (big_int_of_string "100000000000")), "+0.00000010") ;; test 13 eq_string (approx_ratio_fix 1 (create_ratio (big_int_of_int 94) (big_int_of_int 1000)), "+0.1") ;; test 14 eq_string (approx_ratio_fix 1 (create_ratio (big_int_of_int 49) (big_int_of_int 1000)), "+0.0") ;; testing_function "approx_ratio_exp" ;; test 1 eq_string (approx_ratio_exp 5 (create_ratio (big_int_of_int 2) (big_int_of_int 3)), "+0.66667e0") ;; test 2 eq_string (approx_ratio_exp 5 (create_ratio (big_int_of_int 20) (big_int_of_int 3)), "+0.66667e1") ;; test 3 eq_string (approx_ratio_exp 5 (create_ratio (big_int_of_int 2) (big_int_of_int 30)), "+0.66667e-1") ;; test 4 eq_string (approx_ratio_exp 5 (create_ratio (big_int_of_string "999996") (big_int_of_string "1000000")), "+1.00000e0") ;; test 5 eq_string (approx_ratio_exp 5 (create_ratio (big_int_of_string "299996") (big_int_of_string "100000")), "+0.30000e1") ;; test 6 eq_string (approx_ratio_exp 5 (create_ratio (big_int_of_int 29996) (big_int_of_string "100000")), "+0.29996e0") ;; test 7 eq_string (approx_ratio_exp 5 (create_ratio (big_int_of_int 0) (big_int_of_int 1)), "+0.00000e0") ;; failwith_test 8 (approx_ratio_exp 5) (create_ratio (big_int_of_int 1) (big_int_of_int 0)) (Failure "approx_ratio_exp infinite or undefined rational number") ;; failwith_test 9 (approx_ratio_exp 5) (create_ratio (big_int_of_int 0) (big_int_of_int 0)) (Failure "approx_ratio_exp infinite or undefined rational number") ;; testing_function "float_of_ratio";; let ok = ref true in for i = 1 to 100 do let p = Random.int64 0x20000000000000L and pexp = Random.int 100 and q = Random.int64 0x20000000000000L and qexp = Random.int 100 in if not (eq_float (float_of_ratio (create_ratio (shift_left_big_int (big_int_of_int64 p) pexp) (shift_left_big_int (big_int_of_int64 q) qexp))) (ldexp (Int64.to_float p) pexp /. ldexp (Int64.to_float q) qexp)) then ok := false done; test 1 eq (!ok, true) ;; js_of_ocaml-3.5.2/compiler/ocaml-testsuite/000077500000000000000000000000001357507750000207415ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/.ocamlformat000066400000000000000000000000071357507750000232430ustar00rootroot00000000000000disablejs_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/000077500000000000000000000000001357507750000233055ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/bigarrays.ml000066400000000000000000001147311357507750000256310ustar00rootroot00000000000000[@@@ocaml.warning "-27"] (* TEST *) open Bigarray open Printf open Complex (* Test harness *) let error_occurred = ref false let function_tested = ref "" let testing_function s = function_tested := s; print_newline(); print_string s; print_newline() let test test_number answer correct_answer = flush stdout; flush stderr; if answer <> correct_answer then begin eprintf "*** Bad result (%s, test %d)\n" !function_tested test_number; flush stderr; error_occurred := true end else begin printf " %d..." test_number end (* One-dimensional arrays *) (* flambda can cause some of these values not to be reclaimed by the Gc, which * can undermine the use of Gc.full_major for the Windows ports. All the tests * are wrapped in a non-inlineable function to prevent this behaviour. *) let tests () = testing_function "------ Array1 --------"; testing_function "create/set/get"; let test_setget kind vals = let rec set a i = function [] -> () | (v1, v2) :: tl -> a.{i} <- v1; set a (i+1) tl in let rec test a i = function [] -> true | (v1, v2) :: tl -> a.{i} = v2 && test a (i+1) tl in let ca = Array1.create kind c_layout (List.length vals) in let fa = Array1.create kind fortran_layout (List.length vals) in set ca 0 vals; set fa 1 vals; test ca 0 vals && test fa 1 vals in test 1 true (test_setget int8_signed [0, 0; 123, 123; -123, -123; 456, -56; 0x101, 1]); test 2 true (test_setget int8_unsigned [0, 0; 123, 123; -123, 133; 456, 0xc8; 0x101, 1]); test 3 true (test_setget int16_signed [0, 0; 123, 123; -123, -123; 31456, 31456; -31456, -31456; 65432, -104; 0x10001, 1]); test 4 true (test_setget int16_unsigned [0, 0; 123, 123; -123, 65413; 31456, 31456; -31456, 34080; 65432, 65432; 0x10001, 1]); test 5 true (test_setget int [0, 0; 123, 123; -456, -456; max_int, max_int; min_int, min_int; 0x12345678, 0x12345678; -0x12345678, -0x12345678]); test 6 true (test_setget int32 [Int32.zero, Int32.zero; Int32.of_int 123, Int32.of_int 123; Int32.of_int (-456), Int32.of_int (-456); Int32.max_int, Int32.max_int; Int32.min_int, Int32.min_int; Int32.of_string "0x12345678", Int32.of_string "0x12345678"]); test 7 true (test_setget int64 [Int64.zero, Int64.zero; Int64.of_int 123, Int64.of_int 123; Int64.of_int (-456), Int64.of_int (-456); Int64.max_int, Int64.max_int; Int64.min_int, Int64.min_int; Int64.of_string "0x123456789ABCDEF0", Int64.of_string "0x123456789ABCDEF0"]); test 8 true (test_setget nativeint [Nativeint.zero, Nativeint.zero; Nativeint.of_int 123, Nativeint.of_int 123; Nativeint.of_int (-456), Nativeint.of_int (-456); Nativeint.max_int, Nativeint.max_int; Nativeint.min_int, Nativeint.min_int; Nativeint.of_string "0x12345678", Nativeint.of_string "0x12345678"]); test 9 true (test_setget float32 [0.0, 0.0; 4.0, 4.0; -0.5, -0.5; 655360.0, 655360.0]); test 10 true (test_setget float64 [0.0, 0.0; 4.0, 4.0; -0.5, -0.5; 1.2345678, 1.2345678; 3.1415e10, 3.1415e10]); test 11 true (test_setget complex32 [Complex.zero, Complex.zero; Complex.one, Complex.one; Complex.i, Complex.i; {im = 0.5; re = -2.0}, {im = 0.5; re = -2.0}]); test 12 true (test_setget complex64 [Complex.zero, Complex.zero; Complex.one, Complex.one; Complex.i, Complex.i; {im=0.5;re= -2.0}, {im=0.5;re= -2.0}; {im=3.1415;re=1.2345678}, {im=3.1415;re=1.2345678}]); let from_list kind vals = let a = Array1.create kind c_layout (List.length vals) in let rec set i = function [] -> () | hd :: tl -> a.{i} <- hd; set (i+1) tl in set 0 vals; a in let from_list_fortran kind vals = let a = Array1.create kind fortran_layout (List.length vals) in let rec set i = function [] -> () | hd :: tl -> a.{i} <- hd; set (i+1) tl in set 1 vals; a in (* Test indexing arrays. This test has to be copy-pasted, otherwise indexing may not use the optimizations in Cmmgen.bigarray_indexing. *) begin let v = 123 in let cb = Array1.create int8_signed c_layout 1000 in let fb = Array1.create int8_signed fortran_layout 1000 in Array1.fill cb v; Array1.fill fb v; let return = ref true in for i = 1 to 99 do let i = i * 10 in return := !return && Array1.unsafe_get cb (i - 10) = v && Array1.unsafe_get cb (i ) = v && Array1.unsafe_get cb (i + 9) = v && Array1.unsafe_get fb (i - 9) = v && Array1.unsafe_get fb (i ) = v && Array1.unsafe_get fb (i + 10) = v done; test 13 true !return end; begin let v = 123 in let cb = Array1.create int16_unsigned c_layout 1000 in let fb = Array1.create int16_unsigned fortran_layout 1000 in Array1.fill cb v; Array1.fill fb v; let return = ref true in for i = 1 to 99 do let i = i * 10 in return := !return && Array1.unsafe_get cb (i - 10) = v && Array1.unsafe_get cb (i ) = v && Array1.unsafe_get cb (i + 9) = v && Array1.unsafe_get fb (i - 9) = v && Array1.unsafe_get fb (i ) = v && Array1.unsafe_get fb (i + 10) = v done; test 14 true !return end; begin let v = 123. in let cb = Array1.create float32 c_layout 1000 in let fb = Array1.create float32 fortran_layout 1000 in Array1.fill cb v; Array1.fill fb v; let return = ref true in for i = 1 to 99 do let i = i * 10 in return := !return && Array1.unsafe_get cb (i - 10) = v && Array1.unsafe_get cb (i ) = v && Array1.unsafe_get cb (i + 9) = v && Array1.unsafe_get fb (i - 9) = v && Array1.unsafe_get fb (i ) = v && Array1.unsafe_get fb (i + 10) = v done; test 15 true !return end; begin let v = 123. in let cb = Array1.create float64 c_layout 1000 in let fb = Array1.create float64 fortran_layout 1000 in Array1.fill cb v; Array1.fill fb v; let return = ref true in for i = 1 to 99 do let i = i * 10 in return := !return && Array1.unsafe_get cb (i - 10) = v && Array1.unsafe_get cb (i ) = v && Array1.unsafe_get cb (i + 9) = v && Array1.unsafe_get fb (i - 9) = v && Array1.unsafe_get fb (i ) = v && Array1.unsafe_get fb (i + 10) = v done; test 16 true !return end; testing_function "set/get (specialized)"; let a = Array1.create int c_layout 3 in for i = 0 to 2 do a.{i} <- i done; for i = 0 to 2 do test (i+1) a.{i} i done; test 4 true (try ignore a.{3}; false with Invalid_argument _ -> true); test 5 true (try ignore a.{-1}; false with Invalid_argument _ -> true); let b = Array1.create float64 fortran_layout 3 in for i = 1 to 3 do b.{i} <- float i done; for i = 1 to 3 do test (5 + i) b.{i} (float i) done; test 8 true (try ignore b.{4}; false with Invalid_argument _ -> true); test 9 true (try ignore b.{0}; false with Invalid_argument _ -> true); let c = Array1.create complex64 c_layout 3 in for i = 0 to 2 do c.{i} <- {re=float i; im=0.0} done; for i = 0 to 2 do test (10 + i) c.{i} {re=float i; im=0.0} done; test 13 true (try ignore c.{3}; false with Invalid_argument _ -> true); test 14 true (try ignore c.{-1}; false with Invalid_argument _ -> true); let d = Array1.create complex32 fortran_layout 3 in for i = 1 to 3 do d.{i} <- {re=float i; im=0.0} done; for i = 1 to 3 do test (14 + i) d.{i} {re=float i; im=0.0} done; test 18 true (try ignore d.{4}; false with Invalid_argument _ -> true); test 19 true (try ignore d.{0}; false with Invalid_argument _ -> true); testing_function "set/get (unsafe, specialized)"; let a = Array1.create int c_layout 3 in for i = 0 to 2 do Array1.unsafe_set a i i done; for i = 0 to 2 do test (i+1) (Array1.unsafe_get a i) i done; let b = Array1.create float64 fortran_layout 3 in for i = 1 to 3 do Array1.unsafe_set b i (float i) done; for i = 1 to 3 do test (5 + i) (Array1.unsafe_get b i) (float i) done; testing_function "comparisons"; let normalize_comparison n = if n = 0 then 0 else if n < 0 then -1 else 1 in test 1 0 (normalize_comparison (compare (from_list int8_signed [1;2;3;-4;127;-128]) (from_list int8_signed [1;2;3;-4;127;-128]))); test 2 (-1) (normalize_comparison (compare (from_list int8_signed [1;2;3;-4;127;-128]) (from_list int8_signed [1;2;3;4;127;-128]))); test 3 1 (normalize_comparison (compare (from_list int8_signed [1;2;3;-4;127;-128]) (from_list int8_signed [1;2;3;-4;42;-128]))); test 4 (-1) (normalize_comparison (compare (from_list int8_signed [1;2;3;-4]) (from_list int8_signed [1;2;3;4;127;-128]))); test 5 1 (normalize_comparison (compare (from_list int8_signed [1;2;3;4;127;-128]) (from_list int8_signed [1;2;3;-4]))); test 6 0 (normalize_comparison (compare (from_list int8_unsigned [1;2;3;-4;127;-128]) (from_list int8_unsigned [1;2;3;-4;127;-128]))); test 7 1 (normalize_comparison (compare (from_list int8_unsigned [1;2;3;-4;127;-128]) (from_list int8_unsigned [1;2;3;4;127;-128]))); test 8 1 (normalize_comparison (compare (from_list int8_unsigned [1;2;3;-4;127;-128]) (from_list int8_unsigned [1;2;3;-4;42;-128]))); test 9 0 (normalize_comparison (compare (from_list int16_signed [1;2;3;-4;127;-128]) (from_list int16_signed [1;2;3;-4;127;-128]))); test 10 (-1) (normalize_comparison (compare (from_list int16_signed [1;2;3;-4;127;-128]) (from_list int16_signed [1;2;3;4;127;-128]))); test 11 1 (normalize_comparison (compare (from_list int16_signed [1;2;3;-4;127;-128]) (from_list int16_signed [1;2;3;-4;42;-128]))); test 12 0 (normalize_comparison (compare (from_list int16_unsigned [1;2;3;-4;127;-128]) (from_list int16_unsigned [1;2;3;-4;127;-128]))); test 13 (-1) (normalize_comparison (compare (from_list int16_unsigned [1;2;3;4;127;-128]) (from_list int16_unsigned [1;2;3;0xFFFF;127;-128]))); test 14 1 (normalize_comparison (compare (from_list int16_unsigned [1;2;3;-4;127;-128]) (from_list int16_unsigned [1;2;3;-4;42;-128]))); test 15 0 (normalize_comparison (compare (from_list int [1;2;3;-4;127;-128]) (from_list int [1;2;3;-4;127;-128]))); test 16 (-1) (normalize_comparison (compare (from_list int [1;2;3;-4;127;-128]) (from_list int [1;2;3;4;127;-128]))); test 17 1 (normalize_comparison (compare (from_list int [1;2;3;-4;127;-128]) (from_list int [1;2;3;-4;42;-128]))); test 18 0 (normalize_comparison (compare (from_list int32 (List.map Int32.of_int [1;2;3;-4;127;-128])) (from_list int32 (List.map Int32.of_int [1;2;3;-4;127;-128])))); test 19 (-1) (normalize_comparison (compare (from_list int32 (List.map Int32.of_int [1;2;3;-4;127;-128])) (from_list int32 (List.map Int32.of_int [1;2;3;4;127;-128])))); test 20 1 (normalize_comparison (compare (from_list int32 (List.map Int32.of_int [1;2;3;-4;127;-128])) (from_list int32 (List.map Int32.of_int [1;2;3;-4;42;-128])))); test 21 0 (normalize_comparison (compare (from_list int64 (List.map Int64.of_int [1;2;3;-4;127;-128])) (from_list int64 (List.map Int64.of_int [1;2;3;-4;127;-128])))); test 22 (-1) (normalize_comparison (compare (from_list int64 (List.map Int64.of_int [1;2;3;-4;127;-128])) (from_list int64 (List.map Int64.of_int [1;2;3;4;127;-128])))); test 23 1 (normalize_comparison (compare (from_list int64 (List.map Int64.of_int [1;2;3;-4;127;-128])) (from_list int64 (List.map Int64.of_int [1;2;3;-4;42;-128])))); test 24 0 (normalize_comparison (compare (from_list nativeint (List.map Nativeint.of_int [1;2;3;-4;127;-128])) (from_list nativeint (List.map Nativeint.of_int [1;2;3;-4;127;-128])))); test 25 (-1) (normalize_comparison (compare (from_list nativeint (List.map Nativeint.of_int [1;2;3;-4;127;-128])) (from_list nativeint (List.map Nativeint.of_int [1;2;3;4;127;-128])))); test 26 1 (normalize_comparison (compare (from_list nativeint (List.map Nativeint.of_int [1;2;3;-4;127;-128])) (from_list nativeint (List.map Nativeint.of_int [1;2;3;-4;42;-128])))); test 27 0 (normalize_comparison (compare (from_list float32 [0.0; 0.25; -4.0; 3.141592654]) (from_list float32 [0.0; 0.25; -4.0; 3.141592654]))); test 28 (-1) (normalize_comparison (compare (from_list float32 [0.0; 0.25; -4.0]) (from_list float32 [0.0; 0.25; 3.14159]))); test 29 1 (normalize_comparison (compare (from_list float32 [0.0; 2.718; -4.0]) (from_list float32 [0.0; 0.25; 3.14159]))); test 30 0 (normalize_comparison (compare (from_list float64 [0.0; 0.25; -4.0; 3.141592654]) (from_list float64 [0.0; 0.25; -4.0; 3.141592654]))); test 31 (-1) (normalize_comparison (compare (from_list float64 [0.0; 0.25; -4.0]) (from_list float64 [0.0; 0.25; 3.14159]))); test 32 1 (normalize_comparison (compare (from_list float64 [0.0; 2.718; -4.0]) (from_list float64 [0.0; 0.25; 3.14159]))); test 44 0 (normalize_comparison (compare (from_list complex32 [Complex.zero; Complex.one; Complex.i]) (from_list complex32 [Complex.zero; Complex.one; Complex.i]))); test 45 (-1) (normalize_comparison (compare (from_list complex32 [Complex.zero; Complex.one; Complex.i]) (from_list complex32 [Complex.zero; Complex.one; Complex.one]))); test 46 1 (normalize_comparison (compare (from_list complex32 [Complex.zero; Complex.one; Complex.one]) (from_list complex32 [Complex.zero; Complex.one; Complex.i]))); test 47 0 (normalize_comparison (compare (from_list complex64 [Complex.zero; Complex.one; Complex.i]) (from_list complex64 [Complex.zero; Complex.one; Complex.i]))); test 48 (-1) (normalize_comparison (compare (from_list complex64 [Complex.zero; Complex.one; Complex.i]) (from_list complex64 [Complex.zero; Complex.one; Complex.one]))); test 49 1 (normalize_comparison (compare (from_list complex64 [Complex.zero; Complex.one; Complex.one]) (from_list complex64 [Complex.zero; Complex.one; Complex.i]))); testing_function "dim"; test 1 (Array1.dim (from_list int [1;2;3;4;5])) 5; test 2 (Array1.dim (from_list_fortran int [1;2;3])) 3; testing_function "size_in_bytes_one"; test 1 (Array1.size_in_bytes (from_list int [1;2;3;4;5])) (5 * (kind_size_in_bytes int)); test 2 (Array1.size_in_bytes (from_list int [])) 0; let int64list = (from_list int64 (List.map Int64.of_int [1;2;3;4;5])) in test 3 (Array1.size_in_bytes int64list) (5 * (kind_size_in_bytes int64)); test 4 (Array1.size_in_bytes (from_list int64 (List.map Int64.of_int []))) 0; testing_function "kind & layout"; let a = from_list int [1;2;3] in test 1 (Array1.kind a) int; test 2 (Array1.layout a) c_layout; let a = from_list_fortran float32 [1.0;2.0;3.0] in test 1 (Array1.kind a) float32; test 2 (Array1.layout a) fortran_layout; testing_function "sub"; let a = from_list int [1;2;3;4;5;6;7;8] in test 1 (Array1.sub a 2 5) (from_list int [3;4;5;6;7]); test 2 (Array1.sub a 0 2) (from_list int [1;2]); test 3 (Array1.sub a 0 8) (from_list int [1;2;3;4;5;6;7;8]); let a = from_list float64 [1.0;2.0;3.0;4.0;5.0;6.0;7.0;8.0] in test 4 (Array1.sub a 2 5) (from_list float64 [3.0;4.0;5.0;6.0;7.0]); test 5 (Array1.sub a 0 2) (from_list float64 [1.0;2.0]); test 6 (Array1.sub a 0 8) (from_list float64 [1.0;2.0;3.0;4.0;5.0;6.0;7.0;8.0]); let a = from_list_fortran float64 [1.0;2.0;3.0;4.0;5.0;6.0;7.0;8.0] in test 7 (Array1.sub a 2 5) (from_list_fortran float64 [2.0;3.0;4.0;5.0;6.0]); test 8 (Array1.sub a 1 2) (from_list_fortran float64 [1.0;2.0]); test 9 (Array1.sub a 1 8) (from_list_fortran float64 [1.0;2.0;3.0;4.0;5.0;6.0;7.0;8.0]); Gc.full_major(); (* test GC of proxies *) testing_function "blit, fill"; let test_blit_fill kind data initval ofs len = let a = from_list kind data in let b = Array1.create kind c_layout (List.length data) in Array1.blit a b; (a = b) && (Array1.fill (Array1.sub b ofs len) initval; let rec check i = function [] -> true | hd :: tl -> b.{i} = (if i >= ofs && i < ofs + len then initval else hd) && check (i+1) tl in check 0 data) in test 1 true (test_blit_fill int8_signed [1;2;5;8;-100;127] 7 3 2); test 2 true (test_blit_fill int8_unsigned [1;2;5;8;-100;212] 7 3 2); test 3 true (test_blit_fill int16_signed [1;2;5;8;-100;212] 7 3 2); test 4 true (test_blit_fill int16_unsigned [1;2;5;8;-100;212] 7 3 2); test 5 true (test_blit_fill int [1;2;5;8;-100;212] 7 3 2); test 6 true (test_blit_fill int32 (List.map Int32.of_int [1;2;5;8;-100;212]) (Int32.of_int 7) 3 2); test 7 true (test_blit_fill int64 (List.map Int64.of_int [1;2;5;8;-100;212]) (Int64.of_int 7) 3 2); test 8 true (test_blit_fill nativeint (List.map Nativeint.of_int [1;2;5;8;-100;212]) (Nativeint.of_int 7) 3 2); test 9 true (test_blit_fill float32 [1.0;2.0;0.5;0.125;256.0;512.0] 0.25 3 2); test 10 true (test_blit_fill float64 [1.0;2.0;5.0;8.123;-100.456;212e19] 3.1415 3 2); test 11 true (test_blit_fill complex32 [Complex.zero; Complex.one; Complex.i] Complex.i 1 1); test 12 true (test_blit_fill complex64 [Complex.zero; Complex.one; Complex.i] Complex.i 1 1); testing_function "slice"; let a = Array1.of_array int c_layout [| 5; 4; 3 |] in test 1 (Array1.slice a 0) (Array0.of_value int c_layout 5); test 2 (Array1.slice a 1) (Array0.of_value int c_layout 4); test 3 (Array1.slice a 2) (Array0.of_value int c_layout 3); let a = Array1.of_array int fortran_layout [| 5; 4; 3 |] in test 6 (Array1.slice a 1) (Array0.of_value int fortran_layout 5); test 7 (Array1.slice a 2) (Array0.of_value int fortran_layout 4); test 8 (Array1.slice a 3) (Array0.of_value int fortran_layout 3); (* Bi-dimensional arrays *) print_newline(); testing_function "------ Array2 --------"; testing_function "create/set/get"; let make_array2 kind layout ind0 dim1 dim2 fromint = let a = Array2.create kind layout dim1 dim2 in for i = ind0 to dim1 - 1 + ind0 do for j = ind0 to dim2 - 1 + ind0 do a.{i,j} <- (fromint (i * 1000 + j)) done done; a in let check_array2 a ind0 dim1 dim2 fromint = try for i = ind0 to dim1 - 1 + ind0 do for j = ind0 to dim2 - 1 + ind0 do if a.{i,j} <> (fromint (i * 1000 + j)) then raise Exit done done; true with Exit -> false in let id x = x in test 1 true (check_array2 (make_array2 int16_signed c_layout 0 10 20 id) 0 10 20 id); test 2 true (check_array2 (make_array2 int c_layout 0 10 20 id) 0 10 20 id); test 3 true (check_array2 (make_array2 int32 c_layout 0 10 20 Int32.of_int) 0 10 20 Int32.of_int); test 4 true (check_array2 (make_array2 float32 c_layout 0 10 20 float) 0 10 20 float); test 5 true (check_array2 (make_array2 float64 c_layout 0 10 20 float) 0 10 20 float); test 6 true (check_array2 (make_array2 int16_signed fortran_layout 1 10 20 id) 1 10 20 id); test 7 true (check_array2 (make_array2 int fortran_layout 1 10 20 id) 1 10 20 id); test 8 true (check_array2 (make_array2 int32 fortran_layout 1 10 20 Int32.of_int) 1 10 20 Int32.of_int); test 9 true (check_array2 (make_array2 float32 fortran_layout 1 10 20 float) 1 10 20 float); test 10 true (check_array2 (make_array2 float64 fortran_layout 1 10 20 float) 1 10 20 float); let makecomplex i = {re = float i; im = float (-i)} in test 11 true (check_array2 (make_array2 complex32 c_layout 0 10 20 makecomplex) 0 10 20 makecomplex); test 12 true (check_array2 (make_array2 complex64 c_layout 0 10 20 makecomplex) 0 10 20 makecomplex); test 13 true (check_array2 (make_array2 complex32 fortran_layout 1 10 20 makecomplex) 1 10 20 makecomplex); test 14 true (check_array2 (make_array2 complex64 fortran_layout 1 10 20 makecomplex) 1 10 20 makecomplex); testing_function "set/get (specialized)"; let a = Array2.create int16_signed c_layout 3 3 in for i = 0 to 2 do for j = 0 to 2 do a.{i,j} <- i-j done done; let ok = ref true in for i = 0 to 2 do for j = 0 to 2 do if a.{i,j} <> i-j then ok := false done done; test 1 true !ok; test 2 true (try ignore a.{3,0}; false with Invalid_argument _ -> true); test 3 true (try ignore a.{-1,0}; false with Invalid_argument _ -> true); test 4 true (try ignore a.{0,3}; false with Invalid_argument _ -> true); test 5 true (try ignore a.{0,-1}; false with Invalid_argument _ -> true); let b = Array2.create float32 fortran_layout 3 3 in for i = 1 to 3 do for j = 1 to 3 do b.{i,j} <- float(i-j) done done; let ok = ref true in for i = 1 to 3 do for j = 1 to 3 do if b.{i,j} <> float(i-j) then ok := false done done; test 6 true !ok; test 7 true (try ignore b.{4,1}; false with Invalid_argument _ -> true); test 8 true (try ignore b.{0,1}; false with Invalid_argument _ -> true); test 9 true (try ignore b.{1,4}; false with Invalid_argument _ -> true); test 10 true (try ignore b.{1,0}; false with Invalid_argument _ -> true); testing_function "set/get (unsafe, specialized)"; let a = Array2.create int16_signed c_layout 3 3 in for i = 0 to 2 do for j = 0 to 2 do Array2.unsafe_set a i j (i-j) done done; let ok = ref true in for i = 0 to 2 do for j = 0 to 2 do if Array2.unsafe_get a i j <> i-j then ok := false done done; test 1 true !ok; let b = Array2.create float32 fortran_layout 3 3 in for i = 1 to 3 do for j = 1 to 3 do Array2.unsafe_set b i j (float(i-j)) done done; let ok = ref true in for i = 1 to 3 do for j = 1 to 3 do if Array2.unsafe_get b i j <> float(i-j) then ok := false done done; test 2 true !ok; testing_function "dim"; let a = (make_array2 int c_layout 0 4 6 id) in test 1 (Array2.dim1 a) 4; test 2 (Array2.dim2 a) 6; let b = (make_array2 int fortran_layout 1 4 6 id) in test 3 (Array2.dim1 b) 4; test 4 (Array2.dim2 b) 6; testing_function "size_in_bytes_two"; let a = Array2.create int c_layout 4 6 in test 1 (Array2.size_in_bytes a) (24 * (kind_size_in_bytes int)); testing_function "sub"; let a = make_array2 int c_layout 0 5 3 id in let b = Array2.sub_left a 2 2 in test 1 true (b.{0,0} = 2000 && b.{0,1} = 2001 && b.{0,2} = 2002 && b.{1,0} = 3000 && b.{1,1} = 3001 && b.{1,2} = 3002); let a = make_array2 int fortran_layout 1 5 3 id in let b = Array2.sub_right a 2 2 in test 2 true (b.{1,1} = 1002 && b.{1,2} = 1003 && b.{2,1} = 2002 && b.{2,2} = 2003 && b.{3,1} = 3002 && b.{3,2} = 3003 && b.{4,1} = 4002 && b.{4,2} = 4003 && b.{5,1} = 5002 && b.{5,2} = 5003); testing_function "slice"; let a = make_array2 int c_layout 0 5 3 id in test 1 (Array2.slice_left a 0) (from_list int [0;1;2]); test 2 (Array2.slice_left a 1) (from_list int [1000;1001;1002]); test 3 (Array2.slice_left a 2) (from_list int [2000;2001;2002]); test 4 (Array2.slice_left a 3) (from_list int [3000;3001;3002]); test 5 (Array2.slice_left a 4) (from_list int [4000;4001;4002]); let a = make_array2 int fortran_layout 1 5 3 id in test 6 (Array2.slice_right a 1) (from_list_fortran int [1001;2001;3001;4001;5001]); test 7 (Array2.slice_right a 2) (from_list_fortran int [1002;2002;3002;4002;5002]); test 8 (Array2.slice_right a 3) (from_list_fortran int [1003;2003;3003;4003;5003]); (* Tri-dimensional arrays *) print_newline(); testing_function "------ Array3 --------"; testing_function "create/set/get"; let make_array3 kind layout ind0 dim1 dim2 dim3 fromint = let a = Array3.create kind layout dim1 dim2 dim3 in for i = ind0 to dim1 - 1 + ind0 do for j = ind0 to dim2 - 1 + ind0 do for k = ind0 to dim3 - 1 + ind0 do a.{i, j, k} <- (fromint (i * 100 + j * 10 + k)) done done done; a in let check_array3 a ind0 dim1 dim2 dim3 fromint = try for i = ind0 to dim1 - 1 + ind0 do for j = ind0 to dim2 - 1 + ind0 do for k = ind0 to dim3 - 1 + ind0 do if a.{i, j, k} <> (fromint (i * 100 + j * 10 + k)) then raise Exit done done done; true with Exit -> false in let id x = x in test 1 true (check_array3 (make_array3 int16_signed c_layout 0 4 5 6 id) 0 4 5 6 id); test 2 true (check_array3 (make_array3 int c_layout 0 4 5 6 id) 0 4 5 6 id); test 3 true (check_array3 (make_array3 int32 c_layout 0 4 5 6 Int32.of_int) 0 4 5 6 Int32.of_int); test 4 true (check_array3 (make_array3 float32 c_layout 0 4 5 6 float) 0 4 5 6 float); test 5 true (check_array3 (make_array3 float64 c_layout 0 4 5 6 float) 0 4 5 6 float); test 6 true (check_array3 (make_array3 int16_signed fortran_layout 1 4 5 6 id) 1 4 5 6 id); test 7 true (check_array3 (make_array3 int fortran_layout 1 4 5 6 id) 1 4 5 6 id); test 8 true (check_array3 (make_array3 int32 fortran_layout 1 4 5 6 Int32.of_int) 1 4 5 6 Int32.of_int); test 9 true (check_array3 (make_array3 float32 fortran_layout 1 4 5 6 float) 1 4 5 6 float); test 10 true (check_array3 (make_array3 float64 fortran_layout 1 4 5 6 float) 1 4 5 6 float); test 11 true (check_array3 (make_array3 complex32 c_layout 0 4 5 6 makecomplex) 0 4 5 6 makecomplex); test 12 true (check_array3 (make_array3 complex64 c_layout 0 4 5 6 makecomplex) 0 4 5 6 makecomplex); test 13 true (check_array3 (make_array3 complex32 fortran_layout 1 4 5 6 makecomplex) 1 4 5 6 makecomplex); test 14 true (check_array3 (make_array3 complex64 fortran_layout 1 4 5 6 makecomplex) 1 4 5 6 makecomplex); testing_function "set/get (specialized)"; let a = Array3.create int32 c_layout 2 3 4 in for i = 0 to 1 do for j = 0 to 2 do for k = 0 to 3 do a.{i,j,k} <- Int32.of_int((i lsl 4) + (j lsl 2) + k) done done done; let ok = ref true in for i = 0 to 1 do for j = 0 to 2 do for k = 0 to 3 do if Int32.to_int a.{i,j,k} <> (i lsl 4) + (j lsl 2) + k then ok := false done done done; test 1 true !ok; let b = Array3.create int64 fortran_layout 2 3 4 in for i = 1 to 2 do for j = 1 to 3 do for k = 1 to 4 do b.{i,j,k} <- Int64.of_int((i lsl 4) + (j lsl 2) + k) done done done; let ok = ref true in for i = 1 to 2 do for j = 1 to 3 do for k = 1 to 4 do if Int64.to_int b.{i,j,k} <> (i lsl 4) + (j lsl 2) + k then ok := false done done done; test 2 true !ok; testing_function "set/get (unsafe, specialized)"; let a = Array3.create int32 c_layout 2 3 4 in for i = 0 to 1 do for j = 0 to 2 do for k = 0 to 3 do Array3.unsafe_set a i j k (Int32.of_int((i lsl 4) + (j lsl 2) + k)) done done done; let ok = ref true in for i = 0 to 1 do for j = 0 to 2 do for k = 0 to 3 do if Int32.to_int (Array3.unsafe_get a i j k) <> (i lsl 4) + (j lsl 2) + k then ok := false done done done; test 1 true !ok; testing_function "dim"; let a = (make_array3 int c_layout 0 4 5 6 id) in test 1 (Array3.dim1 a) 4; test 2 (Array3.dim2 a) 5; test 3 (Array3.dim3 a) 6; let b = (make_array3 int fortran_layout 1 4 5 6 id) in test 4 (Array3.dim1 b) 4; test 5 (Array3.dim2 b) 5; test 6 (Array3.dim3 b) 6; testing_function "size_in_bytes_three"; let a = Array3.create int c_layout 4 5 6 in test 1 (Array3.size_in_bytes a) (120 * (kind_size_in_bytes int)); testing_function "slice1"; let a = make_array3 int c_layout 0 3 3 3 id in test 1 (Array3.slice_left_1 a 0 0) (from_list int [0;1;2]); test 2 (Array3.slice_left_1 a 0 1) (from_list int [10;11;12]); test 3 (Array3.slice_left_1 a 0 2) (from_list int [20;21;22]); test 4 (Array3.slice_left_1 a 1 1) (from_list int [110;111;112]); test 5 (Array3.slice_left_1 a 2 1) (from_list int [210;211;212]); let a = make_array3 int fortran_layout 1 3 3 3 id in test 6 (Array3.slice_right_1 a 1 2) (from_list_fortran int [112;212;312]); test 7 (Array3.slice_right_1 a 3 1) (from_list_fortran int [131;231;331]); testing_function "size_in_bytes_general"; let a = Genarray.create int c_layout [|2;2;2;2;2|] in test 1 (Genarray.size_in_bytes a) (32 * (kind_size_in_bytes int)); (* Zero-dimensional arrays *) testing_function "------ Array0 --------"; testing_function "create/set/get"; let test_setget kind vals = List.for_all (fun (v1, v2) -> let ca = Array0.create kind c_layout in let fa = Array0.create kind fortran_layout in Array0.set ca v1; Array0.set fa v1; Array0.get ca = v2 && Array0.get fa = v2) vals in test 1 true (test_setget int8_signed [0, 0; 123, 123; -123, -123; 456, -56; 0x101, 1]); test 2 true (test_setget int8_unsigned [0, 0; 123, 123; -123, 133; 456, 0xc8; 0x101, 1]); test 3 true (test_setget int16_signed [0, 0; 123, 123; -123, -123; 31456, 31456; -31456, -31456; 65432, -104; 0x10001, 1]); test 4 true (test_setget int16_unsigned [0, 0; 123, 123; -123, 65413; 31456, 31456; -31456, 34080; 65432, 65432; 0x10001, 1]); test 5 true (test_setget int [0, 0; 123, 123; -456, -456; max_int, max_int; min_int, min_int; 0x12345678, 0x12345678; -0x12345678, -0x12345678]); test 6 true (test_setget int32 [Int32.zero, Int32.zero; Int32.of_int 123, Int32.of_int 123; Int32.of_int (-456), Int32.of_int (-456); Int32.max_int, Int32.max_int; Int32.min_int, Int32.min_int; Int32.of_string "0x12345678", Int32.of_string "0x12345678"]); test 7 true (test_setget int64 [Int64.zero, Int64.zero; Int64.of_int 123, Int64.of_int 123; Int64.of_int (-456), Int64.of_int (-456); Int64.max_int, Int64.max_int; Int64.min_int, Int64.min_int; Int64.of_string "0x123456789ABCDEF0", Int64.of_string "0x123456789ABCDEF0"]); test 8 true (test_setget nativeint [Nativeint.zero, Nativeint.zero; Nativeint.of_int 123, Nativeint.of_int 123; Nativeint.of_int (-456), Nativeint.of_int (-456); Nativeint.max_int, Nativeint.max_int; Nativeint.min_int, Nativeint.min_int; Nativeint.of_string "0x12345678", Nativeint.of_string "0x12345678"]); test 9 true (test_setget float32 [0.0, 0.0; 4.0, 4.0; -0.5, -0.5; 655360.0, 655360.0]); test 10 true (test_setget float64 [0.0, 0.0; 4.0, 4.0; -0.5, -0.5; 1.2345678, 1.2345678; 3.1415e10, 3.1415e10]); test 11 true (test_setget complex32 [Complex.zero, Complex.zero; Complex.one, Complex.one; Complex.i, Complex.i; {im = 0.5; re = -2.0}, {im = 0.5; re = -2.0}]); test 12 true (test_setget complex64 [Complex.zero, Complex.zero; Complex.one, Complex.one; Complex.i, Complex.i; {im=0.5;re= -2.0}, {im=0.5;re= -2.0}; {im=3.1415;re=1.2345678}, {im=3.1415;re=1.2345678}]); (* Kind size *) testing_function "kind_size_in_bytes"; let arr1 = Array1.create Float32 c_layout 1 in test 1 (kind_size_in_bytes Float32) (Array1.size_in_bytes arr1); let arr1 = Array1.create Float64 c_layout 1 in test 2 (kind_size_in_bytes Float64) (Array1.size_in_bytes arr1); let arr1 = Array1.create Int8_signed c_layout 1 in test 3 (kind_size_in_bytes Int8_signed) (Array1.size_in_bytes arr1); let arr1 = Array1.create Int8_unsigned c_layout 1 in test 4 (kind_size_in_bytes Int8_unsigned) (Array1.size_in_bytes arr1); let arr1 = Array1.create Int16_signed c_layout 1 in test 5 (kind_size_in_bytes Int16_signed) (Array1.size_in_bytes arr1); let arr1 = Array1.create Int16_unsigned c_layout 1 in test 6 (kind_size_in_bytes Int16_unsigned) (Array1.size_in_bytes arr1); let arr1 = Array1.create Int32 c_layout 1 in test 7 (kind_size_in_bytes Int32) (Array1.size_in_bytes arr1); let arr1 = Array1.create Int64 c_layout 1 in test 8 (kind_size_in_bytes Int64) (Array1.size_in_bytes arr1); let arr1 = Array1.create Int c_layout 1 in test 9 (kind_size_in_bytes Int) (Array1.size_in_bytes arr1); let arr1 = Array1.create Nativeint c_layout 1 in test 10 (kind_size_in_bytes Nativeint) (Array1.size_in_bytes arr1); let arr1 = Array1.create Complex32 c_layout 1 in test 11 (kind_size_in_bytes Complex32) (Array1.size_in_bytes arr1); let arr1 = Array1.create Complex64 c_layout 1 in test 12 (kind_size_in_bytes Complex64) (Array1.size_in_bytes arr1); let arr1 = Array1.create Char c_layout 1 in test 13 (kind_size_in_bytes Char) (Array1.size_in_bytes arr1); (* Reshaping *) print_newline(); testing_function "------ Reshaping --------"; testing_function "reshape_1"; let a = make_array2 int c_layout 0 3 4 id in let b = make_array2 int fortran_layout 1 3 4 id in let c = reshape_1 (genarray_of_array2 a) 12 in test 1 c (from_list int [0;1;2;3;1000;1001;1002;1003;2000;2001;2002;2003]); let d = reshape_1 (genarray_of_array2 b) 12 in test 2 d (from_list_fortran int [1001;2001;3001;1002;2002;3002;1003;2003;3003;1004;2004;3004]); testing_function "reshape_2"; let c = reshape_2 (genarray_of_array2 a) 4 3 in test 1 (Array2.slice_left c 0) (from_list int [0;1;2]); test 2 (Array2.slice_left c 1) (from_list int [3;1000;1001]); test 3 (Array2.slice_left c 2) (from_list int [1002;1003;2000]); test 4 (Array2.slice_left c 3) (from_list int [2001;2002;2003]); let d = reshape_2 (genarray_of_array2 b) 4 3 in test 5 (Array2.slice_right d 1) (from_list_fortran int [1001;2001;3001;1002]); test 6 (Array2.slice_right d 2) (from_list_fortran int [2002;3002;1003;2003]); test 7 (Array2.slice_right d 3) (from_list_fortran int [3003;1004;2004;3004]); testing_function "reshape"; let a = make_array2 int c_layout 0 1 1 (fun i -> i + 3) in let b = reshape_0 (genarray_of_array2 a) in let c = reshape (genarray_of_array0 b) [|1|] in test 8 (Array0.get b) 3; test 9 (Genarray.get c [|0|]) 3; test 10 (Genarray.get (Genarray.slice_left c [|0|]) [||]) 3; (* I/O *) let dump_content_hex file = let ic = open_in_bin file in let len = in_channel_length ic in let len' = min len 1024 in Printf.printf "\nDump hexa: (full size is %d)" len; for i = 0 to len' - 1 do if i mod 32 = 0 then Printf.printf "\n"; let code = Char.code (input_char ic) in Printf.printf " %02x" code; done; close_in ic; Printf.printf "\n" in print_newline(); testing_function "------ I/O --------"; testing_function "output_value/input_value"; let test_structured_io testno value = let tmp = Filename.temp_file "bigarray" ".data" in let oc = open_out_bin tmp in output_value oc value; close_out oc; let ic = open_in_bin tmp in let value' = input_value ic in close_in ic; dump_content_hex tmp; Sys.remove tmp; test testno value value' in test_structured_io 1 (from_list int8_signed [1;2;3;-4;127;-128]); test_structured_io 2 (from_list int16_signed [1;2;3;-4;127;-128]); test_structured_io 3 (from_list int [1;2;3;-4;127;-128]); test_structured_io 4 (from_list int32 (List.map Int32.of_int [1;2;3;-4;127;-128])); test_structured_io 5 (from_list int64 (List.map Int64.of_int [1;2;3;-4;127;-128])); test_structured_io 6 (from_list nativeint (List.map Nativeint.of_int [1;2;3;-4;127;-128])); test_structured_io 7 (from_list float32 [0.0; 0.25; -4.0; 3.141592654]); test_structured_io 8 (from_list float64 [0.0; 0.25; -4.0; 3.141592654]); test_structured_io 9 (make_array2 int c_layout 0 100 100 id); test_structured_io 10 (make_array2 float64 fortran_layout 1 200 200 float); test_structured_io 11 (make_array3 int32 c_layout 0 20 30 40 Int32.of_int); test_structured_io 12 (make_array3 float32 fortran_layout 1 10 50 100 float); test_structured_io 13 (make_array2 complex32 c_layout 0 100 100 makecomplex); test_structured_io 14 (make_array3 complex64 fortran_layout 1 10 20 30 makecomplex); () [@@inline never] (********* End of test *********) let _ = tests (); print_newline(); if !error_occurred then begin prerr_endline "************* TEST FAILED ****************"; exit 2 end else exit 0 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/bigarrays.reference000066400000000000000000000545301357507750000271570ustar00rootroot00000000000000 ------ Array1 -------- create/set/get 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... set/get (specialized) 1... 2... 3... 4... 5... 6... 7... 8... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... set/get (unsafe, specialized) 1... 2... 3... 6... 7... 8... comparisons 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20... 21... 22... 23... 24... 25... 26... 27... 28... 29... 30... 31... 32... 44... 45... 46... 47... 48... 49... dim 1... 2... size_in_bytes_one 1... 2... 3... 4... kind & layout 1... 2... 1... 2... sub 1... 2... 3... 4... 5... 6... 7... 8... 9... blit, fill 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... slice 1... 2... 3... 6... 7... 8... ------ Array2 -------- create/set/get 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... set/get (specialized) 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... set/get (unsafe, specialized) 1... 2... dim 1... 2... 3... 4... size_in_bytes_two 1... sub 1... 2... slice 1... 2... 3... 4... 5... 6... 7... 8... ------ Array3 -------- create/set/get 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... set/get (specialized) 1... 2... set/get (unsafe, specialized) 1... dim 1... 2... 3... 4... 5... 6... size_in_bytes_three 1... slice1 1... 2... 3... 4... 5... 6... 7... size_in_bytes_general 1... ------ Array0 -------- create/set/get 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... kind_size_in_bytes 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... ------ Reshaping -------- reshape_1 1... 2... reshape_2 1... 2... 3... 4... 5... 6... 7... reshape 8... 9... 10... ------ I/O -------- output_value/input_value Dump hexa: (full size is 61) 84 95 a6 be 00 00 00 29 00 00 00 01 00 00 00 07 00 00 00 07 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 14 00 00 00 00 00 00 00 28 00 00 00 01 00 00 00 02 00 00 00 06 01 02 03 fc 7f 80 1... Dump hexa: (full size is 67) 84 95 a6 be 00 00 00 2f 00 00 00 01 00 00 00 07 00 00 00 07 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 14 00 00 00 00 00 00 00 28 00 00 00 01 00 00 00 04 00 00 00 06 00 01 00 02 00 03 ff fc 00 7f ff 80 2... Dump hexa: (full size is 80) 84 95 a6 be 00 00 00 3c 00 00 00 01 00 00 00 07 00 00 00 07 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 14 00 00 00 00 00 00 00 28 00 00 00 01 00 00 00 08 00 00 00 06 00 00 00 00 01 00 00 00 02 00 00 00 03 ff ff ff fc 00 00 00 7f ff ff ff 80 3... Dump hexa: (full size is 79) 84 95 a6 be 00 00 00 3b 00 00 00 01 00 00 00 07 00 00 00 07 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 14 00 00 00 00 00 00 00 28 00 00 00 01 00 00 00 06 00 00 00 06 00 00 00 01 00 00 00 02 00 00 00 03 ff ff ff fc 00 00 00 7f ff ff ff 80 4... Dump hexa: (full size is 103) 84 95 a6 be 00 00 00 53 00 00 00 01 00 00 00 07 00 00 00 07 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 14 00 00 00 00 00 00 00 28 00 00 00 01 00 00 00 07 00 00 00 06 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 03 ff ff ff ff ff ff ff fc 00 00 00 00 00 00 00 7f ff ff ff ff ff ff ff 80 5... Dump hexa: (full size is 80) 84 95 a6 be 00 00 00 3c 00 00 00 01 00 00 00 07 00 00 00 07 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 14 00 00 00 00 00 00 00 28 00 00 00 01 00 00 00 09 00 00 00 06 00 00 00 00 01 00 00 00 02 00 00 00 03 ff ff ff fc 00 00 00 7f ff ff ff 80 6... Dump hexa: (full size is 71) 84 95 a6 be 00 00 00 33 00 00 00 01 00 00 00 07 00 00 00 07 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 14 00 00 00 00 00 00 00 28 00 00 00 01 00 00 00 00 00 00 00 04 00 00 00 00 3e 80 00 00 c0 80 00 00 40 49 0f db 7... Dump hexa: (full size is 87) 84 95 a6 be 00 00 00 43 00 00 00 01 00 00 00 07 00 00 00 07 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 14 00 00 00 00 00 00 00 28 00 00 00 01 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00 00 3f d0 00 00 00 00 00 00 c0 10 00 00 00 00 00 00 40 09 21 fb 54 52 45 50 8... Dump hexa: (full size is 40060) 84 95 a6 be 00 00 9c 68 00 00 00 01 00 00 00 08 00 00 00 08 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 18 00 00 00 00 00 00 00 30 00 00 00 02 00 00 00 08 00 00 00 64 00 00 00 64 00 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0a 00 00 00 0b 00 00 00 0c 00 00 00 0d 00 00 00 0e 00 00 00 0f 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1a 00 00 00 1b 00 00 00 1c 00 00 00 1d 00 00 00 1e 00 00 00 1f 00 00 00 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 26 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2a 00 00 00 2b 00 00 00 2c 00 00 00 2d 00 00 00 2e 00 00 00 2f 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 35 00 00 00 36 00 00 00 37 00 00 00 38 00 00 00 39 00 00 00 3a 00 00 00 3b 00 00 00 3c 00 00 00 3d 00 00 00 3e 00 00 00 3f 00 00 00 40 00 00 00 41 00 00 00 42 00 00 00 43 00 00 00 44 00 00 00 45 00 00 00 46 00 00 00 47 00 00 00 48 00 00 00 49 00 00 00 4a 00 00 00 4b 00 00 00 4c 00 00 00 4d 00 00 00 4e 00 00 00 4f 00 00 00 50 00 00 00 51 00 00 00 52 00 00 00 53 00 00 00 54 00 00 00 55 00 00 00 56 00 00 00 57 00 00 00 58 00 00 00 59 00 00 00 5a 00 00 00 5b 00 00 00 5c 00 00 00 5d 00 00 00 5e 00 00 00 5f 00 00 00 60 00 00 00 61 00 00 00 62 00 00 00 63 00 00 03 e8 00 00 03 e9 00 00 03 ea 00 00 03 eb 00 00 03 ec 00 00 03 ed 00 00 03 ee 00 00 03 ef 00 00 03 f0 00 00 03 f1 00 00 03 f2 00 00 03 f3 00 00 03 f4 00 00 03 f5 00 00 03 f6 00 00 03 f7 00 00 03 f8 00 00 03 f9 00 00 03 fa 00 00 03 fb 00 00 03 fc 00 00 03 fd 00 00 03 fe 00 00 03 ff 00 00 04 00 00 00 04 01 00 00 04 02 00 00 04 03 00 00 04 04 00 00 04 05 00 00 04 06 00 00 04 07 00 00 04 08 00 00 04 09 00 00 04 0a 00 00 04 0b 00 00 04 0c 00 00 04 0d 00 00 04 0e 00 00 04 0f 00 00 04 10 00 00 04 11 00 00 04 12 00 00 04 13 00 00 04 14 00 00 04 15 00 00 04 16 00 00 04 17 00 00 04 18 00 00 04 19 00 00 04 1a 00 00 04 1b 00 00 04 1c 00 00 04 1d 00 00 04 1e 00 00 04 1f 00 00 04 20 00 00 04 21 00 00 04 22 00 00 04 23 00 00 04 24 00 00 04 25 00 00 04 26 00 00 04 27 00 00 04 28 00 00 04 29 00 00 04 2a 00 00 04 2b 00 00 04 2c 00 00 04 2d 00 00 04 2e 00 00 04 2f 00 00 04 30 00 00 04 31 00 00 04 32 00 00 04 33 00 00 04 34 00 00 04 35 00 00 04 36 00 00 04 37 00 00 04 38 00 00 04 39 00 00 04 3a 00 00 04 3b 00 00 04 3c 00 00 04 3d 00 00 04 3e 00 00 04 3f 00 00 04 40 00 00 04 41 00 00 04 42 00 00 04 43 00 00 04 44 00 00 04 45 00 00 04 46 00 00 04 47 00 00 04 48 00 00 04 49 00 00 04 4a 00 00 04 4b 00 00 07 d0 00 00 07 d1 00 00 07 d2 00 00 07 d3 00 00 07 d4 00 00 07 d5 00 00 07 d6 00 00 07 d7 00 00 07 d8 00 00 07 d9 00 00 07 da 00 00 07 db 00 00 07 dc 00 00 07 dd 00 00 07 de 00 00 07 df 00 00 07 e0 00 00 07 e1 00 00 07 e2 00 00 07 e3 00 00 07 e4 00 00 07 e5 00 00 07 e6 00 00 07 e7 00 00 07 e8 00 00 07 e9 00 00 07 ea 00 00 07 eb 00 00 07 ec 00 00 07 ed 00 00 07 ee 00 00 07 ef 00 00 07 f0 00 00 07 f1 00 00 07 f2 00 00 07 f3 00 00 07 f4 00 00 07 f5 00 00 07 f6 00 00 07 f7 00 00 07 f8 9... Dump hexa: (full size is 320059) 84 95 a6 be 00 04 e2 27 00 00 00 01 00 00 00 08 00 00 00 08 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 18 00 00 00 00 00 00 00 30 00 00 00 02 00 00 01 01 00 00 00 c8 00 00 00 c8 40 8f 48 00 00 00 00 00 40 9f 44 00 00 00 00 00 40 a7 72 00 00 00 00 00 40 af 42 00 00 00 00 00 40 b3 89 00 00 00 00 00 40 b7 71 00 00 00 00 00 40 bb 59 00 00 00 00 00 40 bf 41 00 00 00 00 00 40 c1 94 80 00 00 00 00 40 c3 88 80 00 00 00 00 40 c5 7c 80 00 00 00 00 40 c7 70 80 00 00 00 00 40 c9 64 80 00 00 00 00 40 cb 58 80 00 00 00 00 40 cd 4c 80 00 00 00 00 40 cf 40 80 00 00 00 00 40 d0 9a 40 00 00 00 00 40 d1 94 40 00 00 00 00 40 d2 8e 40 00 00 00 00 40 d3 88 40 00 00 00 00 40 d4 82 40 00 00 00 00 40 d5 7c 40 00 00 00 00 40 d6 76 40 00 00 00 00 40 d7 70 40 00 00 00 00 40 d8 6a 40 00 00 00 00 40 d9 64 40 00 00 00 00 40 da 5e 40 00 00 00 00 40 db 58 40 00 00 00 00 40 dc 52 40 00 00 00 00 40 dd 4c 40 00 00 00 00 40 de 46 40 00 00 00 00 40 df 40 40 00 00 00 00 40 e0 1d 20 00 00 00 00 40 e0 9a 20 00 00 00 00 40 e1 17 20 00 00 00 00 40 e1 94 20 00 00 00 00 40 e2 11 20 00 00 00 00 40 e2 8e 20 00 00 00 00 40 e3 0b 20 00 00 00 00 40 e3 88 20 00 00 00 00 40 e4 05 20 00 00 00 00 40 e4 82 20 00 00 00 00 40 e4 ff 20 00 00 00 00 40 e5 7c 20 00 00 00 00 40 e5 f9 20 00 00 00 00 40 e6 76 20 00 00 00 00 40 e6 f3 20 00 00 00 00 40 e7 70 20 00 00 00 00 40 e7 ed 20 00 00 00 00 40 e8 6a 20 00 00 00 00 40 e8 e7 20 00 00 00 00 40 e9 64 20 00 00 00 00 40 e9 e1 20 00 00 00 00 40 ea 5e 20 00 00 00 00 40 ea db 20 00 00 00 00 40 eb 58 20 00 00 00 00 40 eb d5 20 00 00 00 00 40 ec 52 20 00 00 00 00 40 ec cf 20 00 00 00 00 40 ed 4c 20 00 00 00 00 40 ed c9 20 00 00 00 00 40 ee 46 20 00 00 00 00 40 ee c3 20 00 00 00 00 40 ef 40 20 00 00 00 00 40 ef bd 20 00 00 00 00 40 f0 1d 10 00 00 00 00 40 f0 5b 90 00 00 00 00 40 f0 9a 10 00 00 00 00 40 f0 d8 90 00 00 00 00 40 f1 17 10 00 00 00 00 40 f1 55 90 00 00 00 00 40 f1 94 10 00 00 00 00 40 f1 d2 90 00 00 00 00 40 f2 11 10 00 00 00 00 40 f2 4f 90 00 00 00 00 40 f2 8e 10 00 00 00 00 40 f2 cc 90 00 00 00 00 40 f3 0b 10 00 00 00 00 40 f3 49 90 00 00 00 00 40 f3 88 10 00 00 00 00 40 f3 c6 90 00 00 00 00 40 f4 05 10 00 00 00 00 40 f4 43 90 00 00 00 00 40 f4 82 10 00 00 00 00 40 f4 c0 90 00 00 00 00 40 f4 ff 10 00 00 00 00 40 f5 3d 90 00 00 00 00 40 f5 7c 10 00 00 00 00 40 f5 ba 90 00 00 00 00 40 f5 f9 10 00 00 00 00 40 f6 37 90 00 00 00 00 40 f6 76 10 00 00 00 00 40 f6 b4 90 00 00 00 00 40 f6 f3 10 00 00 00 00 40 f7 31 90 00 00 00 00 40 f7 70 10 00 00 00 00 40 f7 ae 90 00 00 00 00 40 f7 ed 10 00 00 00 00 40 f8 2b 90 00 00 00 00 40 f8 6a 10 00 00 00 00 40 f8 a8 90 00 00 00 00 40 f8 e7 10 00 00 00 00 40 f9 25 90 00 00 00 00 40 f9 64 10 00 00 00 00 40 f9 a2 90 00 00 00 00 40 f9 e1 10 00 00 00 00 40 fa 1f 90 00 00 00 00 40 fa 5e 10 00 00 00 00 40 fa 9c 90 00 00 00 00 40 fa db 10 00 00 00 00 40 fb 19 90 00 00 00 00 40 fb 58 10 00 00 00 00 40 fb 96 90 00 00 00 00 40 fb d5 10 00 00 00 00 40 fc 13 90 00 00 00 00 40 fc 52 10 00 00 00 00 40 fc 90 90 00 00 00 00 40 fc cf 10 00 00 00 00 40 fd 0d 90 00 00 00 00 40 fd 4c 10 00 00 00 00 40 fd 8a 90 00 10... Dump hexa: (full size is 96063) 84 95 a6 be 00 01 77 2b 00 00 00 01 00 00 00 09 00 00 00 09 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 1c 00 00 00 00 00 00 00 38 00 00 00 03 00 00 00 06 00 00 00 14 00 00 00 1e 00 00 00 28 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0a 00 00 00 0b 00 00 00 0c 00 00 00 0d 00 00 00 0e 00 00 00 0f 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1a 00 00 00 1b 00 00 00 1c 00 00 00 1d 00 00 00 1e 00 00 00 1f 00 00 00 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 26 00 00 00 27 00 00 00 0a 00 00 00 0b 00 00 00 0c 00 00 00 0d 00 00 00 0e 00 00 00 0f 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1a 00 00 00 1b 00 00 00 1c 00 00 00 1d 00 00 00 1e 00 00 00 1f 00 00 00 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 26 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2a 00 00 00 2b 00 00 00 2c 00 00 00 2d 00 00 00 2e 00 00 00 2f 00 00 00 30 00 00 00 31 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1a 00 00 00 1b 00 00 00 1c 00 00 00 1d 00 00 00 1e 00 00 00 1f 00 00 00 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 26 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2a 00 00 00 2b 00 00 00 2c 00 00 00 2d 00 00 00 2e 00 00 00 2f 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 35 00 00 00 36 00 00 00 37 00 00 00 38 00 00 00 39 00 00 00 3a 00 00 00 3b 00 00 00 1e 00 00 00 1f 00 00 00 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 26 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2a 00 00 00 2b 00 00 00 2c 00 00 00 2d 00 00 00 2e 00 00 00 2f 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 35 00 00 00 36 00 00 00 37 00 00 00 38 00 00 00 39 00 00 00 3a 00 00 00 3b 00 00 00 3c 00 00 00 3d 00 00 00 3e 00 00 00 3f 00 00 00 40 00 00 00 41 00 00 00 42 00 00 00 43 00 00 00 44 00 00 00 45 00 00 00 28 00 00 00 29 00 00 00 2a 00 00 00 2b 00 00 00 2c 00 00 00 2d 00 00 00 2e 00 00 00 2f 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 35 00 00 00 36 00 00 00 37 00 00 00 38 00 00 00 39 00 00 00 3a 00 00 00 3b 00 00 00 3c 00 00 00 3d 00 00 00 3e 00 00 00 3f 00 00 00 40 00 00 00 41 00 00 00 42 00 00 00 43 00 00 00 44 00 00 00 45 00 00 00 46 00 00 00 47 00 00 00 48 00 00 00 49 00 00 00 4a 00 00 00 4b 00 00 00 4c 00 00 00 4d 00 00 00 4e 00 00 00 4f 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 35 00 00 00 36 00 00 00 37 00 00 00 38 00 00 00 39 00 00 00 3a 00 00 00 3b 00 00 00 3c 00 00 00 3d 00 00 00 3e 00 00 00 3f 00 00 00 40 00 00 00 41 00 00 00 42 00 00 00 43 00 00 00 44 00 00 00 45 00 00 00 46 00 00 00 47 00 00 00 48 00 00 00 49 00 00 00 4a 00 00 00 4b 00 00 00 4c 00 00 00 4d 00 00 00 4e 00 00 00 4f 00 00 00 50 00 00 00 51 00 00 00 52 00 00 00 53 00 00 00 54 00 00 00 55 00 00 00 56 00 00 00 57 00 00 00 58 00 00 00 59 00 11... Dump hexa: (full size is 200063) 84 95 a6 be 00 03 0d 6b 00 00 00 01 00 00 00 09 00 00 00 09 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 1c 00 00 00 00 00 00 00 38 00 00 00 03 00 00 01 00 00 00 00 0a 00 00 00 32 00 00 00 64 42 de 00 00 43 53 00 00 43 9b 80 00 43 cd 80 00 43 ff 80 00 44 18 c0 00 44 31 c0 00 44 4a c0 00 44 63 c0 00 44 7c c0 00 42 f2 00 00 43 5d 00 00 43 a0 80 00 43 d2 80 00 44 02 40 00 44 1b 40 00 44 34 40 00 44 4d 40 00 44 66 40 00 44 7f 40 00 43 03 00 00 43 67 00 00 43 a5 80 00 43 d7 80 00 44 04 c0 00 44 1d c0 00 44 36 c0 00 44 4f c0 00 44 68 c0 00 44 80 e0 00 43 0d 00 00 43 71 00 00 43 aa 80 00 43 dc 80 00 44 07 40 00 44 20 40 00 44 39 40 00 44 52 40 00 44 6b 40 00 44 82 20 00 43 17 00 00 43 7b 00 00 43 af 80 00 43 e1 80 00 44 09 c0 00 44 22 c0 00 44 3b c0 00 44 54 c0 00 44 6d c0 00 44 83 60 00 43 21 00 00 43 82 80 00 43 b4 80 00 43 e6 80 00 44 0c 40 00 44 25 40 00 44 3e 40 00 44 57 40 00 44 70 40 00 44 84 a0 00 43 2b 00 00 43 87 80 00 43 b9 80 00 43 eb 80 00 44 0e c0 00 44 27 c0 00 44 40 c0 00 44 59 c0 00 44 72 c0 00 44 85 e0 00 43 35 00 00 43 8c 80 00 43 be 80 00 43 f0 80 00 44 11 40 00 44 2a 40 00 44 43 40 00 44 5c 40 00 44 75 40 00 44 87 20 00 43 3f 00 00 43 91 80 00 43 c3 80 00 43 f5 80 00 44 13 c0 00 44 2c c0 00 44 45 c0 00 44 5e c0 00 44 77 c0 00 44 88 60 00 43 49 00 00 43 96 80 00 43 c8 80 00 43 fa 80 00 44 16 40 00 44 2f 40 00 44 48 40 00 44 61 40 00 44 7a 40 00 44 89 a0 00 43 53 00 00 43 9b 80 00 43 cd 80 00 43 ff 80 00 44 18 c0 00 44 31 c0 00 44 4a c0 00 44 63 c0 00 44 7c c0 00 44 8a e0 00 43 5d 00 00 43 a0 80 00 43 d2 80 00 44 02 40 00 44 1b 40 00 44 34 40 00 44 4d 40 00 44 66 40 00 44 7f 40 00 44 8c 20 00 43 67 00 00 43 a5 80 00 43 d7 80 00 44 04 c0 00 44 1d c0 00 44 36 c0 00 44 4f c0 00 44 68 c0 00 44 80 e0 00 44 8d 60 00 43 71 00 00 43 aa 80 00 43 dc 80 00 44 07 40 00 44 20 40 00 44 39 40 00 44 52 40 00 44 6b 40 00 44 82 20 00 44 8e a0 00 43 7b 00 00 43 af 80 00 43 e1 80 00 44 09 c0 00 44 22 c0 00 44 3b c0 00 44 54 c0 00 44 6d c0 00 44 83 60 00 44 8f e0 00 43 82 80 00 43 b4 80 00 43 e6 80 00 44 0c 40 00 44 25 40 00 44 3e 40 00 44 57 40 00 44 70 40 00 44 84 a0 00 44 91 20 00 43 87 80 00 43 b9 80 00 43 eb 80 00 44 0e c0 00 44 27 c0 00 44 40 c0 00 44 59 c0 00 44 72 c0 00 44 85 e0 00 44 92 60 00 43 8c 80 00 43 be 80 00 43 f0 80 00 44 11 40 00 44 2a 40 00 44 43 40 00 44 5c 40 00 44 75 40 00 44 87 20 00 44 93 a0 00 43 91 80 00 43 c3 80 00 43 f5 80 00 44 13 c0 00 44 2c c0 00 44 45 c0 00 44 5e c0 00 44 77 c0 00 44 88 60 00 44 94 e0 00 43 96 80 00 43 c8 80 00 43 fa 80 00 44 16 40 00 44 2f 40 00 44 48 40 00 44 61 40 00 44 7a 40 00 44 89 a0 00 44 96 20 00 43 9b 80 00 43 cd 80 00 43 ff 80 00 44 18 c0 00 44 31 c0 00 44 4a c0 00 44 63 c0 00 44 7c c0 00 44 8a e0 00 44 97 60 00 43 a0 80 00 43 d2 80 00 44 02 40 00 44 1b 40 00 44 34 40 00 44 4d 40 00 44 66 40 00 44 7f 40 00 44 8c 20 00 44 98 a0 00 43 a5 80 00 43 d7 80 00 44 04 c0 00 44 1d c0 00 44 36 c0 00 44 4f c0 00 44 68 c0 00 44 80 e0 00 44 8d 60 00 44 99 e0 00 43 aa 80 00 43 dc 80 00 44 07 40 00 44 20 40 00 44 39 40 00 44 52 40 00 44 6b 40 00 44 82 20 00 44 8e a0 00 44 9b 20 00 43 12... Dump hexa: (full size is 80059) 84 95 a6 be 00 01 38 a7 00 00 00 01 00 00 00 08 00 00 00 08 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 18 00 00 00 00 00 00 00 30 00 00 00 02 00 00 00 0a 00 00 00 64 00 00 00 64 00 00 00 00 00 00 00 00 3f 80 00 00 bf 80 00 00 40 00 00 00 c0 00 00 00 40 40 00 00 c0 40 00 00 40 80 00 00 c0 80 00 00 40 a0 00 00 c0 a0 00 00 40 c0 00 00 c0 c0 00 00 40 e0 00 00 c0 e0 00 00 41 00 00 00 c1 00 00 00 41 10 00 00 c1 10 00 00 41 20 00 00 c1 20 00 00 41 30 00 00 c1 30 00 00 41 40 00 00 c1 40 00 00 41 50 00 00 c1 50 00 00 41 60 00 00 c1 60 00 00 41 70 00 00 c1 70 00 00 41 80 00 00 c1 80 00 00 41 88 00 00 c1 88 00 00 41 90 00 00 c1 90 00 00 41 98 00 00 c1 98 00 00 41 a0 00 00 c1 a0 00 00 41 a8 00 00 c1 a8 00 00 41 b0 00 00 c1 b0 00 00 41 b8 00 00 c1 b8 00 00 41 c0 00 00 c1 c0 00 00 41 c8 00 00 c1 c8 00 00 41 d0 00 00 c1 d0 00 00 41 d8 00 00 c1 d8 00 00 41 e0 00 00 c1 e0 00 00 41 e8 00 00 c1 e8 00 00 41 f0 00 00 c1 f0 00 00 41 f8 00 00 c1 f8 00 00 42 00 00 00 c2 00 00 00 42 04 00 00 c2 04 00 00 42 08 00 00 c2 08 00 00 42 0c 00 00 c2 0c 00 00 42 10 00 00 c2 10 00 00 42 14 00 00 c2 14 00 00 42 18 00 00 c2 18 00 00 42 1c 00 00 c2 1c 00 00 42 20 00 00 c2 20 00 00 42 24 00 00 c2 24 00 00 42 28 00 00 c2 28 00 00 42 2c 00 00 c2 2c 00 00 42 30 00 00 c2 30 00 00 42 34 00 00 c2 34 00 00 42 38 00 00 c2 38 00 00 42 3c 00 00 c2 3c 00 00 42 40 00 00 c2 40 00 00 42 44 00 00 c2 44 00 00 42 48 00 00 c2 48 00 00 42 4c 00 00 c2 4c 00 00 42 50 00 00 c2 50 00 00 42 54 00 00 c2 54 00 00 42 58 00 00 c2 58 00 00 42 5c 00 00 c2 5c 00 00 42 60 00 00 c2 60 00 00 42 64 00 00 c2 64 00 00 42 68 00 00 c2 68 00 00 42 6c 00 00 c2 6c 00 00 42 70 00 00 c2 70 00 00 42 74 00 00 c2 74 00 00 42 78 00 00 c2 78 00 00 42 7c 00 00 c2 7c 00 00 42 80 00 00 c2 80 00 00 42 82 00 00 c2 82 00 00 42 84 00 00 c2 84 00 00 42 86 00 00 c2 86 00 00 42 88 00 00 c2 88 00 00 42 8a 00 00 c2 8a 00 00 42 8c 00 00 c2 8c 00 00 42 8e 00 00 c2 8e 00 00 42 90 00 00 c2 90 00 00 42 92 00 00 c2 92 00 00 42 94 00 00 c2 94 00 00 42 96 00 00 c2 96 00 00 42 98 00 00 c2 98 00 00 42 9a 00 00 c2 9a 00 00 42 9c 00 00 c2 9c 00 00 42 9e 00 00 c2 9e 00 00 42 a0 00 00 c2 a0 00 00 42 a2 00 00 c2 a2 00 00 42 a4 00 00 c2 a4 00 00 42 a6 00 00 c2 a6 00 00 42 a8 00 00 c2 a8 00 00 42 aa 00 00 c2 aa 00 00 42 ac 00 00 c2 ac 00 00 42 ae 00 00 c2 ae 00 00 42 b0 00 00 c2 b0 00 00 42 b2 00 00 c2 b2 00 00 42 b4 00 00 c2 b4 00 00 42 b6 00 00 c2 b6 00 00 42 b8 00 00 c2 b8 00 00 42 ba 00 00 c2 ba 00 00 42 bc 00 00 c2 bc 00 00 42 be 00 00 c2 be 00 00 42 c0 00 00 c2 c0 00 00 42 c2 00 00 c2 c2 00 00 42 c4 00 00 c2 c4 00 00 42 c6 00 00 c2 c6 00 00 44 7a 00 00 c4 7a 00 00 44 7a 40 00 c4 7a 40 00 44 7a 80 00 c4 7a 80 00 44 7a c0 00 c4 7a c0 00 44 7b 00 00 c4 7b 00 00 44 7b 40 00 c4 7b 40 00 44 7b 80 00 c4 7b 80 00 44 7b c0 00 c4 7b c0 00 44 7c 00 00 c4 7c 00 00 44 7c 40 00 c4 7c 40 00 44 7c 80 00 c4 7c 80 00 44 7c c0 00 c4 7c c0 00 44 7d 00 00 c4 7d 00 00 44 7d 40 00 c4 7d 40 00 44 7d 80 00 c4 7d 80 00 44 7d c0 00 c4 7d c0 00 44 7e 00 00 c4 7e 00 00 44 7e 40 00 c4 7e 40 00 44 7e 80 00 c4 7e 80 00 44 7e c0 00 c4 7e c0 00 44 7f 00 00 c4 13... Dump hexa: (full size is 96063) 84 95 a6 be 00 01 77 2b 00 00 00 01 00 00 00 09 00 00 00 09 18 5f 62 69 67 61 72 72 61 79 00 00 00 00 1c 00 00 00 00 00 00 00 38 00 00 00 03 00 00 01 0b 00 00 00 0a 00 00 00 14 00 00 00 1e 40 5b c0 00 00 00 00 00 c0 5b c0 00 00 00 00 00 40 6a 60 00 00 00 00 00 c0 6a 60 00 00 00 00 00 40 73 70 00 00 00 00 00 c0 73 70 00 00 00 00 00 40 79 b0 00 00 00 00 00 c0 79 b0 00 00 00 00 00 40 7f f0 00 00 00 00 00 c0 7f f0 00 00 00 00 00 40 83 18 00 00 00 00 00 c0 83 18 00 00 00 00 00 40 86 38 00 00 00 00 00 c0 86 38 00 00 00 00 00 40 89 58 00 00 00 00 00 c0 89 58 00 00 00 00 00 40 8c 78 00 00 00 00 00 c0 8c 78 00 00 00 00 00 40 8f 98 00 00 00 00 00 c0 8f 98 00 00 00 00 00 40 5e 40 00 00 00 00 00 c0 5e 40 00 00 00 00 00 40 6b a0 00 00 00 00 00 c0 6b a0 00 00 00 00 00 40 74 10 00 00 00 00 00 c0 74 10 00 00 00 00 00 40 7a 50 00 00 00 00 00 c0 7a 50 00 00 00 00 00 40 80 48 00 00 00 00 00 c0 80 48 00 00 00 00 00 40 83 68 00 00 00 00 00 c0 83 68 00 00 00 00 00 40 86 88 00 00 00 00 00 c0 86 88 00 00 00 00 00 40 89 a8 00 00 00 00 00 c0 89 a8 00 00 00 00 00 40 8c c8 00 00 00 00 00 c0 8c c8 00 00 00 00 00 40 8f e8 00 00 00 00 00 c0 8f e8 00 00 00 00 00 40 60 60 00 00 00 00 00 c0 60 60 00 00 00 00 00 40 6c e0 00 00 00 00 00 c0 6c e0 00 00 00 00 00 40 74 b0 00 00 00 00 00 c0 74 b0 00 00 00 00 00 40 7a f0 00 00 00 00 00 c0 7a f0 00 00 00 00 00 40 80 98 00 00 00 00 00 c0 80 98 00 00 00 00 00 40 83 b8 00 00 00 00 00 c0 83 b8 00 00 00 00 00 40 86 d8 00 00 00 00 00 c0 86 d8 00 00 00 00 00 40 89 f8 00 00 00 00 00 c0 89 f8 00 00 00 00 00 40 8d 18 00 00 00 00 00 c0 8d 18 00 00 00 00 00 40 90 1c 00 00 00 00 00 c0 90 1c 00 00 00 00 00 40 61 a0 00 00 00 00 00 c0 61 a0 00 00 00 00 00 40 6e 20 00 00 00 00 00 c0 6e 20 00 00 00 00 00 40 75 50 00 00 00 00 00 c0 75 50 00 00 00 00 00 40 7b 90 00 00 00 00 00 c0 7b 90 00 00 00 00 00 40 80 e8 00 00 00 00 00 c0 80 e8 00 00 00 00 00 40 84 08 00 00 00 00 00 c0 84 08 00 00 00 00 00 40 87 28 00 00 00 00 00 c0 87 28 00 00 00 00 00 40 8a 48 00 00 00 00 00 c0 8a 48 00 00 00 00 00 40 8d 68 00 00 00 00 00 c0 8d 68 00 00 00 00 00 40 90 44 00 00 00 00 00 c0 90 44 00 00 00 00 00 40 62 e0 00 00 00 00 00 c0 62 e0 00 00 00 00 00 40 6f 60 00 00 00 00 00 c0 6f 60 00 00 00 00 00 40 75 f0 00 00 00 00 00 c0 75 f0 00 00 00 00 00 40 7c 30 00 00 00 00 00 c0 7c 30 00 00 00 00 00 40 81 38 00 00 00 00 00 c0 81 38 00 00 00 00 00 40 84 58 00 00 00 00 00 c0 84 58 00 00 00 00 00 40 87 78 00 00 00 00 00 c0 87 78 00 00 00 00 00 40 8a 98 00 00 00 00 00 c0 8a 98 00 00 00 00 00 40 8d b8 00 00 00 00 00 c0 8d b8 00 00 00 00 00 40 90 6c 00 00 00 00 00 c0 90 6c 00 00 00 00 00 40 64 20 00 00 00 00 00 c0 64 20 00 00 00 00 00 40 70 50 00 00 00 00 00 c0 70 50 00 00 00 00 00 40 76 90 00 00 00 00 00 c0 76 90 00 00 00 00 00 40 7c d0 00 00 00 00 00 c0 7c d0 00 00 00 00 00 40 81 88 00 00 00 00 00 c0 81 88 00 00 00 00 00 40 84 a8 00 00 00 00 00 c0 84 a8 00 00 00 00 00 40 87 c8 00 00 00 00 00 c0 87 c8 00 00 00 00 00 40 8a e8 00 00 00 00 00 c0 8a e8 00 00 00 00 00 40 8e 08 00 00 00 00 00 c0 8e 08 00 00 00 00 00 40 90 94 00 00 00 00 00 c0 90 94 00 00 00 00 00 40 14... js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/change_layout.ml000066400000000000000000000065261357507750000264720ustar00rootroot00000000000000(* TEST *) (** Test the various change_layout for Genarray and the various Array[n] *) open Bigarray let pp_sep ppf () = Format.fprintf ppf ";@ " let print_array pp ppf a = Format.fprintf ppf "@[[|%a|]@]" Format.(pp_print_list ~pp_sep pp) (Array.to_list a) let print_index = print_array Format.pp_print_int let do_test n test = let rec aux l n = if n = 0 then l else aux begin match test (n-1) with | Some error -> error :: l | None -> l end (n-1) in aux [] n let kind = float64 let c = c_layout let fortran = fortran_layout let rank = 5 let dims = Array.init rank (fun n -> n+2) let size = Array.fold_left ( * ) 1 dims let report s test = let errors = do_test size test in if errors = [] then Format.printf"@[%s: Ok@]@." s else Format.printf "@[%s:@;Failed at indices @[%a@]@]@." s (Format.pp_print_list ~pp_sep print_index) errors let array = let a = Array1.create kind c size in for i = 0 to size - 1 do a.{i} <- float i done; a (** Test for generic biggarray *) let gen = reshape (genarray_of_array1 array) dims let sizes = let a = Array.make rank 1 in let _ = Array.fold_left (fun (i,s) x -> a.(i)<- s; (i+1, s * x)) (0,1) dims in a let multi_index n = Array.init rank ( fun i -> (n / sizes.(i)) mod dims.(i) ) let testG n = let pos = multi_index n in let initial = Genarray.get gen pos in Genarray.set gen pos (-1.); let different = Genarray.get gen pos <> initial in let gen' = Genarray.change_layout gen fortran in Genarray.set gen' ( Array.init rank @@ fun n -> 1 + pos.( rank - 1 - n ) ) initial; if not (different && initial = Genarray.get gen pos) then Some pos else None ;; report "Generic rank test" testG ;; (* Scalar *) let scalar = let a = Array0.create kind c in Array0.set a 0.; a ;; let test = let a' = Array0.change_layout scalar fortran in Array0.set a' 1.; Array0.get scalar = 1. ;; Format.printf "Scalar test: %s@." (if test then "Ok" else "Failed") ;; (* Vector *) let vec = array1_of_genarray @@ reshape gen [|size|] let test1 i = let initial = vec.{i} in vec.{i} <- -1.; let different = vec.{i} <> initial in let vec' = Array1.change_layout vec fortran in vec'.{ i + 1 } <- initial; if different && initial = vec.{i} then None else Some [|i|] ;; report "Rank-1 array test" test1 ;; (* Matrix *) let mat = array2_of_genarray @@ reshape gen [|dims.(0); size / dims.(0) |] let bi_index n = n mod dims.(0), n / dims.(0) let test2 n = let i, j = bi_index n in let initial = mat.{i,j} in mat.{i,j} <- -1.; let different = mat.{i,j} <> initial in let mat' = Array2.change_layout mat fortran in mat'.{ j + 1, i + 1 } <- initial; if different && initial = mat.{i, j} then None else Some [|i; j|] ;; report "Rank-2 array test" test2 ;; (* Rank 3 *) let t3 = array3_of_genarray @@ reshape gen [|dims.(0); dims.(1); size / (dims.(0) * dims.(1)) |] let tri_index n = n mod dims.(0), (n/ dims.(0)) mod dims.(1), n / (dims.(0) * dims.(1)) let test3 n = let i, j, k = tri_index n in let initial = t3.{i,j,k} in t3.{i,j,k} <- -1.; let different = t3.{i,j,k} <> initial in let t3' = Array3.change_layout t3 fortran in t3'.{ k + 1, j + 1, i + 1 } <- initial; if different && initial = t3.{i, j, k} then None else Some [|i;j;k|] ;; report "Rank-3 array test" test3 ;; js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/change_layout.reference000066400000000000000000000001501357507750000300030ustar00rootroot00000000000000Generic rank test: Ok Scalar test: Ok Rank-1 array test: Ok Rank-2 array test: Ok Rank-3 array test: Ok js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/dune000066400000000000000000000027151357507750000241700ustar00rootroot00000000000000(vendored_dirs vendor) (executables (names bigarrays change_layout fftba pr5115 weak_bigarray) (libraries) (js_of_ocaml) ) (rule (target bigarrays.referencejs) (deps bigarrays.bc.js) (action (with-stdout-to %{target} (run node ./bigarrays.bc.js)))) (alias (name runtest) (deps bigarrays.reference bigarrays.referencejs) (action (diff bigarrays.reference bigarrays.referencejs))) (rule (target change_layout.referencejs) (deps change_layout.bc.js) (action (with-stdout-to %{target} (run node ./change_layout.bc.js)))) (alias (name runtest) (deps change_layout.reference change_layout.referencejs) (action (diff change_layout.reference change_layout.referencejs))) (rule (target fftba.referencejs) (deps fftba.bc.js) (action (with-stdout-to %{target} (run node ./fftba.bc.js)))) (alias (name runtest) (deps fftba.reference fftba.referencejs) (action (diff fftba.reference fftba.referencejs))) (rule (target pr5115.referencejs) (deps pr5115.bc.js) (action (with-stdout-to %{target} (run node ./pr5115.bc.js)))) (alias (name runtest) (deps pr5115.reference pr5115.referencejs) (action (diff pr5115.reference pr5115.referencejs))) (rule (target weak_bigarray.referencejs) (deps weak_bigarray.bc.js) (action (with-stdout-to %{target} (run node ./weak_bigarray.bc.js)))) (alias (name runtest) (deps weak_bigarray.reference weak_bigarray.referencejs) (action (diff weak_bigarray.reference weak_bigarray.referencejs)))js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/fftba.ml000066400000000000000000000103561357507750000247260ustar00rootroot00000000000000[@@@ocaml.warning "-35"] (* TEST *) open Bigarray let pi = 3.14159265358979323846 let tpi = 2.0 *. pi let fft (px : (float, float64_elt, c_layout) Array1.t) (py : (float, float64_elt, c_layout) Array1.t) np = let i = ref 2 in let m = ref 1 in while (!i < np) do i := !i + !i; m := !m + 1 done; let n = !i in if n <> np then begin for i = np+1 to n do px.{i} <- 0.0; py.{i} <- 0.0 done; print_string "Use "; print_int n; print_string " point fft"; print_newline() end; let n2 = ref(n+n) in for k = 1 to !m-1 do n2 := !n2 / 2; let n4 = !n2 / 4 in let e = tpi /. float !n2 in for j = 1 to n4 do let a = e *. float(j - 1) in let a3 = 3.0 *. a in let cc1 = cos(a) in let ss1 = sin(a) in let cc3 = cos(a3) in let ss3 = sin(a3) in let is = ref j in let id = ref(2 * !n2) in while !is < n do let i0r = ref !is in while !i0r < n do let i0 = !i0r in let i1 = i0 + n4 in let i2 = i1 + n4 in let i3 = i2 + n4 in let r1 = px.{i0} -. px.{i2} in px.{i0} <- px.{i0} +. px.{i2}; let r2 = px.{i1} -. px.{i3} in px.{i1} <- px.{i1} +. px.{i3}; let s1 = py.{i0} -. py.{i2} in py.{i0} <- py.{i0} +. py.{i2}; let s2 = py.{i1} -. py.{i3} in py.{i1} <- py.{i1} +. py.{i3}; let s3 = r1 -. s2 in let r1 = r1 +. s2 in let s2 = r2 -. s1 in let r2 = r2 +. s1 in px.{i2} <- r1*.cc1 -. s2*.ss1; py.{i2} <- -.s2*.cc1 -. r1*.ss1; px.{i3} <- s3*.cc3 +. r2*.ss3; py.{i3} <- r2*.cc3 -. s3*.ss3; i0r := i0 + !id done; is := 2 * !id - !n2 + j; id := 4 * !id done done done; (************************************) (* Last stage, length=2 butterfly *) (************************************) let is = ref 1 in let id = ref 4 in while !is < n do let i0r = ref !is in while !i0r <= n do let i0 = !i0r in let i1 = i0 + 1 in let r1 = px.{i0} in px.{i0} <- r1 +. px.{i1}; px.{i1} <- r1 -. px.{i1}; let r1 = py.{i0} in py.{i0} <- r1 +. py.{i1}; py.{i1} <- r1 -. py.{i1}; i0r := i0 + !id done; is := 2 * !id - 1; id := 4 * !id done; (*************************) (* Bit reverse counter *) (*************************) let j = ref 1 in for i = 1 to n - 1 do if i < !j then begin let xt = px.{!j} in px.{!j} <- px.{i}; px.{i} <- xt; let xt = py.{!j} in py.{!j} <- py.{i}; py.{i} <- xt end; let k = ref(n / 2) in while !k < !j do j := !j - !k; k := !k / 2 done; j := !j + !k done; n let test np = print_int np; print_string "... "; flush stdout; let enp = float np in let npm = np / 2 - 1 in let pxr = Array1.create float64 c_layout (np+2) and pxi = Array1.create float64 c_layout (np+2) in let t = pi /. enp in pxr.{1} <- (enp -. 1.0) *. 0.5; pxi.{1} <- 0.0; let n2 = np / 2 in pxr.{n2+1} <- -0.5; pxi.{n2+1} <- 0.0; for i = 1 to npm do let j = np - i in pxr.{i+1} <- -0.5; pxr.{j+1} <- -0.5; let z = t *. float i in let y = -0.5 *. (cos(z)/.sin(z)) in pxi.{i+1} <- y; pxi.{j+1} <- -.y done; (* print_newline(); for i=0 to 15 do Printf.printf "%d %f %f\n" i pxr.{i+1} pxi.{i+1} done; **) let _ = fft pxr pxi np in (* for i=0 to 15 do Printf.printf "%d %f %f\n" i pxr.{i+1} pxi.{i+1} done; **) let zr = ref 0.0 in let zi = ref 0.0 in let kr = ref 0 in let ki = ref 0 in for i = 0 to np-1 do let a = abs_float(pxr.{i+1} -. float i) in if !zr < a then begin zr := a; kr := i end; let a = abs_float(pxi.{i+1}) in if !zi < a then begin zi := a; ki := i end done; (* let zm = if abs_float !zr < abs_float !zi then !zi else !zr in print_float zm; print_newline() *) if abs_float !zr <= 1e-9 && abs_float !zi <= 1e-9 then print_string "ok" else print_string "ERROR"; print_newline() let _ = let np = ref 16 in for i = 1 to 13 do test !np; np := !np*2 done js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/fftba.reference000066400000000000000000000002111357507750000262410ustar00rootroot0000000000000016... ok 32... ok 64... ok 128... ok 256... ok 512... ok 1024... ok 2048... ok 4096... ok 8192... ok 16384... ok 32768... ok 65536... ok js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/pr5115.ml000066400000000000000000000003631357507750000245760ustar00rootroot00000000000000(* TEST *) (* PR#5115 - multiple evaluation of bigarray expr *) open Bigarray let f y0 = Printf.printf "***EXEC***\n%!"; y0 let _ = let y = Array1.of_array float64 fortran_layout [| 1. |] in ignore ((f y).{1}); (f y).{1} <- 3.14 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/pr5115.reference000066400000000000000000000000261357507750000261200ustar00rootroot00000000000000***EXEC*** ***EXEC*** js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/weak_bigarray.ml000066400000000000000000000011071357507750000264450ustar00rootroot00000000000000(* TEST *) (** check that custom block are not copied by Weak.get_copy *) open Bigarray open Bigarray.Array1 let () = let a = ref (create float64 c_layout 10) in Gc.compact (); set !a 0 42.; let w = Weak.create 1 in Weak.set w 0 (Some !a); let b = match Weak.get_copy w 0 with | None -> assert false | Some b -> b in Printf.printf "a.(0) = %f\n" (get !a 0); Printf.printf "b.(0) = %f\n" (get b 0); a := create float64 c_layout 10; Gc.compact (); let c = create float64 c_layout 10 in set c 0 33.; Printf.printf "b.(0) = %f\n" (get b 0); js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bigarray/weak_bigarray.reference000066400000000000000000000000661357507750000277760ustar00rootroot00000000000000a.(0) = 42.000000 b.(0) = 42.000000 b.(0) = 42.000000 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bool/000077500000000000000000000000001357507750000224405ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bool/dune000066400000000000000000000004471357507750000233230ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bool/test.ml000066400000000000000000000041311357507750000237500ustar00rootroot00000000000000(* TEST *) let test_not () = assert (Bool.not false = true); assert (Bool.not true = false); () let test_and () = let wit = ref 0 in assert (Bool.( && ) (incr wit; false) (incr wit; false) = false); assert (!wit = 1); wit := 0; assert (Bool.( && ) (incr wit; false) (incr wit; true) = false); assert (!wit = 1); wit := 0; assert (Bool.( && ) (incr wit; true) (incr wit; false) = false); assert (!wit = 2); wit := 0; assert (Bool.( && ) (incr wit; true) (incr wit; true) = true); assert (!wit = 2); wit := 0; () let test_or () = let wit = ref 0 in assert (Bool.( || ) (incr wit; false) (incr wit; false) = false); assert (!wit = 2); wit := 0; assert (Bool.( || ) (incr wit; false) (incr wit; true) = true); assert (!wit = 2); wit := 0; assert (Bool.( || ) (incr wit; true) (incr wit; false) = true); assert (!wit = 1); wit := 0; assert (Bool.( || ) (incr wit; true) (incr wit; true) = true); assert (!wit = 1); wit := 0; () let test_equal () = assert (Bool.equal false false = true); assert (Bool.equal false true = false); assert (Bool.equal true false = false); assert (Bool.equal true true = true); () let test_compare () = assert (Bool.compare false false = 0); assert (Bool.compare false true = -1); assert (Bool.compare true false = 1); assert (Bool.compare true true = 0); () let test_to_int () = assert (Bool.to_int false = 0); assert (Bool.to_int true = 1); () let test_to_float () = assert (Bool.to_float false = 0.); assert (Bool.to_float true = 1.); () let test_of_string () = (* assert (Bool.of_string "false" = Some false); assert (Bool.of_string "true" = Some true); assert (Bool.of_string "heyho" = None); assert (Bool.of_string "1" = None); assert (Bool.of_string "0" = None); *) () let test_to_string () = assert (Bool.to_string false = "false"); assert (Bool.to_string true = "true"); () let tests () = test_not (); test_and (); test_or (); test_equal (); test_compare (); test_to_int (); test_to_float (); test_of_string (); test_to_string (); () let () = tests (); print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bool/test.reference000066400000000000000000000000031357507750000252700ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-buffer/000077500000000000000000000000001357507750000227565ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-buffer/dune000066400000000000000000000004471357507750000236410ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-buffer/test.ml000066400000000000000000000147511357507750000242770ustar00rootroot00000000000000[@@@ocaml.warning "-35"] (* TEST *) open Printf ;; (* Set up*) let n = 10 ;; let buf = Buffer.create n ;; let () = for i = 1 to 10 do Buffer.add_char buf 'a' done ;; assert (Buffer.length buf = n) ;; (* Helpers *) let output result str = print_string ("Buffer " ^ str ^ " " ^ result ^ "\n") ;; let passed = output "passed" ;; let failed = output "failed" ;; let buffer_truncate = "Buffer.truncate" let unexpected str = Printf.sprintf "The Invalid_argument exception has been raised with an \ invalid value as argument \"%s\". Expecting \"%s\"." str buffer_truncate let validate f str msg = if str=buffer_truncate then f msg else failed (unexpected str) (* Tests *) let () = print_string "Standard Library: Module Buffer\n" ;; let truncate_neg : unit = let msg = "truncate: negative" in try Buffer.truncate buf (-1); failed msg with Invalid_argument str -> validate passed str msg ;; let truncate_large : unit = let msg = "truncate: large" in try Buffer.truncate buf (n+1); failed msg with Invalid_argument str -> validate passed str msg ;; let truncate_correct : unit = let n' = n - 1 and msg = "truncate: in-range" in try Buffer.truncate buf n'; if Buffer.length buf = n' then passed msg else failed msg with Invalid_argument str -> validate failed str msg ;; let reset_non_zero : unit = let msg = "reset: non-zero" in Buffer.reset buf; if Buffer.length buf = 0 then passed msg else failed msg ;; let reset_zero : unit = let msg = "reset: zero" in Buffer.reset buf; if Buffer.length buf = 0 then passed msg else failed msg ;; let utf_8_spec = (* UTF-8 byte sequences, cf. table 3.7 Unicode 9. *) [(0x0000,0x007F), [|(0x00,0x7F)|]; (0x0080,0x07FF), [|(0xC2,0xDF); (0x80,0xBF)|]; (0x0800,0x0FFF), [|(0xE0,0xE0); (0xA0,0xBF); (0x80,0xBF)|]; (0x1000,0xCFFF), [|(0xE1,0xEC); (0x80,0xBF); (0x80,0xBF)|]; (0xD000,0xD7FF), [|(0xED,0xED); (0x80,0x9F); (0x80,0xBF)|]; (0xE000,0xFFFF), [|(0xEE,0xEF); (0x80,0xBF); (0x80,0xBF)|]; (0x10000,0x3FFFF), [|(0xF0,0xF0); (0x90,0xBF); (0x80,0xBF); (0x80,0xBF)|]; (0x40000,0xFFFFF), [|(0xF1,0xF3); (0x80,0xBF); (0x80,0xBF); (0x80,0xBF)|]; (0x100000,0x10FFFF), [|(0xF4,0xF4); (0x80,0x8F); (0x80,0xBF); (0x80,0xBF)|]] ;; let utf_16be_spec = (* UTF-16BE byte sequences, derived from table 3.5 Unicode 9. *) [(0x0000,0xD7FF), [|(0x00,0xD7); (0x00,0xFF)|]; (0xE000,0xFFFF), [|(0xE0,0xFF); (0x00,0xFF)|]; (0x10000,0x10FFFF), [|(0xD8,0xDB); (0x00,0xFF); (0xDC,0xDF); (0x00,0xFF)|]] ;; let uchar_map_of_spec spec = (* array mapping Uchar.t as ints to byte sequences according to [spec]. *) let map = Array.make ((Uchar.to_int Uchar.max) + 1) "" in let add_range ((umin, umax), bytes) = let len = Array.length bytes in let bmin i = if i < len then fst bytes.(i) else max_int in let bmax i = if i < len then snd bytes.(i) else min_int in let uchar = ref umin in let buf = Bytes.create len in let add len' = if len <> len' then () else begin let bytes = Bytes.to_string buf in map.(!uchar) <- bytes; incr uchar; end in for b0 = bmin 0 to bmax 0 do Bytes.unsafe_set buf 0 (Char.chr b0); for b1 = bmin 1 to bmax 1 do Bytes.unsafe_set buf 1 (Char.chr b1); for b2 = bmin 2 to bmax 2 do Bytes.unsafe_set buf 2 (Char.chr b2); for b3 = bmin 3 to bmax 3 do Bytes.unsafe_set buf 3 (Char.chr b3); add 4; done; add 3; done; add 2; done; add 1; done; assert (!uchar - 1 = umax) in List.iter add_range spec; map ;; let test_spec_map msg utf_x_map buffer_add_utf_x_uchar = let b = Buffer.create 4 in let rec loop u = Buffer.clear b; buffer_add_utf_x_uchar b u; match Buffer.contents b = utf_x_map.(Uchar.to_int u) with | false -> failed (sprintf "%s of U+%04X" msg (Uchar.to_int u)) | true -> if Uchar.equal u Uchar.max then passed msg else loop (Uchar.succ u) in loop Uchar.min ;; let add_utf_8_uchar : unit = let map = uchar_map_of_spec utf_8_spec in test_spec_map "add_utf_8_uchar: test against spec" map Buffer.add_utf_8_uchar ;; let add_utf_16be_uchar : unit = let map = uchar_map_of_spec utf_16be_spec in test_spec_map "add_utf_16be_uchar: test against spec" map Buffer.add_utf_16be_uchar ;; let add_utf_16le_uchar : unit = (* The uchar_map_of_spec generation function doesn't work on a LE spec since uchars and byte seqs have to increase and map together; simply swap the map obtained with utf_16be_spec. *) let map = let swap bytes = let swap i = match i with | 0 -> 1 | 1 -> 0 | 2 -> 3 | 3 -> 2 | _ -> assert false in String.init (String.length bytes) (fun i -> bytes.[swap i]) in Array.map swap (uchar_map_of_spec utf_16be_spec) in test_spec_map "add_utf_16le_uchar: test against spec" map Buffer.add_utf_16le_uchar ;; let () = let b = Buffer.create 64 in Buffer.add_int8 b 0xff; Buffer.add_int8 b 0x01; Buffer.add_int16_be b 0x0123; Buffer.add_int16_le b 0x0123; Buffer.add_int32_be b 0x01234567l; Buffer.add_int32_le b 0x01234567l; Buffer.add_int64_be b 0x0123456789abcdefL; Buffer.add_int64_le b 0x0123456789abcdefL; assert (Buffer.contents b = "\xff\x01" ^ "\x01\x23\x23\x01" ^ "\x01\x23\x45\x67" ^ "\x67\x45\x23\x01" ^ "\x01\x23\x45\x67\x89\xab\xcd\xef" ^ "\xef\xcd\xab\x89\x67\x45\x23\x01" ); Buffer.clear b; Buffer.add_int16_ne b 0x0123; Buffer.add_int32_ne b 0x01234567l; Buffer.add_int64_ne b 0x0123456789abcdefL; let s = Buffer.contents b in if Sys.big_endian then assert (s = "\x01\x23\x01\x23\x45\x67\x01\x23\x45\x67\x89\xab\xcd\xef") else assert (s = "\x23\x01\x67\x45\x23\x01\xef\xcd\xab\x89\x67\x45\x23\x01"); for i = 1 to 20 do let b = Buffer.create i in for j = 1 to 100 do Buffer.add_int8 b 1 done; assert(Buffer.length b = 100); done; for i = 1 to 20 do let b = Buffer.create i in for j = 1 to 100 do Buffer.add_int16_ne b 1 done; assert(Buffer.length b = 200); done; for i = 1 to 20 do let b = Buffer.create i in for j = 1 to 100 do Buffer.add_int32_ne b 1l done; assert(Buffer.length b = 400); done; for i = 1 to 20 do let b = Buffer.create i in for j = 1 to 100 do Buffer.add_int64_ne b 1L done; assert(Buffer.length b = 800); done ;; js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-buffer/test.reference000066400000000000000000000005211357507750000256130ustar00rootroot00000000000000Standard Library: Module Buffer Buffer truncate: negative passed Buffer truncate: large passed Buffer truncate: in-range passed Buffer reset: non-zero passed Buffer reset: zero passed Buffer add_utf_8_uchar: test against spec passed Buffer add_utf_16be_uchar: test against spec passed Buffer add_utf_16le_uchar: test against spec passed js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bytes/000077500000000000000000000000001357507750000226335ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bytes/binary.ml000066400000000000000000000132141357507750000244520ustar00rootroot00000000000000(* TEST *) let err x = match Lazy.force x with | exception Invalid_argument _ -> () | _ -> assert false let () = let b = Bytes.make 5 (Char.chr 0) in Bytes.set_int8 b 3 260; Bytes.set_int8 b 2 1; Bytes.set_int8 b 1 2; Bytes.set_int8 b 0 3; Bytes.set_int8 b 4 (-1); assert (Bytes.to_string b = "\003\002\001\004\255"); lazy (Bytes.set_int8 b 5 0) |> err; lazy (Bytes.get_int8 b 5) |> err; lazy (Bytes.set_uint8 b 5 0) |> err; lazy (Bytes.get_uint8 b 5) |> err; assert(Bytes.get_int8 b 0 = 3); assert(Bytes.get_int8 b 1 = 2); assert(Bytes.get_int8 b 2 = 1); assert(Bytes.get_int8 b 3 = 4); assert(Bytes.get_int8 b 4 = -1); assert(Bytes.get_uint8 b 0 = 3); assert(Bytes.get_uint8 b 1 = 2); assert(Bytes.get_uint8 b 2 = 1); assert(Bytes.get_uint8 b 3 = 4); assert(Bytes.get_uint8 b 4 = 255); for i = 0 to 255 do Bytes.set_uint8 b 0 i; assert (Bytes.get_uint8 b 0 = i); done; for i = -128 to 127 do Bytes.set_int8 b 0 i; assert (Bytes.get_int8 b 0 = i); done let () = let b = Bytes.make 3 (Char.chr 0) in Bytes.set_int16_le b 1 0x1234; Bytes.set_int16_le b 0 0xabcd; assert (Bytes.to_string b = "\xcd\xab\x12"); assert(Bytes.get_uint16_le b 0 = 0xabcd); assert(Bytes.get_uint16_le b 1 = 0x12ab); assert(Bytes.get_int16_le b 0 = 0xabcd - 0x10000); assert(Bytes.get_int16_le b 1 = 0x12ab); assert(Bytes.get_uint16_be b 1 = 0xab12); assert(Bytes.get_int16_be b 1 = 0xab12 - 0x10000); for i = 0 to Bytes.length b - 2 do let x = Bytes.get_int16_ne b i in let f = if Sys.big_endian then Bytes.get_int16_be else Bytes.get_int16_le in assert (x = f b i); let x = Bytes.get_uint16_ne b i in let f = if Sys.big_endian then Bytes.get_uint16_be else Bytes.get_uint16_le in assert (x = f b i) done; lazy (Bytes.set_int16_le b 2 0) |> err; lazy (Bytes.set_int16_ne b 2 0) |> err; lazy (Bytes.set_int16_be b 2 0) |> err; lazy (Bytes.get_int16_le b 2) |> err; lazy (Bytes.get_int16_ne b 2) |> err; lazy (Bytes.get_int16_be b 2) |> err; lazy (Bytes.set_uint16_le b 2 0) |> err; lazy (Bytes.set_uint16_ne b 2 0) |> err; lazy (Bytes.set_uint16_be b 2 0) |> err; lazy (Bytes.get_uint16_le b 2) |> err; lazy (Bytes.get_uint16_ne b 2) |> err; lazy (Bytes.get_uint16_be b 2) |> err; for i = 0 to 0xffff do Bytes.set_uint16_le b 0 i; assert (Bytes.get_uint16_le b 0 = i); Bytes.set_uint16_be b 0 i; assert (Bytes.get_uint16_be b 0 = i); Bytes.set_uint16_ne b 0 i; assert (Bytes.get_uint16_ne b 0 = i); assert ( (if Sys.big_endian then Bytes.get_uint16_be else Bytes.get_uint16_le) b 0 = i); done; for i = -0x8000 to 0x7fff do Bytes.set_int16_le b 0 i; assert (Bytes.get_int16_le b 0 = i); Bytes.set_int16_be b 0 i; assert (Bytes.get_int16_be b 0 = i); Bytes.set_int16_ne b 0 i; assert (Bytes.get_int16_ne b 0 = i); assert ( (if Sys.big_endian then Bytes.get_int16_be else Bytes.get_int16_le) b 0 = i); done let () = let b = Bytes.make 6 (Char.chr 0) in Bytes.set_int32_le b 1 0x01234567l; Bytes.set_int32_le b 0 0x89abcdefl; assert (Bytes.to_string b = "\xef\xcd\xab\x89\x01\x00"); assert (Bytes.get_int32_le b 0 = 0x89abcdefl); assert (Bytes.get_int32_be b 0 = 0xefcdab89l); assert (Bytes.get_int32_le b 1 = 0x0189abcdl); assert (Bytes.get_int32_be b 1 = 0xcdab8901l); Bytes.set_int32_be b 1 0x01234567l; Bytes.set_int32_be b 0 0x89abcdefl; assert (Bytes.to_string b = "\x89\xab\xcd\xef\x67\x00"); Bytes.set_int32_ne b 0 0x01234567l; assert(Bytes.get_int32_ne b 0 = 0x01234567l); if Sys.big_endian then assert (Bytes.to_string b = "\x01\x23\x45\x67\x67\x00") else assert (Bytes.to_string b = "\x67\x45\x23\x01\x67\x00"); Bytes.set_int32_ne b 0 0xffffffffl; assert(Bytes.get_int32_ne b 0 = 0xffffffffl); for i = 0 to Bytes.length b - 4 do let x = Bytes.get_int32_ne b i in let f = if Sys.big_endian then Bytes.get_int32_be else Bytes.get_int32_le in assert (x = f b i); done; lazy (Bytes.set_int32_le b 3 0l) |> err; lazy (Bytes.set_int32_ne b 3 0l) |> err; lazy (Bytes.set_int32_be b 3 0l) |> err; lazy (Bytes.get_int32_le b 3) |> err; lazy (Bytes.get_int32_ne b 3) |> err; lazy (Bytes.get_int32_be b 3) |> err; () let () = let b = Bytes.make 10 (Char.chr 0) in Bytes.set_int64_le b 1 0x0123456789abcdefL; Bytes.set_int64_le b 0 0x1032547698badcfeL; assert (Bytes.to_string b = "\xfe\xdc\xba\x98\x76\x54\x32\x10\x01\x00"); assert (Bytes.get_int64_le b 0 = 0x1032547698badcfeL); assert (Bytes.get_int64_be b 0 = 0xfedcba9876543210L); assert (Bytes.get_int64_le b 1 = 0x011032547698badcL); assert (Bytes.get_int64_be b 1 = 0xdcba987654321001L); Bytes.set_int64_be b 1 0x0123456789abcdefL; Bytes.set_int64_be b 0 0x1032547698badcfeL; assert (Bytes.to_string b = "\x10\x32\x54\x76\x98\xba\xdc\xfe\xef\x00"); Bytes.set_int64_ne b 0 0x0123456789abcdefL; assert(Bytes.get_int64_ne b 0 = 0x0123456789abcdefL); if Sys.big_endian then assert (Bytes.to_string b = "\x01\x23\x45\x67\x89\xab\xcd\xef\xef\x00") else assert (Bytes.to_string b = "\xef\xcd\xab\x89\x67\x45\x23\x01\xef\x00"); Bytes.set_int64_ne b 0 0xffffffffffffffffL; assert(Bytes.get_int64_ne b 0 = 0xffffffffffffffffL); for i = 0 to Bytes.length b - 8 do let x = Bytes.get_int64_ne b i in let f = if Sys.big_endian then Bytes.get_int64_be else Bytes.get_int64_le in assert (x = f b i); done; lazy (Bytes.set_int64_le b 3 0L) |> err; lazy (Bytes.set_int64_ne b 3 0L) |> err; lazy (Bytes.set_int64_be b 3 0L) |> err; lazy (Bytes.get_int64_le b 3) |> err; lazy (Bytes.get_int64_ne b 3) |> err; lazy (Bytes.get_int64_be b 3) |> err; () js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bytes/dune000066400000000000000000000010201357507750000235020ustar00rootroot00000000000000(executables (names test_bytes binary) (libraries) (js_of_ocaml) ) (rule (target test_bytes.referencejs) (deps test_bytes.bc.js) (action (with-stdout-to %{target} (run node ./test_bytes.bc.js)))) (alias (name runtest) (deps test_bytes.reference test_bytes.referencejs) (action (diff test_bytes.reference test_bytes.referencejs))) (rule (target binary.referencejs) (deps binary.bc.js) (action (with-stdout-to %{target} (run node ./binary.bc.js)))) (alias (name runtest) (deps binary.referencejs)) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bytes/test_bytes.ml000066400000000000000000000044551357507750000253620ustar00rootroot00000000000000(* TEST include testing *) let test_raises_invalid_argument f x = ignore (Testing.test_raises_exc_p (function Invalid_argument _ -> true | _ -> false) f x) let check b offset s = let rec loop i = i = String.length s || Bytes.get b (i + offset) = String.get s i && loop (i+1) in loop 0 let () = let abcde = Bytes.of_string "abcde" in let open Bytes in begin (* abcde ????? *) Testing.test (length (extend abcde 7 (-7)) = 5); (* abcde ????? *) Testing.test (length (extend abcde (-7) 7) = 5); (* abcde abcde *) Testing.test (let r = extend abcde 0 0 in length r = 5 && check r 0 "abcde" && r != abcde); (* abcde ??abc *) Testing.test (let r = extend abcde 2 (-2) in length r = 5 && check r 2 "abc"); (* abcde bcd *) Testing.test (let r = extend abcde (-1) (-1) in length r = 3 && check r 0 "bcd"); (* abcde de?? *) Testing.test (let r = extend abcde (-3) 2 in length r = 4 && check r 0 "de"); (* abcde abc *) Testing.test (let r = extend abcde 0 (-2) in length r = 3 && check r 0 "abc"); (* abcde cde *) Testing.test (let r = extend abcde (-2) 0 in length r = 3 && check r 0 "cde"); (* abcde abcde?? *) Testing.test (let r = extend abcde 0 2 in length r = 7 && check r 0 "abcde"); (* abcde ??abcde *) Testing.test (let r = extend abcde 2 0 in length r = 7 && check r 2 "abcde"); (* abcde ?abcde? *) Testing.test (let r = extend abcde 1 1 in length r = 7 && check r 1 "abcde"); (* length + left + right < 0 *) test_raises_invalid_argument (fun () -> extend abcde (-3) (-3)) (); (* length + left > max_int *) test_raises_invalid_argument (fun () -> extend abcde max_int 0) (); (* length + right > max_int *) test_raises_invalid_argument (fun () -> extend abcde 0 max_int) (); (* length + left + right > max_int *) test_raises_invalid_argument (fun () -> extend abcde max_int max_int) (); end let () = exit 0 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bytes/test_bytes.reference000066400000000000000000000000711357507750000266760ustar00rootroot00000000000000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 All tests succeeded. js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-bytes/testing.ml000066400000000000000000000062341357507750000246470ustar00rootroot00000000000000(**************************************************************************) (* *) (* OCaml *) (* *) (* Pierre Weis, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 2006 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (* Testing auxiliaries. *) open Scanf;; let all_tests_ok = ref true;; let finish () = match !all_tests_ok with | true -> print_endline "\nAll tests succeeded." | _ -> print_endline "\n\n********* Test suite failed. ***********\n";; at_exit finish;; let test_num = ref (-1);; let print_test_number () = print_string " "; print_int !test_num; flush stdout;; let next_test () = incr test_num; print_test_number ();; let print_test_fail () = all_tests_ok := false; print_string (Printf.sprintf "\n********* Test number %i failed ***********\n" !test_num);; let print_failure_test_fail () = all_tests_ok := false; print_string (Printf.sprintf "\n********* Failure Test number %i incorrectly failed ***********\n" !test_num);; let print_failure_test_succeed () = all_tests_ok := false; print_string (Printf.sprintf "\n********* Failure Test number %i failed to fail ***********\n" !test_num);; let test b = next_test (); if not b then print_test_fail ();; (* Applies f to x and checks that the evaluation indeed raises an exception that verifies the predicate [pred]. *) let test_raises_exc_p pred f x = next_test (); try ignore (f x); print_failure_test_succeed (); false with | x -> pred x || (print_failure_test_fail (); false);; (* Applies f to x and checks that the evaluation indeed raises some exception. *) let test_raises_some_exc f = test_raises_exc_p (fun _ -> true) f;; let test_raises_this_exc exc = test_raises_exc_p (fun x -> x = exc);; (* Applies f to x and checks that the evaluation indeed raises exception Failure s. *) let test_raises_this_failure s f x = test_raises_exc_p (fun x -> x = Failure s) f x;; (* Applies f to x and checks that the evaluation indeed raises the exception Failure. *) let test_raises_some_failure f x = test_raises_exc_p (function Failure _ -> true | _ -> false) f x;; let failure_test f x s = test_raises_this_failure s f x;; let any_failure_test = test_raises_some_failure;; let scan_failure_test f x = test_raises_exc_p (function Scan_failure _ -> true | _ -> false) f x;; js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-digest/000077500000000000000000000000001357507750000227645ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-digest/dune000066400000000000000000000004371357507750000236460ustar00rootroot00000000000000(executables (names md5) (libraries) (js_of_ocaml) ) (rule (target md5.referencejs) (deps md5.bc.js) (action (with-stdout-to %{target} (run node ./md5.bc.js)))) (alias (name runtest) (deps md5.reference md5.referencejs) (action (diff md5.reference md5.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-digest/md5.ml000066400000000000000000000222571357507750000240130ustar00rootroot00000000000000[@@@ocaml.warning "-35"] (* TEST flags += " -w a " *) (* Test int32 arithmetic and optimizations using the MD5 algorithm *) open Printf type context = { buf: bytes; mutable pos: int; mutable a: int32; mutable b: int32; mutable c: int32; mutable d: int32; mutable bits: int64 } let step1 w x y z data s = let w = Int32.add (Int32.add w data) (Int32.logxor z (Int32.logand x (Int32.logxor y z))) in Int32.add x (Int32.logor (Int32.shift_left w s) (Int32.shift_right_logical w (32-s))) let step2 w x y z data s = let w = Int32.add (Int32.add w data) (Int32.logxor y (Int32.logand z (Int32.logxor x y))) in Int32.add x (Int32.logor (Int32.shift_left w s) (Int32.shift_right_logical w (32-s))) let step3 w x y z data s = let w = Int32.add (Int32.add w data) (Int32.logxor x (Int32.logxor y z)) in Int32.add x (Int32.logor (Int32.shift_left w s) (Int32.shift_right_logical w (32-s))) let step4 w x y z data s = let w = Int32.add (Int32.add w data) (Int32.logxor y (Int32.logor x (Int32.logxor z (-1l)))) in Int32.add x (Int32.logor (Int32.shift_left w s) (Int32.shift_right_logical w (32-s))) let transform ctx data = let a = ctx.a and b = ctx.b and c = ctx.c and d = ctx.d in let a = step1 a b c d (Int32.add data.(0) 0xd76aa478l) 7 in let d = step1 d a b c (Int32.add data.(1) 0xe8c7b756l) 12 in let c = step1 c d a b (Int32.add data.(2) 0x242070dbl) 17 in let b = step1 b c d a (Int32.add data.(3) 0xc1bdceeel) 22 in let a = step1 a b c d (Int32.add data.(4) 0xf57c0fafl) 7 in let d = step1 d a b c (Int32.add data.(5) 0x4787c62al) 12 in let c = step1 c d a b (Int32.add data.(6) 0xa8304613l) 17 in let b = step1 b c d a (Int32.add data.(7) 0xfd469501l) 22 in let a = step1 a b c d (Int32.add data.(8) 0x698098d8l) 7 in let d = step1 d a b c (Int32.add data.(9) 0x8b44f7afl) 12 in let c = step1 c d a b (Int32.add data.(10) 0xffff5bb1l) 17 in let b = step1 b c d a (Int32.add data.(11) 0x895cd7bel) 22 in let a = step1 a b c d (Int32.add data.(12) 0x6b901122l) 7 in let d = step1 d a b c (Int32.add data.(13) 0xfd987193l) 12 in let c = step1 c d a b (Int32.add data.(14) 0xa679438el) 17 in let b = step1 b c d a (Int32.add data.(15) 0x49b40821l) 22 in let a = step2 a b c d (Int32.add data.(1) 0xf61e2562l) 5 in let d = step2 d a b c (Int32.add data.(6) 0xc040b340l) 9 in let c = step2 c d a b (Int32.add data.(11) 0x265e5a51l) 14 in let b = step2 b c d a (Int32.add data.(0) 0xe9b6c7aal) 20 in let a = step2 a b c d (Int32.add data.(5) 0xd62f105dl) 5 in let d = step2 d a b c (Int32.add data.(10) 0x02441453l) 9 in let c = step2 c d a b (Int32.add data.(15) 0xd8a1e681l) 14 in let b = step2 b c d a (Int32.add data.(4) 0xe7d3fbc8l) 20 in let a = step2 a b c d (Int32.add data.(9) 0x21e1cde6l) 5 in let d = step2 d a b c (Int32.add data.(14) 0xc33707d6l) 9 in let c = step2 c d a b (Int32.add data.(3) 0xf4d50d87l) 14 in let b = step2 b c d a (Int32.add data.(8) 0x455a14edl) 20 in let a = step2 a b c d (Int32.add data.(13) 0xa9e3e905l) 5 in let d = step2 d a b c (Int32.add data.(2) 0xfcefa3f8l) 9 in let c = step2 c d a b (Int32.add data.(7) 0x676f02d9l) 14 in let b = step2 b c d a (Int32.add data.(12) 0x8d2a4c8al) 20 in let a = step3 a b c d (Int32.add data.(5) 0xfffa3942l) 4 in let d = step3 d a b c (Int32.add data.(8) 0x8771f681l) 11 in let c = step3 c d a b (Int32.add data.(11) 0x6d9d6122l) 16 in let b = step3 b c d a (Int32.add data.(14) 0xfde5380cl) 23 in let a = step3 a b c d (Int32.add data.(1) 0xa4beea44l) 4 in let d = step3 d a b c (Int32.add data.(4) 0x4bdecfa9l) 11 in let c = step3 c d a b (Int32.add data.(7) 0xf6bb4b60l) 16 in let b = step3 b c d a (Int32.add data.(10) 0xbebfbc70l) 23 in let a = step3 a b c d (Int32.add data.(13) 0x289b7ec6l) 4 in let d = step3 d a b c (Int32.add data.(0) 0xeaa127fal) 11 in let c = step3 c d a b (Int32.add data.(3) 0xd4ef3085l) 16 in let b = step3 b c d a (Int32.add data.(6) 0x04881d05l) 23 in let a = step3 a b c d (Int32.add data.(9) 0xd9d4d039l) 4 in let d = step3 d a b c (Int32.add data.(12) 0xe6db99e5l) 11 in let c = step3 c d a b (Int32.add data.(15) 0x1fa27cf8l) 16 in let b = step3 b c d a (Int32.add data.(2) 0xc4ac5665l) 23 in let a = step4 a b c d (Int32.add data.(0) 0xf4292244l) 6 in let d = step4 d a b c (Int32.add data.(7) 0x432aff97l) 10 in let c = step4 c d a b (Int32.add data.(14) 0xab9423a7l) 15 in let b = step4 b c d a (Int32.add data.(5) 0xfc93a039l) 21 in let a = step4 a b c d (Int32.add data.(12) 0x655b59c3l) 6 in let d = step4 d a b c (Int32.add data.(3) 0x8f0ccc92l) 10 in let c = step4 c d a b (Int32.add data.(10) 0xffeff47dl) 15 in let b = step4 b c d a (Int32.add data.(1) 0x85845dd1l) 21 in let a = step4 a b c d (Int32.add data.(8) 0x6fa87e4fl) 6 in let d = step4 d a b c (Int32.add data.(15) 0xfe2ce6e0l) 10 in let c = step4 c d a b (Int32.add data.(6) 0xa3014314l) 15 in let b = step4 b c d a (Int32.add data.(13) 0x4e0811a1l) 21 in let a = step4 a b c d (Int32.add data.(4) 0xf7537e82l) 6 in let d = step4 d a b c (Int32.add data.(11) 0xbd3af235l) 10 in let c = step4 c d a b (Int32.add data.(2) 0x2ad7d2bbl) 15 in let b = step4 b c d a (Int32.add data.(9) 0xeb86d391l) 21 in ctx.a <- Int32.add ctx.a a; ctx.b <- Int32.add ctx.b b; ctx.c <- Int32.add ctx.c c; ctx.d <- Int32.add ctx.d d let string_to_data s = let data = Array.make 16 0l in for i = 0 to 15 do let j = i lsl 2 in data.(i) <- let byte n = Bytes.get s (j+n) |> Char.code |> Int32.of_int in let open Int32 in byte 0 |> logor (shift_left (byte 1) 8) |> logor (shift_left (byte 2) 16) |> logor (shift_left (byte 3) 24) done; data let int32_to_string n s i = Bytes.set s (i+3) (Char.chr (Int32.to_int (Int32.shift_right n 24) land 0xFF)); Bytes.set s (i+2) (Char.chr (Int32.to_int (Int32.shift_right n 16) land 0xFF)); Bytes.set s (i+1) (Char.chr (Int32.to_int (Int32.shift_right n 8) land 0xFF)); Bytes.set s i (Char.chr (Int32.to_int n land 0xFF)) let init () = { buf = Bytes.create 64; pos = 0; a = 0x67452301l; b = 0xefcdab89l; c = 0x98badcfel; d = 0x10325476l; bits = 0L } let update ctx input ofs len = let rec upd ofs len = if len <= 0 then () else if ctx.pos + len < 64 then begin (* Just buffer the data *) Bytes.blit_string input ofs ctx.buf ctx.pos len; ctx.pos <- ctx.pos + len end else begin (* Fill the buffer *) let len' = 64 - ctx.pos in if len' > 0 then Bytes.blit_string input ofs ctx.buf ctx.pos len'; (* Transform 64 bytes *) transform ctx (string_to_data ctx.buf); ctx.pos <- 0; upd (ofs + len') (len - len') end in upd ofs len; ctx.bits <- Int64.add ctx.bits (Int64.of_int (len lsl 3)) let finish ctx = let padding = String.init 64 (function 0 -> '\x80' | _ -> '\000') in let numbits = ctx.bits in if ctx.pos < 56 then begin update ctx padding 0 (56 - ctx.pos) end else begin update ctx padding 0 (64 + 56 - ctx.pos) end; assert (ctx.pos = 56); let data = string_to_data ctx.buf in data.(14) <- (Int64.to_int32 numbits); data.(15) <- (Int64.to_int32 (Int64.shift_right_logical numbits 32)); transform ctx data; let res = Bytes.create 16 in int32_to_string ctx.a res 0; int32_to_string ctx.b res 4; int32_to_string ctx.c res 8; int32_to_string ctx.d res 12; Bytes.unsafe_to_string res let test hex s = let ctx = init() in update ctx s 0 (String.length s); let res = finish ctx in let exp = Digest.string s in let ok = res = exp && Digest.to_hex exp = hex in if not ok then Printf.printf "Failure for %S : %S %S %S %S\n" s res exp (Digest.to_hex exp) hex; ok let time msg iter fn = let start = Sys.time() in for i = 1 to iter do fn () done; let stop = Sys.time() in printf "%s: %.2f s\n" msg (stop -. start) let _ = (* Test *) if test "d41d8cd98f00b204e9800998ecf8427e" "" && test "0cc175b9c0f1b6a831c399e269772661" "a" && test "900150983cd24fb0d6963f7d28e17f72" "abc" && test "8215ef0796a20bcaaae116d3876c664a" "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" && test "7707d6ae4e027c70eea2a935c2296f21" (String.make 1_000_000 'a') && test "f96b697d7cb7938d525a2f31aaf161d0" "message digest" && test "d174ab98d277d9f5a5611c2c9f419d9f" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" && test "9e107d9d372bb6826bd81d3542a419d6" "The quick brown fox jumps over the lazy dog" && test "e4d909c290d0fb1ca068ffaddf22cbd0" "The quick brown fox jumps over the lazy dog." then printf "Test vectors passed.\n"; flush stdout; (* Benchmark *) if (Array.length Sys.argv) > 1 && (Sys.argv.(1) = "-benchmark") then begin let s = String.make 50000 'a' in let num_iter = 1000 in time "OCaml implementation" num_iter (fun () -> let ctx = init() in update ctx s 0 (String.length s); ignore (finish ctx)); time "C implementation" num_iter (fun () -> ignore (Digest.string s)) end js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-digest/md5.reference000066400000000000000000000000251357507750000253260ustar00rootroot00000000000000Test vectors passed. js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-filename/000077500000000000000000000000001357507750000232655ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-filename/dune000066400000000000000000000011171357507750000241430ustar00rootroot00000000000000(executables (names suffix extension) (libraries) (js_of_ocaml) ) (rule (target suffix.referencejs) (deps suffix.bc.js) (action (with-stdout-to %{target} (run node ./suffix.bc.js)))) (alias (name runtest) (deps suffix.reference suffix.referencejs) (action (diff suffix.reference suffix.referencejs))) (rule (target extension.referencejs) (deps extension.bc.js) (action (with-stdout-to %{target} (run node ./extension.bc.js)))) (alias (name runtest) (deps extension.reference extension.referencejs) (action (diff extension.reference extension.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-filename/extension.ml000066400000000000000000000005421357507750000256340ustar00rootroot00000000000000(* TEST *) let () = let test f e = assert(Filename.extension f = e); assert(Filename.extension ("foo/" ^ f) = e); assert(f = Filename.remove_extension f ^ Filename.extension f) in test "" ""; test "foo" ""; test "foo.txt" ".txt"; test "foo.txt.gz" ".gz"; test ".foo" ""; test "." ""; test ".." ""; test "foo..txt" ".txt" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-filename/extension.reference000066400000000000000000000000001357507750000271470ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-filename/suffix.ml000066400000000000000000000015151357507750000251250ustar00rootroot00000000000000(* TEST *) let () = let test ~suffix name exp = let r1 = Filename.chop_suffix_opt ~suffix name <> None in let r2 = Filename.check_suffix name suffix in assert (r1 = r2); assert (r1 = exp) in let full_test ~suffix name = test ~suffix name true; match Filename.chop_suffix_opt ~suffix name with | None -> assert false | Some base -> assert (base ^ suffix = name) in let win32 = Sys.os_type = "Win32" || Sys.os_type = "Cygwin" in full_test ~suffix:".txt" "foo.txt"; full_test ~suffix:"txt" "foo.txt"; full_test ~suffix:"" "foo.txt"; full_test ~suffix:"" ""; test ~suffix:".txt" "f" false; test ~suffix:".txt" "" false; test ~suffix:".txt" "foo.txt.bak" false; test ~suffix:".txt" "foo.TXT" win32; if win32 then assert (Filename.chop_suffix_opt ~suffix:".txt" "foo.TXT" = Some "foo") js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-filename/suffix.reference000066400000000000000000000000001357507750000264370ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-float/000077500000000000000000000000001357507750000226125ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-float/dune000066400000000000000000000004471357507750000234750ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-float/test.ml000066400000000000000000000106371357507750000241320ustar00rootroot00000000000000(* TEST *) let () = assert(Float.is_finite 1.); assert(Float.is_finite Float.pi); assert(not(Float.is_finite Float.infinity)); assert(not(Float.is_finite Float.nan)); assert(Float.is_infinite Float.infinity); assert(not(Float.is_infinite 1.)); assert(not(Float.is_infinite Float.nan)); assert(Float.is_nan Float.nan); assert(not(Float.is_nan 1.)); assert(not(Float.is_nan neg_infinity)); assert(Float.is_integer 1.); assert(Float.is_integer (-1e10)); assert(not(Float.is_integer 1.5)); assert(not(Float.is_integer Float.infinity)); assert(not(Float.is_integer Float.nan)); assert(Float.trunc 1.5 = 1.); assert(Float.trunc (-1.5) = -1.); assert(Float.(trunc infinity = infinity)); assert(Float.(trunc neg_infinity = neg_infinity)); assert(Float.(is_nan(trunc nan))); assert(Float.round 0.5 = 1.); (* tie resolve differently *) assert(true || Float.round (-0.5) = -1.); assert(Float.round 1.5 = 2.); (* tie resolve differently *) assert(true || Float.round (-1.5) = -2.); assert(let x = 0x1.0000000000001p52 in (* x + 0.5 rounds to x +. 1. *) Float.round x = x); assert(Float.round (Float.next_after 0.5 0.) = 0.); assert(Float.(round infinity = infinity)); assert(Float.(round neg_infinity = neg_infinity)); assert(Float.(is_nan(round nan))); assert(Float.next_after 0x1.FFFFFFFFFFFFFp-2 1. = 0.5); assert(Float.next_after 0x1.FFFFFFFFFFFFFp-2 0. = 0x1.FFFFFFFFFFFFEp-2); assert(Float.(next_after 0x1.FFFFFFFFFFFFFp-2 infinity = 0.5)); assert(Float.(next_after 0x1.FFFFFFFFFFFFFp-2 neg_infinity = 0x1.FFFFFFFFFFFFEp-2)); assert(Float.next_after 1. 1. = 1.); assert(Float.(is_nan(next_after nan 1.))); assert(Float.(is_nan(next_after 3. nan))); assert(Float.(succ 0x1.FFFFFFFFFFFFFp-2 = 0.5)); assert(Float.(pred 0.5 = 0x1.FFFFFFFFFFFFFp-2)); assert(Float.(succ 0. > 0.)); assert(Float.(pred 0. < 0.)); assert(Float.(succ max_float = infinity)); assert(Float.(pred (-. max_float) = neg_infinity)); assert(Float.(succ 0. < min_float)); assert(Float.(succ infinity = infinity)); assert(Float.(pred neg_infinity = neg_infinity)); assert(Float.(is_nan(succ nan))); assert(Float.(is_nan(pred nan))); assert(not(Float.sign_bit 1.)); assert(Float.sign_bit (-1.)); assert(not(Float.sign_bit 0.)); assert(Float.sign_bit (-0.)); assert(not(Float.sign_bit infinity)); assert(Float.sign_bit neg_infinity); assert(Float.min 1. 2. = 1.); assert(Float.min 2. 1. = 1.); assert(Float.(is_nan(min 1. nan))); assert(Float.(is_nan(min nan 2.))); assert(Float.(is_nan(min nan nan))); assert(1. /. Float.min (-0.) (+0.) = neg_infinity); assert(1. /. Float.min (+0.) (-0.) = neg_infinity); assert(Float.max 1. 2. = 2.); assert(Float.max 2. 1. = 2.); assert(Float.(is_nan(max 1. nan))); assert(Float.(is_nan(max nan 2.))); assert(Float.(is_nan(max nan nan))); assert(1. /. Float.max (-0.) (+0.) = infinity); assert(1. /. Float.max (+0.) (-0.) = infinity); assert(Float.min_max 1. 2. = (1., 2.)); assert(Float.min_max 2. 1. = (1., 2.)); let is_nan2 (x, y) = Float.is_nan x && Float.is_nan y in assert(Float.(is_nan2(min_max 1. nan))); assert(Float.(is_nan2(min_max nan 2.))); assert(Float.(is_nan2(min_max nan nan))); assert(let x, y = Float.min_max (-0.) (+0.) in 1. /. x = neg_infinity && 1. /. y = infinity); assert(let x, y = Float.min_max (+0.) (-0.) in 1. /. x = neg_infinity && 1. /. y = infinity); assert(Float.min_num 1. 2. = 1.); assert(Float.(min_num 1. nan = 1.)); assert(Float.(min_num nan 2. = 2.)); assert(Float.(is_nan(min_num nan nan))); assert(1. /. Float.min_num (-0.) (+0.) = neg_infinity); assert(1. /. Float.min_num (+0.) (-0.) = neg_infinity); assert(Float.max_num 1. 2. = 2.); assert(Float.(max_num 1. nan = 1.)); assert(Float.(max_num nan 2. = 2.)); assert(Float.(is_nan(max_num nan nan))); assert(1. /. Float.max_num (-0.) (+0.) = infinity); assert(1. /. Float.max_num (+0.) (-0.) = infinity); assert(Float.min_max_num 1. 2. = (1., 2.)); assert(Float.min_max_num 2. 1. = (1., 2.)); assert(Float.min_max_num 1. nan = (1., 1.)); assert(Float.min_max_num nan 1. = (1., 1.)); assert(Float.(is_nan2(min_max_num nan nan))); assert(let x, y = Float.min_max_num (-0.) (+0.) in 1. /. x = neg_infinity && 1. /. y = infinity); assert(let x, y = Float.min_max_num (+0.) (-0.) in 1. /. x = neg_infinity && 1. /. y = infinity); ;; let () = print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-float/test.reference000066400000000000000000000000031357507750000254420ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-floatarray/000077500000000000000000000000001357507750000236515ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-floatarray/dune000066400000000000000000000004041357507750000245250ustar00rootroot00000000000000(executables (names floatarray) (libraries) (js_of_ocaml) ) (rule (target floatarray.referencejs) (deps floatarray.bc.js) (action (with-stdout-to %{target} (run node ./floatarray.bc.js)))) (alias (name runtest) (deps floatarray.referencejs)) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-floatarray/floatarray.ml000066400000000000000000000340101357507750000263450ustar00rootroot00000000000000[@@@ocaml.warning "-27-33-39"] (* TEST *) open Printf (* This is the module type of [Float.Array] except type [t] is abstract. *) module type S = sig type t val length : t -> int val get : t -> int -> float val set : t -> int -> float -> unit val make : int -> float -> t val create : int -> t val init : int -> (int -> float) -> t val append : t -> t -> t val concat : t list -> t val sub : t -> int -> int -> t val copy : t -> t val fill : t -> int -> int -> float -> unit val blit : t -> int -> t -> int -> int -> unit val to_list : t -> float list val of_list : float list -> t val iter : (float -> unit) -> t -> unit val iteri : (int -> float -> unit) -> t -> unit val map : (float -> float) -> t -> t val mapi : (int -> float -> float) -> t -> t val fold_left : ('a -> float -> 'a) -> 'a -> t -> 'a val fold_right : (float -> 'a -> 'a) -> t -> 'a -> 'a val iter2 : (float -> float -> unit) -> t -> t -> unit val map2 : (float -> float -> float) -> t -> t -> t val for_all : (float -> bool) -> t -> bool val exists : (float -> bool) -> t -> bool val mem : float -> t -> bool val mem_ieee : float -> t -> bool val sort : (float -> float -> int) -> t -> unit val stable_sort : (float -> float -> int) -> t -> unit val fast_sort : (float -> float -> int) -> t -> unit val to_seq : t -> float Seq.t val to_seqi : t -> (int * float) Seq.t val of_seq : float Seq.t -> t val map_to_array : (float -> 'a) -> t -> 'a array val map_from_array : ('a -> float) -> 'a array -> t val unsafe_get : t -> int -> float val unsafe_set : t -> int -> float -> unit end (* module [Array] specialized to [float] and with a few changes, satisfies signature S *) module Float_array : S = struct include Stdlib.Array let create = create_float let map_to_array f a = map f a let map_from_array f a = map f a let mem_ieee x a = exists ((=) x) a type t = float array end module Test (A : S) : sig end = struct (* auxiliary functions *) let neg_zero = 1.0 /. neg_infinity in let rec check_i_upto a i = if i >= 0 then begin assert (A.get a i = Float.of_int i); check_i_upto a (i - 1); end in let check_i a = check_i_upto a (A.length a - 1) in let check_inval f arg = match f arg with | _ -> assert false | exception (Invalid_argument _) -> () | exception _ -> assert false in (* [make] [set] [get] *) let a = A.make 1000 1.0 in for i = 0 to 499 do A.set a i (Float.of_int i) done; let rec loop i = if i >= 0 then begin assert (A.get a i = (if i < 500 then Float.of_int i else 1.0)); loop (i - 1); end in loop 999; check_inval (A.get a) (-1); check_inval (A.get a) (1000); check_inval (fun i -> A.set a i 1.0) (-1); check_inval (fun i -> A.set a i 1.0) 1000; check_inval A.create (-1); (* check_inval A.create (Sys.max_floatarray_length + 1); *) check_inval (fun i -> A.make i 1.0) (-1); (* check_inval (fun i -> A.make i 1.0) (Sys.max_floatarray_length + 1); *) (* [length] *) let test_length l = assert (l = (A.length (A.create l))) in test_length 0; test_length 10; test_length 25; test_length 255; test_length 256; test_length 1000; test_length 123456; (* [init] *) let a = A.init 1000 Float.of_int in check_i a; check_inval (fun i -> A.init i Float.of_int) (-1); (* check_inval (fun i -> A.init i Float.of_int) (Sys.max_floatarray_length + 1); *) (* [append] *) let check m n = let a = A.init m Float.of_int in let b = A.init n (fun x -> Float.of_int (x + m)) in let c = A.append a b in assert (A.length c = (m + n)); check_i c; in check 0 0; check 0 100; check 1 100; check 100 0; check 100 1; check 100 100; check 1000 1000; (* check_inval omitted *) (* [concat] *) let check l = let f (len, acc) n = (len + n, A.init n (fun i -> Float.of_int (len + i)) :: acc) in let (total, ll) = List.fold_left f (0, []) l in let b = A.concat (List.rev ll) in assert (A.length b = total); check_i b; in check [0; 0; 0]; check [1; 10; 100]; check [10; 0]; check [0]; check [1000; 1000; 1000]; check []; (* check_inval omitted *) (* [sub] *) let a = A.init 1000 (fun i -> Float.of_int (i - 100)) in let b = A.sub a 100 200 in check_i b; assert (A.length b = 200); let b = A.sub a 1000 0 in check_i (A.sub a 1000 0); assert (A.length b = 0); check_inval (A.sub a (-1)) 0; check_inval (A.sub a 0) (-1); check_inval (A.sub a 0) 1001; check_inval (A.sub a 1000) 1; (* [copy] *) let check len = let a = A.init len Float.of_int in let b = A.copy a in check_i b; assert (A.length b = len); in check 0; check 1; check 128; check 1023; (* [blit] [fill] *) let test_blit_fill data initval ofs len = let a = A.of_list data in let b = A.create (List.length data) in A.blit a 0 b 0 (A.length b); assert (a = b); A.fill b ofs len initval; let rec check i = function | [] -> () | hd :: tl -> assert (A.get b i = (if i >= ofs && i < ofs + len then initval else hd)); check (i + 1) tl; in check 0 data in test_blit_fill [1.0;2.0;5.0;8.123;-100.456;212e19] 3.1415 3 2; let a = A.create 100 in check_inval (A.fill a (-1) 0) 1.0; check_inval (A.fill a 0 (-1)) 1.0; check_inval (A.fill a 0 101) 1.0; check_inval (A.fill a 100 1) 1.0; check_inval (A.fill a 101 0) 1.0; check_inval (A.blit a (-1) a 0) 0; check_inval (A.blit a 0 a 0) (-1); check_inval (A.blit a 0 a 0) 101; check_inval (A.blit a 100 a 0) 1; check_inval (A.blit a 101 a 0) 0; check_inval (A.blit a 0 a (-1)) 0; check_inval (A.blit a 0 a 100) 1; check_inval (A.blit a 0 a 101) 0; (* [to_list] [of_list] *) let a = A.init 1000 Float.of_int in assert (compare a (A.of_list (A.to_list a)) = 0); let a = A.init 0 Float.of_int in assert (compare a (A.of_list (A.to_list a)) = 0); (* check_inval omitted *) (* [iter] *) let a = A.init 300 (Float.of_int) in let r = ref 0.0 in A.iter (fun x -> assert (x = !r); r := x +. 1.0) a; A.iter (fun _ -> assert false) (A.create 0); assert (!r = 300.0); (* [iteri] *) let a = A.init 300 Float.of_int in let r = ref 0 in let f i x = assert (i = !r); assert (x = Float.of_int i); r := i + 1 in A.iteri f a; A.iteri (fun _ _ -> assert false) (A.create 0); assert (!r = 300); (* [map], test result and order of evaluation *) let a = A.init 500 Float.of_int in let r = ref 0.0 in let f x = assert (x = !r); r := !r +. 1.0; x -. 1.0 in let b = A.map f a in check_i (A.sub b 1 499); (* [mapi], test result and order of evaluation *) let a = A.init 500 Float.of_int in let r = ref 0.0 in let f i x = assert (x = Float.of_int i); assert (x = !r); r := !r +. 1.0; x -. 1.0 in let b = A.mapi f a in check_i (A.sub b 1 499); (* [fold_left], test result and order of evaluation *) let a = A.init 500 Float.of_int in let f acc x = assert (acc = x); x +. 1.0 in let acc = A.fold_left f 0.0 a in assert (acc = 500.0); (* [fold_right], test result and order of evaluation *) let a = A.init 500 Float.of_int in let f x acc = assert (x = acc -. 1.0); x in let acc = A.fold_right f a 500.0 in assert (acc = 0.0); (* [iter2], test result and order of evaluation *) let a = A.init 123 Float.of_int in let b = A.init 123 Float.of_int in let r = ref 0.0 in let f x y = assert (x = !r); assert (y = !r); r := !r +. 1.0; in A.iter2 f a b; let c = A.create 456 in check_inval (A.iter2 (fun _ _ -> assert false) a) c; check_inval (A.iter2 (fun _ _ -> assert false) c) a; (* [map2], test result and order of evaluation *) let a = A.init 456 Float.of_int in let b = A.init 456 (fun i -> Float.of_int i /. 2.0) in let r = ref 0.0 in let f x y = assert (x = !r); assert (y = !r /. 2.0); r := !r +. 1.0; 2.0 *. (x -. y) in let c = A.map2 f a b in check_i c; let d = A.create 455 in check_inval (A.map2 (fun _ _ -> assert false) a) d; check_inval (A.map2 (fun _ _ -> assert false) d) a; (* [for_all], test result and order of evaluation *) let a = A.init 777 Float.of_int in let r = ref 0.0 in let f x = assert (x = !r); r := x +. 1.0; true in assert (A.for_all f a); let f x = assert (x = 0.0); false in assert (not (A.for_all f a)); (* [exists], test result and order of evaluation *) let a = A.init 777 Float.of_int in let r = ref 0.0 in let f x = assert (x = !r); r := x +. 1.0; false in assert (not (A.exists f a)); let f x = assert (x = 0.0); true in assert (A.exists f a); (* [mem] *) let a = A.init 7777 Float.of_int in assert (A.mem 0.0 a); assert (A.mem 7776.0 a); assert (not (A.mem (-1.0) a)); assert (not (A.mem 7777.0 a)); let check v = A.set a 1000 v; assert (A.mem v a); in List.iter check [infinity; neg_infinity; neg_zero; nan]; (* [mem_ieee] *) let a = A.init 7777 Float.of_int in assert (A.mem_ieee 0.0 a); assert (A.mem_ieee 7776.0 a); assert (not (A.mem_ieee (-1.0) a)); assert (not (A.mem_ieee 7777.0 a)); let check v = A.set a 1000 v; assert (A.mem_ieee v a); in List.iter check [infinity; neg_infinity; neg_zero]; A.set a 0 nan; assert (not (A.mem_ieee nan a)); (* [sort] [fast_sort] [stable_sort] *) let check_sort sort cmp a = let rec check_sorted a i = if i + 1 < A.length a then begin assert (cmp (A.get a i) (A.get a (i + 1)) <= 0); check_sorted a (i + 1); end in let rec check_permutation a b i = let p = Array.make (A.length a) true in let rec find lo hi x = assert (lo < hi); if hi = lo + 1 then begin assert (cmp (A.get a lo) x = 0); assert (p.(lo)); p.(lo) <- false; end else begin let mid = (lo + hi) / 2 in assert (lo < mid && mid < hi); match cmp (A.get a (mid - 1)) x with | 0 when p.(mid - 1) -> find lo mid x | 0 -> find mid hi x | c when c < 0 -> find mid hi x | c when c > 0 -> find lo mid x | _ -> assert false end in A.iter (find 0 (A.length a)) b in let b = A.copy a in sort cmp a; check_sorted a 0; check_permutation a b 0; in Random.init 123; let rand_float _ = match Random.int 1004 with | 1000 -> nan | 1001 -> infinity | 1002 -> neg_infinity | 1003 -> neg_zero | n when n < 500 -> Random.float 1.0 | _ -> -. Random.float 1.0 in let check s = let a = A.init 5 Float.of_int in check_sort s Stdlib.compare a; (* already sorted *) check_sort s (fun x y -> Stdlib.compare y x) a; (* reverse-sorted *) let a = A.of_list [nan; neg_infinity; neg_zero; 0.; infinity] in check_sort s Stdlib.compare a; (* already sorted *) check_sort s (fun x y -> Stdlib.compare y x) a; (* reverse-sorted *) let a = A.init 50000 rand_float in check_sort s Stdlib.compare a; let a = A.make 1000 1.0 in check_sort s Stdlib.compare a; let a = A.append (A.make 1000 1.0) (A.make 1000 2.0) in check_sort s Stdlib.compare a; in check A.sort; check A.stable_sort; check A.fast_sort; (* [to_seq] *) let check_seq a = let r = ref 0 in let f x = assert (A.get a !r = x); r := !r + 1; in let s = A.to_seq a in Seq.iter f s; in check_seq (A.init 999 Float.of_int); check_seq (A.create 0); (* [to_seqi] *) let check_seqi a = let r = ref 0 in let f (i, x) = assert (i = !r); assert (A.get a !r = x); r := !r + 1; in let s = A.to_seqi a in Seq.iter f s; in check_seqi (A.init 999 Float.of_int); check_seqi (A.create 0); (* [of_seq] *) let r = ref 0 in let rec f () = if !r = 100 then Seq.Nil else begin let res = Seq.Cons (Float.of_int !r, f) in r := !r + 1; res end in let a = A.of_seq f in assert (a = A.init 100 Float.of_int); assert (A.of_seq Seq.empty = A.create 0); (* [map_to_array] *) let r = ref 0 in let f x = assert (x = Float.of_int !r); r := !r + 1; x *. 2.0 in let a = A.init 876 Float.of_int in let ar1 = A.map_to_array f a in let ar2 = Array.init 876 (fun x -> Float.of_int (2 * x)) in assert (ar1 = ar2); let ar = A.map_to_array (fun _ -> assert false) (A.create 0) in assert (ar = [| |]); (* [map_from_array] *) let r = ref 0 in let f x = assert (x = Float.of_int !r); r := !r + 1; x *. 2.0 in let ar = Array.init 876 Float.of_int in let a1 = A.map_from_array f ar in let a2 = A.init 876 (fun x -> Float.of_int (2 * x)) in assert (a1 = a2); let a = A.map_from_array (fun _ -> assert false) [| |] in assert (a = A.create 0); (* comparisons *) let normalize_comparison n = if n = 0 then 0 else if n < 0 then -1 else 1 in let check c l1 l2 = assert (c = (normalize_comparison (compare (A.of_list l1) (A.of_list l2)))) in check 0 [0.0; 0.25; -4.0; 3.141592654; nan] [0.0; 0.25; -4.0; 3.141592654; nan]; check (-1) [0.0; 0.25; nan] [0.0; 0.25; 3.14]; check (-1) [0.0; 0.25; -4.0] [0.0; 0.25; 3.14159]; check 1 [0.0; 2.718; -4.0] [0.0; 0.25; 3.14159]; check 1 [0.0; 2.718; -4.0] [nan; 0.25; 3.14159]; (* [unsafe_get] [unsafe_set] *) let a = A.create 3 in for i = 0 to 2 do A.unsafe_set a i (float i) done; for i = 0 to 2 do assert (A.unsafe_get a i = float i) done; (* I/O *) let test_structured_io value = let (tmp, oc) = Filename.open_temp_file ~mode:[Open_binary] "floatarray" ".data" in Marshal.to_channel oc value []; close_out oc; let ic = open_in_bin tmp in let value' = Marshal.from_channel ic in close_in ic; Sys.remove tmp; assert (compare value value' = 0) in let l = [0.; 0.25; -4.; 3.14159265; nan; infinity; neg_infinity; neg_zero] in (* js_of_ocaml doesn't marshal floats *) if false then test_structured_io (A.of_list l); end (* We run the same tests on [Float.Array] and [Array]. *) module T1 = Test (Stdlib.Float.Array) module T2 = Test (Float_array) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/000077500000000000000000000000001357507750000227755ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/dune000066400000000000000000000017771357507750000236670ustar00rootroot00000000000000(executables (names pr6824 print_if_newline pp_print_custom_break) (libraries) (js_of_ocaml) ) (rule (target pr6824.referencejs) (deps pr6824.bc.js) (action (with-stdout-to %{target} (run node ./pr6824.bc.js)))) (alias (name runtest) (deps pr6824.reference pr6824.referencejs) (action (diff pr6824.reference pr6824.referencejs))) (rule (target print_if_newline.referencejs) (deps print_if_newline.bc.js) (action (with-stdout-to %{target} (run node ./print_if_newline.bc.js)))) (alias (name runtest) (deps print_if_newline.reference print_if_newline.referencejs) (action (diff print_if_newline.reference print_if_newline.referencejs))) (rule (target pp_print_custom_break.referencejs) (deps pp_print_custom_break.bc.js) (action (with-stdout-to %{target} (run node ./pp_print_custom_break.bc.js)))) (alias (name runtest) (deps pp_print_custom_break.reference pp_print_custom_break.referencejs) (action (diff pp_print_custom_break.reference pp_print_custom_break.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/pp_print_custom_break.ml000066400000000000000000000032411357507750000277200ustar00rootroot00000000000000[@@@ocaml.warning "-39"] (* TEST *) (* A test file for Format.pp_print_custom_break. *) let fprintf, printf, list = Format.(fprintf, printf, pp_print_list) let string, custom_break = Format.(pp_print_string, pp_print_custom_break) let () = Format.set_margin 30 let example = [ "Foo"; "Baz"; "Bar"; "Qux"; "Quux"; "Quuz"; "Corge"; "Grault"; "Garply"; ] let boxes = ["v"; "b"; "h"; "hv"; "hov"] let test format data = boxes |> List.iter (fun box -> printf "## The %S box@\n```@\n@[<%s 0>%a@]@\n```@\n@\n" box box (format box) data); module Format_list = struct let pp_sep ppf () = fprintf ppf ";@ " let format box_type ppf items = fprintf ppf "[@;<0 2>@[<%s>%a@]%t]" box_type (list ~pp_sep string) items (custom_break ~fits:("", 0, "") ~breaks:(";", 0, "")) let () = printf "# Printing arrays: last trailing semicolon is optional@\n@\n"; test format example end module Format_statements = struct let pp_sep ppf () = custom_break ppf ~fits:(";", 1, "") ~breaks:("", 0, "") let rec format box_type ppf items = fprintf ppf "{@;<0 2>@[<%s>%a@]@,}" box_type (list ~pp_sep string) items let () = printf "# Printing statements: terminator is optional after newline@\n@\n"; test format example end module Format_function = struct let pp_sep ppf () = fprintf ppf "@ | " let format_case ppf = fprintf ppf "%s -> ()" let rec format box_type ppf items = fprintf ppf "@[<%s>function%t%a@]" box_type (custom_break ~fits:("", 1, "") ~breaks:("", 0, "| ")) (list ~pp_sep format_case) items let () = printf "# Printing function: first pipe character is optional@\n@\n"; test format example end js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/pp_print_custom_break.reference000066400000000000000000000034341357507750000312520ustar00rootroot00000000000000# Printing arrays: last trailing semicolon is optional ## The "v" box ``` [ Foo; Baz; Bar; Qux; Quux; Quuz; Corge; Grault; Garply; ] ``` ## The "b" box ``` [ Foo; Baz; Bar; Qux; Quux; Quuz; Corge; Grault; Garply; ] ``` ## The "h" box ``` [Foo; Baz; Bar; Qux; Quux; Quuz; Corge; Grault; Garply] ``` ## The "hv" box ``` [ Foo; Baz; Bar; Qux; Quux; Quuz; Corge; Grault; Garply; ] ``` ## The "hov" box ``` [ Foo; Baz; Bar; Qux; Quux; Quuz; Corge; Grault; Garply; ] ``` # Printing statements: terminator is optional after newline ## The "v" box ``` { Foo Baz Bar Qux Quux Quuz Corge Grault Garply } ``` ## The "b" box ``` { Foo; Baz; Bar; Qux; Quux Quuz; Corge; Grault; Garply } ``` ## The "h" box ``` {Foo; Baz; Bar; Qux; Quux; Quuz; Corge; Grault; Garply} ``` ## The "hv" box ``` { Foo Baz Bar Qux Quux Quuz Corge Grault Garply } ``` ## The "hov" box ``` { Foo; Baz; Bar; Qux; Quux Quuz; Corge; Grault; Garply } ``` # Printing function: first pipe character is optional ## The "v" box ``` function | Foo -> () | Baz -> () | Bar -> () | Qux -> () | Quux -> () | Quuz -> () | Corge -> () | Grault -> () | Garply -> () ``` ## The "b" box ``` function Foo -> () | Baz -> () | Bar -> () | Qux -> () | Quux -> () | Quuz -> () | Corge -> () | Grault -> () | Garply -> () ``` ## The "h" box ``` function Foo -> () | Baz -> () | Bar -> () | Qux -> () | Quux -> () | Quuz -> () | Corge -> () | Grault -> () | Garply -> () ``` ## The "hv" box ``` function | Foo -> () | Baz -> () | Bar -> () | Qux -> () | Quux -> () | Quuz -> () | Corge -> () | Grault -> () | Garply -> () ``` ## The "hov" box ``` function Foo -> () | Baz -> () | Bar -> () | Qux -> () | Quux -> () | Quuz -> () | Corge -> () | Grault -> () | Garply -> () ``` js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/pr6824.ml000066400000000000000000000003321357507750000242720ustar00rootroot00000000000000(* TEST include testing *) let f = Format.sprintf "[%i]";; print_endline (f 1);; print_endline (f 2);; let f = Format.asprintf "[%i]";; print_endline (f 1);; print_endline (f 2);; include Testing let () = exit 0 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/pr6824.reference000066400000000000000000000000461357507750000256220ustar00rootroot00000000000000[1] [2] [1] [2] All tests succeeded. js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/print_if_newline.ml000066400000000000000000000012151357507750000266610ustar00rootroot00000000000000[@@@ocaml.warning "-39"] (* TEST *) (* A test file for Format.print_if_newline. *) open Format;; printf "\ntest print_if_newline\n%!"; printf " newline here\n%!"; print_if_newline (); printf " this gets printed"; print_if_newline (); printf " this doesn't get printed"; printf "\nprint_if_newline doesn't crash when last statement\n%!"; printf " newline here\n"; (* Important that the following is the last statement in the file. [print_if_newline] sets up the Format module to skip printing the next printing command. However, it should not crash if there is no next printing statement. *) print_if_newline (); ;; let () = exit 0 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/print_if_newline.reference000066400000000000000000000001741357507750000302120ustar00rootroot00000000000000 test print_if_newline newline here this gets printed print_if_newline doesn't crash when last statement newline here js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-format/testing.ml000066400000000000000000000062341357507750000250110ustar00rootroot00000000000000(**************************************************************************) (* *) (* OCaml *) (* *) (* Pierre Weis, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 2006 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (* Testing auxiliaries. *) open Scanf;; let all_tests_ok = ref true;; let finish () = match !all_tests_ok with | true -> print_endline "\nAll tests succeeded." | _ -> print_endline "\n\n********* Test suite failed. ***********\n";; at_exit finish;; let test_num = ref (-1);; let print_test_number () = print_string " "; print_int !test_num; flush stdout;; let next_test () = incr test_num; print_test_number ();; let print_test_fail () = all_tests_ok := false; print_string (Printf.sprintf "\n********* Test number %i failed ***********\n" !test_num);; let print_failure_test_fail () = all_tests_ok := false; print_string (Printf.sprintf "\n********* Failure Test number %i incorrectly failed ***********\n" !test_num);; let print_failure_test_succeed () = all_tests_ok := false; print_string (Printf.sprintf "\n********* Failure Test number %i failed to fail ***********\n" !test_num);; let test b = next_test (); if not b then print_test_fail ();; (* Applies f to x and checks that the evaluation indeed raises an exception that verifies the predicate [pred]. *) let test_raises_exc_p pred f x = next_test (); try ignore (f x); print_failure_test_succeed (); false with | x -> pred x || (print_failure_test_fail (); false);; (* Applies f to x and checks that the evaluation indeed raises some exception. *) let test_raises_some_exc f = test_raises_exc_p (fun _ -> true) f;; let test_raises_this_exc exc = test_raises_exc_p (fun x -> x = exc);; (* Applies f to x and checks that the evaluation indeed raises exception Failure s. *) let test_raises_this_failure s f x = test_raises_exc_p (fun x -> x = Failure s) f x;; (* Applies f to x and checks that the evaluation indeed raises the exception Failure. *) let test_raises_some_failure f x = test_raises_exc_p (function Failure _ -> true | _ -> false) f x;; let failure_test f x s = test_raises_this_failure s f x;; let any_failure_test = test_raises_some_failure;; let scan_failure_test f x = test_raises_exc_p (function Scan_failure _ -> true | _ -> false) f x;; js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-fun/000077500000000000000000000000001357507750000222755ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-fun/dune000066400000000000000000000004471357507750000231600ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-fun/test.ml000066400000000000000000000017231357507750000236110ustar00rootroot00000000000000(* TEST *) let test_id () = assert (Fun.id true = true); assert (Fun.id 1 = 1); assert (not (Fun.id nan = nan)); () let test_const () = assert (Fun.const true false = true); assert (Fun.const 0 false = 0); assert (Fun.const 0 4 = 0); () let test_flip () = assert (Fun.flip ( ^ ) "of order" "out " = "out of order"); assert (Fun.flip List.append [2] [1] = [1;2]); assert (Fun.flip List.cons [2] 1 = [1;2]); () let test_negate () = assert (Fun.negate (Bool.equal true) true = false); assert (Fun.negate (Bool.equal true) false = true); () let test_protect () = let does_raise f x = try f x ; false with _ -> true in let double_raise () = let f () = raise Exit in try Fun.protect ~finally:f f () with | Exit -> () in assert (does_raise double_raise ()) let tests () = test_id (); test_const (); test_flip (); test_negate (); test_protect (); () let () = tests (); print_endline "OK"; () js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-fun/test.reference000066400000000000000000000000031357507750000251250ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-hashtbl/000077500000000000000000000000001357507750000231325ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-hashtbl/dune000066400000000000000000000010711357507750000240070ustar00rootroot00000000000000(executables (names hfun htbl) (libraries) (js_of_ocaml) ) (rule (target hfun.referencejs) (deps hfun.bc.js ../../../LICENSE) (action (with-stdout-to %{target} (run node ./hfun.bc.js)))) (alias (name runtest) (deps hfun.referencejs hfun.reference) (action (diff hfun.referencejs hfun.reference))) (rule (target htbl.referencejs) (deps htbl.bc.js ../../../LICENSE) (action (with-stdout-to %{target} (run node ./htbl.bc.js)))) (alias (name runtest) (deps htbl.reference htbl.referencejs) (action (diff htbl.reference htbl.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-hashtbl/hfun.ml000066400000000000000000000030601357507750000244230ustar00rootroot00000000000000(* TEST *) (* Testing the hash function Hashtbl.hash *) (* What is tested: - reproducibility on various platforms, esp. 32/64 bit issues - equal values hash equally, esp NaNs. *) open Printf let _ = printf "-- Strings:\n"; printf "\"\"\t\t%08x\n" (Hashtbl.hash ""); printf "\"Hello world\"\t%08x\n" (Hashtbl.hash "Hello world"); printf "-- Integers:\n"; printf "0\t\t%08x\n" (Hashtbl.hash 0); printf "-1\t\t%08x\n" (Hashtbl.hash (-1)); printf "42\t\t%08x\n" (Hashtbl.hash 42); printf "2^30-1\t\t%08x\n" (Hashtbl.hash 0x3FFF_FFFF); printf "-2^30\t\t%08x\n" (Hashtbl.hash (-0x4000_0000)); printf "-- Floats:\n"; printf "+0.0\t\t%08x\n" (Hashtbl.hash 0.0); printf "-0.0\t\t%08x\n" (Hashtbl.hash (-. 0.0)); printf "+infty\t\t%08x\n" (Hashtbl.hash infinity); printf "-infty\t\t%08x\n" (Hashtbl.hash neg_infinity); printf "NaN\t\t%08x\n" (Hashtbl.hash nan); printf "NaN#2\t\t%08x\n" (Hashtbl.hash (Int64.float_of_bits 0xFF_F0_00_12_34_56_78_9AL)); printf "NaN#3\t\t%08x\n" (Hashtbl.hash (0.0 /. 0.0)); printf "-- Native integers:\n"; printf "0\t\t%08x\n" (Hashtbl.hash 0n); printf "-1\t\t%08x\n" (Hashtbl.hash (-1n)); printf "42\t\t%08x\n" (Hashtbl.hash 42n); printf "2^30-1\t\t%08x\n" (Hashtbl.hash 0x3FFF_FFFFn); printf "-2^30\t\t%08x\n" (Hashtbl.hash (-0x4000_0000n)); printf "-- Lists:\n"; printf "[0..10]\t\t%08x\n" (Hashtbl.hash [0;1;2;3;4;5;6;7;8;9;10]); printf "[0..12]\t\t%08x\n" (Hashtbl.hash [0;1;2;3;4;5;6;7;8;9;10;11;12]); printf "[10..0]\t\t%08x\n" (Hashtbl.hash [10;9;8;7;6;5;4;3;2;1;0]); () js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-hashtbl/hfun.reference000066400000000000000000000006301357507750000257510ustar00rootroot00000000000000-- Strings: "" 00000000 "Hello world" 364b8272 -- Integers: 0 07be548a -1 3653e015 42 1792870b 2^30-1 23c392d0 -2^30 0c66fde3 -- Floats: +0.0 07be548a -0.0 07be548a +infty 23ea56fb -infty 059f7872 NaN 00000000 NaN#2 00000000 NaN#3 00000000 -- Native integers: 0 07be548a -1 3653e015 42 1792870b 2^30-1 23c392d0 -2^30 0c66fde3 -- Lists: [0..10] 0ade0fc9 [0..12] 0ade0fc9 [10..0] 0cd6259d js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-hashtbl/htbl.ml000066400000000000000000000167271357507750000244320ustar00rootroot00000000000000[@@@ocaml.warning "-27"] (* TEST *) (* Hashtable operations, using maps as a reference *) open Printf module Test(H: Hashtbl.S) (M: Map.S with type key = H.key) = struct let incl_mh m h = try M.iter (fun k d -> let d' = H.find h k in if d <> d' then raise Exit) m; true with Exit | Not_found -> false let domain_hm h m = try H.iter (fun k d -> if not (M.mem k m) then raise Exit) h; true with Exit -> false let incl_hm h m = try H.iter (fun k d -> let d' = M.find k m in if d <> d' then raise Exit) h; true with Exit | Not_found -> false let to_list_ h : _ list = H.fold (fun k v acc -> (k,v) :: acc) h [] |> List.sort Stdlib.compare let check_to_seq h = let l = to_list_ h in let l2 = List.of_seq (H.to_seq h) in assert (l = List.sort Stdlib.compare l2) let check_to_seq_of_seq h = let h' = H.create (H.length h) in H.add_seq h' (H.to_seq h); (*printf "h.len=%d, h'.len=%d\n" (List.length @@ to_list_ h) (List.length @@ to_list_ h');*) assert (to_list_ h = to_list_ h') let test data = let n = Array.length data in let h = H.create 51 and m = ref M.empty in (* Insert all data with H.add *) Array.iter (fun (k, d) -> H.add h k d; m := M.add k d !m) data; printf "Insertion: %s\n" (if incl_mh !m h && domain_hm h !m then "passed" else "FAILED"); check_to_seq_of_seq h; check_to_seq h; (* Insert all data with H.replace *) H.clear h; m := M.empty; Array.iter (fun (k, d) -> H.replace h k d; m := M.add k d !m) data; printf "Insertion: %s\n" (if incl_mh !m h && incl_hm h !m then "passed" else "FAILED"); check_to_seq_of_seq h; check_to_seq h; (* Remove some of the data *) for i = 0 to n/3 - 1 do let (k, _) = data.(i) in H.remove h k; m := M.remove k !m done; printf "Removal: %s\n" (if incl_mh !m h && incl_hm h !m then "passed" else "FAILED"); check_to_seq_of_seq h; check_to_seq h; () end module SS = struct type t = string let compare (x:t) (y:t) = Stdlib.compare x y let equal (x:t) (y:t) = x=y let hash = Hashtbl.hash end module SI = struct type t = int let compare (x:t) (y:t) = Stdlib.compare x y let equal (x:t) (y:t) = x=y let hash = Hashtbl.hash end module SSP = struct type t = string*string let compare (x:t) (y:t) = Stdlib.compare x y let equal (x:t) (y:t) = x=y let hash = Hashtbl.hash end module SSL = struct type t = string list let compare (x:t) (y:t) = Stdlib.compare x y let equal (x:t) (y:t) = x=y let hash = Hashtbl.hash end module SSA = struct type t = string array let compare (x:t) (y:t) = Stdlib.compare x y let equal (x:t) (y:t) = x=y let hash = Hashtbl.hash end module MS = Map.Make(SS) module MI = Map.Make(SI) module MSP = Map.Make(SSP) module MSL = Map.Make(SSL) module MSA = Map.Make(SSA) (* Generic hash wrapped as a functorial hash *) module HofM (M: Map.S) : Hashtbl.S with type key = M.key = struct type key = M.key type 'a t = (key, 'a) Hashtbl.t let create s = Hashtbl.create s let clear = Hashtbl.clear let reset = Hashtbl.reset let copy = Hashtbl.copy let add = Hashtbl.add let remove = Hashtbl.remove let find = Hashtbl.find let find_opt = Hashtbl.find_opt let find_all = Hashtbl.find_all let replace = Hashtbl.replace let mem = Hashtbl.mem let iter = Hashtbl.iter let fold = Hashtbl.fold let length = Hashtbl.length let stats = Hashtbl.stats let filter_map_inplace = Hashtbl.filter_map_inplace let to_seq = Hashtbl.to_seq let to_seq_keys = Hashtbl.to_seq_keys let to_seq_values = Hashtbl.to_seq_values let of_seq = Hashtbl.of_seq let add_seq = Hashtbl.add_seq let replace_seq = Hashtbl.replace_seq end module HS1 = HofM(MS) module HI1 = HofM(MI) module HSP = HofM(MSP) module HSL = HofM(MSL) (* Specific functorial hashes *) module HS2 = Hashtbl.Make(SS) module HI2 = Hashtbl.Make(SI) (* Specific weak functorial hashes *) module WS = Ephemeron.K1.Make(SS) module WSP1 = Ephemeron.K1.Make(SSP) module WSP2 = Ephemeron.K2.Make(SS)(SS) module WSL = Ephemeron.K1.Make(SSL) module WSA = Ephemeron.Kn.Make(SS) (* Instantiating the test *) module TS1 = Test(HS1)(MS) module TS2 = Test(HS2)(MS) module TI1 = Test(HI1)(MI) module TI2 = Test(HI2)(MI) module TSP = Test(HSP)(MSP) module TSL = Test(HSL)(MSL) module TWS = Test(WS)(MS) module TWSP1 = Test(WSP1)(MSP) module TWSP2 = Test(WSP2)(MSP) module TWSL = Test(WSL)(MSL) module TWSA = Test(WSA)(MSA) (* Data set: strings from a file, associated with their line number *) let file_data filename = let ic = open_in filename in let lineno = ref 0 in let data = ref [] in begin try while true do let l = input_line ic in incr lineno; data := (l, !lineno) :: !data done with End_of_file -> () end; close_in ic; Array.of_list !data (* Data set: fixed strings *) let string_data = [| "Si", 0; "non", 1; "e", 2; "vero", 3; "e", 4; "ben", 5; "trovato", 6; "An", 10; "apple", 11; "a", 12; "day", 13; "keeps", 14; "the", 15; "doctor", 16; "away", 17; "Pierre", 20; "qui", 21; "roule", 22; "n'amasse", 23; "pas", 24; "mousse", 25; "Asinus", 30; "asinum", 31; "fricat", 32 |] (* Data set: random integers *) let random_integers num range = let data = Array.make num (0,0) in for i = 0 to num - 1 do data.(i) <- (Random.int range, i) done; data (* Data set: pairs *) let pair_data data = Array.map (fun (k, d) -> ((k, k), d)) data (* Data set: lists *) let list_data data = let d = Array.make (Array.length data / 10) ([], "0") in let j = ref 0 in let rec mklist n = if n <= 0 || !j >= Array.length data then [] else begin let hd = fst data.(!j) in incr j; let tl = mklist (n-1) in hd :: tl end in for i = 0 to Array.length d - 1 do d.(i) <- (mklist (Random.int 16), Int.to_string i) done; d (* The test *) let _ = printf "-- Random integers, large range\n%!"; TI1.test (random_integers 20_000 1_000_000); printf "-- Random integers, narrow range\n%!"; TI2.test (random_integers 20_000 1_000); let d = try file_data "../../../LICENSE" with Sys_error _ -> string_data in printf "-- Strings, generic interface\n%!"; TS1.test d; printf "-- Strings, functorial interface\n%!"; TS2.test d; printf "-- Pairs of strings\n%!"; TSP.test (pair_data d); printf "-- Lists of strings\n%!"; TSL.test (list_data d); (* weak *) let d = try file_data "../../../LICENSE" with Sys_error _ -> string_data in printf "-- Weak K1 -- Strings, functorial interface\n%!"; TWS.test d; printf "-- Weak K1 -- Pairs of strings\n%!"; TWSP1.test (pair_data d); printf "-- Weak K2 -- Pairs of strings\n%!"; TWSP2.test (pair_data d); printf "-- Weak K1 -- Lists of strings\n%!"; TWSL.test (list_data d); printf "-- Weak Kn -- Arrays of strings\n%!"; TWSA.test (Array.map (fun (l,i) -> (Array.of_list l,i)) (list_data d)) let () = let h = Hashtbl.create 16 in for i = 1 to 1000 do Hashtbl.add h i (i * 2) done; Printf.printf "%i elements\n" (Hashtbl.length h); Hashtbl.filter_map_inplace (fun k v -> if k mod 100 = 0 then ((*Hashtbl.add h v v;*) Some (v / 100)) else None) h; let l = Hashtbl.fold (fun k v acc -> (k, v) :: acc) h [] in let l = List.sort compare l in List.iter (fun (k, v) -> Printf.printf "%i,%i\n" k v) l; Printf.printf "%i elements\n" (Hashtbl.length h) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-hashtbl/htbl.reference000066400000000000000000000017521357507750000257500ustar00rootroot00000000000000-- Random integers, large range Insertion: passed Insertion: passed Removal: passed -- Random integers, narrow range Insertion: passed Insertion: passed Removal: passed -- Strings, generic interface Insertion: passed Insertion: passed Removal: passed -- Strings, functorial interface Insertion: passed Insertion: passed Removal: passed -- Pairs of strings Insertion: passed Insertion: passed Removal: passed -- Lists of strings Insertion: passed Insertion: passed Removal: passed -- Weak K1 -- Strings, functorial interface Insertion: passed Insertion: passed Removal: passed -- Weak K1 -- Pairs of strings Insertion: passed Insertion: passed Removal: passed -- Weak K2 -- Pairs of strings Insertion: passed Insertion: passed Removal: passed -- Weak K1 -- Lists of strings Insertion: passed Insertion: passed Removal: passed -- Weak Kn -- Arrays of strings Insertion: passed Insertion: passed Removal: passed 1000 elements 100,2 200,4 300,6 400,8 500,10 600,12 700,14 800,16 900,18 1000,20 10 elements js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-int/000077500000000000000000000000001357507750000222775ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-int/dune000066400000000000000000000004471357507750000231620ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-int/test.ml000066400000000000000000000032141357507750000236100ustar00rootroot00000000000000(* TEST *) let test_consts () = assert (Int.zero = 0); assert (Int.one = 1); assert (Int.minus_one = -1); () let test_arith () = assert (Int.add 2 4 = 6); assert (Int.sub 6 2 = 4); assert (Int.mul 6 2 = 12); assert (Int.div 12 2 = 6); assert (Int.rem 5 2 = 1); assert (Int.succ 5 = 6); assert (Int.pred 5 = 4); assert (Int.abs (-5) = 5); assert (Int.abs 5 = 5); () let test_logops () = assert (Int.logand 0xF0F0 0xFFFF = 0xF0F0); assert (Int.logor 0xF0FF 0x0F0F = 0xFFFF); assert (Int.logxor 0xF0FF 0x0F0F = 0xFFF0); assert (Int.lognot Int.max_int = Int.min_int); assert (Int.shift_left 1 4 = 16); assert (Int.shift_left (Int.compare 0 0) 63 = 0); (* Issue #8864 *) assert (Int.shift_right 16 4 = 1); assert (Int.shift_right (-16) 4 = (-1)); assert (Int.shift_right (-16) 4 = (-1)); assert (Int.shift_right_logical Int.min_int (Sys.int_size - 1) = 1); () let test_equal () = assert (Int.equal 1 1 = true); assert (Int.equal 1 0 = false); () let test_compare () = assert (Int.compare 3 3 = 0); assert (Int.compare 3 4 = (-1)); assert (Int.compare 4 3 = 1); assert (Int.compare (-4) 3 = -1); assert (Int.compare 3 (-4) = 1); () let test_float_conv () = assert (Int.to_float 5 = 5.0); assert (Int.of_float 5. = 5); assert (Int.of_float 5.9 = 5); () let test_string_conv () = assert (Int.to_string 50 = "50"); (* assert (Int.of_string "50" = Some 50); assert (Int.of_string "" = None); *) () let tests () = test_consts (); test_arith (); test_logops (); test_equal (); test_compare (); test_float_conv (); test_string_conv (); () let () = tests (); print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-int/test.reference000066400000000000000000000000031357507750000251270ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-int64/000077500000000000000000000000001357507750000224515ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-int64/dune000066400000000000000000000004471357507750000233340ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-int64/test.ml000066400000000000000000000032761357507750000237720ustar00rootroot00000000000000(* TEST *) let test_consts () = assert (Int64.zero = 0L); assert (Int64.one = 1L); assert (Int64.minus_one = -1L); () let test_arith () = assert (Int64.add 2L 4L = 6L); assert (Int64.sub 6L 2L = 4L); assert (Int64.mul 6L 2L = 12L); assert (Int64.div 12L 2L = 6L); assert (Int64.rem 5L 2L = 1L); assert (Int64.succ 5L = 6L); assert (Int64.pred 5L = 4L); assert (Int64.abs (-5L) = 5L); assert (Int64.abs 5L = 5L); () let test_logops () = assert (Int64.logand 0xF0F0L 0xFFFFL = 0xF0F0L); assert (Int64.logor 0xF0FFL 0x0F0FL = 0xFFFFL); assert (Int64.logxor 0xF0FFL 0x0F0FL = 0xFFF0L); assert (Int64.lognot Int64.max_int = Int64.min_int); assert (Int64.shift_left 1L 4 = 16L); assert (Int64.shift_right 16L 4 = 1L); assert (Int64.shift_right (-16L) 4 = (-1L)); assert (Int64.shift_right (-16L) 4 = (-1L)); assert (Int64.shift_right_logical Int64.min_int 63 = 1L); () let test_equal () = assert (Int64.equal 1L 1L = true); assert (Int64.equal 1L 0L = false); () let test_compare () = assert (Int64.compare 3L 3L = 0); assert (Int64.compare 3L 4L = (-1)); assert (Int64.compare 4L 3L = 1); assert (Int64.compare (-4L) 3L = -1); assert (Int64.compare 3L (-4L) = 1); () let test_float_conv () = assert (Int64.to_float 5L = 5.0); assert (Int64.of_float 5. = 5L); assert (Int64.of_float 5.9 = 5L); () let test_string_conv () = assert (Int64.to_string 50L = "50"); (* assert (Int64.of_string "50" = Some 50); assert (Int64.of_string "" = None); *) () let tests () = test_consts (); test_arith (); test_logops (); test_equal (); test_compare (); test_float_conv (); test_string_conv (); () let () = tests (); print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-int64/test.reference000066400000000000000000000000031357507750000253010ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-list/000077500000000000000000000000001357507750000224605ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-list/dune000066400000000000000000000004471357507750000233430ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-list/test.ml000066400000000000000000000043271357507750000237770ustar00rootroot00000000000000[@@@ocaml.warning "-27"] (* TEST *) let string_of_even_opt x = if x mod 2 = 0 then Some (string_of_int x) else None (* Standard test case *) let () = let l = List.init 10 (fun x -> x) in assert (List.exists (fun a -> a < 10) l); assert (List.exists (fun a -> a > 0) l); assert (List.exists (fun a -> a = 0) l); assert (List.exists (fun a -> a = 1) l); assert (List.exists (fun a -> a = 2) l); assert (List.exists (fun a -> a = 3) l); assert (List.exists (fun a -> a = 4) l); assert (List.exists (fun a -> a = 5) l); assert (List.exists (fun a -> a = 6) l); assert (List.exists (fun a -> a = 7) l); assert (List.exists (fun a -> a = 8) l); assert (List.exists (fun a -> a = 9) l); assert (not (List.exists (fun a -> a < 0) l)); assert (not (List.exists (fun a -> a > 9) l)); assert (List.exists (fun _ -> true) l); assert (List.compare_lengths [] [] = 0); assert (List.compare_lengths [1;2] ['a';'b'] = 0); assert (List.compare_lengths [] [1;2] < 0); assert (List.compare_lengths ['a'] [1;2] < 0); assert (List.compare_lengths [1;2] [] > 0); assert (List.compare_lengths [1;2] ['a'] > 0); assert (List.compare_length_with [] 0 = 0); assert (List.compare_length_with [] 1 < 0); assert (List.compare_length_with [] (-1) > 0); assert (List.compare_length_with [] max_int < 0); assert (List.compare_length_with [] min_int > 0); assert (List.compare_length_with [1] 0 > 0); assert (List.compare_length_with ['1'] 1 = 0); assert (List.compare_length_with ['1'] 2 < 0); assert (List.filter_map string_of_even_opt l = ["0";"2";"4";"6";"8"]); () ;; (* Empty test case *) let () = assert ((List.init 0 (fun x -> x)) = []); ;; (* Erroneous test case *) let () = let result = try let _ = List.init (-1) (fun x -> x) in false with Invalid_argument e -> true (* Exception caught *) in assert result; ;; (* Evaluation order *) let () = let test n = let result = ref false in let _ = List.init n (fun x -> result := (x = n - 1)) in assert !result in (* Threshold must equal the value in stdlib/list.ml *) let threshold = 10_000 in test threshold; (* Non tail-recursive case *) test (threshold + 1) (* Tail-recursive case *) ;; let () = print_endline "OK";; js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-list/test.reference000066400000000000000000000000031357507750000253100ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-option/000077500000000000000000000000001357507750000230155ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-option/dune000066400000000000000000000004471357507750000237000ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-option/test.ml000066400000000000000000000060331357507750000243300ustar00rootroot00000000000000(* TEST *) let strf = Printf.sprintf let assert_raise_invalid_argument f v = assert (try ignore (f v); false with Invalid_argument _ -> true); () let test_none_some () = assert (Option.none = None); assert (Option.some 2 = Some 2); () let test_value () = assert (Option.value None ~default:5 = 5); assert (Option.value (Some 3) ~default:5 = 3); () let test_get () = assert_raise_invalid_argument Option.get None; assert (Option.get (Some 2) = 2); () let test_bind () = assert (Option.bind (Some 3) (fun x -> Some (succ x)) = Some 4); assert (Option.bind (Some 3) (fun _ -> None) = None); assert (Option.bind None (fun x -> Some (succ x)) = None); assert (Option.bind None (fun _ -> None) = None); () let test_join () = assert (Option.join (Some (Some 3)) = Some 3); assert (Option.join (Some None) = None); assert (Option.join None = None); () let test_map () = assert (Option.map succ (Some 3) = Some 4); assert (Option.map succ None = None); () let test_fold () = assert (Option.fold ~none:3 ~some:succ (Some 1) = 2); assert (Option.fold ~none:3 ~some:succ None = 3); assert (Option.(fold ~none ~some) (Some 1) = (Some 1)); assert (Option.(fold ~none ~some) None = None); () let test_iter () = let count = ref 0 in let set_count x = count := x in assert (!count = 0); Option.iter set_count (Some 2); assert (!count = 2); Option.iter set_count None; assert (!count = 2); () let test_is_none_some () = assert (Option.is_none None = true); assert (Option.is_some None = false); assert (Option.is_none (Some 2) = false); assert (Option.is_some (Some 2) = true); () let test_equal () = let eq v0 v1 = (v0 mod 2) = (v1 mod 2) in let equal = Option.equal eq in assert (not @@ equal (Some 2) (Some 3)); assert ( equal (Some 2) (Some 4)); assert (not @@ equal (Some 2) None); assert (not @@ equal None (Some 3)); assert (not @@ equal None (Some 4)); assert ( equal None None); () let test_compare () = let compare v0 v1 = - (compare v0 v1) in let compare = Option.compare compare in assert (compare (Some 2) (Some 1) = -1); assert (compare (Some 2) (Some 2) = 0); assert (compare (Some 2) (Some 3) = 1); assert (compare (Some 2) None = 1); assert (compare None (Some 1) = -1); assert (compare None (Some 2) = -1); assert (compare None (Some 3) = -1); assert (compare None None = 0); () let test_to_option_list_seq () = assert (Option.to_result ~none:6 (Some 3) = Ok 3); assert (Option.to_result ~none:6 None = Error 6); assert (Option.to_list (Some 3) = [3]); assert (Option.to_list None = []); begin match (Option.to_seq (Some 3)) () with | Seq.Cons (3, f) -> assert (f () = Seq.Nil) | _ -> assert false end; assert ((Option.to_seq None) () = Seq.Nil); () let tests () = test_none_some (); test_value (); test_get (); test_bind (); test_join (); test_map (); test_fold (); test_iter (); test_is_none_some (); test_equal (); test_compare (); test_to_option_list_seq (); () let () = tests (); print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-option/test.reference000066400000000000000000000000031357507750000256450ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-queue/000077500000000000000000000000001357507750000226315ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-queue/dune000066400000000000000000000004471357507750000235140ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-queue/test.ml000066400000000000000000000101121357507750000241350ustar00rootroot00000000000000(* TEST *) module Q = struct include Queue let to_list q = fold (fun l x -> x :: l) [] q |> List.rev end let does_raise f q = try ignore (f q : int); false with Q.Empty -> true let () = let q = Q.create () in (); assert (Q.to_list q = [ ] && Q.length q = 0); Q.add 1 q; assert (Q.to_list q = [1 ] && Q.length q = 1); Q.add 2 q; assert (Q.to_list q = [1; 2 ] && Q.length q = 2); Q.add 3 q; assert (Q.to_list q = [1; 2; 3 ] && Q.length q = 3); Q.add 4 q; assert (Q.to_list q = [1; 2; 3; 4] && Q.length q = 4); assert (Q.take q = 1); assert (Q.to_list q = [ 2; 3; 4] && Q.length q = 3); assert (Q.take q = 2); assert (Q.to_list q = [ 3; 4] && Q.length q = 2); assert (Q.take q = 3); assert (Q.to_list q = [ 4] && Q.length q = 1); assert (Q.take q = 4); assert (Q.to_list q = [ ] && Q.length q = 0); assert (does_raise Q.take q); ;; let () = let q = Q.create () in Q.add 1 q; assert (Q.take q = 1); assert (does_raise Q.take q); Q.add 2 q; assert (Q.take q = 2); assert (does_raise Q.take q); assert (Q.length q = 0); ;; let () = let q = Q.create () in Q.add 1 q; assert (Q.peek q = 1); Q.add 2 q; assert (Q.peek q = 1); Q.add 3 q; assert (Q.peek q = 1); assert (Q.peek q = 1); assert (Q.take q = 1); assert (Q.peek q = 2); assert (Q.take q = 2); assert (Q.peek q = 3); assert (Q.take q = 3); assert (does_raise Q.peek q); assert (does_raise Q.peek q); ;; let () = let q = Q.create () in for i = 1 to 10 do Q.add i q done; Q.clear q; assert (Q.length q = 0); assert (does_raise Q.take q); assert (q = Q.create ()); Q.add 42 q; assert (Q.take q = 42); ;; let () = let q1 = Q.create () in for i = 1 to 10 do Q.add i q1 done; let q2 = Q.copy q1 in assert (Q.to_list q1 = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]); assert (Q.to_list q2 = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]); assert (Q.length q1 = 10); assert (Q.length q2 = 10); for i = 1 to 10 do assert (Q.take q1 = i); done; for i = 1 to 10 do assert (Q.take q2 = i); done; ;; let () = let q = Q.create () in assert (Q.is_empty q); for i = 1 to 10 do Q.add i q; assert (Q.length q = i); assert (not (Q.is_empty q)); done; for i = 10 downto 1 do assert (Q.length q = i); assert (not (Q.is_empty q)); ignore (Q.take q : int); done; assert (Q.length q = 0); assert (Q.is_empty q); ;; let () = let q = Q.create () in for i = 1 to 10 do Q.add i q done; let i = ref 1 in Q.iter (fun j -> assert (!i = j); incr i) q; ;; let () = let q1 = Q.create () and q2 = Q.create () in assert (Q.length q1 = 0); assert (Q.to_list q1 = []); assert (Q.length q2 = 0); assert (Q.to_list q2 = []); Q.transfer q1 q2; assert (Q.length q1 = 0); assert (Q.to_list q1 = []); assert (Q.length q2 = 0); assert (Q.to_list q2 = []); ;; let () = let q1 = Q.create () and q2 = Q.create () in for i = 1 to 4 do Q.add i q1 done; assert (Q.length q1 = 4); assert (Q.to_list q1 = [1; 2; 3; 4]); assert (Q.length q2 = 0); assert (Q.to_list q2 = [ ]); Q.transfer q1 q2; assert (Q.length q1 = 0); assert (Q.to_list q1 = [ ]); assert (Q.length q2 = 4); assert (Q.to_list q2 = [1; 2; 3; 4]); ;; let () = let q1 = Q.create () and q2 = Q.create () in for i = 5 to 8 do Q.add i q2 done; assert (Q.length q1 = 0); assert (Q.to_list q1 = [ ]); assert (Q.length q2 = 4); assert (Q.to_list q2 = [5; 6; 7; 8]); Q.transfer q1 q2; assert (Q.length q1 = 0); assert (Q.to_list q1 = [ ]); assert (Q.length q2 = 4); assert (Q.to_list q2 = [5; 6; 7; 8]); ;; let () = let q1 = Q.create () and q2 = Q.create () in for i = 1 to 4 do Q.add i q1 done; for i = 5 to 8 do Q.add i q2 done; assert (Q.length q1 = 4); assert (Q.to_list q1 = [1; 2; 3; 4]); assert (Q.length q2 = 4); assert (Q.to_list q2 = [5; 6; 7; 8]); Q.transfer q1 q2; assert (Q.length q1 = 0); assert (Q.to_list q1 = [ ]); assert (Q.length q2 = 8); assert (Q.to_list q2 = [5; 6; 7; 8; 1; 2; 3; 4]); ;; let () = print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-queue/test.reference000066400000000000000000000000031357507750000254610ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-random/000077500000000000000000000000001357507750000227655ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-random/dune000066400000000000000000000004471357507750000236500ustar00rootroot00000000000000(executables (names rand) (libraries) (js_of_ocaml) ) (rule (target rand.referencejs) (deps rand.bc.js) (action (with-stdout-to %{target} (run node ./rand.bc.js)))) (alias (name runtest) (deps rand.reference rand.referencejs) (action (diff rand.reference rand.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-random/rand.ml000066400000000000000000000006111357507750000242410ustar00rootroot00000000000000(* TEST *) (* Test that two Random.self_init() in close succession will not result in the same PRNG state. Note that even when the code is correct this test is expected to fail once in 10000 runs. *) let () = Random.self_init (); let x = Random.int 10000 in Random.self_init (); let y = Random.int 10000 in if x = y then print_endline "FAILED" else print_endline "PASSED" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-random/rand.reference000066400000000000000000000000071357507750000255660ustar00rootroot00000000000000PASSED js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-result/000077500000000000000000000000001357507750000230235ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-result/dune000066400000000000000000000004471357507750000237060ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-result/test.ml000066400000000000000000000075441357507750000243460ustar00rootroot00000000000000(* TEST *) let strf = Printf.sprintf let assert_raise_invalid_argument f v = assert (try ignore (f v); false with Invalid_argument _ -> true); () let test_ok_error () = assert (Result.ok 3 = Ok 3); assert (Result.error "ha!" = Error "ha!"); () let test_value () = assert (Result.value (Ok 3) ~default:5 = 3); assert (Result.value (Error "ha!") ~default:5 = 5); () let test_get_ok_error () = assert (Result.get_ok (Ok 3) = 3); assert_raise_invalid_argument Result.get_ok (Error "ha!"); assert (Result.get_error (Error "ha!") = "ha!"); assert_raise_invalid_argument Result.get_error (Ok 2); () let test_bind () = assert (Result.bind (Ok 3) (fun x -> Ok (succ x)) = Ok 4); assert (Result.bind (Ok 3) (fun x -> Error (strf "hu%d!" x)) = Error "hu3!"); assert (Result.bind (Error "ha!") (fun x -> Ok (succ x)) = Error "ha!"); assert (Result.bind (Error "ha!") (fun _ -> Error "hu!") = Error "ha!"); () let test_join () = assert (Result.join (Ok (Ok 3)) = Ok 3); assert (Result.join (Ok (Error "ha!")) = Error "ha!"); assert (Result.join (Error "ha!") = Error "ha!"); () let test_maps () = assert (Result.map succ (Ok 3) = Ok 4); assert (Result.map succ (Error "ha!") = Error "ha!"); assert (Result.map_error succ (Error 3) = Error 4); assert (Result.map_error succ (Ok 2) = Ok 2); () let test_fold () = assert (Result.fold ~ok:succ ~error:succ (Ok 1) = 2); assert (Result.fold ~ok:succ ~error:succ (Error 1) = 2); assert (Result.(fold ~ok ~error) (Ok 1) = (Ok 1)); assert (Result.(fold ~ok ~error) (Error "ha!") = (Error "ha!")); () let test_iters () = let count = ref 0 in let set_count x = count := x in assert (!count = 0); Result.iter set_count (Ok 2); assert (!count = 2); Result.iter set_count (Error "ha!"); assert (!count = 2); Result.iter_error set_count (Error 3); assert (!count = 3); Result.iter_error set_count (Ok "ha!"); assert (!count = 3); () let test_is_ok_error () = assert (Result.is_ok (Ok 2) = true); assert (Result.is_error (Ok 2) = false); assert (Result.is_ok (Error "ha!") = false); assert (Result.is_error (Error "ha!") = true); () let test_equal () = let ok v0 v1 = (v0 mod 2) = (v1 mod 2) in let error = ok in let equal = Result.equal ~ok ~error in assert (not @@ equal (Ok 2) (Ok 3)); assert ( equal (Ok 2) (Ok 4)); assert (not @@ equal (Ok 2) (Error 3)); assert (not @@ equal (Ok 2) (Error 4)); assert (not @@ equal (Error 2) (Ok 3)); assert (not @@ equal (Error 2) (Ok 4)); assert (not @@ equal (Error 2) (Error 3)); assert ( equal (Error 2) (Error 4)); () let test_compare () = let ok v0 v1 = - (compare v0 v1) in let error = ok in let compare = Result.compare ~ok ~error in assert (compare (Ok 2) (Ok 1) = -1); assert (compare (Ok 2) (Ok 2) = 0); assert (compare (Ok 2) (Ok 3) = 1); assert (compare (Ok 2) (Error 1) = -1); assert (compare (Ok 2) (Error 2) = -1); assert (compare (Ok 2) (Error 3) = -1); assert (compare (Error 2) (Ok 1) = 1); assert (compare (Error 2) (Ok 2) = 1); assert (compare (Error 2) (Ok 3) = 1); assert (compare (Error 2) (Error 1) = -1); assert (compare (Error 2) (Error 2) = 0); assert (compare (Error 2) (Error 3) = 1); () let test_to_option_list_seq () = assert (Result.to_option (Ok 3) = Some 3); assert (Result.to_option (Error "ha!") = None); assert (Result.to_list (Ok 3) = [3]); assert (Result.to_list (Error "ha!") = []); begin match (Result.to_seq (Ok 3)) () with | Seq.Cons (3, f) -> assert (f () = Seq.Nil) | _ -> assert false end; assert ((Result.to_seq (Error "ha!")) () = Seq.Nil); () let tests () = test_ok_error (); test_value (); test_get_ok_error (); test_bind (); test_join (); test_maps (); test_fold (); test_iters (); test_is_ok_error (); test_equal (); test_compare (); test_to_option_list_seq (); () let () = tests (); print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-result/test.reference000066400000000000000000000000031357507750000256530ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-seq/000077500000000000000000000000001357507750000222755ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-seq/dune000066400000000000000000000004471357507750000231600ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-seq/test.ml000066400000000000000000000005421357507750000236070ustar00rootroot00000000000000(* TEST *) let filter1 x = x mod 2 = 0 ;; (* Standard test case *) let () = assert ([2;4] = (List.to_seq [1;2;3;4;5] |> Seq.filter (fun x -> x mod 2 = 0) |> List.of_seq)); () ;; (* MPR 7820 *) let () = assert ([| 1;2;3 |] = (Array.to_seq [| 1;2;3 |] |> Array.of_seq)); () ;; let () = print_endline "OK";; js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-seq/test.reference000066400000000000000000000000031357507750000251250ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-set/000077500000000000000000000000001357507750000223005ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-set/dune000066400000000000000000000011071357507750000231550ustar00rootroot00000000000000(executables (names testmap testset) (libraries) (js_of_ocaml) ) (rule (target testmap.referencejs) (deps testmap.bc.js) (action (with-stdout-to %{target} (run node ./testmap.bc.js)))) (alias (name runtest) (deps testmap.reference testmap.referencejs) (action (diff testmap.reference testmap.referencejs))) (rule (target testset.referencejs) (deps testset.bc.js) (action (with-stdout-to %{target} (run node ./testset.bc.js)))) (alias (name runtest) (deps testset.reference testset.referencejs) (action (diff testset.reference testset.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-set/testmap.ml000066400000000000000000000150761357507750000243200ustar00rootroot00000000000000[@@@ocaml.warning "-27-35"] (* TEST *) module M = Map.Make(struct type t = int let compare (x:t) y = compare x y end) let img x m = try Some(M.find x m) with Not_found -> None let testvals = [0;1;2;3;4;5;6;7;8;9] let check msg cond = if not (List.for_all cond testvals) then Printf.printf "Test %s FAILED\n%!" msg let checkbool msg b = if not b then Printf.printf "Test %s FAILED\n%!" msg let uncurry (f: 'a -> 'b -> 'c) (x, y: 'a * 'b) : 'c = f x y let test x v s1 s2 = checkbool "is_empty" (M.is_empty s1 = List.for_all (fun i -> img i s1 = None) testvals); check "mem" (fun i -> M.mem i s1 = (img i s1 <> None)); check "add" (let s = M.add x v s1 in fun i -> img i s = (if i = x then Some v else img i s1)); check "singleton" (let s = M.singleton x v in fun i -> img i s = (if i = x then Some v else None)); check "remove" (let s = M.remove x s1 in fun i -> img i s = (if i = x then None else img i s1)); check "merge-union" (let f _ o1 o2 = match o1, o2 with | Some v1, Some v2 -> Some (v1 +. v2) | None, _ -> o2 | _, None -> o1 in let s = M.merge f s1 s2 in fun i -> img i s = f i (img i s1) (img i s2)); check "merge-inter" (let f _ o1 o2 = match o1, o2 with | Some v1, Some v2 -> Some (v1 -. v2) | _, _ -> None in let s = M.merge f s1 s2 in fun i -> img i s = f i (img i s1) (img i s2)); checkbool "bindings" (let rec extract = function | [] -> [] | hd :: tl -> match img hd s1 with | None -> extract tl | Some v ->(hd, v) :: extract tl in M.bindings s1 = extract testvals); checkbool "for_all" (let p x y = x mod 2 = 0 in M.for_all p s1 = List.for_all (uncurry p) (M.bindings s1)); checkbool "exists" (let p x y = x mod 3 = 0 in M.exists p s1 = List.exists (uncurry p) (M.bindings s1)); checkbool "filter" (let p x y = x >= 3 && x <= 6 in M.bindings(M.filter p s1) = List.filter (uncurry p) (M.bindings s1)); checkbool "partition" (let p x y = x >= 3 && x <= 6 in let (st,sf) = M.partition p s1 and (lt,lf) = List.partition (uncurry p) (M.bindings s1) in M.bindings st = lt && M.bindings sf = lf); checkbool "cardinal" (M.cardinal s1 = List.length (M.bindings s1)); checkbool "min_binding" (try let (k,v) = M.min_binding s1 in img k s1 = Some v && M.for_all (fun i _ -> k <= i) s1 with Not_found -> M.is_empty s1); checkbool "max_binding" (try let (k,v) = M.max_binding s1 in img k s1 = Some v && M.for_all (fun i _ -> k >= i) s1 with Not_found -> M.is_empty s1); checkbool "choose" (try let (x,v) = M.choose s1 in img x s1 = Some v with Not_found -> M.is_empty s1); checkbool "find_first" (let (l, p, r) = M.split x s1 in if p = None && M.is_empty r then try let _ = M.find_first (fun k -> k >= x) s1 in false with Not_found -> true else let (k, v) = M.find_first (fun k -> k >= x) s1 in match p with None -> (k, v) = M.min_binding r | Some v1 -> (k, v) = (x, v1)); checkbool "find_first_opt" (let (l, p, r) = M.split x s1 in let find_first_opt_result = M.find_first_opt (fun k -> k >= x) s1 in if p = None && M.is_empty r then match find_first_opt_result with None -> true | _ -> false else match find_first_opt_result with | None -> false | Some (k, v) -> (match p with | None -> (k, v) = M.min_binding r | Some v1 -> (k, v) = (x, v1))); checkbool "find_last" (let (l, p, r) = M.split x s1 in if p = None && M.is_empty l then try let _ = M.find_last (fun k -> k <= x) s1 in false with Not_found -> true else let (k, v) = M.find_last (fun k -> k <= x) s1 in match p with None -> (k, v) = M.max_binding l | Some v1 -> (k, v) = (x, v1)); checkbool "find_last_opt" (let (l, p, r) = M.split x s1 in let find_last_opt_result = M.find_last_opt (fun k -> k <= x) s1 in if p = None && M.is_empty l then match find_last_opt_result with None -> true | _ -> false else (match find_last_opt_result with | None -> false | Some (k, v) -> (match p with | None -> (k, v) = M.max_binding l | Some v1 -> (k, v) = (x, v1)))); check "split" (let (l, p, r) = M.split x s1 in fun i -> if i < x then img i l = img i s1 else if i > x then img i r = img i s1 else p = img i s1); checkbool "to_seq_of_seq" (M.equal (=) s1 (M.of_seq @@ M.to_seq s1)); checkbool "to_seq_from" (let seq = M.to_seq_from x s1 in let ok1 = List.of_seq seq |> List.for_all (fun (y,_) -> y >= x) in let ok2 = (M.to_seq s1 |> List.of_seq |> List.filter (fun (y,_) -> y >= x)) = (List.of_seq seq) in ok1 && ok2); () let rkey() = Random.int 10 let rdata() = Random.float 1.0 let rmap() = let s = ref M.empty in for i = 1 to Random.int 10 do s := M.add (rkey()) (rdata()) !s done; !s let _ = Random.init 42; for i = 1 to 10000 do test (rkey()) (rdata()) (rmap()) (rmap()) done let () = (* check that removing a binding from a map that is not present in this map (1) doesn't allocate and (2) return the original map *) let m1 = ref M.empty in for i = 1 to 10 do m1 := M.add i (float i) !m1 done; let m2 = ref !m1 in let a0 = Gc.allocated_bytes () in let a1 = Gc.allocated_bytes () in for i = 11 to 30 do m2 := M.remove i !m2 done; let a2 = Gc.allocated_bytes () in assert (!m2 == !m1); assert(a2 -. a1 = a1 -. a0) let () = (* check that filtering a map where all bindings are satisfied by the given predicate returns the original map *) let m1 = ref M.empty in for i = 1 to 10 do m1 := M.add i (float i) !m1 done; let m2 = M.filter (fun e _ -> e >= 0) !m1 in assert (m2 == !m1) let () = (* check that adding a binding "x -> y" to a map that already contains it doesn't allocate and return the original map. *) let m1 = ref M.empty in let tmp = ref None in for i = 1 to 10 do tmp := Some (float i); m1 := M.add i !tmp !m1 done; let m2 = ref !m1 in let a0 = Gc.allocated_bytes () in let a1 = Gc.allocated_bytes () in (* 10 |-> !tmp is already present in !m2 *) m2 := M.add 10 !tmp !m2; let a2 = Gc.allocated_bytes () in assert (!m2 == !m1); assert(a2 -. a1 = a1 -. a0); (* 4 |-> Some 84. is not present in !m2 *) m2 := M.add 4 (Some 84.) !m2; assert (not (!m2 == !m1)); js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-set/testmap.reference000066400000000000000000000000001357507750000256230ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-set/testset.ml000066400000000000000000000156661357507750000243430ustar00rootroot00000000000000[@@@ocaml.warning "-27-35"] (* TEST *) module S = Set.Make(struct type t = int let compare (x:t) y = compare x y end) let testvals = [0;1;2;3;4;5;6;7;8;9] let check msg cond = if not (List.for_all cond testvals) then Printf.printf "Test %s FAILED\n%!" msg let checkbool msg b = if not b then Printf.printf "Test %s FAILED\n%!" msg let normalize_cmp c = if c = 0 then 0 else if c > 0 then 1 else -1 let test x s1 s2 = checkbool "is_empty" (S.is_empty s1 = List.for_all (fun i -> not (S.mem i s1)) testvals); check "add" (let s = S.add x s1 in fun i -> S.mem i s = (S.mem i s1 || i = x)); check "singleton" (let s = S.singleton x in fun i -> S.mem i s = (i = x)); check "remove" (let s = S.remove x s1 in fun i -> S.mem i s = (S.mem i s1 && i <> x)); check "union" (let s = S.union s1 s2 in fun i -> S.mem i s = (S.mem i s1 || S.mem i s2)); check "inter" (let s = S.inter s1 s2 in fun i -> S.mem i s = (S.mem i s1 && S.mem i s2)); checkbool "disjoint" (S.is_empty (S.inter s1 s2) = S.disjoint s1 s2); check "diff" (let s = S.diff s1 s2 in fun i -> S.mem i s = (S.mem i s1 && not (S.mem i s2))); checkbool "elements" (S.elements s1 = List.filter (fun i -> S.mem i s1) testvals); checkbool "compare" (normalize_cmp (S.compare s1 s2) = normalize_cmp (compare (S.elements s1) (S.elements s2))); checkbool "equal" (S.equal s1 s2 = (S.elements s1 = S.elements s2)); check "subset" (let b = S.subset s1 s2 in fun i -> if b && S.mem i s1 then S.mem i s2 else true); checkbool "subset2" (let b = S.subset s1 s2 in b || not (S.is_empty (S.diff s1 s2))); checkbool "map" (S.elements (S.map succ s1) = List.map succ (S.elements s1)); checkbool "map2" (S.map (fun x -> x) s1 == s1); checkbool "map3" ((* check that the traversal is made in increasing element order *) let last = ref min_int in S.map (fun x -> assert (!last <= x); last := x; x) s1 == s1); checkbool "for_all" (let p x = x mod 2 = 0 in S.for_all p s1 = List.for_all p (S.elements s1)); checkbool "exists" (let p x = x mod 3 = 0 in S.exists p s1 = List.exists p (S.elements s1)); checkbool "filter" (let p x = x >= 3 && x <= 6 in S.elements(S.filter p s1) = List.filter p (S.elements s1)); checkbool "partition" (let p x = x >= 3 && x <= 6 in let (st,sf) = S.partition p s1 and (lt,lf) = List.partition p (S.elements s1) in S.elements st = lt && S.elements sf = lf); checkbool "cardinal" (S.cardinal s1 = List.length (S.elements s1)); checkbool "min_elt" (try let m = S.min_elt s1 in S.mem m s1 && S.for_all (fun i -> m <= i) s1 with Not_found -> S.is_empty s1); checkbool "max_elt" (try let m = S.max_elt s1 in S.mem m s1 && S.for_all (fun i -> m >= i) s1 with Not_found -> S.is_empty s1); checkbool "choose" (try let x = S.choose s1 in S.mem x s1 with Not_found -> S.is_empty s1); checkbool "find_first" (let (l, p, r) = S.split x s1 in if not p && S.is_empty r then try let _ = S.find_first (fun k -> k >= x) s1 in false with Not_found -> true else let e = S.find_first (fun k -> k >= x) s1 in if p then e = x else e = S.min_elt r); checkbool "find_first_opt" (let (l, p, r) = S.split x s1 in let find_first_opt_result = S.find_first_opt (fun k -> k >= x) s1 in if not p && S.is_empty r then match find_first_opt_result with None -> true | _ -> false else (match find_first_opt_result with | None -> false | Some e -> if p then e = x else e = S.min_elt r)); checkbool "find_last" (let (l, p, r) = S.split x s1 in if not p && S.is_empty l then try let _ = S.find_last (fun k -> k <= x) s1 in false with Not_found -> true else let e = S.find_last (fun k -> k <= x) s1 in if p then e = x else e = S.max_elt l); checkbool "find_last_opt" (let (l, p, r) = S.split x s1 in let find_last_opt_result = S.find_last_opt (fun k -> k <= x) s1 in if not p && S.is_empty l then match find_last_opt_result with None -> true | _ -> false else (match find_last_opt_result with | None -> false | Some e -> if p then e = x else e = S.max_elt l)); check "split" (let (l, p, r) = S.split x s1 in fun i -> if i < x then S.mem i l = S.mem i s1 else if i > x then S.mem i r = S.mem i s1 else p = S.mem i s1); checkbool "to_seq_of_seq" (S.equal s1 (S.of_seq @@ S.to_seq s1)); checkbool "to_seq_from" (let seq = S.to_seq_from x s1 in let ok1 = List.of_seq seq |> List.for_all (fun y -> y >= x) in let ok2 = (S.elements s1 |> List.filter (fun y -> y >= x)) = (List.of_seq seq) in ok1 && ok2); () let relt() = Random.int 10 let rset() = let s = ref S.empty in for i = 1 to Random.int 10 do s := S.add (relt()) !s done; !s let _ = Random.init 42; for i = 1 to 10000 do test (relt()) (rset()) (rset()) done let () = (* #6645: check that adding an element to set that already contains it doesn't allocate and return the original set. *) let s1 = ref S.empty in for i = 1 to 10 do s1 := S.add i !s1 done; let s2 = ref !s1 in let a0 = Gc.allocated_bytes () in let a1 = Gc.allocated_bytes () in for i = 1 to 10 do s2 := S.add i !s2 done; let a2 = Gc.allocated_bytes () in assert (!s2 == !s1); assert(a2 -. a1 = a1 -. a0) let () = (* check that removing an element from a set that is not present in this set (1) doesn't allocate and (2) return the original set *) let s1 = ref S.empty in for i = 1 to 10 do s1 := S.add i !s1 done; let s2 = ref !s1 in let a0 = Gc.allocated_bytes () in let a1 = Gc.allocated_bytes () in for i = 11 to 30 do s2 := S.remove i !s2 done; let a2 = Gc.allocated_bytes () in assert (!s2 == !s1); assert(a2 -. a1 = a1 -. a0) let () = (* check that filtering a set where all elements are satisfied by the given predicate return the original set *) let s1 = ref S.empty in for i = 1 to 10 do s1 := S.add i !s1 done; let s2 = S.filter (fun e -> e >= 0) !s1 in assert (s2 == !s1) let valid_structure s = (* this test should return 'true' for all set, but it can detect sets that are ill-structured, for example incorrectly ordered, as the S.mem function will make assumptions about the set ordering. (This trick was used to exhibit the bug in PR#7403) *) List.for_all (fun n -> S.mem n s) (S.elements s) let () = (* PR#7403: map buggily orders elements according to the input set order, not the output set order. Mapping functions that change the value ordering thus break the set structure. *) let test = S.of_list [1; 3; 5] in let f = function 3 -> 8 | n -> n in assert (valid_structure (S.map f test)) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-set/testset.reference000066400000000000000000000000001357507750000256410ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-stack/000077500000000000000000000000001357507750000226125ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-stack/dune000066400000000000000000000004471357507750000234750ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-stack/test.ml000066400000000000000000000062431357507750000241300ustar00rootroot00000000000000(* TEST *) module S = struct include Stack let to_list s = (* from bottom to top *) let l = ref [] in iter (fun x -> l := x :: !l) s; !l end let does_raise f s = try ignore (f s : int); false with S.Empty -> true let () = let s = S.create () in (); assert (S.to_list s = [ ] && S.length s = 0); S.push 1 s; assert (S.to_list s = [1 ] && S.length s = 1); S.push 2 s; assert (S.to_list s = [1; 2 ] && S.length s = 2); S.push 3 s; assert (S.to_list s = [1; 2; 3 ] && S.length s = 3); S.push 4 s; assert (S.to_list s = [1; 2; 3; 4] && S.length s = 4); assert (S.pop s = 4); assert (S.to_list s = [1; 2; 3; ] && S.length s = 3); assert (S.pop s = 3); assert (S.to_list s = [1; 2; ] && S.length s = 2); assert (S.pop s = 2); assert (S.to_list s = [1; ] && S.length s = 1); assert (S.pop s = 1); assert (S.to_list s = [ ] && S.length s = 0); assert (does_raise S.pop s); ;; let () = let s = S.create () in S.push 1 s; assert (S.pop s = 1); assert (does_raise S.pop s); S.push 2 s; assert (S.pop s = 2); assert (does_raise S.pop s); assert (S.length s = 0); ;; let () = let s = S.create () in S.push 1 s; assert (S.top s = 1); S.push 2 s; assert (S.top s = 2); S.push 3 s; assert (S.top s = 3); assert (S.top s = 3); assert (S.pop s = 3); assert (S.top s = 2); assert (S.pop s = 2); assert (S.top s = 1); assert (S.pop s = 1); assert (does_raise S.top s); assert (does_raise S.top s); ;; let () = let s = S.create () in for i = 1 to 10 do S.push i s done; S.clear s; assert (S.length s = 0); assert (does_raise S.pop s); assert (s = S.create ()); S.push 42 s; assert (S.pop s = 42); ;; let () = let s1 = S.create () in for i = 1 to 10 do S.push i s1 done; let s2 = S.copy s1 in assert (S.to_list s1 = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]); assert (S.to_list s2 = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]); assert (S.length s1 = 10); assert (S.length s2 = 10); for i = 10 downto 1 do assert (S.pop s1 = i); done; for i = 10 downto 1 do assert (S.pop s2 = i); done; ;; let () = let s = S.create () in assert (S.is_empty s); for i = 1 to 10 do S.push i s; assert (S.length s = i); assert (not (S.is_empty s)); done; for i = 10 downto 1 do assert (S.length s = i); assert (not (S.is_empty s)); ignore (S.pop s : int); done; assert (S.length s = 0); assert (S.is_empty s); ;; let () = let s = S.create () in for i = 10 downto 1 do S.push i s done; let i = ref 1 in S.iter (fun j -> assert (!i = j); incr i) s; ;; let () = let s1 = S.create () in assert (S.length s1 = 0); assert (S.to_list s1 = []); let s2 = S.copy s1 in assert (S.length s1 = 0); assert (S.to_list s1 = []); assert (S.length s2 = 0); assert (S.to_list s2 = []); ;; let () = let s1 = S.create () in for i = 1 to 4 do S.push i s1 done; assert (S.length s1 = 4); assert (S.to_list s1 = [1; 2; 3; 4]); let s2 = S.copy s1 in assert (S.length s1 = 4); assert (S.to_list s1 = [1; 2; 3; 4]); assert (S.length s2 = 4); assert (S.to_list s2 = [1; 2; 3; 4]); ;; let () = print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-stack/test.reference000066400000000000000000000000031357507750000254420ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-string/000077500000000000000000000000001357507750000230135ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-string/dune000066400000000000000000000005371357507750000236760ustar00rootroot00000000000000(executables (names test_string) (libraries) (js_of_ocaml) ) (rule (target test_string.referencejs) (deps test_string.bc.js) (action (with-stdout-to %{target} (run node ./test_string.bc.js)))) (alias (name runtest) (deps test_string.reference test_string.referencejs) (action (diff test_string.reference test_string.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-string/test_string.ml000066400000000000000000000026761357507750000257250ustar00rootroot00000000000000(* TEST *) let rec build_string f n accu = if n <= 0 then String.concat "" accu else build_string f (n-1) (f (n-1) :: accu) ;; let char n = String.make 1 (Char.chr n);; let reference n = if n = 8 then "\\b" else if n = 9 then "\\t" else if n = 10 then "\\n" else if n = 13 then "\\r" else if n = Char.code '\"' then "\\\"" else if n = Char.code '\\' then "\\\\" else if n < 32 || n > 126 then Printf.sprintf "\\%03d" n else char n ;; let raw_string = build_string char 256 [];; let ref_string = build_string reference 256 [];; if String.escaped raw_string <> ref_string then failwith "test:String.escaped";; let check_split sep s = let l = String.split_on_char sep s in assert(List.length l > 0); assert(String.concat (String.make 1 sep) l = s); List.iter (String.iter (fun c -> assert (c <> sep))) l ;; let () = let s = " abc def " in for i = 0 to String.length s do check_split ' ' (String.sub s 0 i) done ;; (* GPR#805/815/833 *) (* max_string_length is smaller in javascript *) (* let () = if Sys.word_size = 32 then begin let big = String.make Sys.max_string_length 'x' in let push x l = l := x :: !l in let (+=) a b = a := !a + b in let sz, l = ref 0, ref [] in while !sz >= 0 do push big l; sz += Sys.max_string_length done; while !sz <= 0 do push big l; sz += Sys.max_string_length done; try ignore (String.concat "" !l); assert false with Invalid_argument _ -> () end *) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-string/test_string.reference000066400000000000000000000000001357507750000272260ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-uchar/000077500000000000000000000000001357507750000226075ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-uchar/dune000066400000000000000000000004471357507750000234720ustar00rootroot00000000000000(executables (names test) (libraries) (js_of_ocaml) ) (rule (target test.referencejs) (deps test.bc.js) (action (with-stdout-to %{target} (run node ./test.bc.js)))) (alias (name runtest) (deps test.reference test.referencejs) (action (diff test.reference test.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-uchar/test.ml000066400000000000000000000044721357507750000241270ustar00rootroot00000000000000(* TEST *) let assert_raise_invalid_argument f v = assert (try ignore (f v); false with Invalid_argument _ -> true) let test_constants () = assert (Uchar.(to_int min) = 0x0000); assert (Uchar.(to_int max) = 0x10FFFF); assert (Uchar.(to_int bom) = 0xFEFF); assert (Uchar.(to_int rep) = 0xFFFD); () let test_succ () = assert (Uchar.(to_int (succ min)) = 0x0001); assert (Uchar.(to_int (succ (of_int 0xD7FF))) = 0xE000); assert (Uchar.(to_int (succ (of_int 0xE000))) = 0xE001); assert_raise_invalid_argument Uchar.succ Uchar.max; () let test_pred () = assert_raise_invalid_argument Uchar.pred Uchar.min; assert (Uchar.(to_int (pred (of_int 0xD7FF))) = 0xD7FE); assert (Uchar.(to_int (pred (of_int 0xE000))) = 0xD7FF); assert (Uchar.(to_int (pred max)) = 0x10FFFE); () let test_is_valid () = assert (not (Uchar.is_valid (-1))); assert (Uchar.is_valid 0x0000); assert (Uchar.is_valid 0xD7FF); assert (not (Uchar.is_valid 0xD800)); assert (not (Uchar.is_valid 0xDFFF)); assert (Uchar.is_valid 0xE000); assert (Uchar.is_valid 0x10FFFF); assert (not (Uchar.is_valid 0x110000)); assert (not (Uchar.is_valid min_int)); assert (not (Uchar.is_valid max_int)); () let char_max = Uchar.of_int 0x00FF let test_is_char () = assert (Uchar.(is_char Uchar.min)); assert (Uchar.(is_char char_max)); assert (Uchar.(not (is_char (of_int 0x0100)))); assert (not (Uchar.is_char Uchar.max)); () let test_of_char () = assert (Uchar.(equal (of_char '\xFF') char_max)); assert (Uchar.(equal (of_char '\x00') min)); () let test_to_char () = assert (Uchar.(to_char min) = '\x00'); assert (Uchar.(to_char char_max) = '\xFF'); assert_raise_invalid_argument Uchar.to_char (Uchar.succ char_max); assert_raise_invalid_argument Uchar.to_char Uchar.max; () let test_equal () = assert (Uchar.(equal min min)); assert (Uchar.(equal max max)); assert (not Uchar.(equal min max)); () let test_compare () = assert (Uchar.(compare min min) = 0); assert (Uchar.(compare max max) = 0); assert (Uchar.(compare min max) = (-1)); assert (Uchar.(compare max min) = 1); () let tests () = test_constants (); test_succ (); test_pred (); test_is_valid (); test_is_char (); test_of_char (); test_to_char (); test_equal (); test_compare (); () let () = tests (); print_endline "OK" js_of_ocaml-3.5.2/compiler/ocaml-testsuite/lib-uchar/test.reference000066400000000000000000000000031357507750000254370ustar00rootroot00000000000000OK js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bigstring/000077500000000000000000000000001357507750000236765ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bigstring/bigstring_access.ml000066400000000000000000000075411357507750000275500ustar00rootroot00000000000000(* TEST *) open Bigarray type bigstring = (char, int8_unsigned_elt, c_layout) Array1.t external caml_bigstring_get_16 : bigstring -> int -> int = "%caml_bigstring_get16" external caml_bigstring_get_32 : bigstring -> int -> int32 = "%caml_bigstring_get32" external caml_bigstring_get_64 : bigstring -> int -> int64 = "%caml_bigstring_get64" external caml_bigstring_set_16 : bigstring -> int -> int -> unit = "%caml_bigstring_set16" external caml_bigstring_set_32 : bigstring -> int -> int32 -> unit = "%caml_bigstring_set32" external caml_bigstring_set_64 : bigstring -> int -> int64 -> unit = "%caml_bigstring_set64" let bigstring_of_string s = let a = Array1.create char c_layout (String.length s) in for i = 0 to String.length s - 1 do a.{i} <- s.[i] done; a let s = bigstring_of_string (String.make 10 '\x00') let empty_s = bigstring_of_string "" let assert_bound_check2 f v1 v2 = try ignore(f v1 v2); assert false with | Invalid_argument _ -> () let assert_bound_check3 f v1 v2 v3 = try ignore(f v1 v2 v3); assert false with | Invalid_argument _ -> () let () = assert_bound_check2 caml_bigstring_get_16 s (-1); assert_bound_check2 caml_bigstring_get_16 s 9; assert_bound_check2 caml_bigstring_get_32 s (-1); assert_bound_check2 caml_bigstring_get_32 s 7; assert_bound_check2 caml_bigstring_get_64 s (-1); assert_bound_check2 caml_bigstring_get_64 s 3; assert_bound_check3 caml_bigstring_set_16 s (-1) 0; assert_bound_check3 caml_bigstring_set_16 s 9 0; assert_bound_check3 caml_bigstring_set_32 s (-1) 0l; assert_bound_check3 caml_bigstring_set_32 s 7 0l; assert_bound_check3 caml_bigstring_set_64 s (-1) 0L; assert_bound_check3 caml_bigstring_set_64 s 3 0L; assert_bound_check2 caml_bigstring_get_16 empty_s 0; assert_bound_check2 caml_bigstring_get_32 empty_s 0; assert_bound_check2 caml_bigstring_get_64 empty_s 0; assert_bound_check3 caml_bigstring_set_16 empty_s 0 0; assert_bound_check3 caml_bigstring_set_32 empty_s 0 0l; assert_bound_check3 caml_bigstring_set_64 empty_s 0 0L external bswap16: int -> int = "%bswap16" external bswap32: int32 -> int32 = "%bswap_int32" external bswap64: int64 -> int64 = "%bswap_int64" let swap16 x = if Sys.big_endian then bswap16 x else x let swap32 x = if Sys.big_endian then bswap32 x else x let swap64 x = if Sys.big_endian then bswap64 x else x let () = caml_bigstring_set_16 s 0 (swap16 0x1234); Printf.printf "%x %x %x\n%!" (swap16 (caml_bigstring_get_16 s 0)) (swap16 (caml_bigstring_get_16 s 1)) (swap16 (caml_bigstring_get_16 s 2)); caml_bigstring_set_16 s 0 (swap16 0xFEDC); Printf.printf "%x %x %x\n%!" (swap16 (caml_bigstring_get_16 s 0)) (swap16 (caml_bigstring_get_16 s 1)) (swap16 (caml_bigstring_get_16 s 2)) let () = caml_bigstring_set_32 s 0 (swap32 0x12345678l); Printf.printf "%lx %lx %lx\n%!" (swap32 (caml_bigstring_get_32 s 0)) (swap32 (caml_bigstring_get_32 s 1)) (swap32 (caml_bigstring_get_32 s 2)); caml_bigstring_set_32 s 0 (swap32 0xFEDCBA09l); Printf.printf "%lx %lx %lx\n%!" (swap32 (caml_bigstring_get_32 s 0)) (swap32 (caml_bigstring_get_32 s 1)) (swap32 (caml_bigstring_get_32 s 2)) let () = caml_bigstring_set_64 s 0 (swap64 0x1234567890ABCDEFL); Printf.printf "%Lx %Lx %Lx\n%!" (swap64 (caml_bigstring_get_64 s 0)) (swap64 (caml_bigstring_get_64 s 1)) (swap64 (caml_bigstring_get_64 s 2)); caml_bigstring_set_64 s 0 (swap64 0xFEDCBA0987654321L); Printf.printf "%Lx %Lx %Lx\n%!" (swap64 (caml_bigstring_get_64 s 0)) (swap64 (caml_bigstring_get_64 s 1)) (swap64 (caml_bigstring_get_64 s 2)) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bigstring/bigstring_access.reference000066400000000000000000000002301357507750000310620ustar00rootroot000000000000001234 12 0 fedc fe 0 12345678 123456 1234 fedcba09 fedcba fedc 1234567890abcdef 1234567890abcd 1234567890ab fedcba0987654321 fedcba09876543 fedcba098765 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bigstring/dune000066400000000000000000000012771357507750000245630ustar00rootroot00000000000000(executables (names bigstring_access string_access) (libraries) (js_of_ocaml) ) (rule (target bigstring_access.referencejs) (deps bigstring_access.bc.js) (action (with-stdout-to %{target} (run node ./bigstring_access.bc.js)))) (alias (name runtest) (deps bigstring_access.reference bigstring_access.referencejs) (action (diff bigstring_access.reference bigstring_access.referencejs))) (rule (target string_access.referencejs) (deps string_access.bc.js) (action (with-stdout-to %{target} (run node ./string_access.bc.js)))) (alias (name runtest) (deps string_access.reference string_access.referencejs) (action (diff string_access.reference string_access.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bigstring/string_access.ml000066400000000000000000000065121357507750000270630ustar00rootroot00000000000000(* TEST *) external caml_bytes_get_16 : bytes -> int -> int = "%caml_bytes_get16" external caml_bytes_get_32 : bytes -> int -> int32 = "%caml_bytes_get32" external caml_bytes_get_64 : bytes -> int -> int64 = "%caml_bytes_get64" external caml_bytes_set_16 : bytes -> int -> int -> unit = "%caml_bytes_set16" external caml_bytes_set_32 : bytes -> int -> int32 -> unit = "%caml_bytes_set32" external caml_bytes_set_64 : bytes -> int -> int64 -> unit = "%caml_bytes_set64" let s = Bytes.make 10 '\x00' let empty_s = Bytes.create 0 let assert_bound_check2 f v1 v2 = try ignore(f v1 v2); assert false with | Invalid_argument _ -> () let assert_bound_check3 f v1 v2 v3 = try ignore(f v1 v2 v3); assert false with | Invalid_argument _ -> () let () = assert_bound_check2 caml_bytes_get_16 s (-1); assert_bound_check2 caml_bytes_get_16 s 9; assert_bound_check2 caml_bytes_get_32 s (-1); assert_bound_check2 caml_bytes_get_32 s 7; assert_bound_check2 caml_bytes_get_64 s (-1); assert_bound_check2 caml_bytes_get_64 s 3; assert_bound_check3 caml_bytes_set_16 s (-1) 0; assert_bound_check3 caml_bytes_set_16 s 9 0; assert_bound_check3 caml_bytes_set_32 s (-1) 0l; assert_bound_check3 caml_bytes_set_32 s 7 0l; assert_bound_check3 caml_bytes_set_64 s (-1) 0L; assert_bound_check3 caml_bytes_set_64 s 3 0L; assert_bound_check2 caml_bytes_get_16 empty_s 0; assert_bound_check2 caml_bytes_get_32 empty_s 0; assert_bound_check2 caml_bytes_get_64 empty_s 0; assert_bound_check3 caml_bytes_set_16 empty_s 0 0; assert_bound_check3 caml_bytes_set_32 empty_s 0 0l; assert_bound_check3 caml_bytes_set_64 empty_s 0 0L external bswap16: int -> int = "%bswap16" external bswap32: int32 -> int32 = "%bswap_int32" external bswap64: int64 -> int64 = "%bswap_int64" let swap16 x = if Sys.big_endian then bswap16 x else x let swap32 x = if Sys.big_endian then bswap32 x else x let swap64 x = if Sys.big_endian then bswap64 x else x let () = caml_bytes_set_16 s 0 (swap16 0x1234); Printf.printf "%x %x %x\n%!" (swap16 (caml_bytes_get_16 s 0)) (swap16 (caml_bytes_get_16 s 1)) (swap16 (caml_bytes_get_16 s 2)); caml_bytes_set_16 s 0 (swap16 0xFEDC); Printf.printf "%x %x %x\n%!" (swap16 (caml_bytes_get_16 s 0)) (swap16 (caml_bytes_get_16 s 1)) (swap16 (caml_bytes_get_16 s 2)) let () = caml_bytes_set_32 s 0 (swap32 0x12345678l); Printf.printf "%lx %lx %lx\n%!" (swap32 (caml_bytes_get_32 s 0)) (swap32 (caml_bytes_get_32 s 1)) (swap32 (caml_bytes_get_32 s 2)); caml_bytes_set_32 s 0 (swap32 0xFEDCBA09l); Printf.printf "%lx %lx %lx\n%!" (swap32 (caml_bytes_get_32 s 0)) (swap32 (caml_bytes_get_32 s 1)) (swap32 (caml_bytes_get_32 s 2)) let () = caml_bytes_set_64 s 0 (swap64 0x1234567890ABCDEFL); Printf.printf "%Lx %Lx %Lx\n%!" (swap64 (caml_bytes_get_64 s 0)) (swap64 (caml_bytes_get_64 s 1)) (swap64 (caml_bytes_get_64 s 2)); caml_bytes_set_64 s 0 (swap64 0xFEDCBA0987654321L); Printf.printf "%Lx %Lx %Lx\n%!" (swap64 (caml_bytes_get_64 s 0)) (swap64 (caml_bytes_get_64 s 1)) (swap64 (caml_bytes_get_64 s 2)) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bigstring/string_access.reference000066400000000000000000000002301357507750000304000ustar00rootroot000000000000001234 12 0 fedc fe 0 12345678 123456 1234 fedcba09 fedcba fedc 1234567890abcdef 1234567890abcd 1234567890ab fedcba0987654321 fedcba09876543 fedcba098765 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bswap/000077500000000000000000000000001357507750000230225ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bswap/bswap.ml000066400000000000000000000007621357507750000244750ustar00rootroot00000000000000(* TEST *) open Printf external bswap16: int -> int = "%bswap16" external bswap32: int32 -> int32 = "%bswap_int32" external bswap64: int64 -> int64 = "%bswap_int64" let d16 = [0x11223344; 0x0000f0f0] let d32 = [0x11223344l; 0xf0f0f0f0l] let d64 = [0x1122334455667788L; 0xf0f0f0f0f0f0f0f0L] let _ = List.iter (fun x -> printf "%x\n" (bswap16 x)) d16; List.iter (fun x -> printf "%lx\n" (bswap32 x)) d32; List.iter (fun x -> printf "%Lx\n" (bswap64 x)) d64 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bswap/bswap.reference000066400000000000000000000000761357507750000260210ustar00rootroot000000000000004433 f0f0 44332211 f0f0f0f0 8877665544332211 f0f0f0f0f0f0f0f0 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-bswap/dune000066400000000000000000000004571357507750000237060ustar00rootroot00000000000000(executables (names bswap) (libraries) (js_of_ocaml) ) (rule (target bswap.referencejs) (deps bswap.bc.js) (action (with-stdout-to %{target} (run node ./bswap.bc.js)))) (alias (name runtest) (deps bswap.reference bswap.referencejs) (action (diff bswap.reference bswap.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-revapply/000077500000000000000000000000001357507750000235505ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-revapply/apply.ml000066400000000000000000000013601357507750000252270ustar00rootroot00000000000000(* TEST *) external ( @@ ) : ('a -> 'b) -> 'a -> 'b = "%apply" let f x = x + x let g x = x * x let h x = x + 1 let add x y = x + y let _ = List.iter (fun x -> print_int x; print_newline () ) [ f @@ 3; (* 6 *) g @@ f @@ 3; (* 36 *) f @@ g @@ 3; (* 18 *) h @@ g @@ f @@ 3; (* 37 *) add 4 @@ g @@ f @@ add 3 @@ add 2 @@ 3; (* 260 *) ] external ( @@ ) : ('a -> 'b) -> 'a -> 'b = "%apply" let f x = x + x let g x = x * x let h x = x + 1 let add x y = x + y let _ = List.iter (fun x -> print_int x; print_newline () ) [ f @@ 3; (* 6 *) g @@ f @@ 3; (* 36 *) f @@ g @@ 3; (* 18 *) h @@ g @@ f @@ 3; (* 37 *) add 4 @@ g @@ f @@ add 3 @@ add 2 @@ 3; (* 260 *) ] js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-revapply/apply.reference000066400000000000000000000000361357507750000265540ustar00rootroot000000000000006 36 18 37 260 6 36 18 37 260 js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-revapply/dune000066400000000000000000000010771357507750000244330ustar00rootroot00000000000000(executables (names apply revapply) (libraries) (js_of_ocaml) ) (rule (target apply.referencejs) (deps apply.bc.js) (action (with-stdout-to %{target} (run node ./apply.bc.js)))) (alias (name runtest) (deps apply.reference apply.referencejs) (action (diff apply.reference apply.referencejs))) (rule (target revapply.referencejs) (deps revapply.bc.js) (action (with-stdout-to %{target} (run node ./revapply.bc.js)))) (alias (name runtest) (deps revapply.reference revapply.referencejs) (action (diff revapply.reference revapply.referencejs))) js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-revapply/revapply.ml000066400000000000000000000006001357507750000257400ustar00rootroot00000000000000(* TEST *) external ( |> ) : 'a -> ('a -> 'b) -> 'b = "%revapply" let f x = x + x let g x = x * x let h x = x + 1 let add x y = x + y let _ = List.iter (fun x -> print_int x; print_newline () ) [ 3 |> f; (* 6 *) 3 |> f |> g; (* 36 *) 3 |> g |> f; (* 18 *) 3 |> f |> g |> h; (* 37 *) 3 |> add 2 |> add 3 |> f |> g |> add 4; (* 260 *) ] js_of_ocaml-3.5.2/compiler/ocaml-testsuite/prim-revapply/revapply.reference000066400000000000000000000000171357507750000272700ustar00rootroot000000000000006 36 18 37 260 js_of_ocaml-3.5.2/compiler/ppx/000077500000000000000000000000001357507750000164265ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/ppx/dune000066400000000000000000000002061357507750000173020ustar00rootroot00000000000000(library (name ppx_optcomp_light) (libraries compiler-libs.common ocaml-migrate-parsetree) (kind ppx_rewriter) ) js_of_ocaml-3.5.2/compiler/ppx/ppx_optcomp_light.ml000066400000000000000000000132671357507750000225300ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Minimal version of ppx_optcomp It only support the following attribute {[ [@if ocaml_version < (4,8,0)] ]} on module (Pstr_module) and pattern in case (pc_lhs) *) open StdLabels open Migrate_parsetree open OCaml_407.Ast open Parsetree module Version : sig type t val of_list : int list -> t val compare : t -> t -> int val current : t end = struct type t = int list let of_list l = l let split_char ~sep p = let len = String.length p in let rec split beg cur = if cur >= len then if cur - beg > 0 then [ String.sub p ~pos:beg ~len:(cur - beg) ] else [] else if p.[cur] = sep then String.sub p ~pos:beg ~len:(cur - beg) :: split (cur + 1) (cur + 1) else split beg (cur + 1) in split 0 0 let split v = match split_char ~sep:'+' v with | [] -> assert false | x :: _ -> List.map (split_char ~sep:'.' x) ~f:int_of_string let current = split Sys.ocaml_version let compint (a : int) b = compare a b let rec compare v v' = match v, v' with | [ x ], [ y ] -> compint x y | [], [] -> 0 | [], y :: _ -> compint 0 y | x :: _, [] -> compint x 0 | x :: xs, y :: ys -> ( match compint x y with | 0 -> compare xs ys | n -> n) end exception Invalid let keep loc (attrs : attributes) = try let keep = List.for_all attrs ~f:(function | { Location.txt = "if"; _ }, attr_payload -> ( match attr_payload with | PStr [ { pstr_desc = Pstr_eval ( { pexp_desc = Pexp_apply (op, [ (Nolabel, a); (Nolabel, b) ]) ; _ } , [] ) ; _ } ] -> let get_op = function | { pexp_desc = Pexp_ident { txt = Lident str; _ }; _ } -> ( match str with | "<=" -> ( <=) | ">=" -> ( >=) | ">" -> ( >) | "<" -> ( <) | "<>" -> ( <>) | "=" -> ( =) | _ -> raise Invalid) | _ -> raise Invalid in let eval = function | { pexp_desc = Pexp_ident { txt = Lident "ocaml_version"; _ }; _ } -> Version.current | { pexp_desc = Pexp_tuple l; _ } -> let l = List.map l ~f:(function | { pexp_desc = Pexp_constant (Pconst_integer (d, None)) ; _ } -> int_of_string d | _ -> raise Invalid) in Version.of_list l | _ -> raise Invalid in let op = get_op op in let a = eval a in let b = eval b in op (Version.compare a b) 0 | _ -> raise Invalid) | _ -> true) in if false && not keep then Printf.eprintf "dropping %s:%d\n%!" loc.Location.loc_start.pos_fname loc.Location.loc_start.pos_lnum; keep with Invalid -> Location.raise_errorf ~loc "Invalid attribute format" let filter_map ~f l = let l = List.fold_left ~f:(fun acc x -> match f x with | Some x -> x :: acc | None -> acc) ~init:[] l in List.rev l let rec filter_pattern = function | { ppat_desc = Ppat_or (p1, p2); _ } as p -> ( match filter_pattern p1, filter_pattern p2 with | None, None -> None | Some p1, None -> Some p1 | None, Some p2 -> Some p2 | Some p1, Some p2 -> Some { p with ppat_desc = Ppat_or (p1, p2) }) | { ppat_attributes; ppat_loc; _ } as p -> if keep ppat_loc ppat_attributes then Some p else None let mapper = { Ast_mapper.default_mapper with cases = (fun mapper cases -> let cases = filter_map cases ~f:(fun case -> match filter_pattern case.pc_lhs with | None -> None | Some pattern -> Some { case with pc_lhs = pattern }) in Ast_mapper.default_mapper.cases mapper cases) ; structure = (fun mapper items -> let items = List.filter items ~f:(fun item -> match item.pstr_desc with | Pstr_module { pmb_attributes; pmb_loc; _ } -> keep pmb_loc pmb_attributes | _ -> true) in Ast_mapper.default_mapper.structure mapper items) } let () = Driver.register ~name:"ppx_optcomp_light" Migrate_parsetree.Versions.ocaml_407 (fun _config _cookies -> mapper) js_of_ocaml-3.5.2/compiler/tests/000077500000000000000000000000001357507750000167615ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/tests/array_access.ml000066400000000000000000000027021357507750000217530ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let array_set = {| let some_name a n = let x = a.(n) <- n in x = () let a = [|1;2;3|] let () = assert (some_name a 2) |} let%expect_test "array_set" = let compile s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo |> compile_cmo_to_javascript ~pretty:true |> fst |> parse_js in let program = compile array_set in print_fun_decl program (Some "some_name"); [%expect {| function some_name(a,n){runtime.caml_check_bound(a,n)[1 + n] = n;return 1} |}] let%expect_test "array_set" = compile_and_run array_set; [%expect {| |}] js_of_ocaml-3.5.2/compiler/tests/build_path_prefix_map.ml000066400000000000000000000026051357507750000236430ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let%expect_test _ = "let id x = x" |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo |> compile_cmo_to_javascript ~sourcemap:true ~pretty:false |> snd |> (function | Some x -> x | None -> failwith "no sourcemap generated!") |> Filetype.read_map |> Filetype.string_of_map_text |> print_endline; [%expect {| {"version":3.0,"file":"/root/jsoo_test.js","sourceRoot":"","names":["a"],"mappings":"0B;sDAAOA,GAAI,MAAJA,EAAK,4B","sources":["/root/jsoo_test.ml"],"sourcesContent":["let id x = x"]} |}] js_of_ocaml-3.5.2/compiler/tests/channel.ml000066400000000000000000000067061357507750000207340ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://github.com/ocsigen/js_of_ocaml/issues/777 *) let%expect_test _ = Util.compile_and_run {| let tmp = Filename.temp_file "a" "txt" let oc = open_out tmp let () = print_int (out_channel_length oc) let () = output_string oc "test" let () = print_int (out_channel_length oc) let () = flush oc let () = print_int (out_channel_length oc) let () = output_string oc "test" let () = print_int (out_channel_length oc) let () = seek_out oc 0 let () = print_int (out_channel_length oc) |}; [%expect {| 00448 |}] let%expect_test _ = let tmp = Filename.temp_file "b" "txt" in let oc = open_out tmp in let () = print_int (out_channel_length oc) in let () = output_string oc "test" in let () = print_int (out_channel_length oc) in let () = flush oc in let () = print_int (out_channel_length oc) in let () = output_string oc "test" in let () = print_int (out_channel_length oc) in let () = seek_out oc 0 in let () = print_int (out_channel_length oc) in [%expect {| 00448 |}] let%expect_test _ = Util.compile_and_run {| let marshal_out ch v = Marshal.to_channel ch v []; flush ch let marshal_out_segment f ch v = let start = pos_out ch in Format.printf "start=%d\n%!" start; output_binary_int ch 0; (* dummy value for stop *) marshal_out ch v; let stop = pos_out ch in seek_out ch start; output_binary_int ch stop; seek_out ch stop; Digest.output ch (Digest.file f) let _ = let tmp = Filename.temp_file "out" "txt" in let filename = tmp in let chan = open_out filename in output_binary_int chan 8900; marshal_out_segment filename chan ["output";"data"]; marshal_out_segment filename chan ["more";"stuff"] |}; [%expect {| start=4 start=59 |}] let%expect_test _ = let module M = struct let marshal_out ch v = Marshal.to_channel ch v []; flush ch let marshal_out_segment f ch v = let start = pos_out ch in Format.printf "start=%d\n%!" start; output_binary_int ch 0; (* dummy value for stop *) marshal_out ch v; let stop = pos_out ch in seek_out ch start; output_binary_int ch stop; seek_out ch stop; Digest.output ch (Digest.file f) let _ = let tmp = Filename.temp_file "out" "txt" in let filename = tmp in let chan = open_out filename in output_binary_int chan 8900; marshal_out_segment filename chan [ "output"; "data" ]; marshal_out_segment filename chan [ "more"; "stuff" ] end in [%expect {| start=4 start=59 |}] js_of_ocaml-3.5.2/compiler/tests/dune000066400000000000000000000004361357507750000176420ustar00rootroot00000000000000(library (name jsoo_compiler_expect_tests) (libraries js_of_ocaml_compiler unix str) (inline_tests (flags -allow-output-patterns) (deps (file ../../compiler/js_of_ocaml.exe) (file ../../runtime/runtime.js))) (preprocess (pps ppx_expect))) (include_subdirs unqualified) js_of_ocaml-3.5.2/compiler/tests/eliminate_exception_handler.ml000066400000000000000000000035371357507750000250450ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util (* https://github.com/ocsigen/js_of_ocaml/issues/827 *) let%expect_test _ = let compile s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo |> compile_cmo_to_javascript ~pretty:true |> fst |> parse_js in let program = compile {| [@@@ocaml.warning "-26-27"] let some_name () = try raise Not_found with | f -> (try fun g -> 0 with h -> fun h -> raise Not_found) (let o = ( try fun a -> try try fun c -> 0 with q -> raise (Not_found) with | f -> raise Not_found with | h -> (raise Not_found) ) () in try let m = try [] with j -> [] in true with | s -> true) |} in print_fun_decl program (Some "some_name"); [%expect {| function some_name(param){try {throw Stdlib[8]}catch(_a_){return 0}} |}] js_of_ocaml-3.5.2/compiler/tests/empty_cma.ml000066400000000000000000000023271357507750000212750ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let%expect_test _ = compile_lib [] "empty" |> compile_cmo_to_javascript ~sourcemap:false |> fst |> Filetype.read_js |> Filetype.string_of_js_text |> print_endline; Sys.remove "empty.cma"; Sys.remove "empty.js"; [%expect {| (function(joo_global_object) {"use strict";var runtime=joo_global_object.jsoo_runtime;return} (function(){return this}())); |}] js_of_ocaml-3.5.2/compiler/tests/end_to_end.ml000066400000000000000000000022071357507750000214120ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let%expect_test _ = {| console.log("hello world") |} |> Filetype.js_text_of_string |> Filetype.write_js |> run_javascript |> print_endline; [%expect {| hello world |}] let%expect_test _ = compile_and_run {| print_endline "hello world" |}; [%expect {| hello world |}] js_of_ocaml-3.5.2/compiler/tests/exceptions.ml000066400000000000000000000035451357507750000215030ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util (* https://github.com/ocsigen/js_of_ocaml/issues/829 *) let%expect_test _ = let compile ~debug s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo ~debug |> compile_cmo_to_javascript ~pretty:true ~sourcemap:debug |> fst |> parse_js in let program ~debug = compile ~debug {| let some_name () = raise (try try raise Not_found with x -> x with i -> i) let prevent_inline = some_name |} in print_fun_decl (program ~debug:true) None; [%expect {| function some_name(param) {try {try {throw Stdlib[8]}catch(x){x = caml_wrap_exception(x);var i=x}} catch(i$0){i$0 = caml_wrap_exception(i$0);var i=i$0} throw i} |}]; print_fun_decl (program ~debug:false) None; [%expect {| function _a_(_b_) {try {try {throw Stdlib[8]} catch(_e_){_e_ = caml_wrap_exception(_e_);var _c_=_e_}} catch(_d_){_d_ = caml_wrap_exception(_d_);throw _d_} throw _c_} |}] js_of_ocaml-3.5.2/compiler/tests/getenv.ml000066400000000000000000000040371357507750000206070ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let%expect_test _ = compile_and_run ~flags:[ "--setenv"; "A=A" ] {| (match Sys.getenv "A" with | "A" -> () | _ -> print_endline "BUG")|}; [%expect {||}] let%expect_test _ = compile_and_run ~flags:[ "--setenv"; "A=A" ] {| (match Sys.getenv "B" with | exception Not_found -> () | _ -> print_endline "BUG")|}; [%expect {||}] let%expect_test _ = compile_and_run ~flags:[ "--setenv"; "A=A" ] {| (* fallback for older version of the stdlib *) let getenv_opt a = try Some (Sys.getenv a) with Not_found -> None open Sys;; (match getenv_opt "A" with | Some "A" -> () | _ -> print_endline "BUG")|}; [%expect {||}] let%expect_test _ = compile_and_run ~flags:[ "--setenv"; "A=A" ] {| (* fallback for older version of the stdlib *) let getenv_opt a = try Some (Sys.getenv a) with Not_found -> None open Sys;; (match getenv_opt "B" with | None -> () | Some _ -> print_endline "BUG")|}; [%expect {||}] let%expect_test _ = compile_and_run ~flags:[ "--setenv"; "D=±" ] {| (if Sys.ocaml_version >= "4.07" then match Sys.getenv "D" with | "\u{00b1}" -> () | _ -> print_endline "BUG")|}; [%expect {||}] js_of_ocaml-3.5.2/compiler/tests/gl507.ml000066400000000000000000000023761357507750000201610ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://github.com/ocsigen/js_of_ocaml/issues/507 *) (* https://github.com/ocsigen/js_of_ocaml/commit/e2f465dd1ac03da706ae086da37794184db21d31 *) let%expect_test _ = Util.compile_and_run {| let _ = let r = ref 0.0 in for _ = 1 to 100 do r := !r -. (-1.0 *. !r) done; (); print_endline "Success!" |}; [%expect {| Success! |}] js_of_ocaml-3.5.2/compiler/tests/ints.ml000066400000000000000000000022451357507750000202730ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let%expect_test _ = compile_and_run {| Scanf.sscanf "0.97.0" "%u.%u.%u" (fun major minor patch -> [major; minor; patch]) |}; [%expect {| |}] let%expect_test _ = Printf.printf "%d\n" (int_of_string "0u123"); [%expect {| 123 |}]; Printf.printf "%d\n" (int_of_string "0U123"); [%expect {| 123 |}] js_of_ocaml-3.5.2/compiler/tests/is_int.ml000066400000000000000000000026731357507750000206100ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://github.com/ocsigen/js_of_ocaml/issues/739 *) let%expect_test _ = Util.compile_and_run {| let r = ref false let f x = match Obj.is_int x with | true -> r := true; true | false -> r := false; false let print_bool b = print_endline (string_of_bool b) let () = print_string "[not (is_int 1)]: "; print_bool (not (f (Obj.repr 1))); print_string "[is_int (1,2,3)]: "; print_bool (f (Obj.repr (1, 2, 3))) |}; [%expect {| [not (is_int 1)]: false [is_int (1,2,3)]: false |}] js_of_ocaml-3.5.2/compiler/tests/js_parser_printer.ml000066400000000000000000000047271357507750000230600ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml_compiler let print ~compact source = let buffer = Buffer.create (String.length source) in let pp = Pretty_print.to_buffer buffer in Pretty_print.set_compact pp compact; let lexed = Parse_js.lexer_from_string source in let parsed = Parse_js.parse lexed in Js_output.program pp parsed; print_endline (Buffer.contents buffer) let%expect_test "no postfix addition coalesce" = print ~compact:true "a + +b"; [%expect {| a+ +b; |}] let%expect_test "no postfix subtraction coalesce" = print ~compact:true "a - -b"; [%expect {| a- -b; |}] let%expect_test "reserved words as fields" = print ~compact:false {| x.debugger; x.catch; x.for; x.continue; var y = { debugger : 2 } var y = { catch : 2 } var y = { for : 2 } var y = { continue : 2 } |}; [%expect {| x.debugger; x.catch; x.for; x.continue; var y={debugger:2}; var y={catch:2}; var y={for:2}; var y={continue:2}; |}] let%expect_test "preserve number literals" = print ~compact:false {| var x = 0xffff; var x = 0Xffff; var y = 071923; var y = 07123; var z = 0.0; var z = 0.; var t = 1.0e-3; var t = 1.0E+3; var t = 1e-3; var t = 1E+3; |}; [%expect {| var x=0xffff; var x=0Xffff; var y=071923; var y=07123; var z=0.0; var z=0.; var t=1.0e-3; var t=1.0E+3; var t=1e-3; var t=1E+3; |}] let%expect_test "preserve number literals in property_name" = print ~compact:false {| var number_as_key = { 100000000000000000000 : 2 }; |}; [%expect {| var number_as_key={100000000000000000000:2}; |}] js_of_ocaml-3.5.2/compiler/tests/lazy.ml000066400000000000000000000031601357507750000202720ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let%expect_test "static eval of string get" = let compile s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo |> compile_cmo_to_javascript ~pretty:true |> fst |> parse_js in let program = compile {| let lz = lazy ( List.map (fun x -> x * x) [8;9] ) let rec do_the_lazy_rec n = if n = 0 then [] else (Lazy.force lz) :: do_the_lazy_rec (n-1) let _ = do_the_lazy_rec 8 |} in print_fun_decl program (Some "do_the_lazy_rec"); [%expect {| function do_the_lazy_rec(n) {if(0 === n)return 0; var _b_=do_the_lazy_rec(n - 1 | 0), _c_=runtime.caml_obj_tag(lz), _d_=250 === _c_?lz[1]:246 === _c_?caml_call1(CamlinternalLazy[2],lz):lz; return [0,_d_,_b_]} |}] js_of_ocaml-3.5.2/compiler/tests/macro.ml000066400000000000000000000074431357507750000204240ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Jsoo = Js_of_ocaml_compiler let print_macro_transformed source = let buffer = Buffer.create (String.length source) in let pp = Jsoo.Pretty_print.to_buffer buffer in Jsoo.Pretty_print.set_compact pp false; let source = source |> Util.Filetype.js_text_of_string |> Util.Filetype.write_js in let parsed = Util.parse_js source in let transformed = Jsoo.Macro.f parsed in Jsoo.Js_output.program pp transformed; print_endline (Buffer.contents buffer) let print_macro_transformed source = try print_macro_transformed source with Failure s -> Format.printf "failure: %s%!" s let%expect_test "BLOCK()" = print_macro_transformed "BLOCK()"; [%expect {| failure: macro BLOCK called with inappropriate arguments |}] let%expect_test "TAG()" = print_macro_transformed "TAG()"; [%expect {| failure: macro TAG called with inappropriate arguments |}] let%expect_test "LENGTH()" = print_macro_transformed "LENGTH()"; [%expect {| failure: macro LENGTH called with inappropriate arguments |}] let%expect_test "FIELD()" = print_macro_transformed "FIELD()"; [%expect {| failure: macro FIELD called with inappropriate arguments |}] let%expect_test "ISBLOCK()" = print_macro_transformed "ISBLOCK()"; [%expect {| failure: macro ISBLOCK called with inappropriate arguments |}] let%expect_test "BLOCK(1)" = print_macro_transformed "BLOCK(1)"; [%expect {| failure: macro BLOCK called with inappropriate arguments |}] let%expect_test "BLOCK(tag)" = print_macro_transformed "BLOCK(tag)"; [%expect {| failure: macro BLOCK called with inappropriate arguments |}] let%expect_test "BLOCK(1, a)" = print_macro_transformed "BLOCK(1, a)"; [%expect {| [1,a]; |}] let%expect_test "BLOCK(1, a, b, c)" = print_macro_transformed "BLOCK(1, a, b, c)"; [%expect {| [1,a,b,c]; |}] let%expect_test "BLOCK(077, a)" = print_macro_transformed "BLOCK(077, a)"; [%expect {| [63,a]; |}] let%expect_test "BLOCK(0779, a)" = print_macro_transformed "BLOCK(0779, a)"; [%expect {| [779,a]; |}] let%expect_test "TAG(a)" = print_macro_transformed "TAG(a)"; [%expect {| a[0]; |}] let%expect_test "LENGTH(a)" = print_macro_transformed "LENGTH(a)"; [%expect {| a.length - 1; |}] let%expect_test "FIELD(a)" = print_macro_transformed "FIELD(a)"; [%expect {| failure: macro FIELD called with inappropriate arguments |}] let%expect_test "FIELD(a, b)" = print_macro_transformed "FIELD(a, b)"; [%expect {| failure: macro FIELD called with inappropriate arguments |}] let%expect_test "FIELD(a, b << 5)" = print_macro_transformed "FIELD(a, b << 5)"; [%expect {| failure: macro FIELD called with inappropriate arguments |}] let%expect_test "FIELD(a, 0)" = print_macro_transformed "FIELD(a, 0)"; [%expect {| a[1]; |}] let%expect_test "FIELD(a, -1)" = print_macro_transformed "FIELD(a, -1)"; [%expect {| failure: Negative field indexes are not allowed |}] let%expect_test "ISBLOCK(a)" = print_macro_transformed "ISBLOCK(a)"; [%expect {| typeof a !== "number"; |}] js_of_ocaml-3.5.2/compiler/tests/match_with_exn.ml000066400000000000000000000056271357507750000223260ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://github.com/ocsigen/js_of_ocaml/issues/400 *) (* https://github.com/ocsigen/js_of_ocaml/pull/402 *) let%expect_test _ = Util.compile_and_run {| exception A exception B of int let a_exn () = raise A (* Make sure that [a] doesn't look constant *) let a () = if Random.int 1 + 1 = 0 then 2 else 4 let b_exn () = raise (B 2) (* https://github.com/ocsigen/js_of_ocaml/issues/400 * match .. with exception is no compiled properly *) let () = assert ( try match a () with | exception (A | B _) -> true | _n -> b_exn () with B _ -> true); print_endline "Success!" |}; [%expect "Success!"] open Util let run_test s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo |> compile_cmo_to_javascript ~pretty:true |> fst |> parse_js let%expect_test "static eval of string get" = let program = run_test {| exception A of int let fun1 () = match Random.int 2 with | 0 as i | exception A (2 as i) -> i | i -> i+1 | exception A i -> i+2 let fun2 () = match Random.int 2 with | 0 as i | exception A (2 as i) -> i | i -> i+1 |} in print_fun_decl program (Some "fun1"); print_fun_decl program (Some "fun2"); [%expect {| function fun1(param) {try {var i$0=caml_call1(Stdlib_random[5],2),switch$0=0} catch(_d_) {_d_ = caml_wrap_exception(_d_); if(_d_[1] !== A)throw _d_; var _c_=_d_[2]; if(2 !== _c_)return _c_ + 2 | 0; var i=_c_,switch$0=1} if(! switch$0){if(0 !== i$0)return i$0 + 1 | 0;var i=i$0} return i} function fun2(param) {try {var i$0=caml_call1(Stdlib_random[5],2),switch$0=0} catch(_b_) {_b_ = caml_wrap_exception(_b_); if(_b_[1] === A) {var _a_=_b_[2]; if(2 === _a_)var i=_a_,switch$0=1,switch$1=0;else var switch$1=1} else var switch$1=1; if(switch$1)throw _b_} if(! switch$0){if(0 !== i$0)return i$0 + 1 | 0;var i=i$0} return i} |}] js_of_ocaml-3.5.2/compiler/tests/mutable_closure.ml000066400000000000000000000045771357507750000225150ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) let%expect_test _ = Util.compile_and_run {| let log_success () = print_endline "Success!" let log_failure = Printf.printf "Failure! %s" let direct = ref [] let indirect = ref [] let () = for i = 0 to 3 do let rec f = function | 0 -> i | -1 -> g (-2) (* deadcode or infinite loop *) | n -> g (pred n) and g = function | 0 -> i | -1 -> f (-2) (* deadcode or infinite loop *) | n -> f (pred n) in direct := f i :: !direct; indirect := (fun () -> f i) :: !indirect done; let indirect = List.map (fun f -> f ()) !indirect in let direct = !direct in assert (indirect = direct) let () = let delayed = ref (fun () -> ()) in for i = 1 to 2 do let rec f n = function | 0 -> assert (i = n) | j -> delayed := let prev = !delayed in fun () -> prev (); f (succ n + i - i) (pred j) in f 0 i done; !delayed () let _ = let l_fun = ref [] in let l_var = ref [] in let l_base = [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10] in for i = 0 to 10 do l_fun := (fun () -> i) :: !l_fun; l_var := i :: !l_var done; let sum l = List.fold_left ( + ) 0 l in let sum_base = sum l_base in if sum !l_var <> sum_base then log_failure "l_var" else if sum (List.map (fun f -> f ()) !l_fun) <> sum_base then log_failure "l_fun" else log_success () |}; [%expect "Success!"] js_of_ocaml-3.5.2/compiler/tests/nodefs.ml000066400000000000000000000021611357507750000205710ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) let%expect_test _ = Util.compile_and_run {| let ic = open_in "nodefs.ml" let l = ref [] let () = try while true do l := input_line ic :: !l done with End_of_file -> () let () = print_int (List.length !l) |}; [%expect {| 33 |}] js_of_ocaml-3.5.2/compiler/tests/obj.ml000066400000000000000000000052651357507750000200750ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let run_test s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo |> compile_cmo_to_javascript ~pretty:true |> fst |> parse_js let%expect_test "static eval of string get" = let program = run_test {| [@@@ocaml.warning "-3"] let my_is_block x = Obj.is_block (Obj.repr x) let my_is_int x = Obj.is_int (Obj.repr x) let my_tag x = Obj.tag (Obj.repr [x]) let my_size x = Obj.size (Obj.repr x) let my_field x i = Obj.field (Obj.repr x) i let my_set_field x i o = Obj.set_field (Obj.repr x) i o let my_set_tag x t = Obj.set_tag (Obj.repr [x]) t let my_new_block x l = Obj.new_block (x + 1) 3 let my_dup t = Obj.dup (Obj.repr [t]) let my_truncate t i = Obj.truncate (Obj.repr [t]) i |} in print_fun_decl program (Some "my_is_block"); print_fun_decl program (Some "my_is_int"); print_fun_decl program (Some "my_tag"); print_fun_decl program (Some "my_size"); print_fun_decl program (Some "my_field"); print_fun_decl program (Some "my_set_field"); print_fun_decl program (Some "my_set_tag"); print_fun_decl program (Some "my_new_block"); print_fun_decl program (Some "my_dup"); print_fun_decl program (Some "my_truncate"); [%expect {| function my_is_block(x){return caml_call1(Stdlib_obj[1],x)} function my_is_int(x){return typeof x === "number"?1:0} function my_tag(x){return runtime.caml_obj_tag([0,x,0])} function my_size(x){return x.length - 1} function my_field(x,i){return x[1 + i]} function my_set_field(x,i,o){x[1 + i] = o;return 0} function my_set_tag(x,t){return runtime.caml_obj_set_tag([0,x,0],t)} function my_new_block(x,l){return runtime.caml_obj_block(x + 1 | 0,3)} function my_dup(t){return [0,t,0].slice()} function my_truncate(t,i){return runtime.caml_obj_truncate([0,t,0],i)} |}] js_of_ocaml-3.5.2/compiler/tests/obj_dup.ml000066400000000000000000000040241357507750000207350ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://github.com/ocsigen/js_of_ocaml/issues/666 *) (* https://github.com/ocsigen/js_of_ocaml/pull/725 *) let%expect_test _ = Util.compile_and_run {| let print_bool b = print_endline (string_of_bool b) let () = let s = "Hello" in let s' : string = Obj.obj (Obj.dup (Obj.repr s)) in print_bool (s = s'); print_bool (s != s') let () = let s = Bytes.of_string "Hello" in let s' : bytes = Obj.obj (Obj.dup (Obj.repr s)) in print_bool (s = s'); print_bool (s != s'); Bytes.set s' 1 'a'; print_bool (s <> s') |}; [%expect {| true true true true true |}] let%expect_test _ = Util.compile_and_run {| let r = ref false let f x = match Obj.is_int x with | true -> r := true; true | false -> r := false; false let print_bool b = print_endline (string_of_bool b) let () = print_string "[not (is_int 1)]: "; print_bool (not (f (Obj.repr 1))); print_string "[is_int (1,2,3)]: "; print_bool (f (Obj.repr (1, 2, 3))) |}; [%expect {| [not (is_int 1)]: false [is_int (1,2,3)]: false |}] js_of_ocaml-3.5.2/compiler/tests/side_effect.ml000066400000000000000000000033211357507750000215520ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://github.com/ocsigen/js_of_ocaml/issues/177 *) (* https://github.com/ocsigen/js_of_ocaml/pull/178 *) let%expect_test _ = Util.compile_and_run {| let i = ref 0 let log_success () = print_endline "Success!" let log_failure = Printf.printf "Failure! %s" let side_effect yes label = if yes then ( Printf.printf "Side effect: %s\n%!" label; incr i); 0 let _ = side_effect false "this is only to avoid inlining" let f = match side_effect true "Should only see this once" with | 0 | 1 | 2 -> Printf.printf "Please don't optimize this away\n%!" | _ -> Printf.printf "Or this\n%!" let _ = if !i = 1 then log_success () else log_failure "side effect computed twice" |}; [%expect {| Side effect: Should only see this once Please don't optimize this away Success! |}] js_of_ocaml-3.5.2/compiler/tests/static_eval.ml000066400000000000000000000033011357507750000216060ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let run_test s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo |> compile_cmo_to_javascript ~pretty:true |> fst |> parse_js let%expect_test "static eval of string get" = let program = run_test {| let lr = ref [] let black_box v = lr := (Obj.repr v) :: !lr let constant = "abcdefghijklmnopqrstuvwxyz" let call_with_char c = black_box c let ex = call_with_char constant.[-10] ;; black_box ex let ax = call_with_char constant.[6] ;; black_box ax let bx = call_with_char constant.[30] ;; black_box bx ;; |} in print_var_decl program "ex"; print_var_decl program "ax"; print_var_decl program "bx"; [%expect {| var ex = call_with_char(caml_string_get(constant,- 10)); var ax = call_with_char(103); var bx = call_with_char(caml_string_get(constant,30)); |}] js_of_ocaml-3.5.2/compiler/tests/stdio.ml000066400000000000000000000017701357507750000204420ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) let%expect_test _ = Util.compile_and_run {| let () = print_endline "the • and › characters" |}; [%expect {| the • and › characters |}] js_of_ocaml-3.5.2/compiler/tests/tailcall.ml000066400000000000000000000026521357507750000211050ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://github.com/ocsigen/js_of_ocaml/commit/a1a24b53e3e25af30b30e2e1779991db1055143e *) let%expect_test _ = Util.compile_and_run {| let log_success () = print_endline "Success!" let log_failure = Printf.printf "Failure! %s" let _ = let rec odd x = if x = 0 then false else even (x - 1) and even x = if x = 0 then true else odd (x - 1) in assert (odd 1 <> even 1); try ignore (odd 5000); log_success () with _ -> log_failure "too much recursion" |}; [%expect {| Success! |}] js_of_ocaml-3.5.2/compiler/tests/test_marshal.ml000066400000000000000000000131771357507750000220120ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Shachar Itzhaky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://github.com/ocsigen/js_of_ocaml/pull/814 *) let%expect_test _ = Util.compile_and_run {| type sign = SPlus | SMinus type raw_numeral = int type prim_token = | Numeral of sign * raw_numeral | String of string type operator_token = Add | Sub | Times | PlusPlus type expr = | Literal of prim_token | Op of operator_token * expr list let write_out chan v = let start = pos_out chan in Marshal.to_channel chan v []; pos_out chan - start let write_out_noshare chan v = let start = pos_out chan in Marshal.to_channel chan v [Marshal.No_sharing]; pos_out chan - start let _ = let tmp_filename = Filename.temp_file "out" "txt" in let chan = open_out tmp_filename in let v1 = Op (Add, [Literal (Numeral (SPlus, 5)); Literal (Numeral (SMinus, 7))]) in let v2 = Op (Times, [v1; v1]) (* shared *) in let v1_sz = write_out chan v1 in let v2_sz = write_out chan v2 in let v2_ns_sz = write_out_noshare chan v2 in flush chan; Format.printf "sizes = %d %d %d (|v2| %s |v2_ns|)\n%!" v1_sz v2_sz v2_ns_sz (if v2_sz < v2_ns_sz then "<" else ">="); let chan = open_in tmp_filename in let v1' = Marshal.from_channel chan in let v2' = Marshal.from_channel chan in Format.printf "readback = %B %B\n%!" (v1 = v1') (v2 = v2') |}; [%expect {| sizes = 33 40 51 (|v2| < |v2_ns|) readback = true true |}] (* https://github.com/ocsigen/js_of_ocaml/issues/359 *) let%expect_test _ = let module M = struct type loop = { mutable pointer : loop option } let l = { pointer = None } let () = l.pointer <- Some l let _ = let s = Marshal.to_string l [] in Format.printf "%d\n%S\n%!" (String.length s) s end in [%expect {| 24 "\132\149\166\190\000\000\000\004\000\000\000\002\000\000\000\004\000\000\000\004\144\144\004\002" |}] let%expect_test _ = Util.compile_and_run {| type loop = { mutable pointer : loop option } let l = { pointer = None } let () = l.pointer <- Some l let _ = let s = Marshal.to_string l [] in Format.printf "%d\n%S\n%!" (String.length s) s |}; [%expect {| 24 "\132\149\166\190\000\000\000\004\000\000\000\002\000\000\000\004\000\000\000\004\144\144\004\002" |}] let%expect_test _ = Util.compile_and_run {|Printf.printf "%S" (Marshal.to_string [| 0L; 1L |] [])|}; [%expect {| "\132\149\166\190\000\000\000\025\000\000\000\003\000\000\000\011\000\000\000\t\160\025_j\000\000\000\000\000\000\000\000\000\025_j\000\000\000\000\000\000\000\000\001" |}]; Util.compile_and_run {| let data = "\132\149\166\190\000\000\000\012\000\000\000\001\000\000\000\004\000\000\000\003\025_j\000\000\000\000\000\000\000\000\001" let v = Marshal.from_string data 0 let () = assert (1L = v) |}; [%expect {||}]; Util.compile_and_run {| let data = "\132\149\166\190\000\000\000\012\000\000\000\001\000\000\000\004\000\000\000\003\018_j\000\000\000\000\000\000\000\000\001" let v = Marshal.from_string data 0 let () = assert (1L = v) |}; [%expect {||}] let%expect_test _ = Util.compile_and_run {|Printf.printf "%S" (Marshal.to_string 1L [])|}; [%expect {| "\132\149\166\190\000\000\000\012\000\000\000\001\000\000\000\004\000\000\000\003\025_j\000\000\000\000\000\000\000\000\001" |}]; Printf.printf "%S" (Marshal.to_string 1L []); [%expect {| "\132\149\166\190\000\000\000\012\000\000\000\001\000\000\000\004\000\000\000\003\025_j\000\000\000\000\000\000\000\000\001" |}] let%expect_test _ = Util.compile_and_run {|Printf.printf "%S" (Marshal.to_string 1L [])|}; [%expect {| "\132\149\166\190\000\000\000\012\000\000\000\001\000\000\000\004\000\000\000\003\025_j\000\000\000\000\000\000\000\000\001" |}]; Printf.printf "%S" (Marshal.to_string 1L []); [%expect {| "\132\149\166\190\000\000\000\012\000\000\000\001\000\000\000\004\000\000\000\003\025_j\000\000\000\000\000\000\000\000\001" |}] let%expect_test _ = Util.compile_and_run {| let ba = Bigarray.Array1.create Int16_unsigned C_layout 3 in ba.{0} <- 3; ba.{1} <- 1; ba.{2} <- 2; Printf.printf "%S" (Marshal.to_string ba []) |}; [%expect {| "\132\149\166\190\000\000\000)\000\000\000\001\000\000\000\007\000\000\000\007\024_bigarray\000\000\000\000\020\000\000\000\000\000\000\000(\000\000\000\001\000\000\000\005\000\000\000\003\000\003\000\001\000\002" |}]; let ba = Bigarray.Array1.create Int16_unsigned C_layout 3 in ba.{0} <- 3; ba.{1} <- 1; ba.{2} <- 2; Printf.printf "%S" (Marshal.to_string ba []); [%expect {| "\132\149\166\190\000\000\000)\000\000\000\001\000\000\000\007\000\000\000\007\024_bigarray\000\000\000\000\020\000\000\000\000\000\000\000(\000\000\000\001\000\000\000\005\000\000\000\003\000\003\000\001\000\002" |}] js_of_ocaml-3.5.2/compiler/tests/time.ml000066400000000000000000000035411357507750000202540ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let%expect_test _ = compile_and_run {| print_float (Unix.time ()) |}; [%expect {| [0-9]+\. (regexp) |}] let%expect_test _ = compile_and_run {| print_float (Unix.gettimeofday ()) |}; [%expect {| [0-9]+\.[0-9]* (regexp) |}] let%expect_test _ = compile_and_run {| open Unix let {tm_sec; tm_min; tm_hour; tm_mday; tm_mon; tm_year; tm_wday; tm_yday; tm_isdst} = gmtime (time ()) ;; let gap () = print_char '\n';; print_int tm_sec; gap (); print_int tm_min; gap (); print_int tm_hour; gap (); print_int tm_mday; gap (); print_int tm_mon; gap (); print_int tm_year; gap (); print_int tm_wday; gap (); print_int tm_yday; gap (); print_endline (if tm_isdst then "true" else "false"); |}; [%expect {| [0-9]+ (regexp) [0-9]+ (regexp) [0-9]+ (regexp) [0-9]+ (regexp) [0-9]+ (regexp) [0-9]+ (regexp) [0-9]+ (regexp) [0-9]+ (regexp) true\|false (regexp) |}] js_of_ocaml-3.5.2/compiler/tests/util/000077500000000000000000000000001357507750000177365ustar00rootroot00000000000000js_of_ocaml-3.5.2/compiler/tests/util/filetype_intf.ml000066400000000000000000000021061357507750000231300ustar00rootroot00000000000000module type S = sig type ocaml_text type js_text type sourcemap_text type ocaml_file type js_file type sourcemap_file type cmo_file type bc_file val read_js : js_file -> js_text val read_map : sourcemap_file -> sourcemap_text val read_ocaml : ocaml_file -> ocaml_text val write_js : js_text -> js_file val write_ocaml : ocaml_text -> ocaml_file val js_text_of_string : string -> js_text val ocaml_text_of_string : string -> ocaml_text val string_of_js_text : js_text -> string val string_of_map_text : sourcemap_text -> string val string_of_ocaml_text : ocaml_text -> string val path_of_ocaml_file : ocaml_file -> string val path_of_js_file : js_file -> string val path_of_map_file : sourcemap_file -> string val path_of_cmo_file : cmo_file -> string val path_of_bc_file : bc_file -> string val ocaml_file_of_path : string -> ocaml_file val js_file_of_path : string -> js_file val map_file_of_path : string -> sourcemap_file val cmo_file_of_path : string -> cmo_file val bc_file_of_path : string -> bc_file end js_of_ocaml-3.5.2/compiler/tests/util/util.ml000066400000000000000000000210271357507750000212470ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Jsoo = Js_of_ocaml_compiler let ocamlc = try Sys.getenv "OCAMLC" with Not_found -> "ocamlc" let node = try Sys.getenv "NODE" with Not_found -> "node" let js_of_ocaml_root = try Sys.getenv "PROJECT_ROOT" with Not_found -> let regex_text = "_build/default" in let regex = Str.regexp regex_text in let left = Sys.getcwd () |> Str.split regex |> List.hd in Filename.concat left regex_text module Filetype : Filetype_intf.S = struct type ocaml_text = string type js_text = string type sourcemap_text = string type ocaml_file = string type sourcemap_file = string type js_file = string type cmo_file = string type bc_file = string let read_file file = let ic = open_in_bin file in let n = in_channel_length ic in let s = Bytes.create n in really_input ic s 0 n; close_in ic; Bytes.unsafe_to_string s let write_file ~suffix contents = let temp_file = Filename.temp_file "jsoo_test" suffix in let channel = open_out temp_file in Printf.fprintf channel "%s" contents; close_out channel; temp_file let read_js = read_file let read_map = read_file let read_ocaml = read_file let write_js = write_file ~suffix:".js" let write_ocaml = write_file ~suffix:".ml" let id x = x let js_text_of_string = id let ocaml_text_of_string = id let string_of_js_text = id let string_of_map_text = id let string_of_ocaml_text = id let path_of_ocaml_file = id let path_of_js_file = id let path_of_map_file = id let path_of_cmo_file = id let path_of_bc_file = id let ocaml_file_of_path = id let js_file_of_path = id let map_file_of_path = id let cmo_file_of_path = id let bc_file_of_path = id end let parse_js file = file |> Filetype.read_js |> Filetype.string_of_js_text |> Jsoo.Parse_js.lexer_from_string |> Jsoo.Parse_js.parse let channel_to_string c_in = let good_round_number = 1024 in let buffer = Buffer.create good_round_number in let rec loop () = Buffer.add_channel buffer c_in good_round_number; loop () in (try loop () with End_of_file -> ()); Buffer.contents buffer let exec_to_string_exn ~env ~cmd = let env = Array.concat [ Unix.environment (); Array.of_list env ] in let proc_result_ok std_out = let open Unix in function | WEXITED 0 -> std_out | WEXITED i -> Format.printf "process exited with error code %d\n %s" i cmd; std_out | WSIGNALED i -> Format.printf "process signaled with signal number %d\n %s" i cmd; std_out | WSTOPPED i -> Format.printf "process stopped with signal number %d\n %s" i cmd; std_out in let ((proc_in, _, proc_err) as proc_full) = Unix.open_process_full cmd env in let results = channel_to_string proc_in in let results' = channel_to_string proc_err in proc_result_ok (String.concat "\n" (List.filter (function | "" -> false | _ -> true) [ results'; results ])) (Unix.close_process_full proc_full) let run_javascript file = exec_to_string_exn ~env:[] ~cmd:(Format.sprintf "%s %s" node (Filetype.path_of_js_file file)) let swap_extention filename ~ext = Format.sprintf "%s.%s" (Filename.remove_extension filename) ext let compile_to_javascript ?(flags = []) ~pretty ~sourcemap file = let file_no_ext = Filename.chop_extension file in let out_file = swap_extention file ~ext:"js" in let extra_args = List.flatten [ (if pretty then [ "--pretty" ] else []) ; (if sourcemap then [ "--sourcemap" ] else []) ; [ "--no-runtime" ] ; [ Filename.concat js_of_ocaml_root "runtime/runtime.js" ] ; flags ] in let extra_args = String.concat " " extra_args in let compiler_location = Filename.concat js_of_ocaml_root "compiler/js_of_ocaml.exe" in let cmd = Format.sprintf "%s %s %s -o %s" compiler_location extra_args file out_file in let env = [ Format.sprintf "BUILD_PATH_PREFIX_MAP=/root/jsoo_test=%s" file_no_ext ] in let stdout = exec_to_string_exn ~env ~cmd in print_string stdout; (* this print shouldn't do anything, so if something weird happens, we'll get the results here *) let sourcemap_file = swap_extention file ~ext:"map" |> Filetype.map_file_of_path in Filetype.js_file_of_path out_file, if sourcemap then Some sourcemap_file else None let compile_bc_to_javascript ?flags ?(pretty = true) ?(sourcemap = true) file = Filetype.path_of_bc_file file |> compile_to_javascript ?flags ~pretty ~sourcemap let compile_cmo_to_javascript ?(pretty = true) ?(sourcemap = true) file = Filetype.path_of_cmo_file file |> compile_to_javascript ~pretty ~sourcemap let compile_ocaml_to_cmo ?(debug = true) file = let file = Filetype.path_of_ocaml_file file in let out_file = swap_extention file ~ext:"cmo" in let (stdout : string) = exec_to_string_exn ~env:[] ~cmd: (Format.sprintf "%s -c %s %s -o %s" ocamlc (if debug then "-g" else "") file out_file) in print_string stdout; Filetype.cmo_file_of_path out_file let compile_ocaml_to_bc file = let file = Filetype.path_of_ocaml_file file in let out_file = swap_extention file ~ext:"bc" in let (stdout : string) = exec_to_string_exn ~env:[] ~cmd:(Format.sprintf "%s -g unix.cma %s -o %s" ocamlc file out_file) in print_string stdout; Filetype.bc_file_of_path out_file let compile_lib list name = let out_file = swap_extention name ~ext:"cma" in let (stdout : string) = exec_to_string_exn ~env:[] ~cmd: (Format.sprintf "%s -g -a %s -o %s" ocamlc (String.concat " " (List.map Filetype.path_of_cmo_file list)) out_file) in print_string stdout; Filetype.cmo_file_of_path out_file let program_to_string ?(compact = false) p = let buffer = Buffer.create 17 in let pp = Jsoo.Pretty_print.to_buffer buffer in Jsoo.Pretty_print.set_compact pp compact; Jsoo.Js_output.program pp p; Buffer.contents buffer let expression_to_string ?(compact = false) e = let module J = Jsoo.Javascript in let p = [ J.Statement (J.Expression_statement e), J.N ] in program_to_string ~compact p class find_variable_declaration r n = object inherit Jsoo.Js_traverse.map as super method! variable_declaration v = (match v with | Jsoo.Javascript.S { name; _ }, _ when name = n -> r := v :: !r | _ -> ()); super#variable_declaration v end let print_var_decl program n = let r = ref [] in let o = new find_variable_declaration r n in ignore (o#program program); print_string (Format.sprintf "var %s = " n); match !r with | [ (_, Some (expression, _)) ] -> print_string (expression_to_string expression) | _ -> print_endline "not found" class find_function_declaration r n = object inherit Jsoo.Js_traverse.map as super method! source s = (match s with | Function_declaration fd -> let record = match fd, n with | _, None -> true | (Jsoo.Javascript.S { name; _ }, _, _, _), Some n -> name = n | _ -> false in if record then r := fd :: !r | Statement _ -> ()); super#source s end let print_fun_decl program n = let r = ref [] in let o = new find_function_declaration r n in ignore (o#program program); let module J = Jsoo.Javascript in match !r with | [ fd ] -> print_string (program_to_string [ J.Function_declaration fd, J.N ]) | [] -> print_endline "not found" | l -> print_endline (Format.sprintf "%d functions found" (List.length l)) let compile_and_run ?flags s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_bc |> compile_bc_to_javascript ?flags |> fst |> run_javascript |> print_endline js_of_ocaml-3.5.2/compiler/tests/util/util.mli000066400000000000000000000034111357507750000214150ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml_compiler module Filetype : Filetype_intf.S val parse_js : Filetype.js_file -> Javascript.program val compile_ocaml_to_cmo : ?debug:bool -> Filetype.ocaml_file -> Filetype.cmo_file val compile_ocaml_to_bc : Filetype.ocaml_file -> Filetype.bc_file val compile_lib : Filetype.cmo_file list -> string -> Filetype.cmo_file val compile_cmo_to_javascript : ?pretty:bool -> ?sourcemap:bool -> Filetype.cmo_file -> Filetype.js_file * Filetype.sourcemap_file option val compile_bc_to_javascript : ?flags:string list -> ?pretty:bool -> ?sourcemap:bool -> Filetype.bc_file -> Filetype.js_file * Filetype.sourcemap_file option val run_javascript : Filetype.js_file -> string val expression_to_string : ?compact:bool -> Javascript.expression -> string val print_var_decl : Javascript.program -> string -> unit val print_fun_decl : Javascript.program -> string option -> unit val compile_and_run : ?flags:string list -> string -> unit js_of_ocaml-3.5.2/compiler/tests/variable_declaration_output.ml000066400000000000000000000034361357507750000250730ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Ty Overby * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Util let%expect_test _ = let compile s = s |> Filetype.ocaml_text_of_string |> Filetype.write_ocaml |> compile_ocaml_to_cmo |> compile_cmo_to_javascript ~pretty:true |> fst |> parse_js in let program = compile {| type r = {x: int; y: string} let ex = {x = 5; y = "hello"} ;; let ax = [|1;2;3;4|] ;; let bx = [|1.0;2.0;3.0;4.0|] ;; let cx = [|0./.0.;-0./.0.;1./.0.;-1./.0.;0.;-0.|] ;; let (>>=) a b = a * b let (>>|) a b = a + b let (>>?=) a b = a / b let symbol_op = (>>=), (>>|), (>>?=);; |} in print_var_decl program "ex"; print_var_decl program "ax"; print_var_decl program "bx"; print_var_decl program "cx"; print_var_decl program "symbol_op"; [%expect {| var ex = [0,5,runtime.caml_new_string("hello")]; var ax = [0,1,2,3,4]; var bx = [254,1.,2.,3.,4.]; var cx = [254,NaN,NaN,Infinity,- Infinity,0.,- 0.]; var symbol_op = [0,symbol_bind,symbol_map,symbol]; |}] js_of_ocaml-3.5.2/compiler/util.ml000066400000000000000000000044471357507750000171370ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Js_of_ocaml_compiler.Stdlib let normalize_argv ?(warn_ = false) a = let bad = ref [] in let a = Array.map ~f:(fun s -> let size = String.length s in if size <= 2 then s else if Char.equal s.[0] '-' && (not (Char.equal s.[1] '-')) && not (Char.equal s.[2] '=') then ( bad := s :: !bad; (* long option with one dash lets double the dash *) "-" ^ s) else s) a in if warn_ && not (List.is_empty !bad) then warn "[Warning] long options with a single '-' are now deprecated. Please use '--' for \ the following options: %s@." (String.concat ~sep:", " !bad); a let temp_file_name = (* Inlined unavailable Filename.temp_file_name. Filename.temp_file gives us incorrect permissions. https://github.com/ocsigen/js_of_ocaml/issues/182 *) let prng = lazy (Random.State.make_self_init ()) in fun ~temp_dir prefix suffix -> let rnd = Random.State.bits (Lazy.force prng) land 0xFFFFFF in Filename.concat temp_dir (Printf.sprintf "%s%06x%s" prefix rnd suffix) let gen_file file f = let f_tmp = temp_file_name ~temp_dir:(Filename.dirname file) (Filename.basename file) ".tmp" in try let ch = open_out_bin f_tmp in (try f ch with e -> close_out ch; raise e); close_out ch; (try Sys.remove file with Sys_error _ -> ()); Sys.rename f_tmp file with exc -> Sys.remove f_tmp; raise exc js_of_ocaml-3.5.2/compiler/util.mli000066400000000000000000000020571357507750000173030ustar00rootroot00000000000000(* Js_of_ocaml compiler * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val normalize_argv : ?warn_:bool -> string array -> string array (** [normalize_argv argv] returns a new array of arguments where '-long-option' are replaced by '--long-option' *) val gen_file : string -> (out_channel -> unit) -> unit js_of_ocaml-3.5.2/dune000066400000000000000000000020671357507750000146700ustar00rootroot00000000000000(* -*- tuareg -*- *) open StdLabels open Jbuild_plugin.V1 let split_on_char ~sep s = let r = ref [] in let j = ref (String.length s) in for i = String.length s - 1 downto 0 do if String.unsafe_get s i = sep then ( r := String.sub s ~pos:(i + 1) ~len:(!j - i - 1) :: !r; j := i ) done; String.sub s ~pos:0 ~len:!j :: !r let git_version = if not (try Sys.is_directory ".git" with _ -> false) then "" else match run_and_read_lines "git log -n1 --pretty=format:%h" with | version :: _ -> version | [] -> "" let version = let ic = open_in "VERSION" in let version = input_line ic in close_in ic; version let extra_warnings = let v = split_on_char ~sep:'.' ocaml_version in if v < ["4"; "03"] then "-45" else "" let () = send @@ Printf.sprintf {| (env (dev (flags (:standard -w +a-4-40-41-42-44-48-58-66%s)))) (rule (targets version.ml.in) (action (with-stdout-to %%{targets} (echo "let s = \"%s\"\nlet git_version = \"%s\"")))) |} extra_warnings version git_version js_of_ocaml-3.5.2/dune-project000066400000000000000000000000631357507750000163260ustar00rootroot00000000000000(lang dune 1.11) (using fmt 1.0) (name js_of_ocaml)js_of_ocaml-3.5.2/dune-workspace.dev000066400000000000000000000006201357507750000174320ustar00rootroot00000000000000(lang dune 1.11) ;; Install the following opam switches, copy this file as ;; jbuild-workspace and run: ;; ;; $ dune build @install ;; ;; This will build js_of_ocaml against all these version of OCaml (context (opam (switch 4.02.3))) (context (opam (switch 4.03.0))) (context (opam (switch 4.04.2))) (context (opam (switch 4.05.0))) (context (opam (switch 4.06.1))) (context (opam (switch 4.07.1))) js_of_ocaml-3.5.2/examples/000077500000000000000000000000001357507750000156235ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/README.md000066400000000000000000000003641357507750000171050ustar00rootroot00000000000000# Example projects Build all projects: ``` $> dune build @examples/default ``` Or a single one: ``` $> dune build @examples//default ``` Compilation artifacts can be found in `${REPO_ROOT}/_build/default/examples/`. js_of_ocaml-3.5.2/examples/boulderdash/000077500000000000000000000000001357507750000201175ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/boulderdash/LICENSE000066400000000000000000000013521357507750000211250ustar00rootroot00000000000000 All files contained in this directory and its sub-directories are distributed under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE (included below). ------------------------------------------------------------------------ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar 14 rue de Plaisance, 75014 Paris, France Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. js_of_ocaml-3.5.2/examples/boulderdash/README000066400000000000000000000000731357507750000207770ustar00rootroot00000000000000This is a port of the Boulder Dash example from O'Browser. js_of_ocaml-3.5.2/examples/boulderdash/boulderdash.ml000066400000000000000000000361201357507750000227470ustar00rootroot00000000000000(* Js_of_ocaml examples * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2008 Benjamin Canou * * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION * *) open Js_of_ocaml open Js_of_ocaml_lwt let ( >>= ) = Lwt.bind module Html = Dom_html let js = Js.string let document = Html.window##.document let append_text e s = Dom.appendChild e (document##createTextNode (js s)) let replace_child p n = Js.Opt.iter p##.firstChild (fun c -> Dom.removeChild p c); Dom.appendChild p n let box_style = js "border: 1px black solid; background-color: white ; display: inline ; padding-right: \ .5em; padding-left: .5em;" let loading_style = js "background-color: red; color: white; display:inline; position: absolute; top:0; \ right:0;" let loading parent = let div = Html.createDiv document in div##.style##.cssText := loading_style; append_text div "LOADING..."; Dom.appendChild parent div; fun () -> Dom.removeChild parent div let clock_div () = let t0 = ref (Sys.time ()) in let div = Html.createDiv document in div##.style##.cssText := box_style; append_text div "--:--:--"; let stopped = ref true in let rec update_cb () = let dt = Sys.time () -. !t0 in (if not !stopped then let str = let secs = int_of_float dt in js (Printf.sprintf "%02d:%02d:%02d" (secs / 3600) (secs / 60 mod 60) (secs mod 60)) in let txt = document##createTextNode str in replace_child div txt); Lwt_js.sleep 1. >>= fun () -> update_cb () in ignore (update_cb ()); ( div , (fun () -> t0 := Sys.time (); stopped := false) , fun () -> stopped := true ) type cell = | Empty | Grass | Diamond | Boulder | Door | End | Guy | Wall | Bam and state = { map : cell array array ; imgs : Html.imageElement Js.t array array ; mutable pos : int * int ; mutable endpos : int * int ; mutable rem : int ; mutable dead : bool ; mutable map_mutex : Lwt_mutex.t ; mutable events_mutex : bool ; mutable pending_out_cb : (unit -> unit) option ref } exception Death let img_assoc v = match v with | Empty -> js "sprites/empty.png" | Bam -> js "sprites/bam.png" | Grass -> js "sprites/grass.png" | Diamond -> js "sprites/diamond.png" | Boulder -> js "sprites/boulder.png" | End -> js "sprites/end.png" | Door -> js "sprites/door.png" | Guy -> js "sprites/guy.png" | Wall -> js "sprites/wall.png" let set_cell state x y v = state.map.(y).(x) <- v; state.imgs.(y).(x)##.src := img_assoc v let walkable = function | Empty | Grass | Diamond | End -> true | _ -> false let rec fall state = (* assumes wall borders *) let changed = ref false in for y = Array.length state.map - 2 downto 1 do for x = 1 to Array.length state.map.(y) - 2 do let sustaining = state.map.(y + 1).(x) = Guy && state.map.(y).(x) = Boulder in if state.map.(y).(x) = Empty && state.map.(y - 1).(x) = Boulder then ( set_cell state x (y - 1) Empty; set_cell state x y Boulder; changed := true); if state.map.(y).(x) = Empty && state.map.(y - 1).(x) = Empty && state.map.(y).(x - 1) = Boulder && state.map.(y - 1).(x - 1) = Boulder then ( set_cell state (x - 1) (y - 1) Empty; set_cell state x y Boulder; changed := true); if state.map.(y).(x) = Empty && state.map.(y - 1).(x) = Empty && state.map.(y).(x + 1) = Boulder && state.map.(y - 1).(x + 1) = Boulder then ( set_cell state (x + 1) (y - 1) Empty; set_cell state x y Boulder; changed := true); if (not sustaining) && state.map.(y + 1).(x) = Guy && state.map.(y).(x) = Boulder then ( set_cell state x (y + 1) Bam; raise Death) done done; if !changed then Lwt_js.sleep 0.05 >>= fun () -> fall state else Lwt.return () let rec build_interaction state show_rem ((_, _, clock_stop) as clock) = Lwt_mutex.lock state.map_mutex >>= fun () -> for y = 0 to Array.length state.map - 1 do for x = 0 to Array.length state.map.(y) - 1 do state.imgs.(y).(x)##.onmouseover := Html.no_handler; state.imgs.(y).(x)##.onmouseout := Html.no_handler; state.imgs.(y).(x)##.onclick := Html.no_handler done done; let inhibit f _x = if not state.events_mutex then ignore (state.events_mutex <- true; f () >>= fun () -> state.events_mutex <- false; Lwt.return ()); Js._false in let set_pending_out f out () = f () >>= fun () -> state.pending_out_cb := Some out; Lwt.return () in let with_pending_out f () = match !(state.pending_out_cb) with | None -> f () | Some out -> out (); state.pending_out_cb := None; f () in let rec update (x, y) next img over_cont out_cont click_cont = if walkable state.map.(y).(x) then ( let cur_img = state.imgs.(y).(x)##.src in let over () = state.imgs.(y).(x)##.src := img; over_cont () and out () = state.imgs.(y).(x)##.src := cur_img; out_cont () and click' () = click_cont () >>= fun () -> if state.map.(y).(x) = Diamond then state.rem <- state.rem - 1; set_cell state x y Guy; Lwt_js.sleep 0.05 >>= fun () -> fall state >>= fun () -> set_cell state x y Empty; Lwt.return () in let click () = let gx, gy = state.pos in set_cell state gx gy Empty; Lwt.catch (fun () -> click_cont () >>= fun () -> if state.map.(y).(x) = Diamond then state.rem <- state.rem - 1; set_cell state x y Guy; state.pos <- x, y; fall state) (fun e -> match e with | Death -> state.dead <- true; Lwt.return () | _ -> Lwt.fail e) >>= fun () -> build_interaction state show_rem clock in state.imgs.(y).(x)##.onmouseover := Html.handler (inhibit (set_pending_out (with_pending_out over) out)); state.imgs.(y).(x)##.onmouseout := Html.handler (inhibit (with_pending_out (fun () -> Lwt.return ()))); state.imgs.(y).(x)##.onclick := Html.handler (inhibit (with_pending_out click)); if state.map.(y).(x) <> End then update (next (x, y)) next img over out click') in let update_push ((x, y) as pos) next img img_guy = let ((x', y') as pos') = next pos in let x'', y'' = next pos' in if try state.map.(y').(x') = Boulder && state.map.(y'').(x'') = Empty with Invalid_argument _ -> false then ( let over () = state.imgs.(y).(x)##.src := img_guy; state.imgs.(y').(x')##.src := img; Lwt.return () in let out () = state.imgs.(y).(x)##.src := js "sprites/guy.png"; state.imgs.(y').(x')##.src := js "sprites/boulder.png" in let click () = set_cell state x y Empty; set_cell state x' y' Guy; state.pos <- pos'; set_cell state x'' y'' Boulder; Lwt.catch (fun () -> fall state) (fun e -> match e with | Death -> state.dead <- true; Lwt.return () | e -> Lwt.fail e) >>= fun () -> build_interaction state show_rem clock in state.imgs.(y').(x')##.onmouseover := Html.handler (inhibit (set_pending_out (with_pending_out over) out)); state.imgs.(y').(x')##.onmouseout := Html.handler (inhibit (with_pending_out (fun () -> Lwt.return ()))); state.imgs.(y').(x')##.onclick := Html.handler (inhibit (with_pending_out click))) in if state.pos = state.endpos then ( clock_stop (); Html.window##alert (js "YOU WIN !")) else if state.dead then ( clock_stop (); Html.window##alert (js "YOU LOSE !")) else ( if state.rem = 0 then ( let x, y = state.endpos in state.imgs.(y).(x)##.src := js "sprites/end.png"; state.map.(y).(x) <- End); let r (x, y) = succ x, y and l (x, y) = pred x, y in let u (x, y) = x, pred y and d (x, y) = x, succ y in let nil_cont () = () in let nil_cont_async () = Lwt.return () in update (r state.pos) r (js "sprites/R.png") nil_cont_async nil_cont nil_cont_async; update (l state.pos) l (js "sprites/L.png") nil_cont_async nil_cont nil_cont_async; update (u state.pos) u (js "sprites/U.png") nil_cont_async nil_cont nil_cont_async; update (d state.pos) d (js "sprites/D.png") nil_cont_async nil_cont nil_cont_async; update_push state.pos r (js "sprites/bR.png") (js "sprites/push_r.png"); update_push state.pos l (js "sprites/bL.png") (js "sprites/push_l.png"); show_rem state.rem); Lwt_mutex.unlock state.map_mutex; Lwt.return () let opt_style e style = match style with | Some s -> e##.style##.cssText := s | None -> () let build_table ?style ?tr_style ?td_style f t = let m = Html.createTable document in opt_style m style; for y = 0 to Array.length t - 1 do let tr = m##insertRow (-1) in opt_style tr tr_style; for x = 0 to Array.length t.(y) - 1 do let td = tr##insertCell (-1) in opt_style td td_style; Dom.appendChild td (f y x t.(y).(x)); Dom.appendChild tr td done; Dom.appendChild m tr done; m let http_get url = XmlHttpRequest.get url >>= fun r -> let cod = r.XmlHttpRequest.code in let msg = r.XmlHttpRequest.content in if cod = 0 || cod = 200 then Lwt.return msg else fst (Lwt.wait ()) let getfile f = try Lwt.return (Sys_js.read_file ~name:f) with Not_found -> http_get f exception Eos let start _ = let body = Js.Opt.get (document##getElementById (js "boulderdash")) (fun () -> assert false) in let board_div = Html.createDiv document in let ((clock_div, clock_start, _) as clock) = clock_div () in let load_data name process = let loading_end = loading body in getfile name >>= fun data -> process data >>= fun res -> loading_end (); Lwt.return res in let rem_div, show_rem = let div = Html.createDiv document in div##.style##.cssText := box_style; append_text div "--"; ( div , fun v -> replace_child div (document##createTextNode (Js.string (string_of_int v))) ) in load_data "maps.txt" (fun txt -> let find_string st = let sz = String.length txt in let rec find_string_start s = if s >= sz then raise Eos else if txt.[s] == '"' then find_string_end (s + 1) (s + 2) else find_string_start (s + 1) and find_string_end s e = if s >= sz then raise Eos else if txt.[e] == '"' then String.sub txt s (e - s), e + 1 else find_string_end s (e + 1) in find_string_start st in let rec scan_pairs st acc = match try let fst, st = find_string st in let snd, st = find_string st in Some ((fst, snd), st) with Eos -> None with | Some (elt, st) -> scan_pairs st (elt :: acc) | None -> acc in Lwt.return (List.rev (scan_pairs 0 []))) >>= fun levels -> let load_level file = load_data file (fun data -> let map, cells = let res = ref [] and row = ref [] in for i = 0 to String.length data - 1 do match data.[i] with | '\n' -> res := List.rev !row :: !res; row := [] | '#' -> row := Wall :: !row | '.' -> row := Grass :: !row | ' ' -> row := Empty :: !row | '+' -> row := Diamond :: !row | 'X' -> row := Boulder :: !row | 'W' -> row := Guy :: !row | 'E' -> row := Door :: !row | 'S' -> row := Guy :: !row | _ -> failwith "malformed level" done; let map = Array.of_list (List.map Array.of_list (List.rev !res)) in ( map , Array.map (Array.map (fun c -> let img = Html.createImg document in img##.src := img_assoc c; img)) map ) in let gx = ref 0 and gy = ref 0 and ex = ref 0 and ey = ref 0 and rem = ref 0 in let style = js "border-collapse:collapse;line-height: 0; opacity: 0; margin-left:auto; \ margin-right:auto" in let td_style = js "padding: 0; width: 20px; height: 20px;" in let table = build_table ~style ~td_style (fun y x cell -> (match map.(y).(x) with | Guy -> gx := x; gy := y | Diamond -> incr rem | Door -> ex := x; ey := y | _ -> ()); cell) cells in replace_child board_div table; build_interaction { map ; imgs = cells ; pos = !gx, !gy ; endpos = !ex, !ey ; map_mutex = Lwt_mutex.create () ; events_mutex = false ; dead = false ; rem = !rem ; pending_out_cb = ref None } show_rem clock >>= fun () -> let t0 = Sys.time () in let rec fade () = let t = Sys.time () in if t -. t0 >= 1. then ( table##.style##.opacity := Js.def (js "1"); Lwt.return ()) else Lwt_js.sleep 0.05 >>= fun () -> table##.style##.opacity := Js.def (js (Printf.sprintf "%g" (t -. t0))); fade () in fade () >>= fun () -> clock_start (); Lwt.return ()) in body##.style##.cssText := js "font-family: sans-serif; text-align: center; background-color: #e8e8e8;"; let h1 = Html.createH1 document in append_text h1 "Boulder Dash in Ocaml"; Dom.appendChild body h1; let div = Html.createDiv document in append_text div "Elapsed time: "; Dom.appendChild div clock_div; append_text div " Remaining diamonds: "; Dom.appendChild div rem_div; append_text div " "; let select = Html.createSelect document in let option = Html.createOption document in append_text option "Choose a level"; Dom.appendChild select option; List.iter (fun (_f, n) -> let option = Html.createOption document in append_text option n; (* option##onclick <- some (fun _ -> ignore (load_level f); Js._false); *) Dom.appendChild select option) levels; select##.onchange := Html.handler (fun _ -> let i = select##.selectedIndex - 1 in if i >= 0 && i < List.length levels then ignore (load_level (fst (List.nth levels i))); Js._false); Dom.appendChild div select; Dom.appendChild div (Html.createBr document); Dom.appendChild div (Html.createBr document); Dom.appendChild div board_div; Dom.appendChild body div; Lwt.return () let _ = Html.window##.onload := Html.handler (fun _ -> ignore (start ()); Js._false) js_of_ocaml-3.5.2/examples/boulderdash/dune000066400000000000000000000007311357507750000207760ustar00rootroot00000000000000(executables (names boulderdash) (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx))) (rule (targets boulderdash.js) (deps (glob_files maps/*.map)) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:boulderdash.bc} -o %{targets} --pretty -I ./ --file %{dep:maps.txt} --file maps))) (alias (name default) (deps boulderdash.js index.html (glob_files sprites/*.{png,svg}))) js_of_ocaml-3.5.2/examples/boulderdash/index.html000066400000000000000000000006521357507750000221170ustar00rootroot00000000000000 Boulder Dash js_of_ocaml-3.5.2/examples/boulderdash/maps.txt000066400000000000000000000003201357507750000216130ustar00rootroot00000000000000"maps/level0.map" "Level without boulders" "maps/level1.map" "Simple falls" "maps/level2.map" "More falls" "maps/level3.map" "Real (yet little) puzzle" "maps/level4.map" "Bigger puzzle (copie de BeeDeeDash)" js_of_ocaml-3.5.2/examples/boulderdash/maps/000077500000000000000000000000001357507750000210575ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/boulderdash/maps/level0.map000066400000000000000000000001441357507750000227440ustar00rootroot00000000000000################### #S........+.......# #+....+.........+## #...+........+.#.E# ################### js_of_ocaml-3.5.2/examples/boulderdash/maps/level1.map000066400000000000000000000002301357507750000227410ustar00rootroot00000000000000################## #S X # # # + #.X..XX....# # X #.+..++....# # + # + # # # XX # # . +. E# ################## js_of_ocaml-3.5.2/examples/boulderdash/maps/level2.map000066400000000000000000000002501357507750000227440ustar00rootroot00000000000000#################### #S# XXXXX # # # XX .XXX. # # # .XX. .X. # # # +. + # # ## XX # # +X. E# #################### js_of_ocaml-3.5.2/examples/boulderdash/maps/level3.map000066400000000000000000000002071357507750000227470ustar00rootroot00000000000000############## #XXXX# # #XXX+# + # #X..S# X## # #+ +X+# # # #X#X# # # +E.... # # #++ # ############## js_of_ocaml-3.5.2/examples/boulderdash/maps/level4.map000066400000000000000000000016061357507750000227540ustar00rootroot00000000000000######################################## #...... ..+.X .....X.X....... ....X....# #.XSX...... .........X+..X.... ..... ..# #.......... ..X.....X.X..X........X....# #X.XX.........X......X..X....X...X.....# #X. X......... X..X........X......X.XX.# #... ..X........X.....X. X........X.XX.# ###############################...X..X.# #. ...X..+. ..X.X..........+.X+...... .# #..+.....X..... ........XX X..X....X...# #...X..X.X..............X .X..X........# #.X.....X........XXX.......X.. .+....X.# #.+.. ..X. .....X.X+..+....X...X..+. .# #. X..............X X..X........+.....X# #........############################### # X.........X...+....X.....X...X.......# # X......... X..X........X......X.XX..E# #. ..X........X.....X. ....+...X.XX...# #....X+..X........X......X.X+......X...# #... ..X. ..X.XX.........X.X+...... ..X# #.+.... ..... ......... .X..X....X...X.# ######################################## js_of_ocaml-3.5.2/examples/boulderdash/sprites/000077500000000000000000000000001357507750000216105ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/boulderdash/sprites/D.png000066400000000000000000000006611357507750000225040ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<.IDAT8͒1KBQ\P"HkC&Trl6Ơ h+zzu>8\98_RDHiDF @h LEVsʿ#&ی?Pu a{{bso ze+q*6$~+7W|*G`X2a{?0&tVh57EZbZ%s֓nՀ3JP@ ,|aY K@ 4j|Lmk5pIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/L.png000066400000000000000000000006471357507750000225200ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<$IDAT8?K@/I%A\t`.NvӡNG'! B]kX}L *-?xs'3cqfzGR()5whT֏ ` X|I$oL*ΦZ s;%'Wց9@9pnt^ g(Vfx53Pi0\=/;kfݳv I> h:})Y5 `1ݖMX擖6_#AkM&U/RdiRtKIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/R.png000066400000000000000000000006631357507750000225240ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<0IDAT8픱JQE$+XDp[m [jmg`)J d*`a@s@@&&K·1ܙ7*I*(;ܽdnXt "g| ٹڞՋg&ݑFZwVN72E`6J:/WzY`#xVXs (^3[A_`oK?pٹʭ:jp ƀ"I[w jjWlKDl6ր I G91_&NmMIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/U.png000066400000000000000000000006411357507750000225230ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8͕JAE +"J4/2 ֢-Ҹeȳb$0 \>ޙNJ`W]\XO+ջS@.ik59ۺ|jg@# `^'y{Uj`uzmTJJvf[ށ|$\a8}<߈f #uڷhlbvڼg6j5p3?d5א_ٛ)`'@R 2=c`df?[oz* IENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/bD.png000066400000000000000000000020161357507750000226420ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8}MH\W}uf4IQ"5,܈2fY(teNwYhq]!;($%0:VG.2j{{=ܿ·R>48;@ 8rRpclllhxx[n}}4ɻw֖VWW "U>332ZE) ٳ@;0n?|cggG$"y}*J%) 2;;277@bׯ_#999|>/@K\>uﻮK2ZZ|ߧ:G)###OQTt0޷֒H$p]W>zmmmJ)RT*^McX<־'TT*UYkݭQqd2?~ k׮ݍ!"A)U}ߋÛH7(""0*Z1cH7$c!H>@k?8c Zx%z )c rk-,--qYtttf C466b$t\q2 By!r5Zk>|lmm& C0$2 lljj j۷o.Pa]ZRlnn099I&6"^YYq{{ Tr܎:sηOJWWJ)yQJ]^^իW@IHl_އR}IENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/bL.png000066400000000000000000000020001357507750000226430ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<}IDAT8OH\WLcf4Ѥ(d.*de: 3teC!B#0lBtS@\"Y 6FSTGgys{ttmi.sOC)ev $N4P_D3gORpellt:m__/_N7777~~#48@G^z'bQEk-Zk}_J z GS;;;rxx(AHgTTP(Ǐ|>/bQbcAP\.y2;; t5w<744twkk+""ǩVQՈ0 c Zk@卍_;::l !Z ˲3.G6ӮЛ7o6AȪYZk/noo@wk׾,K8x5*Jٳ^~TĆ1<<}ݟڶmXuEd"5 r]L&]ooW]]]\RT/ ӧO2lؽɱN|7 Pӎ'ɕzAIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/bR.png000066400000000000000000000020171357507750000226610ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8OH\W}:41(faMI KK*pE@!Ac "$BB6F$qJ.bw6ІDTgo, m}xQ"RJ9@@*@ E$>IP)w6NՅ ۷o_|cx@Gs 988h% C)efffc ֖J%JERT$ǏKh S@'O٬ Z1F1b\.K.e޾#͛766\.'T:\^~-jU0B ޽oM"R[n=pGR)D8%"8&ɰF$ \U###h<޾>J)(mVVVd2ύ7{TO E'Lw>|4;wd2'ϟ?'388Z[?)5 hii9caggOIӔe 8S1H$x8AX׮]`jjQZښRlX d"c1uݾP*>uLkCz@y}} FQ뺸8?޽{a1c Zk޼y wHD\}mDkpEXkr:T/~|Q6Z/_pGk`Z{ T*g~Z]]*JDj }hhhrxxƖr~`/'''x7_}bXeӧO1lzfzɍwޥIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/bU.png000066400000000000000000000020341357507750000226630ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8}?lW?v񟄖@D@C$6pE%b+c*s3RANMl0!%LXE8\7rww.}oz>zOK)e@Hm<R0>7773;;ӧ??uT`oo}M?'"" ޽^KՒoߊx'v[ܻw0 X}vkt$ Pq$ C Phȃր3FcL>\jj}Ze)RDk-Zkq]W,//q̓/_T(I*""*JfI˗TU(¶m$333W\r HXJ)|r;at:PTxP4M\ܹs$ LT7nܸ_R rt>+PJŋ/x.|۶xb>MY@͛ !ϟ… BEabTʾu_-؉'Aa""f#OJޫJJ_"mttt4iFvh4j[+++k=r @ &fIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/bam.png000066400000000000000000000017671357507750000230700ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<tIDAT8ohe?~pxuKFbh@3 Ĕ"1^ȩM"Jj?g?֋^I1Favwfuys|8s$2cLbU`+a=ZOc̄ IkWWg۠n?ِ,@Մnzv? 0b}2C@,'+c ,?Jsf(x(t䣲=:'{"5 }7~a? g`_|%-?~Jy2T֯M+mٔQ?zspƮ13@K2 5if[V 4.HFϔ?LCNpzC>,Ϟ靄MȎG6>HeF"ߵ) T,@ W湩ק8)cN0#k5͞w1SI㋹hVgYҩ\|@f'9RTbR@P$DQO>}7~mw:6=.ɔKe`[KW\ Ǫ>k N<޴v% hW_S[zIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/blue_diamond.png000066400000000000000000000017571357507750000247520ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<lIDAT8kU546q@HlمYqK?6qx3J)?hϿ$MֶVIƌqqt Q.gI&Wy3)`Po <>3L@khH$]ڊ::v4kW>3qB4bhޙznDO 3!jBֆƦkRتfob 4R(Q}0c|?Zk [ȩG;>}J)z^hfdZ#ʭ. j*r9VD)6Q*x*/eP.PQbKNNՌ\]el4RUDOr[T4֖ɦc#%H[}u^qcPjŲM8BmmJ) JJS)wO&NvCWA?HyX|6Zk(cTJG&S'ׁhp(>6 PUlb{d΋_g|󱶅ۋ'6I6<[b&;c-IENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/bomb.png000066400000000000000000000017241357507750000232410ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<QIDAT8Mh#e343Nڤ]m1XjSk .⩻^=.˶I=x|lE_[W3/w^?AgP)sY) !0LΞKRi. co~gzv/?W+>F0)}̘:???^P8e&Bަx  Qn$NDi>Q,tH$뺔J%666ja A#C!iid2,\ L$S,ձU OfkxUUbA&azz4$IFFF}BD+Rף!Nv뺄a8~Eg~p)0 SV p۶)Jb1lۦlyI?3VUsg^STu PU=,ˢ^.8@8ڶ=gY!lFiT*,¶mw$T*e]uEQ۶FO`wwr- <RvWwvv Pq]D"A$!ǡZRV *pdco xh!鴜R4 e@;G"tqUE@w88rv0 3hqР~P{nIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/boulder.png000066400000000000000000000016771357507750000237650ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<VU(ZkZKl6VG`1`oNN Z-j IBc&NuZ1F1b)=< |~ >'aJ!N[[[ Yk8R(]фa0l6;nZKQaC6Rze!DT*8jFѿ7:PC`ӤYܑ֚ ym4A:ƹYk}c ڎ[ kmϡ֚F///sIa.>k;q~Zk...΁{Q=}&ǛC[](~T*.V*S{vvvq%ZkZVt||@KH iZ ً6MӴ:#cݻ89rZN.X3[؉Dh aq\y?8ud`LW8#PiБAr !Djuu/0f' Z֌_1b 1T8c :OO} EMg v=7> " } pb@@(2&/0>>Ǚ"J r1""(D(1|?2"1\׵WnxNg5|Ⱥ ܏g/;=,<@"ߞ)h~ufN Whx.Wd=2[O[Z?Ś'oؑBIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/door.png000066400000000000000000000005251357507750000232630ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8Ք 0DmE\:H/[(>8d6qBԦС)$sWcH%@Id MAg1n6-\fVIl0~0pHfIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/empty.png000066400000000000000000000002441357507750000234540ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<!IDAT8c?5UM5pQG 5pi %%IENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/end.png000066400000000000000000000012021357507750000230570ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8jQ䇐J1 n,/WtRW"Aހ-$4dN8!M&wu}>P4֓J)= "vb<;7+&@ˮs!߾?ګYAt,slתg5vb!ʬs cr˜LpCXv-^|n|Bq&JϘ9 r+|N/g; i3J`$,٩l3v e)ҦN mmb5FzDӖ_͡8H|?-eTCHrhu E!cQc#A!k3\k(9\rmR"~aBhϬ&o "Kc)@ޕE7+`+VKF g-ۏfݧG#PMt >jMBneo#o??=Z9IENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/grass.png000066400000000000000000000013511357507750000234350ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<fIDAT81Ha`8s(ޗ-Cp;n9) H2d\t$ P<PC/!FY|!c:Q*s_ d:2hQL\-˳*$6 `}BhxJ҅m۾b+TQGQt.T\!Ķm~TPevt^VJyee @Z}8|y^dDԛ?kb[,}m}}|8>f`M }ᣦ 1~?2 yEJiYV& hYVFJ90ƌ!9_(˳kkk}0~L777b4͊RjK"S.4 $NZ"a5-"0JBLǙB㫗mkJ[˲2;<<̆ax7l] ,oʂi3EqAАRn.--Mf%pu]/h6|p䤊qCҳƨ8ܫ2M`K3"raz 3+:3IENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/guy.png000066400000000000000000000011711357507750000231220ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8ԿNA\V+Ƅ%/@Rև&4P\#w,rk$39ߙsִRJ #Hy1|-0EN䦐ǂAN`Tw?b'0ת,j Eep FHJϜ%BicE6huPjTG[ j5(N|0A4ZfG9ۘ)p>^0^ˏGKx9 -fk~ mPTϢ^XGh>}ؕ9`һiG>'v GKyx+b9r~|rRJ7{$ =è3^b] E\{w;x'QMSma>[$zwke?aMAT1/b> Е+|]vGѪaZL^ g"<|V`ǔ?Y nDԥ<IENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/push_l.png000066400000000000000000000012001357507750000236010ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8ջkQIn4% јVDA 5b!Gu M A_+BF0+EW✅5jp`sv||!ƨCؘ_cS1+ЁcTv~8p}ln,_\ \[AlFwn?nKqE z0GxiE?Pɘ@ v>b&w7H&W W/~=l CN _q6Ey1,Ix2xpw-VU+WAOq8 xB bEP4wત~t8!r% #)-:Kf؆sa2:ւ倥|߉%$!&nc$c!%Jm7I=6%Ɗg9ܧՓ@!&iGOR1&1[a02Gz% V$Ŝc z${d_B7(.(dIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/push_r.png000066400000000000000000000011531357507750000236160ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8?kTQn֘h, ]A4`ga'+-"`NS+I $wuex;s)RJJ+@ SXZ+0`-g(~^-8H;|=@Z؏fp&,Vz'bJNpo0St?3I(8y 66`m1hyRvIp};8*^h}gVFhWp!wUUWwr]"<`VUCIa8k <]-vϰ i wpZ,y`i1%@)u )?XuUIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/red_diamond.png000066400000000000000000000016261357507750000245700ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8_k\EO)6$UHDmz)j@߄^ aBKʶ٘,MDhMvI鞝y/Ĥm\ gO1fvMߵ11zi|pD22ű1@ZŨBXcz:{{,[^L ЬT0m՞=~)?o&'pa\(B)"tk #U%zx4XF5{/q Yz'SEUyݹXVy$ _[5{W3vaN߱wPfP@8alᑑ>hkw=NCO{,]:: @ejX{ D"Xq)iN7:zݻ{9UzT'¦XUls"{O"XɪbT>u@S@oA8r0' p IYXX1hRl{*"D",&!<RJ|-y/BSؼLLy`UuV:Zͮ1ky l=D ξޞpXչkc[,R)hD>I2EkdQ*Z tJV!'`Qt8TE7EĒ8@/#\FIENDB`js_of_ocaml-3.5.2/examples/boulderdash/sprites/scalable.svg000066400000000000000000001203361357507750000241040ustar00rootroot00000000000000 image/svg+xml js_of_ocaml-3.5.2/examples/boulderdash/sprites/wall.png000066400000000000000000000004651357507750000232620ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8!@@ѿzM%UPu 9D/ b$/fƙS%P83#|ڶbc̬9٧f>u{*ZUR :.j7?5Uzo7pbLDvb<LTZIENDB`js_of_ocaml-3.5.2/examples/cubes/000077500000000000000000000000001357507750000167245ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/cubes/cubes.ml000066400000000000000000000115161357507750000203630ustar00rootroot00000000000000(* Js_of_ocaml example * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js_of_ocaml_lwt let n = 12 let h = 20. let w = floor ((h *. sqrt 3. /. 2.) +. 0.5) (****) let _ = Random.self_init () let create_cubes v = Array.init n (fun _ -> Array.init n (fun _ -> Array.make n v)) let get a i j k = i < 0 || j < 0 || k < 0 || (i < n && j < n && k < n && a.(i).(j).(k)) let update a = let i = Random.int n in let j = Random.int n in let k = Random.int n in if a.(i).(j).(k) then if not (get a (i + 1) j k || get a i (j + 1) k || get a i j (k + 1)) then ( a.(i).(j).(k) <- false; true) else false else if get a (i - 1) j k && get a i (j - 1) k && get a i j (k - 1) then ( a.(i).(j).(k) <- true; true) else false (****) module Html = Dom_html let top = Js.string "#a8a8f6" let left = Js.string "#d9d9d9" let right = Js.string "#767676" let edge = Js.string "#000000" let on_cube c i j k f = let x = float (i - k + n - 1) *. w in let y = (float (n - 1 - j) *. h) +. (float (i + k) *. h /. 2.) in c##save; c##translate x y; f c; c##restore let draw_top c = c##.fillStyle := top; c##beginPath; c##moveTo w 0.; c##lineTo (2. *. w) (h /. 2.); c##lineTo w h; c##lineTo 0. (h /. 2.); c##fill let top_edges c = c##beginPath; c##moveTo 0. (h /. 2.); c##lineTo w 0.; c##lineTo (2. *. w) (h /. 2.); c##stroke let draw_right c = c##.fillStyle := right; c##beginPath; c##moveTo w h; c##lineTo w (2. *. h); c##lineTo (2. *. w) (1.5 *. h); c##lineTo (2. *. w) (h /. 2.); c##fill let right_edges c = c##beginPath; c##moveTo w (2. *. h); c##lineTo w h; c##lineTo (2. *. w) (h /. 2.); c##stroke let draw_left c = c##.fillStyle := left; c##beginPath; c##moveTo w h; c##lineTo w (2. *. h); c##lineTo 0. (1.5 *. h); c##lineTo 0. (h /. 2.); c##fill let left_edges c = c##beginPath; c##moveTo w h; c##lineTo 0. (h /. 2.); c##lineTo 0. (1.5 *. h); c##stroke let remaining_edges c = c##beginPath; c##moveTo 0. (float n *. 1.5 *. h); c##lineTo (float n *. w) (float n *. 2. *. h); c##lineTo (float n *. 2. *. w) (float n *. 1.5 *. h); c##lineTo (float n *. 2. *. w) (float n *. 0.5 *. h); c##stroke let tile c a (top, right, left) = for i = 0 to n - 1 do let j = ref (n - 1) in for k = 0 to n - 1 do while !j >= 0 && not a.(i).(!j).(k) do decr j done; on_cube c i !j k top done done; for j = 0 to n - 1 do let i = ref (n - 1) in for k = 0 to n - 1 do while !i >= 0 && not a.(!i).(j).(k) do decr i done; on_cube c !i j k right done done; for i = 0 to n - 1 do let k = ref (n - 1) in for j = 0 to n - 1 do while !k >= 0 && not a.(i).(j).(!k) do decr k done; on_cube c i j !k left done done let create_canvas () = let d = Html.window##.document in let c = Html.createCanvas d in c##.width := (n * 2 * truncate w) + 1; c##.height := (n * 2 * truncate h) + 1; c let redraw ctx canvas a = let c = canvas##getContext Html._2d_ in c##setTransform 1. 0. 0. 1. 0. 0.; c##clearRect 0. 0. (float canvas##.width) (float canvas##.height); c##setTransform 1. 0. 0. 1. 0.5 0.5; c##.globalCompositeOperation := Js.string "lighter"; tile c a (draw_top, draw_right, draw_left); c##.globalCompositeOperation := Js.string "source-over"; tile c a (top_edges, right_edges, left_edges); remaining_edges c; ctx##drawImage_fromCanvas canvas 0. 0. let ( >>= ) = Lwt.bind let rec loop c c' a = Lwt_js.sleep 0.2 >>= fun () -> let need_redraw = ref false in for _i = 0 to 99 do need_redraw := update a || !need_redraw done; if !need_redraw then redraw c c' a; loop c c' a let start _ = let c = create_canvas () in let c' = create_canvas () in Dom.appendChild Html.window##.document##.body c; let c = c##getContext Html._2d_ in c##.globalCompositeOperation := Js.string "copy"; let a = create_cubes true in redraw c c' a; ignore (loop c c' a); Js._false let _ = Html.window##.onload := Html.handler start js_of_ocaml-3.5.2/examples/cubes/dune000066400000000000000000000005151357507750000176030ustar00rootroot00000000000000(executables (names cubes) (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx))) (rule (targets cubes.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:cubes.bc} -o %{targets} --pretty))) (alias (name default) (deps cubes.js index.html)) js_of_ocaml-3.5.2/examples/cubes/index.html000066400000000000000000000005021357507750000207160ustar00rootroot00000000000000 Cubes js_of_ocaml-3.5.2/examples/dune000066400000000000000000000001021357507750000164720ustar00rootroot00000000000000(alias (name default) (deps index.html (glob_files *.{png}))) js_of_ocaml-3.5.2/examples/graph_viewer/000077500000000000000000000000001357507750000203055ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/graph_viewer/README.txt000066400000000000000000000004471357507750000220100ustar00rootroot00000000000000By default, only the Javascript viewer is compiled. To compile the GTK viewer and the converter from dot file to JSON, you need Lablgtk2 and Cairo-OCaml. Then, type: make -f Makefile-all The dot format is partially supported at the moment: only some basic styles are rendered correctly. js_of_ocaml-3.5.2/examples/graph_viewer/TODO.txt000066400000000000000000000025071357507750000216170ustar00rootroot00000000000000 * Browser viewer: - controls: keys - code for redrawing up to 4 rectangles in viewer_common.ml - round bounding boxes to integers - how costly is it to compute bounding boxes on the client? * GTK viewer - closing the window should quit the program * Dot parser on the client? * Viewers - tooltips - search for a package - share more code make it more modular: separate the viewport from the drawing code - should rescale the bounding box to a reasonable size - Use the following command for improved rendering: neato -n -T xdot /tmp/foo2.dot * Js_of_ocaml: - version number should be put in a single place (lib/META lib/syntax/pa_js.ml compiler/generate.ml) - unimplemented functions should raise an exception ==== ===> metadata ===> tooltips ===> if we do not have a bb, run the file through dot Try to make this generic (!) Functionalities =============== - search for a package ===> use metadata in the dot file - remove a package and recompute - follow an edge backwards and forwards - information on a node/edges Try WebGL? http://www.mdk.org.pl/2007/8/6/vector-drawing-opengl-shaders-and-cairo www.mdk.org.pl/2007/10/27/curvy-blues http://www.mdk.org.pl/2007/8/16/vector-drawing-opengl-polygon-tessellation http://www.mdk.org.pl/articles/2007/08/06/vector-drawing-opengl-shaders-and-cairo js_of_ocaml-3.5.2/examples/graph_viewer/converter.ml000066400000000000000000000040451357507750000226510ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Scene let offset_command x y c = match c with | Move_to (x1, y1) -> Move_to (x1 -. x, y1 -. y) | Curve_to (x1, y1, x2, y2, x3, y3) -> Curve_to (x1 -. x, y1 -. y, x2 -. x, y2 -. y, x3 -. x, y3 -. y) let offset_element x y e = match e with | Path (cmds, c1, c2) -> Path (Array.map (fun c -> offset_command x y c) cmds, c1, c2) | Polygon (pts, c1, c2) -> Polygon (Array.map (fun (x1, y1) -> x1 -. x, y1 -. y) pts, c1, c2) | Ellipse (cx, cy, rx, ry, c1, c2) -> Ellipse (cx -. x, cy -. y, rx, ry, c1, c2) | Text (x1, y1, txt, font, c1, c2) -> Text (x1 -. x, y1 -. y, txt, font, c1, c2) let _ = let ch = if Array.length Sys.argv > 1 then open_in Sys.argv.(1) else stdin in let _, g = Dot_graph.of_channel ch in let bbox, scene = Dot_render.f g in let x1, y1, x2, y2 = bbox in let l = Scene.get scene in let l = Array.map (fun e -> offset_element x1 y1 e) l in let bbox = 0., 0., x2 -. x1, y2 -. y1 in let i = Cairo.image_surface_create Cairo.FORMAT_ARGB32 1024 1024 in let bboxes = Scene_extents.compute (Cairo.create i) l in Format.printf "@[<1>[0,@,%a,@,%a,@,%a]@]@." Scene_json.rect_stringify bbox Scene_json.rect_array_stringify bboxes Scene_json.stringify l js_of_ocaml-3.5.2/examples/graph_viewer/dot_file.ml000066400000000000000000000024731357507750000224320ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type kind = [ `Graph | `Digraph ] type attr_type = [ `Graph | `Edge | `Node ] type attributes = (string * string) list type node = { name : string ; port : string option } type graph = { graph_name : string option ; body : statement list } and compound = [ `Node of node | `Graph of graph ] list * attributes and statement = [ `Attributes of attr_type * attributes | `Compound of compound ] type t = { kind : kind ; strict : bool ; graph : graph } js_of_ocaml-3.5.2/examples/graph_viewer/dot_file.mli000066400000000000000000000024731357507750000226030ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type kind = [ `Graph | `Digraph ] type attr_type = [ `Graph | `Edge | `Node ] type attributes = (string * string) list type node = { name : string ; port : string option } type graph = { graph_name : string option ; body : statement list } and compound = [ `Node of node | `Graph of graph ] list * attributes and statement = [ `Attributes of attr_type * attributes | `Compound of compound ] type t = { kind : kind ; strict : bool ; graph : graph } js_of_ocaml-3.5.2/examples/graph_viewer/dot_graph.ml000066400000000000000000000165711357507750000226200ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module IntSet = Set.Make (struct type t = int let compare (x : int) y = compare x y end) module IntMap = Map.Make (struct type t = int let compare (x : int) y = compare x y end) type id = int module IdMap = IntMap let last_id = ref (-1) let fresh_id () = incr last_id; !last_id type 'a sequence = { mutable count : int ; mutable seq : 'a IntMap.t ; id : (id, 'a) Hashtbl.t } let make_sequence () = { count = 0; seq = IntMap.empty; id = Hashtbl.create 17 } let sequence_add s id v = if not (Hashtbl.mem s.id id) then ( let n = s.count in s.count <- n + 1; s.seq <- IntMap.add n v s.seq; Hashtbl.add s.id id v) module StringMap = Map.Make (String) type node = { name : string ; id : id ; mutable node_attr : string StringMap.t } type edge = { head : node ; tail : node ; edge_id : id ; mutable edge_attr : string StringMap.t } type def_attr = { mutable g_attr : string StringMap.t ; mutable n_attr : string StringMap.t ; mutable e_attr : string StringMap.t } type graph = { graph_id : id ; graph_name : string option ; mutable graph_attr : string StringMap.t ; subgraphs : graph sequence ; nodes : node sequence ; edges : edge sequence ; parents : (id, graph) Hashtbl.t } type info = { kind : [ `Graph | `Digraph ] ; strict : bool } type st = { st_info : info ; st_graphs : (string, graph) Hashtbl.t ; st_nodes : (string, node) Hashtbl.t ; st_edges : (string * string * string, edge) Hashtbl.t } let make_def_attr () = { g_attr = StringMap.empty; n_attr = StringMap.empty; e_attr = StringMap.empty } let clone_def_attr a = { g_attr = a.g_attr; n_attr = a.n_attr; e_attr = a.e_attr } let rec all_parents s g = if IntMap.mem g.graph_id s then s else Hashtbl.fold (fun _ g s -> all_parents s g) g.parents (IntMap.add g.graph_id g s) let insert_graph parent g = if not (IntMap.mem g.graph_id (all_parents IntMap.empty parent)) then ( Hashtbl.add g.parents parent.graph_id parent; sequence_add parent.subgraphs g.graph_id g) let make_graph parent name def_attrs = let g = { graph_id = fresh_id () ; graph_name = name ; graph_attr = def_attrs.g_attr ; subgraphs = make_sequence () ; nodes = make_sequence () ; edges = make_sequence () ; parents = Hashtbl.create 17 } in (match parent with | Some parent -> insert_graph parent g | None -> ()); g let insert_node g n = let p = all_parents IntMap.empty g in IntMap.iter (fun _ g -> sequence_add g.nodes n.id n) p let make_node g name def_attrs = let node = { name; id = fresh_id (); node_attr = def_attrs.n_attr } in insert_node g node; node let insert_edge g e = let p = all_parents IntMap.empty g in IntMap.iter (fun _ g -> sequence_add g.edges e.edge_id e) p let make_edge g n1 n2 attrs = let edge = { tail = n1; head = n2; edge_id = fresh_id (); edge_attr = attrs } in insert_edge g edge; edge (****) let find_graph st parent name def_attrs = match name with | Some nm when Hashtbl.mem st.st_graphs nm -> let g = Hashtbl.find st.st_graphs nm in (match parent with | Some parent -> insert_graph parent g | None -> ()); g | _ -> let g = make_graph parent name def_attrs in (match name with | Some nm -> Hashtbl.add st.st_graphs nm g | None -> ()); g let find_node st g name def_attrs = try let n = Hashtbl.find st.st_nodes name in insert_node g n; n with Not_found -> let n = make_node g name def_attrs in Hashtbl.add st.st_nodes name n; n let lookup_edge st n1 n2 key = try Hashtbl.find st.st_edges (n1.name, n2.name, key) with Not_found when st.st_info.kind = `Graph -> Hashtbl.find st.st_edges (n2.name, n1.name, key) let find_edge st g n1 n2 key attrs = let key = if st.st_info.strict then Some "" else key in try let key = match key with | Some k -> k | None -> raise Not_found in let e = lookup_edge st n1 n2 key in insert_edge g e; e with Not_found -> let e = make_edge g n1 n2 attrs in (match key with | Some key -> Hashtbl.add st.st_edges (n1.name, n2.name, key) e | None -> ()); e (****) let add_attributes def l = List.fold_left (fun s (nm, v) -> StringMap.add nm v s) def l let get_edges x = match x with | `Node (n, p) -> IntMap.add 0 n IntMap.empty, p | `Graph gr -> gr.nodes.seq, None let opt_add nm v m = match v with | Some v -> StringMap.add nm v m | None -> m let add_edge st g n1 p1 n2 p2 key attrs = let attrs = opt_add "tailport" p1 (opt_add "headport" p2 attrs) in ignore (find_edge st g n1 n2 key attrs) let rec add_edges st g x r key attrs = match r with | [] -> () | y :: r -> let s1, p1 = get_edges x in let s2, p2 = get_edges y in IntMap.iter (fun _ n1 -> IntMap.iter (fun _ n2 -> add_edge st g n1 p1 n2 p2 key attrs) s2) s1; add_edges st g y r key attrs let rec compound_to_graph st g def_attr (c, attr) = let c = List.map (fun s -> match s with | `Node node -> `Node (find_node st g node.Dot_file.name def_attr, node.Dot_file.port) | `Graph gr -> `Graph (graph_def_to_graph st (Some g) def_attr gr)) c in match c with | [] -> assert false | [ `Node (n, _) ] -> n.node_attr <- add_attributes n.node_attr attr | [ `Graph _ ] -> () | x :: r -> let attrs = add_attributes def_attr.e_attr attr in let key = try Some (StringMap.find "key" attrs) with Not_found -> None in add_edges st g x r key attrs and body_to_graph st g def_attr body = List.iter (fun stmt -> match stmt with | `Compound c -> compound_to_graph st g def_attr c | `Attributes (typ, l) -> ( match typ with | `Graph -> def_attr.g_attr <- add_attributes def_attr.g_attr l | `Node -> def_attr.n_attr <- add_attributes def_attr.n_attr l | `Edge -> def_attr.e_attr <- add_attributes def_attr.e_attr l)) body and graph_def_to_graph st g def_attr gr = let g = find_graph st g gr.Dot_file.graph_name def_attr in let def_attr = clone_def_attr def_attr in body_to_graph st g def_attr gr.Dot_file.body; g.graph_attr <- def_attr.g_attr; g let of_file_spec f = let st = { st_info = { kind = f.Dot_file.kind; strict = f.Dot_file.strict } ; st_graphs = Hashtbl.create 101 ; st_nodes = Hashtbl.create 101 ; st_edges = Hashtbl.create 101 } in st.st_info, graph_def_to_graph st None (make_def_attr ()) f.Dot_file.graph let of_channel c = Dot_lexer.reset (); let g = Dot_parser.graph Dot_lexer.token (Lexing.from_channel c) in of_file_spec g js_of_ocaml-3.5.2/examples/graph_viewer/dot_graph.mli000066400000000000000000000031461357507750000227630ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module StringMap : Map.S with type key = string module IntMap : Map.S with type key = int type id type 'a sequence = { mutable count : int ; mutable seq : 'a IntMap.t ; id : (id, 'a) Hashtbl.t } type node = { name : string ; id : id ; mutable node_attr : string StringMap.t } type edge = { head : node ; tail : node ; edge_id : id ; mutable edge_attr : string StringMap.t } type graph = { graph_id : id ; graph_name : string option ; mutable graph_attr : string StringMap.t ; subgraphs : graph sequence ; nodes : node sequence ; edges : edge sequence ; parents : (id, graph) Hashtbl.t } type info = { kind : [ `Graph | `Digraph ] ; strict : bool } val of_file_spec : Dot_file.t -> info * graph val of_channel : in_channel -> info * graph js_of_ocaml-3.5.2/examples/graph_viewer/dot_lexer.mli000066400000000000000000000016241357507750000230000ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val reset : unit -> unit val token : Lexing.lexbuf -> Dot_parser.token js_of_ocaml-3.5.2/examples/graph_viewer/dot_lexer.mll000066400000000000000000000072701357507750000230060ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) { type graph_type = Graph | Digraph | Unknown let graph_type = ref Unknown let set_graph_type v = if !graph_type = Unknown then graph_type := v let buffer = Buffer.create 256 let html_nest = ref 1 let reset () = graph_type := Unknown } let letter = ['A'-'Z' 'a'-'z' '_' '\128'-'\255'] let digit = ['0'-'9'] let name = letter (letter | digit) * let number = '-'? ((digit+ ('.' digit*)?) | ('.' digit+)) let id = name | number rule token = parse "/*" { comment lexbuf } | "//" [^ '\n']* | "#" [^ '\n']* | [' ' '\t' '\r' '\n']+ { token lexbuf } | "->" { if !graph_type = Digraph then Dot_parser.EDGEOP else exit 1 (*XXX*) } | "--" { if !graph_type = Graph then Dot_parser.EDGEOP else exit 1 (*XXX*) } | name { let s = Lexing.lexeme lexbuf in match String.lowercase s with "node" -> Dot_parser.NODE | "edge" -> Dot_parser.EDGE | "graph" -> set_graph_type Graph; Dot_parser.GRAPH | "digraph" -> set_graph_type Digraph; Dot_parser.DIGRAPH | "strict" -> Dot_parser.STRICT | "subgraph" -> Dot_parser.SUBGRAPH | _ -> Dot_parser.ATOM s } | number { Dot_parser.ATOM (Lexing.lexeme lexbuf) } | '"' { qstring lexbuf } | '<' { Buffer.add_char buffer '<'; html_nest := 1; hstring lexbuf } | '{' { Dot_parser.LBRACE } | '}' { Dot_parser.RBRACE } | '[' { Dot_parser.LBRACKET } | ']' { Dot_parser.RBRACKET } | '=' { Dot_parser.EQUAL } | ':' { Dot_parser.COLON } | ';' { Dot_parser.SEMI } | ',' { Dot_parser.COMMA } | '+' { Dot_parser.PLUS } | _ { Format.eprintf "%s@." (Lexing.lexeme lexbuf); exit 1 (*XXX*) } | eof { Dot_parser.EOF } and comment = parse [^'*']* { comment lexbuf } | '*'+ [^ '*' '/']* { comment lexbuf } | '*'+ '/' { token lexbuf } (* | eof *) and qstring = parse '"' { let s = Buffer.contents buffer in Buffer.clear buffer; Dot_parser.QATOM s } | "\\\"" { Buffer.add_string buffer "\\\""; qstring lexbuf } | "\\\n" { qstring lexbuf } | '\n' { Buffer.add_char buffer '\n'; qstring lexbuf } | [^ '"' '\\']+ | '\\' [^'\n'] { Buffer.add_string buffer (Lexing.lexeme lexbuf); qstring lexbuf } (* | _ | eof *) and hstring = parse '>' { decr html_nest; if !html_nest > 0 then hstring lexbuf else begin Buffer.add_char buffer '>'; let s = Buffer.contents buffer in Buffer.clear buffer; Dot_parser.QATOM s end } | '<' { incr html_nest; Buffer.add_char buffer '<'; hstring lexbuf } | [^ '<' '>'] + { Buffer.add_string buffer (Lexing.lexeme lexbuf); hstring lexbuf } js_of_ocaml-3.5.2/examples/graph_viewer/dot_parser.mly000066400000000000000000000067741357507750000232100ustar00rootroot00000000000000/* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ %{ let attrlist = ref [] (*XXX*) let attrstmt kind = () let subgraph _ _ = () let create_graph strict typ name = () let add_node_list st l = (st, l) %} %token EOF %token NODE %token EDGE %token GRAPH %token DIGRAPH %token STRICT %token SUBGRAPH %token EDGEOP %token ATOM %token QATOM %token LBRACE %token RBRACE %token LBRACKET %token RBRACKET %token SEMI %token COMMA %token COLON %token EQUAL %token PLUS %start graph %type graph %% graph: optstrict graphtype optgraphname body EOF { { Dot_file.kind = $2; strict = $1; graph = { Dot_file.graph_name = $3; body = $4 } } } ; body: LBRACE optstmtlist RBRACE { $2 } ; optgraphname: atom { Some $1 } | /* empty */ { None } ; optstrict: STRICT { true } | /* empty */ { false } ; graphtype: GRAPH { `Graph } | DIGRAPH { `Digraph } ; optstmtlist: stmtlist { List.rev $1 } | /* empty */ { [] } stmtlist: stmtlist stmt { $2 :: $1 } | stmt { [$1] } ; optsemi: SEMI { } | /* empty */ { } ; stmt: attrstmt optsemi { `Attributes $1 } | compound optsemi { `Compound $1 } ; compound: simple rcompound optattr { ($1 :: $2, List.flatten (List.rev $3)) } ; simple: node { `Node $1 } | subgraph { `Graph $1 } ; rcompound: EDGEOP simple rcompound { $2 :: $3 } | /* empty */ { [] } ; node: atom { { Dot_file.name = $1; port = None } } | atom COLON atom { { Dot_file.name = $1; port = Some $3 } } | atom COLON atom COLON atom { { Dot_file.name = $1; port = Some ($3 ^ ":" ^ $5) } } ; attrstmt: attrtype attrlist { ($1, List.flatten (List.rev $2)) } | graphattrdefs { (`Graph, [$1]) } ; attrtype: GRAPH { `Graph } | NODE { `Node } | EDGE { `Edge } ; optattr: attrlist { $1 } | /* empty */ { [] } ; attrlist: optattr LBRACKET optattrdefs RBRACKET { List.rev $3 :: $1 } ; optattrdefs: optattrdefs attrdefs { $2 :: $1 } | /* empty */ { [] } ; attrdefs: attritem optseparator { $1 } ; attritem: attrassignment { $1 } ; attrassignment: atom EQUAL atom { ($1, $3) } | atom { ($1, "true") } ; graphattrdefs: atom EQUAL atom { ($1, $3) } ; subgraph: optsubghdr body { {Dot_file.graph_name = $1; body = $2} } ; optsubghdr: SUBGRAPH atom { Some $2 } | SUBGRAPH { None } | /* empty */ { None } ; optseparator: | COMMA { } | /*empty*/ { } ; atom: ATOM { $1 } | qatom { $1 } ; qatom: QATOM { $1 } | qatom PLUS QATOM { $1 ^ $3 } ; js_of_ocaml-3.5.2/examples/graph_viewer/dot_render.ml000066400000000000000000000421011357507750000227620ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module G = Dot_graph module IntMap = G.IntMap module StringMap = G.StringMap (****) let convert (r, g, b) = let c i = float i /. 255.99 in c r, c g, c b let named_colors = let colors = Hashtbl.create 101 in List.iter (fun (nm, v) -> Hashtbl.add colors nm (convert v)) [ "aliceblue", (240, 248, 255) ; "antiquewhite", (250, 235, 215) ; "aqua", (0, 255, 255) ; "aquamarine", (127, 255, 212) ; "azure", (240, 255, 255) ; "beige", (245, 245, 220) ; "bisque", (255, 228, 196) ; "black", (0, 0, 0) ; "blanchedalmond", (255, 235, 205) ; "blue", (0, 0, 255) ; "blueviolet", (138, 43, 226) ; "brown", (165, 42, 42) ; "burlywood", (222, 184, 135) ; "cadetblue", (95, 158, 160) ; "chartreuse", (127, 255, 0) ; "chocolate", (210, 105, 30) ; "coral", (255, 127, 80) ; "cornflowerblue", (100, 149, 237) ; "cornsilk", (255, 248, 220) ; "crimson", (220, 20, 60) ; "cyan", (0, 255, 255) ; "darkblue", (0, 0, 139) ; "darkcyan", (0, 139, 139) ; "darkgoldenrod", (184, 134, 11) ; "darkgray", (169, 169, 169) ; "darkgreen", (0, 100, 0) ; "darkgrey", (169, 169, 169) ; "darkkhaki", (189, 183, 107) ; "darkmagenta", (139, 0, 139) ; "darkolivegreen", (85, 107, 47) ; "darkorange", (255, 140, 0) ; "darkorchid", (153, 50, 204) ; "darkred", (139, 0, 0) ; "darksalmon", (233, 150, 122) ; "darkseagreen", (143, 188, 143) ; "darkslateblue", (72, 61, 139) ; "darkslategray", (47, 79, 79) ; "darkslategrey", (47, 79, 79) ; "darkturquoise", (0, 206, 209) ; "darkviolet", (148, 0, 211) ; "deeppink", (255, 20, 147) ; "deepskyblue", (0, 191, 255) ; "dimgray", (105, 105, 105) ; "dimgrey", (105, 105, 105) ; "dodgerblue", (30, 144, 255) ; "firebrick", (178, 34, 34) ; "floralwhite", (255, 250, 240) ; "forestgreen", (34, 139, 34) ; "fuchsia", (255, 0, 255) ; "gainsboro", (220, 220, 220) ; "ghostwhite", (248, 248, 255) ; "gold", (255, 215, 0) ; "goldenrod", (218, 165, 32) ; "gray", (128, 128, 128) ; "grey", (128, 128, 128) ; "green", (0, 128, 0) ; "greenyellow", (173, 255, 47) ; "honeydew", (240, 255, 240) ; "hotpink", (255, 105, 180) ; "indianred", (205, 92, 92) ; "indigo", (75, 0, 130) ; "ivory", (255, 255, 240) ; "khaki", (240, 230, 140) ; "lavender", (230, 230, 250) ; "lavenderblush", (255, 240, 245) ; "lawngreen", (124, 252, 0) ; "lemonchiffon", (255, 250, 205) ; "lightblue", (173, 216, 230) ; "lightcoral", (240, 128, 128) ; "lightcyan", (224, 255, 255) ; "lightgoldenrodyellow", (250, 250, 210) ; "lightgray", (211, 211, 211) ; "lightgreen", (144, 238, 144) ; "lightgrey", (211, 211, 211) ; "lightpink", (255, 182, 193) ; "lightsalmon", (255, 160, 122) ; "lightseagreen", (32, 178, 170) ; "lightskyblue", (135, 206, 250) ; "lightslategray", (119, 136, 153) ; "lightslategrey", (119, 136, 153) ; "lightsteelblue", (176, 196, 222) ; "lightyellow", (255, 255, 224) ; "lime", (0, 255, 0) ; "limegreen", (50, 205, 50) ; "linen", (250, 240, 230) ; "magenta", (255, 0, 255) ; "maroon", (128, 0, 0) ; "mediumaquamarine", (102, 205, 170) ; "mediumblue", (0, 0, 205) ; "mediumorchid", (186, 85, 211) ; "mediumpurple", (147, 112, 219) ; "mediumseagreen", (60, 179, 113) ; "mediumslateblue", (123, 104, 238) ; "mediumspringgreen", (0, 250, 154) ; "mediumturquoise", (72, 209, 204) ; "mediumvioletred", (199, 21, 133) ; "midnightblue", (25, 25, 112) ; "mintcream", (245, 255, 250) ; "mistyrose", (255, 228, 225) ; "moccasin", (255, 228, 181) ; "navajowhite", (255, 222, 173) ; "navy", (0, 0, 128) ; "oldlace", (253, 245, 230) ; "olive", (128, 128, 0) ; "olivedrab", (107, 142, 35) ; "orange", (255, 165, 0) ; "orangered", (255, 69, 0) ; "orchid", (218, 112, 214) ; "palegoldenrod", (238, 232, 170) ; "palegreen", (152, 251, 152) ; "paleturquoise", (175, 238, 238) ; "palevioletred", (219, 112, 147) ; "papayawhip", (255, 239, 213) ; "peachpuff", (255, 218, 185) ; "peru", (205, 133, 63) ; "pink", (255, 192, 203) ; "plum", (221, 160, 221) ; "powderblue", (176, 224, 230) ; "purple", (128, 0, 128) ; "red", (255, 0, 0) ; "rosybrown", (188, 143, 143) ; "royalblue", (65, 105, 225) ; "saddlebrown", (139, 69, 19) ; "salmon", (250, 128, 114) ; "sandybrown", (244, 164, 96) ; "seagreen", (46, 139, 87) ; "seashell", (255, 245, 238) ; "sienna", (160, 82, 45) ; "silver", (192, 192, 192) ; "skyblue", (135, 206, 235) ; "slateblue", (106, 90, 205) ; "slategray", (112, 128, 144) ; "slategrey", (112, 128, 144) ; "snow", (255, 250, 250) ; "springgreen", (0, 255, 127) ; "steelblue", (70, 130, 180) ; "tan", (210, 180, 140) ; "teal", (0, 128, 128) ; "thistle", (216, 191, 216) ; "tomato", (255, 99, 71) ; "turquoise", (64, 224, 208) ; "violet", (238, 130, 238) ; "wheat", (245, 222, 179) ; "white", (255, 255, 255) ; "whitesmoke", (245, 245, 245) ; "yellow", (255, 255, 0) ; "yellowgreen", (154, 205, 50) ]; colors let rgb_of_hsv h s v = if s <= 0.0 then v, v, v else let h = 6. *. if h >= 1. then 0. else h in let i = truncate h in let f = h -. float i in let p = v *. (1. -. s) in let q = v *. (1. -. (s *. f)) in let t = v *. (1. -. (s *. (1. -. f))) in match i with | 0 -> v, t, p | 1 -> q, v, p | 2 -> p, v, t | 3 -> p, q, v | 4 -> t, p, v | 5 -> v, p, q | _ -> assert false let parse_color c = if c = "none" then None else if String.length c = 7 && c.[0] = '#' then let conv s = int_of_string ("0x" ^ s) in let c = conv (String.sub c 1 2), conv (String.sub c 3 2), conv (String.sub c 5 2) in Some (convert c) else try Scanf.sscanf c "%f,%f,%f" (fun h s v -> Some (rgb_of_hsv h s v)) with Scanf.Scan_failure _ | Failure _ | End_of_file | Invalid_argument _ -> Some (try Hashtbl.find named_colors c with Not_found -> Format.eprintf "%s@." c; assert false) let convert (r, g, b) = let c i = float i /. 255.99 in c r, c g, c b let named_colors = let colors = Hashtbl.create 101 in List.iter (fun (nm, v) -> Hashtbl.add colors nm (convert v)) [ "aliceblue", (240, 248, 255) ; "antiquewhite", (250, 235, 215) ; "aqua", (0, 255, 255) ; "aquamarine", (127, 255, 212) ; "azure", (240, 255, 255) ; "beige", (245, 245, 220) ; "bisque", (255, 228, 196) ; "black", (0, 0, 0) ; "blanchedalmond", (255, 235, 205) ; "blue", (0, 0, 255) ; "blueviolet", (138, 43, 226) ; "brown", (165, 42, 42) ; "burlywood", (222, 184, 135) ; "cadetblue", (95, 158, 160) ; "chartreuse", (127, 255, 0) ; "chocolate", (210, 105, 30) ; "coral", (255, 127, 80) ; "cornflowerblue", (100, 149, 237) ; "cornsilk", (255, 248, 220) ; "crimson", (220, 20, 60) ; "cyan", (0, 255, 255) ; "darkblue", (0, 0, 139) ; "darkcyan", (0, 139, 139) ; "darkgoldenrod", (184, 134, 11) ; "darkgray", (169, 169, 169) ; "darkgreen", (0, 100, 0) ; "darkgrey", (169, 169, 169) ; "darkkhaki", (189, 183, 107) ; "darkmagenta", (139, 0, 139) ; "darkolivegreen", (85, 107, 47) ; "darkorange", (255, 140, 0) ; "darkorchid", (153, 50, 204) ; "darkred", (139, 0, 0) ; "darksalmon", (233, 150, 122) ; "darkseagreen", (143, 188, 143) ; "darkslateblue", (72, 61, 139) ; "darkslategray", (47, 79, 79) ; "darkslategrey", (47, 79, 79) ; "darkturquoise", (0, 206, 209) ; "darkviolet", (148, 0, 211) ; "deeppink", (255, 20, 147) ; "deepskyblue", (0, 191, 255) ; "dimgray", (105, 105, 105) ; "dimgrey", (105, 105, 105) ; "dodgerblue", (30, 144, 255) ; "firebrick", (178, 34, 34) ; "floralwhite", (255, 250, 240) ; "forestgreen", (34, 139, 34) ; "fuchsia", (255, 0, 255) ; "gainsboro", (220, 220, 220) ; "ghostwhite", (248, 248, 255) ; "gold", (255, 215, 0) ; "goldenrod", (218, 165, 32) ; "gray", (128, 128, 128) ; "grey", (128, 128, 128) ; "green", (0, 128, 0) ; "greenyellow", (173, 255, 47) ; "honeydew", (240, 255, 240) ; "hotpink", (255, 105, 180) ; "indianred", (205, 92, 92) ; "indigo", (75, 0, 130) ; "ivory", (255, 255, 240) ; "khaki", (240, 230, 140) ; "lavender", (230, 230, 250) ; "lavenderblush", (255, 240, 245) ; "lawngreen", (124, 252, 0) ; "lemonchiffon", (255, 250, 205) ; "lightblue", (173, 216, 230) ; "lightcoral", (240, 128, 128) ; "lightcyan", (224, 255, 255) ; "lightgoldenrodyellow", (250, 250, 210) ; "lightgray", (211, 211, 211) ; "lightgreen", (144, 238, 144) ; "lightgrey", (211, 211, 211) ; "lightpink", (255, 182, 193) ; "lightsalmon", (255, 160, 122) ; "lightseagreen", (32, 178, 170) ; "lightskyblue", (135, 206, 250) ; "lightslategray", (119, 136, 153) ; "lightslategrey", (119, 136, 153) ; "lightsteelblue", (176, 196, 222) ; "lightyellow", (255, 255, 224) ; "lime", (0, 255, 0) ; "limegreen", (50, 205, 50) ; "linen", (250, 240, 230) ; "magenta", (255, 0, 255) ; "maroon", (128, 0, 0) ; "mediumaquamarine", (102, 205, 170) ; "mediumblue", (0, 0, 205) ; "mediumorchid", (186, 85, 211) ; "mediumpurple", (147, 112, 219) ; "mediumseagreen", (60, 179, 113) ; "mediumslateblue", (123, 104, 238) ; "mediumspringgreen", (0, 250, 154) ; "mediumturquoise", (72, 209, 204) ; "mediumvioletred", (199, 21, 133) ; "midnightblue", (25, 25, 112) ; "mintcream", (245, 255, 250) ; "mistyrose", (255, 228, 225) ; "moccasin", (255, 228, 181) ; "navajowhite", (255, 222, 173) ; "navy", (0, 0, 128) ; "oldlace", (253, 245, 230) ; "olive", (128, 128, 0) ; "olivedrab", (107, 142, 35) ; "orange", (255, 165, 0) ; "orangered", (255, 69, 0) ; "orchid", (218, 112, 214) ; "palegoldenrod", (238, 232, 170) ; "palegreen", (152, 251, 152) ; "paleturquoise", (175, 238, 238) ; "palevioletred", (219, 112, 147) ; "papayawhip", (255, 239, 213) ; "peachpuff", (255, 218, 185) ; "peru", (205, 133, 63) ; "pink", (255, 192, 203) ; "plum", (221, 160, 221) ; "powderblue", (176, 224, 230) ; "purple", (128, 0, 128) ; "red", (255, 0, 0) ; "rosybrown", (188, 143, 143) ; "royalblue", (65, 105, 225) ; "saddlebrown", (139, 69, 19) ; "salmon", (250, 128, 114) ; "sandybrown", (244, 164, 96) ; "seagreen", (46, 139, 87) ; "seashell", (255, 245, 238) ; "sienna", (160, 82, 45) ; "silver", (192, 192, 192) ; "skyblue", (135, 206, 235) ; "slateblue", (106, 90, 205) ; "slategray", (112, 128, 144) ; "slategrey", (112, 128, 144) ; "snow", (255, 250, 250) ; "springgreen", (0, 255, 127) ; "steelblue", (70, 130, 180) ; "tan", (210, 180, 140) ; "teal", (0, 128, 128) ; "thistle", (216, 191, 216) ; "tomato", (255, 99, 71) ; "turquoise", (64, 224, 208) ; "violet", (238, 130, 238) ; "wheat", (245, 222, 179) ; "white", (255, 255, 255) ; "whitesmoke", (245, 245, 245) ; "yellow", (255, 255, 0) ; "yellowgreen", (154, 205, 50) ]; colors (****) let comma_re = Str.regexp "," let semi_re = Str.regexp ";" let wsp_re = Str.regexp "[\x20\x09\x0D\x0A]+" let parse_float s = try float_of_string s with Failure _ -> raise Not_found let parse_rectangle s = match Str.split comma_re s with | [ x1; y1; x2; y2 ] -> parse_float x1, -.parse_float y2, parse_float x2, -.parse_float y1 | _ -> raise Not_found let parse_point s = match Str.split comma_re s with | [ x; y ] -> parse_float x, -.parse_float y | _ -> raise Not_found let start_point l = match l with | x :: _ -> x | _ -> raise Not_found let rec end_point l = match l with | [ x ] -> x | _ :: r -> end_point r | _ -> raise Not_found let epsilon = 0.0001 let add_arrow scene (px, py) (ux, uy) color arrow_size (*XXX pen_width*) = let dx = ux -. px in let dy = uy -. py in let s = 10. /. (sqrt ((dx *. dx) +. (dy *. dy)) +. epsilon) in let dx = s *. if dx >= 0. then dx +. epsilon else dx -. epsilon in let dy = s *. if dy >= 0. then dy +. epsilon else dy -. epsilon in let arrow_width = 0.35 in let vx = -.dy *. arrow_width in let vy = dx *. arrow_width in let qx = px +. dx in let qy = py +. dy in let l = [| px, py; px -. vx, py -. vy; qx, qy; px +. vx, py +. vy |] in Scene.add scene (Scene.Polygon (l, color, color)) let rec render_spline_rec l = match l with | [] -> [] | (x1, y1) :: (x2, y2) :: (x3, y3) :: r -> Scene.Curve_to (x1, y1, x2, y2, x3, y3) :: render_spline_rec r | _ -> raise Not_found let render_spline l = match l with | (x, y) :: r -> Array.of_list (Scene.Move_to (x, y) :: render_spline_rec r) | _ -> raise Not_found let parse_spline scene s color arrow_size = let l = Str.split semi_re s in List.iter (fun s -> let l = List.map (fun s -> Str.split comma_re s) (Str.split wsp_re s) in let endp, l = match l with | [ "e"; x; y ] :: r -> Some (parse_float x, -.parse_float y), r | _ -> None, l in let startp, l = match l with | [ "s"; x; y ] :: r -> Some (parse_float x, -.parse_float y), r | _ -> None, l in let l = List.map (fun l -> match l with | [ x; y ] -> parse_float x, -.parse_float y | _ -> raise Not_found) l in (match endp with | Some u -> add_arrow scene (end_point l) u color arrow_size | None -> ()); (match startp with | Some u -> add_arrow scene (start_point l) u color arrow_size | None -> ()); Scene.add scene (Scene.Path (render_spline l, None, color))) l let add_rect_margin (x1, y1, x2, y2) w = x1 -. w, y1 -. w, x2 +. w, y2 +. w let dpi = 72. let f g = let bbox = parse_rectangle (StringMap.find "bb" g.G.graph_attr) in let margin = try parse_float (StringMap.find "margin" g.G.graph_attr) with Not_found -> 4. in let bbox = add_rect_margin bbox margin in let scene = Scene.make () in IntMap.iter (fun _ n -> let x, y = parse_point (StringMap.find "pos" n.G.node_attr) in let width = dpi *. parse_float (StringMap.find "width" n.G.node_attr) in let height = dpi *. parse_float (StringMap.find "height" n.G.node_attr) in let color = parse_color (try StringMap.find "color" n.G.node_attr with Not_found -> "black") in let shape = try StringMap.find "shape" n.G.node_attr with Not_found -> "ellipse" in (*XXX parse style *) let style = try StringMap.find "style" n.G.node_attr with Not_found -> "" in let fillcolor = if style <> "filled" then None else try parse_color (StringMap.find "fillcolor" n.G.node_attr) with Not_found -> color in (match shape with | "box" | "rect" | "rectangle" -> let w2 = width /. 2. in let h2 = height /. 2. in Scene.add scene (Scene.rectangle (x -. w2, y -. h2, x +. w2, y +. h2) fillcolor color) | _ -> Scene.add scene (Scene.Ellipse (x, y, width /. 2., height /. 2., fillcolor, color))); let font_color = parse_color (try StringMap.find "color" n.G.node_attr with Not_found -> "black") in let font_size = try parse_float (StringMap.find "fontsize" n.G.node_attr) with Not_found -> 14. in let label = (*XXX Parse...*) try StringMap.find "label" n.G.node_attr with Not_found -> n.G.name in let font_family = "serif" in Scene.add scene (Scene.Text (x, y +. (height *. 0.1), label, (font_family, font_size), font_color, None)); ()) g.G.nodes.G.seq; IntMap.iter (fun _ e -> (* Format.eprintf "%s -> %s@." e.G.tail.G.name e.G.head.G.name;*) let color = parse_color (try StringMap.find "color" e.G.edge_attr with Not_found -> "black") in let arrow_size = try parse_float (StringMap.find "arrowsize" e.G.edge_attr) with Not_found -> 1. in parse_spline scene (StringMap.find "pos" e.G.edge_attr) color arrow_size; ()) g.G.edges.G.seq; bbox, scene js_of_ocaml-3.5.2/examples/graph_viewer/dot_render.mli000066400000000000000000000016271357507750000231430ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val f : Dot_graph.graph -> (float * float * float * float) * Scene.cairo_t js_of_ocaml-3.5.2/examples/graph_viewer/dune000066400000000000000000000006661357507750000211730ustar00rootroot00000000000000(executables (names viewer_js) ;; add converter & viewer (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx))) (ocamllex dot_lexer) (rule (targets viewer_js.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:viewer_js.bc} -o %{targets} --pretty -I ./ --file %{dep:scene.json} ))) (alias (name default) (deps viewer_js.js index.html)) js_of_ocaml-3.5.2/examples/graph_viewer/index.html000066400000000000000000000005131357507750000223010ustar00rootroot00000000000000 Graph viewer js_of_ocaml-3.5.2/examples/graph_viewer/main.ml000066400000000000000000000021231357507750000215610ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) let _ = let ch = if Array.length Sys.argv > 1 then open_in Sys.argv.(1) else stdin in let _, g = Dot_graph.of_channel ch in let bbox, scene = Dot_render.f g in ignore (GMain.Main.init ()); Viewer.create (*~full_screen:true*) bbox scene; GMain.main () js_of_ocaml-3.5.2/examples/graph_viewer/maverick_main.dot000066400000000000000000000573601357507750000236350ustar00rootroot00000000000000digraph G { graph [rankdir=LR, ratio="1.4", margin=5, ranksep=3]; node [label="\N"]; graph [bb="0,0,2800,3920"]; 6967 [label="ubiquity-slideshow-kubuntu", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,24.826", width="4.1111", height="0.51389"]; 6968 [label="ubiquity-slideshow-ubuntu", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,24.826", width="3.9444", height="0.51389"]; 6875 [label="tk8.4-doc", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,100.83", width="1.6111", height="0.51389"]; 6878 [label="tk8.5-doc", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,100.83", width="1.6111", height="0.51389"]; 6695 [label="tcl8.4-doc", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,175.83", width="1.6389", height="0.51389"]; 6698 [label="tcl8.5-doc", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,175.83", width="1.6389", height="0.51389"]; 5734 [label="openbsd-inetd", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,251.83", width="2.2222", height="0.51389"]; 7170 [label=xinetd, style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,251.83", width="1.1667", height="0.51389"]; 5678 [label="network-manager-kde", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,326.83", width="3.3333", height="0.51389"]; 6037 [label="plasma-widget-networkmanagement (x 2)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,326.83", width="6.0556", height="0.51389"]; 4829 [label="libstdc++6-4.4-doc", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,402.83", width="2.9167", height="0.51389"]; 4833 [label="libstdc++6-4.5-doc", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,402.83", width="2.9167", height="0.51389"]; 4827 [label="libstdc++6-4.4-dbg", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,477.83", width="2.9722", height="0.51389"]; 4831 [label="libstdc++6-4.5-dbg", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,477.83", width="2.9722", height="0.51389"]; confl1 [label="#", shape=circle, color=red, fontcolor=red, pos="2779,1803.8", width="0.55556", height="0.56944"]; 4687 [label="libsdl1.2debian-all", style="rounded,filled", fillcolor="0.0,0.032303,1.0", pos="2361,1803.8", width="2.75", height="0.51389"]; 4688 [label="libsdl1.2debian-alsa", style="rounded,filled", fillcolor="0.0,0.032303,1.0", pos="2361,1728.8", width="2.9722", height="0.51389"]; 4689 [label="libsdl1.2debian-esd", style="rounded,filled", fillcolor="0.0,0.032303,1.0", pos="2361,1652.8", width="2.8889", height="0.51389"]; 4690 [label="libsdl1.2debian-oss", style="rounded,filled", fillcolor="0.0,0.032303,1.0", pos="2361,1954.8", width="2.8611", height="0.51389"]; 4691 [label="libsdl1.2debian-pulseaudio", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="2361,1879.8", width="3.8889", height="0.51389"]; 4624 [label="libreadline5-dev", style="rounded,filled", fillcolor="0.0,0.117394,1.0", pos="1329,917.83", width="2.5", height="0.51389"]; 4627 [label="libreadline6-dev (x 6)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1835,917.83", width="3.2222", height="0.51389"]; 4623 [label="libreadline5-dbg", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,1494.8", width="2.5", height="0.51389"]; 4626 [label="libreadline6-dbg", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,1494.8", width="2.5", height="0.51389"]; 4535 [label="libqt4-dbg (x 24)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,1570.8", width="2.5556", height="0.51389"]; 6516 [label="qt-x11-free-dbg", style="rounded,filled", fillcolor="0.0,0.259384,1.0", pos="734,1570.8", width="2.4444", height="0.51389"]; 4205 [label="libneon27-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,1645.8", width="2.25", height="0.51389"]; 4208 [label="libneon27-gnutls-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,1645.8", width="3.1944", height="0.51389"]; 3828 [label="libjpeg62-dev (x 23)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1835,1262.8", width="3.0278", height="0.51389"]; 3831 [label="libjpeg8-dev", style="rounded,filled", fillcolor="0.0,0.281699,1.0", pos="2361,1262.8", width="1.9444", height="0.51389"]; 3789 [label="libjack-jackd2-0 (x 2)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,1721.8", width="3.1389", height="0.51389"]; 3791 [label="libjack0 (x 3)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,1721.8", width="2.0556", height="0.51389"]; 3768 [label="libiodbc2-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,1796.8", width="2.0833", height="0.51389"]; 7009 [label="unixodbc-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,1796.8", width="2.1111", height="0.51389"]; 3551 [label="libgpod4 (x 9)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,1872.8", width="2.1667", height="0.51389"]; 3552 [label="libgpod4-nogtk (x 2)", style="rounded,filled", fillcolor="0.0,0.117394,1.0", pos="734,1872.8", width="3.0556", height="0.51389"]; 3405 [label="libgl1-mesa-glx (x 8)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1329,2047.8", width="3.0833", height="0.51389"]; 3407 [label="libgl1-mesa-swx11 (x 3)", style="rounded,filled", fillcolor="0.0,0.159040,1.0", pos="1835,2045.8", width="3.5556", height="0.51389"]; 3331 [label="libgd2-noxpm", style="rounded,filled", fillcolor="0.0,0.170628,1.0", pos="1835,1353.8", width="2.1667", height="0.51389"]; 3333 [label="libgd2-xpm (x 10)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="2361,1501.8", width="2.6944", height="0.51389"]; 3157 [label="libelf-dev (x 3)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2282.8", width="2.25", height="0.51389"]; 3160 [label="libelfg0-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,2282.8", width="1.8889", height="0.51389"]; 2974 [label="libdb4.7-java (x 3)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2357.8", width="2.7778", height="0.51389"]; 2982 [label="libdb4.8-java (x 3)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,2357.8", width="2.7778", height="0.51389"]; 2973 [label="libdb4.7-dev (x 2)", style="rounded,filled", fillcolor="0.0,0.117394,1.0", pos="1329,735.83", width="2.6944", height="0.51389"]; 2981 [label="libdb4.8-dev (x 5)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1835,670.83", width="2.6944", height="0.51389"]; 2953 [label="libcurl4-gnutls-dev (x 4)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1835,1087.8", width="3.5556", height="0.51389"]; 2954 [label="libcurl4-openssl-dev", style="rounded,filled", fillcolor="0.0,0.100343,1.0", pos="2361,1087.8", width=3, height="0.51389"]; confl2 [label="#", shape=circle, color=red, fontcolor=red, pos="1835,2123.8", width="0.55556", height="0.56944"]; 2852 [label="libclutter-1.0-0 (x 2)", style="rounded,filled", fillcolor="0.0,0.058697,1.0", pos="1329,2217.8", width="3.0556", height="0.51389"]; 2856 [label="libclutter-eglx-es11-1.0-0 (x 2)", style="rounded,filled", fillcolor="0.0,0.081013,1.0", pos="1329,2122.8", width="4.4722", height="0.51389"]; 2859 [label="libclutter-eglx-es20-1.0-0 (x 2)", style="rounded,filled", fillcolor="0.0,0.081013,1.0", pos="1329,1951.8", width="4.4722", height="0.51389"]; 2492 [label="lib64stdc++6-4.4-dbg", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2433.8", width="3.3056", height="0.51389"]; 2493 [label="lib64stdc++6-4.5-dbg", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,2433.8", width="3.3056", height="0.51389"]; 2488 [label="lib64readline5-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2508.8", width="2.8333", height="0.51389"]; 2490 [label="lib64readline6-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,2508.8", width="2.8333", height="0.51389"]; 918 [label="hunspell-tools", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2584.8", width="2.2222", height="0.51389"]; 5624 [label="myspell-tools", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,2584.8", width="2.0833", height="0.51389"]; 911 [label="hunspell-fr (x 3)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2659.8", width="2.5", height="0.51389"]; 5596 [label="myspell-fr", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,2659.8", width="1.6389", height="0.51389"]; 907 [label="hunspell-de-de (x 3)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2735.8", width="3.0278", height="0.51389"]; 5586 [label="myspell-de-de-oldspell", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,2735.8", width="3.3056", height="0.51389"]; 882 [label=hello, style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2810.8", width="0.97222", height="0.51389"]; 883 [label="hello-debhelper", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,2810.8", width="2.4167", height="0.51389"]; 820 [label=grub, style="rounded,filled", fillcolor="0.0,0.032303,1.0", pos="150,3112.8", width="0.94444", height="0.51389"]; 827 [label="grub-legacy-ec2", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,3112.8", width="2.4722", height="0.51389"]; confl3 [label="#", shape=circle, color=red, fontcolor=red, pos="734,2998.8", width="0.55556", height="0.56944"]; 824 [label="grub-efi-amd64", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,3037.8", width="2.3889", height="0.51389"]; 825 [label="grub-efi-ia32 (x 2)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2961.8", width="2.7778", height="0.51389"]; 828 [label="grub-pc", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,2886.8", width="1.3333", height="0.51389"]; 541 [label="foomatic-db", style="rounded,filled", fillcolor="0.0,0.058697,1.0", pos="1835,1683.8", width="1.8889", height="0.51389"]; 542 [label="foomatic-db-compressed-ppds (x 4)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="2361,1577.8", width="5.0278", height="0.51389"]; 531 [label=flex, style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,3188.8", width="0.80556", height="0.51389"]; 533 [label="flex-old", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,3188.8", width="1.3056", height="0.51389"]; 492 [label="exim4-daemon-heavy (x 2)", style="rounded,filled", fillcolor="0.0,0.146444,1.0", pos="150,3263.8", width="3.9722", height="0.51389"]; 494 [label="exim4-daemon-light (x 2)", style="rounded,filled", fillcolor="0.0,0.146444,1.0", pos="734,3328.8", width="3.75", height="0.51389"]; 491 [label="exim4-config (x 5)", style="rounded,filled", fillcolor="0.0,0.117394,1.0", pos="1835,3293.8", width="2.75", height="0.51389"]; 6067 [label="postfix (x 9)", style="rounded,filled", fillcolor="0.0,0.117394,1.0", pos="2361,3293.8", width="1.9444", height="0.51389"]; 428 [label=emacs23, style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,3403.8", width="1.5", height="0.51389"]; 432 [label="emacs23-nox", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,3403.8", width="2.1111", height="0.51389"]; 310 [label="debconf-english", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,3479.8", width="2.4167", height="0.51389"]; 311 [label="debconf-i18n", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,3479.8", width="2.0556", height="0.51389"]; confl4 [label="#", shape=circle, color=red, fontcolor=red, pos="734,3630.8", width="0.55556", height="0.56944"]; 115 [label="bacula-common-mysql (x 3)", style="rounded,filled", fillcolor="0.0,0.058697,1.0", pos="150,3705.8", width="4.0278", height="0.51389"]; 116 [label="bacula-common-pgsql (x 3)", style="rounded,filled", fillcolor="0.0,0.058697,1.0", pos="150,3630.8", width="3.9444", height="0.51389"]; 117 [label="bacula-common-sqlite3 (x 3)", style="rounded,filled", fillcolor="0.0,0.058697,1.0", pos="150,3554.8", width="4.1667", height="0.51389"]; 41 [label="apache2-prefork-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,617.83", width="3.1111", height="0.51389"]; 42 [label="apache2-threaded-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,553.83", width="3.3611", height="0.51389"]; confl5 [label="#", shape=circle, color=red, fontcolor=red, pos="1835,3818.8", width="0.55556", height="0.56944"]; 38 [label="apache2-mpm-event", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1329,3894.8", width="3.0833", height="0.51389"]; 39 [label="apache2-mpm-prefork (x 2)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1329,3818.8", width="4.0278", height="0.51389"]; 40 [label="apache2-mpm-worker", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1329,3743.8", width="3.2778", height="0.51389"]; 0 [label="abrowser (x 7049)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,3856.8", width="2.8333", height="0.51389"]; 467 [label="eucalyptus-nc", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="150,3781.8", width="2.1944", height="0.51389"]; dep1 [label=or, shape=circle, color=blue, fontcolor=blue, pos="734,3781.8", width="0.61111", height="0.61111"]; 2854 [label="libclutter-1.0-dev (x 2)", style="rounded,filled", fillcolor="0.0,0.117394,1.0", pos="150,2181.8", width="3.3611", height="0.51389"]; 2858 [label="libclutter-eglx-es11-1.0-dev", style="rounded,filled", fillcolor="0.0,0.132647,1.0", pos="150,2096.8", width="4.0556", height="0.51389"]; 2861 [label="libclutter-eglx-es20-1.0-dev", style="rounded,filled", fillcolor="0.0,0.132647,1.0", pos="150,1968.8", width="4.0556", height="0.51389"]; 3102 [label="libecore-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,1220.8", width="1.9444", height="0.51389"]; 3129 [label="libedje-dev (x 2)", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,1087.8", width="2.5", height="0.51389"]; 3332 [label="libgd2-noxpm-dev", style="rounded,filled", fillcolor="0.0,0.181356,1.0", pos="734,1339.8", width="2.75", height="0.51389"]; 3334 [label="libgd2-xpm-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,1419.8", width="2.3889", height="0.51389"]; 4615 [label="librdf0-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,887.83", width="1.75", height="0.51389"]; 4647 [label="librpm-dev", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="734,764.83", width="1.75", height="0.51389"]; 6974 [label="ubuntu-desktop", style="rounded,filled", fillcolor="0.0,0.081013,1.0", pos="1329,1747.8", width="2.4722", height="0.51389"]; 6980 [label="ubuntu-netbook", style="rounded,filled", fillcolor="0.0,0.000000,1.0", pos="1329,1545.8", width="2.5", height="0.51389"]; 6967 -> 6968 [dir=none, color=red, pos="298.12,24.826 388.26,24.826 502.79,24.826 591.83,24.826"]; 6875 -> 6878 [dir=none, color=red, pos="208.13,100.83 319.93,100.83 563.72,100.83 675.67,100.83"]; 6695 -> 6698 [dir=none, color=red, pos="209.75,175.83 321.82,175.83 562.33,175.83 674.33,175.83"]; 5734 -> 7170 [dir=none, color=red, pos="230.59,251.83 356.22,251.83 594.38,251.83 691.33,251.83"]; 5678 -> 6037 [dir=none, color=red, pos="270.3,326.83 341.08,326.83 432.75,326.83 515.87,326.83"]; 4829 -> 4833 [dir=none, color=red, pos="255.76,402.83 361.27,402.83 522.46,402.83 628.04,402.83"]; 4827 -> 4831 [dir=none, color=red, pos="257.11,477.83 362.16,477.83 521.43,477.83 626.58,477.83"]; 4687 -> confl1 [dir=none, color=red, pos="2460.1,1803.8 2559.3,1803.8 2704.7,1803.8 2758.2,1803.8"]; 4688 -> confl1 [dir=none, color=red, pos="2434.8,1742.1 2533,1759.7 2701,1789.8 2758.8,1800.2"]; 4689 -> confl1 [dir=none, color=red, pos="2423.2,1667.4 2458.5,1676.1 2503.1,1688.3 2542,1701.8 2625.5,1730.9 2721.2,1775.8 2760.6,1794.8"]; 4690 -> confl1 [dir=none, color=red, pos="2424.1,1940.6 2459.2,1932 2503.5,1920.2 2542,1906.8 2625.7,1877.7 2721.3,1832.2 2760.6,1812.9"]; 4691 -> confl1 [dir=none, color=red, pos="2442.1,1865.1 2541.1,1847.1 2702.3,1817.8 2758.7,1807.5"]; 4624 -> 4627 [dir=none, color=red, pos="1419.2,917.83 1502.8,917.83 1627.8,917.83 1718.9,917.83"]; 4623 -> 4626 [dir=none, color=red, pos="240.29,1494.8 349.95,1494.8 533.82,1494.8 643.55,1494.8"]; 4535 -> 6516 [dir=none, color=red, pos="242.54,1570.8 353.01,1570.8 536.46,1570.8 645.24,1570.8"]; 4205 -> 4208 [dir=none, color=red, pos="231.51,1645.8 332.2,1645.8 504.15,1645.8 618.42,1645.8"]; 3828 -> 3831 [dir=none, color=red, pos="1944.6,1262.8 2048.5,1262.8 2201.4,1262.8 2290.2,1262.8"]; 3789 -> 3791 [dir=none, color=red, pos="263.29,1721.8 380.38,1721.8 559.77,1721.8 659.89,1721.8"]; 3768 -> 7009 [dir=none, color=red, pos="225.75,1796.8 337.47,1796.8 545.28,1796.8 657.46,1796.8"]; 3551 -> 3552 [dir=none, color=red, pos="228.76,1872.8 330.49,1872.8 508.15,1872.8 623.39,1872.8"]; 3405 -> 3407 [dir=none, color=red, pos="1440,2047.4 1518.6,2047.1 1624.1,2046.7 1706.3,2046.3"]; 3331 -> 3333 [dir=none, color=red, pos="1884.5,1367.7 1983.5,1395.6 2205.1,1457.9 2307.4,1486.7"]; 3157 -> 3160 [dir=none, color=red, pos="231.51,2282.8 347.41,2282.8 557.73,2282.8 665.83,2282.8"]; 2974 -> 2982 [dir=none, color=red, pos="250.73,2357.8 357.75,2357.8 525.98,2357.8 633.08,2357.8"]; 2973 -> 2981 [dir=none, color=red, pos="1409.2,725.53 1503.8,713.37 1660.2,693.29 1754.8,681.13"]; 2953 -> 2954 [dir=none, color=red, pos="1963.7,1087.8 2052.3,1087.8 2168.8,1087.8 2252.7,1087.8"]; 2852 -> confl2 [dir=none, color=red, pos="1402,2204.3 1520,2182.3 1746.2,2140.3 1814.8,2127.6"]; 2856 -> confl2 [dir=none, color=red, pos="1490.1,2123.1 1609.3,2123.4 1760,2123.7 1814.3,2123.8"]; 2859 -> confl2 [dir=none, color=red, pos="1379.4,1968.9 1488.6,2006.1 1743.3,2092.7 1815.6,2117.2"]; 2492 -> 2493 [dir=none, color=red, pos="269.59,2433.8 370.29,2433.8 513.6,2433.8 614.32,2433.8"]; 2488 -> 2490 [dir=none, color=red, pos="252.73,2508.8 359.26,2508.8 524.85,2508.8 631.36,2508.8"]; 918 -> 5624 [dir=none, color=red, pos="230.28,2584.8 343.31,2584.8 547.84,2584.8 658.31,2584.8"]; 911 -> 5596 [dir=none, color=red, pos="240.29,2659.8 360.99,2659.8 571.62,2659.8 674.3,2659.8"]; 907 -> 5586 [dir=none, color=red, pos="259.5,2735.8 360.73,2735.8 510.8,2735.8 614.97,2735.8"]; 882 -> 883 [dir=none, color=red, pos="185.65,2810.8 276.11,2810.8 516.56,2810.8 646.97,2810.8"]; 820 -> 827 [dir=none, color=red, pos="184.35,3112.8 273.29,3112.8 513.28,3112.8 644.81,3112.8"]; 820 -> confl3 [dir=none, color=red, pos="182.23,3106.5 288.76,3085.7 627.65,3019.6 713.88,3002.8"]; 824 -> confl3 [dir=none, color=red, pos="232.43,3032.3 369.68,3023.2 637.46,3005.3 713.45,3000.2"]; 825 -> confl3 [dir=none, color=red, pos="244.8,2967.8 385.15,2976.7 639.6,2992.8 713.41,2997.5"]; 828 -> confl3 [dir=none, color=red, pos="192.94,2895.1 309.77,2917.5 630.17,2978.9 713.81,2995"]; 541 -> 542 [dir=none, color=red, pos="1889.8,1672.8 1983,1654 2172.5,1615.8 2280.7,1594"]; 531 -> 533 [dir=none, color=red, pos="179.36,3188.8 273.73,3188.8 569.9,3188.8 686.32,3188.8"]; 492 -> 494 [dir=none, color=red, pos="257.45,3275.8 363.7,3287.6 525.17,3305.6 630.14,3317.3"]; 491 -> 6067 [dir=none, color=red, pos="1934.6,3293.8 2038.6,3293.8 2199.3,3293.8 2290.9,3293.8"]; 428 -> 432 [dir=none, color=red, pos="204.68,3403.8 309.17,3403.8 537.44,3403.8 657.19,3403.8"]; 310 -> 311 [dir=none, color=red, pos="237.12,3479.8 351.9,3479.8 551.84,3479.8 659.79,3479.8"]; 115 -> confl4 [dir=none, color=red, pos="251.06,3692.8 392.74,3674.7 641.23,3642.7 713.65,3633.4"]; 116 -> confl4 [dir=none, color=red, pos="292.12,3630.8 436.28,3630.8 647.33,3630.8 713.43,3630.8"]; 117 -> confl4 [dir=none, color=red, pos="251.73,3568.1 393.39,3586.5 640.89,3618.7 713.46,3628.2"]; 41 -> 42 [dir=none, color=red, pos="242.86,607.65 350.35,595.87 526.6,576.55 636.17,564.55"]; 38 -> confl5 [dir=none, color=red, pos="1410.9,3882.5 1530.9,3864.5 1747.5,3832 1814.6,3821.9"]; 39 -> confl5 [dir=none, color=red, pos="1474.3,3818.8 1595.5,3818.8 1757.2,3818.8 1814.1,3818.8"]; 40 -> confl5 [dir=none, color=red, pos="1413.7,3756.4 1534.1,3774.2 1747.6,3805.9 1814.4,3815.8"]; 41 -> 2981 [color=blue, minlen=2, weight=2, pos="e,1738.7,667.8 260.56,621.3 567.42,630.96 1426.9,657.99 1728.6,667.48"]; 42 -> 2981 [color=blue, minlen=2, weight=2, pos="e,1774.3,656.63 853.61,557.09 1003,562.24 1266.3,574.82 1490,603.83 1585.7,616.24 1694.9,638.9 1764.4,654.4"]; dep1 -> 39 [color=blue, pos="e,1199.2,3810.8 756.24,3783.2 825.72,3787.5 1042.8,3801 1188.9,3810.1"]; dep1 -> 40 [color=blue, pos="e,1220.1,3750.8 756.24,3780.4 829.12,3775.8 1064.4,3760.7 1209.8,3751.4"]; 467 -> dep1 [color=blue, pos="e,711.83,3781.8 229.06,3781.8 359.02,3781.8 612.28,3781.8 701.75,3781.8"]; 492 -> 491 [color=blue, minlen=2, weight=2, pos="e,1735.7,3292.1 292.21,3266.4 621.54,3272.2 1430.9,3286.6 1725.5,3291.9"]; 494 -> 491 [color=blue, minlen=2, weight=2, pos="e,1736.7,3297 865.44,3324.6 1085.2,3317.7 1523.2,3303.7 1726.6,3297.3"]; 2854 -> 3405 [color=blue, minlen=2, weight=2, pos="e,1237.7,2058.2 246.48,2170.9 466.39,2145.9 1003.1,2084.9 1227.6,2059.4"]; 2854 -> 2852 [color=blue, minlen=2, weight=2, pos="e,1220.3,2214.5 269.26,2185.5 495.42,2192.4 984.15,2207.3 1210.1,2214.2"]; 2858 -> 2856 [color=blue, minlen=2, weight=2, pos="e,1170.9,2119.3 294.27,2100 513.19,2104.8 928.33,2114 1160.7,2119.1"]; 2858 -> 3405 [color=blue, minlen=2, weight=2, pos="e,1221.3,2052.3 289,2091 523.11,2081.3 991.91,2061.8 1211,2052.7"]; 2861 -> 2859 [color=blue, minlen=2, weight=2, pos="e,1169,1954.1 295.75,1966.7 514.45,1963.6 926.55,1957.6 1158.8,1954.3"]; 2861 -> 3405 [color=blue, minlen=2, weight=2, pos="e,1226.1,2040.9 278.7,1977.4 510.75,1993 995.55,2025.5 1215.8,2040.2"]; 3102 -> 3828 [color=blue, minlen=2, weight=2, pos="e,1728.3,1258.8 804.13,1223.5 988.71,1230.5 1489.5,1249.6 1718.3,1258.4"]; 3102 -> 2953 [color=blue, minlen=2, weight=2, pos="e,1737.5,1099.6 797.95,1213.1 979.66,1191.2 1500.4,1128.2 1727.3,1100.8"]; 3129 -> 2953 [color=blue, minlen=2, weight=2, pos="e,1706.2,1087.8 824.57,1087.8 1016.9,1087.8 1467.3,1087.8 1696.2,1087.8"]; 3129 -> 4627 [color=blue, minlen=2, weight=2, pos="e,1752.4,930.58 805.81,1076.7 998.63,1047 1527.6,965.3 1742.4,932.12"]; 3129 -> 3828 [color=blue, minlen=2, weight=2, pos="e,1756,1250.3 804.97,1099.1 998.19,1129.8 1533.4,1214.9 1746.1,1248.7"]; 3332 -> 3331 [color=blue, minlen=2, weight=2, pos="e,1757,1352.8 833.16,1341.1 1046.2,1343.8 1544.4,1350.1 1747,1352.7"]; 3332 -> 3828 [color=blue, minlen=2, weight=2, pos="e,1733.9,1269.9 826.45,1333.4 1028,1319.3 1506.2,1285.8 1723.7,1270.6"]; 3334 -> 3333 [color=blue, minlen=2, weight=2, pos="e,2266.8,1497.1 818.33,1424.1 1092.2,1437.9 1956.2,1481.4 2256.7,1496.6"]; 3334 -> 3828 [color=blue, minlen=2, weight=2, pos="e,1752.8,1274.8 805.94,1409.7 940.34,1390.8 1238.7,1348.8 1490,1312.8 1575.7,1300.6 1673.2,1286.4 1742.7,1276.3"]; 4615 -> 2953 [color=blue, minlen=2, weight=2, pos="e,1756.5,1073.6 787.48,897.54 963.7,929.55 1527.4,1031.9 1746.6,1071.8"]; 4615 -> 2981 [color=blue, minlen=2, weight=2, pos="e,1783.7,686.19 791.74,880.22 918.72,863.08 1231.5,818.52 1490,762.83 1590.4,741.2 1705.2,709.06 1773.9,689.05"]; 4647 -> 2981 [color=blue, minlen=2, weight=2, pos="e,1739,674.14 789.69,756.34 872.15,744.08 1031.6,721.49 1168,708.83 1365.7,690.47 1597.2,679.67 1728.9,674.53"]; 4647 -> 4627 [color=blue, minlen=2, weight=2, pos="e,1748.3,905.78 790.88,772.73 968.57,797.42 1514.8,873.33 1738.2,904.38"]; 6974 -> 3333 [color=blue, minlen=2, weight=2, pos="e,2300.5,1516.1 1386.1,1733.9 1460,1716 1592.5,1683.9 1706,1656.8 1918.8,1606 2170.7,1546.6 2290.7,1518.4"]; 6974 -> 542 [color=blue, minlen=2, weight=2, pos="e,2290.8,1594.4 1416.5,1751.4 1540,1754.5 1772,1753.1 1964,1710.8 2064.8,1688.7 2082,1658 2180,1625.8 2212.6,1615.1 2249.1,1605.1\ 2280.7,1597"]; 6974 -> 4691 [color=blue, minlen=2, weight=2, pos="e,2261.6,1867.1 1404.5,1757.5 1584.7,1780.5 2040.9,1838.9 2251.4,1865.8"]; 6980 -> 3333 [color=blue, minlen=2, weight=2, pos="e,2265.6,1505.9 1417.9,1542 1607.7,1533.9 2051.8,1515 2255.5,1506.3"]; 6980 -> 542 [color=blue, minlen=2, weight=2, pos="e,2187.8,1572.5 1418.8,1548.6 1587.5,1553.8 1954.7,1565.2 2177.7,1572.1"]; } js_of_ocaml-3.5.2/examples/graph_viewer/scene.json000066400000000000000000001035421357507750000223020ustar00rootroot00000000000000[0,[0,0,0,2810,3930], [0,[0,6,3880.68,304,3919.68],[0,53.5,3887.87,256.5,3911.87], [0,596,3880.68,882,3919.68],[0,641.5,3887.87,836.5,3911.87], [0,96,3804.67,214,3843.67],[0,117.5,3811.87,192.5,3832.87], [0,680,3804.67,798,3843.67],[0,701.5,3811.87,776.5,3832.87], [0,95,3729.67,215,3768.67],[0,115.5,3736.87,194.5,3757.87], [0,679,3729.67,799,3768.67],[0,699.5,3736.87,778.5,3757.87], [0,74,3653.67,236,3692.67],[0,100.5,3660.87,209.5,3684.87], [0,696,3653.67,782,3692.67],[0,712,3660.87,766,3681.87], [0,34,3578.67,276,3617.67],[0,73,3585.87,237,3609.87], [0,520,3578.67,958,3617.67],[0,589,3585.87,889,3609.87], [0,49,3502.67,261,3541.67],[0,82,3509.87,228,3530.87], [0,633,3502.67,845,3541.67],[0,666,3509.87,812,3530.87], [0,47,3427.67,263,3466.67],[0,81,3434.87,229,3458.87], [0,631,3427.67,847,3466.67],[0,665,3434.87,813,3458.87], [0,2763,2099.7,2805,2142.7],[0,2774,2110.3,2794,2130.3], [0,2266,2101.7,2466,2140.7],[0,2298,2108.9,2434,2129.9], [0,2258,2176.7,2474,2215.7],[0,2292.5,2183.9,2439.5,2204.9], [0,2261,2252.7,2471,2291.7],[0,2294,2259.9,2438,2280.9], [0,2262,1950.7,2470,1989.7],[0,2295,1957.9,2437,1978.9], [0,2225,2025.7,2507,2064.7],[0,2268.5,2032.9,2463.5,2056.9], [0,1243,2987.67,1425,3026.67],[0,1273,2994.87,1395,3015.87], [0,1723,2987.67,1957,3026.67],[0,1762,2994.87,1918,3017.87], [0,64,2410.7,246,2449.7],[0,93,2417.9,217,2441.9], [0,648,2410.7,830,2449.7],[0,677,2417.9,801,2441.9], [0,62,2334.7,248,2373.7],[0,92.5,2341.9,217.5,2365.9], [0,650,2334.7,828,2373.7],[0,679,2341.9,799,2365.9], [0,73,2259.7,237,2298.7],[0,101,2266.9,209,2287.9], [0,623,2259.7,855,2298.7],[0,660.5,2266.9,817.5,2290.9], [0,1730,2642.7,1950,2681.7],[0,1766.5,2649.9,1913.5,2673.9], [0,2295,2642.7,2437,2681.7],[0,2318.5,2649.9,2413.5,2673.9], [0,41,2183.7,269,2222.7],[0,78.5,2190.9,231.5,2214.9], [0,664,2183.7,814,2222.7],[0,690.5,2190.9,787.5,2214.9], [0,79,2108.7,231,2147.7],[0,103.5,2115.9,206.5,2136.9], [0,662,2108.7,816,2147.7],[0,687.5,2115.9,790.5,2136.9], [0,76,2032.7,234,2071.7],[0,103,2039.9,207,2063.9], [0,628,2032.7,850,2071.7],[0,664.5,2039.9,813.5,2063.9], [0,1222,1857.7,1446,1896.7],[0,1259,1864.9,1409,1888.9], [0,1711,1859.7,1969,1898.7],[0,1753.5,1866.9,1926.5,1890.9], [0,1761,2551.7,1919,2590.7],[0,1787,2558.9,1893,2582.9], [0,2268,2403.7,2464,2442.7],[0,2300,2410.9,2432,2434.9], [0,73,1622.7,237,1661.7],[0,101.5,1629.9,208.5,1652.9], [0,670,1622.7,808,1661.7],[0,693.5,1629.9,784.5,1653.9], [0,54,1547.7,256,1586.7],[0,88.5,1554.9,221.5,1578.9], [0,638,1547.7,840,1586.7],[0,672.5,1554.9,805.5,1578.9], [0,1236,3169.67,1432,3208.67],[0,1269,3176.87,1399,3199.87], [0,1742,3234.67,1938,3273.67],[0,1775,3241.87,1905,3264.87], [0,1711,2817.7,1969,2856.7],[0,1752,2824.9,1928,2848.9], [0,2257,2817.7,2475,2856.7],[0,2291,2824.9,2441,2848.9], [0,1819,1779.7,1861,1822.7],[0,1830,1790.3,1850,1810.3], [0,1223,1687.7,1445,1726.7],[0,1259.5,1694.9,1408.5,1717.9], [0,1172,1782.7,1496,1821.7],[0,1223.5,1789.9,1444.5,1813.9], [0,1172,1953.7,1496,1992.7],[0,1223.5,1960.9,1444.5,1984.9], [0,35,1471.7,275,1510.7],[0,72,1478.9,238,1502.9], [0,619,1471.7,859,1510.7],[0,656,1478.9,822,1502.9], [0,52,1396.7,258,1435.7],[0,85,1403.9,225,1424.9], [0,636,1396.7,842,1435.7],[0,669,1403.9,809,1424.9], [0,74,1320.7,236,1359.7],[0,102,1327.9,208,1351.9], [0,663,1320.7,815,1359.7],[0,688.5,1327.9,789.5,1351.9], [0,64,1245.7,246,1284.7],[0,95.5,1252.9,214.5,1276.9], [0,679,1245.7,799,1284.7],[0,699,1252.9,779,1276.9], [0,45,1169.7,265,1208.7],[0,82,1176.9,228,1200.9], [0,619,1169.7,859,1208.7],[0,656.5,1176.9,821.5,1200.9], [0,119,1094.7,191,1133.7],[0,134,1101.9,176,1122.9], [0,651,1094.7,827,1133.7],[0,680,1101.9,798,1125.9], [0,120,792.699,190,831.699],[0,133.5,799.9,176.5,823.9], [0,649,792.699,829,831.699],[0,678,799.9,800,823.9], [0,718,904.699,760,947.699],[0,729,915.3,749,935.3], [0,68,867.699,242,906.699],[0,96,874.9,214,898.9], [0,54,943.699,256,982.699],[0,88,950.9,222,974.9], [0,106,1018.7,204,1057.7],[0,122.5,1025.9,187.5,1049.9], [0,1771,2221.7,1909,2260.7],[0,1793.5,2228.9,1886.5,2249.9], [0,2184,2327.7,2548,2366.7],[0,2238,2334.9,2494,2358.9], [0,125,716.699,185,755.699],[0,138,723.9,172,744.9], [0,691,716.699,787,755.699],[0,709,723.9,769,744.9], [0,11,641.699,299,680.699],[0,58.5,648.9,251.5,672.9], [0,603,576.699,875,615.699],[0,647,583.9,831,607.9], [0,1740,611.699,1940,650.699],[0,1773,618.9,1907,642.9], [0,2295,611.699,2437,650.699],[0,2321,618.9,2411,642.9], [0,100,501.699,210,540.699],[0,119.5,509.9,190.5,529.9], [0,662,501.699,816,540.699],[0,688,509.9,790,529.9], [0,67,425.699,243,464.699],[0,95,432.9,215,456.9], [0,664,425.699,814,464.699],[0,688.5,432.9,789.5,453.9], [0,718,272.699,760,315.699],[0,729,283.3,749,303.3], [0,9,199.699,301,238.699],[0,54,206.9,256,230.9], [0,12,274.699,298,313.699],[0,56,281.9,254,305.9], [0,4,350.699,306,389.699],[0,51.5,357.9,258.5,381.9], [0,42,3287.67,268,3326.67],[0,77.5,3294.87,232.5,3318.87], [0,617,3351.67,861,3390.67],[0,655.5,3358.87,822.5,3382.87], [0,1819,84.6992,1861,127.699],[0,1830,95.3,1850,115.3], [0,1222,10.6992,1446,49.6992],[0,1257,17.9,1411,41.9], [0,1188,86.6992,1480,125.699],[0,1233.5,93.9,1434.5,117.9], [0,1215,161.699,1453,200.699],[0,1252,168.9,1416,192.9], [0,52,48.6992,258,87.6992],[0,87.5,55.9,222.5,78.9], [0,75,123.699,235,162.699],[0,101.5,130.9,208.5,154.9], [0,716,120.199,762,166.199],[0,727,134.6,751,152.6], [0,33,1723.7,277,1762.7],[0,72.5,1730.9,237.5,1753.9], [0,8,1808.7,302,1847.7],[0,53.5,1815.9,256.5,1839.9], [0,8,1936.7,302,1975.7],[0,53.5,1943.9,256.5,1967.9], [0,668,2684.7,810,2723.7],[0,691.5,2691.9,786.5,2712.9], [0,648,2817.7,830,2856.7],[0,679.5,2824.9,798.5,2848.9], [0,639,2565.7,839,2604.7],[0,671,2572.9,807,2596.9], [0,652,2485.7,826,2524.7],[0,679.5,2492.9,798.5,2516.9], [0,675,3017.67,803,3056.67],[0,696,3024.87,782,3045.87], [0,675,3140.67,803,3179.67],[0,696,3147.87,782,3171.87], [0,1244,2157.7,1424,2196.7],[0,1274,2164.9,1394,2188.9], [0,1243,2359.7,1425,2398.7],[0,1273,2366.9,1395,2387.9], [0,303.121,3899.18,596.828,3901.18],[0,213.129,3823.17,680.672,3825.17], [0,214.75,3748.17,679.328,3750.17],[0,235.59,3672.17,696.328,3674.17], [0,275.301,3597.17,520.871,3599.17],[0,260.762,3521.17,633.039,3523.17], [0,262.109,3446.17,631.578,3448.17],[0,2465.1,2120.2,2763.2,2122.2], [0,2439.62,2123.82,2763.98,2183.88],[0,2427.96,2129.3,2766.04,2258.57], [0,2428.86,1983.43,2766.04,2113],[0,2446.92,2058.91,2763.88,2118.48], [0,1424.2,3006.17,1723.9,3008.17],[0,245.289,2429.2,648.551,2431.2], [0,247.539,2353.2,650.238,2355.2],[0,236.512,2278.2,623.422,2280.2], [0,1949.6,2661.2,2295.2,2663.2],[0,268.289,2202.2,664.891,2204.2], [0,230.75,2127.2,662.461,2129.2],[0,233.762,2051.2,628.391,2053.2], [0,1445,1876.6,1711.3,1879.7],[0,1889.23,2437.34,2312.67,2558.26], [0,236.512,1641.2,670.828,1643.2],[0,255.73,1566.2,638.078,1568.2], [0,1414.07,3198.48,1759.93,3244.86],[0,1968.7,2836.2,2257.7,2838.2], [0,1406.82,1719.71,1819.98,1798.38],[0,1495.1,1800.2,1819.3,1802.9], [0,1384.07,1806.86,1820.93,1957.05],[0,274.59,1490.2,619.32,1492.2], [0,257.73,1415.2,636.359,1417.2],[0,235.281,1339.2,663.309,1341.2], [0,245.289,1264.2,679.301,1266.2],[0,264.5,1188.2,619.969,1190.2], [0,190.648,1113.2,651.969,1115.2],[0,189.352,811.199,649.809,813.199], [0,187.039,817.52,719.07,923.18],[0,237.363,891.703,718.516,925.797], [0,249.738,926.504,718.473,958.195],[0,197.754,929.02,718.996,1030.88], [0,1894.6,2251.22,2285.9,2331.98],[0,184.359,735.199,691.32,737.199], [0,262.34,606.707,635.25,650.191],[0,1939.6,630.199,2295.9,632.199], [0,209.68,520.199,662.191,522.199],[0,242.121,444.199,664.789,446.199], [0,255.93,231.207,718.777,292.594],[0,297.121,293.199,718.43,295.199], [0,256.602,295.809,718.59,357.891],[0,247.75,3316.36,641.281,3361.44], [0,1415.75,41.5117,1819.75,104.09],[0,1479.3,105.199,1819.1,107.199], [0,1418.55,108.211,1819.55,169.59],[0,1732.44,3252.65,1746.62,3262.46], [0,265.527,3256.52,1733.63,3304.7],[0,1767.35,3266.04,1782.11,3275.61], [0,858.574,3269.62,1769.62,3368.91],[0,1192.57,110.066,1206.9,119.863], [0,761.176,113.898,1193.96,142.801],[0,1213.52,168.641,1227.8,178.441], [0,761.176,143.605,1214.86,174.598],[0,705.75,138.289,719.781,148.109], [0,234.059,142.199,706.75,144.199],[0,1729.4,628.211,1743.53,638.027], [0,297.191,632.102,1730.52,659.602],[0,1730.45,622.766,1744.62,632.578], [0,870.41,599.398,1731.63,628.699],[0,1231.03,1860.61,1245.54,1870.36], [0,251.367,1753.11,1232.71,1866.59],[0,1213.95,1705.92,1228.12,1715.73], [0,274.23,1709.8,1215.13,1740.5],[0,1164.61,1801.02,1178.73,1810.83], [0,299.246,1804.9,1165.72,1826],[0,1214.81,1867.36,1229.02,1877.17], [0,293.957,1833,1216.04,1873.3],[0,1162.7,1965.77,1176.82,1975.59], [0,300.734,1957.3,1163.82,1971.7],[0,1219.47,1879.97,1233.8,1889.77], [0,283.633,1883.8,1220.87,1948.6],[0,1722.11,2661.73,1736.32,2671.55], [0,809.09,2665.6,1723.34,2702.5],[0,1730.73,2819.21,1745.24,2828.96], [0,802.828,2710.91,1732.42,2825.19],[0,1700.2,2832.29,1714.23,2842.11], [0,829.57,2836.2,1701.2,2838.2],[0,1745.66,2987.88,1760.28,2997.58], [0,810.656,2847.31,1747.55,2993.87],[0,1749.33,2671.61,1763.96,2681.3], [0,809.812,2675.31,1751.26,2826.89],[0,1750.95,2567.4,1765.03,2577.22], [0,838.148,2571.3,1752.01,2584.9],[0,1727.37,2649.44,1741.7,2659.23], [0,831.379,2590.61,1728.77,2655.39],[0,2260.46,2423.54,2274.71,2433.35], [0,823.277,2427.4,2261.75,2501.9],[0,1745.99,2643.7,1760.58,2653.41], [0,810.801,2514.31,1747.84,2649.69],[0,1749.73,2848.55,1764.42,2858.21], [0,792.301,2852.21,1751.78,3028.45],[0,1776.56,3230.96,1791.41,3240.38], [0,796.605,3043.79,1779.18,3236.91],[0,1732.71,3245.53,1746.91,3255.34], [0,794.543,3167.67,1733.94,3251.47],[0,1741.53,3015.89,1756.11,3025.62], [0,795.742,3019.63,1743.34,3153.26],[0,2293.6,2401.59,2308.38,2411.15], [0,1390.87,2190.13,2295.93,2407.57],[0,2283.51,2323,2298.31,2332.51], [0,1421.48,2171.56,2285.95,2328.97],[0,2254.79,2054.46,2269.32,2064.2], [0,1409.38,2058.21,2256.52,2168.49],[0,2259.31,2413.75,2273.52,2423.57], [0,1422.86,2382,2260.54,2419.7],[0,2181.51,2348.03,2195.71,2357.85], [0,1423.77,2351.9,2182.73,2377.4]], [0,[2,155,3900.17,148,18.5,0,[0,"#000000"]], [3,155,3903.87,"ubiquity-slideshow-kubuntu","14px serif",[0,"#000000"],0], [2,739,3900.17,141.998,18.5,0,[0,"#000000"]], [3,739,3903.87,"ubiquity-slideshow-ubuntu","14px serif",[0,"#000000"],0], [2,155,3824.17,57.9996,18.5,0,[0,"#000000"]], [3,155,3827.87,"tk8.4-doc","14px serif",[0,"#000000"],0], [2,739,3824.17,57.9996,18.5,0,[0,"#000000"]], [3,739,3827.87,"tk8.5-doc","14px serif",[0,"#000000"],0], [2,155,3749.17,59.0004,18.5,0,[0,"#000000"]], [3,155,3752.87,"tcl8.4-doc","14px serif",[0,"#000000"],0], [2,739,3749.17,59.0004,18.5,0,[0,"#000000"]], [3,739,3752.87,"tcl8.5-doc","14px serif",[0,"#000000"],0], [2,155,3673.17,79.9992,18.5,0,[0,"#000000"]], [3,155,3676.87,"openbsd-inetd","14px serif",[0,"#000000"],0], [2,739,3673.17,42.0012,18.5,0,[0,"#000000"]], [3,739,3676.87,"xinetd","14px serif",[0,"#000000"],0], [2,155,3598.17,119.999,18.5,0,[0,"#000000"]], [3,155,3601.87,"network-manager-kde","14px serif",[0,"#000000"],0], [2,739,3598.17,218.002,18.5,0,[0,"#000000"]], [3,739,3601.87,"plasma-widget-networkmanagement (x 2)","14px serif", [0,"#000000"],0], [2,155,3522.17,105.001,18.5,0,[0,"#000000"]], [3,155,3525.87,"libstdc++6-4.4-doc","14px serif",[0,"#000000"],0], [2,739,3522.17,105.001,18.5,0,[0,"#000000"]], [3,739,3525.87,"libstdc++6-4.5-doc","14px serif",[0,"#000000"],0], [2,155,3447.17,106.999,18.5,0,[0,"#000000"]], [3,155,3450.87,"libstdc++6-4.4-dbg","14px serif",[0,"#000000"],0], [2,739,3447.17,106.999,18.5,0,[0,"#000000"]], [3,739,3450.87,"libstdc++6-4.5-dbg","14px serif",[0,"#000000"],0], [2,2784,2121.2,20.0002,20.4998,0,[0,"#ff0000"]], [3,2784,2125.3,"#","14px serif",[0,"#ff0000"],0], [2,2366,2121.2,99,18.5,0,[0,"#000000"]], [3,2366,2124.9,"libsdl1.2debian-all","14px serif",[0,"#000000"],0], [2,2366,2196.2,106.999,18.5,0,[0,"#000000"]], [3,2366,2199.9,"libsdl1.2debian-alsa","14px serif",[0,"#000000"],0], [2,2366,2272.2,104,18.5,0,[0,"#000000"]], [3,2366,2275.9,"libsdl1.2debian-esd","14px serif",[0,"#000000"],0], [2,2366,1970.2,103,18.5,0,[0,"#000000"]], [3,2366,1973.9,"libsdl1.2debian-oss","14px serif",[0,"#000000"],0], [2,2366,2045.2,140,18.5,0,[0,"#000000"]], [3,2366,2048.9,"libsdl1.2debian-pulseaudio","14px serif",[0,"#000000"],0], [2,1334,3007.17,90,18.5,0,[0,"#000000"]], [3,1334,3010.87,"libreadline5-dev","14px serif",[0,"#000000"],0], [2,1840,3007.17,115.999,18.5,0,[0,"#000000"]], [3,1840,3010.87,"libreadline6-dev (x 6)","14px serif",[0,"#000000"],0], [2,155,2430.2,90,18.5,0,[0,"#000000"]], [3,155,2433.9,"libreadline5-dbg","14px serif",[0,"#000000"],0], [2,739,2430.2,90,18.5,0,[0,"#000000"]], [3,739,2433.9,"libreadline6-dbg","14px serif",[0,"#000000"],0], [2,155,2354.2,92.0016,18.5,0,[0,"#000000"]], [3,155,2357.9,"libqt4-dbg (x 24)","14px serif",[0,"#000000"],0], [2,739,2354.2,87.9984,18.5,0,[0,"#000000"]], [3,739,2357.9,"qt-x11-free-dbg","14px serif",[0,"#000000"],0], [2,155,2279.2,81,18.5,0,[0,"#000000"]], [3,155,2282.9,"libneon27-dev","14px serif",[0,"#000000"],0], [2,739,2279.2,114.998,18.5,0,[0,"#000000"]], [3,739,2282.9,"libneon27-gnutls-dev","14px serif",[0,"#000000"],0], [2,1840,2662.2,109.001,18.5,0,[0,"#000000"]], [3,1840,2665.9,"libjpeg62-dev (x 23)","14px serif",[0,"#000000"],0], [2,2366,2662.2,69.9984,18.5,0,[0,"#000000"]], [3,2366,2665.9,"libjpeg8-dev","14px serif",[0,"#000000"],0], [2,155,2203.2,113,18.5,0,[0,"#000000"]], [3,155,2206.9,"libjack-jackd2-0 (x 2)","14px serif",[0,"#000000"],0], [2,739,2203.2,74.0016,18.5,0,[0,"#000000"]], [3,739,2206.9,"libjack0 (x 3)","14px serif",[0,"#000000"],0], [2,155,2128.2,74.9988,18.5,0,[0,"#000000"]], [3,155,2131.9,"libiodbc2-dev","14px serif",[0,"#000000"],0], [2,739,2128.2,75.9996,18.5,0,[0,"#000000"]], [3,739,2131.9,"unixodbc-dev","14px serif",[0,"#000000"],0], [2,155,2052.2,78.0012,18.5,0,[0,"#000000"]], [3,155,2055.9,"libgpod4 (x 9)","14px serif",[0,"#000000"],0], [2,739,2052.2,110.002,18.5,0,[0,"#000000"]], [3,739,2055.9,"libgpod4-nogtk (x 2)","14px serif",[0,"#000000"],0], [2,1334,1877.2,110.999,18.5,0,[0,"#000000"]], [3,1334,1880.9,"libgl1-mesa-glx (x 8)","14px serif",[0,"#000000"],0], [2,1840,1879.2,128.002,18.5,0,[0,"#000000"]], [3,1840,1882.9,"libgl1-mesa-swx11 (x 3)","14px serif",[0,"#000000"],0], [2,1840,2571.2,78.0012,18.5,0,[0,"#000000"]], [3,1840,2574.9,"libgd2-noxpm","14px serif",[0,"#000000"],0], [2,2366,2423.2,96.9984,18.5,0,[0,"#000000"]], [3,2366,2426.9,"libgd2-xpm (x 10)","14px serif",[0,"#000000"],0], [2,155,1642.2,81,18.5,0,[0,"#000000"]], [3,155,1645.9,"libelf-dev (x 3)","14px serif",[0,"#000000"],0], [2,739,1642.2,68.0004,18.5,0,[0,"#000000"]], [3,739,1645.9,"libelfg0-dev","14px serif",[0,"#000000"],0], [2,155,1567.2,100.001,18.5,0,[0,"#000000"]], [3,155,1570.9,"libdb4.7-java (x 3)","14px serif",[0,"#000000"],0], [2,739,1567.2,100.001,18.5,0,[0,"#000000"]], [3,739,1570.9,"libdb4.8-java (x 3)","14px serif",[0,"#000000"],0], [2,1334,3189.17,96.9984,18.5,0,[0,"#000000"]], [3,1334,3192.87,"libdb4.7-dev (x 2)","14px serif",[0,"#000000"],0], [2,1840,3254.17,96.9984,18.5,0,[0,"#000000"]], [3,1840,3257.87,"libdb4.8-dev (x 5)","14px serif",[0,"#000000"],0], [2,1840,2837.2,128.002,18.5,0,[0,"#000000"]], [3,1840,2840.9,"libcurl4-gnutls-dev (x 4)","14px serif",[0,"#000000"],0], [2,2366,2837.2,108,18.5,0,[0,"#000000"]], [3,2366,2840.9,"libcurl4-openssl-dev","14px serif",[0,"#000000"],0], [2,1840,1801.2,20.0002,20.4998,0,[0,"#ff0000"]], [3,1840,1805.3,"#","14px serif",[0,"#ff0000"],0], [2,1334,1707.2,110.002,18.5,0,[0,"#000000"]], [3,1334,1710.9,"libclutter-1.0-0 (x 2)","14px serif",[0,"#000000"],0], [2,1334,1802.2,160.999,18.5,0,[0,"#000000"]], [3,1334,1805.9,"libclutter-eglx-es11-1.0-0 (x 2)","14px serif", [0,"#000000"],0], [2,1334,1973.2,160.999,18.5,0,[0,"#000000"]], [3,1334,1976.9,"libclutter-eglx-es20-1.0-0 (x 2)","14px serif", [0,"#000000"],0], [2,155,1491.2,119.002,18.5,0,[0,"#000000"]], [3,155,1494.9,"lib64stdc++6-4.4-dbg","14px serif",[0,"#000000"],0], [2,739,1491.2,119.002,18.5,0,[0,"#000000"]], [3,739,1494.9,"lib64stdc++6-4.5-dbg","14px serif",[0,"#000000"],0], [2,155,1416.2,101.999,18.5,0,[0,"#000000"]], [3,155,1419.9,"lib64readline5-dev","14px serif",[0,"#000000"],0], [2,739,1416.2,101.999,18.5,0,[0,"#000000"]], [3,739,1419.9,"lib64readline6-dev","14px serif",[0,"#000000"],0], [2,155,1340.2,79.9992,18.5,0,[0,"#000000"]], [3,155,1343.9,"hunspell-tools","14px serif",[0,"#000000"],0], [2,739,1340.2,74.9988,18.5,0,[0,"#000000"]], [3,739,1343.9,"myspell-tools","14px serif",[0,"#000000"],0], [2,155,1265.2,90,18.5,0,[0,"#000000"]], [3,155,1268.9,"hunspell-fr (x 3)","14px serif",[0,"#000000"],0], [2,739,1265.2,59.0004,18.5,0,[0,"#000000"]], [3,739,1268.9,"myspell-fr","14px serif",[0,"#000000"],0], [2,155,1189.2,109.001,18.5,0,[0,"#000000"]], [3,155,1192.9,"hunspell-de-de (x 3)","14px serif",[0,"#000000"],0], [2,739,1189.2,119.002,18.5,0,[0,"#000000"]], [3,739,1192.9,"myspell-de-de-oldspell","14px serif",[0,"#000000"],0], [2,155,1114.2,34.9999,18.5,0,[0,"#000000"]], [3,155,1117.9,"hello","14px serif",[0,"#000000"],0], [2,739,1114.2,87.0012,18.5,0,[0,"#000000"]], [3,739,1117.9,"hello-debhelper","14px serif",[0,"#000000"],0], [2,155,812.2,33.9998,18.5,0,[0,"#000000"]], [3,155,815.9,"grub","14px serif",[0,"#000000"],0], [2,739,812.2,88.9992,18.5,0,[0,"#000000"]], [3,739,815.9,"grub-legacy-ec2","14px serif",[0,"#000000"],0], [2,739,926.2,20.0002,20.4998,0,[0,"#ff0000"]], [3,739,930.3,"#","14px serif",[0,"#ff0000"],0], [2,155,887.2,86.0004,18.5,0,[0,"#000000"]], [3,155,890.9,"grub-efi-amd64","14px serif",[0,"#000000"],0], [2,155,963.2,100.001,18.5,0,[0,"#000000"]], [3,155,966.9,"grub-efi-ia32 (x 2)","14px serif",[0,"#000000"],0], [2,155,1038.2,47.9988,18.5,0,[0,"#000000"]], [3,155,1041.9,"grub-pc","14px serif",[0,"#000000"],0], [2,1840,2241.2,68.0004,18.5,0,[0,"#000000"]], [3,1840,2244.9,"foomatic-db","14px serif",[0,"#000000"],0], [2,2366,2347.2,181.001,18.5,0,[0,"#000000"]], [3,2366,2350.9,"foomatic-db-compressed-ppds (x 4)","14px serif", [0,"#000000"],0], [2,155,736.2,29.0002,18.5,0,[0,"#000000"]], [3,155,739.9,"flex","14px serif",[0,"#000000"],0], [2,739,736.2,47.0016,18.5,0,[0,"#000000"]], [3,739,739.9,"flex-old","14px serif",[0,"#000000"],0], [2,155,661.2,142.999,18.5,0,[0,"#000000"]], [3,155,664.9,"exim4-daemon-heavy (x 2)","14px serif",[0,"#000000"],0], [2,739,596.2,135,18.5,0,[0,"#000000"]], [3,739,599.9,"exim4-daemon-light (x 2)","14px serif",[0,"#000000"],0], [2,1840,631.2,99,18.5,0,[0,"#000000"]], [3,1840,634.9,"exim4-config (x 5)","14px serif",[0,"#000000"],0], [2,2366,631.2,69.9984,18.5,0,[0,"#000000"]], [3,2366,634.9,"postfix (x 9)","14px serif",[0,"#000000"],0], [2,155,521.2,54,18.5,0,[0,"#000000"]], [3,155,524.9,"emacs23","14px serif",[0,"#000000"],0], [2,739,521.2,75.9996,18.5,0,[0,"#000000"]], [3,739,524.9,"emacs23-nox","14px serif",[0,"#000000"],0], [2,155,445.2,87.0012,18.5,0,[0,"#000000"]], [3,155,448.9,"debconf-english","14px serif",[0,"#000000"],0], [2,739,445.2,74.0016,18.5,0,[0,"#000000"]], [3,739,448.9,"debconf-i18n","14px serif",[0,"#000000"],0], [2,739,294.2,20.0002,20.4998,0,[0,"#ff0000"]], [3,739,298.3,"#","14px serif",[0,"#ff0000"],0], [2,155,219.2,145.001,18.5,0,[0,"#000000"]], [3,155,222.9,"bacula-common-mysql (x 3)","14px serif",[0,"#000000"],0], [2,155,294.2,141.998,18.5,0,[0,"#000000"]], [3,155,297.9,"bacula-common-pgsql (x 3)","14px serif",[0,"#000000"],0], [2,155,370.2,150.001,18.5,0,[0,"#000000"]], [3,155,373.9,"bacula-common-sqlite3 (x 3)","14px serif",[0,"#000000"],0], [2,155,3307.17,112,18.5,0,[0,"#000000"]], [3,155,3310.87,"apache2-prefork-dev","14px serif",[0,"#000000"],0], [2,739,3371.17,121,18.5,0,[0,"#000000"]], [3,739,3374.87,"apache2-threaded-dev","14px serif",[0,"#000000"],0], [2,1840,106.2,20.0002,20.4998,0,[0,"#ff0000"]], [3,1840,110.3,"#","14px serif",[0,"#ff0000"],0], [2,1334,30.2,110.999,18.5,0,[0,"#000000"]], [3,1334,33.9,"apache2-mpm-event","14px serif",[0,"#000000"],0], [2,1334,106.2,145.001,18.5,0,[0,"#000000"]], [3,1334,109.9,"apache2-mpm-prefork (x 2)","14px serif",[0,"#000000"],0], [2,1334,181.2,118.001,18.5,0,[0,"#000000"]], [3,1334,184.9,"apache2-mpm-worker","14px serif",[0,"#000000"],0], [2,155,68.2,101.999,18.5,0,[0,"#000000"]], [3,155,71.9,"abrowser (x 7049)","14px serif",[0,"#000000"],0], [2,155,143.2,78.9984,18.5,0,[0,"#000000"]], [3,155,146.9,"eucalyptus-nc","14px serif",[0,"#000000"],0], [2,739,143.2,22,22,0,[0,"#0000ff"]], [3,739,147.6,"or","14px serif",[0,"#0000ff"],0], [2,155,1743.2,121,18.5,0,[0,"#000000"]], [3,155,1746.9,"libclutter-1.0-dev (x 2)","14px serif",[0,"#000000"],0], [2,155,1828.2,146.002,18.5,0,[0,"#000000"]], [3,155,1831.9,"libclutter-eglx-es11-1.0-dev","14px serif",[0,"#000000"],0], [2,155,1956.2,146.002,18.5,0,[0,"#000000"]], [3,155,1959.9,"libclutter-eglx-es20-1.0-dev","14px serif",[0,"#000000"],0], [2,739,2704.2,69.9984,18.5,0,[0,"#000000"]], [3,739,2707.9,"libecore-dev","14px serif",[0,"#000000"],0], [2,739,2837.2,90,18.5,0,[0,"#000000"]], [3,739,2840.9,"libedje-dev (x 2)","14px serif",[0,"#000000"],0], [2,739,2585.2,99,18.5,0,[0,"#000000"]], [3,739,2588.9,"libgd2-noxpm-dev","14px serif",[0,"#000000"],0], [2,739,2505.2,86.0004,18.5,0,[0,"#000000"]], [3,739,2508.9,"libgd2-xpm-dev","14px serif",[0,"#000000"],0], [2,739,3037.17,63,18.5,0,[0,"#000000"]], [3,739,3040.87,"librdf0-dev","14px serif",[0,"#000000"],0], [2,739,3160.17,63,18.5,0,[0,"#000000"]], [3,739,3163.87,"librpm-dev","14px serif",[0,"#000000"],0], [2,1334,2177.2,88.9992,18.5,0,[0,"#000000"]], [3,1334,2180.9,"ubuntu-desktop","14px serif",[0,"#000000"],0], [2,1334,2379.2,90,18.5,0,[0,"#000000"]], [3,1334,2382.9,"ubuntu-netbook","14px serif",[0,"#000000"],0], [0,[0,[0,303.12,3900.17],[1,393.26,3900.17,507.79,3900.17,596.83,3900.17]], 0,[0,"#ff0000"]], [0,[0,[0,213.13,3824.17],[1,324.93,3824.17,568.72,3824.17,680.67,3824.17]], 0,[0,"#ff0000"]], [0,[0,[0,214.75,3749.17],[1,326.82,3749.17,567.33,3749.17,679.33,3749.17]], 0,[0,"#ff0000"]], [0,[0,[0,235.59,3673.17],[1,361.22,3673.17,599.38,3673.17,696.33,3673.17]], 0,[0,"#ff0000"]], [0,[0,[0,275.3,3598.17],[1,346.08,3598.17,437.75,3598.17,520.87,3598.17]], 0,[0,"#ff0000"]], [0,[0,[0,260.76,3522.17],[1,366.27,3522.17,527.46,3522.17,633.04,3522.17]], 0,[0,"#ff0000"]], [0,[0,[0,262.11,3447.17],[1,367.16,3447.17,526.43,3447.17,631.58,3447.17]], 0,[0,"#ff0000"]], [0,[0,[0,2465.1,2121.2],[1,2564.3,2121.2,2709.7,2121.2,2763.2,2121.2]],0, [0,"#ff0000"]], [0,[0,[0,2439.8,2182.9],[1,2538,2165.3,2706,2135.2,2763.8,2124.8]],0, [0,"#ff0000"]], [0, [0,[0,2428.2,2257.6],[1,2463.5,2248.9,2508.1,2236.7,2547,2223.2], [1,2630.5,2194.1,2726.2,2149.2,2765.6,2130.2]], 0,[0,"#ff0000"]], [0, [0,[0,2429.1,1984.4],[1,2464.2,1993,2508.5,2004.8,2547,2018.2], [1,2630.7,2047.3,2726.3,2092.8,2765.6,2112.1]], 0,[0,"#ff0000"]], [0,[0,[0,2447.1,2059.9],[1,2546.1,2077.9,2707.3,2107.2,2763.7,2117.5]],0, [0,"#ff0000"]], [0,[0,[0,1424.2,3007.17],[1,1507.8,3007.17,1632.8,3007.17,1723.9,3007.17]], 0,[0,"#ff0000"]], [0,[0,[0,245.29,2430.2],[1,354.95,2430.2,538.82,2430.2,648.55,2430.2]],0, [0,"#ff0000"]], [0,[0,[0,247.54,2354.2],[1,358.01,2354.2,541.46,2354.2,650.24,2354.2]],0, [0,"#ff0000"]], [0,[0,[0,236.51,2279.2],[1,337.2,2279.2,509.15,2279.2,623.42,2279.2]],0, [0,"#ff0000"]], [0,[0,[0,1949.6,2662.2],[1,2053.5,2662.2,2206.4,2662.2,2295.2,2662.2]],0, [0,"#ff0000"]], [0,[0,[0,268.29,2203.2],[1,385.38,2203.2,564.77,2203.2,664.89,2203.2]],0, [0,"#ff0000"]], [0,[0,[0,230.75,2128.2],[1,342.47,2128.2,550.28,2128.2,662.46,2128.2]],0, [0,"#ff0000"]], [0,[0,[0,233.76,2052.2],[1,335.49,2052.2,513.15,2052.2,628.39,2052.2]],0, [0,"#ff0000"]], [0,[0,[0,1445,1877.6],[1,1523.6,1877.9,1629.1,1878.3,1711.3,1878.7]],0, [0,"#ff0000"]], [0,[0,[0,1889.5,2557.3],[1,1988.5,2529.4,2210.1,2467.1,2312.4,2438.3]],0, [0,"#ff0000"]], [0,[0,[0,236.51,1642.2],[1,352.41,1642.2,562.73,1642.2,670.83,1642.2]],0, [0,"#ff0000"]], [0,[0,[0,255.73,1567.2],[1,362.75,1567.2,530.98,1567.2,638.08,1567.2]],0, [0,"#ff0000"]], [0,[0,[0,1414.2,3199.47],[1,1508.8,3211.63,1665.2,3231.71,1759.8,3243.87]], 0,[0,"#ff0000"]], [0,[0,[0,1968.7,2837.2],[1,2057.3,2837.2,2173.8,2837.2,2257.7,2837.2]],0, [0,"#ff0000"]], [0,[0,[0,1407,1720.7],[1,1525,1742.7,1751.2,1784.7,1819.8,1797.4]],0, [0,"#ff0000"]], [0,[0,[0,1495.1,1801.9],[1,1614.3,1801.6,1765,1801.3,1819.3,1801.2]],0, [0,"#ff0000"]], [0,[0,[0,1384.4,1956.1],[1,1493.6,1918.9,1748.3,1832.3,1820.6,1807.8]],0, [0,"#ff0000"]], [0,[0,[0,274.59,1491.2],[1,375.29,1491.2,518.6,1491.2,619.32,1491.2]],0, [0,"#ff0000"]], [0,[0,[0,257.73,1416.2],[1,364.26,1416.2,529.85,1416.2,636.36,1416.2]],0, [0,"#ff0000"]], [0,[0,[0,235.28,1340.2],[1,348.31,1340.2,552.84,1340.2,663.31,1340.2]],0, [0,"#ff0000"]], [0,[0,[0,245.29,1265.2],[1,365.99,1265.2,576.62,1265.2,679.3,1265.2]],0, [0,"#ff0000"]], [0,[0,[0,264.5,1189.2],[1,365.73,1189.2,515.8,1189.2,619.97,1189.2]],0, [0,"#ff0000"]], [0,[0,[0,190.65,1114.2],[1,281.11,1114.2,521.56,1114.2,651.97,1114.2]],0, [0,"#ff0000"]], [0,[0,[0,189.35,812.2],[1,278.29,812.2,518.28,812.2,649.81,812.2]],0, [0,"#ff0000"]], [0,[0,[0,187.23,818.5],[1,293.76,839.3,632.65,905.4,718.88,922.2]],0, [0,"#ff0000"]], [0,[0,[0,237.43,892.7],[1,374.68,901.8,642.46,919.7,718.45,924.8]],0, [0,"#ff0000"]], [0,[0,[0,249.8,957.2],[1,390.15,948.3,644.6,932.2,718.41,927.5]],0, [0,"#ff0000"]], [0,[0,[0,197.94,1029.9],[1,314.77,1007.5,635.17,946.1,718.81,930]],0, [0,"#ff0000"]], [0,[0,[0,1894.8,2252.2],[1,1988,2271,2177.5,2309.2,2285.7,2331]],0, [0,"#ff0000"]], [0,[0,[0,184.36,736.2],[1,278.73,736.2,574.9,736.2,691.32,736.2]],0, [0,"#ff0000"]], [0,[0,[0,262.45,649.2],[1,368.7,637.4,530.17,619.4,635.14,607.7]],0, [0,"#ff0000"]], [0,[0,[0,1939.6,631.2],[1,2043.6,631.2,2204.3,631.2,2295.9,631.2]],0, [0,"#ff0000"]], [0,[0,[0,209.68,521.2],[1,314.17,521.2,542.44,521.2,662.19,521.2]],0, [0,"#ff0000"]], [0,[0,[0,242.12,445.2],[1,356.9,445.2,556.84,445.2,664.79,445.2]],0, [0,"#ff0000"]], [0,[0,[0,256.06,232.2],[1,397.74,250.3,646.23,282.3,718.65,291.6]],0, [0,"#ff0000"]], [0,[0,[0,297.12,294.2],[1,441.28,294.2,652.33,294.2,718.43,294.2]],0, [0,"#ff0000"]], [0,[0,[0,256.73,356.9],[1,398.39,338.5,645.89,306.3,718.46,296.8]],0, [0,"#ff0000"]], [0,[0,[0,247.86,3317.35],[1,355.35,3329.13,531.6,3348.45,641.17,3360.45]], 0,[0,"#ff0000"]], [0,[0,[0,1415.9,42.5],[1,1535.9,60.5,1752.5,93,1819.6,103.1]],0, [0,"#ff0000"]], [0,[0,[0,1479.3,106.2],[1,1600.5,106.2,1762.2,106.2,1819.1,106.2]],0, [0,"#ff0000"]], [0,[0,[0,1418.7,168.6],[1,1539.1,150.8,1752.6,119.1,1819.4,109.2]],0, [0,"#ff0000"]], [1, [0,[0,1733.6,3257.52],[0,1733.49,3254.02],[0,1743.59,3257.2], [0,1733.71,3261.02]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,265.56,3303.7],[1,572.42,3294.04,1431.9,3267.01,1733.6,3257.52]], 0,[0,"#0000ff"]], [1, [0,[0,1769.4,3270.6],[0,1768.63,3267.19],[0,1779.16,3268.4], [0,1770.17,3274.01]], [0,"#0000ff"],[0,"#0000ff"]], [0, [0,[0,858.61,3367.91],[1,1008,3362.76,1271.3,3350.18,1495,3321.17], [1,1590.7,3308.76,1699.9,3286.1,1769.4,3270.6]], 0,[0,"#0000ff"]], [1, [0,[0,1193.9,114.9],[0,1193.66,111.408],[0,1203.88,114.222], [0,1194.14,118.392]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,761.24,141.8],[1,830.72,137.5,1047.8,124,1193.9,114.9]],0, [0,"#0000ff"]], [1, [0,[0,1214.8,173.6],[0,1215,170.106],[0,1224.78,174.182], [0,1214.6,177.094]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,761.24,144.6],[1,834.12,149.2,1069.4,164.3,1214.8,173.6]],0, [0,"#0000ff"]], [1,[0,[0,706.75,143.2],[0,706.75,139.7],[0,716.75,143.2],[0,706.75,146.7]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,234.06,143.2],[1,364.02,143.2,617.28,143.2,706.75,143.2]],0, [0,"#0000ff"]], [1, [0,[0,1730.5,633.1],[0,1730.43,629.601],[0,1740.5,632.904], [0,1730.57,636.599]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,297.21,658.6],[1,626.54,652.8,1435.9,638.4,1730.5,633.1]],0, [0,"#0000ff"]], [1, [0,[0,1731.6,627.7],[0,1731.7,624.202],[0,1741.6,627.997], [0,1731.5,631.198]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,870.44,600.4],[1,1090.2,607.3,1528.2,621.3,1731.6,627.7]],0, [0,"#0000ff"]], [1, [0,[0,1232.6,1865.6],[0,1233.01,1862.12],[0,1242.53,1866.78], [0,1232.19,1869.08]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,251.48,1754.1],[1,471.39,1779.1,1008.1,1840.1,1232.6,1865.6]],0, [0,"#0000ff"]], [1, [0,[0,1215.1,1710.8],[0,1215,1707.3],[0,1225.1,1710.51],[0,1215.2,1714.3]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,274.26,1739.5],[1,500.42,1732.6,989.15,1717.7,1215.1,1710.8]],0, [0,"#0000ff"]], [1, [0,[0,1165.7,1805.9],[0,1165.63,1802.4],[0,1175.7,1805.7], [0,1165.77,1809.4]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,299.27,1825],[1,518.19,1820.2,933.33,1811,1165.7,1805.9]],0, [0,"#0000ff"]], [1, [0,[0,1216,1872.3],[0,1216.14,1868.8],[0,1225.99,1872.69], [0,1215.86,1875.8]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,294,1834],[1,528.11,1843.7,996.91,1863.2,1216,1872.3]],0, [0,"#0000ff"]], [1, [0,[0,1163.8,1970.7],[0,1163.87,1967.2],[0,1173.8,1970.9], [0,1163.73,1974.2]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,300.75,1958.3],[1,519.45,1961.4,931.55,1967.4,1163.8,1970.7]],0, [0,"#0000ff"]], [1, [0,[0,1220.8,1884.8],[0,1220.56,1881.31],[0,1230.78,1884.12], [0,1221.04,1888.29]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,283.7,1947.6],[1,515.75,1932,1000.55,1899.5,1220.8,1884.8]],0, [0,"#0000ff"]], [1, [0,[0,1723.3,2666.6],[0,1723.16,2663.1],[0,1733.29,2666.2], [0,1723.44,2670.1]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,809.13,2701.5],[1,993.71,2694.5,1494.5,2675.4,1723.3,2666.6]],0, [0,"#0000ff"]], [1, [0,[0,1732.3,2824.2],[0,1732.71,2820.72],[0,1742.23,2825.37], [0,1731.89,2827.68]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,802.95,2711.9],[1,984.66,2733.8,1505.4,2796.8,1732.3,2824.2]],0, [0,"#0000ff"]], [1, [0,[0,1701.2,2837.2],[0,1701.2,2833.7],[0,1711.2,2837.2], [0,1701.2,2840.7]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,829.57,2837.2],[1,1021.9,2837.2,1472.3,2837.2,1701.2,2837.2]],0, [0,"#0000ff"]], [1, [0,[0,1747.4,2992.88],[0,1747.93,2989.42],[0,1757.28,2994.4], [0,1746.87,2996.34]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,810.81,2848.3],[1,1003.63,2878,1532.6,2959.7,1747.4,2992.88]],0, [0,"#0000ff"]], [1, [0,[0,1751.1,2676.3],[0,1750.54,2672.84],[0,1760.97,2674.7], [0,1751.66,2679.76]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,809.97,2825.9],[1,1003.19,2795.2,1538.4,2710.1,1751.1,2676.3]],0, [0,"#0000ff"]], [1, [0,[0,1752,2572.3],[0,1751.96,2568.8],[0,1762,2572.2],[0,1752.04,2575.8]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,838.16,2583.9],[1,1051.2,2581.2,1549.4,2574.9,1752,2572.3]],0, [0,"#0000ff"]], [1, [0,[0,1728.7,2654.4],[0,1728.94,2650.91],[0,1738.68,2655.08], [0,1728.46,2657.89]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,831.45,2591.6],[1,1033,2605.7,1511.2,2639.2,1728.7,2654.4]],0, [0,"#0000ff"]], [1, [0,[0,2261.7,2428.4],[0,2261.53,2424.9],[0,2271.69,2427.91], [0,2261.87,2431.9]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,823.33,2500.9],[1,1097.2,2487.1,1961.2,2443.6,2261.7,2428.4]],0, [0,"#0000ff"]], [1, [0,[0,1747.7,2648.7],[0,1748.21,2645.24],[0,1757.59,2650.17], [0,1747.19,2652.16]], [0,"#0000ff"],[0,"#0000ff"]], [0, [0,[0,810.94,2515.3],[1,945.34,2534.2,1243.7,2576.2,1495,2612.2], [1,1580.7,2624.4,1678.2,2638.6,1747.7,2648.7]], 0,[0,"#0000ff"]], [1, [0,[0,1751.6,2853.2],[0,1750.97,2849.76],[0,1761.44,2851.41], [0,1752.23,2856.64]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,792.48,3027.46],[1,968.7,2995.45,1532.4,2893.1,1751.6,2853.2]],0, [0,"#0000ff"]], [1, [0,[0,1778.9,3235.95],[0,1779.88,3232.59],[0,1788.5,3238.75], [0,1777.92,3239.31]], [0,"#0000ff"],[0,"#0000ff"]], [0, [0,[0,796.74,3044.78],[1,923.72,3061.92,1236.5,3106.48,1495,3162.17], [1,1595.4,3183.8,1710.2,3215.94,1778.9,3235.95]], 0,[0,"#0000ff"]], [1, [0,[0,1733.9,3250.47],[0,1734.04,3246.97],[0,1743.89,3250.86], [0,1733.76,3253.97]], [0,"#0000ff"],[0,"#0000ff"]], [0, [0,[0,794.69,3168.66],[1,877.15,3180.92,1036.6,3203.51,1173,3216.17], [1,1370.7,3234.53,1602.2,3245.33,1733.9,3250.47]], 0,[0,"#0000ff"]], [1, [0,[0,1743.2,3020.62],[0,1742.72,3017.15],[0,1753.11,3019.25], [0,1743.68,3024.09]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,795.88,3152.27],[1,973.57,3127.58,1519.8,3051.67,1743.2,3020.62]], 0,[0,"#0000ff"]], [1, [0,[0,2295.7,2406.6],[0,2296.5,2403.19],[0,2305.44,2408.88], [0,2294.9,2410.01]], [0,"#0000ff"],[0,"#0000ff"]], [0, [0,[0,1391.1,2191.1],[1,1465,2209,1597.5,2241.1,1711,2268.2], [1,1923.8,2319,2175.7,2378.4,2295.7,2406.6]], 0,[0,"#0000ff"]], [1, [0,[0,2285.7,2328],[0,2286.57,2324.61],[0,2295.38,2330.49], [0,2284.83,2331.39]], [0,"#0000ff"],[0,"#0000ff"]], [0, [0,[0,1421.5,2173.6],[1,1545,2170.5,1777,2171.9,1969,2214.2], [1,2069.8,2236.3,2087,2267,2185,2299.2], [1,2217.6,2309.9,2254.1,2319.9,2285.7,2328]], 0,[0,"#0000ff"]], [1, [0,[0,2256.4,2059.2],[0,2255.96,2055.73],[0,2266.32,2057.94], [0,2256.84,2062.67]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,1409.5,2167.5],[1,1589.7,2144.5,2045.9,2086.1,2256.4,2059.2]],0, [0,"#0000ff"]], [1, [0,[0,2260.5,2418.7],[0,2260.64,2415.2],[0,2270.49,2419.1], [0,2260.36,2422.2]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,1422.9,2383],[1,1612.7,2391.1,2056.8,2410,2260.5,2418.7]],0, [0,"#0000ff"]], [1, [0,[0,2182.7,2352.9],[0,2182.56,2349.4],[0,2192.69,2352.5], [0,2182.84,2356.4]], [0,"#0000ff"],[0,"#0000ff"]], [0,[0,[0,1423.8,2376.4],[1,1592.5,2371.2,1959.7,2359.8,2182.7,2352.9]],0, [0,"#0000ff"]]]] js_of_ocaml-3.5.2/examples/graph_viewer/scene.ml000066400000000000000000000031771357507750000217440ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type command = | Move_to of float * float | Curve_to of float * float * float * float * float * float type color = float * float * float type ('color, 'font, 'text) element = | Path of command array * 'color option * 'color option | Polygon of (float * float) array * 'color option * 'color option | Ellipse of float * float * float * float * 'color option * 'color option | Text of float * float * 'text * 'font * 'color option * 'color option (****) let rectangle (x1, y1, x2, y2) fill stroke = Polygon ([| x1, y1; x2, y1; x2, y2; x1, y2 |], fill, stroke) (****) type ('color, 'font, 'text) t = ('color, 'font, 'text) element list ref type cairo_t = (float * float * float, string * float, string) t let make () = ref [] let add sc e = sc := e :: !sc let get sc = Array.of_list (List.rev !sc) js_of_ocaml-3.5.2/examples/graph_viewer/scene.mli000066400000000000000000000033151357507750000221070ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type command = | Move_to of float * float | Curve_to of float * float * float * float * float * float type color = float * float * float type ('color, 'font, 'text) element = | Path of command array * 'color option * 'color option | Polygon of (float * float) array * 'color option * 'color option | Ellipse of float * float * float * float * 'color option * 'color option | Text of float * float * 'text * 'font * 'color option * 'color option (****) val rectangle : float * float * float * float -> 'color option -> 'color option -> ('color, 'font, 'text) element (****) type ('color, 'font, 'text) t type cairo_t = (float * float * float, string * float, string) t val make : unit -> ('color, 'font, 'text) t val add : ('color, 'font, 'text) t -> ('color, 'font, 'text) element -> unit val get : ('color, 'font, 'text) t -> ('color, 'font, 'text) element array js_of_ocaml-3.5.2/examples/graph_viewer/scene_extents.ml000066400000000000000000000043571357507750000235170ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Scene let pi = 4. *. atan 1. let path_extent ctx fill stroke = if stroke <> None then Cairo.stroke_extents ctx else Cairo.fill_extents ctx let compute_extent ctx e = Cairo.new_path ctx; match e with | Path (cmd, fill, stroke) -> Array.iter (fun c -> match c with | Move_to (x, y) -> Cairo.move_to ctx x y | Curve_to (x1, y1, x2, y2, x3, y3) -> Cairo.curve_to ctx x1 y1 x2 y2 x3 y3) cmd; path_extent ctx fill stroke | Ellipse (cx, cy, rx, ry, fill, stroke) -> Cairo.save ctx; Cairo.translate ctx cx cy; Cairo.scale ctx rx ry; Cairo.arc ctx 0. 0. 1. 0. (2. *. pi); Cairo.restore ctx; path_extent ctx fill stroke | Polygon (points, fill, stroke) -> Array.iteri (fun i (x, y) -> if i = 0 then Cairo.move_to ctx x y else Cairo.line_to ctx x y) points; Cairo.close_path ctx; path_extent ctx fill stroke | Text (x, y, txt, (font, font_size), fill, stroke) -> Cairo.select_font_face ctx font Cairo.FONT_SLANT_NORMAL Cairo.FONT_WEIGHT_NORMAL; Cairo.set_font_size ctx font_size; let ext = Cairo.text_extents ctx txt in ( x -. (ext.Cairo.text_width /. 2.) -. 5. , y +. ext.Cairo.y_bearing -. 5. , x +. (ext.Cairo.text_width /. 2.) +. 5. , y +. ext.Cairo.y_bearing +. ext.Cairo.text_height +. 5. ) let compute ctx l = Array.map (fun e -> compute_extent ctx e) l js_of_ocaml-3.5.2/examples/graph_viewer/scene_extents.mli000066400000000000000000000017141357507750000236620ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val compute : Cairo.t -> ('color, string * float, string) Scene.element array -> (float * float * float * float) array js_of_ocaml-3.5.2/examples/graph_viewer/scene_json.ml000066400000000000000000000061121357507750000227650ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Scene let array_stringify f ch l = Format.fprintf ch "@[<1>[0"; Array.iter (fun e -> Format.fprintf ch ",@,%a" f e) l; Format.fprintf ch "]@]" let string_stringify ch s = (*XXX Escape! *) Format.fprintf ch "\"%s\"" s let color_stringify ch c = match c with | None -> Format.fprintf ch "0" | Some (r, g, b) -> let h v = truncate (v *. 255.99) in Format.fprintf ch "@[<1>[0,@,%a]@]" string_stringify (Format.sprintf "#%02x%02x%02x" (h r) (h g) (h b)) let font_stringify ch (font, size) = Format.fprintf ch "%a" string_stringify (Format.sprintf "%gpx %s" size font) let command_stringify ch c = match c with | Move_to (x, y) -> Format.fprintf ch "@[<1>[0,@,%g,@,%g]@]" x y | Curve_to (x1, y1, x2, y2, x3, y3) -> Format.fprintf ch "@[<1>[1,@,%g,@,%g,@,%g,@,%g,@,%g,@,%g]@]" x1 y1 x2 y2 x3 y3 let commands_stringify = array_stringify command_stringify let point_stringify ch (x, y) = Format.fprintf ch "@[<1>[0,@,%g,@,%g]@]" x y let points_stringify = array_stringify point_stringify let rect_stringify ch (x1, y1, x2, y2) = Format.fprintf ch "@[<1>[0,@,%g,@,%g,@,%g,@,%g]@]" x1 y1 x2 y2 let rect_array_stringify = array_stringify rect_stringify let element_stringify ch e = match e with | Path (cmds, fill, stroke) -> Format.fprintf ch "@[<1>[0,@,%a,@,%a,@,%a]@]" commands_stringify cmds color_stringify fill color_stringify stroke | Polygon (l, fill, stroke) -> Format.fprintf ch "@[<1>[1,@,%a,@,%a,@,%a]@]" points_stringify l color_stringify fill color_stringify stroke | Ellipse (cx, cy, rx, ry, fill, stroke) -> Format.fprintf ch "@[<1>[2,@,%g,@,%g,@,%g,@,%g,@,%a,@,%a]@]" cx cy rx ry color_stringify fill color_stringify stroke | Text (x, y, txt, font, fill, stroke) -> Format.fprintf ch "@[<1>[3,@,%g,@,%g,@,%a,@,%a,@,%a,@,%a]@]" x y string_stringify txt font_stringify font color_stringify fill color_stringify stroke let stringify = array_stringify element_stringify js_of_ocaml-3.5.2/examples/graph_viewer/scene_json.mli000066400000000000000000000021651357507750000231420ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val rect_stringify : Format.formatter -> float * float * float * float -> unit val rect_array_stringify : Format.formatter -> (float * float * float * float) array -> unit val stringify : Format.formatter -> (float * float * float, string * float, string) Scene.element array -> unit js_of_ocaml-3.5.2/examples/graph_viewer/svg.ml000066400000000000000000000424211357507750000214410ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) type command = | Move_to of float * float | Curve_to of float * float * float * float * float * float type color = float * float * float type element = | Path of command list * color option * color option | Ellipse of float * float * float * float * color option * color option | Polygon of (float * float) list * color option * color option | Text of float * float * string * string * float * color option * color option (****) let width = 16499. let height = 22807. let h = (*8192*) 2000 let w = truncate ((width *. float h /. height) +. 0.5) let s = Cairo.image_surface_create Cairo.FORMAT_ARGB32 w h let perform_draw ctx fill stroke = (* print_extent ctx fill stroke; *) (match fill with | Some (r, g, b) -> Cairo.set_source_rgb ctx r g b; if stroke <> None then Cairo.fill_preserve ctx else Cairo.fill ctx | None -> ()); match stroke with | Some (r, g, b) -> Cairo.set_source_rgb ctx r g b; Cairo.stroke ctx | None -> () let pi = 4. *. atan 1. let draw_element ctx e = match e with | Path (cmd, fill, stroke) -> List.iter (fun c -> match c with | Move_to (x, y) -> Cairo.move_to ctx x y | Curve_to (x1, y1, x2, y2, x3, y3) -> Cairo.curve_to ctx x1 y1 x2 y2 x3 y3) cmd; perform_draw ctx fill stroke | Ellipse (cx, cy, rx, ry, fill, stroke) -> Cairo.save ctx; Cairo.translate ctx cx cy; Cairo.scale ctx rx ry; Cairo.arc ctx 0. 0. 1. 0. (2. *. pi); Cairo.restore ctx; perform_draw ctx fill stroke | Polygon (points, fill, stroke) -> ( match points with | (x, y) :: rem -> Cairo.move_to ctx x y; List.iter (fun (x, y) -> Cairo.line_to ctx x y) rem; Cairo.close_path ctx; perform_draw ctx fill stroke | [] -> ()) | Text (x, y, txt, font, font_size, fill, stroke) -> let ext = Cairo.text_extents ctx txt in Cairo.move_to ctx (x -. ext.Cairo.x_bearing -. (ext.Cairo.text_width /. 2.)) y; Cairo.select_font_face ctx font Cairo.FONT_SLANT_NORMAL Cairo.FONT_WEIGHT_NORMAL; Cairo.set_font_size ctx font_size; Cairo.show_text ctx txt; perform_draw ctx fill stroke let path_extent ctx fill stroke = if stroke <> None then Cairo.stroke_extents ctx else Cairo.fill_extents ctx let compute_extent ctx e = Cairo.new_path ctx; match e with | Path (cmd, fill, stroke) -> List.iter (fun c -> match c with | Move_to (x, y) -> Cairo.move_to ctx x y | Curve_to (x1, y1, x2, y2, x3, y3) -> Cairo.curve_to ctx x1 y1 x2 y2 x3 y3) cmd; path_extent ctx fill stroke | Ellipse (cx, cy, rx, ry, fill, stroke) -> Cairo.save ctx; Cairo.translate ctx cx cy; Cairo.scale ctx rx ry; Cairo.arc ctx 0. 0. 1. 0. (2. *. pi); Cairo.restore ctx; path_extent ctx fill stroke | Polygon (points, fill, stroke) -> ( match points with | (x, y) :: rem -> Cairo.move_to ctx x y; List.iter (fun (x, y) -> Cairo.line_to ctx x y) rem; Cairo.close_path ctx; path_extent ctx fill stroke | [] -> assert false) | Text (x, y, txt, font, font_size, fill, stroke) -> let ext = Cairo.text_extents ctx txt in ( x -. (ext.Cairo.text_width /. 2.) , y +. ext.Cairo.y_bearing , x +. (ext.Cairo.text_width /. 2.) , y +. ext.Cairo.y_bearing +. ext.Cairo.text_height ) let ctx = Cairo.create s let scale = float h /. height let _ = Cairo.scale ctx scale scale; Cairo.translate ctx 364. 22443. (****) let convert (r, g, b) = let c i = float i /. 255.99 in c r, c g, c b let named_colors = let colors = Hashtbl.create 101 in List.iter (fun (nm, v) -> Hashtbl.add colors nm (convert v)) [ "aliceblue", (240, 248, 255) ; "antiquewhite", (250, 235, 215) ; "aqua", (0, 255, 255) ; "aquamarine", (127, 255, 212) ; "azure", (240, 255, 255) ; "beige", (245, 245, 220) ; "bisque", (255, 228, 196) ; "black", (0, 0, 0) ; "blanchedalmond", (255, 235, 205) ; "blue", (0, 0, 255) ; "blueviolet", (138, 43, 226) ; "brown", (165, 42, 42) ; "burlywood", (222, 184, 135) ; "cadetblue", (95, 158, 160) ; "chartreuse", (127, 255, 0) ; "chocolate", (210, 105, 30) ; "coral", (255, 127, 80) ; "cornflowerblue", (100, 149, 237) ; "cornsilk", (255, 248, 220) ; "crimson", (220, 20, 60) ; "cyan", (0, 255, 255) ; "darkblue", (0, 0, 139) ; "darkcyan", (0, 139, 139) ; "darkgoldenrod", (184, 134, 11) ; "darkgray", (169, 169, 169) ; "darkgreen", (0, 100, 0) ; "darkgrey", (169, 169, 169) ; "darkkhaki", (189, 183, 107) ; "darkmagenta", (139, 0, 139) ; "darkolivegreen", (85, 107, 47) ; "darkorange", (255, 140, 0) ; "darkorchid", (153, 50, 204) ; "darkred", (139, 0, 0) ; "darksalmon", (233, 150, 122) ; "darkseagreen", (143, 188, 143) ; "darkslateblue", (72, 61, 139) ; "darkslategray", (47, 79, 79) ; "darkslategrey", (47, 79, 79) ; "darkturquoise", (0, 206, 209) ; "darkviolet", (148, 0, 211) ; "deeppink", (255, 20, 147) ; "deepskyblue", (0, 191, 255) ; "dimgray", (105, 105, 105) ; "dimgrey", (105, 105, 105) ; "dodgerblue", (30, 144, 255) ; "firebrick", (178, 34, 34) ; "floralwhite", (255, 250, 240) ; "forestgreen", (34, 139, 34) ; "fuchsia", (255, 0, 255) ; "gainsboro", (220, 220, 220) ; "ghostwhite", (248, 248, 255) ; "gold", (255, 215, 0) ; "goldenrod", (218, 165, 32) ; "gray", (128, 128, 128) ; "grey", (128, 128, 128) ; "green", (0, 128, 0) ; "greenyellow", (173, 255, 47) ; "honeydew", (240, 255, 240) ; "hotpink", (255, 105, 180) ; "indianred", (205, 92, 92) ; "indigo", (75, 0, 130) ; "ivory", (255, 255, 240) ; "khaki", (240, 230, 140) ; "lavender", (230, 230, 250) ; "lavenderblush", (255, 240, 245) ; "lawngreen", (124, 252, 0) ; "lemonchiffon", (255, 250, 205) ; "lightblue", (173, 216, 230) ; "lightcoral", (240, 128, 128) ; "lightcyan", (224, 255, 255) ; "lightgoldenrodyellow", (250, 250, 210) ; "lightgray", (211, 211, 211) ; "lightgreen", (144, 238, 144) ; "lightgrey", (211, 211, 211) ; "lightpink", (255, 182, 193) ; "lightsalmon", (255, 160, 122) ; "lightseagreen", (32, 178, 170) ; "lightskyblue", (135, 206, 250) ; "lightslategray", (119, 136, 153) ; "lightslategrey", (119, 136, 153) ; "lightsteelblue", (176, 196, 222) ; "lightyellow", (255, 255, 224) ; "lime", (0, 255, 0) ; "limegreen", (50, 205, 50) ; "linen", (250, 240, 230) ; "magenta", (255, 0, 255) ; "maroon", (128, 0, 0) ; "mediumaquamarine", (102, 205, 170) ; "mediumblue", (0, 0, 205) ; "mediumorchid", (186, 85, 211) ; "mediumpurple", (147, 112, 219) ; "mediumseagreen", (60, 179, 113) ; "mediumslateblue", (123, 104, 238) ; "mediumspringgreen", (0, 250, 154) ; "mediumturquoise", (72, 209, 204) ; "mediumvioletred", (199, 21, 133) ; "midnightblue", (25, 25, 112) ; "mintcream", (245, 255, 250) ; "mistyrose", (255, 228, 225) ; "moccasin", (255, 228, 181) ; "navajowhite", (255, 222, 173) ; "navy", (0, 0, 128) ; "oldlace", (253, 245, 230) ; "olive", (128, 128, 0) ; "olivedrab", (107, 142, 35) ; "orange", (255, 165, 0) ; "orangered", (255, 69, 0) ; "orchid", (218, 112, 214) ; "palegoldenrod", (238, 232, 170) ; "palegreen", (152, 251, 152) ; "paleturquoise", (175, 238, 238) ; "palevioletred", (219, 112, 147) ; "papayawhip", (255, 239, 213) ; "peachpuff", (255, 218, 185) ; "peru", (205, 133, 63) ; "pink", (255, 192, 203) ; "plum", (221, 160, 221) ; "powderblue", (176, 224, 230) ; "purple", (128, 0, 128) ; "red", (255, 0, 0) ; "rosybrown", (188, 143, 143) ; "royalblue", (65, 105, 225) ; "saddlebrown", (139, 69, 19) ; "salmon", (250, 128, 114) ; "sandybrown", (244, 164, 96) ; "seagreen", (46, 139, 87) ; "seashell", (255, 245, 238) ; "sienna", (160, 82, 45) ; "silver", (192, 192, 192) ; "skyblue", (135, 206, 235) ; "slateblue", (106, 90, 205) ; "slategray", (112, 128, 144) ; "slategrey", (112, 128, 144) ; "snow", (255, 250, 250) ; "springgreen", (0, 255, 127) ; "steelblue", (70, 130, 180) ; "tan", (210, 180, 140) ; "teal", (0, 128, 128) ; "thistle", (216, 191, 216) ; "tomato", (255, 99, 71) ; "turquoise", (64, 224, 208) ; "violet", (238, 130, 238) ; "wheat", (245, 222, 179) ; "white", (255, 255, 255) ; "whitesmoke", (245, 245, 245) ; "yellow", (255, 255, 0) ; "yellowgreen", (154, 205, 50) ]; colors let svg_name nm = "http://www.w3.org/2000/svg", nm let d_attr = "", "d" let x_attr = "", "x" let y_attr = "", "y" let cx_attr = "", "cx" let cy_attr = "", "cy" let rx_attr = "", "rx" let ry_attr = "", "ry" let points_attr = "", "points" let taxt_anchor_attr = "", "text-anchor" let font_family_attr = "", "font-family" let font_size_attr = "", "font-size" let fill_attr = "", "fill" let stroke_attr = "", "stroke" let stack = ref [] let push e = stack := e :: !stack let skip_whitespace i = (* XXX Check white-space only *) match Xmlm.peek i with | `Data s -> ignore (Xmlm.input i) | _ -> () let end_tag i = let e = Xmlm.input i in assert (e = `El_end) let rec empty_tag i = match Xmlm.input i with | `Data s -> (*Whitespace*) empty_tag i | `El_end -> () | _ -> assert false let rec text_tag i = match Xmlm.input i with | `Data s -> empty_tag i; s | `El_end -> "" | _ -> assert false let comma_wsp = Str.regexp "[\x20\x09\x0D\x0A,]+" let cmd = Str.regexp "[a-zA-Z]" let rec parse_curve_to args rem = match args with | [] -> rem | x1 :: y1 :: x2 :: y2 :: x3 :: z3 :: r -> Curve_to (x1, y1, x2, y2, x3, z3) :: parse_curve_to r rem | _ -> assert false let rec parse_cmds l = match l with | Str.Delim cmd :: Str.Text args :: rem -> ( let args = List.map float_of_string (Str.split comma_wsp args) in let rem = parse_cmds rem in match cmd, args with | "M", [ x; y ] -> Move_to (x, y) :: rem | "C", (_ :: _ as args) -> parse_curve_to args rem | _ -> assert false) | [] -> [] | _ -> assert false let parse_path s = let l = Str.full_split cmd s in parse_cmds l let parse_color c = if c = "none" then None else if String.length c = 7 && c.[0] = '#' then let conv s = int_of_string ("0x" ^ s) in let c = conv (String.sub c 1 2), conv (String.sub c 3 2), conv (String.sub c 5 2) in Some (convert c) else Some (try Hashtbl.find named_colors c with Not_found -> Format.eprintf "%s@." c; assert false) let read_path attrs i = let d = List.assoc d_attr attrs in (*Format.eprintf "d=%s@." d;*) let cmd = parse_path d in let fill = parse_color (List.assoc fill_attr attrs) in let stroke = parse_color (List.assoc stroke_attr attrs) in let e = Path (cmd, fill, stroke) in push e; empty_tag i let read_ellipse attrs i = let cx = float_of_string (List.assoc cx_attr attrs) in let cy = float_of_string (List.assoc cy_attr attrs) in let rx = float_of_string (List.assoc rx_attr attrs) in let ry = float_of_string (List.assoc ry_attr attrs) in let fill = parse_color (List.assoc fill_attr attrs) in let stroke = parse_color (List.assoc stroke_attr attrs) in let e = Ellipse (cx, cy, rx, ry, fill, stroke) in push e; empty_tag i let rec group l = match l with | x :: y :: r -> (x, y) :: group r | [] -> [] | _ -> assert false let read_polygon attrs i = let points = List.assoc points_attr attrs in let points = group (List.map float_of_string (Str.split comma_wsp points)) in let fill = parse_color (List.assoc fill_attr attrs) in let stroke = parse_color (List.assoc stroke_attr attrs) in let e = Polygon (points, fill, stroke) in push e; empty_tag i let read_text attrs i = let fill = parse_color (try List.assoc fill_attr attrs with Not_found -> "black") in let stroke = parse_color (try List.assoc stroke_attr attrs with Not_found -> "none") in let x = float_of_string (List.assoc x_attr attrs) in let y = float_of_string (List.assoc y_attr attrs) in let font = List.assoc font_family_attr attrs in let font_size = float_of_string (List.assoc font_size_attr attrs) in let txt = text_tag i in let e = Text (x, y, txt, font, font_size, fill, stroke) in push e let rec read_element nm attrs i = skip_whitespace i; match Xmlm.input i with | `El_end -> () | `Data d -> ( match Xmlm.input i with | `El_end -> () | _ -> assert false) | `El_start ((_, nm'), attrs') -> (* Format.eprintf "%s" nm'; List.iter (fun ((_, nm), _) -> Format.eprintf " %s" nm) attrs'; Format.eprintf "@."; *) (match nm' with | "path" -> ignore (read_path attrs' i) | "ellipse" -> ignore (read_ellipse attrs' i) | "polygon" -> ignore (read_polygon attrs' i) | "text" -> ignore (read_text attrs' i) | _ -> read_element nm' attrs' i); read_element nm attrs i | _ -> assert false let _ = let ch = open_in "/tmp/foo.svg" in let i = Xmlm.make_input (`Channel ch) in (match Xmlm.input i with | `Dtd (Some nm) -> () | _ -> assert false); match Xmlm.input i with | `El_start ((_, nm), attrs) -> assert (nm = "svg"); read_element nm attrs i | _ -> assert false let l = List.rev !stack let bboxes = ref [] let intersects (x1, y1, x2, y2) (x3, y3, x4, y4) = x1 <= x4 && y1 <= y4 && x3 <= x2 && y3 <= y4 let redraw w range ev = (* let t1 = Unix.gettimeofday () in *) let ctx = Cairo_lablgtk.create w#misc#window in Cairo.save ctx; if !bboxes = [] then bboxes := List.map (fun e -> compute_extent ctx e) l; Cairo.new_path ctx; Cairo_lablgtk.region ctx (GdkEvent.Expose.region ev); let rect = Gdk.Rectangle.create 0 0 0 0 in Gdk.Region.get_clipbox (GdkEvent.Expose.region ev) rect; Cairo.clip ctx; let scale = scale *. ((1. /. scale) ** range#adjustment#value) in Cairo.scale ctx scale scale; Cairo.translate ctx 364. 22443.; let bbox = let x = (float (Gdk.Rectangle.x rect) /. scale) -. 364. in let y = (float (Gdk.Rectangle.y rect) /. scale) -. 22443. in ( x , y , x +. (float (Gdk.Rectangle.width rect) /. scale) , y +. (float (Gdk.Rectangle.height rect) /. scale) ) in (* let (x1, y1, x2, y2) = bbox in Format.eprintf "%f %f %f %f (%f)@." x1 y1 x2 y2 scale; *) List.iter2 (fun box e -> if intersects box bbox then draw_element ctx e) !bboxes l; Cairo.restore ctx; (* let t2 = Unix.gettimeofday () in Format.eprintf "%f@." (t2 -. t1); *) true let slider_changed (area : GMisc.drawing_area) range () = let scale = scale *. ((1. /. scale) ** range#adjustment#value) in area#misc#set_size_request ~width:(truncate (width *. scale)) ~height:(truncate (height *. scale)) (); GtkBase.Widget.queue_draw area#as_widget let _ = ignore (GMain.Main.init ()); let initial_size = 600 in let w = GWindow.window () in ignore (w#connect#destroy GMain.quit); let b = GPack.vbox ~spacing:6 ~border_width:12 ~packing:w#add () in (* let f = GBin.frame ~shadow_type:`IN ~packing:(b#pack ~expand:true ~fill:true) () in *) let f = GBin.scrolled_window ~packing:(b#pack ~expand:true) (* ~hpolicy:`AUTOMATIC ~vpolicy:`AUTOMATIC *) () in let area = GMisc.drawing_area ~width:initial_size ~height:initial_size ~packing:f#add_with_viewport () in area#misc#set_size_request ~width:(truncate (width *. scale)) ~height:(truncate (height *. scale)) (); let slider = GRange.scale `HORIZONTAL ~draw_value:false ~packing:b#pack () in slider#adjustment#set_bounds ~lower:0. ~upper:1. ~step_incr:0.1 (); (* let button = GButton.check_button ~label:"Animate" ~packing:b#pack () in ignore (area#event#connect#expose (redraw area slider)) ; ignore (slider#connect#value_changed (slider_changed area)) ; ignore (button#connect#toggled (animate_toggled button slider)) ; *) ignore (area#event#connect#expose (redraw area slider)); ignore (slider#connect#value_changed (slider_changed area slider)); w#show (); GMain.main () (* let _ = let l = List.rev !stack in Format.eprintf "len: %d@." (List.length l); let t1 = Unix.gettimeofday () in List.iter (fun e -> draw_element ctx e) l; let t2 = Unix.gettimeofday () in Format.eprintf "%f@." (t2 -. t1); (* let ch = open_out "/tmp/foo.mar" in Marshal.to_channel ch l []; close_out ch; *) Cairo_png.surface_write_to_file s "/tmp/foo.png" *) js_of_ocaml-3.5.2/examples/graph_viewer/viewer.ml000066400000000000000000000335041357507750000221450ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Scene let pi = 4. *. atan 1. (****) let path_extent ctx fill stroke = if stroke <> None then Cairo.stroke_extents ctx else Cairo.fill_extents ctx let compute_extent ctx e = Cairo.new_path ctx; match e with | Path (cmd, fill, stroke) -> Array.iter (fun c -> match c with | Move_to (x, y) -> Cairo.move_to ctx x y | Curve_to (x1, y1, x2, y2, x3, y3) -> Cairo.curve_to ctx x1 y1 x2 y2 x3 y3) cmd; path_extent ctx fill stroke | Ellipse (cx, cy, rx, ry, fill, stroke) -> Cairo.save ctx; Cairo.translate ctx cx cy; Cairo.scale ctx rx ry; Cairo.arc ctx 0. 0. 1. 0. (2. *. pi); Cairo.restore ctx; path_extent ctx fill stroke | Polygon (points, fill, stroke) -> Array.iteri (fun i (x, y) -> if i = 0 then Cairo.move_to ctx x y else Cairo.line_to ctx x y) points; Cairo.close_path ctx; path_extent ctx fill stroke | Text (x, y, txt, (font, font_size), fill, stroke) -> Cairo.select_font_face ctx font Cairo.FONT_SLANT_NORMAL Cairo.FONT_WEIGHT_NORMAL; Cairo.set_font_size ctx font_size; let ext = Cairo.text_extents ctx txt in ( x -. (ext.Cairo.text_width /. 2.) -. 5. , y +. ext.Cairo.y_bearing -. 5. , x +. (ext.Cairo.text_width /. 2.) +. 5. , y +. ext.Cairo.y_bearing +. ext.Cairo.text_height +. 5. ) (****) module Common = Viewer_common.F (struct type font = string * float type color = float * float * float type text = string let white = 1., 1., 1. type ctx = Cairo.t let save = Cairo.save let restore = Cairo.restore let scale = Cairo.scale let translate = Cairo.translate let begin_path = Cairo.new_path let close_path = Cairo.close_path let move_to = Cairo.move_to let line_to = Cairo.line_to let curve_to = Cairo.curve_to let arc = Cairo.arc let rectangle = Cairo.rectangle let fill ctx (r, g, b) = Cairo.set_source_rgb ctx r g b; Cairo.fill_preserve ctx let stroke ctx (r, g, b) = Cairo.set_source_rgb ctx r g b; Cairo.stroke_preserve ctx let clip = Cairo.clip let perform_draw ctx fill_color stroke_color = (match fill_color with | Some c -> fill ctx c | None -> ()); match stroke_color with | Some c -> stroke ctx c | None -> () let draw_text ctx x y txt (font, font_size) fill stroke = Cairo.select_font_face ctx font Cairo.FONT_SLANT_NORMAL Cairo.FONT_WEIGHT_NORMAL; Cairo.set_font_size ctx font_size; let ext = Cairo.text_extents ctx txt in Cairo.move_to ctx (x -. ext.Cairo.x_bearing -. (ext.Cairo.text_width /. 2.)) y; Cairo.show_text ctx txt; perform_draw ctx fill stroke type window = GMisc.drawing_area type drawable = GDraw.drawable type pixmap = GDraw.pixmap let get_drawable w = new GDraw.drawable w#misc#window let make_pixmap window width height = GDraw.pixmap ~width ~height ~window () let drawable_of_pixmap p = (p : GDraw.pixmap :> GDraw.drawable) let get_context p = Cairo_lablgtk.create p#pixmap let put_pixmap ~(dst : GDraw.drawable) ~x ~y ~xsrc ~ysrc ~width ~height p = dst#put_pixmap ~x ~y ~xsrc ~ysrc ~width ~height p#pixmap (****) type rectangle = Gtk.rectangle = { x : int ; y : int ; width : int ; height : int } let compute_extents = Scene_extents.compute end) open Common (****) let set_visible w vis = if vis then (if not w#misc#visible then w#misc#show ()) else if w#misc#visible then w#misc#hide () let scroll_view ?width ?height ?packing st = let table = GPack.table ?width ?height ~columns:2 ~rows:2 ?packing () in let hadj = GData.adjustment () in let hbar = GRange.scrollbar `HORIZONTAL ~adjustment:hadj ~packing:(table#attach ~left:0 ~top:1 ~fill:`BOTH ~expand:`NONE) () in hbar#misc#hide (); let vadj = GData.adjustment () in let vbar = GRange.scrollbar `VERTICAL ~adjustment:vadj ~packing:(table#attach ~left:1 ~top:0 ~fill:`BOTH ~expand:`NONE) () in vbar#misc#hide (); let display = GMisc.drawing_area ~packing:(table#attach ~left:0 ~top:0 ~fill:`BOTH ~expand:`BOTH) () in display#misc#set_can_focus true; display#misc#set_double_buffered false; let sadj = GData.adjustment ~upper:20. ~step_incr:1. ~page_incr:1. ~page_size:0. () in let zoom_steps = 8. in (* Number of steps to get a factor of 2 *) let set_zoom_factor f = let count = ceil (log f /. log 2. *. zoom_steps) in let f = 2. ** (count /. zoom_steps) in sadj#set_bounds ~upper:count (); Format.eprintf "Factor: %f@." f; st.zoom_factor <- f in let get_scale () = (2. ** (sadj#value /. zoom_steps)) /. st.zoom_factor in let update_scrollbars () = let a = display#misc#allocation in let scale = get_scale () in let aw = ceil (float a.Gtk.width /. scale) in let ah = ceil (float a.Gtk.height /. scale) in hadj#set_bounds ~step_incr:(aw /. 20.) ~page_incr:(aw /. 2.) ~page_size:(min aw st.st_width) ~upper:st.st_width (); let mv = st.st_width -. hadj#page_size in if hadj#value > mv then hadj#set_value mv; vadj#set_bounds ~step_incr:(ah /. 20.) ~page_incr:(ah /. 2.) ~page_size:(min ah st.st_height) ~upper:st.st_height (); let mv = st.st_height -. vadj#page_size in if vadj#value > mv then vadj#set_value mv; set_visible hbar (aw < st.st_width); set_visible vbar (ah < st.st_height) in let refresh () = invalidate_pixmap st.st_pixmap; GtkBase.Widget.queue_draw display#as_widget in ignore (display#event#connect#configure (fun ev -> prerr_endline "CONFIGURE"; update_scrollbars (); false)); ignore (display#event#connect#map (fun ev -> let a = display#misc#allocation in Format.eprintf "alloc: %d %d@." a.Gtk.width a.Gtk.height; let zoom_factor = max (st.st_width /. float a.Gtk.width) (st.st_height /. float a.Gtk.height) in set_zoom_factor zoom_factor; refresh (); update_scrollbars (); false)); display#event#add [ `STRUCTURE ]; ignore (display#event#connect#expose (fun ev -> let area = GdkEvent.Expose.area ev in let x = Gdk.Rectangle.x area in let y = Gdk.Rectangle.y area in let width = Gdk.Rectangle.width area in let height = Gdk.Rectangle.height area in redraw st (get_scale ()) hadj#value vadj#value display display#misc#allocation x y width height; true)); ignore (hadj#connect#value_changed (fun () -> GtkBase.Widget.queue_draw display#as_widget)); ignore (vadj#connect#value_changed (fun () -> GtkBase.Widget.queue_draw display#as_widget)); let prev_scale = ref (get_scale ()) in let zoom_center = ref (0.5, 0.5) in ignore (sadj#connect#value_changed (fun () -> let scale = get_scale () in let r = 1. -. (!prev_scale /. scale) in Format.eprintf "update@."; hadj#set_value (hadj#value +. (hadj#page_size *. r *. fst !zoom_center)); vadj#set_value (vadj#value +. (vadj#page_size *. r *. snd !zoom_center)); prev_scale := scale; refresh (); update_scrollbars ())); let bump_scale x y v = let a = display#misc#allocation in let x = x /. float a.Gtk.width in let y = y /. float a.Gtk.height in if x >= 0. && x <= 1. && y >= 0. && y <= 1. then zoom_center := x, y; Format.eprintf "loc: %f %f@." x y; sadj#set_value (sadj#value +. (v *. sadj#step_increment)); Format.eprintf "reset@."; zoom_center := 0.5, 0.5; true in (* Zoom using the mouse wheel *) ignore (display#event#connect#scroll (fun ev -> let x = GdkEvent.Scroll.x ev in let y = GdkEvent.Scroll.y ev in match GdkEvent.Scroll.direction ev with | `UP -> bump_scale x y 1. | `DOWN -> bump_scale x y (-1.) | _ -> false)); display#event#add [ `SCROLL ]; let pos = ref None in ignore (display#event#connect#button_press (fun ev -> display#misc#grab_focus (); if GdkEvent.get_type ev = `BUTTON_PRESS && GdkEvent.Button.button ev = 1 then pos := Some (GdkEvent.Button.x ev, GdkEvent.Button.y ev); false)); ignore (display#event#connect#button_release (fun ev -> if GdkEvent.Button.button ev = 1 then pos := None; false)); ignore (display#event#connect#motion_notify (fun ev -> (match !pos with | Some (x, y) -> let x', y' = if GdkEvent.Motion.is_hint ev then let x', y' = display#misc#pointer in float x', float y' else GdkEvent.Motion.x ev, GdkEvent.Motion.y ev in let offset a d = a#set_value (min (a#value +. d) (a#upper -. a#page_size)) in let scale = get_scale () in offset hadj ((x -. x') /. scale); offset vadj ((y -. y') /. scale); pos := Some (x', y') | None -> ()); false)); display#event#add [ `BUTTON_PRESS; `BUTTON_RELEASE; `BUTTON1_MOTION; `POINTER_MOTION_HINT ]; ignore (display#event#connect#key_press (fun ev -> let keyval = GdkEvent.Key.keyval ev in if keyval = GdkKeysyms._Up then ( vadj#set_value (vadj#value -. vadj#step_increment); update_scrollbars (); true) else if keyval = GdkKeysyms._Down then ( vadj#set_value (vadj#value +. vadj#step_increment); update_scrollbars (); true) else if keyval = GdkKeysyms._Left then ( hadj#set_value (hadj#value -. hadj#step_increment); update_scrollbars (); true) else if keyval = GdkKeysyms._Right then ( hadj#set_value (hadj#value +. hadj#step_increment); update_scrollbars (); true) else if keyval = GdkKeysyms._Page_Up then ( vadj#set_value (vadj#value -. vadj#page_increment); update_scrollbars (); true) else if keyval = GdkKeysyms._Page_Down then ( vadj#set_value (vadj#value +. vadj#page_increment); update_scrollbars (); true) else if keyval = GdkKeysyms._0 || keyval = GdkKeysyms._agrave then ( let a = table#misc#allocation in Format.eprintf "alloc: %d %d@." a.Gtk.width a.Gtk.height; let zf = max (st.st_width /. float a.Gtk.width) (st.st_height /. float a.Gtk.height) in let v = ceil (log zf /. log 2. *. zoom_steps) in Format.eprintf "ZOOM: %f %f %f@." zf v sadj#upper; sadj#set_value (min sadj#upper (max 0. (sadj#upper -. v))); true) else if keyval = GdkKeysyms._1 || keyval = GdkKeysyms._ampersand then ( sadj#set_value sadj#upper; true) else if keyval = GdkKeysyms._plus || keyval = GdkKeysyms._equal || keyval = GdkKeysyms._KP_Add then let x, y = display#misc#pointer in bump_scale (float x) (float y) 1. else if keyval = GdkKeysyms._minus || keyval = GdkKeysyms._KP_Subtract then let x, y = display#misc#pointer in bump_scale (float x) (float y) (-1.) else false)); display#event#add [ `KEY_PRESS ]; object method scale_adjustment = sadj end let create ?(full_screen = false) (x1, y1, x2, y2) scene = let st = { bboxes = [||] ; scene = Scene.get scene ; zoom_factor = 20. ; st_x = x1 ; st_y = y1 ; st_width = x2 -. x1 ; st_height = y2 -. y1 ; st_pixmap = make_pixmap () } in let initial_size = 600 in let w = GWindow.window () in ignore (w#connect#destroy GMain.quit); let b = GPack.hbox ~packing:w#add () in let f = scroll_view ~width:initial_size ~height:initial_size ~packing:(b#pack ~expand:true) st in ignore (GRange.scale `VERTICAL ~inverted:true ~draw_value:false ~adjustment:f#scale_adjustment ~packing:b#pack ()); (*XXX Tooltips area#misc#set_has_tooltip true; ignore (area#misc#connect#query_tooltip (fun ~x ~y ~kbd tooltip -> Format.eprintf "%d %d %b@." x y kbd; false)); *) (* Full screen mode *) let fullscreen = ref false in let toggle_fullscreen () = if !fullscreen then w#unfullscreen () else w#fullscreen (); fullscreen := not !fullscreen; true in if full_screen then ignore (toggle_fullscreen ()); ignore (w#event#connect#key_press (fun ev -> let keyval = GdkEvent.Key.keyval ev in if keyval = GdkKeysyms._q || keyval = GdkKeysyms._Q then exit 0 else if keyval = GdkKeysyms._F11 || keyval = GdkKeysyms._F5 || (keyval = GdkKeysyms._Escape && !fullscreen) || keyval = GdkKeysyms._f || keyval = GdkKeysyms._F then toggle_fullscreen () else false)); w#show () js_of_ocaml-3.5.2/examples/graph_viewer/viewer.mli000066400000000000000000000016451357507750000223170ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) val create : ?full_screen:bool -> float * float * float * float -> Scene.cairo_t -> unit js_of_ocaml-3.5.2/examples/graph_viewer/viewer_common.ml000066400000000000000000000214441357507750000235150ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Scene let pi = 4. *. atan 1. (****) module F (M : sig type font type color type text val white : color type ctx val save : ctx -> unit val restore : ctx -> unit val scale : ctx -> sx:float -> sy:float -> unit val translate : ctx -> tx:float -> ty:float -> unit val begin_path : ctx -> unit val close_path : ctx -> unit val move_to : ctx -> x:float -> y:float -> unit val line_to : ctx -> x:float -> y:float -> unit val curve_to : ctx -> x1:float -> y1:float -> x2:float -> y2:float -> x3:float -> y3:float -> unit val arc : ctx -> xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit val rectangle : ctx -> x:float -> y:float -> width:float -> height:float -> unit val fill : ctx -> color -> unit val stroke : ctx -> color -> unit val clip : ctx -> unit val draw_text : ctx -> float -> float -> text -> font -> color option -> color option -> unit type window type drawable type pixmap val get_drawable : window -> drawable val make_pixmap : window -> int -> int -> pixmap val drawable_of_pixmap : pixmap -> drawable val get_context : pixmap -> ctx val put_pixmap : dst:drawable -> x:int -> y:int -> xsrc:int -> ysrc:int -> width:int -> height:int -> pixmap -> unit (****) type rectangle = { x : int ; y : int ; width : int ; height : int } val compute_extents : ctx -> (color, font, text) Scene.element array -> (float * float * float * float) array end) = struct open M let empty_rectangle = { x = 0; y = 0; width = 0; height = 0 } let rectangle_is_empty r = r.width = 0 || r.height = 0 (****) type pixmap = { mutable pixmap : M.pixmap option ; mutable p_width : int ; mutable p_height : int ; mutable valid_rect : rectangle } let make_pixmap () = { pixmap = None; p_width = 0; p_height = 0; valid_rect = empty_rectangle } let invalidate_pixmap p = p.valid_rect <- empty_rectangle let grow_pixmap pm window width height = let width = max width pm.p_width in let height = max height pm.p_height in if width > pm.p_width || height > pm.p_height then ( let old_p = pm.pixmap in let p = M.make_pixmap window width height in let r = pm.valid_rect in (match old_p with | Some old_p -> put_pixmap ~dst:(drawable_of_pixmap p) ~x:0 ~y:0 ~xsrc:0 ~ysrc:0 ~width:r.width ~height:r.height old_p | None -> ()); pm.pixmap <- Some p; pm.p_width <- width; pm.p_height <- height) let get_pixmap pm = match pm.pixmap with | Some p -> p | None -> assert false (****) type st = { mutable bboxes : (float * float * float * float) array ; scene : (color, font, text) Scene.element array ; mutable zoom_factor : float ; st_x : float ; st_y : float ; st_width : float ; st_height : float ; st_pixmap : pixmap } (****) let perform_draw ctx fill stroke = (match fill with | Some c -> M.fill ctx c | None -> ()); match stroke with | Some c -> M.stroke ctx c | None -> () let draw_element ctx e = begin_path ctx; match e with | Path (cmd, fill, stroke) -> Array.iter (fun c -> match c with | Move_to (x, y) -> move_to ctx ~x ~y | Curve_to (x1, y1, x2, y2, x3, y3) -> curve_to ctx ~x1 ~y1 ~x2 ~y2 ~x3 ~y3) cmd; perform_draw ctx fill stroke | Ellipse (cx, cy, rx, ry, fill, stroke) -> save ctx; translate ctx ~tx:cx ~ty:cy; scale ctx ~sx:rx ~sy:ry; arc ctx ~xc:0. ~yc:0. ~radius:1. ~angle1:0. ~angle2:(2. *. pi); restore ctx; perform_draw ctx fill stroke | Polygon (points, fill, stroke) -> Array.iteri (fun i (x, y) -> if i = 0 then move_to ctx ~x ~y else line_to ctx ~x ~y) points; close_path ctx; perform_draw ctx fill stroke | Text (x, y, txt, font, fill, stroke) -> draw_text ctx x y txt font fill stroke let intersects ((x1, y1, x2, y2) : float * float * float * float) (x3, y3, x4, y4) = x1 <= x4 && y1 <= y4 && x3 <= x2 && y3 <= y2 let redraw st scale x y x' y' w h = (* Format.eprintf "REDRAW %d %d %d %d@." x' y' w h; *) let ctx = get_context (get_pixmap st.st_pixmap) in save ctx; if Array.length st.bboxes = 0 && Array.length st.scene > 0 then st.bboxes <- compute_extents ctx st.scene; begin_path ctx; rectangle ctx ~x:(float x') ~y:(float y') ~width:(float w) ~height:(float h); M.fill ctx M.white; clip ctx; let x = float x /. scale in let y = float y /. scale in M.scale ctx ~sx:scale ~sy:scale; translate ctx ~tx:(-.st.st_x -. x) ~ty:(-.st.st_y -. y); let bbox = let x = st.st_x +. x +. (float x' /. scale) in let y = st.st_y +. y +. (float y' /. scale) in ( x , y , x +. (float st.st_pixmap.p_width /. scale) , y +. (float st.st_pixmap.p_height /. scale) ) in for i = 0 to Array.length st.scene - 1 do let box = st.bboxes.(i) in let e = st.scene.(i) in if intersects box bbox then draw_element ctx e done; restore ctx let redraw st scale x0 y0 window a x y width height = let pm = st.st_pixmap in grow_pixmap pm window a.width a.height; let round x = truncate ((x *. scale) +. 0.5) in let x0 = round x0 in let x0' = round (((float a.width /. scale) -. st.st_width) /. 2.) in let x0 = if x0' > 0 then -x0' else x0 in let y0 = round y0 in let y0' = round (((float a.height /. scale) -. st.st_height) /. 2.) in let y0 = if y0' > 0 then -y0' else y0 in let dx = pm.valid_rect.x - x0 in let dy = pm.valid_rect.y - y0 in (* Firebug.console##log_6 (dx, pm.valid_rect.width, a.width, dy, pm.valid_rect.height, a.height); *) if (dx > 0 && pm.valid_rect.width + dx < a.width) || (dy > 0 && pm.valid_rect.height + dy < a.height) then pm.valid_rect <- empty_rectangle else if not (rectangle_is_empty pm.valid_rect) then ( (*XXX FIX: should redraw up to four rectangles here *) (*XXX FIX: does not change pm.valid_rect when it is large enough already and valid *) let p = get_pixmap pm in let r = pm.valid_rect in (* Format.eprintf "Translation: %d %d@." dx dy; *) if dx <> 0 || dy <> 0 then put_pixmap ~dst:(drawable_of_pixmap p) ~x:dx ~y:dy ~xsrc:0 ~ysrc:0 ~width:r.width ~height:r.height p; let offset p l d m = (* 0 <= p; 0 <= l; p + l <= m *) if p + d + l <= 0 then 0, 0 else if p + d < 0 then 0, l + p + d else if p + d >= m then m, 0 else if p + d + l > m then p + d, m - p - d else p + d, l in let x, width = offset 0 r.width dx pm.p_width in let y, height = offset 0 r.height dy pm.p_height in if height > 0 then if x > 0 then ( assert (x + width >= a.width); redraw st scale x0 y0 0 y x height) else ( assert (x = 0); if a.width > width then redraw st scale x0 y0 width y (a.width - width) height); if y > 0 then ( assert (y + height >= a.height); redraw st scale x0 y0 0 0 a.width y) else ( assert (y = 0); if a.height > height then redraw st scale x0 y0 0 height a.width (a.height - height)); pm.valid_rect <- { x = x0; y = y0; width = a.width; height = a.height }); let r = pm.valid_rect in if x < 0 || y < 0 || x + width > r.width || y + height > r.height then ( redraw st scale x0 y0 0 0 a.width a.height; pm.valid_rect <- { x = x0; y = y0; width = a.width; height = a.height }); put_pixmap ~dst:(get_drawable window) ~x ~y ~xsrc:x ~ysrc:y ~width ~height (get_pixmap pm) end js_of_ocaml-3.5.2/examples/graph_viewer/viewer_common.mli000066400000000000000000000055331357507750000236670ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module F (M : sig type color type font type text val white : color type ctx val save : ctx -> unit val restore : ctx -> unit val scale : ctx -> sx:float -> sy:float -> unit val translate : ctx -> tx:float -> ty:float -> unit val begin_path : ctx -> unit val close_path : ctx -> unit val move_to : ctx -> x:float -> y:float -> unit val line_to : ctx -> x:float -> y:float -> unit val curve_to : ctx -> x1:float -> y1:float -> x2:float -> y2:float -> x3:float -> y3:float -> unit val arc : ctx -> xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit val rectangle : ctx -> x:float -> y:float -> width:float -> height:float -> unit val fill : ctx -> color -> unit val stroke : ctx -> color -> unit val clip : ctx -> unit val draw_text : ctx -> float -> float -> text -> font -> color option -> color option -> unit type window type drawable type pixmap val get_drawable : window -> drawable val make_pixmap : window -> int -> int -> pixmap val drawable_of_pixmap : pixmap -> drawable val get_context : pixmap -> ctx val put_pixmap : dst:drawable -> x:int -> y:int -> xsrc:int -> ysrc:int -> width:int -> height:int -> pixmap -> unit (****) type rectangle = { x : int ; y : int ; width : int ; height : int } val compute_extents : ctx -> (color, font, text) Scene.element array -> (float * float * float * float) array end) : sig type pixmap val make_pixmap : unit -> pixmap val invalidate_pixmap : pixmap -> unit type st = { mutable bboxes : (float * float * float * float) array ; scene : (M.color, M.font, M.text) Scene.element array ; mutable zoom_factor : float ; st_x : float ; st_y : float ; st_width : float ; st_height : float ; st_pixmap : pixmap } val redraw : st -> float -> float -> float -> M.window -> M.rectangle -> int -> int -> int -> int -> unit end js_of_ocaml-3.5.2/examples/graph_viewer/viewer_js.ml000066400000000000000000000357451357507750000226520ustar00rootroot00000000000000(* Graph viewer * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js_of_ocaml_lwt type rect = { x : int ; y : int ; width : int ; height : int } module Html = Dom_html let create_canvas w h = let c = Html.createCanvas Html.document in c##.width := w; c##.height := h; c module Common = Viewer_common.F (struct type font = Js.js_string Js.t type color = Js.js_string Js.t type text = Js.js_string Js.t let white = Js.string "white" type ctx = Html.canvasRenderingContext2D Js.t let save ctx = ctx##save let restore ctx = ctx##restore let scale ctx ~sx ~sy = ctx##scale sx sy let translate ctx ~tx ~ty = ctx##translate tx ty let begin_path ctx = ctx##beginPath let close_path ctx = ctx##closePath let move_to ctx ~x ~y = ctx##moveTo x y let line_to ctx ~x ~y = ctx##lineTo x y let curve_to ctx ~x1 ~y1 ~x2 ~y2 ~x3 ~y3 = ctx##bezierCurveTo x1 y1 x2 y2 x3 y3 let arc ctx ~xc ~yc ~radius ~angle1 ~angle2 = ctx##arc xc yc radius angle1 angle2 Js._true let rectangle ctx ~x ~y ~width ~height = ctx##rect x y width height let fill ctx c = ctx##.fillStyle := c; ctx##fill let stroke ctx c = ctx##.strokeStyle := c; ctx##stroke let clip ctx = ctx##clip let draw_text (ctx : ctx) x y txt font fill_color stroke_color = ctx##.font := font; ctx##.textAlign := Js.string "center"; ctx##.textBaseline := Js.string "middle"; (match fill_color with | Some c -> ctx##.fillStyle := c; ctx##fillText txt x y | None -> ()); match stroke_color with | Some c -> ctx##.strokeStyle := c; ctx##strokeText txt x y | None -> () type window = Html.canvasElement Js.t type drawable = window * ctx type pixmap = drawable let get_drawable w = let ctx = w##getContext Html._2d_ in ctx##.lineWidth := 2.; w, ctx let make_pixmap _ width height = let c = Html.createCanvas Html.document in c##.width := width; c##.height := height; get_drawable c let drawable_of_pixmap p = p let get_context (_p, c) = c let put_pixmap ~dst:((_p, c) : drawable) ~x ~y ~xsrc ~ysrc ~width ~height ((p, _) : pixmap) = c##drawImage_fullFromCanvas p (float xsrc) (float ysrc) (float width) (float height) (float x) (float y) (float width) (float height) (****) type rectangle = rect = { x : int ; y : int ; width : int ; height : int } let compute_extents _ = assert false end) open Common let redraw st s h v (canvas : Html.canvasElement Js.t) = let width = canvas##.width in let height = canvas##.height in (*Firebug.console##time (Js.string "draw");*) redraw st s h v canvas { x = 0; y = 0; width; height } 0 0 width height (* ;Firebug.console##timeEnd (Js.string "draw") ;Firebug.console##log_2 (Js.string "draw", Js.date##now()) *) let json : < parse : Js.js_string Js.t -> 'a > Js.t = Js.Unsafe.pure_js_expr "JSON" let ( >>= ) = Lwt.bind let http_get url = XmlHttpRequest.get url >>= fun { XmlHttpRequest.code = cod; content = msg; _ } -> if cod = 0 || cod = 200 then Lwt.return msg else fst (Lwt.wait ()) let getfile f = try Lwt.return (Sys_js.read_file ~name:f) with Not_found -> http_get f class adjustment ?(value = 0.) ?(lower = 0.) ?(upper = 100.) ?(step_incr = 1.) ?(page_incr = 10.) ?(page_size = 10.) () = object val mutable _value = value method value = _value val mutable _lower = lower method lower = _lower val mutable _upper = upper method upper = _upper val mutable _step_incr = step_incr method step_increment = _step_incr val mutable _page_incr = page_incr method page_increment = _page_incr val mutable _page_size = page_size method page_size = _page_size method set_value v = _value <- v method set_bounds ?lower ?upper ?step_incr ?page_incr ?page_size () = (match lower with | Some v -> _lower <- v | None -> ()); (match upper with | Some v -> _upper <- v | None -> ()); (match step_incr with | Some v -> _step_incr <- v | None -> ()); (match page_incr with | Some v -> _page_incr <- v | None -> ()); match page_size with | Some v -> _page_size <- v | None -> () end let handle_drag element f = let mx = ref 0 in let my = ref 0 in element##.onmousedown := Html.handler (fun ev -> mx := ev##.clientX; my := ev##.clientY; element##.style##.cursor := Js.string "move"; let c1 = Html.addEventListener Html.document Html.Event.mousemove (Html.handler (fun ev -> let x = ev##.clientX and y = ev##.clientY in let x' = !mx and y' = !my in mx := x; my := y; f (x - x') (y - y'); Js._true)) Js._true in let c2 = ref Js.null in c2 := Js.some (Html.addEventListener Html.document Html.Event.mouseup (Html.handler (fun _ -> Html.removeEventListener c1; Js.Opt.iter !c2 Html.removeEventListener; element##.style##.cursor := Js.string ""; Js._true)) Js._true); (* We do not want to disable the default action on mouse down (here, keyboard focus) in this example. *) Js._true) let start () = let doc = Html.document in let page = doc##.documentElement in page##.style##.overflow := Js.string "hidden"; doc##.body##.style##.overflow := Js.string "hidden"; doc##.body##.style##.margin := Js.string "0px"; let started = ref false in let p = Html.createP doc in p##.innerHTML := Js.string "Loading graph..."; p##.style##.display := Js.string "none"; Dom.appendChild doc##.body p; ignore (Lwt_js.sleep 0.5 >>= fun () -> if not !started then p##.style##.display := Js.string "inline"; Lwt.return ()); (* Firebug.console##time(Js.string "loading"); *) getfile "scene.json" >>= fun s -> (* Firebug.console##timeEnd(Js.string "loading"); Firebug.console##time(Js.string "parsing"); *) let (x1, y1, x2, y2), bboxes, scene = json##parse (Js.string s) in (* Firebug.console##timeEnd(Js.string "parsing"); Firebug.console##time(Js.string "init"); *) started := true; Dom.removeChild doc##.body p; let st = { bboxes ; scene ; zoom_factor = 1. /. 20. ; st_x = x1 ; st_y = y1 ; st_width = x2 -. x1 ; st_height = y2 -. y1 ; st_pixmap = Common.make_pixmap () } in let canvas = create_canvas page##.clientWidth page##.clientHeight in Dom.appendChild doc##.body canvas; let allocation () = { x = 0; y = 0; width = canvas##.width; height = canvas##.height } in let hadj = new adjustment () in let vadj = new adjustment () in let sadj = new adjustment ~upper:20. ~step_incr:1. ~page_incr:0. ~page_size:0. () in let zoom_steps = 8. in (* Number of steps to get a factor of 2 *) let set_zoom_factor f = let count = ceil (log f /. log 2. *. zoom_steps) in let f = 2. ** (count /. zoom_steps) in sadj#set_bounds ~upper:count (); st.zoom_factor <- f in let get_scale () = (2. ** (sadj#value /. zoom_steps)) /. st.zoom_factor in let redraw_queued = ref false in let update_view _force = (* Firebug.console##log_2(Js.string "update", Js.date##now()); *) let a = allocation () in let scale = get_scale () in let aw = ceil (float a.width /. scale) in let ah = ceil (float a.height /. scale) in hadj#set_bounds ~step_incr:(aw /. 20.) ~page_incr:(aw /. 2.) ~page_size:(min aw st.st_width) ~upper:st.st_width (); let mv = st.st_width -. hadj#page_size in if hadj#value < 0. then hadj#set_value 0.; if hadj#value > mv then hadj#set_value mv; vadj#set_bounds ~step_incr:(ah /. 20.) ~page_incr:(ah /. 2.) ~page_size:(min ah st.st_height) ~upper:st.st_height (); let mv = st.st_height -. vadj#page_size in if vadj#value < 0. then vadj#set_value 0.; if vadj#value > mv then vadj#set_value mv; if not !redraw_queued then ( redraw_queued := true; Html._requestAnimationFrame (Js.wrap_callback (fun () -> redraw_queued := false; redraw st (get_scale ()) hadj#value vadj#value canvas))) (* if force then redraw st (get_scale ()) hadj#value vadj#value canvas else if not !redraw_queued then ignore (redraw_queued := true; (* Firebug.console##log(Js.string "sleep"); *) Lwt_js.yield() >>= fun () -> redraw_queued := false; redraw st (get_scale ()) hadj#value vadj#value canvas; Lwt.return ()) *) in let a = allocation () in let zoom_factor = max (st.st_width /. float a.width) (st.st_height /. float a.height) in set_zoom_factor zoom_factor; let prev_scale = ref (get_scale ()) in let rescale x y = let scale = get_scale () in let r = 1. -. (!prev_scale /. scale) in hadj#set_value (hadj#value +. (hadj#page_size *. r *. x)); vadj#set_value (vadj#value +. (vadj#page_size *. r *. y)); prev_scale := scale; invalidate_pixmap st.st_pixmap; update_view false in let size = 16 in let height = 300 - size in let points d = Js.string (Printf.sprintf "%dpx" d) in let size_px = points size in let pos = ref height in let thumb = Html.createDiv doc in let style = thumb##.style in style##.position := Js.string "absolute"; style##.width := size_px; style##.height := size_px; style##.top := points !pos; style##.left := Js.string "0px"; style##.margin := Js.string "1px"; style##.backgroundColor := Js.string "black"; let slider = Html.createDiv doc in let style = slider##.style in style##.position := Js.string "absolute"; style##.width := size_px; style##.height := points (height + size); style##.border := Js.string "2px solid black"; style##.padding := Js.string "1px"; style##.top := Js.string "10px"; style##.left := Js.string "10px"; Dom.appendChild slider thumb; Dom.appendChild doc##.body slider; let set_slider_position pos' = if pos' <> !pos then ( thumb##.style##.top := points pos'; pos := pos'; sadj#set_value (float (height - pos') *. sadj#upper /. float height); rescale 0.5 0.5) in handle_drag thumb (fun _dx dy -> set_slider_position (min height (max 0 (!pos + dy)))); slider##.onmousedown := Html.handler (fun ev -> let ey = ev##.clientY in let _, sy = Dom_html.elementClientPosition slider in set_slider_position (max 0 (min height (ey - sy - (size / 2)))); Js._false); let adjust_slider () = let pos' = height - truncate ((sadj#value *. float height /. sadj#upper) +. 0.5) in thumb##.style##.top := points pos'; pos := pos' in Html.window##.onresize := Html.handler (fun _ -> let page = doc##.documentElement in canvas##.width := page##.clientWidth; canvas##.height := page##.clientHeight; update_view true; Js._true); (* Drag the graph using the mouse *) handle_drag canvas (fun dx dy -> let scale = get_scale () in let offset a d = a#set_value (min (a#value -. (float d /. scale)) (a#upper -. a#page_size)) in offset hadj dx; offset vadj dy; update_view true); let bump_scale x y v = let a = allocation () in let x = x /. float a.width in let y = y /. float a.height in let prev = sadj#value in let vl = min sadj#upper (max sadj#lower (prev +. (v *. sadj#step_increment))) in if vl <> prev then ( sadj#set_value vl; adjust_slider (); if x >= 0. && x <= 1. && y >= 0. && y <= 1. then rescale x y else rescale 0.5 0.5); Js._false in (* Zoom using the mouse wheel *) ignore (Html.addMousewheelEventListener canvas (fun ev ~dx:_ ~dy -> let ex, ey = Dom_html.elementClientPosition canvas in let x = float (ev##.clientX - ex) in let y = float (ev##.clientY - ey) in if dy < 0 then bump_scale x y 1. else if dy > 0 then bump_scale x y (-1.) else Js._false) Js._true); (* Html.addEventListener Html.document Html.Event.keydown (Html.handler (fun e -> Firebug.console##log(e##keyCode); Js._true)) Js._true; *) (* Html.addEventListener Html.document Html.Event.keypress (Html.handler (fun e -> Firebug.console##log(Js.string "press"); match e##keyCode with | 37 -> (* left *) Js._false | 38 -> (* up *) Js._false | 39 -> (* right *) Js._false | 40 -> (* down *) Js._false | _ -> Firebug.console##log(- 1- e##keyCode); Js._true)) Js._true; *) let handle_key_event ev = match ev##.keyCode with | 37 -> (* left *) hadj#set_value (hadj#value -. hadj#step_increment); update_view false; Js._false | 38 -> (* up *) vadj#set_value (vadj#value -. vadj#step_increment); update_view false; Js._false | 39 -> (* right *) hadj#set_value (hadj#value +. hadj#step_increment); update_view false; Js._false | 40 -> (* down *) vadj#set_value (vadj#value +. vadj#step_increment); update_view false; Js._false | _ -> (* Firebug.console##log_2(Js.string "keycode:", ev##keyCode); *) Js._true in let ignored_keycode = ref (-1) in Html.document##.onkeydown := Html.handler (fun e -> ignored_keycode := e##.keyCode; handle_key_event e); Html.document##.onkeypress := Html.handler (fun e -> let k = !ignored_keycode in ignored_keycode := -1; if e##.keyCode = k then Js._true else handle_key_event e); (* Firebug.console##time(Js.string "initial drawing"); *) update_view true; (* Firebug.console##timeEnd(Js.string "initial drawing"); Firebug.console##timeEnd(Js.string "init"); *) Lwt.return () let _ = Html.window##.onload := Html.handler (fun _ -> ignore (start ()); Js._false) js_of_ocaml-3.5.2/examples/hyperbolic/000077500000000000000000000000001357507750000177635ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/hyperbolic/dune000066400000000000000000000010021357507750000206320ustar00rootroot00000000000000(executables (names hypertree) (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx))) (rule (targets hypertree.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:hypertree.bc} -o %{targets} --pretty -I ./ --file %{dep:image_info.json} --file %{dep:messages.json} --file %{dep:tree.json}))) (alias (name default) (deps hypertree.js index.html (glob_files icons/*.{png,jpg}) (glob_files thumbnails/*.{png,jpg}) )) js_of_ocaml-3.5.2/examples/hyperbolic/hypertree.ml000066400000000000000000001653631357507750000223420ustar00rootroot00000000000000(* Js_of_ocaml example * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js_of_ocaml_lwt (* - check compatibility + wait page - files to load set in index.html ==> tree.txt, icon directory, image_info.json, image directories - validation tools - we should stop updating the canvas when it is not visible (opaque overlay) - do not cache images forever (just keep a list of recently used images) ==> keep images used last + twice as many / minimum 200 ? - spinner: draw it on a canvas (===> large canvas...) - webgl? - swap image once loaded instead of putting it over the canvas (?) - récupérer le nom des animaux? ==> overlay mechanism: save what is below, display overlay; restore when moved - can we have fast shadows? ==> precompute the shadows in a canvas? - should we have half size images for better rendering??? (might make it possible fast shadows?) - support for touch events - limit how far we can go - use history to save current location and random seed - get all image sizes so that we can size precisely images before they are all loaded ============== - find point closest to center; start drawing from it; stop below a given threshold - speed-up rendering by traversing the tree and stopping when the edge length becomes below some threshold =============== - preferred diameter of each node spring-like forces around this diameter repulsive forces: exponential when below the preferred diameter decrease exponentially http://en.wikipedia.org/wiki/Hyperbolic_geometry#Circles.2C_spheres_and_balls - importante répulsion quand trop près! ==> surtout pour feuilles! - cap the acceleration - metric tree/vp-tree? r trees / kd trees *) (* List of icons to be prefetched *) let icons = [ "commons-38.png" ; "wikipedia-38.png" ; "info-38.png" ; "meeting-point-38.png" ; "globe-38.png" ; "ocsigen-powered.png" ] let icon nm = Js.string ("icons/" ^ nm) let tree_color = Js.string "#794c0d" (* let outside_color = Js.string (*"#3d2606"*) "#1e1303" let outside_color = Js.string (*"#0c1a0d"*) "#070718" *) let option var = Js.Optdef.get var (fun () -> Js.Unsafe.coerce (new%js Js.array_empty)) class type style = object method border : float Js.optdef Js.readonly_prop method padding : float Js.optdef Js.readonly_prop method backgroundColor : Js.js_string Js.t Js.optdef Js.readonly_prop method boundaryColor : Js.js_string Js.t Js.optdef Js.readonly_prop method treeColor : Js.js_string Js.t Js.optdef Js.readonly_prop method nodeColor : Js.js_string Js.t Js.optdef Js.readonly_prop method nodeBackgroundColor : Js.js_string Js.t Js.optdef Js.readonly_prop method nodeFont : Js.js_string Js.t Js.optdef Js.readonly_prop method buttonColor : Js.js_string Js.t Js.optdef Js.readonly_prop end let style : style Js.t = option Js.Unsafe.global##.hyp_style class type messages = object method info : Js.js_string Js.t Js.optdef Js.readonly_prop method recenter : Js.js_string Js.t Js.optdef Js.readonly_prop method noRef : Js.js_string Js.t Js.optdef Js.readonly_prop method close : Js.js_string Js.t Js.optdef Js.readonly_prop method wikimediaCommons : Js.js_string Js.t Js.optdef Js.readonly_prop method language : Js.js_string Js.t Js.optdef Js.readonly_prop method noRef : Js.js_string Js.t Js.optdef Js.readonly_prop method languages : Js.js_string Js.t Js.optdef Js.readonly_prop method ok : Js.js_string Js.t Js.optdef Js.readonly_prop end let opt_style v default = Js.Optdef.get v (fun () -> default) (**** Complex numbers ****) type c = { x : float ; y : float } let one = { x = 1.; y = 0. } let zero = { x = 0.; y = 0. } (* Scalar operations *) let sdiv z s = { x = z.x /. s; y = z.y /. s } let smul s z = { x = s *. z.x; y = s *. z.y } (* Norm *) let sq_norm c = (c.x *. c.x) +. (c.y *. c.y) let norm c = sqrt (sq_norm c) let normalize c = sdiv c (norm c) (* Conjugate and negation *) let conj z = { x = z.x; y = -.z.y } let neg z = { x = -.z.x; y = -.z.y } (* Addition, multiplication and division *) let add z t = { x = z.x +. t.x; y = z.y +. t.y } let sub z t = { x = z.x -. t.x; y = z.y -. t.y } let sq_norm_sub z t = let x = z.x -. t.x in let y = z.y -. t.y in (x *. x) +. (y *. y) let mul z t = { x = (z.x *. t.x) -. (z.y *. t.y); y = (z.x *. t.y) +. (z.y *. t.x) } let add_mul a z b = { x = (a.x *. z.x) -. (a.y *. z.y) +. b.x; y = (a.x *. z.y) +. (a.y *. z.x) +. b.y } let div z t = let n = sq_norm t in { x = ((z.x *. t.x) +. (z.y *. t.y)) /. n; y = ((z.y *. t.x) -. (z.x *. t.y)) /. n } (* Möbius transformation, hyperbolic transformation *) (* (a.z + b) / (c.z + d) *) let transf a b c d z = div (add_mul a z b) (add_mul c z d) (* (t.z + p) / (conj p.z + 1) *) let hyp_transf (p, t) = let a = t in let b = p in let c = mul (conj p) t in let d = one in fun z -> transf a b c d z let hyp_transf_vect (p, t) v v' = let a = t in let b = p in let c = mul (conj p) t in let d = one in for i = 0 to Array.length v - 1 do v'.(i) <- transf a b c d v.(i) done (* (z + p) / (conj p.z + 1) *) let transl p = hyp_transf (p, one) let compose (p1, t1) (p2, t2) = let t2p1 = mul t2 p1 in let den = add (mul t2p1 (conj p2)) one in div (add t2p1 p2) den, normalize (mul (mul t1 t2) (div (conj den) den)) (* Transformation from z0 to z1: z1 = (z0 + p) / (conj p.z0 + 1) ==> p = (z1.z0.conj (z1 - z0) + z1 - z0) / (1 - |z1.z0|^2) *) let compute_translation z0 z1 = let dz = sub z1 z0 in let z0z1 = mul z0 z1 in sdiv (add (mul z0z1 (conj dz)) dz) (1. -. sq_norm z0z1) (******) let ( >>= ) = Lwt.bind let lwt_wrap f = let t, w = Lwt.task () in let cont x = Lwt.wakeup w x in f cont; t (******) module Html = Dom_html let json : < parse : Js.js_string Js.t -> 'a > Js.t = Js.Unsafe.pure_js_expr "JSON" let http_get url = XmlHttpRequest.get url >>= fun r -> let cod = r.XmlHttpRequest.code in let msg = r.XmlHttpRequest.content in if cod = 0 || cod = 200 then Lwt.return msg else fst (Lwt.wait ()) let getfile f = try Lwt.return (Sys_js.read_file ~name:f) with Not_found -> http_get f let load_image src = let img = Html.createImg Html.document in lwt_wrap (fun c -> img##.onload := Html.handler (fun _ -> c (); Js._false); img##.src := src) >>= fun () -> Lwt.return img let create_canvas w h = let d = Html.window##.document in let c = Html.createCanvas d in c##.width := w; c##.height := h; c let debug_widget = let d = Html.document in let w = Html.createDiv d in w##.style##.position := Js.string "absolute"; w##.style##.bottom := Js.string "0"; w##.style##.left := Js.string "0"; w##.style##.lineHeight := Js.string "0.9em"; w let _debug_msg _s = () (* let d = Html.document in Dom.appendChild d##body debug_widget; let p = Html.createP d in p##innerHTML <- Js.string s; Dom.appendChild debug_widget p *) let handle_drag element move stop click = let fuzz = 4 in element##.onmousedown := Html.handler (fun ev -> let x0 = ev##.clientX and y0 = ev##.clientY in (* debug_msg (Format.sprintf "Mouse down %d %d" x0 y0); *) let started = ref false in let c1 = Html.addEventListener Html.document Html.Event.mousemove (Html.handler (fun ev -> let x = ev##.clientX and y = ev##.clientY in (* debug_msg (Format.sprintf "Mouse move %d %d %d %d" x0 y0 x y); *) if (not !started) && (abs (x - x0) > fuzz || abs (y - y0) > fuzz) then ( started := true; element##.style##.cursor := Js.string "move"); if !started then move x0 y0 x y; Html.stopPropagation ev; Js._true)) Js._true in let c2 = ref Js.null in c2 := Js.some (Html.addEventListener Html.document Html.Event.mouseup (Html.handler (fun ev -> (* debug_msg (Format.sprintf "Mouse up %d %d %d %d" x0 y0 ev##clientX ev##clientY); *) Html.removeEventListener c1; Js.Opt.iter !c2 Html.removeEventListener; if !started then ( element##.style##.cursor := Js.string ""; stop ev##.clientX ev##.clientY) else click ev##.clientX ev##.clientY; Js._true)) Js._true); Js._true) let handle_touch_events element move stop cancel click = let fuzz = 4 in ignore (Html.addEventListener element Html.Event.touchstart (Html.handler (fun ev -> Js.Optdef.iter (ev##.changedTouches##item 0) (fun touch -> let id = touch##.identifier in let x0 = touch##.clientX and y0 = touch##.clientY in (* debug_msg (Format.sprintf "Touch start %d %d" x0 y0); *) let started = ref false in let c1 = Html.addEventListener Html.document Html.Event.touchmove (Html.handler (fun ev -> for i = 0 to ev##.changedTouches##.length - 1 do Js.Optdef.iter (ev##.changedTouches##item i) (fun touch -> if touch##.identifier = id then ( let x = touch##.clientX and y = touch##.clientY in (* debug_msg (Format.sprintf "Touch move %d %d %d %d" x0 y0 x y); *) if (not !started) && (abs (x - x0) > fuzz || abs (y - y0) > fuzz) then ( started := true; element##.style##.cursor := Js.string "move"); if !started then move x0 y0 x y)) done; Html.stopPropagation ev; Js._false)) Js._true in let c2 = ref Js.null in let c3 = ref Js.null in c2 := Js.some (Html.addEventListener Html.document Html.Event.touchend (Html.handler (fun ev -> for i = 0 to ev##.changedTouches##.length - 1 do Js.Optdef.iter (ev##.changedTouches##item i) (fun touch -> if touch##.identifier = id then ( let x = touch##.clientX and y = touch##.clientY in (* debug_msg (Format.sprintf "Touch end %d %d %d %d" x0 y0 x y); *) Html.removeEventListener c1; Js.Opt.iter !c2 Html.removeEventListener; Js.Opt.iter !c3 Html.removeEventListener; if !started then ( element##.style##.cursor := Js.string ""; stop x y) else click x y)) done; Js._true)) Js._true); c3 := Js.some (Html.addEventListener Html.document Html.Event.touchend (Html.handler (fun ev -> for i = 0 to ev##.changedTouches##.length - 1 do Js.Optdef.iter (ev##.changedTouches##item i) (fun touch -> if touch##.identifier = id then ( let x = touch##.clientX and y = touch##.clientY in (* debug_msg (Format.sprintf "Touch cancel %d %d %d %d" x0 y0 x y); *) Html.removeEventListener c1; Js.Opt.iter !c2 Html.removeEventListener; Js.Opt.iter !c3 Html.removeEventListener; if !started then element##.style##.cursor := Js.string ""; cancel x y)) done; Js._false)) Js._true)); Js._false)) Js._true) (* let handle_touch_events element move stop cancel = let fuzz = 4 in let id = ref 0 in let x0 = ref 0 in let y0 = ref 0 in ignore (Html.addEventListener element Html.Event.touchstart (Html.handler (fun ev -> OptDef.iter (ev##changedTouches##item(0)) (fun touch -> id := touch##identifier; in x0 := touch##clientX; y0 := touch##clientY)); (* x0 := ev##pageX; y0 := ev##pageY;*) debug_msg (Format.sprintf "Touch down %d %d" !x0 !y0); Js._false)) Js._false); ignore (Html.addEventListener element Html.Event.touchmove (Html.handler (fun ev -> (* let x = ev##pageX and y = ev##pageY in *) debug_msg (Format.sprintf "Touch move %d %d %d %d" !x0 !y0 x y); move !x0 !y0 x y; Js._false)) Js._false); ignore (Html.addEventListener element Html.Event.touchend (Html.handler (fun _ -> debug_msg (Format.sprintf "Touch end"); stop (); Js._false)) Js._false); ignore (Html.addEventListener element Html.Event.touchcancel (Html.handler (fun _ -> cancel (); Js._true)) Js._false) *) let roundRectPath c x y w h r = let r = min r (min w h /. 2.) in c##beginPath; c##moveTo (x +. r) y; c##arcTo (x +. w) y (x +. w) (y +. r) r; c##arcTo (x +. w) (y +. h) (x +. w -. r) (y +. h) r; c##arcTo x (y +. h) x (y +. h -. r) r; c##arcTo x y (x +. r) y r let text_size_div = let doc = Html.document in lazy (let d = Html.createDiv doc in d##.style##.visibility := Js.string "hidden"; d##.style##.position := Js.string "absolute"; d##.style##.whiteSpace := Js.string "nowrap"; Dom.appendChild doc##.body d; d) let text_size font txt = let doc = Html.document in let d = Lazy.force text_size_div in d##.style##.font := font; let txt = doc##createTextNode (Js.string txt) in Dom.appendChild d txt; let res = d##.clientWidth, d##.clientHeight in Dom.removeChild d txt; res (******) let default_language () = (Js.Optdef.get Dom_html.window##.navigator##.language (fun () -> Js.Optdef.get Dom_html.window##.navigator##.userLanguage (fun () -> Js.string "en"))) ##substring 0 2 let language = ref (Js.Optdef.case Html.window##.localStorage default_language (fun st -> Js.Opt.get (st##getItem (Js.string "hyp_lang")) default_language)) let _ = Firebug.console##log !language let set_language lang = Js.Optdef.iter Html.window##.localStorage (fun st -> st##setItem (Js.string "hyp_lang") lang); language := lang let load_messages () = getfile "messages.json" >>= fun s -> Lwt.return (json##parse (Js.string s)) let local_messages msgs : messages Js.t = option (Js.Unsafe.get msgs !language) (******) let screen_transform canvas = let offset = opt_style style##.border 0.5 +. opt_style style##.padding 0. in let w = canvas##.width in let h = canvas##.height in (* let r = float (min w h) /. 2. in *) let rx = float w /. 2. in let ry = float h /. 2. in let dx = float w /. 2. in let dy = float h /. 2. in let rx = max 5. (rx -. offset) in let ry = max 5. (ry -. offset) in rx, ry, dx, dy let eps = 0.05 (* let to_screen z = ((z.x +. 1.) *. r, (z.y +. 1.) *. r) *) let from_screen canvas x y = let rx, ry, dx, dy = screen_transform canvas in let z = { x = (float x -. dx) /. rx; y = (float y -. dy) /. ry } in let n = norm z in if n <= 1. -. eps then z else sdiv z (n /. (1. -. eps)) let pi = 4. *. atan 1. let ellipse_arc c cx cy rx ry start fin clock_wise = c##save; c##translate cx cy; c##scale rx ry; c##arc 0. 0. 1. start fin clock_wise; c##restore let arc c (rx, ry, dx, dy) z0 z1 z2 = let rd = norm (sub z1 z0) in let start = atan2 (z1.y -. z0.y) (z1.x -. z0.x) in let fin = atan2 (z2.y -. z0.y) (z2.x -. z0.x) in c##beginPath; let alpha = mod_float (fin -. start +. (2. *. pi)) (2. *. pi) in (* Firebug.console##log_4(start, fin, alpha, (alpha > pi)); *) if rx = ry then c##arc ((z0.x *. rx) +. dx) ((z0.y *. rx) +. dy) (rd *. rx) start fin (Js.bool (alpha > pi)) else ellipse_arc c ((z0.x *. rx) +. dx) ((z0.y *. ry) +. dy) (rd *. rx) (rd *. ry) start fin (Js.bool (alpha > pi)); c##stroke let line c (rx, ry, dx, dy) z1 z2 = c##beginPath; c##moveTo ((z1.x *. rx) +. dx) ((z1.y *. ry) +. dy); c##lineTo ((z2.x *. rx) +. dx) ((z2.y *. ry) +. dy); c##stroke (* We have |z0|^2 = 1 + r^2 (the "line" is orthogonal to the unit circle) |z1-z0|^2 = r^2 (z1 is on the circle) |z2-z0|^2 = r^2 (z2 is on the circle) By solving this set of equations, we get z0. *) let segment c transf z1 z2 = let d = 2. *. ((z1.x *. z2.y) -. (z1.y *. z2.x)) in if abs_float d < 0.05 then line c transf z1 z2 else let n1 = sq_norm z1 +. 1. in let n2 = sq_norm z2 +. 1. in let z0 = { x = ((z2.y *. n1) -. (z1.y *. n2)) /. d; y = ((z1.x *. n2) -. (z2.x *. n1)) /. d } in arc c transf z0 z1 z2 type boxes = { bx : float array ; by : float array ; bw : float array ; bh : float array } let shadow = false let draw canvas vertices edges nodes boxes = Firebug.console##time (Js.string "draw"); let c = canvas##getContext Html._2d_ in let ((rx, ry, dx, dy) as transf) = screen_transform canvas in c##clearRect 0. 0. (float canvas##.width) (float canvas##.height); let padding = opt_style style##.padding 0. in c##beginPath; ellipse_arc c dx dy (rx +. padding) (ry +. padding) 0. 7. Js._false; Js.Optdef.iter style##.backgroundColor (fun color -> c##.fillStyle := color; c##fill); Js.Optdef.iter style##.boundaryColor (fun color -> c##.lineWidth := 1.; c##.strokeStyle := color; c##stroke); c##.lineWidth := 2.; c##.lineCap := Js.string "round"; c##.strokeStyle := opt_style style##.treeColor tree_color; let rx, ry, _, _ = transf in for i = 0 to Array.length edges - 1 do let j, j', w = edges.(i) in let z = vertices.(j) in let z' = vertices.(j') in if rx *. ry *. sq_norm_sub z z' > 4. then ( c##.lineWidth := w; segment c transf z z') done; let image_count = ref 0 in let large_image_count = ref 0 in for i = 0 to Array.length nodes - 1 do let l, img = nodes.(i) in match img with | `Img (img, _) -> ( boxes.bw.(i) <- 0.; (* Invalidate image location. *) let z = vertices.(i) in let min_scale l w h s = let s = ref s in for i = 0 to Array.length l - 1 do let j, large = l.(i) in let sx = abs_float (vertices.(j).x -. z.x) /. w in let sy = abs_float (vertices.(j).y -. z.y) /. h in let s' = if sx > sy then sx else sy in let s' = if large then s' else 1.9 *. s' in if s' < !s then s := s' done; !s in if not (Lazy.is_val img) then ( let s = min_scale l 1. 1. 1. in if s *. max rx ry > 1. then ignore (Lazy.force img)) else match Lwt.poll (Lazy.force img) with | Some img -> (* if min_w *. r > 1. && min_h *. r > 1. then begin *) let w = float img##.width in let h = float img##.height in (* let s = min_scale l w h (1. /. min w h) in let scale = s *. r in *) let s = min_scale l 1. 1. 1. in let scale = s /. max (w /. rx) (h /. ry) in let w = w *. scale /. 2. in let h = h *. scale /. 2. in if w > 1. && h > 1. then ( (* let ratio = r *. min (min_w /. w) (min_h /. h) in let w = w *. ratio in let h = h *. ratio in *) if shadow then ( c##save; (* let blur = 7. /. img_r *. rd in let offset = 5. /. img_r *. rd in *) let blur = 7. *. scale in let offset = 5. *. scale in c##.shadowBlur := if blur < 1. then 0. else blur; c##.shadowOffsetX := if blur < 1. then 0. else offset; c##.shadowOffsetY := if blur < 1. then 0. else offset; c##.shadowColor := Js.string "black"); let x = (z.x *. rx) +. dx in let y = (z.y *. ry) +. dy in c##drawImage_withSize img (x -. w) (y -. h) (2. *. w) (2. *. h); (* c##drawImage_fromCanvasWithSize (img, x -. w, y -. h, 2. *. w, 2. *. h); *) if shadow then c##restore; boxes.bx.(i) <- x; boxes.by.(i) <- y; boxes.bw.(i) <- w; boxes.bh.(i) <- h; incr image_count; if w >= 2. && h >= 2. then incr large_image_count) | None -> ()) | `Txt (circle, Some txt, _) -> let z = vertices.(i) in let r2 = Array.fold_left (fun r2 (j, _) -> min r2 (sq_norm (sub vertices.(j) z))) 1. l in let w = float txt##.width in let h = float txt##.height in let img_d = sqrt ((w *. w) +. (h *. h)) in let rd = sqrt (r2 *. rx *. ry) *. 0.5 in let rd = if rd > img_d /. 2. then img_d /. 2. else rd in let w = w /. img_d *. rd in let h = h /. img_d *. rd in if circle then ( c##beginPath; c##.fillStyle := opt_style style##.nodeBackgroundColor tree_color; c##arc ((z.x *. rx) +. dx) ((z.y *. ry) +. dy) (sqrt ((w *. w) +. (h *. h))) 0. 7. Js._false; c##fill); c##drawImage_fromCanvasWithSize txt ((z.x *. rx) +. dx -. w) ((z.y *. ry) +. dy -. h) (2. *. w) (2. *. h) | `Txt (_, None, _) | `None -> () done; Firebug.console##timeEnd (Js.string "draw"); Firebug.console##log_2 !image_count !large_image_count let default_img = "frog.jpg" let tree_url = "tree.json" let ( >> ) x f = f x type 'a tree = Node of 'a * 'a tree array let rec tree_vertice_count n = let (Node (_, l)) = n in Array.fold_left (fun s n -> s + tree_vertice_count n) 1 l let rec tree_edge_count n = let (Node (_, l)) = n in Array.fold_left (fun s n -> s + 1 + tree_edge_count n) 0 l let rec randomize_tree n = let (Node (_info, ch)) = n in for i = Array.length ch - 1 downto 0 do let v = ch.(i) in let j = truncate (Js.math##random *. float (i + 1)) in ch.(i) <- ch.(j); ch.(j) <- v done; Array.iter randomize_tree ch let need_redraw = ref false let redraw_funct = ref (fun () -> ()) let perform_redraw () = need_redraw := false; !redraw_funct () let schedule_redraw () = if not !need_redraw then ( need_redraw := true; Html._requestAnimationFrame (Js.wrap_callback (fun () -> if !need_redraw then perform_redraw ()))) (* let load_image src = load_image src >>= fun img -> let w = img##width in let h = img##height in let canvas = create_canvas (w + 14) (h + 14) in let c = canvas##getContext (Html._2d_) in c##shadowBlur <- 7.; c##shadowOffsetX <- 5.; c##shadowOffsetY <- 5.; c##shadowColor <- Js.string "black"; c##drawImage_withSize (img, 2., 2., float w, float h); Lwt.return canvas *) let image_node img = `Img ( lazy (Lwt_js.yield () >>= fun () -> load_image (Js.string ("thumbnails/" ^ img ^ ".jpg")) >>= fun img -> schedule_redraw (); Lwt.return img) , img ) let nl_re = Regexp.regexp "\n" let not_space_re = Regexp.regexp "[^ ]" let pipe_re = Regexp.regexp "[|]" let compute_text_node info = let font = opt_style style##.nodeFont (Js.string "20px sans-serif") in let w, h = text_size font info in let w = w + 8 in let h = h + 8 in let canvas = create_canvas w h in let c = canvas##getContext Html._2d_ in c##.fillStyle := opt_style style##.nodeBackgroundColor tree_color; roundRectPath c 0. 0. (float w) (float h) 4.; c##fill; c##.font := font; c##.fillStyle := opt_style style##.nodeColor (Js.string "black"); c##.textAlign := Js.string "center"; c##.textBaseline := Js.string "middle"; c##fillText (Js.string info) (float w /. 2.) (float h /. 2.); canvas let compute_text_nodes node_names nodes = let names = try fst (List.assq !language node_names) with Not_found -> ( try fst (List.assq (Js.string "en") node_names) with Not_found -> Hashtbl.create 11) in Html.document##.title := Js.string (try Hashtbl.find names "" with Not_found -> ""); for i = 0 to Array.length nodes - 1 do match nodes.(i) with | neigh, `Txt (is_root, _, info) -> let canvas = try Some (compute_text_node (Hashtbl.find names info)) with Not_found -> None in nodes.(i) <- neigh, `Txt (is_root, canvas, info) | _ -> () done let make_node info is_root _children = if String.length info = 0 then `None else if info.[0] = '|' then image_node (String.sub info 1 (String.length info - 1)) else `Txt (is_root, None, info) let compute_nodes node = let rec compute is_root n = let (Node (info, ch)) = n in let info = make_node (Js.to_string info) is_root ch in let ch = Array.map (fun n -> compute false n) ch in Node (info, ch) in compute true node let list_tl l = let rec tl x l = match l with | [] -> x | x :: r -> tl x r in match l with | [] -> assert false | x :: r -> tl x r let compute_neighbors nodes tree = let frontiers = Array.make (Array.length nodes) ([||], [||]) in let node_info (Node (i, _)) = i in let status i = let _, info = nodes.(i) in i, info <> `None in let rec compute_frontiers node = let (Node (i, l)) = node in Array.iter compute_frontiers l; frontiers.(i) <- (if Array.length l = 0 then [| status i |], [| status i |] else fst frontiers.(node_info l.(0)), snd frontiers.(node_info l.(Array.length l - 1))) (* (i :: fst frontiers.(node_info (List.hd l)), i :: snd frontiers.(node_info (list_tl l))) *) in compute_frontiers tree; let neighboors = Array.make (Array.length nodes) [||] in let rec compute_neigh node parent lft rght = let (Node (i, ch)) = node in let children = Array.map (fun n -> status (node_info n)) ch in neighboors.(i) <- Array.concat [ parent; lft; rght; children ]; let is_root = Array.length parent = 0 in let n = Array.length ch in for j = 0 to n - 1 do let lft = if j > 0 then snd frontiers.(node_info ch.(j - 1)) else if is_root then snd frontiers.(node_info ch.(n - 1)) else lft in let rght = if j < n - 1 then fst frontiers.(node_info ch.(j + 1)) else if is_root then fst frontiers.(node_info ch.(0)) else rght in compute_neigh ch.(j) [| status i |] lft rght done in compute_neigh tree [||] [||] [||]; for i = 0 to Array.length nodes - 1 do let _l, info = nodes.(i) in nodes.(i) <- neighboors.(i), info done let weight_sum l = Array.fold_left (fun s n -> let (Node (w, _)) = n in s +. w) 0. l let rec compute_weights node = let (Node (_, l)) = node in if Array.length l = 0 then Node (1., [||]) else let l' = Array.map compute_weights l in Node (0.6 *. weight_sum l', l') let array_map2 f a1 a2 = let l = Array.length a1 in assert (Array.length a2 = l); if l = 0 then [||] else let r = Array.make l (f a1.(0) a2.(0)) in for i = 1 to l - 1 do r.(i) <- f a1.(i) a2.(i) done; r let tree_layout node_names root = let root = compute_nodes root in let node_count = tree_vertice_count root in let vertices = Array.make node_count zero in let edges = Array.make (tree_edge_count root) (0, 0, 0.) in let nodes = Array.make node_count ([||], `None) in let vi = ref 0 in let ei = ref 0 in let weights = compute_weights root in let rec layout_rec current current_weights is_root transf lineWidth dir = let (Node (info, ch)) = current in let (Node (_, ch_weights)) = current_weights in let i = !vi in incr vi; vertices.(i) <- fst transf; let l = Array.length ch in let ch' = if l = 0 then [||] else let j = ref 0 in let total_weight = weight_sum ch_weights in let w0 = ref (if is_root then let (Node (w, _)) = ch_weights.(0) in (total_weight -. w) /. 2. else 0.) in array_map2 (fun node weights -> let (Node (w, _)) = weights in let angle = acos dir.x *. w /. total_weight in let th = acos dir.x *. (((!w0 +. (w /. 2.)) /. total_weight *. 2.) -. 1.) in incr j; w0 := !w0 +. w; let min_angle = pi /. 3. in let a = { x = (cos angle -. cos min_angle) /. (1. -. cos (min_angle +. angle)) ; y = 0. } in let dir = { x = cos min_angle; y = sin min_angle } in let a, dir = if a.x > 0.25 then a, dir else let a = { x = 0.25; y = 0. } in a, transl (neg a) { x = cos angle; y = sin angle } in let u = compose (a, one) (zero, { x = cos th; y = sin th }) in let (Node (i', _) as ch) = layout_rec node weights false (compose u transf) (lineWidth *. 0.94) dir in let k = !ei in incr ei; edges.(k) <- i, i', lineWidth; ch) ch ch_weights in nodes.(i) <- [||], info; Node (i, ch') in let tree = layout_rec root weights true (zero, one) 6. { x = -1.; y = 0. } in compute_neighbors nodes tree; let boxes = { bx = Array.make node_count 0. ; by = Array.make node_count 0. ; bw = Array.make node_count 0. ; bh = Array.make node_count 0. } in compute_text_nodes node_names nodes; vertices, edges, nodes, boxes let load_tree () = getfile tree_url >>= fun s -> let info : Js.js_string Js.t tree * (Js.js_string Js.t * (Js.js_string Js.t * Js.js_string Js.t) array * Js.js_string Js.t) array = json##parse (Js.string s) in let tree, node_names = info in randomize_tree tree; let node_names = node_names >> Array.map (fun (lang, tbl, about) -> let h = Hashtbl.create 101 in Array.iter (fun (k, v) -> Hashtbl.add h (Js.to_string k) (Js.to_string v)) tbl; lang, (h, about)) >> Array.to_list in Lwt.return (tree_layout node_names tree, node_names) let radius_of_length r = (exp r -. 1.) /. (exp r +. 1.) let length_of_radius r = log ((1. +. r) /. (1. -. r)) type info = { name : Js.js_string Js.t ; url : Js.js_string Js.t ; attribution : Js.js_string Js.t ; width : int ; height : int ; links : (Js.js_string Js.t * Js.js_string Js.t * Js.js_string Js.t) array ; img_url : Js.js_string Js.t option } let load_image_info () : info array Lwt.t = getfile "image_info.json" >>= fun s -> Lwt.return (json##parse (Js.string s)) let close_button over = let color = opt_style style##.buttonColor (Js.string "#888888") in let size = 32 in let offset = 4. in let lw = 4. in let canvas = create_canvas size size in let c = canvas##getContext Html._2d_ in c##save; c##.lineWidth := 2.; c##.strokeStyle := color; if over then ( c##.shadowBlur := offset; c##.shadowColor := color); c##beginPath; let a = offset +. (lw /. sqrt 2.) in let b = float size -. offset -. (lw /. sqrt 2.) in c##moveTo a a; c##lineTo b b; c##moveTo a b; c##lineTo b a; c##stroke; c##restore; canvas##.className := Js.string (if over then "on" else "off"); canvas##.style##.position := Js.string "absolute"; canvas##.style##.top := Js.string "0"; canvas##.style##.right := Js.string "0"; canvas let img_button ?href h src = let doc = Html.document in let decoration over = let img = Html.createImg doc in img##.src := icon src; let div = Html.createDiv doc in div##.style##.position := Js.string "absolute"; div##.style##.width := Js.string "38px"; div##.style##.height := Js.string (string_of_int (max 38 h) ^ "px"); div##.style##.margin := Js.string "2px"; (Js.Unsafe.coerce div##.style)##.borderRadius := Js.string "2px"; let extra = max 6 (44 - h) in div##.style##.padding := Js.string (* (Format.sprintf "%dpx 3px %dpx 3px" (extra / 2) (extra - extra / 2)); *) (string_of_int (extra / 2) ^ "px 3px " ^ string_of_int (extra - (extra / 2)) ^ "px 3px"); div##.className := Js.string ("filled_button " ^ if over then "on" else "off"); Dom.appendChild div img; div in let button = Html.createDiv doc in button##.className := Js.string "button"; button##.style##.width := Js.string "48px"; button##.style##.height := Js.string (string_of_int (8 + max 38 h) ^ "px"); let container = match href with | None -> (button :> Html.element Js.t) | Some url -> let a = Html.createA doc in a##.target := Js.string "_blank"; a##.href := url; Dom.appendChild button a; (a :> Html.element Js.t) in Dom.appendChild container (decoration true); Dom.appendChild container (decoration false); button let tooltip txt = let tooltip = Html.createDiv Html.document in tooltip##.style##.position := Js.string "absolute"; tooltip##.className := Js.string "tooltip on"; tooltip##.innerHTML := txt; tooltip let show_on_click button txt = let activated = ref false in button##.onclick := Html.handler (fun ev -> if not !activated then ( activated := true; let c = ref Js.null in c := Js.some (Html.addEventListener Html.document Html.Event.click (Html.handler (fun _ev -> ignore (Lwt_js.yield () >>= fun () -> Js.Opt.iter !c Html.removeEventListener; txt##.className := Js.string "text on"; activated := false; Lwt.return ()); Js._true)) Js._true); txt##.className := Js.string "text"); Html.stopPropagation ev; Js._false) let show_image all_messages image_info name small_image = image_info >>= fun image_info -> let messages = local_messages all_messages in (* let suffix_re = Regexp.regexp "\\.[^.]*$" in let name = Js.string (Regexp.global_replace suffix_re name "") in *) let i = ref (-1) in let name_js = Js.string name in for j = 0 to Array.length image_info - 1 do if name_js == image_info.(j).name then i := j done; if !i >= 0 then ( let info = image_info.(!i) in Firebug.console##log_2 name !i; let d = Html.document in let container = Html.createDiv d in container##.style##.margin := Js.string "10px"; container##.style##.position := Js.string "absolute"; container##.style##.top := Js.string "0"; container##.style##.bottom := Js.string "0"; container##.style##.left := Js.string "0"; container##.style##.right := Js.string "0"; let img_container = Html.createDiv d in img_container##.style##.position := Js.string "absolute"; img_container##.style##.top := Js.string "0"; img_container##.style##.bottom := Js.string "4em"; img_container##.style##.left := Js.string "38px"; img_container##.style##.right := Js.string "38px"; let wrap elt = let w = Html.createDiv d in w##.style##.position := Js.string "absolute"; w##.style##.top := Js.string "0"; w##.style##.bottom := Js.string "0"; w##.style##.left := Js.string "0"; w##.style##.right := Js.string "0"; w##.style##.margin := Js.string "auto"; (* w##style##width <- Js.string "100%"; w##style##height <- Js.string "100%"; w##style##maxWidth <- Js.string (string_of_int info.width ^ "px"); *) w##.style##.maxHeight := Js.string (string_of_int info.height ^ "px"); Dom.appendChild w elt; w in let img = Html.createImg d in (match Lwt.poll (Lazy.force small_image) with | Some small_image -> let canvas = create_canvas info.width info.height in let c = canvas##getContext Html._2d_ in c##drawImage_withSize small_image 0. 0. (float info.width) (float info.height); canvas##.style##.display := Js.string "block"; canvas##.style##.height := Js.string "auto"; canvas##.style##.width := Js.string "auto"; canvas##.style##.maxWidth := Js.string "100%"; canvas##.style##.maxHeight := Js.string "100%"; canvas##.style##.marginLeft := Js.string "auto"; canvas##.style##.marginRight := Js.string "auto"; let w = wrap canvas in Dom.appendChild img_container w; img##.onload := Html.handler (fun _ -> Dom.removeChild img_container w; Js._false) | None -> ()); (img##.src := match info.img_url with | None -> Js.string ("images/" ^ name ^ ".jpg") | Some url -> url); img##.width := info.width; img##.height := info.height; img##.style##.display := Js.string "block"; img##.style##.height := Js.string "auto"; img##.style##.width := Js.string "auto"; img##.style##.maxWidth := Js.string "100%"; img##.style##.maxHeight := Js.string "100%"; img##.style##.marginLeft := Js.string "auto"; img##.style##.marginRight := Js.string "auto"; let w = wrap img in let handle_error _ = Dom.removeChild img_container w; Js._false in img##.onerror := Html.handler handle_error; img##.onabort := Html.handler handle_error; Dom.appendChild img_container w; Dom.appendChild container img_container; let legend = Html.createDiv d in legend##.innerHTML := info.attribution; (* let p = Html.createP d in p##innerHTML <- Js.string ("See the <a target=\"_blank\" href=\"" ^ Js.to_string info.url ^ "\">image \ description page</a> on Wikimedia Commons for more \ information."); Dom.appendChild legend p; *) legend##.onclick := Html.handler (fun ev -> Html.stopPropagation ev; Js._true); legend##.className := Js.string "text"; legend##.style##.position := Js.string "absolute"; legend##.style##.bottom := Js.string "0"; legend##.style##.marginRight := Js.string "auto"; legend##.style##.marginLeft := Js.string "auto"; Dom.appendChild container legend; let background = Html.createDiv d in Dom.appendChild background container; background##.className := Js.string "overlay"; background##.style##.width := Js.string "100%"; background##.style##.height := Js.string "100%"; background##.style##.position := Js.string "absolute"; background##.style##.top := Js.string "0"; background##.style##.left := Js.string "0"; background##.style##.zIndex := Js.string "1"; let button = Html.createDiv d in button##.className := Js.string "button"; button##.style##.position := Js.string "absolute"; button##.style##.top := Js.string "0"; button##.style##.right := Js.string "0"; button##.style##.cursor := Js.string "pointer"; Dom.appendChild button (close_button true); Dom.appendChild button (close_button false); let tt = tooltip (opt_style messages##.close (Js.string "Click anywhere to return to the tree")) in tt##.style##.right := Js.string "32px"; tt##.style##.top := Js.string "20px"; Dom.appendChild button tt; Dom.appendChild background button; let buttons = Html.createDiv d in buttons##.style##.position := Js.string "absolute"; buttons##.style##.top := Js.string "0"; buttons##.style##.left := Js.string "0"; let url = let suffix = if !language == Js.string "en" then "" else "?uselang=" ^ Js.to_string !language in "http://commons.wikimedia.org/wiki/File:" ^ Js.to_string info.url ^ suffix in let commons = img_button ~href:(Js.string url) 52 "commons-38.png" in let tt = tooltip (opt_style messages##.wikimediaCommons (Js.string "See image description on Wikimedia Commons")) in tt##.style##.left := Js.string "48px"; tt##.style##.top := Js.string "12px"; Dom.appendChild commons tt; Dom.appendChild buttons commons; let wikipedia = img_button 34 "wikipedia-38.png" in let txt = Html.createDiv d in let count = ref 0 in let dl = Html.createDl d in let list title lang = let ul = Html.createUl d in let empty = ref true in Array.iter (fun (name, lang', refer) -> if lang' == lang then ( empty := false; let a = Html.createA d in Dom.appendChild a (d##createTextNode name); a##.target := Js.string "_blank"; let refer = Js.to_string refer in let url = "http://" ^ Js.to_string lang ^ ".wikipedia.org/wiki/" ^ if String.length refer = 0 then Js.to_string name else refer in a##.href := Js.string url; let li = Html.createLi d in Dom.appendChild li a; Dom.appendChild ul li)) info.links; if not !empty then ( incr count; let dd = Html.createDd d in Dom.appendChild dd (d##createTextNode title); Dom.appendChild dl dd; let dt = Html.createDt d in Dom.appendChild dt ul; Dom.appendChild dl dt) in list (opt_style messages##.language (Js.string "In English")) !language; if !language != Js.string "en" then list (Js.string "In English") (Js.string "en"); if !count > 0 then Dom.appendChild txt dl else Dom.appendChild txt (d##createTextNode (opt_style messages##.noRef (Js.string "No reference found."))); txt##.className := Js.string "text on"; txt##.style##.position := Js.string "absolute"; txt##.style##.left := Js.string "48px"; txt##.style##.top := Js.string "62px"; txt##.style##.whiteSpace := Js.string "nowrap"; Dom.appendChild wikipedia txt; Dom.appendChild buttons wikipedia; txt##.onclick := Html.handler (fun ev -> Html.stopPropagation ev; Js._true); show_on_click wikipedia txt; buttons##.onclick := Html.handler (fun ev -> Html.stopPropagation ev; Js._true); Dom.appendChild background buttons; Dom.appendChild d##.body background; background##.onclick := Html.handler (fun _ -> Dom.removeChild d##.body background; Js._true)); Lwt.return 0 let information_en = Js.string "<h1>A tree of animals</h1> This <a target=\"_blank\" \ href=\"http://en.wikipedia.org/wiki/Phylogenetic_tree\"><em>phylogenetic</em> \ tree</a> displays the relationships among animals.<h2>Usage</h2>Browse the tree by \ dragging it with the mouse. Click on any image to display a larger \ version.<h2>Credits</h2>This software and the images it uses are under free \ licenses. Images are from <a target=\"_blank\" \ href=\"http://commons.wikimedia.org/wiki/Main_Page\">Wikimedia Commons</a>. You \ can click on each image for details. The software has been written by Jérôme \ Vouillon (CNRS)." let show_information_page messages tree_i18n = let info = try snd (List.assq !language tree_i18n) with Not_found -> ( try snd (List.assq (Js.string "en") tree_i18n) with Not_found -> information_en) in let doc = Html.document in let txt = Html.createDiv doc in txt##.className := Js.string "text"; txt##.style##.width := Js.string "80%"; txt##.style##.margin := Js.string "auto"; txt##.innerHTML := info; let cell = Html.createDiv doc in cell##.style##.display := Js.string "table-cell"; cell##.style##.verticalAlign := Js.string "middle"; Dom.appendChild cell txt; let table = Html.createDiv doc in table##.style##.width := Js.string "100%"; table##.style##.height := Js.string "100%"; table##.style##.display := Js.string "table"; Dom.appendChild table cell; let overlay = Html.createDiv doc in overlay##.className := Js.string "overlay translucent"; Dom.appendChild overlay table; let c = ref Js.null in let close_info () = Dom.removeChild doc##.body overlay; Js.Opt.iter !c Html.removeEventListener in c := Js.some (Html.addEventListener Html.document Html.Event.keydown (Html.handler (fun e -> match e##.keyCode with | 27 | 13 -> close_info (); Js._false | _ -> Js._true)) Js._true); let button = Html.createButton doc in Dom.appendChild button (doc##createTextNode (opt_style messages##.ok (Js.string "OK"))); button##.onclick := Html.handler (fun _ -> close_info (); Js._false); let button_div = Html.createDiv doc in button_div##.style##.textAlign := Js.string "center"; button_div##.style##.margin := Js.string "2em auto"; Dom.appendChild button_div button; Dom.appendChild txt button_div; Dom.appendChild doc##.body overlay let unsupported_messages () = let doc = Html.document in let txt = Html.createDiv doc in txt##.className := Js.string "text"; txt##.style##.width := Js.string "80%"; txt##.style##.margin := Js.string "auto"; txt##.innerHTML := Js.string "Unfortunately, this browser is not supported. Please try again with another \ browser, such as <a href=\"http://www.mozilla.org/firefox/\">Firefox</a>, <a \ href=\"http://www.google.com/chrome/\">Chrome</a> or <a \ href=\"http://www.opera.com/\">Opera</a>."; let cell = Html.createDiv doc in cell##.style##.display := Js.string "table-cell"; cell##.style##.verticalAlign := Js.string "middle"; Dom.appendChild cell txt; let table = Html.createDiv doc in table##.style##.width := Js.string "100%"; table##.style##.height := Js.string "100%"; table##.style##.display := Js.string "table"; Dom.appendChild table cell; let overlay = Html.createDiv doc in overlay##.className := Js.string "overlay"; Dom.appendChild overlay table; Dom.appendChild doc##.body overlay let _ = (* Random.self_init (); *) (* Prefetch icons. *) List.iter (fun src -> ignore (load_image (icon src))) icons let all_messages = load_messages () let tree_info = load_tree () let image_info = load_image_info () let start _ = Lwt.ignore_result (tree_info >>= fun ((vertices, edges, nodes, boxes), tree_i18n) -> all_messages >>= fun all_messages -> let doc = Html.document in let page = doc##.documentElement in page##.style##.overflow := Js.string "hidden"; page##.style##.height := Js.string "100%"; doc##.body##.style##.overflow := Js.string "hidden"; doc##.body##.style##.margin := Js.string "0px"; doc##.body##.style##.height := Js.string "100%"; let w = page##.clientWidth in let h = page##.clientHeight in let canvas = create_canvas w h in Dom.appendChild doc##.body canvas; let tr = ref (zero, one) in let tr' = ref !tr in let vertices' = Array.copy vertices in (redraw_funct := fun () -> need_redraw := false; Firebug.console##time (Js.string "transform"); (* let transf = hyp_transf !tr' in for i = 0 to Array.length vertices - 1 do vertices'.(i) <- transf vertices.(i) done; *) let w = page##.clientWidth in let h = page##.clientHeight in if w <> canvas##.width || h <> canvas##.height then ( canvas##.width := w; canvas##.height := h); hyp_transf_vect !tr' vertices vertices'; Firebug.console##timeEnd (Js.string "transform"); draw canvas vertices' edges nodes boxes); perform_redraw (); Html.window##.onresize := Html.handler (fun _ -> let page = doc##.documentElement in let w = page##.clientWidth in let h = page##.clientHeight in (* debug_msg (Format.sprintf "Resize %d %d" w h); *) if w <> canvas##.width || h <> canvas##.height then (* canvas##width <- w; canvas##height <- h; perform_redraw () *) schedule_redraw (); Js._true); (* let eventually t f = let scheduled = ref false in fun () -> if not !scheduled then begin scheduled := true; ignore (Lwt_js.sleep t >>= fun () -> scheduled := false; f (); Lwt.return ()) end in *) let find_box boxes x y = let p = ref (-1) in for i = 0 to Array.length boxes.bw - 1 do if Array.unsafe_get boxes.bw i > 0. && abs_float (float x -. Array.unsafe_get boxes.bx i) < Array.unsafe_get boxes.bw i && abs_float (float y -. Array.unsafe_get boxes.by i) < Array.unsafe_get boxes.bh i then p := i done; !p in let on_image = ref false in let update_cursor x y = let i = find_box boxes x y in if i <> -1 then ( if not !on_image then ( canvas##.style##.cursor := Js.string "pointer"; on_image := true)) else if !on_image then ( canvas##.style##.cursor := Js.string ""; on_image := false) in canvas##.onmousemove := Html.handler (fun ev -> update_cursor ev##.clientX ev##.clientY; Js._false); handle_drag canvas (fun x0 y0 x1 y1 -> let z0 = from_screen canvas x0 y0 in let z1 = from_screen canvas x1 y1 in (* (* Transformation from z0 to z1: z1 = (z0 + p) / (conj p.z0 + 1) ==> p = (z1.z0.conj (z1 - z0) + z1 - z0) / (1 - |z1.z0|^2) *) let dz = sub z1 z0 in let z0z1 = mul z0 z1 in let p = sdiv (add (mul z0z1 (conj dz)) dz) (1. -. sq_norm z0z1) in tr' := compose !tr (p, one); *) let p, _ = !tr in let z0' = transl (neg p) z0 in let p' = compute_translation z0' z1 in tr' := p', one; schedule_redraw ()) (*perform_redraw ()*) (fun x y -> tr := !tr'; on_image := false; update_cursor x y) (fun x y -> let i = find_box boxes x y in if i > 0 then match nodes.(i) with | _, `Img (img, name) -> ignore (show_image all_messages image_info name img) | _ -> ()); handle_touch_events canvas (fun x0 y0 x1 y1 -> Firebug.console##time (Js.string "transform"); let z0 = from_screen canvas x0 y0 in let z1 = from_screen canvas x1 y1 in (* (* Transformation from z0 to z1: z1 = (z0 + p) / (conj p.z0 + 1) ==> p = (z1.z0.conj (z1 - z0) + z1 - z0) / (1 - |z1.z0|^2) *) let dz = sub z1 z0 in let z0z1 = mul z0 z1 in let p = sdiv (add (mul z0z1 (conj dz)) dz) (1. -. sq_norm z0z1) in tr' := compose !tr (p, one); *) let p, _ = !tr in let z0' = transl (neg p) z0 in let p' = compute_translation z0' z1 in tr' := p', one; schedule_redraw ()) (fun _ _ -> tr := !tr') (fun _ _ -> tr := !tr') (fun x y -> let i = find_box boxes x y in if i > 0 then match nodes.(i) with | _, `Img (img, name) -> ignore (show_image all_messages image_info name img) | _ -> ()); let handle_key_event ev = match ev##.keyCode with | 37 -> (* left *) let z0 = { x = 0.; y = 0. } in let z1 = { x = 0.1; y = 0. } in let p, _ = !tr in let z0' = transl (neg p) z0 in let p' = compute_translation z0' z1 in tr' := p', one; tr := !tr'; schedule_redraw (); Js._false | 38 -> (* up *) let z0 = { x = 0.; y = 0. } in let z1 = { x = 0.; y = 0.1 } in let p, _ = !tr in let z0' = transl (neg p) z0 in let p' = compute_translation z0' z1 in tr' := p', one; tr := !tr'; schedule_redraw (); Js._false | 39 -> (* right *) let z0 = { x = 0.; y = 0. } in let z1 = { x = -0.1; y = 0. } in let p, _ = !tr in let z0' = transl (neg p) z0 in let p' = compute_translation z0' z1 in tr' := p', one; tr := !tr'; schedule_redraw (); Js._false | 40 -> (* down *) let z0 = { x = 0.; y = 0. } in let z1 = { x = 0.; y = -0.1 } in let p, _ = !tr in let z0' = transl (neg p) z0 in let p' = compute_translation z0' z1 in tr' := p', one; tr := !tr'; schedule_redraw (); Js._false | _ -> Js._true in ignore (Html.addEventListener Html.document Html.Event.keydown (Html.handler handle_key_event) Js._true); let prev_buttons = ref None in let rec make_buttons () = (match !prev_buttons with | None -> () | Some buttons -> Dom.removeChild doc##.body buttons); let buttons = Html.createDiv doc in buttons##.style##.position := Js.string "absolute"; buttons##.style##.right := Js.string "0"; buttons##.style##.bottom := Js.string "0"; let messages = local_messages all_messages in let info = img_button 38 "info-38.png" in info##.style##.position := Js.string "absolute"; info##.style##.bottom := Js.string "2px"; info##.style##.right := Js.string "0"; info##.style##.cursor := Js.string "pointer"; info##.onclick := Html.handler (fun _ -> show_information_page messages tree_i18n; Js._false); let tt = tooltip (opt_style messages##.info (Js.string "Information")) in tt##.style##.right := Js.string "36px"; tt##.style##.bottom := Js.string "36px"; Dom.appendChild info tt; Dom.appendChild buttons info; let lang = img_button 38 "globe-38.png" in lang##.style##.position := Js.string "absolute"; lang##.style##.bottom := Js.string "2px"; lang##.style##.right := Js.string "48px"; lang##.style##.cursor := Js.string "pointer"; let languages = [ "Français", "fr"; "English", "en" ] in let txt = Html.createDiv doc in let dl = Html.createDl doc in let ul = Html.createUl doc in List.iter (fun (name, id) -> let a = Html.createA doc in Dom.appendChild a (doc##createTextNode (Js.string name)); a##.href := Js.string "#"; a##.onclick := Html.handler (fun _ -> set_language (Js.string id); make_buttons (); compute_text_nodes tree_i18n nodes; schedule_redraw (); Js._false); let li = Html.createLi doc in Dom.appendChild li a; Dom.appendChild ul li) languages; let dd = Html.createDd doc in Dom.appendChild dd (doc##createTextNode (opt_style messages##.languages (Js.string "Languages"))); Dom.appendChild dl dd; let dt = Html.createDt doc in Dom.appendChild dt ul; Dom.appendChild dl dt; Dom.appendChild txt dl; txt##.className := Js.string "text on"; txt##.style##.position := Js.string "absolute"; txt##.style##.right := Js.string "0px"; txt##.style##.bottom := Js.string "46px"; txt##.style##.whiteSpace := Js.string "nowrap"; Dom.appendChild lang txt; show_on_click lang txt; Dom.appendChild buttons lang; let recenter = img_button 38 "meeting-point-38.png" in recenter##.style##.position := Js.string "absolute"; recenter##.style##.bottom := Js.string "2px"; recenter##.style##.right := Js.string "96px"; recenter##.style##.cursor := Js.string "pointer"; recenter##.onclick := Html.handler (fun _ -> tr' := zero, one; tr := !tr'; schedule_redraw (); Js._false); let tt = tooltip (opt_style messages##.recenter (Js.string "Recenter")) in tt##.style##.right := Js.string "36px"; tt##.style##.bottom := Js.string "36px"; Dom.appendChild recenter tt; Dom.appendChild buttons recenter; Dom.appendChild doc##.body buttons; prev_buttons := Some buttons in make_buttons (); let img = Html.createImg doc in img##.src := icon "ocsigen-powered.png"; let a = Html.createA doc in a##.target := Js.string "_blank"; a##.href := Js.string "http://ocsigen.org/"; Dom.appendChild a img; let logo = Html.createDiv doc in logo##.style##.position := Js.string "absolute"; logo##.style##.left := Js.string "0"; logo##.style##.bottom := Js.string "0"; Dom.appendChild logo a; Dom.appendChild doc##.body logo; Lwt.return ()); Js._false let start _ = try ignore (Html.createCanvas Html.window##.document); start () with Html.Canvas_not_available -> unsupported_messages (); Js._false let _ = Html.window##.onload := Html.handler start �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/icons/��������������������������������������������������������0000775�0000000�0000000�00000000000�13575077500�0021076�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/icons/commons-38.png������������������������������������������0000664�0000000�0000000�00000004033�13575077500�0023507�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���&���4���#J>���sBIT|d��� pHYs���������tEXtSoftware�www.inkscape.org<��IDATXř}TϝY%�UV+ڈD & cc۔@BB76 >ܹC@JۤlY%JI+J"B=ޝٹ(=M<}=y`fT{wxfG56:/*qrTX竧K<Ń_O DfwS=*c$ߩXu3V_D$T.U/eae3ícQ*|*kQv߈iaHvoj6ce0n0/#Q,M#:w!p x#SF18ς`a&qW0o`͉}%VUPݍ^>֜X]dy^\nfCls_7Xy^~nx'?b�JfF^a70яM̉Ax#j%&^ MeW}ls8GZ �O/ uK!e M,-A�5Jm`_4Z{*Sc rt&ZRKӚ1ɻf1W0;,R*"[@Ko(z[9K`F Eg;6PXzܧ7|lkU4)|2?g4lb]0kYqO8)a(9K( y@qϴ3V{%J mN@zB*6 E2Sc.̇4kA Wh!;:%ۏ+m4IK\)ip}r E/qDE_SjX_K-S@h%xxXd@ZkR`A�ílݲkeݵ.qGȌB B3m+.\iG3fm+1yB_Ի2r�܌4AK]Or&;~3Lu6 :VߍҸ CUi𓶳&;`!xPQݕɯYz�R2:A kwWx޼XrBN<gm13S4kuN.;q(JpPg4A9@XM?ͥ%mJ-'۔8DK\A!.'K6ʲmEЛ6ہfe۸6 X%r> v 4DmLY|�X zR Ξ{W"2/q!4=xӤJђMklbo-fw(yOD"N 3 W:bK < ,O>PHDcnt!c %-g{UK.zȵVh-Bn3#p8av@1wbI~Ӊ,QeBv臗_gҊ0a֖I0Vו` t=(3O]4EoDWbXVo|Hs|L !uw9 l)F= Xbѐ0tm[}_l[:W @6 \Kf(2XiuEri,k?y~쏖M*13 /-] Х>x\Nxa.̈́ϑ<pqnZWAYj$7 Xd.Xe5L$@ `!dc nt?(eUC\l,Wl}|p7x֋bֲ73-Z=})aJ5* DZeIa̞4o�> 6Y9`ƯUsa큾+qރl b$ q33[szapcd����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/icons/favicon.png���������������������������������������������0000664�0000000�0000000�00000001260�13575077500�0023230�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���sBIT|d��� pHYs�� �� B(x���tEXtSoftware�www.inkscape.org<��-IDAT8MHTaνƟjjD/h]n2Ԣ"#2 }*"HRI93vZtG :nw~D{("@Pm`ԧLH_6+#`5Q@ 0 btw#iFex^&K'2jz-lv?.Z^MDP@njUZk:zR<{d`<9[ȋT4Cź<\$fؓ5\=DcD8T$[*r5Z>a\ǖ,;FT汾ރ;lJ(pk<z.d9b.WԄF #P1DѠκ(8*ICěq}<Ic9�: ÔUK+~k]*5Ӫ =)JmbH9+!뗚} 4Dd8a`x"ņ2wI¦=ь])beeupcvٗԕ3R6&;weRY#ov����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/icons/globe-38.png��������������������������������������������0000664�0000000�0000000�00000005525�13575077500�0023133�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���&���&���=���sBIT|d��� pHYs�� �� B(x���tEXtSoftware�www.inkscape.org<�� IDATX{pWյ?kBHR V\i*0@@^`!bLWJv\F/ZmyZ@`1!Tf:s>k^묵2I\z ðN@ j5%sBװ V6Ccʗ̗:,K 򄊀.AN، H$& x VdӞ sS0+icӘ\N_O7Vܔ[ rghAw~2`5IV'"�GtUp)' ݇_6ĥ+=BsopzO|` ߠ/J !8@pJ-p* EtX!*ϵn3}U.3쑉}jZ@;rHM: - dR;tkFJa�&rXl IdDR*^Eƥ.;ďyk֋]g.. r%L:UMw$ΤyI%͗Hx5ϭSk`Ik$.sg;äEw">qcDKi7+f�!bV zǝ$.\kI�.q(#"9X[c;K|j[pcwIHH6�f6P- Ka.pm.HV\M:O:<͕}5U?�r2=%I%"|pk4%}rt XV!r48Eɹlh>>?{i`WK|v?}c22\y >ӥcgMRt"myZΪx#Y�3A=xԦ#HrɵZBx0B;ݹC JR>`W Gua6(ʣS +V �L |c݆|&3VG%2CIIK_]\6X߹&ʼn/NjRL^(uCD+FZe3VG3BV]J6I̻d 8t3Ա#[PH9 nh!]r$Hl?;<]R.si:L/Vu�+8 BX|>sG�r)%]!nlxYɿŧBҭ]lhn>R IA"Kg5Gp_(޺ �C$%Z @&rvzAd7T&q F&WrqE{s{\$+S!;_jY8ބǦ?ʇ%!Qq<lNr/*Z+C'3 AQϦVyٟcrA\$2xkr&a`r-6&q5tM]+83Fޙk*˹NV5~vKp#1(qh`o+i#jqk%Jc:`Ralo} b0Į9advQ.v9tr!rN~-74M~E\l4T(Rz?fcdjﮃv><- AZc,xEyi KY~MOȒ 9\'s{r< G]T @IyOAI$K&TKDdl %sPi'0#OHےşTr:cQ?VF4-[Q6E͆-ƝNU`CE6)./B#[;Z*:d )~vcw FDR�GC6Ly.\e E([Rh0?\ H=#9qqp)Eg-k$qѐ2=zO8M5/qĝBѹ#;IXCAn5gK\ q|syJeOr\JtA#K. #͡F,JR"π*v]Lջv\Y!\X4̾ECRU^\X;OJ||3Zaq1A$Oq XU.I#q?ۘHL\NyCr٠8zUґfɈO RI$Ktsq;.m^għ&/+gID.>vmkyqN.: ]:Mi(6L7=!&MyE"= ^%z/ަZ ש Π M(_Rv!bHY:5VIR?Ho?Q=R>7jSp ߖ>��vui C^�G vQ|83"ria˯ϵyPK!7 ӐtDz"2&}瓙%z4U ?`{0S>Owqrښ;2ݐ2Ssȭ rλWmuOf{c%:4RQRG>f2ڳ%`Me\i~X6QcPh?`ӊ15 ge|����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/icons/info-38.png���������������������������������������������0000664�0000000�0000000�00000001446�13575077500�0022774�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���&���&���=���sBIT|d��� pHYs������FqD���tEXtSoftware�www.inkscape.org<��IDATXKhQ$3yL&cئFb\hEq#Z*.*D  wUqtQPĢJC6[uL0 ,Ý g>3X� fm\9xfJy@ryivr|Ucʳݑ-w� TS_mc¶8+vN{$Zp|ML{,:&NB�Bˋ`|Em);e9fG)bfr,μwX*p ]ńYD(?%/h3w%�(M<8/?piHߞqݡlEF)jR1`6%L"#3މu]iS t =Gb#)E *Y�Ԡ S\<RTUM,3)Tm0HQFǘLB T5@yδNg3L@HmTP VKfcOG8ikqB1PT;fn`٬.9Qt D+ǀc ),-�s)cfQ5(ny17 AtMͭj1;Öc^hs/a|2 zJ+-uѺ'K4hvoۿ=`VۂF,PTU����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/icons/meeting-point-38.png������������������������������������0000664�0000000�0000000�00000002121�13575077500�0024607�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���&���&���=���sBIT|d��� pHYs�� �� B(x���tEXtSoftware�www.inkscape.org<��IDATX͘nGƿjrȑ3$?�B$&IJQv{�1l (NBJဴHyN鵘ٰNI̬UuID��9΂p�f]_PDDNJiݷzȆF4бh0 (L@@s�qHߨ(wJ~Cu1021Ƚ@t Sof/pD7T�1pvO`,0ʸ+ra�lx;1E&`W"b4!da,RYTT& , ;Y�*Õ؇CRv�[/wNcj P@%tڪ*�vYuJ5 19f>R|H2t"1T l\/('{gbN r�0Dwb)vd!ƞ!'O6v CDꀅdӧKֱ7h V)f >Sϩ-ߙ:XV>"DaNl4ꂙ1Hw`Ϟh<b u kfX.`ի,oђ=ΊV� ڞ b~ ŋw<AHu(a'p^jSkpcslń^nyP1^%ZnbǙP}5pŠ#w9 &d6.X8w6-8˥5i +U#}V W-v/90۫*s+|$b8�޶ \W&~Z�^nojT ~), ~Sh~֞`繐5 r `m_M_&~*_fˀl]9h'B91:*+ 'i[:vޛhQv����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/icons/wikipedia-38.png����������������������������������������0000664�0000000�0000000�00000006712�13575077500�0024010�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���&���"���3���sRGB����bKGD������ pHYs��(��(4���tIME 3c*�� JIDATXÕm\UN0Lfd"` X%$[euY5jvW ,,ZPAp!&d C&3鞾ӷs~1"|Usy޴4M98~juBsG;>O<[ڮo|bPkyv9,w;3{:ڷ#[o7Z{t;KW\>{^P_si0:mt]ON_L&'>v[.=X) L� C^{W,Mf\"ҍdw>/yA@~G_ן~brrχnZ3R\F^xЮ'f.w:Yv?S?i1?Oy2fMI,bh0*UQD\u?0\u+G~|&Kejάi4٣g388y3mn,q.l+o˲IS NǗ;p\u]+צG~&`VcGoKO]}G-u\+MӲ(,a`YnLa.eڋq8?LX\l]FGGxY?O>A hgddg˖-=4/ W!2033 TL6FH,uR aq܌׮}Ŧjn۞yg`Pi^`۶m-CCC_f[/xK;qddRJ2JeRHDĒBo 0, ݲ,YN'4$ nÐH.�{m[_5kz> , �q uDaX&R\%B�S304Cבq̚axӴ2�̙i[q\T_Zd2ml6?x9rH<Jd,uQ*e71~8fEoboiفk[.e7xcBlsݞl(t]cZeqqQ꺎aYy77>>.7m䌌 z{2_>y<{pfp]SsUC|ahN<eiRJkL?`IjQ,p 7\.wL4jZ+ٽ{fS*%M%RJ&&&) b ;v_:mߎ Eh/)V]4u4mq<bŵa(q4~lM3�ŝw9811 Dа,c<;5v}+᩟ ΥT*18ۥh["ٜw48'N| /tv܄t:J]eѐ\sttP(2�FZTp,R*(%9֭G!"0$ Cn@"cAQVY}:_fMO_?Zfs5M ccf<o9!h5lܸϻP}XV`z}I Jj""ɹ=˲VvN$jB'_DJI&T*c:i"e?)\}U5FA^G)ڵk1 e-kn/RC ۈHFݰ� jJ{ER)J YMo@&ZlXM!b Ld9y4etlM36Y�(�$J?bBiۨ4%%wKDqM;>-Djdt<٬C(9YJ>cǘxry#d2R(@oo4U)a@hI{۔eIR$&#T'",˞uW ^,XT@R4L$ oo}^} 岫hka@6G6ϩS3ARymh4K4%U *DR",ˤTB*yČǎ~0r$IvCcOBaRJfggH8CP-Q)JU08gFGG>ZQ, # 2KKK!~]fgyᅃnV-l6]( "dqqðXz>\0 l;C %t:K+VMش|t;Vi5tEHXsuvݓyUe?4J1$E1a(HA/{߽BqU Ŵ,;k܍<ȣt}z+N.O",Uf!dBĞG2ݗn~88YV#I$R (^C5V4(Rr97߃㸜58Hoo?萈|_&},u:H d,x{ pD\_jiɣ]yR% "?zG /Cs 2HӔ$YZ@#UJ61'!C v扥Z#AAwNc^{m.+OsdRD!`C/SUTǒ8NRj. B7碡#☮,s*^Om"IBjB bn&P Bh/q,J)\ץ_Rqr4nCA@BłHDdmR)9|<%D 󍗆nÂWGR=Iad,ɱj,,4!s895E0 Ix+N:B%D* 4߼Q_)@k{Xi.۳X?󗘦( D)vv9,a43d2&jPhئE DR׉u]nn!`9<ه?wHDyi{E۷>eY6^g 21 ðE!abgm4s,u:t�> J ;] ]Kuü޴w>x剙6mT6-B *BHeJt:D,Hb!28"" aH5 g>sǐ6][f !O<8[l!纸9tPX&MR}EݐfkfWG+ok|[Hb@4l2WxG�!:KKT"%tSYcyo{+T ]vg5(/A)رcogaNXf%#1ǂ8n?:n-j,wu׹a_z0VL<a~:\TxbΝު,i8-*3����IENDB`������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/image_info.json�����������������������������������������������0000664�0000000�0000000�00000130265�13575077500�0022762�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������[0,[0,"ovibos","Ovibos_moschatus_attackierend2_.jpg","By BS Thurner Hof [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,489,[0,[0,"Ovibovini","fr",""],[0,"Bœuf musqué","fr","B%C5%93uf_musqu%C3%A9"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Ovibos_moschatus_attackierend2_.jpg/800px-Ovibos_moschatus_attackierend2_.jpg"]],[0,"capra","Saanenziege.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5-2.0-1.0\">CC-BY-SA-2.5-2.0-1.0</a>]",332,257,[0,[0,"Tan (goat pattern)","en","Tan_(goat_pattern)"],[0,"Saanen goat","en","Saanen_goat"],[0,"Saanen (race caprine)","fr","Saanen_(race_caprine)"],[0,"Chèvre","fr","Ch%C3%A8vre"],[0,"Pélardon","fr","P%C3%A9lardon"],[0,"Rocamadour (fromage)","fr","Rocamadour_(fromage)"]],[0,"http://upload.wikimedia.org/wikipedia/commons/f/f5/Saanenziege.jpg"]],[0,"rupicapra","Rupicapra_rupicapra_0.jpg","By Andreas Tille [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,640,[0,[0,"Rupicapra","en",""],[0,"Alps","en",""],[0,"Lac du Crachet","fr","Lac_du_Crachet"],[0,"Val Trupchun","fr","Val_Trupchun"],[0,"Chamois","fr",""],[0,"Alpes","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Rupicapra_rupicapra_0.jpg/800px-Rupicapra_rupicapra_0.jpg"]],[0,"mouton","Schaf_bei_Woodhenge1.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,600,[0,[0,"Ovis","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Schaf_bei_Woodhenge1.jpg/800px-Schaf_bei_Woodhenge1.jpg"]],[0,"mouflon","Mouflon_2.jpg","<a target=\"_blank\" href=\"http://en.wikipedia.org/wiki/User:Jdennett77\">Jdennett77</a> [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.5\">CC-BY-2.5</a>]",800,598,[0,[0,"Ovis","en",""],[0,"Mouflon","en",""],[0,"Ovina","fr",""],[0,"Ovis orientalis","fr","Ovis_orientalis"],[0,"Ovis","fr",""],[0,"Mouflon méditerranéen","fr","Mouflon_m%C3%A9diterran%C3%A9en"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Mouflon_2.jpg/800px-Mouflon_2.jpg"]],[0,"connochaetes","Wildebeest_Steve_Evans.jpg","By Steve Evans from Citizen of the World (South Africa) [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.0\">CC-BY-2.0</a>]",800,533,[0,[0,"Gnou","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Wildebeest_Steve_Evans.jpg/800px-Wildebeest_Steve_Evans.jpg"]],[0,"oryx","Oryx_samburu.jpg","By \"Daniel Fafard (Dreamdan)\" (Auteur) [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,545,[0,[0,"Oryx","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Oryx_samburu.jpg/800px-Oryx_samburu.jpg"]],[0,"aepyceros","Serengeti_Impala3.jpg","By Ikiwaner [<a target=\"_blank\" href =\"http://www.gnu.org/licenses/old-licenses/fdl-1.2.html\">GFDL 1.2</a>]",800,800,[0,[0,"Impala","en",""],[0,"Parc national de l'île Ndere","fr","Parc_national_de_l%27%C3%AEle_Ndere"],[0,"Impala","fr",""],[0,"Gazelle","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Serengeti_Impala3.jpg/800px-Serengeti_Impala3.jpg"]],[0,"bison","Bison_bison_009.jpg","By Donnie from WV, USA (VAC2010 1236\nUploaded by berichard) [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.0\">CC-BY-SA-2.0</a>]",800,506,[0,[0,"Bison d'Amérique du Nord","fr","Bison_d%27Am%C3%A9rique_du_Nord"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/d/d5/Bison_bison_009.jpg/800px-Bison_bison_009.jpg"]],[0,"bos","Kuh_in_transkei.jpg","By Amada44 [Public domain]",800,532,[0,[0,"Afrikaner cattle","en","Afrikaner_cattle"],[0,"Élevage bovin en Afrique du Sud","fr","%C3%89levage_bovin_en_Afrique_du_Sud"],[0,"Sanga (rameau)","fr","Sanga_(rameau)"],[0,"Afrikaner (race bovine)","fr","Afrikaner_(race_bovine)"],[0,"Bos taurus","fr","Bos_taurus"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Kuh_in_transkei.jpg/800px-Kuh_in_transkei.jpg"]],[0,"syncerus","Syncerus_caffer.jpg","By PaulRae\nderivative work: Berichard (talk)\n\n (African_Buffalo.JPG) [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.5\">CC-BY-2.5</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a>]",800,697,[0,[0,"Buffle d'Afrique","fr","Buffle_d%27Afrique"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Syncerus_caffer.jpg/800px-Syncerus_caffer.jpg"]],[0,"cervus","Cervus_elaphus_Luc_Viatour_6.jpg","By Lviatour [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a>]",800,533,[0,[0,"Cerf élaphe","fr","Cerf_%C3%A9laphe"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/4/4b/Cervus_elaphus_Luc_Viatour_6.jpg/800px-Cervus_elaphus_Luc_Viatour_6.jpg"]],[0,"alces","Moose-Gustav.jpg","Author information on Wikimedia Commons [Attribution or <a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.5\">CC-BY-2.5</a>]",600,450,[0,[0,"Red Marsh Nature Reserve","en","Red_Marsh_Nature_Reserve"],[0,"Wolves and moose on Isle Royale","en","Wolves_and_moose_on_Isle_Royale"],[0,"Alces alces","fr","Alces_alces"]],[0,"http://upload.wikimedia.org/wikipedia/commons/c/c9/Moose-Gustav.jpg"]],[0,"capreolus","Chevreuil_repos.jpg","By Asabengurtza [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,600,[0,[0,"Felix Salten","fr","Felix_Salten"],[0,"Chevreuil","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Chevreuil_repos.jpg/800px-Chevreuil_repos.jpg"]],[0,"okapia","Okapi2.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,695,[0,[0,"Donodon","en",""],[0,"Dorsetodon","en",""],[0,"Drescheratherium","en",""],[0,"Henkelotherium","en",""],[0,"Brancatherulum","en",""],[0,"Tragulina","en",""],[0,"Harbor seal","en","Harbor_seal"],[0,"Manzano Mountain Cottontail","en","Manzano_Mountain_Cottontail"],[0,"Mixodectidae","en",""],[0,"Robust Cottontail","en","Robust_Cottontail"],[0,"Euthlastus","en",""],[0,"Comotherium","en",""],[0,"Dryolestes","en",""],[0,"Laolestes","en",""],[0,"Miccylotyrans","en",""],[0,"Parcs nationaux congolais (RDC)","fr","Parcs_nationaux_congolais_(RDC)"],[0,"1901 en science","fr","1901_en_science"],[0,"Géographie de la République démocratique du Congo","fr","G%C3%A9ographie_de_la_R%C3%A9publique_d%C3%A9mocratique_du_Congo"],[0,"Okapi","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/1/18/Okapi2.jpg/800px-Okapi2.jpg"]],[0,"giraffa","Giraffa_camelopardalis_angolensis.jpg","<p>© Hans Hillewaert / <a target=\"_blank\" href=\"http://creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a></p>",800,1067,[0,[0,"Giraffe","en",""],[0,"Oshikoto","fr",""],[0,"Girafe","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Giraffa_camelopardalis_angolensis.jpg/800px-Giraffa_camelopardalis_angolensis.jpg"]],[0,"hippopotamus","Hippo_pod_edit.jpg","By Paul Maritz [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,533,[0,[0,"Mammalia in the 10th edition of Systema Naturae","en","Mammalia_in_the_10th_edition_of_Systema_Naturae"],[0,"Largest organisms","en","Largest_organisms"],[0,"Wildlife of Zambia","en","Wildlife_of_Zambia"],[0,"Cetruminantia","en",""],[0,"Whippomorpha","en",""],[0,"Kasungu National Park","en","Kasungu_National_Park"],[0,"South Luangwa National Park","en","South_Luangwa_National_Park"],[0,"Democratic Republic of the Congo","en","Democratic_Republic_of_the_Congo"],[0,"Hippopotamidae","en",""],[0,"Hippopotamus","en",""],[0,"Mammifère aquatique","fr","Mammif%C3%A8re_aquatique"],[0,"Gabon","fr",""],[0,"Hippopotamus amphibius","fr","Hippopotamus_amphibius"],[0,"Hippopotamidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Hippo_pod_edit.jpg/800px-Hippo_pod_edit.jpg"]],[0,"orcinus","Killerwhales_jumping.jpg","By Pittman [Public domain]",450,313,[0,[0,"Mammals of Olympic National Park","en","Mammals_of_Olympic_National_Park"],[0,"Captive killer whales","en","Captive_killer_whales"],[0,"Life (BBC TV series)","en","Life_(BBC_TV_series)"],[0,"Flora and fauna of Greenland","en","Flora_and_fauna_of_Greenland"],[0,"Mammals of Antarctica","en","Mammals_of_Antarctica"],[0,"Bluespotted stingray","en","Bluespotted_stingray"],[0,"Cosmopolitan distribution","en","Cosmopolitan_distribution"],[0,"Megafauna","en",""],[0,"Killer whale","en","Killer_whale"],[0,"Dolphin","en",""],[0,"Orientation bibliographique en zoologie (taxinomie)","fr","Orientation_bibliographique_en_zoologie_(taxinomie)"],[0,"Superprédateur","fr","Superpr%C3%A9dateur"],[0,"Parc national Olympique","fr","Parc_national_Olympique"],[0,"Orque","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/3/37/Killerwhales_jumping.jpg"]],[0,"phocoena","Daan_Close_Up.PNG","By AVampireTear [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",675,583,[0,[0,"Harbour porpoise","en","Harbour_porpoise"],[0,"Marsouin commun","fr","Marsouin_commun"],[0,"Phocoenidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/2/28/Daan_Close_Up.PNG"]],[0,"monodon","Narwhals_breach.jpg","By Glenn Williams (National Institute of Standards and Technology) [Public domain]",800,509,[0,[0,"Ivory trade","en","Ivory_trade"],[0,"Tusk","en",""],[0,"Narwhal","en",""],[0,"Corne de licorne","fr","Corne_de_licorne"],[0,"Défense (dent)","fr","D%C3%A9fense_(dent)"],[0,"Narval","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Narwhals_breach.jpg/800px-Narwhals_breach.jpg"]],[0,"delphinapterus","Delphinapterus_leucas_head_3.jpg","<a target=\"_blank\" href=\"http://commons.wikimedia.org/wiki/User:Stan_Shebs\">Stan Shebs</a> [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5\">CC-BY-SA-2.5</a>]",800,573,[0,[0,"Béluga (baleine)","fr","B%C3%A9luga_(baleine)"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Delphinapterus_leucas_head_3.jpg/800px-Delphinapterus_leucas_head_3.jpg"]],[0,"balaenoptera","Humpback_stellwagen_edit.jpg","By Whit Welles Wwelles14 [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/3.0\">CC-BY-3.0</a>]",800,453,[0,[0,"Silas D. Alben","en","Silas_D._Alben"],[0,"Stellwagen Bank National Marine Sanctuary","en","Stellwagen_Bank_National_Marine_Sanctuary"],[0,"National Recording Registry","en","National_Recording_Registry"],[0,"Cetartiodactyla","en",""],[0,"Cetology","en",""],[0,"Whale surfacing behaviour","en","Whale_surfacing_behaviour"],[0,"Whale watching","en","Whale_watching"],[0,"Humpback whale","en","Humpback_whale"],[0,"Baleen whale","en","Baleen_whale"],[0,"Whale","en",""],[0,"Cetacea","en",""],[0,"Baleine à bosse","fr","Baleine_%C3%A0_bosse"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Humpback_stellwagen_edit.jpg/800px-Humpback_stellwagen_edit.jpg"]],[0,"phacochoerus","Tarangire_Warzenschwein1.jpg","By Ikiwaner [<a target=\"_blank\" href =\"http://www.gnu.org/licenses/old-licenses/fdl-1.2.html\">GFDL 1.2</a>]",800,600,[0,[0,"Warthog","en",""],[0,"Phacochère","fr","Phacoch%C3%A8re"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Tarangire_Warzenschwein1.jpg/800px-Tarangire_Warzenschwein1.jpg"]],[0,"sus","WildZwijn_cropped.jpg","By nl:User:GerardM (Image:WildZwijn.jpg) [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,606,[0,[0,"Sanglier","fr",""],[0,"Fenouillèdes","fr","Fenouill%C3%A8des"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/6/61/WildZwijn_cropped.jpg/800px-WildZwijn_cropped.jpg"]],[0,"camel","07._Camel_Profile,_near_Silverton,_NSW,_07.07.2007.jpg","By Jjron [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,985,[0,[0,"Mandora Marsh","en","Mandora_Marsh"],[0,"Australian feral camel","en","Australian_feral_camel"],[0,"Taboo food and drink","en","Taboo_food_and_drink"],[0,"Invasive species in Australia","en","Invasive_species_in_Australia"],[0,"Dromedary","en",""],[0,"Camelid","en",""],[0,"Tylopoda","en",""],[0,"Camel","en",""],[0,"Dromadaire australien","fr","Dromadaire_australien"],[0,"Dromadaire","fr",""],[0,"Camelidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/4/43/07._Camel_Profile%2C_near_Silverton%2C_NSW%2C_07.07.2007.jpg/800px-07._Camel_Profile%2C_near_Silverton%2C_NSW%2C_07.07.2007.jpg"]],[0,"lama","Lama_animal.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5\">CC-BY-SA-2.5</a>]",800,600,[0,[0,"Lama (animal)","fr","Lama_(animal)"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/Lama_animal.jpg/800px-Lama_animal.jpg"]],[0,"lutra","Loutre_des_pyrenees_baronnies_2004.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",594,394,[0,[0,"Lac Arpi","fr","Lac_Arpi"],[0,"Petite Amazonie des Pyrénées","fr","Petite_Amazonie_des_Pyr%C3%A9n%C3%A9es"],[0,"Géographie de la Charente","fr","G%C3%A9ographie_de_la_Charente"],[0,"Vis (rivière)","fr","Vis_(rivi%C3%A8re)"],[0,"Lutra","fr",""],[0,"Loutre d'Europe","fr","Loutre_d%27Europe"],[0,"Loutre","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/c/c3/Loutre_des_pyrenees_baronnies_2004.jpg"]],[0,"procyon","Procyon_lotor_1.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,927,[0,[0,"Procyonidae","fr",""],[0,"Amérique du Nord","fr","Am%C3%A9rique_du_Nord"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Procyon_lotor_1.jpg/800px-Procyon_lotor_1.jpg"]],[0,"simocyon","Red_Panda.JPG","By User Bernard Landgraf on de.wikipedia.org [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,534,[0,[0,"Wildlife of India","en","Wildlife_of_India"],[0,"Red panda","en","Red_panda"],[0,"Ailuridae","fr",""],[0,"Petit panda","fr","Petit_panda"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/c/c6/Red_Panda.JPG/800px-Red_Panda.JPG"]],[0,"mephitis","Striped_skunk.jpg","Author information on Wikimedia Commons [Public domain]",300,437,[0,[0,"Mammals of the Indiana Dunes","en","Mammals_of_the_Indiana_Dunes"],[0,"Mammals of New England","en","Mammals_of_New_England"],[0,"Pépé le putois","fr","P%C3%A9p%C3%A9_le_putois"],[0,"Mouffette","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/6/63/Striped_skunk.jpg"]],[0,"mirounga","Mirounga_leonina_male.JPG","By B.navez (self-made (scan of paper photo)) [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,544,[0,[0,"Southern elephant seal","en","Southern_elephant_seal"],[0,"Largest organisms","en","Largest_organisms"],[0,"Elephant seal","en","Elephant_seal"],[0,"Carnivora","en",""],[0,"Éléphant de mer du sud","fr","%C3%89l%C3%A9phant_de_mer_du_sud"],[0,"Province de Santa Cruz","fr","Province_de_Santa_Cruz"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/Mirounga_leonina_male.JPG/800px-Mirounga_leonina_male.JPG"]],[0,"arctocephalus","Arctocephalus_galapagoensis2.jpg","By Kelly J. Kane [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/3.0\">CC-BY-3.0</a>]",800,800,[0,[0,"Galápagos Sea Lion","en","Gal%C3%A1pagos_Sea_Lion"],[0,"Arctocephalus galapagoensis","fr","Arctocephalus_galapagoensis"],[0,"Nageoire","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Arctocephalus_galapagoensis2.jpg/800px-Arctocephalus_galapagoensis2.jpg"]],[0,"odobenus","Noaa-walrus30.jpg","Author information on Wikimedia Commons [Public domain]",700,455,[0,[0,"Odobenus","fr",""],[0,"Odobenidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/d/de/Noaa-walrus30.jpg"]],[0,"ursus","Polar_Bear_2004-11-15.jpg","By Ansgar Walk [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5\">CC-BY-SA-2.5</a>]",800,606,[0,[0,"Nordic countries","en","Nordic_countries"],[0,"Polar seas","en","Polar_seas"],[0,"Wapusk National Park","en","Wapusk_National_Park"],[0,"Polar region","en","Polar_region"],[0,"Megafauna","en",""],[0,"Bear","en",""],[0,"Parcs nationaux du Canada","fr","Parcs_nationaux_du_Canada"],[0,"Emblèmes des provinces et territoires du Canada","fr","Embl%C3%A8mes_des_provinces_et_territoires_du_Canada"],[0,"Parc national Wapusk","fr","Parc_national_Wapusk"],[0,"Ours blanc","fr","Ours_blanc"],[0,"Océan Arctique","fr","Oc%C3%A9an_Arctique"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Polar_Bear_2004-11-15.jpg/800px-Polar_Bear_2004-11-15.jpg"]],[0,"tremarctos","Spectacled_Bear_-_Houston_Zoo.jpg","By en:User:Cburnett [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,728,[0,[0,"Ichigkat muja – Cordillera del Condor National Park","en","Ichigkat_muja_%E2%80%93_Cordillera_del_Condor_National_Park"],[0,"Serranía de los Churumbelos","en","Serran%C3%ADa_de_los_Churumbelos"],[0,"Tremarctos","en",""],[0,"Spectacled bear","en","Spectacled_bear"],[0,"Ours à lunettes","fr","Ours_%C3%A0_lunettes"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Spectacled_Bear_-_Houston_Zoo.jpg/800px-Spectacled_Bear_-_Houston_Zoo.jpg"]],[0,"ailuropoda","Grosser_Panda.JPG","By J. Patrick Fischer [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a>]",800,533,[0,[0,"World Wide Fund for Nature","en","World_Wide_Fund_for_Nature"],[0,"Giant panda","en","Giant_panda"],[0,"Panda géant","fr","Panda_g%C3%A9ant"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Grosser_Panda.JPG/800px-Grosser_Panda.JPG"]],[0,"canis","Wolf._bei_Eekholt.jpg","By Volker.G [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/3.0\">CC-BY-3.0</a>]",800,600,[0,[0,"Bête du Gévaudan","fr","B%C3%AAte_du_G%C3%A9vaudan"],[0,"Loup","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Wolf._bei_Eekholt.jpg/800px-Wolf._bei_Eekholt.jpg"]],[0,"vulpes","R%C3%B8d_r%C3%A6v_%28Vulpes_vulpes%29.jpg","I, <a target=\"_blank\" href=\"http://commons.wikimedia.org/wiki/User:Malene\">Malene</a> [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.5\">CC-BY-2.5</a>]",800,560,[0,[0,"Burns Inquiry","en","Burns_Inquiry"],[0,"Fox hunting","en","Fox_hunting"],[0,"Renard roux","fr","Renard_roux"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/R%C3%B8d_r%C3%A6v_%28Vulpes_vulpes%29.jpg/800px-R%C3%B8d_r%C3%A6v_%28Vulpes_vulpes%29.jpg"]],[0,"suricata","Suricata_suricatta18082009b.jpg","By Sylfred1977 [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,1198,[0,[0,"Suricate","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Suricata_suricatta18082009b.jpg/800px-Suricata_suricatta18082009b.jpg"]],[0,"parahyaena","Parahyaena_brunnea_3.jpg","By http://www.pistoleros.no (http://www.pistoleros.no) [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",300,221,[0,[0,"Hyène brune","fr","Hy%C3%A8ne_brune"],[0,"Parahyaena","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/0/04/Parahyaena_brunnea_3.jpg"]],[0,"neofelis","Neofelis_nebulosa.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",432,252,[0,[0,"Kameng Elephant Reserve","en","Kameng_Elephant_Reserve"],[0,"Neofelis","en",""],[0,"Clouded leopard","en","Clouded_leopard"],[0,"Neofelis","fr",""],[0,"Panthère nébuleuse","fr","Panth%C3%A8re_n%C3%A9buleuse"],[0,"Pardofelis","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/7/7d/Neofelis_nebulosa.jpg"]],[0,"panthera","Lion_waiting_in_Namibia.jpg","By yaaaay (Originally posted on Flickr at The King.) [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.0\">CC-BY-2.0</a>]",800,600,[0,[0,"Lion (color)","en","Lion_(color)"],[0,"Lion","en",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Lion_waiting_in_Namibia.jpg/800px-Lion_waiting_in_Namibia.jpg"]],[0,"felis","WhiteCat.jpg","By Icebooter at en.wikipedia Later versions were uploaded by JamesWeb, Pd THOR, Bean2020, Balls187, Persian Poet Gal at en.wikipedia. [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a>]",348,326,[0,[0,"Feline hip replacement","en","Feline_hip_replacement"],[0,"Kass","en",""],[0,"Cat","en",""],[0,"Carnivora","en",""],[0,"Chat","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/b/b2/WhiteCat.jpg"]],[0,"lynx","Linces10.jpg","By (c)\"Programa de Conservación Ex-situ del Lince Ibérico www.lynxexsitu.es\" [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.5\">CC-BY-2.5</a>]",294,420,[0,[0,"Genetic monitoring","en","Genetic_monitoring"],[0,"Lynx","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/f/f5/Linces10.jpg"]],[0,"acinonyx","TheCheethcat.jpg","By James Temple [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.0\">CC-BY-2.0</a>]",800,1200,[0,[0,"Cheetah","en",""],[0,"Mammal","en",""],[0,"Guépard","fr","Gu%C3%A9pard"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/09/TheCheethcat.jpg/800px-TheCheethcat.jpg"]],[0,"ceratotherium","Rhinoc%C3%A9ros_blanc_JHE.jpg","By Coralie [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,434,[0,[0,"Rhinocéros","fr","Rhinoc%C3%A9ros"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Rhinoc%C3%A9ros_blanc_JHE.jpg/800px-Rhinoc%C3%A9ros_blanc_JHE.jpg"]],[0,"equus_grevyi","Zebra_zoo-leipzig.jpg","By Thomas Lersch [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5\">CC-BY-SA-2.5</a>]",800,600,[0,[0,"Equus (genus)","en","Equus_(genus)"],[0,"Zèbre de Grévy","fr","Z%C3%A8bre_de_Gr%C3%A9vy"],[0,"Equidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Zebra_zoo-leipzig.jpg/800px-Zebra_zoo-leipzig.jpg"]],[0,"equus_asinus","Equus_asinus_Kadzid%C5%82owo_002.jpg","By Lilly M [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,516,[0,[0,"Asses' milk (Donkey's milk)","en","Asses%27_milk_(Donkey%27s_milk)"],[0,"Lait d'ânesse","fr","Lait_d%27%C3%A2nesse"],[0,"Equidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Equus_asinus_Kadzid%C5%82owo_002.jpg/800px-Equus_asinus_Kadzid%C5%82owo_002.jpg"]],[0,"equus_caballus","Pferde_im_Galopp.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5\">CC-BY-SA-2.5</a>]",800,371,[0,[0,"Equine coat color","en","Equine_coat_color"],[0,"Cheval","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Pferde_im_Galopp.jpg/800px-Pferde_im_Galopp.jpg"]],[0,"plecotus","Plecotus_auritus_01.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.0\">CC-BY-SA-2.0</a>]",800,600,[0,[0,"Mother Ludlam's Cave","en","Mother_Ludlam%27s_Cave"],[0,"Norfolk Roadside Nature Reserve","en","Norfolk_Roadside_Nature_Reserve"],[0,"Plecotus","en",""],[0,"Brown long-eared bat","en","Brown_long-eared_bat"],[0,"Chiroptera (classification phylogénétique)","fr","Chiroptera_(classification_phylog%C3%A9n%C3%A9tique)"],[0,"Plecotus auritus","fr","Plecotus_auritus"],[0,"Forêt de Soignes","fr","For%C3%AAt_de_Soignes"],[0,"Oreillard","fr",""],[0,"Vespertilionidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Plecotus_auritus_01.jpg/800px-Plecotus_auritus_01.jpg"]],[0,"rhinolophus","Grand_Rhinolophe.jpg","By Marie Jullion [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,600,[0,[0,"Greater Horseshoe Bat","en","Greater_Horseshoe_Bat"],[0,"Plateau d'Albion","fr","Plateau_d%27Albion"],[0,"Alpes dinariques","fr","Alpes_dinariques"],[0,"Rhinolophus ferrumequinum","fr","Rhinolophus_ferrumequinum"],[0,"Biospéologie","fr","Biosp%C3%A9ologie"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Grand_Rhinolophe.jpg/800px-Grand_Rhinolophe.jpg"]],[0,"talpa","Talpa_europaea_hg.jpg","By Hannes Grobe, Hgrobe 21:20, 4 July 2006 (UTC) [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5\">CC-BY-SA-2.5</a>]",800,571,[0,[0,"European Mole","en","European_Mole"],[0,"Taupe d'Europe","fr","Taupe_d%27Europe"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Talpa_europaea_hg.jpg/800px-Talpa_europaea_hg.jpg"]],[0,"erinaceus","Erinaceus_europaeus_LC0119.jpg","I, <a target=\"_blank\" href=\"http://commons.wikimedia.org/wiki/User:LC-de\">Jörg Hempel</a> [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.0/de/deed.en\">CC-BY-SA-2.0-de</a>]",800,599,[0,[0,"Erinaceus europaeus","fr","Erinaceus_europaeus"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/Erinaceus_europaeus_LC0119.jpg/800px-Erinaceus_europaeus_LC0119.jpg"]],[0,"sorex","Common_Shrew.jpg","By Sjonge at en.wikipedia [Public domain]",800,600,[0,[0,"Common Shrew","en","Common_Shrew"],[0,"Raasay","fr",""],[0,"Musaraigne","fr",""],[0,"Sorex araneus","fr","Sorex_araneus"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Common_Shrew.jpg/800px-Common_Shrew.jpg"]],[0,"homo","Infant_smile.jpg","By Mehregan Javanmard [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.5\">CC-BY-2.5</a>]",800,1237,[0,[0,"Homo sapiens","fr","Homo_sapiens"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Infant_smile.jpg/800px-Infant_smile.jpg"]],[0,"pan","Schimpanse_zoo-leipig.jpg","By Thomas Lersch [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.5\">CC-BY-2.5</a>]",800,600,[0,[0,"Chimpanzee","en",""],[0,"Common chimpanzee","en","Common_chimpanzee"],[0,"Gabon","fr",""],[0,"Chimpanzé","fr","Chimpanz%C3%A9"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Schimpanse_zoo-leipig.jpg/800px-Schimpanse_zoo-leipig.jpg"]],[0,"gorilla","Gorilla_gorilla_gorilla8.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,1067,[0,[0,"Gabon","fr",""],[0,"Gorille","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Gorilla_gorilla_gorilla8.jpg/800px-Gorilla_gorilla_gorilla8.jpg"]],[0,"pongo","Kutai_Orangutan_2008.jpg","By Neil WWW.NEILSRTW.BLOGSPOT.COM (Wild Orangutan) [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.0\">CC-BY-2.0</a>]",800,977,[0,[0,"Kutai National Park","en","Kutai_National_Park"],[0,"Orang-outan de Bornéo","fr","Orang-outan_de_Born%C3%A9o"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Kutai_Orangutan_2008.jpg/800px-Kutai_Orangutan_2008.jpg"]],[0,"macaca","JapaneseMacaque1_CincinnatiZoo.jpg","By Ltshears [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a>]",800,650,[0,[0,"Macaque japonais","fr","Macaque_japonais"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/JapaneseMacaque1_CincinnatiZoo.jpg/800px-JapaneseMacaque1_CincinnatiZoo.jpg"]],[0,"callitrix","Wei%C3%9Fb%C3%BCschelaffe_%28Callithrix_jacchus%29.jpg","<p>© Raimond Spekking / <a target=\"_blank\" href=\"http://creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a></p>",800,620,[0,[0,"Common marmoset","en","Common_marmoset"],[0,"Ouistiti","fr",""],[0,"Simiiformes","fr",""],[0,"Callithrix","fr",""],[0,"Callithrix jacchus","fr","Callithrix_jacchus"],[0,"Primates","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Wei%C3%9Fb%C3%BCschelaffe_%28Callithrix_jacchus%29.jpg/800px-Wei%C3%9Fb%C3%BCschelaffe_%28Callithrix_jacchus%29.jpg"]],[0,"ateles","Ateles_fusciceps_robustus_moving.JPG","By Patrick Müller [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,533,[0,[0,"Atèle à tête brune","fr","At%C3%A8le_%C3%A0_t%C3%AAte_brune"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Ateles_fusciceps_robustus_moving.JPG/800px-Ateles_fusciceps_robustus_moving.JPG"]],[0,"tarsius","Tarsier_Hugs_Mossy_Branch.jpg","By Kok Leng Yeo [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by/2.0\">CC-BY-2.0</a>]",800,1067,[0,[0,"Wildlife of the Philippines","en","Wildlife_of_the_Philippines"],[0,"Philippine tarsier","en","Philippine_tarsier"],[0,"Tarsiiformes","en",""],[0,"Primate","en",""],[0,"Philippines","fr",""],[0,"Tarsius","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Tarsier_Hugs_Mossy_Branch.jpg/800px-Tarsier_Hugs_Mossy_Branch.jpg"]],[0,"lemur","Knuthenborg_Safaripark_-_en_lemur.jpg","By Hubertus45 [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a>]",800,737,[0,[0,"Fourré épineux de Madagascar","fr","Fourr%C3%A9_%C3%A9pineux_de_Madagascar"],[0,"Lémur catta","fr","L%C3%A9mur_catta"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Knuthenborg_Safaripark_-_en_lemur.jpg/800px-Knuthenborg_Safaripark_-_en_lemur.jpg"]],[0,"platacanthomys","Malabar_spiny_dormouse.jpg","By Kalyanvarma [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a>]",800,527,[0,[0,"Malabar Spiny Dormouse","en","Malabar_Spiny_Dormouse"],[0,"Platacanthomyidae","en",""],[0,"Loir épineux","fr","Loir_%C3%A9pineux"],[0,"Platacanthomyinae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/6/61/Malabar_spiny_dormouse.jpg"]],[0,"synaptomys","Synaptomys_cooperi.jpg","By PaulT [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,611,[0,[0,"Synaptomys cooperi","fr","Synaptomys_cooperi"],[0,"Campagnol","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/8/81/Synaptomys_cooperi.jpg/800px-Synaptomys_cooperi.jpg"]],[0,"mesocricetus","Hamster_im_Gras.jpg","By Tux [Public domain or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.0/de/deed.en\">CC-BY-SA-2.0-de</a>]",800,600,[0,[0,"Hamster doré","fr","Hamster_dor%C3%A9"],[0,"Mesocricetus","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Hamster_im_Gras.jpg/800px-Hamster_im_Gras.jpg"]],[0,"mus","Mouse-19-Dec-2004.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,484,[0,[0,"Stockage des céréales","fr","Stockage_des_c%C3%A9r%C3%A9ales"],[0,"Souris","fr",""],[0,"Sibylline","fr",""],[0,"Mus (genre)","fr","Mus_(genre)"],[0,"Gris","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Mouse-19-Dec-2004.jpg/800px-Mouse-19-Dec-2004.jpg"]],[0,"castor","Beaver_pho34.jpg","By Per Harald Olsen (User made.) [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5-2.0-1.0\">CC-BY-SA-2.5-2.0-1.0</a>]",711,554,[0,[0,"Fauna of Scotland","en","Fauna_of_Scotland"],[0,"Dyke Marsh","en","Dyke_Marsh"],[0,"Waitoreke","en",""],[0,"Eurasian Beaver","en","Eurasian_Beaver"],[0,"Beaver","en",""],[0,"Monts d'Arrée","fr","Monts_d%27Arr%C3%A9e"],[0,"Faune de l'Écosse","fr","Faune_de_l%27%C3%89cosse"],[0,"Virenque","fr",""],[0,"Parc national de Fulufjället","fr","Parc_national_de_Fulufj%C3%A4llet"],[0,"Castor fiber","fr","Castor_fiber"],[0,"Saint-Rambert-en-Bugey","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/c/cc/Beaver_pho34.jpg"]],[0,"eliomys","L%C3%A9rot.jpg","By Jctramasure [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a>]",800,600,[0,[0,"Eliomys quercinus","fr","Eliomys_quercinus"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/08/L%C3%A9rot.jpg/800px-L%C3%A9rot.jpg"]],[0,"marmota","Marmotte_des_Pyr%C3%A9n%C3%A9es.jpg","By Sylvouille at fr.wikipedia [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/1.0\">CC-BY-SA-1.0</a>]",800,533,[0,[0,"Alpine marmot","en","Alpine_marmot"],[0,"Marmota marmota","fr","Marmota_marmota"],[0,"Marmotte","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Marmotte_des_Pyr%C3%A9n%C3%A9es.jpg/800px-Marmotte_des_Pyr%C3%A9n%C3%A9es.jpg"]],[0,"sciurus","Red_Squirrel_-_Lazienki.JPG","By Pawel Ryszawa [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5-2.0-1.0\">CC-BY-SA-2.5-2.0-1.0</a>]",800,639,[0,[0,"Écureuil roux","fr","%C3%89cureuil_roux"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/Red_Squirrel_-_Lazienki.JPG/800px-Red_Squirrel_-_Lazienki.JPG"]],[0,"hystrix","Westafrikanisches_Stachelschwein.jpg","By C-8 [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0-2.5-2.0-1.0</a>]",800,537,[0,[0,"Crested Porcupine","en","Crested_Porcupine"],[0,"Hystrix cristata","fr","Hystrix_cristata"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/3/37/Westafrikanisches_Stachelschwein.jpg/800px-Westafrikanisches_Stachelschwein.jpg"]],[0,"lepus","Li%C3%A8vre_en_%C3%A9t%C3%A9.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.artlibre.org/licence/lal/en\">FAL</a>]",753,1013,[0,[0,"Lièvres dans la Bible","fr","Li%C3%A8vres_dans_la_Bible"],[0,"Usagi","fr",""],[0,"Lièvre","fr","Li%C3%A8vre"]],[0,"http://upload.wikimedia.org/wikipedia/commons/4/42/Li%C3%A8vre_en_%C3%A9t%C3%A9.jpg"]],[0,"myrmecophaga","Myresluger.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5\">CC-BY-SA-2.5</a>]",350,229,[0,[0,"Pilosa","en",""],[0,"Río Plátano Biosphere Reserve","en","R%C3%ADo_Pl%C3%A1tano_Biosphere_Reserve"],[0,"Pantanal","fr",""],[0,"Fourmilier","fr",""],[0,"Tamanoir","fr",""],[0,"Myrmecophagidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/e/e1/Myresluger.jpg"]],[0,"bradypus","9092_-_Milano_-_Museo_storia_naturale_-_Diorama_-_Bradypus_trydactilus_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5/it/deed.en\">CC-BY-SA-2.5-it</a>]",800,531,[0,[0,"Sloth moth","en","Sloth_moth"],[0,"Paresseux à trois doigts","fr","Paresseux_%C3%A0_trois_doigts"],[0,"Province de Salta","fr","Province_de_Salta"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/9092_-_Milano_-_Museo_storia_naturale_-_Diorama_-_Bradypus_trydactilus_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg/800px-9092_-_Milano_-_Museo_storia_naturale_-_Diorama_-_Bradypus_trydactilus_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg"]],[0,"priodontes","Chubut-PeninsulaValdes-Armadillo-TatuCarreta-P2230729b.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,580,[0,[0,"Valdes Peninsula","en","Valdes_Peninsula"],[0,"Priodontes maximus","fr","Priodontes_maximus"],[0,"Dasypodinae","fr",""],[0,"Dasypodidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/Chubut-PeninsulaValdes-Armadillo-TatuCarreta-P2230729b.jpg/800px-Chubut-PeninsulaValdes-Armadillo-TatuCarreta-P2230729b.jpg"]],[0,"loxodonta","African_Bush_Elephants.jpg","By Gorgo (Photo taken by author) [Public domain]",800,600,[0,[0,"Seismic communication","en","Seismic_communication"],[0,"African Bush Elephant","en","African_Bush_Elephant"],[0,"Addo Elephant National Park","en","Addo_Elephant_National_Park"],[0,"Parc national des Éléphants d'Addo","fr","Parc_national_des_%C3%89l%C3%A9phants_d%27Addo"],[0,"Éléphant d'Afrique","fr","%C3%89l%C3%A9phant_d%27Afrique"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/African_Bush_Elephants.jpg/800px-African_Bush_Elephants.jpg"]],[0,"lamantins","Manatee_photo.jpg","By NASA [license on Wikimedia Commons]",800,571,[0,[0,"Manatee","en",""],[0,"Gabon","fr",""],[0,"Baie de Chetumal","fr","Baie_de_Chetumal"],[0,"Lamantin","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Manatee_photo.jpg/800px-Manatee_photo.jpg"]],[0,"macropus","Kangaroo_and_joey03.jpg","Author information on Wikimedia Commons [<a target=\"_blank\" href =\"http://www.gnu.org/licenses/old-licenses/fdl-1.2.html\">GFDL 1.2</a>]",800,1200,[0,[0,"Eden Park Kangaroo Cull","en","Eden_Park_Kangaroo_Cull"],[0,"Pouch (marsupial)","en","Pouch_(marsupial)"],[0,"Theria","en",""],[0,"Eastern Grey Kangaroo","en","Eastern_Grey_Kangaroo"],[0,"Marsupial","en",""],[0,"Kangaroo","en",""],[0,"Kangourou géant","fr","Kangourou_g%C3%A9ant"],[0,"Macropodiformes","fr",""],[0,"Marsupium","fr",""],[0,"Kangourou","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Kangaroo_and_joey03.jpg/800px-Kangaroo_and_joey03.jpg"]],[0,"koala","Koala_climbing_tree.jpg","By Diliff [<a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a>]",800,787,[0,[0,"Symbols of Queensland","en","Symbols_of_Queensland"],[0,"Outline of Australia","en","Outline_of_Australia"],[0,"Mammals of Australia","en","Mammals_of_Australia"],[0,"Australia","en",""],[0,"Phascolarctos","en",""],[0,"Vombatiformes","en",""],[0,"Phascolarctidae","en",""],[0,"Great Otway National Park","en","Great_Otway_National_Park"],[0,"Marsupial","en",""],[0,"Australidelphia","fr",""],[0,"Koala","fr",""],[0,"Orientation bibliographique en mammalogie","fr","Orientation_bibliographique_en_mammalogie"],[0,"Riverina","fr",""],[0,"Australie","fr",""],[0,"Marsupialia (classification phylogénétique)","fr","Marsupialia_(classification_phylog%C3%A9n%C3%A9tique)"],[0,"Mammalia (classification phylogénétique)","fr","Mammalia_(classification_phylog%C3%A9n%C3%A9tique)"],[0,"Guide phylogénétique illustré du monde animal","fr","Guide_phylog%C3%A9n%C3%A9tique_illustr%C3%A9_du_monde_animal"],[0,"Phascolarctos","fr",""],[0,"Phascolarctidae","fr",""]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Koala_climbing_tree.jpg/800px-Koala_climbing_tree.jpg"]],[0,"ornithorynque","Platypus.jpg","By Stefan Kraft [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a>]",800,538,[0,[0,"Monotreme","en",""],[0,"Symbols of New South Wales","en","Symbols_of_New_South_Wales"],[0,"Phineas and Ferb","en","Phineas_and_Ferb"],[0,"Sydney Aquarium","en","Sydney_Aquarium"],[0,"Aquatic mammal","en","Aquatic_mammal"],[0,"Waitoreke","en",""],[0,"Artificial induction of immunity","en","Artificial_induction_of_immunity"],[0,"Electroreception","en",""],[0,"Ornithorhynchidae","en",""],[0,"Platypus","en",""],[0,"Mammifère aquatique","fr","Mammif%C3%A8re_aquatique"],[0,"Faune de l'Australie","fr","Faune_de_l%27Australie"],[0,"Murray (fleuve)","fr","Murray_(fleuve)"],[0,"Monotremata","fr",""],[0,"Ornithorynque","fr",""],[0,"Mammifère","fr","Mammif%C3%A8re"]],[0,"http://upload.wikimedia.org/wikipedia/commons/f/f2/Platypus.jpg"]],[0,"echidne","Short-beaked_Echidna_Tasmania.jpg","I, <a target=\"_blank\" href=\"http://commons.wikimedia.org/wiki/User:KeresH\">KeresH</a> [<a target=\"_blank\" href =\"http://www.gnu.org/copyleft/fdl.html\">GFDL</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/3.0/\">CC-BY-SA-3.0</a> or <a target=\"_blank\" href =\"http://www.creativecommons.org/licenses/by-sa/2.5-2.0-1.0\">CC-BY-SA-2.5-2.0-1.0</a>]",800,523,[0,[0,"Échidné à nez court","fr","%C3%89chidn%C3%A9_%C3%A0_nez_court"]],[0,"http://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Short-beaked_Echidna_Tasmania.jpg/800px-Short-beaked_Echidna_Tasmania.jpg"]]]�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/hyperbolic/index.html����������������������������������������������������0000664�0000000�0000000�00000005223�13575077500�0021762�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Hyperbolic tree js_of_ocaml-3.5.2/examples/hyperbolic/index2.html000066400000000000000000000053111357507750000220420ustar00rootroot00000000000000 Hyperbolic tree js_of_ocaml-3.5.2/examples/hyperbolic/messages.json000066400000000000000000000004671357507750000224740ustar00rootroot00000000000000{ "fr": {"info": "Informations", "recenter": "Recentrer", "close": "Cliquez n'importe où pour retourner à l'arbre", "wikimediaCommons": "Voir la description de l'image sur Wikimedia Commons", "language": "En français", "noRef": "Aucune référence disponible.", "languages": "Langues", "ok": "OK" } } js_of_ocaml-3.5.2/examples/hyperbolic/svg_icons/000077500000000000000000000000001357507750000217555ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/hyperbolic/svg_icons/Commons-logo.svg000066400000000000000000000226601357507750000250550ustar00rootroot00000000000000 js_of_ocaml-3.5.2/examples/hyperbolic/svg_icons/Info_Simple_bw.svg000066400000000000000000000111371357507750000253750ustar00rootroot00000000000000 image/svg+xml js_of_ocaml-3.5.2/examples/hyperbolic/svg_icons/Wikipedia-logo-v2-fr.svg000066400000000000000000006711771357507750000263170ustar00rootroot00000000000000 image/svg+xml js_of_ocaml-3.5.2/examples/hyperbolic/svg_icons/favicon.svg000066400000000000000000001443621357507750000241350ustar00rootroot00000000000000 image/svg+xml js_of_ocaml-3.5.2/examples/hyperbolic/svg_icons/globe.svg000066400000000000000000000222261357507750000235720ustar00rootroot00000000000000 image/svg+xml js_of_ocaml-3.5.2/examples/hyperbolic/svg_icons/meeting-point-bis.svg000066400000000000000000000212431357507750000260320ustar00rootroot00000000000000 image/svg+xml js_of_ocaml-3.5.2/examples/hyperbolic/svg_icons/meeting-point.svg000066400000000000000000000075321357507750000252640ustar00rootroot00000000000000 image/svg+xml js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/000077500000000000000000000000001357507750000221315ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/acinonyx.jpg000066400000000000000000000104021357507750000244600ustar00rootroot00000000000000JFIFHHC  !"$"$CzQ"9!1"AQ#2aB$RSTq3br0 !1AQ"2Raq ? M5]L+H]4r1FU@ٓtvHmG}Ƹ;{J-\FivA-8m W=h xl$B6W$/u\>4ƽnLcF!סH>5ѥH)ι+ƛu:R'ťO--j"dCuY;+C 5 &2 ;>F43%qϺlE ߻VttTB. I#sgi8~,4Waxϵ%Y)sO 3 ,XT`I^}Ax֫J7m*: 0r28֝[iJ Ce6C^3,v}:eIƨtꮛmAURK!2Y6H} x:)Ǟc'7 04WnlmtyT*gh0 ǜcS 'PIOgW/$p"su(fހoߵ縗gu#XvUe eb7HŽpPVFdW̿z]%mGfL5ݧ$/0$B.Z!h{FJ;#*T˴ [z9rrqCEJ.)39#Ef;Wvлpc:z:P)cCF#qDL!;BTH_[KQ-"EOM#ԏZFqv Er 'UmLpI KУĊm ?Lh死VE`-L3'oFH*NTcȫp5\:7W#T +Q`^4׊pdhaRDwRQ0+\"靂5ʔX,qCt.oH6e! y$Z6j;DP\.Q%ET&7 3ëi<RڅE" )I#Hnb~ʟ1*LRG_ZǃοWZ)u*S^jk=CN㾪nlўizH*YJw`ݲ ;@9:gZU*iF A8:z]h)[̱a?MtsI*'7Vd}q=JOn iA` a2?6'-<J'ݯ՟쨿Z/ ,o-Ho5eM4MF \/S8.*KE[ 8Q-NK-yly:iV -2Z!F0v9'ggڳg#3v.sϟ?Q2 1>ID=/i X{FucFT0rx=5wX_QP,3+R)a@P$b~cLX=[e6X`jWӛ(XKf pX2p2tt(&Uy{=E\%/3p>@ @:=un$Xzydd`~koBX)f[+31r 1$}8 gT LѺ8$y2#Nw) \gD?ntnjj4ѻ +ύd*_m9SϷ& CG] 4$=Txp{i?M-BOU5'TTU=*g$p '>}E] U)?Hp?hB"Zb7*XO?Du*u$$_# 202?έZh!;-:%vAB;ysP:ΆUvC'{g>}D/qF"Mh j 4(z" t\"Eڌ)?ͫ4\js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/aepyceros.jpg000066400000000000000000000161021357507750000246250ustar00rootroot00000000000000JFIF XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$Cdd6!1"AQaq2#B'!1A"Qa2q ?@DIYJA8[lWQRWRr~1.CD1CӅvH  nիJtwto&IS]~hҺ[ TJ9^km 6Kр/b`#g'!-=TG$xl-#i ppY.-x*NKP\&GΝxWR*MOa/hi ;.#@ąu#ħe%c+T{lO ,Edm@,7$s!1e!@:{o`< Pæn-34:䈬}M7 ԓA2[ͼp:+ qw6 GڜQY[vXs*CpbgJd/!,*4EeNnpPY+MJRN* U,Pw6b\v8,'9+h8B.OSę /B=I1.G$v;9ߌl⩘JN}/ӍQpo]IVMB܀I`@k ɶ‘#)J_\PUIO&i&P]CTWgkTJD),$*|qqJZ[-V +,-bݪe 8EjΔ,X@M>K⬼J2'ȳZXIg oiw>wEE*>/U 7 qjy!rwD2^/5f1#+Cq&5V#TďcVcXרyMڜʳ! BJ\0oTX TzGdUvJ3#@JwlnQ8eCdB ~vl]2,Z[b6҃w`K¬+m3ѩ{VӜWN= %;<}1̨1K2R&H9$U s ?M.U5FczW[LDJl*( VyFڗ8_E,$^*@ibre7m'c9%_?<2PZc/N(4ك<ގʦtd %o͘3 ;QlR!." Te4x fMRn!X[\m68Wzjd(;mmh,Rv 87]ͅc3Yh)=^.fUL||xrfQN}MMUQGC>hҡ 3X[tVY4jrY?I2ήݽqфg*#j65+M5wXv&f&%$H6'/FR?NBPcǶ4fAS̆%>o#zKOulK'p?†6ԒJJq\X5y ɢT#N֍͈|iKgQSTѨ$keoQ }q[-=O vS'sUlwJ% m[\<(FWM5,lb os͉"L'Q\HguͶ/ q>uvz*ZNcHe5cW'm$r;m|U@%hOAȒRw6ґ~BI!U ů<*i܆PSAK  [xb2Rdre)?p$hpZ;<(`48MFvs,P0Rim%B6U!SF~h'#s謭5n0hI]MK4a@.{Z7àL5Ju6l(2*EOLRgQfQc»*22d;otN)n5 hc`wPp>q%2Z =@Ѡ6>dѬ-9B,+5D:\1ox$i\jJzL$)f"{_њ7Ni A7?+ec)y|61(=U+G Io8oX֨-]؂?n脗dHpo] *Ht> 1bչ,ws>%DX)5ʂ"|7P캂w{ۓ463?~WAcetYSTU^1uqMli6TKP2Bu*b *+-MH9[~؀| *Cc#1ұ\S% 1>( QZMQ' BXKi#R~FiUVAou#3F_@ .?.4AJc}!xy mQ99*7mK)w@UȌ5l:4*.;pM@n[uyz᫠tnh4oq!m&;_ S( $?6[ǹƗ&@dlXV!JɲA99=hNtD:eHt}qYćD* M5TDZn4T78|~Oib\l!YO}o,|tU)Zu4>|VU9j2\(/.c露;۩rG},xԛ@*VO1O GI%Rdnџ_xl~SQ*"D$sM89>3Fz鸜X7lO5s+gJUWR5$RE$pʑ/ԲuaѦk4OIG47`b݉gQc0h!dkTZm3 LLpGnJ+}*-Nרm@O,~u/#ycF/:X<5k ::yqQ9%jN =.wx竭*RBw](Ä.R_Eea5^._6; SIr-Ҏ#glCܨn8{B[`y!vs=K5I Dh)n$uۅfުBLJƒQUteic|I]#L&3HHUvd H$*rqaJǩQJ8/ӌqߐ^Mgdthi&XTx(խО"T4Q\Zx#0{=$~y]|P/;Bb "W$|]d'JfI|dc°F~8EF)&]Ү8"&)`)d-S:z X,r{`"By5Y+Cֳ"wmEF5؝ Rx$u4Ʋ!l|*C93ZEr|SH7 uU 0VHYHVtYEӒy^lp3$zUdI>GoA)0sQoG1 (ҚA$TҦtpȄwR :-Z[Jz[z?ktr` +MS Mr@]gєfE:J6GB#[cHj2ֽ%A:#Ap O+bʫOM[ >"s@rvqFFE8sG'D^eEjb,s`It"M 0,̉.v<}߆cjbiG<1O:v ~㮧$-=-n)ƹZ@BFVL٢O=BG) !8zzU+C}׮lVo+ΚzFeGuuoSG/8,pG·Gum**4F!U|gRkV;|(s4=O.-)F=}هEtʕ<2ˎ |Υi%[[AƬcqu7B$R֜w1P#gٯO"yۘHd3JV%;. ~=4G\UEeC珙:zEѽGm􌖴W wS8( r}A$jȹeo,T1Xdʮ7)#[i992ǭԆӚKt D J +r1ΥQPۢjȨazuaʨorxܛ*ljE!,4GQTi$ 5 2WrNN5Km3Ql@ZSmCQ|dWxቔ;Lg 鎼GE2DD22w_$(Z㦵.7FoQ<s*12D`6 uK^oWldx䌒㲟\ڪM{q= wZqUU'?=tbW.ýAMN5@QGn!%|Fd?$d4."H(v`9dhU.qiEFYoAO94*'^GCM~*iH<|Ƈ_fgR K/{BtQG]!IG{WRqW$OLP>Fъ+Ri\'ێ/I~s5 uqyD2s>H49:$UЬ7\HqNH6%* Zos=IFܰ1;OV7]Q-)#ԊZ+DQv2灓錃g S#M[VPZ2G O99 q46*}y5w L_(1d?(|p52Ĥ u;YsQ8q|:pv <B3]-aurMJ)䆊z-Q 2g*1Fu^7Wb[W~ eJYb9Th– 4 45v:WJr00 5AZ-Y2  =Yϧ;>[IM kumyWWUR[I#(ΰ'>jKJѰ9aƕ7ȇJsj)pgUI)_52m)'e~"-#`G>AFؖA/NQ /zB`tM/OtL~ T%k5`g_d*/?VR?_e$X:hzj z/t6o!6php֢def/ lfjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/alces.jpg000066400000000000000000000114741357507750000237310ustar00rootroot00000000000000JFIFddC  !"$"$CVs":!1"AQaq2#B3$Cbr'!1"AQa23R ?ՒzWPR=;?CP1u,Îw֭@JTv˰H ($zrqcI2%;Q 9@UHǿ;ڊ RAU'qX2 xO_o̔ð3&WCٔc}5GV])mv٩UNH缧m䃭(RV8QH6NoLw.F3]yˮdu\mZ9'/kF6+8}TQTRA .9ןMXjdܲM"Qx#"J," =٪gh22܇~uN}qƹUAUqya1@Pyr\BIU l@pBA URE,s=zf&Y>sjFlsZ!f4RQ{<~ϩp[[=lm̊*=/\޶JIMI??|~o=%KUvrl3 2Gaw;L$  *l0(*Qө+69(4hd#ԓ?.AmZEzfE.v"v>+;,Ka,T4 ݆}?Uyzg_pJt=SkUATj .a O`)LBA/JNS{#9'^Vؑ׺#,cO7tA5GQtlGW=I#׌:*(zHbm1s_p$EeA6{_]osEQC7ݞ}ZW!%J: ;rHc'ubS.6 |tL@;zcAhrf驳滣ic4Y vЈ:&(RN_Ӝ}t~XёdoqUܩ FK.;c4`P GAZ5݊k.}/ȱ. cߗ>ZbImO' =[_T.2,BVgk8I[/Pţ% j72,T2@9Ҥ3KE]C0\N_% ecw: ףx&ۀT H tkiruMֆM#wP*@|pw| f<+[])a$tĒOb{!tΆ|Ij)ks[:O`g.)Xa=d@#ۿ 䁃ƪ,ַQw>c2F`T`H̕`w}莮S\ۍ>іhgQy54ձprr`s~54;.P40RS4 m>f퓀U\7g|^&#ǛH=ƮQMO#*XD'\ g>ڧ p,T0EIwY#\ZN \1X͌F)'ek*d[R\g}iMd{QUMᖒN3OmnF|D\ojN 3;c>HP<FTAZUG<αzFvUnげ {Oei}Biu_ۂA#SuWH@$$k)(@o2qntnkЭzx㪑ncsq=WuY;me}uTt1F y9p1O&KNS"8AKUXzXA3?v8HJRFʊ XTi@Bm r;[{.2ԍ/d1YG|`ꕶ:KU EBx}]NUjO0(1>dǮlRKLb(x7>xSjy5OqR5;dqC>}Mh$аb6Ʀ/SR Mk7zx"vۃG7JMy zn$:zޡ6U9.{^}s<|/te7OQ[0J*Hvl3{AhX2⏏c:;q-.M.s>6I9Ɛ>$CTO4݆*Gv'Fu=S\_49dbch6w8QzZ?_]MF <]Rf@!?Ν&,!KoOUN]?#;0Q{{kP(dC821$o}=~u֪A"$٘OaYYGQS)ۊTϮ;8`>')թ&Zk4~Dl0Px$s=W)n t֡,F#h yhBU$42(1NjoFI6v7EL =i46 xjA}3$,,pL;Rڨ!'lX !}}TM-DDRIT5EHFpŜm8 RIZ=i%#UK"b2H-#qtT=AW2X%XxI>x*d`RH ξnWIdL7G p#ny=wAG ,&<#}?145tURRi*#ܣlHJ'9oOS(l6zH/.21H'ߎ?~ZjӏOJ@T}5W9"t`ʱ 2\8S{x?s4;&p**ŭrVfOa89:_lzkL("d@)%;GԭZRXɅJ'i_]q =SHdhgO4ֻ|Ò1H3\2NV/s "_(Y6qǯƋ3YzV`$rTBP l{ /vodWUT;C Kx9X9#X[Ec8eTUupFcRC9 )G9Km˨aXe57`e#Oo} ot Hʠ*s?7##2e-uEonlV$>GV^SEdi4RWzm$1䞓|y`+1_}=LI-.)F8=JYxӥEGj竌zQ򹁥O )K6޾9' ^U19?Q΋)X̦Q`;پZX@X3G綫s#'tEOQoydQK.>֍IW$IQ|r!JH)Hd!?N]/yK'ȆQ03)(>^VxHܪHggIe1>HAYҕta֒:@TG?K' V"cƲ&} ]WSqR `ROb{MA$Pw!y,2CaCqƳjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/arctocephalus.jpg000066400000000000000000000054761357507750000255040ustar00rootroot00000000000000JFIF,,C  !"$"$Cdd8!1AQa"q#2Brb$R"!12"AaQq ?̦H>WA~SlQ e1j8  J6! 2;QrdKiĆ >|SDbt>¯WMo]=%@ۆ|C2H RF#MyR @,jiUNI'aӱ'cQ M8դ]@ViDKHը_)VFRMHѪu"ѐpG1Vņyl*S7~d%Q]D˔ #Vadz7R`,#`g}Gq]<9SƎ\oKfsqi[ d;vc) ,^#VmpnQaG5j@)ȶc 0>zeNEHT۳V-ro ?gT."6[П'?oν~vϡum%ʷlU>|믖gè5 UDx =G9v5r9mH#"c$+GcϘ=G@$ UeH 0ʜ HdfmRt89ӣҗbWN f9VNZs;3B J"h[j&35䍳wlN}^ggG֬⻅gERx#=Xc]ᾦ.ee1W9;x-ŊɶIc [_PrXvN@>bВՋG,vX?npk&!w F6 Hf'Ϛ,C<֗:PľN{וٶ^ tvcZg/Yr涭/O^uuφAD#WҖ_\$X~\V,yx|n?X䬶ȱ(حc$d r~PGp$mHUp@<ڲXF\S>$O0CbzZ[v-W#wp|/.vOtmRa`^ՇG3C}rq5|dOgnf#O>S WXl4Sj_{ @`خeYr#%"2?)"Om.]cO b5WrhAy?l|>0ZmӪAmK#8*ϟҋLޚ׺4ԩ1$!3Vrzyx*Lӥ$K7 y(g-TwXjțqyyiR+X[["6O8$l$˓;xkZ K8w Wdn%8yh8#e3ǡ?XtE/jIA' /cg.2,rz<[`d{V6ӑQ͚͂麈HH zޟSX~1[[Fo;KVёk z[6k2nqV%Hi4PK'"2?jSƷ^f.{63cҌu 6N 0Vy(ye[X^{էJt6&wt lg9h[tYd#b^#{,U۰9^XV7tzc,l.e80ko3~UrH>~^T`33H`=nN8-h?za 8wIE`.t[/!XT}ZQtWDziuʶLG>!ca MJmlRay cR( FA'A$r"C1SJ=ċ"#*Ϙtq}NS`lL,8f+ub\,qHdS01ObfQp<#&fcUCc Ԇv R vRҤ҂k& <`TH O@Ab9+81#XYZ Zs&XYZ (W3XYZ Rsf32 B&lcurv3mluc enUS$esES,LdaDK4deDE,fiFI(frFU<itIT,rnlNL$noNO xptBR(JsvSE*jaJPkoKR2zhTW2zhCNKameran RGB-profiiliRGB-profil fr Kamera000 RGB 000000exOMvj_ RGB r_icϏPerfil RGB para CmaraRGB-kameraprofilRGB-Profil fr Kamerasvg: RGB cϏeNRGB-beskrivelse til KameraRGB-profiel CameratT| RGB \ |Perfil RGB de CmeraProfilo RGB FotocameraCamera RGB ProfileProfil RVB de l appareil-phototextCopyright 2003 Apple Computer Inc., all rights reserved.descCamera RGB ProfileCamera RGB ProfileC  !"$"$CQz! G !1AQq"2a34Rr#Bbs56ST$CDt+!1A2Qaq3"4B ?4cRSײpr4W d&z#DQl|@Evrjא,4)bǙ.2V 8R| <Xƴ!3aI!˻)=`dUoKtf6ԡz tP4"}O^%k )i9|}=<4d+u=fcj%ÇRlAmGJ@!@ѐA? ZSR#-Q ;߰P5vgN [)<(dI"u]e±d$0SIUr&#q馏(fߩ|OP镁RSg5 Pw?Jpe$4x$H\v1ΪfNU'ni|T;}8`=ߤ0?Ox4nޤJ&Lg#NhQ؃\!)I^PoHw~7DS kWfn֎GT>~Z2$U0ZqWǺ*tl#5,9:f>USʩ2Sp?(fnlQ,˲wqF{U&8ߕZ\ǬW&mduWƙ)w=WFFuN&ʬtP1:J%wKywx#$lEe5i\; Ȯ4e8SeYv3V63zZR!:%co|*}ZdR 8i=. Waĝa$Jp*-@eHR5^ZSq[mčYûn\ϑt'o{3Y<Pۓ3v>\a!('ծ-&j%ifla)?3+tcӂzn֥{Xk֗3Ea4vo/l8_,hNT($A1QVӌSiJI’zנ0H[neY߾RY)LWuCU21!PCr(3g˵Cy)D=v;+~Sh*-J='SٝC+?-HM}] S4R6/wsM'Mgy ((CQ a?B O۔X'`sз(]m(a;pEjtkTJ_մʇ=2Yڟ[h\PBJ V7ڹ)[.ͧ-<,;)9 #xOӷr\R9-1+<8*'u&4nֻKp}7$Mᕱs˹-;C@UKtf>(17Az뻢KJps$\;;TvƊ6[֢bh8m]{RA®jUC׊MxoAKtRy}T8Σ+QLy Q)w1?' p ʱR gJ+8P_ zvf숊),)&W*J\.Z#-o0 Pڭ^rt+hԧeբSlupeEmWIAP$˭j8O3ZcR9r{)C\ys4GR7f#m5x{7p@Z;GP{C )3lVnip_F?Xx _# |:.K7{y)Ilg:FqޟmuMTOc!^[쑋\9 eDJ޻˨Lx`ʕU-jcG3[ 42xwן42=p@I+,]"CAkyڱ7)F^!Snc?,Ҷ^v{bi ʎ̆wb.VynY7RB[ -DDgqs\= rbZefy~ɫ =0#.sg+p|HJNJKDt 2o2rʽ %>MŚPey,Iz,@E{OqI6u.@ P#9*JuNx9H8"N]Al@8Q3+b]-5 BB?t{yN%[e<Ψ {j-8I>S"C02xZem9zBR2;M[4b{mb%~OriܶK澸N3G'dzmmV,*}2JRПq[ȗ>sYt6VQ;[lhxvǁ Q6 )#۞yW GtȐkW% `jLE[4SrI6.-C9ŧN%JYH*H>K''MXR_^g?M|Poycj[:^X@%uЯQ8l5u>d[Z~P{ Gz'ҏINih+鏨B*pK/>~Sk˱c_Rk zjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/balaenoptera.jpg000066400000000000000000000066241357507750000253000ustar00rootroot00000000000000JFIFHHC  !"$"$CK9!1AQa"q2#Bbrs&!1AQ"2aq ?߂3p+0 iX)4H@NZ-N` ff@!ah >AJ[nŸAb,hf&34i TH4,j`h`*,(Dd3K^T(?,T.}h & <8ai#?S;S)$)z˧]HVQ*dlWܦKJ*MG4tŎ:tgRJ87N0%,PO`;*Ib#[;!Gv`-@P!NaR(;Ϗ>i Mw6y `:rTCoraI:`C)i,rDd;ujgcY%p;0&HQtnVeoprs\MㅽE|KmG:-eQun6 NX>ٺG>_G[f( @IנSZ+K@/pJdž34HullhajtM-E7S('Jf c|v): r3ۇ"TRlS{T/ϋf_B^2Tza^4i]60d3*%;fDd 󖑒zƱo{y(_3@6+zoZrBSGҋݕG47HRwm;4K9$`;Ys{b8cQGm+zӊ"f9>TAZ|E`3!伇j19?'$A3Waɸ+#8sߎ+.OGT!;4l$_Z!$Q~߫d桤XJu戚Hu[6q${[+ޓJ4ߣR]d#$9?s+t+kRl3\JQ@N;Srtڊu›Kk׮~:)ێvU&LPXHMkTH76:^ll2~޿I$:#omEA84(1P˺0.# htgRX@Lewvzm_uڱ+5 aG\Òv< uKT֭׸2Ox|_ 0p8 ˒fb}+;ج"y畂h2I4%n볢~tT4}Z148wR;+>?ǚ|Y&ãE%ֺNs՚8UpȎ0ۑ69 edn=p4Th_Κ"D%Hрyj4?NZW%fb^$"1{jw{$Pq94 .(Hm"9.OCt4 MrΠ+*a&o`jztj"`f@$IK@uekk3j+ 6F$pG$7$զKDw'LM.3\*CEl qc͝7½όE"Y/Z\s9xl>r G1w7W^$>LJřj*EmEߚ(76z /3.J„~PQVlHZռ Er zgȟOJ.̤BL%) ydS2f'/GovNGf?-m:3&P`Qyۑjtai=*u#)\dqCKGiy˛K VqiO^5] 6`~R0sS_%q.+ȋ˒20vHŒcR&ZWD=8<8quRb4Y K'["6m̒D?8"bcyH^e-힋,@FX W|:HG5/Z7 іOlctu(h"#yc!ӆXWȤ, w~sVj%O_6k[@ HZO?%Nit+:p/'|bUErO&ZLg.)+SND!ǡwd6Klv|LyU]#G~Qn,^%= )SZMHb:%XzI$هq xvQؿ``~)5{9BZ5ēg@~E UIlQn-amhtO vjfbkoqBn!sVKKҊ4[ %!yi+d3>=6$*%خyto{KiXQ3(y`VooNr*MhB%#N&-Ǔm9v2zgӚEҭI{_ϑ$lm-eUg d`{VOWHNO`6) @*0@")Rhu+D`CEgݟ/GxH=im.RrM#mbҹ8)[T +"T{5-G[Y[\5Ӱ{m?э]|O4x r@8$V)dN[[^1\A$X6jjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/bison.jpg000066400000000000000000000071151357507750000237510ustar00rootroot00000000000000JFIF,,C  !"$"$CO}!;!1AQ"a2qB#3bRr$!1A"Q2R ?8mQǴ"3 {ah=Z>:>i[O1 jUYqǖP}aX`Y8>LOvR=6II顛o0W[ŅXSB\F_$LUWĹ)*K$mzŲԀ =ĀEK,I<[i/ac߾9ʆy`ɗ 4G8nu34S^8i$r%,Kzٿ,kIER1I66rI,%}DӍ1€T \On^+IPKRT7N +RK "8)Z:lėN'/fdtoAIefDAd-]ECW%]%-#,7?iReO-JAL7$d ݳle& F:TW#Ip,kZlUݏS}퍯+m'r4evmT˞,7QWQB+sf.Ce. eR<)G$}:䎤c ;HlXl6IKg w 2֌'pBKߦ5I2y%i`B>smi㒥Ȼs[WgS[7N !@&ڭKBYgڊLޛSKN4kHq PyOqy29lzq>́ߖp7|V⨑[6O/9_/fd3G[-7!b.~JW bQyw lyUe1, 6KӉ#RUFWQ~&~S@$`$/|fQb,4E6{Kafl@~x> 9hҨCcǿ cKks9hi$}U3.T\e Jͪuykpe[ncxf\X+bjyM[mhh/v6=*+7s5QVfD Ӟ+sTY)ho%1#a˯|G%2(Y;cڐ.[cpr/p<˞#5'a EJ}VyK퀙df2Bc.[LaD: P,P e K@Uc #]}%Xʷmp;tCQ8rDO"C9S-2wEs7gu ͔QiΙ$ oO 5ZyLUDui >;F\,5^ `nJ932lSA^]qx.ɌY]1ͨ#]A=v0qRxWO9a'JRՐ!Pw´$~5FIgqhqG$g T3e8lGdKpP%r4>(rW|J6xi3=j*eH5_Q"o!9B{]Ju}ѩFͷ=0KHeYiPtNcp > MITlX}_Ý4O$\3-|5KƱW=25B/r/Em[٨r榥SU9XYwg8ʔe6٬qƻlՃ͔d:㴚&!!}[~9kF:|}+|GWvP>spM"pPqREQňck1'ds]RS;ʂ$P;F4tֹ!ؖhvU O~IGW b}W8npTO]?zQ!GBXM6\sLj<+Ǩl:bK&\"UkBg:t(YP;}N,sѯ~4+ȩd)i`HX_%-F<"Wassbf$oF㔲eDjC`Te yZH4EXҍQj,mp lO r߆9h`S 8>!b&̔*Emܷa-La4iHLaIy'ͳ)V4MW;~xGv7P xyEemlWNi 3ߩ놐Qe\=HCjO;>&xo. 57ʯVzxrKF,4۟L/|Cڿ)VJ/m;2өkb迈?+㑺O-<eg %ڇ>#SL/'Mk1KO=k]Iy# -$ayHWP.OMEԈ㌂Cw FU禱kjՍ1'8{/[JiP~3i$@mؽveȠBܵ17˷A-9^pOd5YO?Ob )+BAsΖ6i"$,}k0y)(ەpGKYc$&eaЃ8pCY,/- J }1%zc܏L&Ԑr=0р9$[@OR -z`[z>ݧC$ Cⳬp tLs>| o@^hYI>q3ˊ0+(R4\+%,#{.I`vJxFaU\|КVΊh]V;ǧ^3 qq6dc٣oDo[/,r̖$r9қl6h`;l0'HAwoebc$pjzh找Wp' $+3VRWb\/$cц-G%CC]T6buf)a2E11//m=H_LE=M-MD4ą2FH뱵1Ϟl{Ƿ/G<>X+o\9=g^_aG4?t$FOWOQӭa:T%J̎'oZ~13ufƎR߸uk$Ų<1fyQIֿϽeԃ4*)tJ \:+LY/جnn1y~S(hliH:$1;XF lY] ̵ Pwo۷lOPVU@!nڪ)S%c{-{#8\:њfQ?Y5[܇6RIR*dvQ1hNr=<բB5;(kƎ,IM"ťD@ҧamX%j2oSB)anv'@.`zkn[@3u&Rdm| 1j/5/NӁ*)6(fx촱#Xm4:\|1P*$}۾"Gib-QUg3ĒSÞCQ𕑵ivckr\ưf\E>:6,</Gp7H9;#M&`X*I ލ EU\UfuyU, 1:Tͺkb?)Dm`b }_[(31?BO`~4os+oyYQ@ ز{cбJhe=GL7N\$E\Khl^\m v-gOM}?.*Ԛjzwu@mQfDyThD% ad|l`UY'%e3!VIUJr%2NuF.8/&z .}a릠U*f7rAv;bk"6pZف$6{pIYCIJW;()%ZхHKt^+$.z|m E;F4*y[RNNJ$5`Tϲ&\)/ԏ,`bEܣ$oiV= 15 j7; "%g1:> ,7{'# ߘU}ֶ1n ps´1Y!aʱZ~kEp۩4XBuF9**i#"`[ZN@>(#85YTS@ nx#!UM~aV?3 2`+ܥ`w(]]eGO: I`̺@> *X`[3V%L}'A.%WUəYUM):H3"ߢat| <դ&ivhfv7;NҚ‘eśRS$JA ?ed9^?xI(]Ar^߻uum{oVWZ3,B匠e&PgtFPkbm{ka,x&=N<ٯ$%>ECm ,cO6'8D$PDj ,}|ci#5Q։t5,?*ʣ" Y0wn/x+6,I\?K[٬QOI4  6d/h>ʣu":b{!@G~`㎢ QMSYB O WpOqp:/'lu."W,UÒ׹%!<ژLJJiH8ĢG~f|5 *ʀ,slf!1)H[wم>yU)BTBsf7]ZlM𭘇jJ6hxO'z:jL%Mnw[ 9Ev}(8"$-j=1rTecW|)pSj-QU(H[mn *_,.{ن%D(EB;# {.b|KEP |>8(Y?َɗI+?_su_G@WU.G! r.Xj/_ӟDvݔ߱'M?y)~Ҭ5e? -wϒ?v)\oAʃ]P1 ?ls+Wjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/bradypus.jpg000066400000000000000000000216001357507750000244630ustar00rootroot00000000000000JFIFHH XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CQzE !1A"Qa2q#345Brs6Rt$7b1!1A"Q2a3Bqr$ ? Ҭ'ƺc뷈ulBgڨ;z/g,py;k#SH̶SJ:XXUβ=Ny#q#߾cm]<.8Oe$b*jzj#(]\,o.ܧwo5h x9PKf\!22Sqsn$uǎH'&26huG4-,)Qtv`xopX4T5(^TWr4\3.\r :l+I^\3HL&HsAaW} ] 9ZZEh.7nc6+1[X݆hF~EdPh] U"5Sii%춹^/0DaنҧĻy |OQH^bxu7-0Uv05iꥁğDΫWu–jWFDX۽Lb-j@#U X7pgPYvW7HDv@-h{ʆ?y:#-X|p'2l8Ou F,|A j{'@9?Q bcKZߘW J+wV_wS"S# QE2zx|15خf,kEj1[qF]%3eY#A \5 83軦Z;CGD2!5eL _d4 ̸zYXHRm-|WkKJWn /%ZG$ʝC~X)^i^I#FnGE$f=3ؓ{4\7FJ 'e V. F3I$"j~lyo뿃H$O",go# gXeQ\1b~a]UljUu.gnI$Ĺ}\jgrYvУeP4~B15ң!9-Ni O3TK1%{[m1+ǿ4twsRWTUP~ ?Ÿ8ݞ +Eԏqkk^Dմ2sQgPnU?uu6|̏Pjj9\~G* )bڴ ๾ZkZ~\s={yoy%A#KQY\+JŨ$k,gEoSUNsDfRFR:}0X2jܞzFy5Kjwt!cl.qWcs"ܺ.̌bJ[ .pr/e6ҰIzeRzG-NfcL.p5;u^R6h*%s 1\#]jHu2,vg冯{4.l6uyZЩ>.ۤye5 ,A(R}J,%LO1jHZ,F[{ō¿Kq5)F̥sHrx2mj)aLi<" zb$>Ѷ\Jn8()榜L!%Ƒ/{\m{>GkHZ.AIYRE/"SOͬbqKUC02kčV>W IθBRKfxʼn2N "$fnIq+y|7̒OU4b(d;,J3n+iZ)Q 꺑0VfeU5b@JHH6qؾavj\S,h, x@_,4j i=w6?(8K)M2FH|L-ZۥQ^V)@U9J3%<1I@OT\\V Wzw45, 1EV?Gc e3r*4VA!Nq5vH~9]Tx.Ckd)b_9g?ڏCVTS)^Zo=VsoYQAX)ذ;~0?nwݛuV qr!wjog-FnSdb$:'YT:PIy. 1Rϸ.* ,[`@]J3q unmfΓ(b!T 78ᴀfe=r-1V*߶.JG>0P؉ i#KU!G_Iu߮.$u 4y*TH*X穥m֚zгؑy^ uf`N20cMg. vb ~̢FΧ"-XeQ=KFfk7?[-!/6+13 jHC5M=6-Ck3In!jID*+Rt ϔf5Y/̔+J$koo04$Qe3k:i xd-w4kmÞlYr{ܢ k0/r:iÞ*8G9QdiUR8h;j [l{ s3s*so9UMô*ȯkw TQ:a3- ϥ1/1]c-40E8&|P?L`f6b@.s[&g %i6.җYH&} ;O+TE_,t%%rX߷Ml\)2@||c];!(uA`ö,9ψ1gGĬ!N9PC m狕-e2 &KTO~agu5Ȣ1̩eAP[OAǓz2-JʼnZBdK bAa}N*G+G!gCCĒ"}r $H!ub mcn1&1<t@>C/kN*WF~%2׈G?!`9OaDSc|?yk>h(Djs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/callitrix.jpg000066400000000000000000000103421357507750000246260ustar00rootroot00000000000000JFIFHHC  !"$"$CXq"B!1A"Qa2qBRT#3V$CUb)!1Q"ARa2 ?Ed0ԣ4,T} a*\x2.:ZaEmHbKv+6} (!N$lHJARTcGx>| 2uR%,H&ҝmL4ߒM. @%M>'R5^#翦 ?;$8wZwR\('nGֹ|ģ^[ڒn>]*;0ޜoT"Ǵ]#? 2wJ.Dw.,pSK/VZu J Y-ee mF\3*PbX!DφoJɦtA^Wf܌ak7YI="7y_ܺP,:[q}C}ɔLGyh5IҍJR6|`ٞD%ʔhDjJ5rcpmI~Ne)DtNBZv6'ː7v+Ƙu92J`/kccqѦVr1%c\Xn6Sk=4l(6vO8ǥfwJi6o@@C>{__B4Ԍ@Q1^S㾫 ;|1mHmM/֫[k$s0e-ŚS><$r.I#,2܈/VĨA;_2CqU Ɋ[! ΣkKmle4c%@v\<^ EcrT $"]EHM$kc/:`PUq66J y.7-% U%AWoߌֲd֑؃?,XyPLSs$ 0o+l)u"e- ioI m]clK#AJqucK,EGnn|`F2L$ oV ח"%^'q͉`{UJ=5PtLlZ}Ԣߎ1Oe*UǤRˉn ޷6Z}ȥȷ"jGud& WNN7{rCNR}K_Aô!m3b(9nNHn/0)=U7 R +_NA\y 9,F~ cC/qJ~w>AO]$ q6Bx>EZ 8!>a`^PmTSJa #T\թVv) lG-{܆TIUۣTt 6֥VGpYt yUYIZ`(ں*lmbV|.bz&~8׹Rw3Q^b<0m^+Taqx#Čl\u8bZHJZ=,k.hUI7X>5=OP nJĈ5FR:?^X9^ ?V?免>X}Uyz(Ʋ}Vx!DVOZݢFejNI<(_녅v8ϙ#!eȔy:IuaKcP)᧳BbeYN6Rc)D~V煅,I7ffa&q*(J-8! +yیUiHzEMil꿮#@k/VbQ68ɖĤf2}؛fިj/H@)յyc@cю GBm!7Lu d$yS9"EJR_ᅅȡxqDZ0 (h=8XX5ἆZp=a=>x"uO#K:Mw,,,dc_XXXXolgjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/camel.jpg000066400000000000000000000201451357507750000237160ustar00rootroot00000000000000JFIFHH XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CnZ:!1A"Qa#2qB3RUb3!1Q"Aa2#Rq$3 ?ic׷ymz;ۥ$7|F m\0u9KYP؃.@ Z>j6qH Y}4j؀\ aU[t06i<"T\坺Cu3P [J;Oxq%`,UI$ T&X)'{J؋`/z+|e:Zp#eM rDt#5|K"cUZԠ+YAH]ؒNTSbF ŷH"n'̜sޛ(j: 4FI`#źD.yߪf 32˛fqx~)K%i\?wMxL|J,-ƃm@w\x fEfR0>&a@ +qUܾ ,eEᚖލ)kO0h '&Ͳ,e*l F\tv c`hF ֹD*wu ^z>ضM~m,V#,XZ`;# l;ilW)9Y B #猇0ȼeKA<Ab Z\yQ#v&枰s>*:(j~\zt'Jp&`%a &۵qUqF~=>~P ;Fq.)b3*q8Pz[t2XQ}fN)O]k:F;X jZޗyR =eMDpD Jaf}c/m BheoOSseyUD V&;ㆶý8~!Zj8<-c}'%MyTX)@o Hup<op.?|&͓ be&6c|->! Oyt$2ȣ62!Oq645n GdkA6WoFf"'c֮Px3>r9zM"m! v$so)LDz?񗼏8<9d1"5lAٯ[m;wǙ[ۼ*Tͥ&g/Q9$݀#}-SkLH,QBGװ&'l8 TM,oSTTGM ,;* =cmISU?H9cZ⺼Z ܿ$ oS8$4 #NE~ 2]#Yem pdrZˤ:Af&SZoˆN ۹>eUDKY}K]Lʤٔy.m%ҥu SU}2FiUko,6MS0k^10%V]Z-m[,5$?)ʢ{^Ÿ ;5:AY<1LenE6b^[91{UWUZdV [AcutYCN\Dӂ6Fƕ;}Els>M&X^OWԗ~в vcy)߁{':<ƺ\&e Bu؄n]8RIcf֖^rv%ϬH迳UYRQ'JE(|TڤhuAp<|*2*C y?lWvA-eˤ7XQօ 9 TF?5Kt-7|#*cm?5|iޞɂjmEO +HSe:jJh괓m))HkpurgUdMO#ٚ0Dg6n3[dMvgHY mbFfkN؋B:L63HÿYbmD~x(6z|(= i!{?o7$eHI%a*J:iB.Oq'np ߴҙ9^*xE{&wm: &JfvZ!ةǦ>*\~EYBf:MNDKrS7a'̙sM5!)%f 0hkܑp1F%MnOTҴY3uGĎ2E1 rɨC 1N+{[^PKTi^LOX l@絰gqܙ h cMfIԥ Nk{ ]Z4SBӑO<ƌN2 ڏ qam&STA1HPPv@wϔE.Z-=!jP1dfcq{xfs֥q eTx6":33l mmXEK/rKRG<͐Co[}[ ms;O#mzLY!.\X<틝XYҒC5gS*X6j$V稔gW/$+<0%I{o=:  3}DZ8Ue"cMFmsFK9^sJR4,a:uC`e; {̬ܘP}%]J5w?2kuĔԴZSYظ5B`cz$ 鉶0~{ AEyhUTFZe, ׿q睡es"0#zQ<ֱ; 6țqHr|5As$AQ#]L`,sGnI%_ x2=,yt+H} -lNn8$v7)sEh &ǽSP;[0ye(@9\öLqzKqf? J!KO~SA ѓc~=l/+_*t8V_'Fjttr{Z:o3}Dx2vxr )T]Bi)cm[b}bW]M84c?xU_M-<0N0@A,Y]CrZUc4H-mlmԮVAKO;襧2׎!C,X4r GSub>]6mi] C~rᷩTSy/~cx[m$Id1TmÞ S3#EKq[MVW'yj*dYW#=IL1GRPeRh>CaNA/?Lɒɉ0*iƶ5EM,eH~:xI|״tP{ F'k *s ^#Pk:aKA[F4PV"cd' A3'tRP"CP,-nƌ#% DZ8˧X?\Gmumӣ9)-2fIɓtc2T~:.EYpIW 8ip@020;:Ĝ.vu' =F?x v==zmV$MUavd1>gVn-5 )`<ŗ=œrL0Teem Hx#멓^cK.As21W6!FJM04`1gVq}Q3Ir2TcggSS)G^%],A ySJA dGWKH$bvÅiz4ŷSä]šWTbo 8El%-QHX~xL-]= D_WdsN=ӔpGtHJS:u7dǻ9B@]jK[ OpyH:fԭ,bU '9GCbyRK&GP| & 2 '<1u.NuPlWRnN ?]ZǴ_“+|2)Uwzc{ETԙ:GuQH؝~UJtL9J28%}6P>#`OMS΄|hpYA!|5bhcOJmqv<7]zE&CiO$V&ZRUN'>ݭ5R$[ʱax=OmYP]ꆟmoFRd3#KT83zoUfwMfk y <) ;Wћ5zPB Ol Ѹ3,TwUy8QG˖( Z,`2@v}?_~:gEb R|"wdUtG8 D1@V% Ʀxj4# <_nK_:2>>bq0T J `LCKp)*I3рP{~Z552Œ4DF\cq=q=˧^beΟ"dQD)D,.[,y lDaM;w=团.]*eBD'#gY#kGvSY埍O= |>'JTKBEOf[)7@`^9uB1zu\8՟fnzy˵hqi0zw3YC5%KgR¡z]`H:q徢MLy%IиQBO)6ɢVic? Y̬:IUS`o&dJv1|B>ᐂ{vs@S\dd4=1U\2+\qLxMV?*T&Wt#(qm=WP'hY-muUhK \24wPS2>L8 =<{mO.-NpIMYC8@rp~bodn@Fpv; 4g|(z*렧T"*eln;c@UUm , Xa\9-İ\ niP>$HS8k,yqW 7F{OWPUp/2ˎx`r'pxm|DIV[[<) ᦍN6#*Dž^8RoIdHhX$v?k"Οs=d2K$*U$GW?Mf/f*(n;^1KLY#$>qg魂T7b\)9#.\"e1ϾF=~T$_jcKZ071TV cx#Vo9?9{De¢:Tp˵sx[G d$c>ޘ^5YKpN3xΔ^7[}rki-ur2* Hi<Kk:I=M4;f?3CPe`X =ӆ07)GM \N4+_-2$RE}?,Ǩ ȚK[p"03a$gg}# FԮ#D};p=s:a`e; ][Glrjn@_aЯ .k[dۤN~!s3c 00x5Hiy<('!,I!3:_LDٳ~w.uR II- #b}X~T0RkL{|}O8%>Jb씔1ǖoNEZ`Aʐ2X3Y5(SQ[WD>CjkwXJ,,5)hiTrPx }5I**aT K#99'#iT)j>!.,p*'eӶui𦞛F Wj)S-|QaeG/U5MŲPAcJaJޭk6)iV2;wٌ*sO=SyH 2>KrƢ5mɺ5 #tMBɼ2=qOF0]W `+vf¨0t 4] {4US²*%NB;O?tݺ;*DlW}VTVZ8kM. j&ff#pՆo҇M*|ϋr]KnC[z:FtE;bL`Y[kdyGU̗A -, \{px5,4c:VIk*)i`fUL6p>97_*kZ)nS{ q /&Aiw d5U!7僴 ~#"PsCnҏ6@|2h#9Ӿ6hut:Cgt[=?ҋqh`Ll[.ARe`?hsjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/capra.jpg000066400000000000000000000063661357507750000237340ustar00rootroot00000000000000JFIFHHC  !"$"$CWq"@!1"AaQ2qRSbr#3B$T%!1A"Qa ?WWݫ2`x&FQʺHl0`ރ^3j*Yah(A^*Һ:^ﹺT[XTG;G$|CҾ dF?¨2I Oq+ĆP~𣐌AAOݚyHhn zI2I 2yV!Utg|wFGo;HbBeMMVp`wǵtG:'Z9rV&7o8\T#y2}T)aRmQp}&|nn;v.G$~f1-|Eq J-"m`$yHziu\\4s!`Hk]E>kq#DeR ּi;?SOпHZoU}*t{#yJ;у<{1^P:P[X%lXP \zߦ}*r 8zWgXr跴"sҵ]ס\lq☯XAy]{ƴP"" */QD ~%1qj2"F{ޱߦ L H1ȤoTޑ+L&-l̃i{’xRmIo˟c|&JPҶ0fbmx 23Hyo,X')ʁEi*呆==dmR;4)3B_hd(r;ܑ,FU>?}0TIb{GnFYwAF[qMlFdS8hA\zpbTpS=M'|9*Gk<˸Z_H\OGtݿی>Օ%,g0/ %{yg sYM*W$kFW<~~tYm& Iڠ$=cP q Sͦt.ۋ}' e T\' Aη[JѷIp7\eO4>kNW!$F6=;@;)l|jxz)c_XyR>G.Wi.†#]km:X3 0=vzZ7Cն[ےle }>-GVo_-=ĖEhPe~iH=liy5Ҹ5 [K[iKiFhHlu>"H2.1?/Y?e=Pۿ>]+f)lr=v M@J~ g?햅d\AH㑚PUG]O)[d rpHq΢nM;{XVQw,7-cdq/]A3QQE$QDcnAϘ2Τ#  !A;y(ˤ$4w$X G#O.f=xe+yG~Y":*nz =+ZԦ (3g#?ui E;},uP]N麤Vjw2H'Vqi<4xLSvrI9?XKkq}.qGv~p=F]d7|K+*1CSךѻvy00q۾)g!Ï =&9F39䵴Xr@;+~pĥa39⛱&@U1;sA*L:Zյդ>H=><~T؋fBl vJxMNsrm0\ݨwZI'o(R;y? pI#J,FŷPCQ-yI 斕r0 ; I } 71R1$'Owp Ϯb >ŧʼnΑ<J$ X/ H|҅ +*X[A}9Eoo22$!W.9B 6]%S)9vH3'{{PU.T&r=%78/ϡ#?B4$+ (Rwvjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/capreolus.jpg000066400000000000000000000073551357507750000246420ustar00rootroot00000000000000JFIFC  !"$"$CVs"4!1A"Qa2q#BR$*!1AaQ2"q ?N"I$.ٹ,o  H-i`y`,'9my@v$h$UY֬FԪA)|j̞`{o`-9r\mc'_K3%\Xsn0We< Q cJ&r%bvXJiSԘ*Y vwƊpZuhn6fPRNSL*MO&,隄gO DEAf~D<ƬҒRv x_ "SGDT!">|xQ;tXbE W-Oub$"IٛS\k-s{|3-QʬS6/I00ꬡWR3^)A<j82:gqk4sq*ৡꙐl4D؀|Kb JfxajXHʠ_wgY$@5R:}WLXYc4E:܁`t/3VrOwvI^X>9iZvnTb3O3Q,)HRSO1$nN] , mqW'3)XV$i6Ҧo0,]L e87{~r5M2w CZۍ-,RiV7T^[a9q)l)O-Bla%vO&QI JA925Q^Yo>(RRiMU{<q0ݯ{hqͱcC]n'UuVM|nY馕Ԅ i'{lY$HbYnE[|8'_M,بdZisxnA)m -3FA(L]A"a ']xM$3< 1RPI "2*0?p&쪞 B&SErɶ[}Őe4Te"6(已5C 3 wiSmK{o}Z,ҪҿP_i6"81V"/ EESGC'?'lMas|4˘EK,:x/q}ZHcWVS+ZGk0?w;2"ijDL5 VNj0^L-6Hڜ.h}%c,icQ͆_̗+ uh qFTtNl%ta"  ~/p?JzԨZZ"E,ĕu-.>dĶ/;=He ^&ȕƩ*C|L4ʾ?]G3";C#ZH 'o,[M%"YXZ88Ө&j qcUS4O(!| DZBX$< ?,UA^>^`ˏ *V lb]Qʪ8a#rddPN8}Q1IUv?OI% lv8uS*1NI1D3DH?McM$܁o C돏jl,iަuT_;n7 Nݼrz:ڪ"+H#ӿ~gUW5zfYdb,NHRA*+ C\xV:f !%>{T<"*b, rۨC]ܞa.`P'/q8ʑg?4tH!yBDynli-EU2*I A Oqn|jJC,SUǝc{aYTfQNh 77$0&%hs{4%`Km&CAF(]hH%I;^LL^^-?BCIxIua{ocK0; u*r5qli QIǍb* .{moتJi!AY/P!cT# W_Ќ .o%*/J̛X-vtiMܒXMcKEWHeĚH2)NTƜte$F.Eq,6ceC9c zc/gJO/dpHcv%W7UV\L&Du,U[ŭ um"l n7܌2y\8.ɤc劄-QΫ2fs2ϯTeU[߾Ued .BpQlx=Pt h1 nl=;]Y&r#F+bc 0$þ]g,gKmz}}pKQuFbomR1ȷn6&n{DY7J-bote&Y;Q~1. iotۏ%*=BkHf"KJ*BXXn;Z>[@V4н髤JnnvÊ YLnJ;_4p (Q˹eqR0i۪6^quդT"71[z;s\3F8,mkI:Muh߾cGPiU@S7F0nam)դ[?yIh.+nܫin,=~Qof|SS4$1 _a ";]-I;(#"[&\(VapXXbJ*&^ B7 $tVRW$pl1105JUH@.繽XidF^|&&7Eu!@E^I;[QGՙbvifѕ$-G=}98 KF-&&R J)#;Jjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/castor.jpg000066400000000000000000000074211357507750000241320ustar00rootroot00000000000000JFIFddC  !"$"$CXq; !1Q"Aaq2R#B3$br!!1AQ"q ?><>H{ىC'1& ʛ}q7!{z 8Tt)b2qN<7* `NYFGF=橒M~0=tUF@e(kG"633Tn.2E*I#?I0Jox_lddOXO (ɰ8 [3Lg+-] g$'b@߶ Oor0Z -mXiSIý*Db6,J覕dPKT<2Dh@4Ұ賓muz]o4EUm,`‘SFsMM},B3:9[ 'oZl6[tYxaXu9fW̊Fb6q4ўE?&A5lՌ w6'#l.ɥv[ 3`XѲx4&d$x6xQ(gS!x yKԍ:>jeR> g1,}l--5ASkmrvd0F+ތ^k\ռV==(%{afp)D\tXÑGxc5MLUՆRے>;6'tz&UyQg."LKǤ|Fr.L1s0TAYEWKr4pzۑX++oJ(ɫڒU$j#6یUIHL}?+bp,))P|dfr%}ſ쟈}FI)ZUyb%,ntjaΤQUIA$#jA l. 7bMF;*sM@oicRn9>~1݋Ʃ?FF$\mF#$ ?Fߎx%.pd3Vz8%U*TD*GE@nؓ})"#(WFxCSWHԕFINw ,SY꟣6gOLlS1\k#7$3'\>DrG?\N4̤a`ֿAJs2o邌WP 1SJ5,N\b;-:<􆎙+^Dcb{\cʩQYh"6WdaHٜ#G,ID jujr)yF{{`lNLakj"AEQjW{*(f0 Ieh0t|"cH<Fa`o{b"-Njwٯ(6ؓLk6+.$Px~xX}ee_[$TmlE# jilhNz !QA%;F8 n0@O[cyd3өuBlN@_ѣ|m_ LPUI*iuo Z9s+ty3'23+B16a+s}; NY%oRx,*ef>5-DPEX=CA :ek`v=J%b骥&ٮq4?f]L4 tx'b mϦfuɝҦ؄ IovLh*IuԘYNG(4c&GG pnÞps( MDUmHd90'|) 3͂VLTRO#SSܸb)mm~͸vVf󖦞 LLڴXrNIafGǺiu|K(IjYcZ %UXokn/["ĐrRDў,-nzBdJɔ&kф&G{p1Фd|&ʭrJg32k(PK1¶ܗ:,2OU.%Z}atltU]: |  r۴G4k,`>@G?< 466M *EfM77 IyɳH3Sǣ  ?3}',nc)-jXy<fC6 2)];,vOL`zZ:J(i\Lfon/ocEeBe GYIdҺtb;m$֐OG}wkM 1[ l8MԆˌ CX01Q7`;T MHjH}?xqŹbZJRUT4ꊔqlFuJr$sv{[N 9 4 H)H iY<YAS$`X,iSOF X\N1{ 炌SRH'|0(Q`яEHbnI*O} }qfw;CZ+I$o5^'Z!4`s~TWoKw1ҶrI ԕ~$dynpG޷bjUaiY,Fr~ںOMK++AR*RRn[~\M* 3&"Ф-$>ѥ+DXv~o: e໋o)pd]QWeQǤi~ s+" }C{5FenH8dMnjF0D軖M#%6d$~VYͲb܎f)L14\r?g-HU&[zً6f a[!S Sky(1.f3oFx;ó(zLo"8ClN9,0e ǗL5^JGl` 3ʦ[HFn?d^0H܀Cs c8c>&6C|Ү6ĔhI;Z\rG?ؒEhf~F.N 틤+v}ZO~x \$G!qTL:tIZ*HC܂9d)Ŕ81FΛ*/3 baqW&θP/e7v75cټI@FA\Ө8ƔR9Y*'{Wxj̱KOvOq>\9t{μs ߧMи2OSD~RWZWcYa#b<I?}cV0l%Fl42n8;MAҏ|J"`u?=N|wcU Jc'ϻCj)!4yKr29}G:u]RZN|"rNej]8jN#5lc0@v)0>H.2MxT%&,K LBhU"Icyl nI?%4URS2 "ș9OV]}[K1!gd|Ntj"1w#I Ā, ?F^ "NrU8ۮL&&&3-dC)b:0Gy&Xԫ)at O~#]Ғe I؉ va= tL^jJVX}y^fKwU} J"8\(ʯeZ+!E; #H>$c׫=%h^JT OGA;|GLxm& EG_M R.甍}z۠M],7,1&)Pa?>umU,;zN>8m28iP!P2n5aeX( YyPA]ѪڜwwY@0^+fO3[z4{DN-[Et 2?O\vUZ>`BHǜQצuThgjJ)ޕ|򓌏=dXji)k |BBGO0G^ CYJz٥`yc'C]qw!Ks?ӏ`5qj%X{[t(J-F:μYUj)ВVc[jb"pIƤ44Hs1E>dB(*Ĥn4^n4 ǿLAiaq$-ʊdH8u'iO%tqE~]O\=GIWsj hDuUgF6۲OMiWƪrITU뀪|^A0ldL9Λ![ϐ# $~zG8pѝ5p H)Iٛ?3 YڥGWEgvVEp?Gg]YKq*d8ٝF '^Jt#6bV߮k^aw S: *.N~#ޠń"Gn0YJ!J~!$=4jf| S̒ 걔ZH8I>īꃹ?Ѭԙ?gkQđأy#Y>91>´7uo\ Ƨ+ /W#\)9r=IC#o(bN7R)TnX#TcH]cѯ}ӵc ژBfv t@ػ2:y)]F`9 ,} '_"8;Φ*K~JhO/8i7 1^w%y9A9-ˀNg|2^)~|R9܌d|=E66q8X)qg~6,)וn{Q?Zɨ51+go-:l[öz搜9wQN:]xR9 |1!a}M|$ rKKshWXfu;At(0M,G*X{kk8[}Z+FW##=8¶Q\OQ}4C5AQ_O( +mhueWrgUZ O }oVkh%Razk ^YT6 \Y]6A%;{~:_RK;S"S1u/:'Fu_Ɯ.+(KCN4jgSkךH+ c&F4f;XdwuǯΗBi7[oijehW e$0y+Pv{ 2`C sev?ív֊:ZZV4iK> 93e߃Ņ+ rXpU|lQ5ʏFwA4c׫-wpňقxǮ]pJB$ w;.e7A9|m⒔K%kR0і5w g 4|f.Qv2XQ@4:E\y[p54~nj`u4^?3_V2zBb_e#7<ת.,QqUFskOLԔ1<#6?W)jk)KBW [%3}SU9C)8篷>xBT#nѠzviZG/KoԄ{*j2˴ QRƜ }?ֶfSnDnfzIX96Xm6X/h`@t=/'|/= NTv#Hl7$yp0:pJ# 6_57^ZS__UF5NoqX"FW%O.65 ?oumc*$5?޵Zjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/cervus.jpg000066400000000000000000000205151357507750000241450ustar00rootroot00000000000000JFIF,, XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CQzB !1"AQaq2r5#346R78Bst5!1A"Qa2q#3B4Rr ?i"cQbϜF좔_h` Iw6cq noLIr+Bf_LO󎫒\GiW 絾ߊWE>TҷJ@-u}G|m 7 4N#f*ou:HK5R%2_R\ PCEI4pGAǣ}B62M}dn*# `$d޼KJިX296#6)Mj)r\B4=e%b= Mt9:TDN\i[+3z[SM&v>nZx̎2Uᇮd Xu7}qp[|!$87[\G)+:` geEV9@-XErS+!Dl"'܌941&~ٰVEcTʂ@`x?3}kZfB*13WSRKbx۰6#Pt@UF&Pa8`c~}O7fh@pt F@>EZrꨤ)$qHċ{s 6.ybR*#S;u###u><{7cm;iqD35<1P+48[9vBGRFy~xtyΤm+`opX 1M3b>y-; asqTiVgU*bۓ{۾!RiQݲI$6mjQibLR`4pt&k1ۧϞ3!a'c^o@ ƒշRS45QwC^pem #3ꉅ?K+nSZZ1UAnNjWgr~R}4!.C=O!Hf؂h9-9Zp6>itV{"A*7xw063v[\xS=mec?EYBy7Ҹ:XqwIM<Ɔ[m@|#燴 q9qL06;@anN> 5 !Pm:Rɴfe{ܱ]kVy:قz玑]jQ|I;ystq#ȷ|qH,ur2EJ8p hʖ +Ugb{Xw8q:Gm80wN$37;ǯ 4 ?Pm I<Ʌې>G\rXN4YVj:{ ^&^__.nO𢫮_ ̛1 e5qXf7MZ0Ƕ9<]Ac䠣IkHcUsapl,MϠXH#"j]; y]M顤ti!Tn9cq16s|0xR-.~XG1p6msQQY)"4H&#x{C-=kVJiX/~SP$Lz,RA$5ʠWrrT +2nqk0#˵GCkvT9=,T$"[6؋{l0o_+$$  E_Ed%.S쑣Ń[^,= o8bLuN1Sy#0hܮs$Md( Xem\yP4$BWS{pX8M&&s[[͗%8e`Lm6-tmfԺ72SMϵެ_kXnT#U+yu~aDr,wIH~<3ҷPr$o w:F>#*$Q 1`D׉gUp*4ba%e)kL~]:["Z|ŠjGh($b׻1дʃZeWSԐk_S"fCAliYt'TUE q]D[ϋ7U~HmRKAQ-6c;AQ EgfNS'64F4EL7"hk\|WKLwmo+.EC뉎fM* -N%2. RA{X6/9^lMj<_<04 6c6I niAݼNisf՘HvkbwGJ`1jWJizRIS#Z϶$񀹏qU!Å#}g rU|8z]UCMYGQ2AuJrmO 59_kIY]WL)K "rr}Ў[gM0޼|wVMiH%Zk܎̥\w1l텮n/,(BUܡI7ޥ ^[IXnB'3+ZP6۹\;Wt@tf,ӹ})/ENʧobpE _2;{EsveY jªE#ok_>`I"9Y*YZx ' H}GPLd@a9OUX2RȎ 2`=rXUs ېO9Ե_ ^os;RI#ճ(0ڎZğ`yЍYJKd4&<0EʫG >A>x,Y:JI^9T=ƚ )s 55WY[e54UK\y}gssO_IiTC!B=daMdx0&8KW)im=Y]QUz84笕 2Gr-~xr Qs y'#zrOUղ=212%;O#1qq4eaGRK:.gT[O+ XLnyGHIE[N(Q&-$Dl12 .(1CsZ[X+7,i*~weUlj])jاVR9[ψCt9IG^\ %<rpfi\Ӕ݄$k:wh8qPm竊 2ΌH_cEN|hĺ9?@l[{0r3pܫj K_o%*C'w6HjT{zbe j3( ^84U$4.{˦-XIݫ2e˦V3Fr;^nDR:Az̬MK#P/2 6FhR ֛gDh_+>IUr=mUQ6tٕGfYRB ?u9;!gӧf=PvP I6pc9+Tѵm]3̒#MN&c${<1Bf@N'XCOORPetYe+Ǘ4%$eI艢nSY}#5%vRm&NhQDc%g4f"M'J'xK l 9p/έCU5)%PWe*~}òFj~)OWd6NZ8Zar;~defkM<%Q 7h+8|xZl0IIZG(Q`.pXLB&J(m I'@M[s]Rd^kO<5(C &)pE#$j!sjRFp0&G-}>}Ia{u.N~JeDxnN<>xI/;R2Ü6RvxGlrU[H ?E2OBg<*oDm_ K*W|d&/]SmyUʷýҚ<N'8r3qV5'F SrM IU_[5?v"S3GGA?\n_qt_' [yujs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/connochaetes.jpg000066400000000000000000000065451357507750000253160ustar00rootroot00000000000000JFIFC  !"$"$CQz"<!1A"Qaq2Br#34R$Cbs$!1AQ2B ?m?QT5truDl I~A|qCOj=T:$qY%[źx&-BG8M6JyqHĒoLY4v0z̟`NcШ9,nQ;IKGXņgPdvc]!'61ȹ W5TNd=iT)[I;8~e[R ;% 6ry؍V^u32%4wn$6H&b#U*KAa^q\sQŔ) *{ZF^D_}.So]FHoљ32Y^8Cն# ]Wú%Q{&QBE‹R7Qu9$9(CV8Mxۺ'gnźĨ+*d?z[`=&H@Xf*4귵s{3JȢ EoH[7_?\T1"jw23 9 2hx*HQyY2i-Z"eҀ5>O;o#ܶf"WiB#a!|Pۊ3Fb4S 1R;r无Tb`T1؋ EK$*@< ]A;,OH1fy55ᜨWSՌ0IX[ 0(h:IcۚcԼgǃ0rM=`A2U77>852Sǯ,4bIff23 z&Ukd,7{kbjmi%2 SRafr{ l|φˌ9f[6#VP| /Q鎋͐ɝG$~@^~clbO4\b"{o`J36J!mϦ2 V}G^ '~AARQq*C9N/}?O4UV fi^9VX9jIBǻOXJQ8L%CTX+3K4-RȑثQ BO1Z}͘=Kem$oJr'T/<*#ܓN hC0m^!v6OG&W>=oLwBic6fYK'aH2JC{q$^ѐU7+b6oY}oμ_ R<  7'#=;1fM"iXA,@6N8ggq$*, ]q#HFF2-uo6앱ڀcq|+"+K W7+vW=JXH}y^ I%V6? 3Ihyð:hb陊ݭ{  l ۗ mt9^^iTTDb<Ly3,%O$3ԝ,o qfzI z PŜEUivHcFKQ8L<+|4ytb!/MY*Z9NTI_-!{_o M#,F24 4[X\rlxCP:Zy&q7JTUdkc3\.?#4' sQV57e*Ab%/b9u+2VUimV|M, !,C #46ǣ~XXˁ"Kߛ~3\pb_4y~?ł?剔0>YިGTp ~=?"OgG₏js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/delphinapterus.jpg000066400000000000000000000074401357507750000256670ustar00rootroot00000000000000JFIFHHC  !"$"$CTv" <!1A"Qaq2#BRr$3Cc'!1Q"A#aq ?Gթ54o/D$MI"K n@R0IL![uayz?:7 ]A"O2TNcs"P4AZB/6IcY)w,jt,rŎ>V폰TX`^>XC&i~e¸c&+qt1;( #@bv׵̑Rv"E=Ñ,zхU\z05|\ S!omn1?,m"4κ1 X_{nNLPJf𲲛): #qԕ4"4N"z~s*]G$gRka1if`;Z,(]blqr &Ycmtf]n"\UV^E n ƈdUuQT"$NZX X/`]؟M4I#MK 샫)ٔ_cn]L4T$ż̫#ʪA2`Rᣪwn9qؓXy=Lr q,!&4\$Bi(Ȇ#S K %uHƗoGu +e SNys)!JIqkn7A+f hf:YAt;jRzoS+P,3!P{^ěcLꌅP .齏ml=]马(FTy&B,l4CSM#IQ`<Űw5%;EVybPycw>Y&UDkQe Xij@U(nN>Up-C$IuΤ>h ?hc2McΩgE'hinOWOMAhG"KBS nM%ANd @Gkg8 NEʭvX۹%'=Kq=NPԀv#_;fyaK.}#q;댓`礩uRpY6)[ *᧭@!iV-YL$-elz7녀NeĪ)2ɦКs#0? hk5h f[H*w 1p@r5ZdX u{ bS4l,#alV>Ee2m^L_t_ƙQ¤+\IKJe*SQ*;*sNlyd]C[͈m^6(驣 6"(5]4`Ɨa ~ޝpOC ]GC-h6=T!\2@o`&3*<k\_-I>sj̑j=:__V={;qE_ v]<$IsUs<YyI[<2n#EoO|~TcE-tS̥$D xC5k %M=XX}xA3VAv$~\ Į)k[Ɵ,Xp|=+D6gO `H(nўERV|I҆m$Ć#U`܅6CfF-{_|U; #db}+pŤ(~80U#e70_9 S(l)Zo=2=H?q̇8r.-;[,F&b:]²weti2fbJf ޗu-k-vd082<7~zI+uaSԅدoGU1L F]%Wf9-3ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CP{6!1"AQa#2qBRb$rѱ.!1AQ"aq2R ?i3UVY) >YS멠i˥br߿:):c* 6յ_vD(!;Ȋj>ס]Q0)5sw_.HfyBx {|{fy5!b)̮q:IRyqy<:&a)w;mBãiR<ՙI "wR>JWֶcPyWg؂?+c\ ?+&6UZB5MxcHX県A=|DjvKSi֊dS+Iy $2zI 6 N8<~)r=t<%΋4Ia$gLqC AۯPY_[>ƅK!`r-Ƣ fo٘V2Xtd^;c̩& Hcfh!r&q0 X}=%4 W+!d6xX@<( F #J9kgm/"ƝH¡䑜9%౳S;_1irZZTK c.zCm8b^XbȢ93%,J#s۪wMIԓ= !jj底XT=#"ءd;wh~WzԫjPe21b7zvÃnŮE,oixLZ dO,/#gt,Cu~gLJ9bDY*1q|`/?? @&^ܰIOQѶ:p;c'=| j!]jhsOY 'sĤeݸC3#Gu,ĥ_f?b`X2(qs88]Uٳ0|A2JM]Kg#n9 1"=Sr͍A&X;՛9vW9϶~OWxA,@J-j6UVDZUa yjTDJf$sj_1mPk'EnW(~<֔8TC xIcRMܵ'pY9IDAGs Vf<Ҭ+GNB`;b@3rOThwE=Lƣi:j]A] Gdr~vU`?# m MBY$xذ<ÞJ= ylst"іPgUQaP O}s~v44j-)k&jzc[ ),v1XgȆ_o*ULM槯EjEZBNKFo@\}><O4O(-5d$0P8c v-\\ܼ޹Z<,m]q) @=ax^/CU5QFEeB2BpzF Kw^m6GrԍFK&~;8ąE=Gpat뚊њy@ER,1 yOZޝ W\|gRieZ۲sl17 cn h >lVxW0$t!w*A^N;3Շè!6jz1Κ.sQ: 1N09L Ƣ ԗOWk:VT@wĞ߃i PO hkڅzu R=׊$Rؑ? _Q [.M#HN%9RkE k9<# gNlB-Z_|GkS*jaLa\6=fma답%J#I\ee!2;]A"xuk%i^7KuXg2y2?e\#_I5zIu)s*K&ficd!rFNpOLXCC0OXx4O֚DUZW*+3g=a0j \A_4jXMnՄFUN9RW?pP|:N-gsΕOIKZ%ԠhmW+|c`x'[y &) F?]+ιRkTO3r\~Nqw wsv{bK,-Z c͘Lk=I $F'*$<~K1bXnjgl Yrsr8=|lyQ-MYk$P6{w/ &w$Qs;TQbqiv\8=ᵢEq0A'[\dvV6 75' gL"Cs0q߹=˫`%K-s2GeW(m7GQK Hr9N4dрdI/sszsr1қ "cdj4Eؑβe|w8 gDUbHF`pj LV"0XOSfEڕjkDI#1 w;qשW>G؁ޢS&"k B&φcRc ݊7f^B-iV̯GHv1dLN}˹js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/eliomys.jpg000066400000000000000000000154041357507750000243200ustar00rootroot00000000000000JFIFHHXICC_PROFILEHappl scnrRGB XYZ acspAPPLappl-appl rXYZgXYZbXYZ0wtptDchadX,rTRCgTRCbTRCdescncprtAdscmXYZ tK>XYZ Zs&XYZ (W3XYZ Rsf32 B&lcurv3mluc enUS$esES,LdaDK4deDE,fiFI(frFU<itIT,rnlNL$noNO xptBR(JsvSE*jaJPkoKR2zhTW2zhCNKameran RGB-profiiliRGB-profil fr Kamera000 RGB 000000exOMvj_ RGB r_icϏPerfil RGB para CmaraRGB-kameraprofilRGB-Profil fr Kamerasvg: RGB cϏeNRGB-beskrivelse til KameraRGB-profiel CameratT| RGB \ |Perfil RGB de CmeraProfilo RGB FotocameraCamera RGB ProfileProfil RVB de l appareil-phototextCopyright 2003 Apple Computer Inc., all rights reserved.descCamera RGB ProfileCamera RGB ProfileC  !"$"$CVs 8!1AQ"a2qB#b$Cr4!1A"Qaq2#B3b ?mQ3TTYkl_Z_&<ǥ09!a=ʹMkwWWʌ;.ʐA7l/*ovGRPo#J Gf q]!lir#w 0! P48Jv\.TmBH8.&Osy j!ʄZ)O W#o`l *Ew?/ͤ^y[Ҵ!7% VUָ M;smhpWNgG*ѷ51MjAZ*tғ&-?mwSK?c;lS05\t4[C`8y$=F84XDlOD8CAKW}GCeX3?Eh }[MԂ0;/2FS#4tdܩi]z ㉃O+Y0%T*VlJЧaղDUJKk.%S: qS#llC(7O?`9A{ځ*E6ܺ'OMk#rɴsi Cc#n&CBmr ;bzr4  :3Up6Fħ4B҅BEIOjP <󊮸Z4~AUKTwRZ$%; [nX|ZH7?Y-9A(B7B;u]W.O  '~JH44&#aA70+Ju Ғ98K\`Y~W'g*(d8Fq`W'ہd;*CjR|!% ,2Nӂ?Y,2| \D^~-X#DuN&!I"M te jNV۝:ZʖtI?(Ns |@6v‹Ƌ1,!)l87QAIԘò^YA7Olq}(_-Qd3$ĔBtMra"֢G #4\]wky hj 뵁 qeUbgZjb)m!)lbr\Xp߯s\Lo`ˇ44FjA+uMǕ2&.? %KIZ`1RH\Ӳf3t_ Vwl}KȵեG#E% Đ*gj,S@^fwOk*UQ|ie"Gr5I6($J?eoʌ"\ ٰKRoB6&-_4)E{",|a ^Էl9|H( dq 5Y Ng]k[tT"H ecg,J˗ˆ!Z/TArFezVW%%~}yc[Ï<~ߢrxsLq#,DŽZ/~?:;q@QN|0%X3Sbj%!R,V4x VNu\umk+8cߜ=(_o9r=TafFq) RPJAU{[%dq9Rֽ9ˤ[l,)*29!*v6|Y,D8UT*֊t IHWգf'l::Z$k- Ejo%$wK+Esz9kI=ѹU$(26-`poanpځj;!zQ-j 'j>(6hicZxLB^5zP)ETP4RZ-ܡsf= 6aQJ7>ugd:W?dSBwLN6]h|a²2UN9͹8dƦ.XW^&$\UUl{=*r6\‰&llj+Ch*Ql6yWY]tf9i%: opH&&9 +zrq^}ϺU'We<+J)aJ^䛎mq Q66}vDM w8[!Ri3] )%IPJiP)UYd ѝL)V9U^::e2['TPO}"V"]ATSfu)1)hRPntOX c?*a9vN^TC+] #b5)Q]jl8TI@бAms,!%ǟXuA!DJ5xnn>[E| .mJ2~AqĖ'0?sMEh'5ٺ@R&58;jp< 10IQA12IEwCVUm-Z}1>=߅+@IT$n#a|+qK65ǻF"YVY3"K̮9(;Qar~j՛+SwFyYU'/]#!C(WjO'[;_n`X:Tng8N&>mFA>S]?Օ鍠rhpoDIij5Ry_b; m {Pj*U%p$xr=S|c> a\Eu5q$-Kdڼ7Ŏy;8}6rrlv3!ln4U F#Rq{y!"ے?jFO,5G}ܐrn.ɞQkF|7HrCq+)E3r" _0#/>7\2fhs{{C\KIƆXl!#ϩ߾1fJХ{&G H Jo]t8[[Ur-O鍟AcͪQm>_/u:jC1TN/TFfdGΎ8 !7̯ݪfzU-a̐.3n/'k"{6F\iq"0i4 8[ט& SX|a6u׸q|(%Tj*4̔;ers|NYa6q!C8k N!a@DG[qoPtUBOLi)HkZp5. ^QEKF&tΩ1-ʧzBP_L14À^qsoJ~dWE\p5ˊp\yvlp&)ip&$L}&?1[eo:Z 򤛛+2Ӑ:6<JŐk H>\9RԀ):PTN1Idd|Pku_t \+UnjYW;bپ2r<R;OeɕBWzQw}\}<=o,HQ 1.:ny^TVMld32^~\js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/equus_asinus.jpg000066400000000000000000000057261357507750000253710ustar00rootroot00000000000000JFIF,,C  !"$"$CP|"8 !1A"Qaq#23CRb%!1AQ"2a ?zE0\&LhsLo*W+Ҭ6f8'+<'_ P}U˧`>SUr> Ef Q?$|I7HV!7B@=IjicޘacR=?s>|vGr7 a9Zer%Ϯ2IN~N{ ]1^r-: `wW6H@Ym6PMgWK>rё ʤwP闢B7\gx@!1tdĎG@֮ȋX{@̆C)bzuV;@wNGwKĬ֨}//\ŵŁqdZYK{"M}zdk^Jk^Z^Y 7zz]Of増O}( O@9|GqK-Tխ~9,:RJe/UHf<񏊊,zc$`9e\phI!8ϵUHL&%8䌞A\"%qװI7Tq6sֳlqD^d1Z٥êAKs) /bj&YeTE,`(A]k̦{9yˁ3WޕK]N)>kzy@e$dٸ dheXdR?,ma4%vy㞝>ԍYmdCw!>U&c5=@pбZ:pyncc`Ry Te)ϽYD빬nπ6ϿVoT\Ev=(?P'm> L0J.UXW $QsKٰE#;kɤޕ8R3?ziƚp#՞:6;Je(1fxnw5naU}8ߏoőeֹ:t9ڦDԁLyfl3B/m`B*Y1tد-(*Q(´\ e,䉑ݷh AA*Fj 13\cL0;g=ܓJDrvʑV~Hd,G:1:4eA iPA o|=H ЮSXOv s;8Xǜ|25/X]98$G'5R1nL360Ynz*%*v~{[PGqsVed&N@:b$LPV<^t/n]gnPUH)W;(sԗp Ҋiy& aMV;#%|F}Q\pr(_F'R ܈ 椲JI'2IlҾWOՒBVMkmh"A\Ќhn.эXĬI͸aۿ-G'os50ۂW=^[ΤIgޭ<Ȗ$ѱLZ[d{-IJ++.܌>2_-\g9s`˒:v+q *Ѭ28]@7w׷J#%ٹ}*ryvu'Е^է=J{ݲ-143X.?D\ģ>`4P#*2F}+js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/equus_caballus.jpg000066400000000000000000000110711357507750000256430ustar00rootroot00000000000000JFIFC  !"$"$CD4!1A"Qa2q#B$b,!1AQ"aq#2R ?<>"ca{N<<*K,D? [Uǽ.&BOٍvϾtzB(b,*;ZbJI+ I",>a8fEc }>[O Gxy]b>0Z=4},aJdK"赠ɤ ;-ZCP *ىӲ]BcBhf^Z$h+ [0c6 ֲ:*ַHK`RuHS1w\QUHkI' Zjbhrt}l>CPʬ#{lO K,A:Tۋr h.v qpS.FHy Զ]) jH![xD'fC{}}׶tC$5$;1"i 34hNMw$S2[k`Q$B3ds,h4qHVǸowW'_Sc9OA OG1<db}MnF6S dEc-)ӦW +[%,q2iCcz2eSQ xҦ<]*Q X 13~y+F+$VTJyU -k_F +$0mM?`[3Σ/z)x(}aUI'{k9?fIfU3Z"H'%va&_J#UHQAL5 5oqbmQZƏ2d!7 P7YSsjS,rjj%I"E ߞ0x{x6KU?Ϡt6c.GŒ׬Pi E3mFLtx(.ͫ2u16TbRnV/PَKj]FIߛF9aQl>UM<(~-|iǓ,19FiIg9no.w; tM?M_=hŕJ\Y+/B5bܶzRk?Wu9hSzƀm"nnx\ѱ#˿ɢ(!qSQ܅~@'6ǽsZ"M/#.b*`grhZ5;>ohǚEQWLN̢sUi[Thn7~ qvDcsKIot{q*l7[I,Ծ̗!/^x|GW n7nE..v$Z/aԬ_N!mۣ/D[; Ռu,h<1"|9*R2R56aC0[y kXYEQ+l>zM_xSbƥjD)֟Z/f`ta± 44#8SKMᖙcj)bC|Qpm LP;(CylTZZi"k0!Imkb=>GЯaB^KJY$r?#WVH}2F q   !C of NW ܶ)+K7Y7񜟳)~kvs$,]rjIR091@-~|\ͮjԔ5";I97i"767MEڻs(•| hXB#k yHo 7-k4htpvc(e c,RƅWOn;1hV-kb;}#*r^(QX Gtv cSr"Ll cV|O$ဒGPGY?c =2 ?( ,?8 Y_rPf1Q!#'e/iᕢV μ|Hox 'hH6Sʝ/b]@brtȺ\ 'p9X܂$ cSU%.vRo{a eϔL5Uk[#^PK9-J:a.!Z`C6N׶0ᙦUER(26mj ^z}fS+YT9qv*k,~owPzL2 C[Vx6$ټnqehكRy#?%Kxm7?v>XOd{1-0E l⪪*KJUlA:E/<_zbIJM)yb̀b@S7RN|uDk9@SUޘ .PT[khXZQLFxZf mg4q)ZFΡaR w^Kc2ɖDeCXV2״jubcc8 zUYi$a)iMPxdh MO"؆!PÖQ’$*X馞Egs5kI) q<nv?M"zkP+(_Y'EE>w=2D Q}_U:ybX e% t'mH y )/O'Q&cp遞t ;w5F6Bk]o{ M'yu7$&s|,Y`<+a{K-=7r֮'̡I<8FʜnKE+LuXFP7&Rnr(91SAL ʈ < Cz}2J^;bKl;5:`r8ק nWAaujgr2'ߜd`Ī+:RԍTA Ikٙ'&,tVz p ;ܛFhђۋ=,i#S4LUJ\'H$da p*/K3"F2W0CbTp2 䍫d~W0/c$(t-|jdk1ΈۻYbi9-D'h5 A [bGocuu6%&dpmN?/\j $I6{YN0-gK{\mߒCT)XS{T 6}ҍtsMQMgiu$rZbhRO'Q t 0`62όqPJTo QdRFPncBKi-b>.xb/*+X oO:ڂ2p8İJη, 2nmcp-nMx}ZJ4:b؎CZ^n9=ƊU/u^? 7dlej;0A37Lft1Z1`QtYI/Gɦ),Tn nv8X;޾*M_N\dV UÚ=K&ꬊ7"w7Fnn M 0 (1 mp 'XTG$Io(ҳ(7KuQ|~pwL rԆ@ŶnqucLfX 60{~_ ڎH,IX56e!I [ܛw2k) DUڅۑ|;GfHKJڣ b Ko8d-he/0Lfڲ_N}D? t7+f;u@J*!s 'ƆIZYS:͹_>;[UQ(@5)6R^E[/\YR)#nJlpk؜t] i%:Ϙ/Xxu啡Qj!ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CVs9!1"AQ2aq#B$3rRb0!1A"Qaq2# ?!|quJn bAw544%$5LPU@??6M@kMnUgV::IK"lL!}tyj Ąmxly9s=d J#j`#tJG&|6b[]ZltQIeJSTG 6HC!'Ozۑ\k*gs22& Ȟm$S²:K^8:]Wik?ЗI.l I#= J|@)Va87. IoY)&*d]M3쮒ꐵ(SbU0[%YTѼ Q*AUX _mzs,SDX,3hyH__kKt'ٽZvL"ON* $rOlQ@eG;E[RQ $G1Ep3}e}9?9kCeP}#RTb5-&dY؟4Z@ӉdDY[KRa?V2T?1 OT5,3)|hS8s!pIc\4pXτ()<.IpqRIQR2Z[T!yc)ӐO U muc)z!)㧧WK)py'ˌu5בiX_ BCQ$SĢID`*px?t6`zayn"X D Q =~Wݏ="dKAn7Hec$py8;~nЫbby|IS\ۧjqO}*\v &]Q TEw #TAQll ~՝r؏/oQp~bbYin2,P›'99=tatbŒ1QkHF[fV@瓞< I[Yfyr_f5׹! (:nVNdj䧊:9bT;N{}]6tnU I* $Y>d%KBr )TC,JH 2 qN=m;vYPp:{NEa/d Ăq &Ez.D$kCs@ QIkUP ţp|ӂQUܭE=]%D;K#eGo_MQ81ǜRX?K!2t9=֝Apb#Zi⾹ZV $k`HO$q n=Zq1UUw4 #+`N2{j>:(o/%UDJ2"$jd.H''g]$QrNٔ>-UD'Tv~?- D)I4c *}Am$vce#w#%,=) >CAr׌Ƭ;~UA]J*KGr % ܅cF19G{T4Ϝĥm`JU*sTi'I;$8-(uhF1<sǶ@-CO;S$jՕld};⚎b2D/RU'zK۶3#+ )3x͸Cvꬲ(Ic|َsqyΖGony^gW'V xz>ι[Qz$`izjeV †Bw{JlLVT5XNT~xii2#kLɺU$S< 'p}xu41-MҖ,aAFi2y87kLgO[%XR 7v>\7}>=7+9ۣd0]w$~ 5*8OIE01=,ߔbe@>=B̦J} b>mBdgNsvcP@*3$eyfV3GHrs`d@.GY EzYyf #*#'#pluy"m/Os PhI9iV”fElѬod{ FP1' AZ24#֖vH_P8^v5\x.P|.I9xQ#ÿt K\bT Lad[6no{Ӈˍ;c` c`G5H%d>=@YxT-,tMݕZ%jI;T$; Qzj9ᐤO$1,mIIS3 T"6Q0$,d!pFIvXOsDbcp*p8Ǐ䓬ײ3[23O7**1 ?_9b}v gX%K#bL8睼HIéb3 WWKs7i%rjQ8R5{$&9&vh&VF8`ƒ9?ںG Z|YĕW`jigTl}@sϙEibG 'iYV9'xak6zM$#r3}PʒXOvKj]6"Nѱi9e*[0/Nv~̖t$Q#.H#Zsag? o^%nO5Ζ~PWhO%_Lޭ4>46ռYi-r%RTmG:ia/Ӽ|tmI9.2AP kAzPWPɐKUmUYh%TKÕ/N,r3.*k.oU$0n,8Ϯ8g%AcNJ{}D0J/Jv#9OʻpFf0shoE&` ;FUI

@Q9gնSQojhcyb"ȤP3vBj\)qv1j)In~u~K5b=GP#pqJԌm1>){9+MfEDi-RŕRTYj.P;  8hR+Tg~>ICl<^$a3h!n[D5^i)]+1wn}ޤߑǨaK`EÐ(.0 zdaO= gApW@]$ߍk>3;7?Y=7R9S(TI :[f'~yK -.S3-Wxh9x9tCҫNo+ghl wj2ˏlyGo妞1pJj«T9Ƿ||[ʲ3V:rtGlZC"FF^t*kŝKQ8e'PI[OPTq#8ijO}/Qw^~G$M̥W'HL@A1T>=]\i0a6 zѺV(mlw?hCM9!1?s:<GUڮURI *QJ*Nq8ʜezbyU% =N0,qosk"T:^6阽vo{ʭ%q:S\>:8=U@8GRݢN~Фk+`&Q3{sF^ؘ4)cNMpz5U p (D$O$uV0'罵ksb/5$g>ڪ0 qWL}IbI`R= VGt O'QߑW :.6.hX^ԑ c^mQo_K`G\F5@]-+Ot6sY#LΙvb*y& 4:Ή0ܩXk.R2y_eq7#q?[<{W$Bhd,m C 9֟L 3*sPUQVNOmH ;0s0!( P0!U4TV4fxq 저q 8=ӤԾ1l]Z-Ta}\!)m gaboq*VWO);@bp8[8Ư[M#}Eg~1UhF^?K_MmAw9js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/felis.jpg000066400000000000000000000055051357507750000237420ustar00rootroot00000000000000JFIFddC  !"$"$C`g :!1AQa"q2R$B#3Cb#!1AQ2R ?Y O+3|j<">EtE8DggãD.TIOoHr-x526ZU3d$i[+9sOq^O:EVE(:ӑ<">Zqn=)BV ~TiDxRc*@muΕQ]G;Ƒߟc IqZ:Ii5HN$5d!q<b݉:2:ӂ'B44F=Jh1Cdڀ5-Cx{GSv#6cO;E:*DseYzq!$'/M.d1_mXQT9(WJ1TOcV)R@$ <͌]mҫ)@۫|T6m m|f ]T.ۤ~5xO1QGygB(]*@j9hZj2l=up1 s& l#b 4t6*re= ocޗb U Ȇx̭k%8')O'5 [Vl{S!ֵ*ߝjm?k^Wn:yP$NS d-Gack̆6H%%TܟM--BJ% nIIV [35⨅Kqةk혂{ qJI'sp,-51p:SXu NTPBqc@+H2H[J"AEYZ5cM-'T@Rj;MBiJBT z&@_`?;Mj$({am;ա2y2(OD Nkq4#O%T yمi玱1z`mڍ@6 )Ig:. БԔaubj2M\1o p*s%SSN&ԧ#a+^J $kw㛚~k6g,8 A)Ļ% b~:WwI&S5(wz5,ҳ 8~\kN)k5 5zvQcR(x[P)ٷ݌!GYX%kg:]=ɪq}L\N2/I'*d8қ/duR5>,PQlemŪC7a *mfPjf js5=4CRmưm4DlO鋃U5@8jYxlDe>HM|L07k/S(yCD9+Nӡ7Ux3 zrʑoJE" &^p$y3Reۋ .iU1 ȇl\ _Kk&HE 1YAN/k!$ԩ_j$F +r3]iGz중c͓p M'(81!+"f6 5'Nkm>C'2w&Iizrd*BԵ6V7UMICHzl:~О7!E,vÆbޫʕQ vPy[Km-WM̠)ep(PMǥ6/4%DQ*v[Hp6Hy qwR@M#`=,#Ncb@Q~6NȂCwʅ;B%kwlx Du#~ˠwC:=XlX^O]}?wB@\jsMhšYx ji[lOBՒD; se#9WnCZ`8QOJT^ D$js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/giraffa.jpg000066400000000000000000000114721357507750000242370ustar00rootroot00000000000000JFIF,,C  !"$"$CsV4!1A"Qaq2#$B3S-!1AQ"aq2 ?ֱc\#s,;QDx.{X.{.;x.rgk'o!4⻓  E`T^ LT^;s;x. x. x4ǂDu DH0٘n1~MG\^ ШS;x7B ҕkk(GUIja{oU\ay6=7ӎPr̲JJMSWJJ.P\7ԂAn<-nDrnd#c 9mRVXe0myC]^!p|$)ċ$wCͽ-Զ$܂}8M6a2-Culoz1s˞#oK:b#gTSj$jA5煮z^ 'm B| " h&ٔߛ{vO$5cqřUf 'Yrq .*͝YALEUt34xS/r -0c`~?񋎚Uc(_9K5Wʠ! [sj5:UWAd%J ^=5S݉D15ͩ^ &r)gSQ>nvf^M~CɫĞ㏨o7e1f~ԲLi~i Ucjp8stzc.Ux"ZIb:^PX8FVnd볖W7EQV/r4q\VQEǠ9XQYM-S,xu4i `ěH*R;22H{loje#'r5.U,+oĴ`ESYMm$Tig@)W l[ԌܑS=}A_.USJ)ZNeD2 V6$!'j[ŀdo̧rأj=`O"|~~/Mv6qCi\l,-DA M skLM:_[u`EKJdZMf˅<Ac)S-ȧZөC]H>T cֲ O͔ZejYF6X*S,gOXŨYc܍?C5YFcR]ܚѵpsku֚ NWUf9QPS ISyV6T*m1jrb©e-O!%nA\|'3\(`qkTMEB̪MM;8apbé Jik 1 Mo|=v^?=C:l&2ZJzht`}w!ZMyua׉x6 - @Xʖ uT ׃^Q\zl+`ivpot/$'+ӭ-<[J ^|dc2x\ Uu} ͮp s.ZjYIH"]P˨jRv#mLb_Kiڷ3 և8jH-*0> lSA%8v+lf%Ro-a@88@3r"Vy Rˤ{}L>$y1%K'd7q@ sI:\a;K$=˅ﻩbؼ#(me=%d}U sE5Ea:жxw,+2jiff!k}ͷ\ʦPw7Rt-Vmyڎ`>onl7>/f̚qEEO6"ap/"6d=TYWYUi$W )M*CzmanpcjK+Xx,4%!!+cGnNvdU ww֊H]ѩ`|7:%xe;E RU_`J7ÍYGUTT SAZOF@EmX'` {噶k\){*F6A9&ŀV #3#3ɢSM43ja>E xMp @9SOnRvˀY(}\~ci/zj4 TrX2 cs\":#I]+XM0anKFAI d n![Y$m`ZQ} IӴ&,r|68fu7+8ʉ)h2E;6ZqK9g*j\icTq$Kkc8B:of:vJxH׶JDybt(f q 0ff'Db@bńȑDNb3i.orXwiz$c4[\ Yn[4c21[1q1>'s)暪hd4 7;Ͻ'ޔjj2 laK8ۏg:+Ƿˋ,w3UjzTch%uJ߈@>06 Qzc)^* a+v'a܎cO [uD @]3AO3m y׊iIWDFJU\I0I)ƨThuGM=F18H,I$hKcJT4tYG}^um}E]iYlU$JT43̫̮gH:gu*R|#p}iq4=*IhZkTSHA^Ypݲ'UX!4qyAܨ?\UsvI8-J @.7n7k>7 n8ƽw7(SuS%MMY ^X`}H~mS%qHLq 嘟m omV9;$+`Q-4G qL$Sxҗ7R$5׭i \IaT\{h%}ECD E(g ƛSzn=iY#ϥbY 9199#_xgWOCsY鋉jN]#' [5h.K)nC-\JBiLlH<܌4mPE-nY)⨃7AKFEú_ r=̵ۄTDUGsZ/ :TAԥ%O0f#\ds}q"m}%8]K h@$` g?Xa cg辘Ol) $wlXjb,X:oT.I)hegxQ ) }z~PSJe4y 鎰42#(%5(Q~t5s-< @/SqI$p]2O` ;$\.^u$K;<tJU癷Af;F?-x+/xACv Hhc (nY~EY")N*THlGp1 èmRADq\џΨyu s%]JSXkLf7vmY8T+RL?CI#۾1aJd׬glAcge8φ"UD#vU*}Օ:"׾XDB?N"TQ 3_R07FMcܟZ:J6yyOjomTjԠnCVƌ @ 9 Ak).{xMazd6e ȼRLZ*;Ln羖ISL쑀6q p3K^+-5Y^2<7y*JP~S$Iǰ7ZJpw8AI,DCEJ qf5[j1 $2eEQmU-D{"?NS5Kӱ/K>8,b=h]`HYYF0aM]?3l$sr;|sm5k؇r(#rXR?r$c<o%ErdqEC&d vqViՈ qW!AURkeʡic|aT±`(xIj<,.WG#4 >?}IVT>}--I(#Q@ta5p R.IO0H#便]2+iX- UR;hB*P:mkx* r/D&h!t% /3$B\[kPq<RSrkѠܒ >yobs`3`M1KS^ZJ@ B4=RP)-XxA:N8$QKcR 搡XGb]pݭL"dP$ʛm8*Y=Xw)@?;P翿RbgzrK-Q]-(ȑyԢ#".Ob/rj dbBR7ލmnu ܤx`(:,ni@VQHPZp$?5[eKy(TB885=9kYϭnЂ2KZpT6;9`ח&JP8R]hVA85n>̺|-˘ cuV",U% Iɮ"7)\QlE)Έ%LGe<)(ֵ+Nq$W<3,qϰ}IYN[qeY9 9w9ec-]M$n~J38⛙alw{N1<5+O!=+KkJABTr1Q\{R(Si#skgr2cӎʆA~%D;ejbBŠc}=ߚkcBI'gzN^}*m J^RpR^CP㡭 sW1ҫvcgD vc̈[:薜9uZINsLw4-%쵨h@l[Ձ.%SnIvL%9C/`w=x bs 96ۆ؍"1)OoR8?o$#OojgBtvr;3EmVVAΦNV̸InVjjXoL {X-"83f:(hJ@o U;}![ DiV7i7!!KƤ>;Px:pӶAa6#Z c @Jn>-T0yi)c8۪ m䖒_FB5`N}ΖRխ7Ͷ*2-HBI  PNʔ@wy~0\fS\Ғ}] WGq }<60rm#P#uvQ[ ku8εP$4uijBPO#B#u2futB\O2wg|sSyvq-R;%N RGp-a)I>*P?2eNI&ui .rJw'aӭG"']-|7dpdAPrdյ%֭c|7=%JeJa޵j)s\Sa>/Ǯ$)ۺۇ&HBkfzZ7z_N|TQYqmqadr ys7ʄD"V&=)&TF$DX=ygڹkP olHU%*Whsh܂$z ZW"Aߩ霳;ĸ÷#0NKie+IjȨgY3"bY8ҽO}[Ur[mQ \dJglZ:㺜qZycQD::>a0,Ԝs)'mmlPeq(8Ūp.%0ƕ8 C~ǸUycПiN"z'$J8pqfUIeKJ؊ƋKFJ򃫧Lc]E CeMC0iōN:*3 UWu\YGK;VFO#CbG\l72R#vs'I:P,3J1Ň3?H!|o4u#%Ep>+9[x7෻ݙp$F}j6F!E\Xfu&_%J6YP>ﴒ@F19$ mgCD:?g" 4^Ie)^` KB[(fЛ&_Xڏ{a8$dդc Tuuܻظ H•"O^[c5KsM5(1c&I1s6 R}?,Wfgx'W1ZTq"kψo1uZnZ;đpӗH;)c˅;R!zu84"BqCN9y:I S*'ƴ9رɉyAE#;'#ʖAʝ$ճaʔCcBSM_Gf;e#Qtn̝98k9Υjf[iT(o, ;eB;3ȗcV㾴0"I<aSi$qʋٙzKM *%DxTyB9|dZvR'c~K kPt?#㩡8#H FgaOM4AXcR[BD|'ٞb)u* ΜuGCb&)LSPX>frp~䔃GU ^ZD?Z?ΰ') RX`pS ?pN?}=QNzOg?uOtekkGWAQ$nO4hڷ_"3R9Rjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/homo.jpg000066400000000000000000000110331357507750000235730ustar00rootroot00000000000000JFIFXICC_PROFILEHADBEmntrRGB XYZ acspMSFTnone-ADBE cprtLdescHkwtptbkptrTRCgTRCbTRCrXYZ gXYZ bXYZ4textCopyright (c) 1999 Adobe Systems Incorporated. All Rights Reserved.descAdobe RGB (1998)XYZ QXYZ curv3curv3curv3XYZ OXYZ 4,XYZ &1/C  !"$"$C|P7!1Q"Aaq2#BR3b%!1A"QBa ?ki$AQ(HRF.:#^Q;Y\i|lBQXq 8J /N /1`CĠZ(9dPWʜ嚛P!ƛF>1Lzr̾@BV//3Tvw7 2̇|gPqh>,&xd5q4Zg_aoě/IExO/"3Qd3#Q}bk1@ǔ+OZSU%uaJsY礑wc;@!vb4X榲`KXi&*%MZ5 +ICW .%ґ<?Sk$>ϳLjS$Nd*7)~ͫ ^0/?xaT]s??OcGG&Q8:p?c0bddMCt.uQ-,_Jܦ’JJwC,F̌: K -8!E-3fO\]U.Npfi9LZ`5:a{W߄N#pZvSL\Q:i|3\A)OmPGδ DK}",Z$ms:dee qEZتk#O|I&In:`6[a|y@,𢦑{tƌRbehVq=u%}cQW:L '"&4# hq´dKM_Y4T$Л2PFB&ذ r櫀j*%0UՓ3  #{o+;eKoG#>~f`K1P bF:zdƔnWYT'}!}*lQV ybQK3iBnu^)7ŸUÑiUW:1q'k6]A$l+%9{PH nLBAc r,9aE9}klTlu-åˢdY/`{m5U'.z*'jjb og|SG5\ B֑H#{:x8+EYqMB::iHiT "uۮ+=qB*+7:֨Q 2w$IE>9MmFœ9tkֻҬ DTM|lg\ɩv' RXӈ6*FE]S<؎g\'KGA 8z|XUWؿ3x`9X E`KH2*w6g dqD8Z56I%9zfZ#uSN D4'895-<rᵒIVqcJ,-˒ř;isnP8ce<3`97HI=.ql!.b\vmtMGQC CH(ԩpqmɅEUM3tp 6-4nPAO,[u>ҒE`b5dO5VԻg.}Abȭ "X'X~8>LhQhȸ2xòN}Ixvcܝ}|T]-C-?2jSalstJsx(upF{iqOpLO.@ح{bS%$N8V$fԵt8@7~ޠ_[v]w꩖2U%yq"tz dJT"Ye<*4Un۟@T}nIjbѝ@̲ꚎJaCYՕRwMoOj.QK=}LdQ2-Wtrd+yd:_1S)p-=db7o R1ǯ\yfCy,EnJϳ* /KB82K6Ti D#Hckzaa'O|mrW8<z(xo; Lo=.? |Iii)ԊaU`IE!J]ZJ!H?-ZB6[ uTK`0TQC- 01!AH;< ٬ Ŷ,l>c~jr M/ R< :sC %MKG@"a5S^ 3 0g'̙g`EXyps* -,O.4GL䭰|8=g@J5k Xʮ'T5DY>pnzVwY\5a}7XzkKt'|;@c|,.>Kh+$b*CBb)I7_= 夑 hfc',,Y(IfIE#iT$$^PKW MNl"21 ko)0:$*Ή$-a6*OQ`ms!OeЪZ0EԀv1)"noСrusjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/hystrix.jpg000066400000000000000000000071631357507750000243540ustar00rootroot00000000000000JFIF``C  !"$"$CQz"9!1A"Qaq#23Br$Rb4$1!AQ"#Ba ?Q^$p#_P]מ[©}XAU2N**:=;amsƎhA))bS~YgSxǂ^qO%K$xԛ z`?Qr=L%#eRX!o+bfgGFK3죧Nm=V}MWS)ya;c:Rr峆:TTk|.Y`AZK)Wxe,:SԃJɕTB$c{}qLc(xF!j|,RĤ_ɛK-!laG,GltAUiVːf:LTJ.@*mt?\s^ǫ-,s:ZRRрC2琦UfY)>1qA?yE,N q,˝$Qc` XoaQCNwĬ| ePQ23#ӫvppY+J51(n$'|, VP3"!V1kTd9k<\4L?Sna $ytR2h]ԩ$#q.eZiA!*ٹ]{r6-!H^AUe UicbI_Qq`p21֕ ZAm|9A@ C+@CH2)A^{aXɐ*,˰놩L:e T ÷v^ؚ4"hNOVS~viE2-;cȲ jk`fE9"o+,5 4Q7! ؝L@mHf ȵ KM :Zl;Gm}`o[]$03j!+uBWr2ca|9.\@[;ؓ߮ U0UrybR@w 5\6H5Ty0a#BuCbbeHA SlQ7'2TFkk|i C| +_j KKp KS[,anukhՕ.@V6#g_V|yfk⑙)0{%N1 喍To1ХejcG2ׯ\ZVL jgƵ,-`@77#lgՈR<(lO߳+~t4SF^bHQ$ b*%/fhs#aKN%x ao XaվutdTrUMzR2Jŝ\Hp"&Ica˨XV7k P\] RUgYlGM<5itIm2]$w[U:-!ZƊbҕìVؒѸo%j"jVYa1+#xAwOAEɲnL5*zt H, n䙍fR'sT_]Y*eK SX 8-{ o3J.[jRZa gUsd%tlmَ[ u F93_I:lG]j;|C^q-2)3αLVb.7'1As8'5"ƪcWBlKb@Zt]-M,8u&U{1.!em7h:pa4I Xt#Q܍GT$kU/mzyXҡru# &[̆6Jj4UI&Xb:ZHg̞DYa>"2 /=}E-zD3hVo;`E=7?V1+,,㷥\!溪jR"ǫMM_UJKXl{i>}sM=:*w,0/emayv*e]UuF]QG\3%\tV i&Qcccn,tVk+gҙBT;h\ .u .D|TtԔ9-=F[Z\{݅mб[ 24Ό4dXIa#[f_4~BpWnS@,9,8PC.$\k{o1/zj(LUT$m,[I\Gq-lfj]kȀZQbE-S`TE"/*?rB~zZ-vaMQ:"YbNb;鱶G4Z*U-E2  Dmiu[Vo\gMAbcYqk:`W-5iCK;X]O|W3Z%H&mz7T7d:xsi@m}F#WOǬI{j`{aY ͗s;W+D82-QNk 5SW+7ZsΡ} (bOРu,[("`p*[QV@X)ƹY즵49u5IQ;TY ,(MqGkHMcHç\hn ,˅^$3劖mI5r64R52ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$Ccd 8!1AQa"q2Bb3R#C$!1A"2QBa ?~A.`FU0U䟅+jJn=,0sDV7oFW/Яw=eT'O42쮙s )]G 7џpܵQ&qKZ︷8<%VKz <;bIJ}N$5o_N]U-Kg\KNLS0-8i%|KğA9jiٝ.;O 4F(.R47P0GFDiQGa\iYtFX;?C}CIGjV)ف2,˫e!uZu801%J,vU {޳(:AmOLEɿh+r9qFYQMqpLo/XQOl\[WH \EԾo"F#.L|Gs3ezrk߶)ؙ|}yq%^cUOG"0*tlZQpvcoÉS.%6kx`5!eǧ *aA]766[Y⃅NJdeBԒvwfPv-am}O *2]+@TOWUl٩)E%x(&=)tnWb,m\myMdWG.ǩ.aIKsE4('a-!G QؼAG8Ƕ!4h+TsoA[YП']7oeH W車z(O: 18 *.{ JrÊ .k$fh4X|a%^,|F7r|8Ҷq1tE^DYC;\O6x(seTC/!S_%sagpƙсS,v Ү:0,_^%>8ţ+y32K 0bP|J5rC==?.J-*OK݂ͪ5uE=>x н{T4Tr*vx\Ⱦ8rЫ>zJ7'{NR՗QKDuT\u =ɻAKA4,rcj,lQ.lDBC KEy_OOBrV.vn%'zF?-w[-vi;2%K>2v=cDܛ(ߧo@n,R55xK'8{DY2ɥ8 (uo! >X7D\T/~"TI_} I!fgjFyQloH׍RfU%grK2m䏐OadU s-8+F)a'8h&IK[A]I)nw&6": tŖrD .|2ve}ij9`yo[WF8=xwxXɭ 8)+dPYq%EVSbH'7,2J<]1mgyUFeR4|>sjUaLQܮOk*sm,Vyc'|e N9龖q W+eg5ѢYT 凋v$8C^bbZZ6HX ܟ&,)IXፘ t,{ۦ ++.-C@u;(ApڲNPe:%`D(y\Y\N4&qӔ@gp,[I%1DT( Uc4ȡLʒA?W 4 3x1H酳C:hFiHΆwFȿmP[ fD2;3[C[OMo+{ >V2@q 4 fH]no01ؔ I,ʜ-*@^ '9`<1Qr2"(KZשv_ %(mH e/;k#^$CeD,o #N9QTjI=*>XI`r@ߡ܄T\ə e֞wUPo$&0Q{`9Z)iͤ_+u3 uh *x$3SHcWAZ9Y^I@itJrZ[9묞qL5{ w#tuW'e%e{8<6n%TSVYp, 7⨦SsMaв[H2BmIK2N5H"'⑂ju\N_le]fs\c,䚕 _ws + *u`H`ٝv AZBWy+@'q/KElH ma{}c&MZzPXxac)4%6@یInVY4e$!LcS6!9idL,wط9EȾ/Gu-2\B*,Ij?js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/lama.jpg000066400000000000000000000071331357507750000235510ustar00rootroot00000000000000JFIFHHC  !"$"$CVs"<!1AQa"q2#b3BSr,!1QAB"2Raq ?|i[XY/5ģS(=Mx!^!C|🶊 k{hw=6 x?m?eV,19>ckiП58ν<)R,^Jj%H#`9h[uX."Vcx"Py :ꙎK9u7/Ջ-I/݂6rz89MAAvf~Zk]7DHF L5lɃǶ>z]xUJI.#ڶ-flyt#4Z~*Z-uWqlpH:c<22̟,hj^cƜܭ.*܆2t䖭<,gTFܹZ!K]QWq=)_F^M̊L 9AJ#@=Wk/a_p,֙[=oN~7n{Ǟیxv|VT3 $|o4b0^ؿ.x!jmQazϖէUS:og֬ z8^I2 OJ'dsSkȘA?USj:XIg wi ./ijG.7wo"Ǯ k ,fC[Hut5_l!`~G:{DxW(UM|0xJ;JX1Ő27+ LYryrh8V"4hfO݀z\\Xru2Ӫ*2%mӢ.f3>|!φ"< JgQdw#c^Y(e<6Һ=aZ1m]5;s 'f;.Uэ8JG˦v4屢i|FLv뮲S[&g2z^}OijtRzKSeij\z1t;0wdO-UOC~֟T$ >aKuf!TQ jv%-[m}z9tU}8{gS]\S ET'MTϙϗA &j h /Y[6_:)QQ[[]^z I/y.1АG#5tq/MAa8vWdDǐ=>gmʾc=SҖ2 |>=K' oPe R~ޚ0WչbVnmmDK37R~Y}m$-! +I&*g+厜Wp).979]VZ`#${+i *z +5b^7+CZ.wIu)A\&N6"Fw!ж}. {6hғeו,z݈0zj{5V|J2- *zzSZ4')?N&.(]tEmFGN⋂6Ju>ɏsN+[,W wFKcR6j1I?-iPT:ZΖ\;T?]-Ya~/FRIi,S̷2=jtS4BH7ϧ_\ y5!d\H|=@u'sGrk! (k{!B~P0Ĕi#F" <=Fٍ#m-PNA8E>YKL20#טߟ8>GmʱTG*\|#?"K}hז!@(!-SI,P*##>gJQCGDi1M]yNTDܦUm:`r.(tmCyPKKKMv (js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/lamantins.jpg000066400000000000000000000057151357507750000246310ustar00rootroot00000000000000JFIFddC  !"$"$CTv7!1AQ"aq2#3BRSbr"1!AQq ?p*Eu##cYKDJ9*6;IQJ%F֝PsF|'C21ژY\mӧp#$MJgb;GkLZEʠwPbOj9j}(F恠i͞h&1PI' 9:rקzoO[w|$`3x3\k]N^Q(F|+I3uz鹠nĖMP.ă6/&FOIvfNnkfnmH/I?(w{Ui 2gVSݧ,[F08oV~4S|/m{_qIYDo|^6hcu w).ȩiL-%B"LFqqd0x $Io%d 8ˏ2?_LuI}U 50@ll~9㌌]`\t߫4SP*Ǹ5򭪎wdº]5T9g98n0k&Euc>8GxӵNycPb`E,@=Aibe憆Yi՜yY ]3S$b,(sܡ@maA;Lu=]&TЗ@}%~22cdVRsF'K]k='pLK'')%Al8>hߎ;2F׫CxiDxU5'uRXIS|SshX\TZ'JAK9S|T/ԍ$4LG͑H'r 0x'+Ph1}hsqRi2֏ {Oɥ(mu&'E!<^ڌx=,蚢zAa\wpv~oqrq<{/s"5Ւ[[6H\1V3>~JHN`dO 5Ǔ%ksc$8G~4!*8l!ةP@Ў #F4@R3z* C@~ޔ~ʣ.&IxCx؆S '~m).!$rI5aY~byэxurc0ȧt{pu$q5}1'V@I۟zz^+BLUOiEFYd8#ojЈKv.rNq If(HFxS&F GiaMdYAAti y4?$*/#-kr~gi:Y0̹"aˉqDKA4?C%n& ]Y\r}+N4FHk5?rN H? f}0W]T.S 7ޥ'2ؕ=#8O^ RzH%CϱX8$(z ,NsH=0VՈK$a:]RzH,fHRCYp~Y.n③ Gk>J"0ݜ|y3Ƞ~ݝR`1 DġS`"]o vPc@\n[rkV|pPI"@EIoTaʼn(]pr!{wsF W'0>Vz%ԑR@y8U+)/ yV,w's47E{ 4]31ZHOW75bUbU8"3ǵ(d_KX*K`js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/lemur.jpg000066400000000000000000000115771357507750000237720ustar00rootroot00000000000000JFIFC  !"$"$C_h!6 !1A"Qaq2#B$3R1!1"AQaq$2BR ?TeUq)(e4׾ Iq$$Upy߾j:FD![9I8S&RyX4j@$ G eW_OPrI Qҭ1ka̬ iZ|15ziiLdB/Q:HX5 {%w8kTeTQ n{\{|wҟX,R~I*#2k`,2MXS 觚7 5b{\a϶!zmJw`M5$$; <Re))&4(ۛs-lx6[@\5%p{$/Ep5SMW,\ LbDrُ-uk`):W5y&|fTTqұii5ImG6b8( NҵnzEUHT4nI1IlFAY &Zr1UEG0jXΔbulvlx_-.c9==$nC)\opQUc8FbeuW*InA -7 - i5 I'IQKn̅ [oZ,i ly r.X10l#Tī.!@čEs e{s֦R`l seB j,iڙjGD14@FqO kʳ_VMH?W#ZݠksaYaiV?'ǝƟUIn/l}BJ]zw,I[[@X;VƫmZ*sDO"ȿLQ/Gav;_c⺾I@FVap=; Huq#msTإubtmrmm,gkNK=ti)s;|b G?) #o# -%,t o-e\@Sr42И&_Yyv{6UW,Y=i4"Ii_s)jze2YN{ob`N^!3>-* M@=)!=p.3YoLsۑ80Z$~H–DDEO7܂0]=%-<;0nGqe!HG:4ڕPjq"T6S"Kc7ď`4~Ly]! ve#5Len}2Z:'J ~yj|1x&4O15Q{ 񝅫AKV:IO+I K ;@۵[KO-;'OZꘖ7*8{`2'U(#K$BPl{q/xᨗSVa<(IArYIz ae{L@ԙΐV͝NfsuQI ,QH6ePpPyE-Y+,ʶG m&F/Ψ)5w-$q,K| <5A<ę~J_e>&ϠK&c1o +<+Ml?9I֟#OH\u9v_1"q66x7/ȫ!"T٭lne:[pd&f$m|zq5#O145.CBHr96=7YYC\Zef[2ߍ+[7"L)e"\+&xQӱ]$\^n")Z$Vb)F>e'$ӲƢ`OFȬ8>aqntWg a 695%;eT[m*Ý|UGggԲHuHEk ܀en6Ǧ"8TYO[QLGP$?Zp JOLLZdvdAMqXnSoaiv@b طc}l Pf'J5/HP_aCq{07<(\ A F{m~=RZ5D݆qp/'UZHi⤧j*%sun`O}C oPt/6Bю. QRu-w_V H" \=キ U%V<Q{T(MWһds$Af$vÆc{M @Et $p%2H|m ~-sjH樉-#0ԑ͝omuٖmgxv5&Cf}$Y|5I$bOߜ $ U4' ¶盃q|z࣯ZgB!Z;E+ҡ* m{~}1F R5;s9U =m~Pd@dLC.$k_`~p,AjD!T |Rx7~;b m2fx"v/m޸V3\1eUy.a$3!*knNﵰ= =YZQS)R]Ůz|&J'>߰NWR_###3T#@Qp{!I(ij3j JvdAbU@8\UVfjsVYmI'wv cbIkNYou&aQ-]0cH,,EߏƠWKn]Ŀ?sV_MLs Tw3ƇNiqmclYt3u# =yڕ}oe+5ʖ%-"=d2wwŇLET\-Ǥ[ve):vp>\8;IMN 0ÑkuBa {EiC* M`7'1(XwEmU$2,U&'y∲]#nsuVz,IWVGK TpHb {q0ƴSQMFXu3j#.m)ZgiOAA4N/Tcʤ$-6s5~Zz֛ Iv9BdQҵl5̲n]d]@l;1a7Z9bik`V P`mZDR ƧH丒I&iDP] Ӷ,ֵc@#sf'Ii;>ߏ\&0XF*׷o59iD4UR*UPwMo̚-+g^PEkWR"\b: Ȕ񘂱{YEkz0ގ:l$+HVVP^1_t:V(',i3S VXDDX6Z%oU"1@`F9={k knׯr6, (ֺ$TQhC[I`Gb889da=&)SZ%'` Nsqk0 {$%q6daݪbVJ/kR4yVh>BPT4dǙZM^Tm?U0js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/lepus.jpg000066400000000000000000000112101357507750000237560ustar00rootroot00000000000000JFIF%%C  !"$"$CsV"8!1A"Qaq#2Bb$3r/!1AQaq"23B ?Ɯ##3$vvz* dJ5TNCG`4/oZ|m"HLJe[O⣜ࡀjt5h՞H'b/Zt *m+0ݯ=>'qi~d lsYQ[2eṰ};[0"c<5U FGBĄ*;۹džLՂVZhk v7qlY6ZH$ #i #(BzD2 ܼdA_P^Ц#QͶ29A̤H(e<}7˩U5(ToKۋlf_#UXʲi;{3\f; Y!oośW$FKIwqpx^GW$0Ve|0ͥsWI RtnB0P/O_A$ ^t0s\0!pg;3e$5x'it0[,.lA6\Ed,QTfبDAO[yyBٍ_/RP1hd&YZT>;[`1 67^dİj3S9pr-km74ֵ")ET%=HR`F{vUOTPI#cq6vXJtt>G-cHD X Μv܁~K[* R{{r*4!hr3oQQ3~oΫߛ}yCS XP͹~{a^6M qPV%R4mV~7J?.uy[VkbMRQdUlMA0f^2MI\l9l-dK3iwڴZ~|h3\ږ*z(vBKr?.Y$}  lqܐHd$v|;ցiѷ@æ@-nT16YF YHaa{lI~qUva$)'cf&1l~qz1Lk'Q*X_~2BT, ,v v7,~=3-OTRWCўJQIq| ˫ޙJ9МӅUNv3*iit豣Z"[wZZs%\t?*fk{+EqU%fp"8i\谛-0ԇ?(I/v` >!.2zꪊzF(#`@7]탫i .f@3,-:Gb8LT5u@ҿ6YJZ50^5U.A'xe(KfG4#ʻ3+j[9YeSĹI5(I D!e G#[PJ,d'gcC֖̑ )49EV`uPG%cBADE:J|u+,b6}~Ku1E4B>5(+ei(We'oS3E=K`W[n5L9*]Rpt,}87xc Z6s8gYIacGӿX9+CQ rjvt܋|=Y0[ZᔐoslF)^4FF׶H;WC*!U667ťng?#Aq.б:亠*,6ĦʳRf"E`u &n2WU4t@ād鮓&{ -e4/tJR멷$lx :V5w?:1BUGP96m֧IwOgheX nN1jq"Vヹ(r㡯ҼllLZ x~Ҷm 0,%caͿJdk֭$T1Bz97LfiL5H ;~wMVt* 菱ݘﹽl#F[ ;i,h5z{0̪l%+"KP2b`z#AKQ"Ԏ3accA-1, LTFܓ8OEU+"5Fi5X\Q뢭~^92FZVB {X}n1\%5(7$HkS(,HvPMԓ%}G}+X[R kH\_~I0S4+eRhF, Dê>f܏;lig}&1Ԑ'pR#$sb y3h1+E$Y U5-)кfX܏|U>]*t;%]ͽ$t=yVB4(q}׷{۽vU9Q_.]Y3GXlm8[JC{nv yl]df+9'v7//OL*u C^$:.W@ȷ+z3i/k bb`8g HRas/FBﵱW 4qC@&&;X -i<&٫M>#iF0${폐Q 6]78ƛREM=tl4Ȭ/6TZUF?P$2 Ɩcjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/loxodonta.jpg000066400000000000000000000112111357507750000246360ustar00rootroot00000000000000JFIFHHC  !"$"$CVs!:!1A"Qaq2#3BR$r2!1AQ"qa2R3Bb ? Ԯ4 iV ⦡\=,{ HjFm,1ƺh1c8*Ǟo}0B!*HTNcOkSU*MOFC1sv`lmI쏖. YD5)#x}Bq7Zj DF1n 2`Y(.kreVj~dvIi@Q&Ãʼn(!O_QbA$Zl4%VEvi215!$^5Md VnA7׸9H=?|sʳxj'`5(;XqSKP-?#F_ֲ`x;!wD3 / aXi᠊GI `b~=]8/)Z;0> }޸Si 5+`w|f)*BLK@OtI6EaŇc3 Jumk+Vf5Lwy4A$婅uKH`Nk[~A}ёVPWLR,E*;ܬqlhDAO34H\BFSGe*ϵa&]J$!W?L+( ![:IbTP7 ,5[CK-'ɦ?JmzlK~RKm]ਖB5:xNڀ!TQH b0;YnyٶjI uH ":ֲWupF:_uOhz,icb{|s6ʺ*rbx]};(HDNTecY*7a |1WuP3dpSVfi56Ccs><`muSPsF* E+Y} =EAM {1Є/s F"= [J MH3!kYSBc&i G=žݱ05_IdG/ic{.fuUULә,_ SSU {`MϹ :F_Cbwd OHC Ari$2E s(;=?8br +%̤}y'3H:6 یK6U==ZTP0fݽF+RR25-?C(|w4J?,f ׅ!_js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/lutra.jpg000066400000000000000000000113521357507750000237640ustar00rootroot00000000000000JFIFHHC  !"$"$CQz"A !1A"Qa2qB#346Rrs$5%Ct+!1"A23QBq ?*t&Ou\xZ'ԵJ)طH2kLS^Z 2 AҢ 5dh\IIV/>GuR1dKBRR~%S2=6NTVaHDU-mRu SKf;ѥI*q rP $<Ͱ~Ɗʅ6DVBz kW6r}QԉYZsHE*P^Dt- oa~ ZTA>~4<@A,e#则m^yG;(3$jH"V kJp% P^ޠ~*QXp1Pm7bIK[2+4)HC tn.J;':eXm=JT ;i sI@䋋-lF*jtdfKϴ9scHFİAS ,rY3)\`$ehwJ-c{㠈y=Lsfaj,u9Fmw;d=Ypޭ:oЦ5.۴쪽WPʦ:- O/2)TW8ہ`xas,u<@e5 )&^Ɛ^^wRRUafyIn%"tbꍴUdG͍G,";QD8XCdć e)NH#C~Ж- Tm;W T ́ o*N%C{L-gDˏrZR qۜȬ81GwZbHCu%@}P,DSaFΟK|0/ơS/U.kښ?EZ`y:`z[ "T\_) PA>Ai!SrSٺt>TLW5ND=:+NO%> Ż6bYA6RQ$dJDT$q%>B搤ol g|ٛ"vnuL@!ݴ@=@8 sCEN.tQ) ԗr#b#4iMMc'|GcXL81Aʪ@wk%͏maC7iShrKIJJygŸ |U:=I7!Њvb\1Ru$tŻQ[N ÛbM<[4pm_od<v>o-F]$1`uAu,%Dnx;=0~ZJb2Rޣ焜P"eTD`ޜǴx(CpR),Nj3.zGvyhQAEQx bFg;.TҴǏ}p,|\W'0Tt;*1#ؤ+^W]5Nr%utwSകxq,dCEFH]eiʫUjI h .v$6oY=*P[Ԯ4HଛkG,P.4s*J\U|N6fXIq4䂡J r/{tJws <D1ϲFIDd$k ZO;= #ZUmJlO`L"JE(Jڴjܶ_e"bx;u2X\*Z]X~X^L'Ix/gĕ[] -vB|lИqe0ndi>@O߈Q "Rm: ̩ڂ BzzۛIfgy8w)S%@{ޜ퀹%?Jq鴰\lm}V 8[aʄ&2Ȳqq(}A$X([n_ePX ֒z w¬`*O|9!Р pCPVm4U p$#;l&+KRێ$^ֿ>cvju*3r&mI[HYz@)$\rm~5geT y]^sm.Hv.Eӆc1bNJBl@RV` kĚ8PcYZ*N<8mϣB.k;xR۪:cj X7LDGVJ{+wXӖRڨ4)qВqm"7 ztjVqIEZ0Jk9Bnf?# =-iFHEhVSnUqyzJ Da`@k2cEd9 omI:o{0_SPI$7@zYW 8P^ARn"mTLƐ^ut,|o`Q=o܎RǿkK&*;٫^Y 6*6珎f qJLHa sg)NTy $2MYhJҀPlXdV,*lԢISO+bH:o 7c`. w;LE5PŲd6[miUzLp'Dun)J5 ný"$DOe)q:xAH''VqbvM6.j J"K:oo 9Ho!uٻo.u'qcd&)T=T4%$JwĨsIKrGY%m:qwǮ4t6}>xm 6Z.:+ojR}&&pMͰ׼11ѳ (\K ?~ʚu/[J/q1I T!;jȂAf#]= ( H!&Sl(cuJ=c';;Mg*1kLnAo:wc01=%M?g$|Sb?3z?/7Q.~8O:f3/N?S +BbI3=G*A]Xf8dt0~8;33s3gK@yIgHaV_js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/lynx.jpg000066400000000000000000000075221357507750000236330ustar00rootroot00000000000000JFIFHHC  !"$"$CwS"8!1A"Qaq2#R3B%Cb)!1"AQ2aRq ?I`2#109oOUtZS\%9m:Hn+HS0#{ ]2n RWF\=qLҵD=} 텟8$WS^XQ0c` ù3cL9%w.z}&p dTȭ)3(R4)ER[+z!=a.~`dBh`CIUXu /hFϯrc22MзszL-5:ww'`0a#̨8! jLA\TG *w_bl*`Z_w3TH֎v3 #GT~q0I?1* +r;$%6eqe7.IՁ)OL!ɧb/iT ld016Y;.9 9j&HMί#ng"dA ;*jS6=P~{84u5qGsOH#Hk,y򧚙5p0c%D}G\sV$fYK6cVfԔԘ.ˤu醳gUCUEf55BSp?s&,{$ POgHP+LwV֑$~_vJԬElHyC.ob<k>=sacq i8يN*LRL@Rz~j*9\J.ƒg$Xw B ӳ|tjQ=N鋞X칉TOiXk'WfVgp4۸ #UG;z%.#<|Fk2x BABUXvwφڎL)1S2 FQeS-N$0dWM irjX sz2eW0$jEVH`uE^iSJ'j,^T /~-i冊Z(aXHG:6۵0gYgG,ӘR@o6ktLC+(FW6eU+ǢvO` 3 !Jzj"ۡvKRauQ4&9|ENXegC LLM4iMzOBcӈKA,+`Oi6f4L=CϧK H:Y%9BN4X 40b ZwQNI [f qYMWC+2p yrޣ1|"S+s_`K i`|FV_#*0TAƗf1/]uG!He飐>Kd٬q^RW1ݮORm~U-UFYLjT _c{֒]faMGT*4BAUs;#Y]QWLu4Ҫ)DkelzJ-:@0l[p0FwC>Z$OPAéH͊v p}AT.Tc񆎱HC';!"Vb۹t'&[m7leNNMWrmG<XEbHbaT,aZ'b:'^ĬR-YH%XXmqPe54eT& '("VNS&V翑6道3ejXDyckS|lvXRL! e孺/l-Z㼆Z!Sh;jYø+&ZA]Hs3Xj9}/6UI#lz.1 MY52mX~qs>B"圂),?_j.,@8bD=yZqƔQ'4Ea8t2xP<7%0TFP`#r9%UaXg{&8l :IfA*M_poyc -M6x{P_?Mĕ-+XIcI;.l 5"ҨFLK )]Ǩ\x1^FUNׯa;γH :ڭMQBnX|.GJf-jc>lN C8$c)Unqd8T"U~[Z۩YgKj+-t F3͙ċuH .m=}1)R̚e4(.ň5S$)24QAӫ\qyUFl#ιXa} yۿCYͿ*9FgK;cf-5TMyP7u\t6fHV&)f}Mb /,)Dsȑ$b~_`oNf.@t`l?#o)ZPy~sHݴƮH6ƅrUO=H*O=q,4(K'{}&&)IŜG;> >_Kh%js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/macaca.jpg000066400000000000000000000102351357507750000240410ustar00rootroot00000000000000JFIFHHC  !"$"$CZn" ; !1AQa"q2B#Rb$3Sr!!1A"2Qa ?βm9IQ_/"ZwpoN-<#hb#"3F87Svcx4}>]%E zpqĶWAJwamq~F* ! ftn=霻7:"\̲Xk>\rtv-tu .[RI$-7nn0yƍɞQDVWFRlo`lNj 2Se Bجn^E .O񞱦||iCIŕKK(mŢ-vՙ@6ߧݑLuԣ,/_@yUJјuE䗨^ƭ=T ng"(WUBO%aǞ \3fHbdydEDGKOhg.[~[}f15RM3i/ͧCN4ف#[־xrtO9vif5+h Xt 9!srOQM'ҭl: 3;#:Z JozhELL#h6`};G:1J4kWip !S"6u.S YK$S2.Yao^7 ߿eQe0& Gk mq /b02UB`b,zlA\Q'TeO\~WzȃnCtat`*ѫmB,V5SGV[pR;h-[_3w+%WYNmu$3G ;cc϶+6o9lOCSH ©!G2*Kp+(r-|nj3|&DM Qe ؓkӜ芽=OkV׬#y A$;}|;T$ɦDjDVfuPy_.EJ)H)}vfO%ZR/`g"yTYB\lu%slm)wQUH~aé4]EL\=;:yn~ǿ62ܶhj!; Kt#F.fIfh+C}m5y2U=%t1F@6p (j)jUP:bZj̗c=@nlc:ڞY7) V=V_'żs*r#"c<}1Υ%1)X03aDβju¢$FV=,ci|M9 ~1n-63J|DYOI?eKYP')I4\Yhw3Dm=y'$(C|$Z\'.͵ =t=ɉZyZGITd14IZUE7bI*=ySƑn6٘|YzO>h⪪II ȤF\k`O=L0hZvt1~~Q^`_E6̵NaWKEMZxtG*¿0WbX v鎨$[9%6OǴ-yUS.{y1IO 8:KWJ|8.Fɐ2J 6f]`ǽNek-KYHlqfC"nMytc)%aQԱBN5#[2oJ-3AcѸҠG83Rd† rLѰ{̳;~zNb2zf ,jXlm`lF SO#&ĎMb06[_X#(ݱTР8H!"d`+MEPUJ7$ӹܪ 2i=gW%6WSbU=!ihE@$T=Ao9ZC'բ)?- ͉%<&ʳ9MSS޳1"Gq|?f]wvNj -]ܜe9!XPB nuOA3HrgP6s),DZTrc/2=39 R+O#q tKbǍ,F H5 UlUQ+;g=L\\"8hFŗ+Ɵ= ΍&c[nw[ԐN,|k+juO"یePάp-c"S1*α-ȸ߁Lڇo1GkJj4YCQ*IrՏ=O[Y~]CD4\vSShƝeQ7cn_LKj,˘ |p ښ7i*6”+͇lXEN/r/ [,ZK")#}9&m+ȳ}C @$n㢭,H-F@bLi+>V:fgwb"-SbMcD9tYRMfcq;O|ڒjVVvkǾ6!ȳɣE>b#λAB kv Zɾ$IEwQ{~noaxx~4UU K/1Cŭu<X~? ̲wZ R+&%d+bM.#aʥuC7q{E\"sᶶ3Hj鳉$}̉vV`ĩ|OԼӊ؀,/8gRaea]c4A Gk\z↗\%hk6az|4Uk]GOTr(0[Ͷ~' xecˡO>Xvoajs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/macropus.jpg000066400000000000000000000126311357507750000244670ustar00rootroot00000000000000JFIFddC  !"$"$CzQE  !1A"Qaq2T#BRU3SVbcr2 !1AQ"#2aqB3Rb ? rXޮvk\|8ϑrB-#JyJْ%q؛yaN Pэdh1[>&9,Z)\i0ǴLq$}lAF )zlILS( hI'Yڙc%Cb9I%Xz-X;ڸIS)5 KYu82vJ75 )lBץѨd~צڅ`ե"fljUs&$.- |8< '냩F[⺊J. VnK o"XԿcT)*GEm=DuQٗN$6)4rTAU4i+YdR{\xab 띶cUSURhD #}Gvbd2.)ͣ T{=4mˠ=M'Ք:ΎHfj0.à8BF.I4jf$_gǍP LPeM$hi@"侀-f8ZxF(8ﱟw^Q 2?weAݍE\s#ZN߂i!* mL\oeaf0bBy5CJ4hzCt:|+Ũo%iLwxt Z?]QPΑL ]'n؎X` Y{#iOG$SC"0ܭƘEJ*wuVX[! xγ|&` >tY4RPʺqL Ah Ա@SNۙE&o+ b骜 0ƫRі+Oo N.[ |,B'x䓒H6c<a8ih[+ʤX) I ;B)*&+ Dr/GQ< s+\o D|&7[Ȍ1>cq<@˛HUM5-I!nD<Ii\6GU[X*_%# &tu^sK$"=-2,nr)h^*eb46|Mb}mnx6A3ZZtHlT,nO;093sSmժ ؛=~n40w&Ax',vf8jy4e-Xmyw2qt%2ms0 ;ϫ l$jeHMl.ԛ|edB&epM.yT)ZX9lO%XZ*.ĀM7 %U4 I~[(ZhrvpBY]"ӕ73Ёx9*CLj^5+hA(ᅤ6qb.Kć̣|*A j'k@ewtZLZv>)j~B#+h!\%i^t6Qc& }HxM4.lX8#Fځ[Ya`5^se|cKU 8`66<?A$*bಐdqUP!6Y,,w;) 717\T8ΟP@M 4T)QM YU:ymw2ui&HèTcawkPW²,Xbzjƻ&!7`{8:6bfR$s`}<<1g`(9h[:iPn@;+˖׷Mw,g\uPqq.HqC&7QA[%IJi)A^z#b my-evU$P˺M=OϜ`>|[:G$sShQ&b4 %Psz\2\ 6&<Z[!Fw8e`L[\*eze,RƠy¡dtTQ,U4w$~/<'ZEc}tߕ'+PLj-pTG/ E 0휚Pm:i֖8T*Gh ޛ1A0$ͽ=M/I$!'M_A 'UT'ۮV _:x5Vy#Q ʪ&Őn'U_5YGY>Sh9@Q7oI:D}ADey]~=D2~_(P5Z,2-qrrMrRd[)`jE,uSBw*lv<[3Σ1俄&DZ㕣C](1~]E;\JA?CYW9%?4g9PY6γ8a2%7-¥gN Wh(.O+u5$~|}&Oa[K_s"ӾHرbXrk q%zixgk)Y4o;OkӋ!SE]5ǟ1rzW=&8?Ph^S+04v!&wLs33Y;CZ㏌:;>rCZڋloǻSdC($xEoԵ%L,CI*5Jsn$o]@jԝDyI%Z9pEͭp:#jG3 >ZyҧZRM:PAon/n~BLkj/&P)_WmKV8r#H'm@O&ܴV,MWWZ.ǖp6d '6I62Ag^챪JSh7/32d]@9G`;6? zcX 0,D$9!FX, ^F(-Xhoe<|de{~u\XHzmHI:Vךe"kٕ31~utT!QA|qۊxt^y6<*㐫 OG^IW6P:6>ǚO`+=XHImϬZbh-Opn{~%hhl( Ry(}B L2=(%&2{WIs(-ˊW5۰7`JePY~[lfpđKhᴁVX(5>"?JM,3wJB9? >}Fqk4srG85KKY q*oykPYqLb5SOIch쎇H?@\1c=LjIx["ĉ T853=)v5MvRE:F@a>ݎ3zG^ ]^oji\+: ߎÎM7[Tl1d8.̐ǜn.Bӯ4HݨǹT?JU07Z3䪷=zvRۛE2w (e;[qH Q:TtHY玼9uu6(ޭ0G]Á9Hln`3yYEAB\;~\fh4jF'm;?2\e!O#yK⿒ۨp9sZ@@wo]WQ G 9k<4+ξ# rA?\ ;֞r2G GB4Gbº.,᱌tO9,{A^qNt 6Z Z5QH'=)ZmlMʇA''׵U4Qvln7"A$,qEߦW>5AnɶMR;o:P16Aŀ=Obyy%Hc.vB-*@'nL@I۳e؎iXnR8zCEx'Rw)s!iԎ+ m ܳGSip~@}T5r h;u+px(o/FVTnpH!@h ۏAۯZece;V|[m]]AV\H H,{4%P)$<ط ) Y0:_ʆo ^;IU' cFj]4)2C<&߾*T={O]/ڥJϫFEԩA_dE/h?uRtaГgi_ݩRVEgݴR' jkߗ; +?Ûn߼hR*js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/mephitis.jpg000066400000000000000000000144431357507750000244630ustar00rootroot00000000000000JFIFC  !"$"$CxR 4!1"AQaq2#B$3b3!1"AQaq#23BR ?rZgD[c޿Ƽ x&7RxKKa|8Ew}~"DIp8ܑ#gETA ,nWҽEB|D9`[g8cD_ZI$tsobw)`#X-\NĖʋdG\cwܡG*=}F?֑Yi:+!k`Q肙a ?R$I+%-=wXnl$p?KSh+Ŷǚe?ަv%g-0FW[kyT-DĖek@퓧<}XфQcJ>{oČ*5ܣY Tۘ7v'=©RR$5T<#yރbxh]J yڋ'^yIr6vig9)n`cņӠK5fuQKsOZŖC$*'BnqM#)n%USqL{|ˎۼӝh7٢UE LJL_ƕ~zA)Z4UV5 yJJ#-d3@lݸ=3t˱T VCfyUM5LH]* @uMÃC\y[ŎnJ;aTm栀t*LHp9o0zQ# xG#ֽ=kZN ` [9<ȲH@#oh3`}j_*biWzB~g&mhՆNTXMumkKD7NKt&9GƖ=agxb<8I>Α vj'Hiէii%T_LdccӂU"O8le}Nuq eswo⭊KMhQ>$/&8M W?tX5!%|~M.,ғ+cSx-3(`!WNO?`{WeES@; iuT\Js[H#2jȅzLR m%E7*J"lR\gǸГ$pC Ӷ^uSAw87ީ7IΪtS U%eU^4{*Wb >֛j|,}%iv-,KKBf ~v=pE.芝weIn(Ѐ;e #[`Vٖ񙞾 _ZY xk%Was}z}*D,w/$WhǒA ڲ$֍J'xE#rOM"{6*;xqL6:غ.l:p̌LnT}%LVRM TvS+gY[GX[ CI-i(-hpJ]` 8:ZO^I|pKXE̞ oC׹pt#u,JI,Q.R*̛=d,mnTOJ d@+$;qaie-KvuAK< xA<5Gs֮ò~uΑ7*01yƯiF+ouLeUg%u`; !xU uH&dBASΌ>5BY+? !KW7i]iPxd=U!@i ZZ:HB{hdhKB2c88Oa<5Kh5\"r;N]kQ1ی_Ɯ`*;RqVg>Tѓ}q>aI4pJR!هʌ$#s@{WiU+>09SPTlD:An~k>h ha+}K# Ymq^%QEFe0F2Òx Rտt6pw|69:NAV `<\aězio=?`oP x ;$n*@]y\gЃ4y$$_3aZ4/ŋ)Tk{q#XxNGji92{௔wc*UuFcNT:ޓ:\O<hGm6XK=₦IƕC1 bT$EVӢgӗ>:~^;jKN?8<っ\ 9,z;zV,V+U' Lldp>0=I~O:K@`LR},%9rם3iʲRWMݴ\{ts Z@2|FITjr]wmh0[' ]bO2ʾf='>hjBJ/EmJIjNiH `rHqItac7Pu y_s4$ϙps'y׼9s*tщ>]5mM¢xhDr>xbcΫ w~T wXVPՁU?P]e\W8F LA_q歒1d#8-V0N8]%+D&US54ei0Y?p]*-UYvVKZTȐ*q00WqTx&\0~6ZpFsꎤ⭱vvH1 sV3h(M"hn1G#fG#­w yDmI^cor\ֽ'r}%ubi9 &8Q7g[6ʔ*FRMޤUq5=9d$'jH<v02\c6hx[%AK}hoi0QȮcjK _4Wy(s4mNF2O> 0|Juuۭ![ D @K`r=05!}F]ς Ehӈ2Se`FAwd)p ˿T&UUQ%T=\#g2" 6$oks-\;Ib I#=Ό@%Q-&yxnPSGW\/U ,3gJ瓑23,p2Sm AS_TtBi)L1bm\pܑU9ENE%Ҷk |A ̻ *0ʯ xǗ) +"X )9|?֒'cyʨl(Ea 9~U U,@"7aUV76Gl}]<j7Q) h"J+qT+ObMk{謲{plZJ4%4SU+")ms#wxg\,"U`jJ)P\ XC+À({!1ru'[ݬֹWh)iJ± x9q﮸Lu?ݫBy ۝ŠzCo rQ3o3H24&>}#~EK,Hb)bT/.䑞uroÒu({KacO+`+bfԐ(\b-%Cצzdb6#c>aq\<9Jۦ3X4@UGo܌:0s)sJhrJ6`NPDJ޸_8e`?ݹmǘ45q8zbpv'C2f֓2X#|bNº S46q'4 q˦:* pr7*d0¬'Q iOePhΫ@bgy"+: !HS#n8%f2ep*j'Zi"2Cja4&/J;"=п>*fs>,tQb^b^sԭy3 $sRCc[HH+ rJ5B]<{zc̛"/wx ]\ÕrG("jZzjK( [#ǑM(HzG\^(B}&9,l ERH3JeUBڴ.URSft% uAI^)RH8s7ljgtHP_،r@09+_$yY祌JCcXKC,),9`*'屮\{I Aco2LȚð%c~w0Hkʈ@6Qoh֬ fO2p^Hnƹ2 4t#X"jWLX;b ؆V3ǀK =;◫u`+ )!#cdC0V ^*y ԯb@EoT0w;/Π:*|r/5qy9)]2H"/qhMvfi7+TyWcԌ."g9yj+J#."E_]6KcS)DzKهQkKOG?c: !1_ܷqb/c:>v#[ќ,1UCYVihc"gau0LᎊyDG]FbT禹T5j5xd젍 \}q_g8PȊ-S8 k# t#S "2t+vGCYhije,hw~T hJ!Q{o3MQ \9xV2n.q1@I`UKCjIڠr:q3(Ehj*ccGWO{U[$,$ V*)yׯuTѩ^lrf Jf*o` u"YةĻ7Qw5bl< ̅:d 4O"zDX3E|tdY#Rn鲶65Oʉ$Ãf8PUdA,v|US&Wڛ1iWs -]35 lvŌyWAT5҇b W ]}=jNQ^/Hpלg9Xϗefwm-r`?zҦzC~ jQ%)Q=P/A'&iMVUXډB?/ܯ9J ,Ni!f 7>sȣ?^kQYS Ξ|w4f㭅R#DC稱|AG@V6AP} Tn RgW;2P5*)pќY1QhE d~_#R37 F-U$&hWX6t>m!IQ PP q +n[Ji ME.(' pZ]%_@"v?.2Vt2b[O[TU@_/fX|G-!϶5P)BeMHV3Dvm!WpWq׾#j9Hk' blŅc}vcFFb uRmӨ!A; oPCP<~!-=~SBZUX$]XjvSeWRNYep\ve3UK<6j7FܭÅgO$2[ O=jJ:y)92\/ 0 ឦ;Z5M=Ó1i2wy33Y͐ Ge7paK_m|@,zfy!o2L"*nA͹lC\tYb TׯC1rJђW-İӉĘ,YjcY70mw;qyʣ@U;ZKR 8WHK.13X_#3DdUV7ç(P#K}.b ISQS5SXI%d $"7ԼKNhxsX[X, "8en_ME-DZKG/mod\0aY3$ ml,ژE$`)R o|'J 8vN[ƞ(ʥń{ p\ %]ugHP?QAz0j+' /xjiZj>,uj!iZWt3RբwO/̶[R1I, V,GNGfB6ii? 䏩ZrщYc-ڼ)G,W:׌248l^B؎Oy]P.K!rJG5oi?AUz23$zX!%"s.ﲜg읨Z\i!_$r>9k9h!II4)U`|Xr<=@`mpx{w88N~i'4QQSMlmD)I~ح[LHe~|늭+]t`Ghϡ)(%^H-JPNmij5vuSvsL>-%##TI z#Q#l9Oj| smڛqDGAuO :J,SR;lr} yS%(\VVGz Ӡn%y{3HVq.32Gl,J]mn*8S"ڨ? Fgx +.nJM+b;CRG=8NĹ1lˏjeHV-KZ4d#%/,6WV(?P;|g\IbHPXZ󄃌SmJV5:H6V'PHZqP81Rl˵α$~;(;d%Z0zԵ,;{aF]mūmr+HϼFpNzۧ7&2/YL JߑR6<sm.qSPbV!-0u7q|A/a&{wQ5J=\9Sf!۳3ƌ.%)xQ 0sΗ/w鋬kN~h cĒbyQ9= snmyFDk"#q$#%gvVֹmm3LI(gr;_QctB, x$c>sް: w. oу%XIOOJqoW%K\OJ=Fc+qGLuPpݲRUqA ؞8eVM:#%zJu<ǂ" 2Fp> Pӄ7I=1gp x@ihIZLxO:SΉ#)* mTJ<\;`ZmOo:R>β:fd.#jB]eDA~ĥp ʍ[WkotzْW|uT,d JRGI 5XxnJÞHDH At2cIVy*? rU=tKhsV@v=~UDX]cgGX88|Y6j#^_ĕ(R(6xmܝ%J[/g<' d7Dle#*}Ƌ4KCPK).7=-o/ߑr.ԴǶ4)'r'mKp$.E rb,,"GJ<zSd\TBv"D(V@Rq#Hqζ~w1b 4CZ\V$sqmEPpZ``+W?u#-8TVi^Xڶ.qa^B#Ql睉*k?0?RV5g"Ls);mr+h= 09Ld!9Рk>^#>Z3%snK`jRGܛo~$)9PJ__ +9@qqS)g[Ju$jja>mL/? en](jjH U@fsҐQn,FbZl h8#qx3ԅ! BNn6sJ]I:QQ'Y~ҡ]wޕ*`7qFX3jTL=i^xs/K$JBy@j84ٯ|JdqlBCJҧR T2mRH˝*U=H$^%$^jɂÉHZv*U)jz^Qp 'QT9=ڕ* }js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/monodon.jpg000066400000000000000000000073461357507750000243160ustar00rootroot00000000000000JFIF,,XICC_PROFILEHADBEmntrRGB XYZ acspMSFTnone-ADBE cprtLdescHkwtptbkptrTRCgTRCbTRCrXYZ gXYZ bXYZ4textCopyright (c) 1999 Adobe Systems Incorporated. All Rights Reserved.descAdobe RGB (1998)XYZ QXYZ curv3curv3curv3XYZ OXYZ 4,XYZ &1/C  !"$"$CO}<!1"AQa2qBR#3bC$4c#!1A"a2Q ?C& u QJ #xTSQh(P TUz-EYD7Y3@`QU۽[,3Knr߁̂ׯk0 shdA":sdZDRHX]eYNAb{h -@6Ҁڠ\bT*&^uсPDԮk, x)՗nH5qd 5+sh O8ULu$ήÚMnn[ɰ҅9 \ԅU^+X_i-ˬ~Y}K.o fĽPxRGrGh#,yiʤLľ$X^\55 !HWYc^pZKǚ~,}OԐ((a^69yzJºpG33,t/ US|96 i{o7@ݥݼͬoЎDʷ".~DORvqqPs~;Sb_quzvt4-=r&]. 9Mo4?N^{q6ur֩q {rs}V 4$Q`3od|W/q w V#FS3!"\}: H>*@sCt s]kФY,O%XD}0H ̩mhT1*,E699,Ǩ{5DXrvcd=AKwSexJ=mC2:K͋nT#=ܑιϏ{oׇ^Xc~II2W;|vO݌oMi{{}8ﲞL@sϯʗ{E?;9YR[I4TG-ȆGH_"z|v\Q-/6%F=O:{o{đ2: >uٖёZ᎚ 5>Qm8g[oxէI`bWG?U_>Oo}\iG,[]nuW#1O/ZzrAe$!rFz<<):ZM`ši[%>uMHK"02H-lЀ7\t(/mccxę ^@Acr7ϭ:fYIYJX|||E{<tWIC ,Ths@჈>LҸWKc0FVBaCwso$}i%]o/K9g#'Zj߀x\AopH @ ?jO-mFB|3Zgqf @fr3[J>ؓf̟2G>U nc˴ AGl|jnMox7цlnR,mF nnRX s"Nmm-In&d|E 4AXmy/IIʤҏUqX6kg2 VkxB@q@T!lK$ @E[i19H% ͝CA EN ^`P!5s%Ҭ+ЉXnUZlu%rfy g֕v\T[YvVی{hmqPTi"T_ٟs&. #r>9#<1,Ra,95X133欬QMpqt[zZ~J=?sJT6 (jޥ3YƑoe8r遚5"r޵u y\c\ҢM$m!\q& iLC37fX, [ ݚ-^E=య&Qei%L#H') m%|(ʪO?EsFѹeF|hELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CVs:!1AQ"2aq#r$Bb%3R1!1A"Q2aqB#3 ?;޲K !$wugH-EJL)dFHy,T">6fˎbjyd't+U ;+%,32Is%Jw%M[MQZD0eǧ~.8,&ҝ2e]c(Cg \Ϗ'@W&y(ŝu%Γ9@S@}!jb9"FFgg*H [jۡRdH TsNQZV`ȶ 봴E''},`3@U'І&Q\Y*_"b ,# 1YDxa.H35@-O‘ELs*#/Ӟ<6BT0nO߼aIS jTd n*e t?q`0;T 8^Ƞ:HY`N=Q&!􂭽EGv\D_f;1=̚:BL Amu87p98'֓ص1'l`` g?< KX$y;i8M1`w mN72/r*e2KͿrTtzqE74;M/ŇrKlg? 0K$ԬEUJs1b[I#c}abpبl}DłI;9:#Wፉ/ϹvHD dFGH=N5㗧vR;eH1Cy`ס:[ „ӄ0u۶jC䫈!@r1BՏ8*Jk}*'$Rp8~$`׮:Js:_ $7_-{(+$Eh*b*H `Gjq [.6vZ}=yY)循 g0dg_b[\:5ݕ\RX /y!>5˛:6p'*e^.4ɲU2HMV.K85v2r(z'%-{:Вm[B\褒ODESt\%tt&aAJgtn*0*#n@Ϸ,^ф$qqAv7UIR: V>Uz,"zY2,u0n&9M9 g3=1lHRkM[Sw!H%\F5]v8 YU %*.[c؟a,kےIgQ"iUߎ5=+Ql lT~MwPr^PDNԄ-ϦtEnq֏b'JtFZgIz:j4yW}UZj:kQSNT[=r*3\r⮩]3cso=WAfWWY`p=}S6'L.-{n5Ƥ, pc$:(pLlwV] dP?XL3K#?SZi<}ɯn}~s\2‚S$pERT# ˥ܚ+p?9g98 kT"݀;N4s2IZ8':ҚCy'$J߯zW7%?a888Y^OZ*>u=pڨmrT4tǙd*f':kUJI;DFfJBt<~xō)IY"b9A=~^NVx qnzȟĥXGϾZ( K)ݫ"ZU4Xy`VR7U{'Mza"@#gP>11f̡Q{^4v.QF<|zkSM5Xkhgi%іFT]OJ\xf@j+C4TОLԑ̙ ,#3tHP |BMn!hSyBG10=wf{$ gp=6(bZՂ-ˁggR.wCAlA%e .G`% ߟ16ÁTqp+x=-,sL@x'mR _,qI_.4 *me[A؝ۏd~Qun}HU8o4ASTF2z$Dukaxdl}Rz#ۑ'Z",5r\hfbC4UQ=3]NZ0SڒTnOkZF'Dp(Y$MY5[ͿaYmmxW:C<$58c!`$躱@9mvõ\j7]jb^6lVB/L '!FzLt^14s:Yh!O^0G{YbJBFHN|mVkxQ(w\;^ ԷGcȾU[(Z9Fy=c%crwl;坭y\&0+SőBbOWL3=P>io}*\.4H L  ,ݮ9zu@7wͫWk,/_DԪ᧌Gf9A, Ω`bd5#<[KrR<հ5*,XvE ޖŇj;kQ #hhiq$(I_3ț ^-i"IQ"VlQw1餍ȉzչn)-haM,;!>âliM>5o25aI Wgԩ${B _I nRԥ%v_5B*c##9Ϟ^"NcݍMhE 6QAUi⣉f,;o3:s1Ik,Ѭ"4hz˱wY#4bEoOI O,Tx0"깈ϠgHP?O&7ff;9?e}]j:b]evOGvjjaRflY9 W>t(F+ӕy HI '2G[?eMZ>rlKr EdcN |rdҒGNuUY-*'urS2cQz髇-ՌfIOrV$V_zNkGmQF.\'>:rJnǔG<ݙnݡGu:SKK',=Ǩ7AŤsq%(L:f` 8$51i<)nk"ܕʮHcA``2qDa0{}[ja,1*uS!G^2=^RĀ'RФZ Y5\(OӴ](QhqWnJ8kdP1T;/1F|nuqV6%I䥫v0gNd/צC~OqF̱P8hJYkM2ad\ ߑuH UrjMe&K_\{R|176Pnp#ܱƫbY oD pO1XTuo\j |8w5e2A;žA9M01Zk?t:@bEd[ˢH՟ʒYQ$Y8r"vI"/-Cm۾?8#A tjm[] cWfq;N zͮ.V^gcm{ckuŽuk^Ybdqj;^V52!=ɭ턤)Ozł>dhO9 Q:o;i=3^EzcL<.d\hVap~WE{j8WrG$LȬ[1[iCQikt{h/E f 0;j\y<`yp@$/a V^u{Qc|х;6OqZ_]5LqCrN«6XOS6&b;`'OںC.N?JdlU!< rrz WlLBie1\| C6RM(JtJ1~Ep܌j(-KkOH攑zHߓӢDiOtc7Py1oڙ˂cl*FtNta~38D-|~qĺb buZ*N}aQSmY؜W-z"dl   ;Isԏx>u Vw+#9`oW[mwXHS Fxⱛ| >]ؓsߚi? ʉHcPI["u{ BL|7K›súrO֖t," m$e6jp jNkR "ܐ+@U[ \WRrpXmO(,@oPD]Ơ`}RD?UJyБ,Kn|˖pA➒,j^I 4jl,D,d"_+c}HZIAl4z@}JN#VUUT t0%?A0n!:+ Í6]6}bifwkx㈕,?<|sY˩tYIȘ6،zaa$`![dN}7t5aQ";-HM(e`rHߞ5:y";r" 2Osi"JPWbwޜcW6>[qb]QIx1ѱ%q%yY\H z3UHoo308 G52;lz=#@m@`{Pؒ#X(1 N c_Kڣ0?Ҋ-x w~;]k°{/l0ڇ F 晒d:8sT8Rs򤬀1٠/Ύ!K2F m؝Ǥ{$Pmc qWw =e nB?Yt cN i J1u1ZckH V֖d68ƅLIxGhHtnQi!ΝYb#ʄeA|d8_Hx\G4u{K΢* n|sw9%O T14 A@>?m(ARr5H8;TJҙ@9nY)3HIw'8VtY1dUsieHg 3;UU$CjW.&9 3J&l>(: t RIasg#8qEL4hP7ؑ֗o|`EfPKKs*+XЎQ#|𢊯>!]> N0'aYƲEi84>uӖ&VB0`<h`<[AsIϷ- VO9ފ)vFQԷF@ƖOoT"$0(Gjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/mus.jpg000066400000000000000000000045471357507750000234510ustar00rootroot00000000000000JFIFHHC  !"$"$CM!9 !1AaQq"$2B#4CRSb !1AQ" ? 5( s͢th*$P!w4Q3I&=)w:T.洳we 2w\ε,h]1 YړV;VFÅ*jS6E3ES̲Hu!n!*88g}+;gb44p@r3h2y!)9q6̠(/D]A5}(xΩ- x/5[)., {gqDJ& V{<ֺ CNgnUɚ`t;ԌYN( ԍ). eb5fT[̂ޏ4-S]pEKa^ n tW#>$ MT" \B O6ۙvbW9Ԑ~N})ӱ'+B1~$ͷ&֩(rsOʪtEC("HW>yJ:í8<:QevCX9"=|_aKpQKh8ѴY)w5uJ劆R5f!ƥn֩#yG7ʽ3D.]Ì9wqUܐS$94^ fb[ F 8{m|>L#s<ԦAܜ_*wSCvMZ|(A`{z>Êx*ʜs%;!#d SLR_K07äR+m ?v)p\q?X҆BDr?\E_~+m]*]59p-W?릿Or^-\*TGSφBr6cZTJ R5*;PO-@ ̄0*t''AY表9#sҡ2H˅iBN2z7NE(d$I\D%8)6Kq%9hY%8VKWmN- 9O:O0qGKj=+X)dd<Ϛj3w?ZvdE1tPnmlSUX$ɖ w3! Vu$y[wWUKH Z8Lt*=gL#IK]3oqy'C]$%9S'BCJp  R& 6.\#&3IH +wޥRվ3n\]O8A۽Z /TcK|FTwjeqk(9&]W'ڵ~,xVc9#Y": ؤWP |zI]h[߆y{#..Eԭm3$x.h$F M $ٸ=fegyZy=UBGTbNC^A0n~ m^A?>BT0;fd0s>lR\? Ubƺ ǒkTРy<[ |vG' {2ó(\ K+M jP<y:#څFT%&A$,}E!Wj <چqS}yӰ2aCv/΄$WhTYj ! q X$!O$Gn,>0rǫ,F1Fo<-M)&4e%BnȰ ke9JǟO.+{;=:Cz_咴ki. Y4QTu(.ȳR\S{$Ul?x>"0KKqmE%H )\ڗӸ&( nXq[RRO n=80J1w)dcƒDŽVxTA&,FXJ$ʘ$m-m)J.6lێr0!M '95qX CXZBY ]d$qGWP<^-2T,R̀E7"(pΫŭd ڔHKUt8r1\W-GDE`P2>7a\)oq2eq9LqM0Pi$:?)7.}q26ĉ1sYUt$$6PA Gmл4Hp2'{<+p༜kSAku\x4}o?ĥFAFI|%KWd8Wb88!qȯ)Wdr/\nf bW #Zl-FjIf8h\f5"Aq˪*@;}At4?VMV%!3!)dx*)?lutPX% -CA W~a̜39c?6yBH)*Ɇ{t|aa) 9ۼ'Q ){N=\R3ǧ1+̫c&A&jkM HUw.ZCItq 7y9F*1 6< $DGҽ>!_*fe",TMasw2Lm9HEv]1^/GVU{)tI%LG?ۏj#8"W43`yM2, |6y灪cf[ec)+o̦⒅%^mwiLj 2BBqlӛʈP*'{X&kM;Afqe4)"2*H!@&Œd,ȏ* d;! )ڐJ\Y?}7"Nx %q,AqRKrR  =  :Ԧ<*2PBoi<@x= zET0/%*֡hn? #!cBmspM55M~)Gs)RoZ5D}9z'kӡ2lQOWW,!(4Fe?56}Cߎ6ǐJ.'G }sx<ِm)_8#M[şO͸-f# ;)*s*pClL@B)XV;,>TJ Ĺ [Jq$1C~,uNO{([ jBoU`NoSt ēxp)qQjh{h0EGFzrq&j Nʦ07GWU,7 |Dǘ XK`%4I >Um$}>lw$ m InΈY5 q.f!-[xk֬ ӎ ;&[6G1K[R[) P68}`͏mD '3& (:ķDu'EMYj4ReE¼؎rTH(߽PԹ ` 6[71y{KbbToN.ؖn@ S5'޵'}έ^oy:ѱ=sl2r]T뱚&6~cȧ;[>2 S`?~KPUg_86eJT4 u+PvHuVCj([Or.v~8<؜_+)@'>ëLe;cM)|=+32"Jm桇CngTMoʇu9B2[u{2a'ru)dg]Ρp؏3Rzj+ ^=+SmJ( {uQ:>Ƴ,.  % lX\1<"Dl,$73xCh&W̙#zJY[Rm@_J~'N;##=D}*Y2RҞu ?Жb_'K&; —蓓 : p]$WUT8r DqyCK!n%JHp&q?zc ِxb1MSVw{2,ExfrY0x*42ٵp/S. t{Z\ EvkI-)>Нt9EYМnJѹ8Et6933pzk HG< T(*?h_N4Te[ -GmZRsbqʽl!XHN ܆M|?΃H9Kby1\yʎ))7*9+gFq>kSeJB)itZ1US̗!J:@/ *X /z;0TPM- RV,l{M+.0t?.mmBîFR[F *瑉Q?AIJSTvxqӭr1Ӹ|y6׾6I)xEVH`-5Ǹt*1_*Rz} iNFРoZcыLR0b{Ը/Zl9nO{@71Y EϨ ד&'-iؙ&-*DvwT(׾LZѪ,rWݹq1U[!6_m:n,qϠh9ZcԎ>ꊃmϊMݍĩ ]G}F}(mѓ y|ڐ_jΘ_=|=Bi LnJK5[שf(QW36|EEEUj5_Ho 0n6JJQ#rU _ξ.oMS+ט0sk ZU UO'S %LMU(_!M@7ѳj`f[i+%6Zq ^sΛ3~&-idG ȶѴj[< WO9"+5B~7E:CaQ3OsG*.<DU^Mtqs]e nu*2(s5KڟV07M]q':2p.Kϵ7qq;C0p-"WJ`glei) xb.;vԴQֿSjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/neofelis.jpg000066400000000000000000000130111357507750000244330ustar00rootroot00000000000000JFIFHHC  !"$"$CL" < !1A"Qaq#2$B4R%3b%!1"aQAq ? 8wRŐ_Q ?էm3G0rJB3ֹd{,r.ؚ؆?8_kkE T1"Hȵ*f GBfvac¬.^)MCKVǶo&OOv'^nc=i4X+8 xhztz_W)ߓ-m ŶhVҷHuߙ;x(bpϮA{@.ǎrNzį9GjEgߜ9$z^[.)jW4X|zowƾ pkOV[y 728^n͞FXbfֵEV *ڜ ^qnjA88u6|;QT0TG57#{׎:d[!AE@uqF$ia1۲50Sp0)*^/talXo8QsѬ|UaI>#c~h ^ ݟ0Iwligih(+y,8'nStapjk-Q†VGXu\;(~n1:΁bCן^5w1dWDMpK=+yއߢ,+s;Wx $D?!'E ARx<^x IC\\NFh) feՎ+X ֌Tuש.SV_&zءAVbNmH$ Dgadgo2=VE(HQ[#{o:&B"iYHj}{}jDܒYMneHdV\ |[=X{e0h,;ۯ+3{IlEw*uuD#jYY(@I<Яv|QA_/`"Bȑc#OҦ940,s%N]~nu@e6-ڱ!SP^rn䍘ƻ <˔$R#:OmPgՉ5ˬ&ɧX|0ђNO#AW[y-tlɘa Dx`Zŧdo!#_oq1;2$'ͯ/.ksƈXKR4,,1o#,ʐwuygD^zhbF0$Rm69nb",D%1`H:$?oOӂ^U]jȠPH'ݹDIʍ2ψQ|{^Q䩍H?kdx#[C>Kelp:ԘJ>K,mIіj|olw2ΕR1;R2]Wcĸ?]KXXqY/%>%lBQXaՒ%Y]a5-:h@ׁ0B}cӻ2ݦ،Ws?Tw?${u > I8q](z9 J@cAmYIb)Wy jxSA fo}5 PD&p@2vRiefQIJl 8t[{*&z9^)ePy cpJAyw"%cuZ:oE !EgbHߩ,GT+6LuRa<@(ƺҤTCܴ'LbnU+؈!#~u~-k[yc*57k?q]yoQK*$iνxE&/{>O{0t3N^)aZdarvI_H/7׻z=uSqk?1$h}t#L*GA۶2]ܑ2f՝VB\eރ0 vx Srװ96cáRe7G]Wv|=9x{Y xľ6ƀ*P445-f,͘^\KrؑH=C̻ 6:ۻ-/~3 L2H#3A>BhuAǵz !H%S#=Swn[NZKT12P3l+;y9,ʦ?$dC\E"zq2OotlTwz1S%{7 6k\+ W;{В.;o \<=gpViloͶ>\ Dsѣ{,D 2LU#UGr-?IţGrXNm7 E%=VwMU̐G]Փ@]סLLtr4ˍxw  %CO>7۝Zw>41,"w.zb@ZQ*b%0jbxAnu}Fonks=ǝ %+(,rI>@4 e|p& XaI'qK=^%lx];dq֗!,CMΆ5bE?)#$JʾZ]}'eMWR5rV-v>c(@׎Xhrww)zBY>RB,XmhhϤyVHČ)#}.ցϷ< WvΠxGZɍB2N|U{Fנ?ַ^9hc]( 1\o΂=G Gz¼_r6Gte=&:Y3Y5"W׉PwvpCoS)ZэHٓu&12f2Oj[([/'%!O.HSG%9>GJ,r2 }oȍ}Sg qtٔG Ԫܞ7v{fNPB IYl|U޼#~\{\N;ћ#vmYGj'tXEnftԂ9B|U :R5uO5xpQ="Ylɵ>qo++`BLl6dvm5uP2w:ErYnqtOl7>#dߴ YqOQg,`R(^C (,wolUy 'lE9IB_X#Dj|b{&]~ t>צjBLg?8:ޏJ8 \ iUۗ .7tllyp=xM/Ylvn6ܓ9R֥od~5:;hȖ ΅+c=N$k1`T?OT)Ř69Dx޹D@ r?af0wo֚jPGO/0,)R7wtC w=4y*^)k+0C$q )p={NY푋kc~%Hޏ#Nv%KJ>448}3I.=ݴ@f FW_G/yǑF<&2?zVJRhe޷>nUᚅƯTP ;SX卅EO"H(;[ b3>t{j$s#*#{R8R8{>z8ar UARY(Up:ΛB'js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/odobenus.jpg000066400000000000000000000060371357507750000244570ustar00rootroot00000000000000JFIF,,C  !"$"$CP|" : !1AQa"q#2BR$br$!1AQ"a2 ?o.~AOD2,w'4}5ä{^YX~!Nu5a.:6‏1e^C/i>U1 qBuWLvh#Fp11DtAgRGI mˏ- zH?e?5]&ϴnt:ı%qC'tdr[NGT3#6P:/Kvĭ8#5J-$ygJwm/mKGS=ڠF+wos֝7[$2jFsǹ{N]$Go2cp qϟ?ڠ}u WN\غ% srG }jxV_ ~3d= u->ǖKR8 $('sTfgK_\kw{?i9āYT0?*_b=0iwWZPI3Q4KYK؛o <}*Gӏ]'.,֙ G3OvOC]ȉv"?>islWZ]_c{KS,r ٛǢ\۰ VD8>dCDFv֠ \?b ms;5X􏺣aiS$NSIҲ@n_N1މ837" p3\|Oz"^qO>p"m}j%՞)8əz* 3Id*4y>y4Ppݷkc’Kvy fL'2̶vȤQDrΓ$n IW9$ʲfAȼ={P'M#B4|%|(?(TTS/'vF0ÃJPZɄ0AVAlix33"{mY\D0kcqfrpV֗w7Nȩ8#bc>|4=EkPBGQ`=gP<7ARb]&js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/okapia.jpg000066400000000000000000000227241357507750000241060ustar00rootroot00000000000000JFIFHH XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$C]k< !1"AQa2q#BR$%&(3r.!1A"Qa2q#B ?D u2H;GX[RDzy7^RBJ~WpU {3c{RcgUYJRq H 1XG"O&04(aDo(źKe2O C@dm<]i;GsIcZaT^9uO#%O،FF P2aDE]͈ SܳI29%{l{n3֫+lq<+N7$+m%2si9&eӵ}h{QRNf$*>ʣ9?9 ;hEَ莢u%{FRfXM;P\*A>=rcˉ^ߴMd[nmp%I;Tc,A4X@'xӟ} Zz+"x" 7*nx՘!Ӑ_˺>]m3zj(T$T9aΛk^D.-P7{Y%:cԡ8Ȉ+:*Hv>K[s"Nw`mЈ,yQf%3˓vnꫨ:TUQK-)RQ/NHLƳ!ix!Szv)׷m7ol%ur\- N8p8Ց%'YgUpuv6R, ʛ@m.>Wy7UUq{ql\۩'_Yx1۾*x5=D%LdoIe0U&V[<+9j[yG ( Q f9qj6}橡Z;8ZR+Hg+gktxܝ6F#Crs(?tZR9Zg3Df| >@9:Z.f5X_T?/`ӥ*ëy{q1cV Y}+tuZIZ9$,sM:#3cϨzTWjj{5$n,p*T>qƒ95^Uǧ-GsȆFvOvKr=56V@(v+VUF#WF8 z*Bq'2O?s\m}fiXR,L~MNdxIDL 3Ox'^BSNUX)-LoY$S˻#d|{u1:;%4CTzycxzF^H%9Ea(Zvd5;i"/ }ߐI$%RQtu,3tE l?j>g!xtOfkzdccķNN$Y[ʹvvŽh)at<}X9֩.#! U^&U+M<0aw9 }KnYblI:JXe@9d9?aH| I MW{9QPAsAGl\s0@w2t5w/դIhNCtK˜WOyG)؂)A,[q uQҦ3{&U4@bi 'ž@=~`mwqxgJTB?(6yrF03qRtWߢxM@*k:r{DLXz qMǫ Ai뎆2VJ.sm(8p?]9U@AbNs=m/UMMcIFdڤ;r#s~S#[z*ܮtG$6БE`0?M%e igD)xǪ&TsL&Av8=@mOvZm<2O(~ ϻ4`7j]EdiCIQԌA$ vʌ9Y-_i_W{PKGQv avG  ڡF0*nxޖJt KxFu#C `Bt!7'.W\Ze4|r~'U*19ֶ0X&XWctʗQ3t$\:;Yr?Z@WsBi]j,K#K y c伒LUyH\N`#:twS[pFf®9ߺc'sYU,k 2ȟdyΩR5/|PQCUԶmg5<7pX3#&G36OԗXLd;O#:dQ?2uzQ'O'\dP H*(md_oYjuuCTDuG p ۰F@'G:=g6GR@=}QKUQQ54tII P#cհz{Ƞ?vsomls\E#1M 0 0H*Y3na[cN0 C6lj?uImN=uS(p2pg5-uϤGSTZEO Fژ stǎ,ˏbA8;$u*h{.ݮ~YQuMNXO+ r#c :[reR,Kx*Y9#wҀ$ FcU+Hҍ* Nt oz|DPo0Ħ# [$a9'DL-ɓxUk݁TH$oZ2ܧ qѾE$t[uҦV ^ŧQV }E=Qޡט OCMKEsOQ81dHeL`NwuT$cu=-v*KCxe]_b۞};A ,s! E:$R "rA<5mQh@:/X6)eIс9#1t [cԱw~-,t,B ւx ƅ ST)LatlIP;|P[ Vχy%hTu1TTQcWscG=tޟͿ K2KH,=MFw6 4Dx:hݚkO =5K&ϧ8d߬'|^x IMIC X)c2,߅{mS*9jk- O==N "Qc A& !+a!]mԵ)QfrU2%SPWļv<8q܆ɗKUzF86]KM!BG2PƬdT3җ+1q@DYvHTl\ї' wǜ;dN1Y̕F8H>@aPXjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/orcinus.jpg000066400000000000000000000151321357507750000243170ustar00rootroot00000000000000JFIFHH XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CSw<!1"AQaq2#BR$34sTb !1A"Qa ?Gf@+0pvܝ̎f}&{c+oaKdR/b JDW}YLN$+$-cbpr.aϥoo+Z`i21&ޘ x\3"{#!N]FmbpY.E'joE"%L}$=Ch.nlE{ 4dp7 4PHIRn.7;r uzbƒv'Hv=UhO:IFMLZ:;}fYCz6l */M {àQ +TDve7fF TH3ߵѩ\hwz MUG 9Q@QKJrմi*r|%1+s$/@h5sWO/zCRS D9 =(61>3HtYTLkגuRG5сƣpݮMCļMFL0X1i\x Kkmqq5gl ɋ-HȶM'k=1=xc|DL߄ZTz ߤo}N=|8gpZa]r c8$*wo,M!1b<\],)dmdlFŀlIߛ`bQhqߵs98JZs}:`l{ߎ{yLX @몊IX,}ryq/ya_ڦ/R,$Gw+* k㔹8MDGU0YČ"yP#_YA -p ;9iSL߸H7%8?Z.jqyRA3O#Α$ swI]/aDR$H#TCMߌ8]J/8v\5mOqSGP|q7q>SUqNWٍ ,ij+2rkj=qK q&_R=U$@TIT; u)yqZu[ܜmK! oN g;CAo`q;Y2PoK) :b$u_D:Z|oC1qdYwpJHңM \je|50S>TUFU= &ʽ;pz|P8{!2fihag bmQ$/n;>V1 [Qtz\t \~/bS;2n` "2ey/ xTªVaBi+n2j6`S7jI[ahϊ6=c2ꬶ^[>uB3.2)3mǛ<,z)f(Yc,|c"g:(I3 5m:㻱K2?S9,Y@2e<{LUg>T/[ƀX`;7T98ԉFslnV^C3I,5@ld)0D(KC {=UI,z-yJs{aR#c$ݐ.xN<-2cos9lerC  ݂lc.)  nx#{ю[C_93KMSMwX7Xw,ɴe\YRqV]O 6'˩tijdF_Ŝ-[AVFdQ5 yRg|C1J<1omV2#,ke]fF^<2-Hʪ ̥G`Nᘶlg`=,":]6EeCgU⛖$K7w،sqoU_T- &$L/Z,nNoE]G$3ǽ)&鱶=8 @X,ѩ&~>ܨEDr@f;~ﵷb"؈RkcpG.l ѩVh OBOG\o}%V'o2C b@'M UrTN6&Juu;a̦֙ݮ]j$bvM+<ȍ5U)w'.ÈrI23+*$P zyoX5P:㎺bjr-ν/M6+ ɭ@ FTay) JʲA0MEPU[0/v O瓶Q4_d DͧU9S BH|4W!6 C r$}|a i6z`j6q\ ssk +QO$< fDx ϖ(LTR2 FAb-OVPL.`WR,D#95`n_%p낲N(qFpN:ZybX߉CxUcP.6 %Ѵ|m0\9썅aEmT"HQh^bJ/j`% hb$(:Tmk[^,)̻\weE_ccjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/ornithorynque.jpg000066400000000000000000000161531357507750000255670ustar00rootroot00000000000000JFIF XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CRy?!1AQa"q#2RBTbSrs(!1AQ2a"Rbq ?c&f!r-co||CmxsmcayVWr䚤d1kB.llO 'a4Hf;{rn(0 "R.V551ʱ9FH t&`^bUwܯmmN#~DeE0Bu#L =du{09z&9ء |D^\傥{L>Z .0o" ^r&q i,4#WBff9dC~[95Eh<$QX9GaVIBd ^5;h~Xk%m1 Wz%+N؇5V5t¢iꄪZPm#eŪ)EU>A$`e ؛j-%p@Hj,ݐ[KOeV{ԋܐ}0j/X_.KfMp}8u1*A`_a׷dݭ:^bWH\iY@N CXX8wLti#O0 ^[;|ZbJ4ƱJ$5-a,^ʒR~ Mňqgď16t~K)$Xͺ4'> BJs=m|Jcq5pj"Gtog)q׳TTTEd4V;mRQZ2%(zU텉񉠦KUS ._˄}F~Jkz"_NS̋`$l e,齂MӮh#2F`_Sr:II 4ig b|%Gdt T#16hE>R)9غJHƊ5^gOؿ(ZF#',R*FW:hb.)kܝ1*O*׼ h6P{K9lR-mTX6x%$/v7R<+:=>+GzjD"PL/ctkre0NΉTk e˨/qqĢf -<-B3\:'L$b ,RfCU9$8VkkpqTIP)WV ZH:9YT2ȹ*gNi 1!Ȏ2{폠+ WtssEu2TO!>[?k-T4p% IJ2綊y[\y٥kF7 i8pVQ9ȷu`N;q:Hc2Ko{ pn:@ %}0zb} M <*JՖGFOR"DQond}t 3%9s46b ʺƖH7̂Ď'.i]X;+k{{mc' VĮY:^[6t\e'ڇ8(v7$5TT;"kZt뎮Fv[Ǽ='I q',mrEl/{;H*f%j!*n=ΉQpx!e>eEkr9vhEU$L0#)hmQ@TIL!*`9:-Az ,f;,Kr{:&2  ${~*{穇 6`XolCʐT(izcy)@F*YPrH|*[*0,)$5_}~ VS$b*_o4KU̓ɜNol;V/A$4edӟ1~|BpHHJ-6`b$l)s|z>F3 T6-$[oњHcS @+K+u`}~JdRXqbML6[< '#͔mֹB!MRTNj*8u(NTD<$3~BL)HŜ>A**="^U.Akؕ62&Tb2d(d}CM+U$yE/&hl3 }>XTH'TK$hr0$_,+hv)UR }a-{rB)Sffk%dj9Hn${vrF,7z ~FvtFkSDqTGjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/oryx.jpg000066400000000000000000000176761357507750000236550ustar00rootroot00000000000000JFIF XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CRyE !1A"Qa2q#BRT3SUr$4d(!1AQa"#3BR ?Ӄ?+&,"LL΁fē0Խ,zհk.ޤ64?fA>?@\MkMxAR69 A-#Ws,V6稡3dQ rMߌe923qHi4"߶I+=_ZzqI[ D0s"|bWحҦ.˪%(>&Ӥ#lO&:4vUy!vֹ'ma6rq{GOEI%YFx~JnfM :[)*bhdr B\e_;o|!lqR,~O4aU0 ޛעZzǂVĹM$P!*\Sp-[}_ȵu*";2kpl|EL)IL6[[ 32dno":X tf_/IʥNX2;%opWDߤc/"IjGR=z;"D̙vܒvlƩ([ !ґYcrnz.M $ʨb*&1'{M(\ὒM-u/bf2\1;0%,^ubl!F00b -ap ~eQF2rd@$#I~|]V{k8ZnmLHВU`z-۠}h aTmm7_lT@`ܪ#QN_$+2JE|;}VOf٘ϘJ"r |7>a։8zjv?{=I8 SO4I 6Ww؋ЈSfrKXFmTIFFg lKuM/x)j*AYE{KV(+=<ZD9zD55KP3 : 凱hU%}5BO#CW-{l>_"z:D Tk3s@z[{v5A9|mBRvyB"@؁Ս7A4YTWhiIeR t.,jHk2/.Q( >$׈YK lSL@;߱ q\ҩa9Ym$ FRBߒT7\vFuTa=La53Sl$TxuIer>t6>8|YXgˤЊ64xdHˡ -,hPlVW{2mm:)fjEfrJX611J]svV=+4\H{|ƯY˽ӖSU%͚\5`~|sf} f:Q/l-a{۹;b9BT|eo;[{b.̲晇*9U"F7oy`حԿ`7+9{d~֟+^f9y6y5"l/kjx6iꪉCikXî# ?ݞ/ATFQNL!Ir^M7ubR%LT 9[sxwZWOVӷ#%@UBMve@杤m~kJz*UbPXT+]6.DԴfR=r]G1r~}%\,D;wF9.EG-}d*ҨH2U@6LI/1ASXLgDpa74.G: m F`c;_oNtT!П >(VW^9b8SžMvO{6qo"$P ?IQ- |3VyX \[`4l*,V2ΪW:*V ܪ*˂R y_rpdɺ*7b-#4.1&#/qp/c߯\bGDUez/+2}d1Q3o{tyџzY)5 a]6cN{<C ݮw*֔4א0/H6k!Gڙ~\=},*2iI$pğ JImuXy+Uc`JSS RA6|\ej%tC]p&)"PBc&ËlMPczn*6ɕ{+3 =M$k'(>=o"T3ZtK+ZcLJeVcL+hRz D*7ɶ.*J4,yX1#Dӕ1V[Mţi^-<F6˰7Yi2Fd([bIbv'&1TDV}Th 4HT*/q㽾XaQFO3?tZw~H_z*]Y<7E=<. W$36ww:hkfXpH!6u[DSE]ΆfXy[XF iXnmLuQ;Xui*AET8UE3sX\kkgJH^g)'^ll澿>lNLWY!YZMBG)= nt*mpfwdTe!PXZ\abVgr Oy|XQ_̳YJ¤@{|{vCN9*$K%u5t O<r,++(ʘ3 OgRځF&RimŲLQ:u+6я"ٚ͘<a[^zѤ]Ŕ.Lzk&-|Νb1f2vc.l]} nRg3ꢦLB$o T[v >jki(HwS6O<>>a[ } IfQq0J#sӽqq I/:rVT%??߫fRf2=7\bi$|ԤBZbV`r=TRVGC667بoSBXWQ#D-=kb{*v##DQ,d6 q1a\ II9k} ' U&M }TPEZqӔ 0u>.0j J>m}?LRb]D07ZDB=9ߢsoی\|KNQN<)˖ 6'PQ~`qɳLEU2 59F'_pz}04|:—*:l7 bl޿`C0lU|Fv7 'ɪRZf0Xct At *Z3IR*r鴐Y ݋rtu OS e[R&rT= rC :9bj8"xZrv=p +;{}|;ɶ].,oLRa)4B)X8QSFnȅ?bqD,ѫ2Q/I$vA{3$n~Ql>"KpFO\^T`=CiI[{O5_"KQY+6 'ݭcap7>]5% U@Cq1 v]^& z6DSW<YCOD 34hm*wcHĕlPvT:NR>cƹj+8(VHwrfuKfh,(YF-h/i4.mL.X`oBD̊@ X QɝFHb@f& o~7г&gv<4 bI7|'w K#VWP-Cey0nIwICDn9)e`(1e^^q!M3CML!c25_Ƕ,auM~Y,[տT~]js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/ovibos.jpg000066400000000000000000000067461357507750000241510ustar00rootroot00000000000000JFIF``C  !"$"$CN"9!1A"Qaq2#$R3Bbr%!1AQ"2aq ?ϘQU;SW<B`mp3jI5j+kJ1\Hn:8xmt )6U;0UL@_F*RbZzKf&Sm6{Eʺ.lƾE"j[^>RdLd}CI:iFlyt+%s’ jp@حO&gF7.a:oHdNr7?jզ!jGO0ϫL SZOK_ YZvgwfo2|XeT|<*)r̩#TizH ==;ah, [ 0,#T5cNm4 qtu=n?ZzD'$ j-~b2@FS$b, ɨ4Ҥ pG6\L; GʣWꩈTnB ^|/҇sN"nA;,93HEN7^9N9WqL5i  Ո={ lGg >3|sqAi]L!.ɱ'sԀV(Y85DvWGǫ/l&sr<ԗ$]k`6)%@ ۮƸ6 "+ ƶ[*P)'lzO>,Qhٔ69]D5b`ZV u~g_R?;=3bc~1>8\'SS#tDR)4`1Lx,FIK,Uy8n.&eQr̢JiSa{OAwdz)>̫2JLchʠ2$X㯖0IdtQFЖU##s|QijLyIf#U6Ur.9EG5dsꎌ-ߵj4za&]تX|)X^@Rdv7?a/=7~GFX/oO?QљEŔng )+WOg2P ӆ !O `Ӿ%қXZ_,@H9 J܌G(lFŌc3ls{YAq\kA2YN?D2FmSK>ݎC4ϮY6b.*{ ^~?b!F,],\ԥCEq_\E_)}Y@EE5\ ).4< ӳoebg5%,0xL6u7=P?&Y#Wc%@q|XU(gf%j |tgFM3SSIUS|IlT- $JAylIK Go\3!:Hh04qc!2RɤDCL u™idVU>CG)`&}]u>F'J ƹ:(Of}#,-Llׁ3:y^:jFoT"ױ=l1E$?q||4 +0Bop7@{Zǡ8iM M*zW195*F#̩Nt;eGyy=9Ţ s`q,*6h#99bt_ϐKdRc-g/޻SEWI rLlF :MP/Epմ`7G}w,k~άz;ZL&7"BPF E*&v_򄡚_j2 1FڕYvg*޶eCpQrvǯjSSGLs3<Dk{c~8|>'>( O.Fu;v>}`` IN2J5 bwG@:l9>:)rv5:[ 2VfPA3|.Jmއ!SITTsQavHݶgxWeٍaIWR(ӜF_@oSצIo2dٮqMKT~^ ϖw'{Ax&#gɃf3;WC~ yT (32JP ;Hknl#bzIG𼼶aW HHҚ$N.YTkaQԨt9k/TFK 3,k_R3y:*h)e&݆ 2C/>F].RMhVSGL ^'T)^Z2 :\mlv9b* f.5[oLq6_Pd2!9#ԗװSb@(JZ6oKz`UmK-ck\e,z]+nfe[_! Q%!:dR/\t=6 jWf2*i*C"uerFm{d+h2'CN q:o)='%*vゖ;^ϩ ԙyj%$B_u?XirB4t;wqI䫊)6*&GKfmCJ,e ~[|5igY[_aPN"DX-;-HVD 6ra`b&eFSb@uv6=70?3(2ɍrۯ mkvģ@f2A$Ju|Aώ8)7SHa*iN|)D'|,u0w. V&f׸'{}qw4qӤ@Ⱥƍ$ޣlUؤ+ s=ѿ5='*M#B$߷OL xYBX~ CmƜKџryhT[P77KZJ(gّ"-W~ kɉ%hfoVչd22yXet=#zz=وxR3@\5:K! mgos[ $R4)U74v;KMa4K Cf /~X#Y k8 ,jTFE%GŁ8DFa]TS@/Jdr{2獦B(#wخ?Q.^٦_#i74o,"aHnR)E"^D[Ƈ]6m*ͥYmcoKm4)ѬOIt#T$mm<1MfZהG($ڥQ@rjzZJb m=zbu4%##/;'x'x*'f?h M77鋝Ѥi uXkZ<^GړI C11#rO`#[[`}:CMDK=rbuhaH17 m^)&^bHĞBRG,y4s VT=4چbguyZAv^OmQa" ʌ j*Yk$/kaیk5 PKNt8z{I*Q9:RsCjm35\2.Aas}]6mgCD/Eq캓66@83Aj .?^#:"ssk~xr@,*7[zO'a3Rr{ya{~x%ȨC|PɎe>ol,plYmr$IeuPQHDnBtp /t$ᒮ{ 81*H>8t|>2:+,,jj*2fϼwTm"=_IƠ }qܔE6jY+ Fzx|a<$|IY-; 506$#m 74YVJѵDlGORgꆧJ*< ڲ7ͩsf)-t+uD2A7ƽ RR^@Hї24-DgIcD2i3w| 2I c` /;{KZpè,aa|cYOd X-ێرEY[J⭮rҝX|uNLYSK!I1T؅YӤA*,`Q6!6ESL7vsVfi2 hAۨUzSTBC®#:IQհc5ֈᦵ/m~zbRҤR]f_΂54䁜Q*/Ho.GlA~)[|cb2e Ots8:nH[`miDsҿ 4(Y 1<gK>xBJ}ESZYz۾*(FiFhtJG#,XeߧVD$DtjDvOau*6#:TҌ\e ξ6Fj"²61 ҽ}G209mNHD$/w婥SaSg+bۓU%P4.1sJ0sӮ=]3 o="d +# |QN[XtXgg ?`uvZ@9'RN+^_m=#M<&Q8z[SyS[>V8@ hU>>"[|"8 JZlh*FtRF|T͎R)k-㆕2:N7=~Oӑ^(m}I qfgilO^$617)99ΰL ^_p5my`U;#~ʸ.)j`ċ,Z]Txlǔ1>\u]5mMR^3kPHy[9϶'TeF75,t`ȧ-#tg?YhF `>]eY&Le(|$"IuI$GBų!:!5TZʤܩuҵ)l)d6#4PteA^m4$q Tq ou4/zD&69q8XO<vlr׷buABQj%bTieOW4;e+e 9u/Lc&h: r3 I__R43F`G7H5T%XUXqӷN:mG'mVZeXbXtw"g*;|eSMmLILCW-?O$<$ӯ e5eˎ~BX11|okS?|*DYYt+ʇM6%=eY)Fpwi,6v9#K])FnCsX)DGBA;FZJeOu8}}Nh'M \&>le$Qgl=Kk4lp>Z y]8B$ (:WCGnIW+ pIb]H_ $FR,̭]RƑ8Ec#p75ֱl4]]k ے!~G$U5t'j(1!'M;AD!IGVYeҢF^́߱k_~5H̫9Ls @&Ikh2zcMrj̯4>l%{ci+)k* Ͽy55Zj\Tl=G_O-wzX%J961i*Xjj5kT܀  |Ta; 7i4Vzp|:FǾvcǘ(]8zjt(3갎\26355O&Gh!ps+O!`r'C'd5 !`$cGpXִBkմEDT0*@cm|k?[9c:d4b mdZCo ńB +3o)Hkkjufd/#` K:ݢ5 vꈥUrT-]Q -9,5, 83 vƌOW5WOZ7ltTo-D!xcu8ߪLjjk G֔~T/^A zm響XwH&g+js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/parahyaena.jpg000066400000000000000000000105401357507750000247440ustar00rootroot00000000000000JFIF``C  !"$"$CUt"7!1AQa"q2#BR3b,!1"AQ2aq3 ?VX' CrdDYC7D۩ I]SUQQg`#ƩIח-vx;c$A]GĤ^ưP s>Y|B ܀כM5u6&M3C}-ijT`p ?=WO? V4vx\A\ jXԐۻ221Ǧ,׸[9rp<.II^[ ŧ}:<'{b*T^H.4%M B-L~}#,7Hj#<4'sp$A2J:D`$~7wn8m&DlIu}44rV]%-+ "$<s[=4TW@C9@Ř~:[a-=eoyIs@V{}8pXdT&f̥7&ڔ%T5Hdmޜ@+;*$#I*`V1=d0[ i+Îň\`k]XE\.O;ǖa#':ExLj(#U﩮3-`wkCoZb8psY'ZH~Xiω<{n ).ItF]Vp(5J{PA@Nv#'i9Ncmܸ#Zj+#uBJz$QT`mڏ!eTUuWfe9δz%{4g;rXd1JU[KSW_(XϞh69JI2r {zUHeQ8fþ{n7Q)E1HdYc]鹻qϑ>g\?J-g;Ȫg>\1Zr[KD4x W𲬽åK`ԪܬhO I6|v&l#?182xrhvuY"۸G|_m"A1s+SKGm$h1] [q|@ڬ]eC {L@~a K7sR[x{3BJs,uvZzX*anG3[=+]%A˩R*LoHo?!^|L)dymuL>F( 8]m>F"EԀeⳢqk%j̈JQ θ)3EKѶXٰDG=FuX΢թT@\pWnޛ***!AW|io];'a#Ǭ~ ҔUl[!Y瑎"i\)hdd34xgos(8kU9E0C"eڽbI9ׅfO3RR&PA#̃FZYrD41 儲X8bϞp%O:/ED5q8i`FAMe:v> 8?5KTn\0:څ7WXM=ONOCޚp",ӫe-]CQAp8J@09>r+QԀDqH~gVh ͐xG6sd7W:bл/:+G Oz xK5LN Gq8ƭvhgERyƱo5EfCW$L5Xm?cv}tzz{޵J_/+-i) r(/v̌s۾DB0Rldl~F + ^HaʟpyM?ӭ UX'}+FIH1W)w.ZeLjWH_ IH;1TWLQOL%=l*X*26|]=/Zh@|6pBFk*no%)x ]Aj (#Ʃ`ik?j9֤c(`c?Q1 G=AY?tǽIY D[dw#84}7,+ CI1lZ?\VG*U")=DUϼh6\n7#=#GKF g2~DN:1dH2˜|dcƠz䠩Adѫ 0 p$眏_}{xj[mURFB술bDC w*s>UK}@zZZ4Hwc zhy"jf쑉 ؂8Ӵ}3r j9gl4*=qGZ_lH!Zjo8 ZأUVǩnUW+qE2) O'$znYZyD*W˷9뭓垖}HKVP/?:淦zqIsO:Fv2+9'B4VGՕ8ӒVZd.ɞ]禴Ze-mMܑc }ɊB' ~WAMABT[T PǴԫ9Ժ9V  t} B4[~yF?;$ PyhױZY:)'xL^n(0k +Oxs8UI8TRc,ށHO -.KFeGôݞr2;ijFFk݉9 k <j:Qd7oI!(cwoR#C4.==3, RѪ0#h?:jkik %܅r[{F݂xsj^h1`8qV~!݂tqRGjRd`{7ZP%yp3JмtָS1T-AUWq }A-ZqD]a۴vd÷VU߫gi%s)9@8pŏ9c%]QAN$@gd2X|h<g8j[ z+uo1@9Ֆ/QF[xu&PFviwGu R GPӽLM#lrqGVՕoĬUr>،Z鎎KjGfP0ʜ~|smo^&{hݘ630UnKCY,t0G0VYWg#R: ՔWU(ңgv6cj :"bP0]X㊙PVM) ?--7>&yS*51qӟi*e񏉆 x1Ǟ&9$6c9Fsb[7q?]-- (0@4"5jχ6<~zc`[M;v O]--8`@IkQ‘:$GG&Tb>y綖f83~[UݼNpp] H*gKKG_F̰BeV1V!W== Yo`n6تRHSKKLNb%5%ʴIUF@`}ZV[R q --12ՒLP, w+9<]---sh3?js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/phacochoerus.jpg000066400000000000000000000175411357507750000253260ustar00rootroot00000000000000JFIF XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CVs8!1AQ"a2q#3R$Cbr&!1A"Qaq2b ?˱bcjtlǽ+N̞5/34mk_lIm4`VR GMgfm[6v _!K-,܉iM31#{:w4dz^c3jRٻ:]"6Gze KGm|EG&1&ZN5rV 3zԢLH-:7Sc`oI 'P֞U/"fK}@,lwo8lgtt'#Qs锻XGIr[(dѺ[kzhƉ"1` =b]Tpa, PNy0: 84b_eU@m웽 Hid a[aGٍ,O#`qL/6bU OHUغӞ[DMt *&C̾LCW4$01bBenu(o8}U9RFf)P -خ>*O:Zxdh+̍t |^1`Ȳ|cpvʺcP*e*"sn^9-̦z->cKKͶح+T%FQBI=;of\&l)R)SKXG }ܒ6܎Kc*8#[h@U=ak,6K$\:Τ"^qY"GTGORwVfeeu!D&\\A]%'Gdo5+j6i0!iV>jm=.|SSEř#., E;`!Ieo* VkFڂ}\`IG4]Q岳 Zwl~Զt4?k)krL;F=EMJþ79YJc5-k44,Œ`4,7.Q+TЭ[CRnDCn^Zkn6Qm#&f*amˡI#3Uk{*1✲TUjHH\7p76ISGEUc;RIeFLtoxk!,$K^)n0ZrQI,YqpEFV~LmaC@M%UJKGQl4f f?˒G`uv;_1}IΦz yQ-LC*<oڀT;z>)_1bt0bJD}H81GHgù2Ppºi3*u-vիI\I==O8a&ň s&|94D+rio<_q;K 7]NϽo]aeuL[SHݭ觙 6jj J'롆hMP+صl82J ZʆHS@#rI1Dܘvq_HيwltViJm(vI,*˲}>yvQ*w1.> z؛)0j\Q#956}b ݠ7HuỴd&jb"0#x(4KI`,["'2=|&.NMHR!d*6 }s_x(lT7P )Eg4pRLj@=\QO"8h]$GN{<]-VEfyUH3x؍]ߦa/6{˔9C2Q=], =zD"dЄ "ݽ1qf0)-L2ڀ M?~uTE,TxƝ`tdtj}EЭ2hB$u{& `BNkvAG( /U^X.[o{ѿd΀Vv:cЌz22! Z)^CsniUA @8W TBʹ$y$FP: X_U07g910פ!>,5P-q9)Rʫ2J[rOLVI3U24p#A+yv<QVoZe5BrUH7'Œl-ŽOab,.Tw$t:QgF^N!P UB7bvmv߀2ͣQGS+\_Am.SkK.C p@% =7[Tr!TX nաLY(@v^Rto)s):zĩc,Rbp;rk]>E&(#U"@7C)68i6lUI z-At@tv.6RHSYɶцe@ɔN:˶K`oZ^F$$:)i4+JSXmqlf'[IUÎCSӽ$e]Qc~ؤz }dƂ8*BS;b&Ʈ\ xJbM "TUBi3HGp@m϶%V,fei&Z_[ty?\YFOecѭP),Hck}]%f4 eD`ܭDدLxzgJE7v6\Qc5{7 kdE:ZTPK\|a\wC],**j(ms}-|w']P 梍# $t`@8&m$r.]i g3.,IrRLn)5BĴ3i3I(e[)KﹷBV:60HtJihk5y+䩆Un(裑%3t6kRT[߯\FQS UARDg:>^iK[OE,.#=1{Z߂v QJ$j^HrZ}G4O֮1v:\46ڰAi7rQM(lE\Ì򡰝ַ/#,yWq1w1/ooJ'_T'(0ʝt0~PbeFZ-q!:4j' }_b`k@@[_ 9Qq d_OZؽIP]HĈISϷ6.)QJI oWchm5aq|`ⶄV|?Gk(Q~##ӞÙf8E q* Xye3l޶Oa3!63yW d{mJ/C{8ɂ'ru?ϕy׵K?3+eWI%H~ܒVˋ+1cz"i2O7m>6#b2lT[2oFΎGC&IՀB;dPé j\FQ 0):0=UKZd:g4ќaTDҮāzԝ1cDP"g*W=QÆ=/k$VԁE5=C}^^X!1Pl0z+ Q|{f[?᫐Vxx#հs^Zܦf J7 5V.2*hٔ[RN!SzJ"%9ny@mQ,jȩ2vճ}#4c ^i(59-d;@c^lw1ESKk\F,3Y0K;x8c6nodL%>ѿ6%LauT~AyT6>aq~E xHh;D9\ 4illc'۝Oqڈ VMy!`@r dV!Abw@1üU@Slč#<-oMeN@:H늭M!ѥńTΐN9wD[1Nc xs3pXkT&0G)\REtI%HOO RUQRS>yd?8#s Uh/"5+CD'T,A KxiWv8Gބ_#b!xjxBWÐGPYO@\e? Dg40H .0W- M#n]]ަx'$h_qȟz^Es=VR %ʃ`GJ%dž<}3]m @yPW@deuQԊjF#v%3֌=@-*/7,mUR Z&0+7ܩen`i``]LQFA: 04Mx +Ntܱë剛v8feC'6r6R JKy+'ֹTMEդ*9PoN24'#Kkۨ=Tn&Y5k|WVb!s;7 !!;`xشѩFzF(۫Hxe͍ ɏVAxҽ5 vِU?*7sYKORS& E? )]H@297@u'̚%$ƒ(#P˨f!%V!1AQ"qa#2345Rbrs67BSt)!1A2"q3Baё ? 6;%-1dY.ZзGI8{TukacF/7Wg dSZmxVtirAWg E^ \uKr+b)Bxzz8ʐ KCqӄ+X\d͸F!iIa(}RVhqA77-4qZuZ^a!7P*7mjI*PJbfq REw )2;bSf +rSAո)-挜`|Ϳ{iVvqNd?n 임cqxl-$}99\j'gX'4qWF;Տ$d gʟN\C $6 CN?9,;L'AR^~ħ6'AV|8ksZYwӧe$<i rV-HoV> ZcI XVg_O\+eR)4$Q2k *Ǿ9˱͍318얼 חΚ)!-J|`.ǔ7I2BRvϦium#--j^~Ŷ hUK]`{ss#=2A4ޡT2I*'>C^8Ip)Cxy4Kd·7;Tv&)ZJԵVuX\RKnEŴ5tYJU5KႷOuu.mZZ*ط(l6DxJ>wr@>=4fgىbְ *K9YiɄZNVЁQ&otyJJB):viHJw%+H}ЇE$6'r%SϨT'xQP"JUuwʽL1H@#|cmAp1HRQU38hoY[KW&q%qeO+sm"=关iFWʍ^"G*6iF>9 ua`Ru6~Wh7n3ho(rX?MZ2}Zl1LG>56J_ Pհj >QVQGކŮ*Ԙ, 'ʒ. 1֙<Ь$oZaH Z %n%5NF<\riBTJBHm(8ҥ9N.C^ -q!YQ9ɔ5ÒvKC1t)c[!ӾTO4^8MCp[yye IJ|֖ i(H*%#,dia7*T#iJB,ӮkDoa\-(%9>AmY8=?GZo u^i?k z;"OhIus><`ԻYqx c:})<[BlKkeQ۾X ǩV5uJHKZ :($yタ0}[N0jjL:״cH$NYeG1]/1*hmR {p~VU|5ؚѦd@Bz@%H2[8ME!i iux*鬄px>z.:R~ߞkzUhym?T~C1QD^/Y-c5=^& M6'\6qHW\W#agFqi`ͭ$li\n<2\oׂ2lRb/-}EjG.{9ι\d\}$v|2SgeR6nc׶+un]ta֯ c9e0[Mn秩7U)Vڭv7omZ%%.ʃOc?<֩KiʞS9Z7l Oљ+\'IZ ?5?&ȡe [8';}+MsO 8"3V~t `?awg2g&(}*@Fw̉7Se8 |fG^y-މ:Y0\ A<*q<v^ۿXP]289Isi>#Ȳ;+[sl!폿ΞdwJ.K=ѭKa[ck,1l>g_"Z)]3-؆`CV=j!K,FYm+luǠ>4GoVS<(?`QDcrHnYe2ʔ1V^ ͜?%|M2?L^bʟ~ kO.9noeK1fa]8nd=|oF=D`.(x ItU:{_n4mvLelcVIN*H[\X^0xx[9GzG^P@rњjLyǮ*/Dj7vO.4&\[!8$8w'9Ɣ΄\W^TܚC<+KA 1VeAt|Qe2GԌB0s\YvHŔ9&QlfkzUŕkqѲ7PV'+5с.چ),m'(;}ݮ|p/X#zjzG47@HW0?rLBcԼb|?hfD#ʓ5GFtsoKaHR Z3v=A,6Psx)u / tcItA.FRwkT/ĈQS݃#p:|;ۻ} רqÑ=JM,jؾ,Z؅}!E>]Ǧ-+nJNfo_*o)Ӣfq,G>dyTba|07OHHRx2r w|eKM^g+t(!dd 3@ɿzlzf:my}Hq6W{Z8tڸ;V&Zz)c"]pGc(GeK75Cp& #TI+ߴ8PC.(t ³(#=Q+uI Zyb߬2A#QM ݣ pA˰3O=J<1M!U0%`S>(Bp+&js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/pongo.jpg000066400000000000000000000070561357507750000237650ustar00rootroot00000000000000JFIF,,C  !"$"$CnZ";!1A"QaqB#23rRb$,!1AQ"aq#R ?}ⱧmG(hZ{5UX  68;5һ jnpRSG$cG?_NO,x y"!Kܪuig&mhBmV{*&*_|,8&,& ֧ Ueˋ('_K=YH؜/C< nG藦X 3ه7j|W]bQj/X۲H~;7r:o,QQ g?sܒ~gS>5?lZD=*q"0SHI3q8pAuofcjmRT!*NGR'T;oZT\q:Ӫ+IJd@pqخO+uSܬJvtu;Q)$}3r0ΘwKxY!$MRI?ņ;M^SSJ뽢uXg/uڮGieHrX蝺Vt(qn"4 *IC1'wmTO"Tt0l'[qEDL/7-U  c;8Ï? k)R5溔Ypz㣍i{`e]Nv:n9NOñ!`gbCwΕM) 8;)8zvgGN:rH`y RDǿpkakۑ^)c221$OV;gQ DJus׸_;^= >@P_cDHv#pq;gCJY&\n.{Z[ ʪj*|ÖBXpsjEqV\vd'[K-@n?3b e8ogsCZ/źMJu*{%X̥F́^XޭiOSIp UC)ϑ)o1RϾZRJz*k- %m-;+t}b0|c@WҾYb{6:*]m+bix`y̬7r;s}aڪ N?^D47#ߩkoMA) d܌ƸcvZZq{6#{*dW*t#z1.W[hkVp=AA(b@Um^Q)7ePZh(adw =?Ô2ݪ-촗Y-zVVV\Lk[i-Pnk8AOl{q䓜gWfs x:X,=}΢Mœ8*EK;mdԭ,Qȯ8BG~/uzq)s+fuu>Hu &a!A8,V@[|`i8V|NE쵰Úw$\eԶ<bXa>-F VJJF=;#tYW]29̓m O|%JC1)l)A1DkTWlC>+SNloEIuixȸ8oq^ogfҗ@.G߲4-;X  iz^ zE߫>\ww7ݤӵgn;`Tf'dEicl'}F%']4wDIqcPp8δ[#D7]bHzwPt6l>}aG;DtM#\,BMfTjdKmo.iWuۢ߃B=khP @C.v=S[rր}(N=I3E Ad`Y3~miH A!-1wƒŲ 9'UOi">댸r{wRMgS[k՟5$Sg4F1^mR,s1Z.ͩD܄)x[ #wB@5 cQWp6R cd =֪9c!^k͖Dygo}p\vwλn5T8vn0?= EZbAmE'T]Y@> C3uΊPテ5M!pv9QHQԌFbPn{i*wJU߶VSfR`_js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/priodontes.jpg000066400000000000000000000137631357507750000250330ustar00rootroot00000000000000JFIFHH XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CUu6!1AQaq"2B#R$Sb!!1A"Q2 ?aҊKp5_D" wF*Qap9 ^[Ir,'n#t;^ԖB0g*}A'ևSmǭ680+FBߏ;mG=*™*, ɶ^cڨr)[L't?@cnf~T*md8)f۾zBlFgڊ.HioN88'##惍{h+Anm"6O KJ`.+s&.pm7;8RѶxYi5z]x4Ś. 3ef'4*iQhlm;QFr{,p $NqdivA7 chlybH $ bp;z |T#Ntz]5I'=Mc]Fuw/5ڶj%_{]t5okˆəi[sKi8> 'FlW;9wǦVG=Gy]}!6JaԘ WU%HAڍ[s$ĐL;KIϭ)PF&P9=(#k5vtˏyY"+}zqB1݇9z4jQWu`8ֻLc+7ʢXIr*qݐF/ՌH mV#|IڸY.~ fݬv䰃G%5]qrBY(=>x_Co'-OF·M kKu4o`wGvܑ:K \k 6;z{T5H)vak6kT(7m os+_ 7*niʱY0TYYŢ[v쮬/s޳%y|w+H]üʪO8 .sX u!.-@|I qHA0± (8Wocd4HJr${|~9c݀4Dk37VRTdz8;:pYea&7P2nN*q񾿢.z[2>>E}><e]K{jm$ǽyr˷b맦]5׃1۶O`9Ǹ錓hM惩jޖ:v &0H.9IL񷽶/2 6uڋ@TKAd g#bo(;N$ja֮7/I~:*E-I8\mޛGt;~f/jCc$A\,rA~u*}MFv7Ss@иW j^v FH R<r@S'܌g[-ѻ0'V%+[} cP!`&u ,d?dN)B$sj ^΃SN4$e3oL*L~4=?IoIVTNS$Ntyծ\O!y3Y֚TvÁ~UPVa!H}+L86lRA>M*Z(S@Zm $l[h ߆{qNܵ/>N;DgWpd .y;V"A2k_]3.$rLYQxm'-&Е~ة*ՒTsVփn4v愤G-i <(`$sJ[@AiE?{n<(3z v)(;UAA\!jq)ÓLHDjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/procyon.jpg000066400000000000000000000105351357507750000243300ustar00rootroot00000000000000JFIF``C  !"$"$Ck\"8!1"AQaq2#B$b3Rr !1"AQ2 ?kZh-O+dU~PS:aNr }s멨nrYN\T|Hq~7dSZcċU\#fLypr~uKv~ZꫦZ2JJsߝ9PޭU OVN^lw7c'HV]$N8+TNv GI-R9*]R;r?bGnNj02V$ Ǫ21d .c8者aFɂKOsJ+e<4EIm ߎ'IY, 59IYjNq0qGP#bvmsԍujIe2F=g9yӊ~795MPk?R{u{)sCJ l0l)gp'T0ث(SYlIdQjL 񀧏{rp$ _WQlq8<1y-mQ -4sKTѤUM=hF1ruq$W^I!Aa4Y`wcBC% ,ds!o[>=5Ϩbij^$HWОyǮ%5-z"ۏb< 5TsgO_([I C#mSrwb9?HAq,m} yY$ dsۜtڵwƏ]25DMKh;흍 : LlhTL zzn頱]/NykD4%EDAa1Ǯ^zFw+*8G.qXΔ.v{%TTQN4ڻӰ9%%6rX)+Su||k4i=2dK}w xi!L ı c~mLS-1W|lhE4%c͆ w?󾮑Ixv3"bFA˽J52Cn;tM[>a&TxP7aG|~L蛅mThjihrpu|jWuԀ~2q8#Q] z\uTi_#vHPM̲0U1T6,sƦ+dķM(nPʔբ 'q '*%sgNu¬Āx8=%RQxffcٰιOΟ=Uh$xAR`yU-2y:}ᨂ-*FI^8l|;)FֵFdJ Az{% дuP<)'O?|=Fx|] aN@}ms'̪^zw$ax2?vϮEM+oY-G E,ItH-*˵@nFJs_'p}1ԓikd)!jdN@ >ښ*X˥/T6~= FZ*)Xh`r>kϭm}S`i ~ҟgl`q5ۧ$QHTv>;cUW4[֊Zv`gtIժtZǂ1 %A32}5Iu{ תg[`[ƾtBql7[+Hm3A Q ;F9$si7r^mMGn"Fx#yxm5$BZ[u}M<%3Kd'Rf:īOu2OPo{ߡe NrCqggބ^z隚'RE # 9ct4zĈ 8E D{ҞnWBŐ L\`j>+^MF[|{I(؂7lc:ʨ:TR1U'}j_$4Q+y r c?5-ƴ N/,Γ~M,dmo?m[ I:,Tɹ92*6l>5McgrarbQ;MMTmlیg:X>=eEwvuέe=D1uMҖ &GrwWL쉗OP*#OǿkP@T}۶f ˻"(G$:|spOƚ88/P0HXa~)Ԕc瓞H((znΑ7ӌ}w n5mc>`;vMxlW0S+TT/M.Z\ c3߾Qy#Q8HC^9i5Ž&jdp(b5Ge_UVH5uGKPKy;GΥV ,eIm9:ӽ/T1BW=t]:oM)9nsCⱽ.e]QKbACљ^"4ˎ#oC-]""F޹n20#YX79x|T吟Nq^iUnvESZ!P\<5BZ- S"eLQ3 (c :.^if)4Hӱyx?Rq+S#T)c@Pp:F3YyqƳuW26cRJ!]C&JN2G}u MpVR7Pxr@}q֏%L4PI}th!AQƻ';:lGfH%*ycF@$J5zqJT"޾`pGq=Y!K(x*ʖ8H2$\pO:eM[IW!HV|ښcRI-U+P6Q[ރ鼄=,I,0F?HVF1%1JInaQKlS>NO>:Za;T`(ILTҼS+\zruDrMqi8g+: EZV. 5C,|9$Oa?js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/rhinolophus.jpg000066400000000000000000000070751357507750000252160ustar00rootroot00000000000000JFIFHHC  !"$"$CVs";!1A"Qaq#$2BRb3Cr#!1"AQaq ?pwŹQ"˨*idTLHaӾ+G̎Pڎ z{u6J^Z͗G"+/_Ô"LNuI}l@F%=8QK,cxXO1>bydU}8peW̳UF/}AFkc%VfE`t+̳2I;Y1葴.teZ0`t[¤dUyρBR::lig! 78Y*=Gv(:ٶizݑZ>n;a^4RvA&~;/Q(i_>pE4vyJn$7x A.* I[!0 ~/[|inč!)ew(M{X\&Oa+i(ՓC}\z%tu2N[mv'*G ]]dSQ-pL`ߧ)aau ~Ua †Nj5H-،@K ; 5~]3xR2tj_b0zji0)˿Kόe_OY.MDª.R-Ȥ2o빇7 '|JK]uҐT6 lkHV>SꙮK΢v @9kUFx#!ϩ"hob{M&F4|zFI적bR=c4TT[ΰFY}^ :X{ _x+994UTTȦћMvǛjxÈ2X̤ #R"?q;]/ d|Cę6{YMW_J];ODH㓮 :=ISOSцc M%0^~-Ѳ.'[ 9Qhn;mJDTKJ;`FePC" ΑkL 8ZO1Pxn噧s浔e`҅ p,Nle~CsXj;2ff |G~mot5ӎ[sk:McYcIEP 㫢'6(\߶ol1:9r s0%6|k)Kva h  Ek!c YEH p,΍;}1?4%yZɁzN0s19-It"~ kPw_z&Ew&YRBuy=Gejo}GI'l=̎fd;}]FHl6pEFgbE=Rj.bcpø }lF5s)i)Ftwcv'6[|\ #Oq[P/VxPZRa 1ʪO|$n1cBH[png@%iCYN*YlG뉜9qO BXh"1F.Kmm@u2@QXJjRu |P *H [<#Ϯ%eƕ+sQM7Ʈa؃n\}j}V7[x۳3,)si#4= [:xi mIyztł64FA;m~,9G_KN>#RЏnZQCqQWa zl,3eJw$l,_x}E0?b#OL$fy ,BuGXĕURi7)y]2 E+([6R|t:K2~؃Y8ʤ*BJ)0;j#KsTav8)y_;,ډM T4m@XXi:l7ò)u$M$4ўeYG Ow55OVA `#u[NVN'/+-DHބņ6BԳr%fc֢(k(\|qif -0x&iJ'Tov=J)6Tɣ7gkzb&csZUZɚAXP-*XgztZ_84PERIFiXKOĕU&$[k=crZ, EFDk!w6}>w8Q"^6FkR m]49;×TqVb?鰶`ؑ_V0;EHiH,T.e)bmi2]g&mDZU9B;b u|xT6`S:?l 3Bѥŏ0z/+#mJj4Z챱\m|rvJI(r13!r^ Na:op똄Y$UfydL%\\t#>XX㋎S䥊2y%["07zJ^[Y:[ $)˸D6:)`grFʢ% ۯmS+V;YXJ4m"͎Ak%"$U2׷\f:+16{ *P < ч Ke~\Eaab)js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/rupicapra.jpg000066400000000000000000000105671357507750000246320ustar00rootroot00000000000000JFIFHHC  !"$"$CYo"B !1A"Qaq2B#5s%34CRrt6b&!1A"2Qa ?JN/҇\!<&(܀M~QۭS3Q ΄il9 *’Ev2M”N۵Ŏ-d [.!k.-zDާ}7|y m ZCaO 8AR$ Xh4ꎺbRbeE)֝J0Tٙ[,,W\ ￶g cRSvRVTlAan& hMR,W%Mh'PI7(q?mթr)rhGNp7Mc,N V", qɩ"Gu4i(2V.[@6_hv5V)C>$~y;;5Ol uoFViTB:RԤo}`<HֶM!N3K &8flHN[-jP|FrwRWL)/7yqUW:.^~8ᕈӨ`vb\l'%^Uf}Y]SJMybLƆTS*b+KfloA{pJ2rn(b:ˊ 4ziUB:;ۛ)$ e,e*ВR ZRˢM`9P . ,\\i~e4i ! Xw{Yh0ںd!݀A""T2la6$?j4vˊOfJ[$S~Det2%u]ʬ*1E@ kĬ(KE:؞6GbjlT \fo5D%"iERGߍ8vʹ9utRېǐU Y'|酬FLzR fB7V< |P6DdǨiy;7 A 2s K/TzJDKC_Ti{(si $7cJǙv$+O>)ht/u,HHY-P=ZK1%PVppf-@BBRI; ǧUu]ytu)QIj8/EEL5F+ޠ3[b%ȌLMˁ *nD_k k5Tӳ3UJ(}t:W#[cF!! {wnqG6]J\Jt܃a1L09 OEx DEj^ЊR')%y;n #`~1JE=)I@6\m~ۤK:%9ޥHҾ{\4&J|en䛡FH*o%@+;bs7U:Ǒ-i)Jܲun1ay=NRqQud۟kc.u+iJF,}~1elPVQe:5( k1fbkG^Lwr%O):Pڮo64OԉLgt 䃿}^98``=X)7$H52MЦyI ;cÓm;uG4 e'>MzVMRI$y%^'MQ-ӥ P/ =ZL1Qp3r/~y47 1:*!u,^ymn1*BMLKi))9.%aj| 95gaA(k" |\ ty^Xp"Ү[ RPNvh ~LbtDF(n=! h[lU(ﶥϤ!N2, o12a(W0_"gM)S[թ+߹نJ$W,+f3-%8:Hsq\9Ddn)ƒ,N:N@5V[wsPH %$DJ rف*J^y'&DialQn/ZQVɔz/!SYCe+?ZWp)ysYXѐWQ #oێ.^CˠRVq'|YPo8 ):m>"Ė،IC!A/xgF!?PI<â;C=`%M9bWb;< ǦC~旒Fo)DnT8kPUF㊌S5ƪ0PUN߃?r2:ێuQaR{_O|&ש"~,eZSbغtٟ:e- Z\ G1 '-; l%1:@RnOI`5F\Y㎻MGARՐdxE=q֭>>UJG<`4E8I+TqS6⣴)ҳQy`zPBRT5&=|N\pþҧ~`Y1eN!J&ku!C,MMtܜVAR$E)PRDk[Im #m`t8wJncR}B9ܺ䄿0Ǥ $1SMdTANˤ01?[SK 6 Qyq-Jny*U{#Edؑ9qSar )HtX7m]N}$iҖ#)ĔH14^e# J'?ۈyxQܫPSp Kb,SynzwI HS7VAF^?~|x`ǎP`h eM͖º@u-=nt* z!r`!twqU?zԏb }l0qYQ\CEJ$)ͅm?+Rn8pHeHH@8%Cg&wE`fĠ1'js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/sciurus.jpg000066400000000000000000000110051357507750000243250ustar00rootroot00000000000000JFIF,,C  !"$"$CYo!@!1Q"Aaq26s5BRbt#4$%3ru3!1AQq"2a#34$BC ?|[U:PkqN07yMM&J$mhRO\WHaU0$MP(|qp `AU>#ƹbRcNŕp%_ Md&Ls%v qIW1#OMĖf16]*?tImC 7cVƣ$ R0N(b[y< She Y-O[oG+ Ј>]f;.y:թT|X49>ыή8GXx  PѤEozr25Ru.H+'ԫ{Jg:hm noyP`}:n<@N^ᾮ_3A0j(d)^Ug hN9\ Zw4'Y`j{Jp!qe)+½7KndS0yJJT|ߨ*\?+᎝xf5Cqﬕ(;lQܹq8j `$KV2Hrl3gԔQVGlyTQb]5?:l B6dzp Ma(S9 Pn<`tF TFe >2EQSΑW Y=Mi P*;>_Iݿy&hilػVQmm)RqYAd$UDf;C1ӆUv֫šڎbJTT09 ״_R5Ȝ9.S:;N)8|9H:I8\_nmJNIq}q$v#қV;WGMJ;g>^c"WxеaТ?hڴrݐZUP;YMib1LfN`M}m$u*>'|J+fWgAP6qf)*ˑG= W/$4$5AՋ(8\dKl?E9p9ahy K9cSsi.iRCOMӟCvT?8)u^VBRVMki4Iuz 6AK]䣮󭧇%jޖ!lZʲ5*@^8z uI`' ӟeyNH8Rz n 0L;\iB7 ed򭫅/2!x}Rw:uFF~nXr S)▹Ƒq1Wm$$$ch$DKM6BzN69/.jc% *$*>iMeX~' f@q+aeZOCʧHM214?M$7Y_&(Rw>>Z.P pI?MqMGS㞃mBII>m(Q~'U91AO,S7V<1m,ROMT ;Ć2a-PVT $t$-h|K>`dIVڿZe" `䄡Tt(uN>?faŜFlr<^mJ[Hgz r^^$(|mBwg'qOXDlO9ǧa,cЅ8!_1^Jj"k"-☉P)^O$"0IV^~[ HJBF2̯:Fuq4:~ssaEJӠ0?%Jrcb]~P*lb[Rj8Q'kdʽf\\[nrj!ԭ:j~5okTnVahʵ7W]~UqarǬI4fZ`[ՙ3U-jNd(7pz`~tbg6qXB6A9'uJA t{Ep$u"=ó^yI(K8xնzgj1c+q?ɕ;ZS 8ΩM 6~KP,KZK9A~w=۞bR(UţGqrb/ (gSk V}ݝA9$MkuMԠ58cYz qKq& G~U-+o`W5}+-j;!*YW;1wnq2V3EXǐӽ{=~wkKw6o%ӉtŷL'n肔$gFuzدsAayzUmwNKOz P8#vԭzf5vYqߘfYZs$ke}m!($|'* T5%n 8=º,QAVܬZnzJt8qV/[>ڂPq-azZ I<, f)#8J5~Fp7=j(;uֆ2mh"-"sbNۤoӯɷ;Pd.+ ?Í^N'D[ 8U H&AAOMlv#[u%:J@$ڥj?XBmc{fLhZ$!j 'dvùǐTNBޤ[Z`J^"w*5朸O~Ƅ$0-s]=;IƐܫEZ!u#_4tI*r #ZGu1o\&t$PdNHܝ8x;kVUfunxR\@)Rc}9>Y#J؆#L[!Ima#3Gn 0Yʋǽ!s[7ǧ9oEi+S.$ ;gUh{KEխ+JIJ♨۞27)D|)ctLwJ-FR(Pu"DǗٝmߑ6 -L<%MI ʇIJI)JJsZRHYCJe X;{eqj⫤DHPQs_ 2T|qҮd.̀eX;#|I=:dI#k\(Dcx^.8fjvP%GRoܜ~4:7]iLK,W-  78P:F#4e`͂8DH2,1 MTqJQ@9ڣ+.<ܯV:y %v; RU9ָm|xv&q)AR5Ӝ`sIg۵ E,6]eD@NBSM,=>:=Zaْ;g .xS1ӑnZ Hn42ښքvzY6\sn.2Ld;OL+7 iCm>JABTT0ȢK;qCS IS?Ҧu,|\}?[G=!?k㌿/~B6WZG➒?@Տڴ(|RIGI_= ?ޟx[+4~B{G9v:Ox|tyOjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/simocyon.jpg000066400000000000000000000062171357507750000245010ustar00rootroot00000000000000JFIFC  !"$"$CQz"B !1A"QaqB#2453st6CDRbru!1!"AQ ?<@s&%:,g GYYtkT3ମf-7>aC'{T.ieω$ң@fۗ;ԩD_7Ν䰤xU` ܚ7a F{=j:K^]݅E}qkEPã) 4%`>+adJ2sƖY]X|>xv_Z鋴sHpz"Pzאj &sG\wqڹn$r3R!|6934:^$jҏo`52Js.q-G]jѕWʧ$Q mBw rx g!T,c ڋo$Xs 6 @@:Er퀫hSڼ`.I6S$O{`;Ɂ>R՘\*$ͭO1gSf9l Y^;&l㶹OFq myG_c6Gk&UB忚oϵYcUYjѴrP߅o@G?e]qC_]i I7^ 8,z^a}g)7''8lО).юXߣ;+cҟx^Wi<{{K;B{`dtdk8\oq(U]tk㜱R `1#)E9bMy¬HfFP8_y')4M,"`gVeIބT+PӅğ%rNItIIf֮F(\dV(^0 n@A$Ki@n`2,^Mw.i-i{:NW>)'2err3cרJ52z ԸC)ed9Vnk4!oT~ 7`2dƋi]Ңs*1#Lw(ATrE|h)>R={mvd#||ЇΤr0O1>6}+IBsXW:>5S1.$#VȂb8l}`?jکe!gP9zwm_;G.'8[[ֵMjGNhgr#٥qΡ/5֥#v"%rW#|gp[љZI`f^aI ǹ=(Yh. w5 g u?*!z& =>`ҬMޭE,/j #=FW"czvȇO.teqI{\,#0G9#QΉC߷7|J:5D1{e$[_1w *\\I#HuomR8B.l<.psu -O1o59q\M:ˆHQFI?*wesdr2>u][DYr|͎S;d S1&×{n(^Oa}~rRHP2GzYaW_~4vLJuk8a\(|ҧ(EY$j7 3I6p!,ldam6ĜI>'鯤Ar <̱N}֩Z /5S e5mtirDуˌT7Qf.+AM+\ælե3r$1ܓOJ }zIZAi~&1y<67+KWdK[IͲ+@"1? e~/C1wJ x|TpXyT\ʯ -ڤsz'+7a9$,BP Y1F 7Q,܄8ӚY4[irO,* Y8 {t(3nnNRҡw>%N3fq(\A Ǩ>lc˺ n)kskkjs0esQͰ돭$cSUtP4yHщp]4lÍM$2Bn@H*WNEmNÅ?zlj:D8kúĆ8#HҬuq[b8mM\bTK8yp젮6xtH$FKb NIgs$ XèN{zOiBYp(V2FGDRwڡ\y #mCns`bٌ31ߘdԶ[S^YZ;FQkέ1\+S[NajVNb{B4ފ:O\)Ӂ +&/N[F*ѱ?UJ_攩Q֩d?:!kΛMJUhտxRiTR5oSC?iRBkRno*U+JQSGʕ*('js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/sorex.jpg000066400000000000000000000041171357507750000237760ustar00rootroot00000000000000JFIFC  !"$"$CVs!7!1AQa"2qB#$3Rr!1AQ" ?rc:!BRs} QA/[ Z6TCSN9K!$U\6($JHye`m@ZW:)2D3zYI)Z Q4| hS=j%aZN V+:k9A0HIFļ{p­e#*K~8~>K$a DOAZ?7"d LPU;;zu7\6U$Js%Vz}UZCQREJ>bqY;Oa@sJDǃ?-#4p~NZ>MkJS1:RQLh T~+ .d7yiO5yż-E[|<+wY@[*h5Lop_s.9wV#1پ9O)Tء% h˳}ΝEV\!z .3>E n)RVGҧn\~d#2xo\9qu(jZhFY5vqZ',#SVwdKu;@Xa* R檱B$4Z+w^/+IJ DUz}+mŌhC6 :z]bR7z뜸L;Q9 5!ŲBT,NԐ 5LLEs{Ė5so. Eԭ]~֣M9dq %|mw! Vt,k6R{3auԿQ#2OO5ZT ;ZQnSAGeeh#үCv f#օ{澛lqW bH*Nzӎ4†PFVfw"MP`w[(B{َ2x;rznvHMqX3a-îVCgkǩzw!.n+hmcڠ|\9KL5H< :ƾ)7ɷZdǤ:ưȶuR~*3N>a2Q}iˉA&V ; fAKe@#5d؛WaeryNDqﻒ*/2~{֘Sqt^JR$*^d8wN7N}Ormwmk$l*W׬IJYxs=KDn4gWnaMf*W#%n1,:f*zµGPS l$[Z2UR6͖BeH;n*yGG%3 -I%@U.8P۱wH !BwS׵u.2$ qt[k+* 4*{ :V1[ %JK*t4XBf>iS}aXVdn݄!>;'zvJ "D  SIhSȠ9l⑫',P?9Cxw-ԇG9D\&1GJ]-2zBכ8 V߆ռA+HF6&FNƴzaχ7IWfЮM6^,7bo$}*t`R- OZA6SYLQʃ8lhڬ4L@\k#*Z rLtWh]BҠ*-b$bM a($mA[ZL Iht.dl{QCHϜ֕la MRWZVaFHSB!4P @LL JBgZ4>nA۵*pZtKѿjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/suricata.jpg000066400000000000000000000054021357507750000244470ustar00rootroot00000000000000JFIFHHC  !"$"$CzQ";!1AQ"aqS2BR#3Tb4C$!1"#2QAq ?fHYP]kwJZRPHc#B}X0pqXXaG FQZJqIcѤAGR1d . +)Z 7X&-BR=17!Ԡ+o d4G*"*P)8+v֝ (,DAEzȶmFiOb^0jێ x::p╆+ߪεTʟNÓRGW4Fʤu*XYHMs~P Uiim<ïsH#9j72Rsꭚ' )[U&SCHIXQؐFrKMp򖜨H8֬ڋm q H4[?X^/kfӈ疊'#uq;otkAۓ4p9'GBRe'աT&މ'P#z W%jbHU),TtC*ZzFZRJV([醭(U6-ekRГ\3?R?-T5kBkbP+F*qmilJHժܔd}VAƊlbVx#;eAF]C)RmJη6ۤ5j.dϚĶ/O0ٺZe1- o۽n:cط˒$9ZQ;÷զ)\'ZsR5ˎfDnKBT@BN OM*cuˤ%[EN)2(XQpcBd(+ö8?Y!VzU-L6T9_NqmglҲeq4E;ZݭkWZA<F| 5٣)ެdv+!#/吆WDeʹjRSo4o֪^rP1%C|L#! m(mM8G0toj.ĔkRv jCiЛe:UW_1ِN]o'P*T5&q)na&@ "8?mr;`,+~צaLP9_Ʒ +t uޖ3_Vޕ8ÅEMҝh9*;R-HР:?Z~q7SR1$ #g\(w/) d3rqrj)gBS^>ሱ)鞤 t8թm#?{<jO/ف}5[/ v~uW=KDBsK: nLnï:ye{AZ>"ɻ2Ɗ"*h$not(HȯIwr֥s"GjJ[9"p= ):MNE+ "CI!L,r?RE@o ]^uu'a^7!E*.7 bHqb !jޛS Xi.n1|֪. mMB)Z=w>JKV[z^`8򱨢O-sxv&jn+DG$ -}z>]wLi !,%@kl`mKQe[n'SSji%(H w7% `Vt e%jѺ{@qϕ__eOJ?Z{\ԥ4js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/sus.jpg000066400000000000000000000116371357507750000234550ustar00rootroot00000000000000JFIFHHC  !"$"$CWr"8!1A"Qaq2#B$3Rb#!1"AQ2aq ?9cD1Cq<,!8]Aǎu>4$RaH8I>W:mOE-!rɲt0#'c}Aӷku5EP0aidPӁUW9aۃO):)ն{tB 9advՁa4ISA%`1 8m螞TIGM&,TJPJxfpۙ19ƝڧVU0D `aN%,82&II%0ġ󚁳<0<3?ƒ3Ýk/mm2P 24ܣmʩ#Bwa>tt31W-LEKi} hi*%-de嘂~à 1vhਤF`}ÊXOW=$;K~`,ҙzsepmR\3KuH]ґ rdsؓ|=X?}9!lSNzhbJ) czIln4bUGX-7GӉI`~= Ot4ƯHYӈogr@ƓԲYզ :FFH}Ăp4[> IyG‚?Rr~+dTA.VҽњW:r*AdmcΈI{5ЅfoU*26y$c$8K14F,+#^r =KgRԏ$Y :$l!N{xEtym U$&8 ?'y{Zk ysIY cύ.RMS6fvPy.O,N*gT 8EE 9^W&#P] ]%GohY+yS\QC6@ϳB麚䧬F%ۍK{'_PX=BȠDTw~yw/ gbވڹ.`BQRj$)ǴjF !=bwZm 4\DUNfm >Yji^'?]RYqؾ{mosT<m+%4,؄NK KBFbjhu=mnH.+UOJ%|r;IT /aK}nʗFZii$AFGҚi M:n Ptʒ0{ 'A ;5 mMH f@8f S*:MnF7I㑗 ?Ʊ0RŖhj)2l pI=kfKNR2[n' >*H00A?8םt=韻%Br,܎>>x=U$I5T;;dc<] ϪȊ?dp 5_v=@U2NSh3Iksk]{@GWreYcFApkxJtijf`yw8U;F3shgԛG"ÕOQE݀˻< 8uK [mDR#JrI#0a_5, σNAwpG89>utZש' H@q0S]B+%-cHVgS$;"i%WԚΙVA3)`c䑎M6 d2]!("-sƾtzeRKMq>1ۜ{L7JjZsKp<8xdIiW}2HgS]3bJׂT<,2#6A<;4GE@'!w8lyEFQ_}UskzO ?<qA8UnVjcKS"//#dֳzfZYb/6V0iǜt6;MjW^ETeOQIvb W#&H Fddd 9uM***m<1nGl3V*;v WS5U3`sI9ƎE\H,#2u 8 ƂV([k`fn[U0y`9ƴi,q\ڐS#8(O۱M{[YX\w@A|~5GOCT[#6UoP0\hϜcƶW'ţ%T&*te֝U:k$d>1֩cIiky9ÁSWi#PO@:_II:a̭HP7Jkb mi]|6j9a)rv94#_Emk AF^3?:%QJI{\H9+M\--JW $@th_$ΐZw_K2JGsw#恵P\HY=i>qg_`{=Q$h")w*0`I109?k;S?JӤ()E!I$<554/f?#BRu mpD'*I`͏qv9e;3fjs433jjhl]& pU,iAi7"88{XwĔ׸⎙lEp7^Gp1u54E3k_OKIK2 F:*A@g)d6oAÑ8u54胃U䆮zZILUHS6H/YUr-ʀ$vHsv<~u55(UO9aʜ;<Ju]ԒA#7]̥F1\MMSM̖F_v+REǡ47թ՜w|ikE3gZtT}CPc_A€kФVT}*kaO-PĞb#NKJ4b}oDQGPۑ"T79٣_xqV%^>Jى>.۞")-U 0$U]sʎXϸx始 9YHHYxbVU9 cq!th 2p"G],dK(ӡӄگUtIeH ,y1Ojm$Ul , +e& lQc龄z;y4}jg@E9JɌl T5d-Q)erC<`P^Y[1m47& mj9ΑNH07#m0*)*^t3;y[:NKQw4E2>N3V,ܣ؛(mt"A'O.9JrT?p vyb# ?RYjg?/brO5|2/*r715 (x&*Ra[<3n]xe.,Lj9Laޚ1j2\[  KĕPۛ97]h˸Fx|N2:3Nf`av8;~Y J O4BTu>9ҩqK1e_!P;y@E $AOmv|)  77)^e+vPұC1oT YEK!6{~I,R-|}Op*ȫԩ@hg K? ojc AwL6wliDȣ1S̓o|`5*VŔ* }@=uTY 2!ma:`,̹fEcձbLBr`dԲA WIIG+ǼySdSimKM8 ,[j䤞N/kGҭ|r3ZdFg/In4pp^kz{hO N-Kt3!$ztRSd <9PI F~P~֘d^Ζ)b-\d)WnV $'ǫ"$QO?fzh#\y' ц%ؒ/+tFxLr΀|>-䦬\.uf?::A!k^RO7ק]\\kMk9Eyc뜶hnsQu +`[L*a >`{ԧؕt_F>pvGl[/t<1k\DyqqGh6m19ZW![ UB^P rcd&q$5\ AH6iM ~kޯe󣍶\ӡS.No~~bz&ش@O985n)?3d$X=Nk`I5XUD 馆Ջ?HSPѢNNRX-Y59&r2:d*%wmjԣycZWQIp4c(iTYB .Ғ}p5KvQřYjRBamVMP[{H`QpLuHdT-EY)^nQʇ:*RO:Y|m%DfjȌeTubu=}ECQ%KKɾAϮ<\GM/ G͓͍ Q {{٪:7m {`w:Z/(ԬQH-};ϓf%Hk\%ICے s30WӔ/$r-PS9b go誊-Mn4N+IX,lv9;|9\bK*SVYpx VMTeQTA f9}FxdsU$tbo;t۾9jXvOhRivu`$gF*;Fȑ>lt:8ѧ]XR#i%6seP<#E}bI}C]=DTtI"1moB?TUOu]+,>>/G/I. ~eF~S-#js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/syncerus.jpg000066400000000000000000000077551357507750000245240ustar00rootroot00000000000000JFIFHHC  !"$"$C]k"9!1A"Qaq2Bb#R3S"!1AQ2 ?"F0=q9*섛7RH.)nob%Ex]u(زҵ>桸<ݐ+43'-X_M§sdLe3G6i RZޝ6mS;=]Ia1xmX3|YaE]$>QyfYWSD%/ ct*GCB I'4۔Wo{w?_$jJvqP*%QeO>;ESgY,ᬍ%r>Dt71ڻ9!!ly{/̫^@=Ǩ>sUͲ \G%D)i{1a`mpvyi"MwE {b8%q$ut ŖBCZz&j9eFU$ _>L:[( fݤob%Aw}<QHdIrBC XJdYa,}]GeT_oWc dh$v~4$Y#e]$az8Y2^+}_1|ZvΪ!`H"[b8 .I> gEk\g$zY[}õ?"ՙC?p,6TYC*vY*#r:i9ٱ泐o*s5,<;T1 Ak$א5-}½mbQpIM{i`Jˤ_֬EWVpF#4vkXOjm*ZHRj&sNT$`Lq2WUCqY]nN wrⅫc}\3lYB(  n:ycU O&016 'ON XAmeb)V/iDka]AC_HK /WD_p}uЊ `ἆ"i! XLfE1++ ۮإ)UBfR/{{liRrc5ы ""6:;lfrV6M@X>;aqq]=CC[1nN9VXځ\O\4XWfKE'1m%̅6V:W:Z-hk}T[ Ьr2}BҠ7-RCPrZ`zAe13.QLsB3VH!8t䟊W"eupmöo/)OG =>Xu I㧷x$TG9Ბuߧ^uXȳYidHi$؂va'S5cdsֽm^TrhTY[ n rC[ *Hk; Н:`uhͳa)=5<&@-@7F]%$Q܃cc ~[UTˏ/z j4!T9|xݘ 7}q{6xX3-/]&vpm}w۷WG fWx0ˈdU"F7gEWI E\%cd^a ~b8s *rQ,1GRr,w_ E ڠPTP=ɨ Υt2u)dsN7pqZkO -%35tq$lh꠆0T"="&eߡXo|]U"6x%,Eaw@Gñ7-"X.v Bcc)5#0o{tgy̳ ,siIDEak@wZwjiߩ#P,n A^[~أ8b*ʦ:P%ljLW-|1ʗIFcM-v  brki"ec#%b%N'˽ :0FTO]z#|Uf4K'FXYI_ o{,%z!y$Udkۍ7ov 0Đ0XfT#o|UrI^jYy ٙM0KHFZB\/1[;"5Af)*k~xELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CTv5!1"AQaq2B#Rb&!1AQ"q2B ?nzvSUG;}xI}hjeC8_m+CC_iUbgx)N;r4dI)&̊Nl NAݍEylEUҺN@=f9u~`i&EZ4inj!Tm=:yƕP-% ց̄SN#d34S%`iKuiC@4x7+싡*7&x[)$IQmZ54ey 78.6i+ 9 ZC[m4!XvǮjŰMJYEu65TK= FC4IUIcO~_颍7k};!@7> `)bjV4JsQ^'jNH uGjF|V8Gro wS[ g[!S]M F6'l0#{ B֓[Ӓ#𼼏}5˓KvҎWqj\XJE'UFƢV`Pq5t v.&,}5cQGRrs8s⋖3AzRO 󳐎$w#>N8ě+zu[m"0f>Z~@}éhMRۼ?AJ׭5[IO RNI1񥠓ٺ23T$\H'蘯[{LL^3rm5M23.vx143֒['!2pu9NWQLQ=A)a9n134#SRf֍ocW_SCC ?v㶽4rv Z\UQc}4}zTPYUGe]gl﬌)u}Jf7^2~GO@,O OAGY]p}t(6xw"at,xh#WIi<$fP`Oh%06)I!,7 Cvhb2)0Oƙ}L.pGi A#998:hŅCl0pu俏|eW$agPr,!IXcFD%7(HD4hu S,g}˻׿Gc5m5*QP2pX lR×뉤*CPw<|CHal%+p}f+խżIE'FUٝOrImf^Iss`"$~1#ƈqPtM5B K ZTW ;J9Ww'fHe;Oۏ9J0V'(]G$XD9Iw y*vsz\=+ny̠\|ZVF44¬dmA8ڤ:_;c-9k Ru`0#]kjPw1ҔU*F2,w3.XIlY|/v;[T1Sp2O9Լ<9vxS2BOd[bc'28$^K6CƖnpqR[lX{S%XqmsGe/#\b,!]RsUGX !V-m#_-U>xIGV yOs>ТhũgHⲩ0$`v?>sz"ZRPϟ=)_(h&:6_HlqIA_ HRm/WjUbR <ƹsPT%۱iB4TPMy3R2RgNQ^+2TS;ƻ#'9=8VKMYM LUA:ONƃ9$jJS**\j5T[%NċC`|Dɽ4J"#IU"*T^]QYF?rl2\)横<ھ !?ZERK@ҊV-lhOYVmM>[׷GTxDDX{;|)0 WE*/'<:HEu3$GKWI_Szr _C C8Ӷyt(J$Q* l]EWpTMNb̗J0'8#l`!FR3j2WS5{m f=8M3lz3KP;3$pp};Mlz-PG ɻ I'ނxk*4;YC`Ei kMqS塨SES%*`R[`'.}O?-IQQQIcL@%>ֶnR2$ӄl?m?+&U+PvBqtC 3D$q?Gؕ ($l|~ƮXM.H*7bdg-_c*XBR_#wH#jESG}5(&a3v('[ѬUtC^q8ieAjbId~)lI₶*xCTrOi:r*iRReB0{#&%hV`c~%ses+N&21R$*uMAj]e82s΄7e'IԴ%=#Y#RB:-АW~$v`EfkC:ZD4V抝_!M;qJU-k0[Q r-ahJy$O?O|aY뇔W.!#770Tuُ1{MSS@AmQXA y Cw#j:yEv;8j3 iO{ljIIĬfbPuJyR@Ha`@X>Zb#cLE)֙ (空Ϯxm%4< f$W!z]qs?T"pu2ì+ 8Gľ1 D:F& DŮ8XͳfHD'V\B m+=r#Zlw_+R+YJdZyi!Z7+Ћv;ybt*rN+Ȋ jD[p|Eg[K}F[qqqE13)VcI%3! %e%%Ui`)$c,CI'P C/G5 OQ2:ҕK}v=N/r(U|2hNnĔ)Gjmv me2R͹յ]^R}1]s\,ș_%4f!=Ci*\J&,v*Wh5捘xA:H15š?0::oU6"s-cR fP~*Cd,GL^S$ 썶Ym x`&MwRHA6zkmG܆*}|>(Pj"ґT[;65d,Hw4 Srcb<ޠlRm60SC4#QJ.Ew`7' ®Uۢbw p#S tewKch/䫖<97]N]Q,+^7 ֑_@ N[+|} tQLĄ@ [ GxgsRVcy A;opzǦޘghX&9B9i䅸L0_CIR*-槤4g,slY)Q^ZO/;'#T (l@!_4?.t]`Ǎv~Kun!fvsFw~IEELGjppz6qDs eV#D_^ƻ*T<9v)Y@~-rI&@zrY%~!.ZW[q l,*5)GRk_ XB9)*W.hRiΑ$Tus)%]BzY^zVW6J,~&J,F;qʨ>i qe))T#IGYwobE5@#LFW!U'tn$ufL<.o_K6:sc,!Լm!P}_QEΛ)EreM7&+%CyFBdm]%7HmzZ6[Xqu|lr\oe2djTu;kiܾjN)ҕ*B{aU} sDl!CrJA7OmU+Zv`j"_}Q!I%MIn(xOq[)rCVyr24XJ@I6Za)xKD)ai'ȑ<8%qyiKJ'-)UE*LjCm][1@q1^FfCf 8XV=7ڝrTqㅊ]c^O\Ks%NTTۚit vƕRBͩL%LHA6;|*+u$R+M,]^"R|mx[aJ$rJJo>A;LHH֘WLz+DNvEgiEMm%!NrE T&HL-Ť8@'blJE|e*uJ^HI޻b<ssmʅf%c5 }EN!wI ZW&e#JqZZT |q`8 E|Tyn㺡{_ DeZ }B_ 5VSʋ\**Ua<\ _~l-92d%K,$, ’~F4yt:D,"Re snN͕4ѳ\'n w&5_~8h)hrD^@PWKbdKe4t.Ga9UjItHK` )"S_AyktV`3ƌr4gjV[qjCFa̓ݎ'LvFztsPV)1dJ8)^)j|ڃ2.'&3 NG_ 2FU1$PsC!C XQJT52kꐯW(s8m`ʕ7Ïs}mdX(jwX \FSjsfc<5EjZg.<-a$`wP}D(!iuc#1fm-fn>u˔è/Ԝ+Aaanj=і'hW+`rڐꓪ#qc8eOÑev*BTPmCbzM8A[&@ L`Di夽Dl2@sM? Mц1+-eN&t,@$,LaٔE-JoYc0jnUMs ̩O@SBpHOmi8?* BZ !-Xm=Ӆ)٬R.484a#912@(s=6r; O .RbO-է q4TFLx*XC.]Z yX9TeL%\zOQ.$*qqj:U*u3f  IZVsIU YqO%s7ԝk|cD;˰ae-g6౸J?p>qdJaUDw!j4lH@iK%o;)SC Wx,Nm98)iNK\ļ LtR@5*Bm9I]I ^Ne\ORZ$`nɍ 4[GgOc3D0$:0|0V}.W^W.ʶo3B; jW}\_5YH"acLJԲi4:Rn Ɖ4N;5GT qD-Gro`z3($QPlHnXX#sMLWl <ؑ,wRU3 RRp @>lVk4J;t!$gSd[[,4$TJʀ'̞c,4N %k2y^0Ot-.& $!) 6l,,8g>yT&̅_ !^_js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/tremarctos.jpg000066400000000000000000000065141357507750000250240ustar00rootroot00000000000000JFIFC  !"$"$C_h"7!1A"Qaq2#BRb"1!"AQa ? )SPFN ^t^RI<ͩbeE4kl*LI*zÎ?GQ4FUua=+FGT$nͅ䌲u?7c $lY7bOQMLm!gnmׅ] dYvq<*A8P[ D1$zUSbIY^wM TF~S#hHE"/7!$gemR[e؎G8;6bX%O6cdt,C|14cS̅(d{ g d- 4];v`Gu3MF`Y)}ƞ ~g_2*%<ΚT r oVDVQepٖaMO ,}l @A17z~M7":;v^gZnbA[l CuTM\S%ubcG$zT_}Afg5 UQVK <>Κ  AfE@]<4Ôћ*̬<lO8Sfm"9%ߜvI9bo~b5=]-D X4MqKV]K,larXPW: 呡;WHDYEE];K"U[Mߝ"i# ądm VGn #m5z@NB ]Հc'Q攵ҽCPo~X}aAGV(iŇ64A\Ȧd /cg~L(*}3̜ZoJc}.q] ;r_=3+Mα" Zc# =CuIVkNctXPԍ# ʴEACG9A1 @;/pm탮K7YEMyd䕳zשzlI.^Ago=t}cQ[UPfkX p]JA~e,lـ'gZFK&y5?81ڝDNi0]JFٛIUC1*Xb a\Ȗ% usm}2ZELUT245(v;e5,p7,|{s;S-#BE) &@^rDI$ok^vuWFcm1{q`#ۏf] *( {ZL\ө3Xf;llY̮%[Kvf:nom#Bu5 jQ6%xѢ 9sf jI2_ą Ha X~V•M@0Xl?%E1i5ia$ qqe):7"@_#A"ZtN^␙!xY(y#moZ"Emz42ܖP,y< T 3ʺ-1$LX[_D$Ҹabno]кTF HKH{NjZ ,4]}-CU+]BpwԵE|9rI?c?#YU\h:<+تSsa%`_OÆ_C]-_E5Tlfefh+7!4)PDkma BYn{_|ͦ{\W:m`v¬*, O83ܒ*|u `t_kk2O[ F.0qzlJ #,jY?\aLI 1Zbd"[|v"9dGIU=k-hFhRAһ0KsaF_TQ54̪]YEŁk%(lNL=lҩ*4 22}_s%i cX=Gs(Y(c[&<6tO~Se;D\9 \^UQEԬӥX;o%ewP-?dNˊnI6}â r|-VسiGk|0M!%JbB)K}bx'iYL&!"gd܍,֜&*MNbcTw<9f~u5Pе*  $W5~}Jr̊`Qkw*88妫J:fux{m=+s,*C Ď/k1'g4&z.z Fw$ me>}&h)G?U*O_T ?js_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/ursus.jpg000066400000000000000000000300121357507750000240100ustar00rootroot00000000000000JFIF11!ICC_PROFILE!NKON mntrRGB XYZ   acspAPPLnone- descCrXYZ4gXYZHbXYZ\wtptpcprt,rTRC gTRC bTRC descNikon sRGB 4.0.0.3001Nikon sRGB 4.0.0.3001XYZ o8XYZ bXYZ $XYZ TtextNikon Inc. & Nikon Corporation 2002curv  !"#%&'(*+,-/01245678:;<=?@ABDEFGIJKLNOPQRTUVWYZ[\^_`acdefhijkmnopqstuvxyz{}~     !#$&')*,./124679:<>?ACDFGIKLNPQSUWXZ\]_acdfhjkmoqrtvxz{}   #%'),.02579<>@CEGILNPSUWZ\_acfhkmortwy{~   #&(+.1469<?BEHJMPSVY\_bdgjmpsvy| "%(+/259<?CFIMPTWZ^adhkoruy| !%),048;?CGJNRVZ]aeimqtx|  $(,159=AEJNRVZ_cgkptx| #(,15:>CGLQUZ^chlquz  %*/49>CGLQV[`ejoty~      ! & , 1 6 ; A F K P V [ ` f k p u {      # ) . 4 9 ? D J P U [ ` f l q w }     # ) / 5 ; A F L R X ^ d j p v |     % + 2 8 > D J P W ] c i p v |      ! ' . 4 ; A H N U [ b h o u |  "(/6<CJQW^elsy &-4;BIPW^elt{  '.5=DKSZaipw "*19@HOW_fnu}&.6>EMU]elt| #+3;CKS[cks|'08@IQYajrz #+4<EMV_gpx %.7@HQZckt} &/8AJS\enw$-6?IR[dnw (2;DNWajt} )3<FPYcmv &0:DMWaku (3=GQ[eoy&0;EOZdnx )3>HS]hr}&1<FQ\fq|    ) 3 > I T _ j u !!!!$!/!:!F!Q!\!g!r!}!!!!!!!!!!!""""%"0";"F"R"]"h"t""""""""""""####)#5#@#L#W#c#n#z###########$$$$'$3$>$J$V$a$m$y$$$$$$$$$$$%%%%)%5%A%L%X%d%p%|%%%%%%%%%%%& &&#&/&;&G&S&_&k&w&&&&&&&&&&&'''!'-'9'E'Q']'j'v'''''''''''( (("(.(;(G(S(`(l(y(((((((((())))')4)@)M)Z)f)s)))))))))))* **$*0*=*J*W*c*p*}**********+ ++$+1+=+J+W+d+q+~+++++++++,, ,,',4,A,N,[,i,v,,,,,,,,,,---!-.-;-I-V-c-p-~---------....+.9.F.S.a.n.|.........////+/9/G/T/b/o/}/////////000!0/0=0J0X0f0t00000000001 11(161D1R1`1m1{111111111222$222@2N2\2j2x222222222333"303?3M3[3i3x333333333444$424A4O4]4l4z4444444445 55(575E5T5c5q555555555666!606>6M6\6k6y6666666667 77+7:7I7X7g7v7777777778 88)888G8V8e8u8888888889 99*999H9X9g9v99999999::::.:=:L:\:k:z::::::::;;;$;4;C;S;b;r;;;;;;;;;<<<-<<>>&>6>F>V>f>v>>>>>>>>???&?7?G?W?g?w????????@ @@)@9@J@Z@j@z@@@@@@@@A AA.A?AOA_ApAAAAAAAABBB%B6BFBWBgBxBBBBBBBBCCC/C@CPCaCrCCCCCCCCD DD*D;DLD]DnD~DDDDDDDEEE(E9EJE[ElE}EEEEEEEFFF'F8FIF[FlF}FFFFFFFGGG)G:GKG]GnGGGGGGGGH HH-H>HPHaHrHHHHHHHHII!I3IDIVIgIyIIIIIIIJJJ)J;JMJ^JpJJJJJJJJKK"K3KEKWKiK{KKKKKKKL LL.L@LRLdLvLLLLLLLMMM*MUQUdUwUUUUUUUVV$V8VKV^VrVVVVVVVW W W3WGWZWnWWWWWWWX XX1XDXXXkXXXXXXXYYY0YCYWYkYYYYYYYZ ZZ0ZDZXZlZZZZZZZ[ [[3[G[[[o[[[[[[[\\#\7\K\_\s\\\\\\]]](]=]Q]e]y]]]]]]^^^0^D^X^m^^^^^^^__$_9_M_b_v______```/`C`X`l```````aa&a;aPadayaaaaaab bb4bIb^bsbbbbbbccc/cDcYcmccccccddd+d@dUdjdddddddee(e=eRehe}eeeeeeff'fyUymyyyyyyzz*zBzYzqzzzzzz{{/{F{^{v{{{{{|||5|L|d|||||||} }$}<}T}l}}}}}}~~,~D~]~u~~~~~6Nf)AYrӀ5Mf~ȁ*B[sւ 8Qĩ/HazĄ݄'@Yrօ!9RkІ4Mfˇ/Hb{Lj,E^xĉ݉)C\uŠۊ(A[tۋ'A[tی(B\uÍݍ*D^xŎߎ-Ga{ɏ1Ke͐6Pjӑ"]{׽3Rp̾ (Gf¿=\{4Sr +Jiˆ§$CbÁàÿ<[zęĸ5Utœų0OoƎƭ +KjNJǩ'GfȆȥ$CcɃɢ!Aaʀʠ?_˟˿>^~̞̾>^~͞;>^~Ξο?_πϠ!AaЂТ#Ddфѥ'Gg҈Ҩ *Klӌӭ/PpԑԲ5Uv՗ո;\|֝־!Bc׃פ(Ij؋ج0Rsٔٵ9[|ڝھ"Cdۆۧ ,Noܐܲ7Yzݜݽ"Ceކި .Pqߓߵ;](Ik6Xz$Fh4Vx"Df4Vx#Fh6Y{'Jl;^ .Ps Cf7Z|+NqBe8[~ -Qt$Gj>b6Y} .Ru'Jn Dh>b9\4X| /Tx,Pt)Mq&Jo$ImC  !"$"$CWr"< !1A"Qaq#2BR43Tr(!1Q"2aARq ?玩Gh,K( WR\J9!DsgYN\,RoVI}IB)'z2BZT춿-:l:Qh#Ϧ*(5 exK Wn;ԭ@퐬~j A*;:p P*% |ށ[>Յ0RL9*S$Hs/KRv h6W.j)>@>jtRKܸQ8PpT>Py:QKf/!FKqʰW9 RR2 P:дD!_m9IDZ) rtR}wDH PeDυD(lrmԺr[mE?;2.Rmo- >S]GG$HMCi6%#$jRšp|J gV<[Ւ9󪔶` X)QȦS*PZ6Np}I܊l`֔W'pFA*$g?lRaQJej6FuaYCpT=!9mnf݊7ؑyuf8B2 88 KoDXJz!Ď*  6po &!˄MaQݏBO]@kHH>Z+! 59iuo;U|iE":Qӥ!'5o@;z-cA*LFI+ZA aq֝ Z7VBc_J2,i:UcL~/X$KYv;ӍMbFV7G@׵ptʱ*]]K8 ls; no, JmbI!߻݂psW@FI@*GYs=/t?*RD?kVo^e,K( Ж)Js zmBbI"vnVմ"qэ1i/u**IR''JO.Z?#yԅJr%H NTPH-)>ʂN$M&=3G!l{YaOþGy#[Ԓ죿틏N4J#PܚuuC@ 3DaՇ`Nl9VTxR0cIO9Ix|-=I^K%@g}o{96\moG:HOqd R! 8%P[ݛ79FE>ROr(n6X2$]ݹy³OuCj ;GB)[C![['!IqKq˃Gvr D6]2x24BBRT Ւ :>F,gw?V]C%Ѯ+@ ^UHnrrhlj#Iڒr]½qIprV]G N3[?=߰,[ V\RU5$o1ֶ&eKc15Վ0JBG:l~KTpvQj; 1$(9:@zwRN<]S8(]5ԐH$tY p~jsJPyV&O|֬cȐ],UѷS\AIz;'T2pK'>bxȗ ِq+. :mq@eDequ N*ڝvȍ'jΊ8OLg4|Q`Xzrlt8*RNviGS\h%[VW{Q2\w*o;(T8l40N< GJ,ҲdN}k!ۇU1=1W,n[XR?;@!5T9KQI'RM֮&7"J+_E FIJz=% ECP=>q3l{26JyO?<6ԙR*q->Cʗti9qq\@@"mW+,:0lRI~vF46T2Њ㍑>xRMRRwfJ +#$_PϯZ+-lwKY ;-lJFRw)*Tմjs_of_ocaml-3.5.2/examples/hyperbolic/thumbnails/vulpes.jpg000066400000000000000000000224401357507750000241530ustar00rootroot00000000000000JFIF XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmC  !"$"$CSw7!1Q"Aa2q#B$Rb2!1AQ"aq2#R3$ ?f&Q֥Eϥ(>-HHL-{m֔r7ʨfm l߆Uo:ZS,nH{zQJڼ!PoXl޶SҴ] ¬Fr]' rR1==KnzyQ0ʨ6 $ \-( &ȒliW[ c\JQ! Ԩb{SY8&v#qjG7VC0}1-{2&NFTvk(HZ5g[SE =0y+I~_s;sl ޔFNi@caY"v"zy'[)Ƈv18Y`$Eh2u˩ocuEc""4QҤ/uv~,k~y{*,U#M9 l,X7>_Ҧ0:tRPȔS)D;j*ۆGi1JJUSELH:c=¶kӸpՖ7(8TP c,:Z#sCa, oZf(JE3p7Z̑H氲JYE.QHeI*n]“v,oYxыDO$`t}{ϒ-+vtR^Q)C \6I8SxVZT#-2絅lPХ^])ʤکߋxcZgZzjccPWψetڭqo:5,tu!X.4#/25>si&aZ}q)Aq`B|nff*:J^4%iSM~422B8)"_C\Ejt֣F`]I@zۧn²8ft[m`l5_71SvOzYf55`UzJ(O8QkדX)벚Ps SuX^d.6Uc+vҨBM_.L5T$TsǗ|ĄxVt翡 L[MPevuC6u8m֩-o]rA$Me•,ܑ\|kҀ&-R3굅z`θMXʳkb˨@lz xwA'bM#qԑ*݁\ecaAW. C)eֿ76}~2lm-TPacKKGC"[/G΀\bŮlO; q}&mVv7Q#CZECK@Wk߶`RS<3nj_Dko-akc@I;Um.Qkv ժ?R"%,D`䁸7 vę\i4ׯ]aYʩ꠭IOR.UPIP6 )LٗB9~3;h4LY-᧝G@ao( "?#U-I|lH̐HEqqf̿nN ny FMoO3CASQ/IDqmN~.]+vTR:I<0FZb"-xaz43l=0<5JGWTx9a}&aoO Zb*2.#uRt'\,F ^@؄qFf)Fmœt||1$k<,Szld jŏ#mk~u^2+ƴӉcǯ逴`KVځzI'=(hD$]veƏ0 HyITP##$; [V/9䭯k:6q \Ÿ`m*Egη 7pW75:SgMq[rc rꗡPid]ObGM ͔t| >{ނ㝢VCPUo_lvQܻ^aZTͣhi8 ,UY[S A]NRQcьu܆)Z~V['tkVAAͫ(R:KSʈ9s̩i +t]O_{}2b#M?wGe>.0˕I@ r\0'M f"Ӗ]zTY%mTE6Z# ,iZ1{ -rokr1K2{h:ySBA$E6)5pL@*gf\k [E򠻳5FUqM^t"2tI{8۶+6֬atCQF\JS~LtE0f[~VW*; S턤aVbk im%XIjrTrZn X>vIWJr,ųGOt؛%&nا Jƒ@o:d5TR1m'ʞ5 [ gPUӣ3Uijy>P;)8HV.L4y]%oSQ%$R8 M'5 ϥF!.lUߧfJTh:#lv~E0wA!r[_ QuiY[WU(FaFxkEKYYU%S4$ ؒ44,1aQ\gyl1Hxb2߿zXRQHB'd;mILe ߊ&!AWN`/ԑΕ^B+*<N;7JHƪAv;S;鉅k&2F%MN޳MU5$uU @7QbA鎴bR@cxeUqjla d@tF%7@LK3[05[\Jg5y%iM1!Hpfc.kk1VEnY,t5-hdRF|Fy(Ewo֎&anXf |/, JFv[I7 dlKsrkj^K9I߿2Ѱ6%LN$1MՑYW@ }6`_ΕP>~+ʐ,4qL*eGcX`}@aY8̧ް$̀{iNkTi\~\rC\{; w5Y"*x3E~ml[KDC QZ y+gT ,[ d)C{Z_.T<Ƣua BHVžLk"P9ڣZX*cKUESc` A┌ە*9|+lڊ )H)S=v?L;#Bmjb_WNwóCi2|+$H135O˿#l\D/ԛځMF:9|Bfcb^n߾f j#n~ ȪT&LjQ1' n7Fŕk]j*oSpƳNV}8KZE/ziE6UQS kSq`lA?|j61Xo^e,Bm)hKQ1H$Zָ(ߛすto+DyPT!Oe^ ބ>R/@BGF]ޛURUB%H@ـ.J8^_n.o cM0yGy>.Bè2rz'qN'lU%vҳ",qƑEV};\ #%(Gu|oCSWꊄ TQbQ~ _%f{1"GUU) rMC$16Y j)r~_(DJ.U_UU5i9sXQ6yRIW/0CΛkV?4.(tu]0@RYWʷcyYbVCƠѢjdk5js_of_ocaml-3.5.2/examples/hyperbolic/tree.json000066400000000000000000000111101357507750000216070ustar00rootroot00000000000000[0,[0,"Mammalia",[0,[0,"Monotremata",[0,[0,"|echidne",[0]],[0,"|ornithorynque",[0]]]],[0,"",[0,[0,"Marsupialia",[0,[0,"|koala",[0]],[0,"|macropus",[0]]]],[0,"",[0,[0,"",[0,[0,"|lamantins",[0]],[0,"|loxodonta",[0]]]],[0,"",[0,[0,"",[0,[0,"|priodontes",[0]],[0,"",[0,[0,"|bradypus",[0]],[0,"|myrmecophaga",[0]]]]]],[0,"",[0,[0,"",[0,[0,"",[0,[0,"|lepus",[0]],[0,"Rodentia",[0,[0,"|hystrix",[0]],[0,"",[0,[0,"",[0,[0,"|sciurus",[0]],[0,"|marmota",[0]]]],[0,"",[0,[0,"|eliomys",[0]],[0,"",[0,[0,"|castor",[0]],[0,"",[0,[0,"|mus",[0]],[0,"",[0,[0,"|mesocricetus",[0]],[0,"|synaptomys",[0]],[0,"|platacanthomys",[0]]]]]]]]]]]]]]]],[0,"Primates",[0,[0,"|lemur",[0]],[0,"",[0,[0,"|tarsius",[0]],[0,"",[0,[0,"",[0,[0,"|ateles",[0]],[0,"|callitrix",[0]]]],[0,"",[0,[0,"|macaca",[0]],[0,"",[0,[0,"|pongo",[0]],[0,"",[0,[0,"|gorilla",[0]],[0,"",[0,[0,"|pan",[0]],[0,"|homo",[0]]]]]]]]]]]]]]]]]],[0,"",[0,[0,"",[0,[0,"|sorex",[0]],[0,"",[0,[0,"|erinaceus",[0]],[0,"|talpa",[0]]]]]],[0,"",[0,[0,"Chiroptera",[0,[0,"|rhinolophus",[0]],[0,"|plecotus",[0]]]],[0,"",[0,[0,"",[0,[0,"",[0,[0,"",[0,[0,"|equus_caballus",[0]],[0,"|equus_asinus",[0]],[0,"|equus_grevyi",[0]]]],[0,"|ceratotherium",[0]]]],[0,"Carnivora",[0,[0,"",[0,[0,"Felidae",[0,[0,"|acinonyx",[0]],[0,"",[0,[0,"",[0,[0,"|lynx",[0]],[0,"|felis",[0]]]],[0,"",[0,[0,"|panthera",[0]],[0,"|neofelis",[0]]]]]]]],[0,"",[0,[0,"|parahyaena",[0]],[0,"|suricata",[0]]]]]],[0,"",[0,[0,"Canidae",[0,[0,"|vulpes",[0]],[0,"|canis",[0]]]],[0,"",[0,[0,"",[0,[0,"|ailuropoda",[0]],[0,"",[0,[0,"|tremarctos",[0]],[0,"|ursus",[0]]]]]],[0,"",[0,[0,"",[0,[0,"",[0,[0,"|odobenus",[0]],[0,"|arctocephalus",[0]]]],[0,"|mirounga",[0]]]],[0,"",[0,[0,"|mephitis",[0]],[0,"|simocyon",[0]],[0,"",[0,[0,"|procyon",[0]],[0,"|lutra",[0]]]]]]]]]]]]]]]],[0,"",[0,[0,"",[0,[0,"|lama",[0]],[0,"|camel",[0]]]],[0,"",[0,[0,"|sus",[0]],[0,"|phacochoerus",[0]]]],[0,"",[0,[0,"",[0,[0,"Cetacea",[0,[0,"|balaenoptera",[0]],[0,"",[0,[0,"",[0,[0,"|delphinapterus",[0]],[0,"|monodon",[0]]]],[0,"",[0,[0,"|phocoena",[0]],[0,"|orcinus",[0]]]]]]]],[0,"|hippopotamus",[0]]]],[0,"Ruminantia",[0,[0,"",[0,[0,"|giraffa",[0]],[0,"|okapia",[0]]]],[0,"",[0,[0,"Cervidae",[0,[0,"",[0,[0,"|capreolus",[0]],[0,"|alces",[0]]]],[0,"|cervus",[0]]]],[0,"Bovidae",[0,[0,"",[0,[0,"|syncerus",[0]],[0,"",[0,[0,"|bos",[0]],[0,"|bison",[0]]]]]],[0,"",[0,[0,"|aepyceros",[0]],[0,"",[0,[0,"",[0,[0,"|oryx",[0]],[0,"|connochaetes",[0]]]],[0,"",[0,[0,"",[0,[0,"",[0,[0,"|mouflon",[0]],[0,"|mouton",[0]]]],[0,"",[0,[0,"|rupicapra",[0]],[0,"|capra",[0]]]]]],[0,"|ovibos",[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],[0,[0,"fr",[0,[0,"","Les mammifères"],[0,"Mammalia","Mammifères"],[0,"Monotremata","Monotrèmes"],[0,"Marsupialia","Marsupiaux"],[0,"Rodentia","Rongeurs"],[0,"Primates","Primates"],[0,"Chiroptera","Chiroptères"],[0,"Carnivora","Carnivores"],[0,"Felidae","Félins"],[0,"Canidae","Canidés"],[0,"Cetacea","Cétacés"],[0,"Ruminantia","Ruminants"],[0,"Cervidae","Cervidés"],[0,"Bovidae","Bovidés"]],"<h1>Un arbre des animaux</h1>\n\nCet <a target=\"_blank\"\nhref=\"http://fr.wikipedia.org/wiki/Arbre_phylog%C3%A9n%C3%A9tique\">\narbre <em>phylogénétique</em></a> représente les liens de parenté\nentre animaux.\n\n<h2>Utilisation</h2>\n\nParcourez l'arbre en le faisant glisser avec la souris. Cliquez\nsur une image pour l'afficher en grand.\n\n<h2>Crédits</h2>\n\nCe logiciel et les images qu'il utilise sont sous des licences libres.\nLes images proviennent de <a target=\"_blank\"\nhref=\"http://commons.wikimedia.org/wiki/Main_Page?uselang=fr\">Wikimedia\nCommons</a>. Vous pouvez cliquer sur chaque image pour plus de\ndétails. Le logiciel a été écrit par Jérôme Vouillon (CNRS)."],[0,"en",[0,[0,"<TITLE>","Mammals"],[0,"Mammalia","Mammals"],[0,"Monotremata","Monotremes"],[0,"Marsupialia","Marsupials"],[0,"Rodentia","Rodents"],[0,"Primates","Primates"],[0,"Chiroptera","Bats"],[0,"Carnivora","Carnivorans"],[0,"Felidae","Felids"],[0,"Canidae","Canids"],[0,"Cetacea","Cetaceans"],[0,"Ruminantia","Ruminants"],[0,"Cervidae","Deer"],[0,"Bovidae","Bovids"]],"<h1>A Tree of Animals</h1>\n\nThis <a target=\"_blank\"\nhref=\"http://en.wikipedia.org/wiki/Phylogenetic_tree\">\n<em>phylogenetic</em> tree</a> displays the relationships among\nanimals.\n\n<h2>Usage</h2>\n\nBrowse the tree by dragging it with the mouse. Click on any image to\ndisplay a larger version.\n\n<h2>Credits</h2>\n\nThis software and the images it uses are under free licenses. Images\nare from <a target=\"_blank\"\nhref=\"http://commons.wikimedia.org/wiki/Main_Page\">Wikimedia\nCommons</a>. You can click on each image for details. The software\nhas been written by Jérôme Vouillon (CNRS)."]]]��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������js_of_ocaml-3.5.2/examples/index.html���������������������������������������������������������������0000664�0000000�0000000�00000002256�13575077500�0017625�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Js_of_ocaml examples

Js_of_ocaml examples

Ocsigen js_of_ocaml-3.5.2/examples/minesweeper/000077500000000000000000000000001357507750000201465ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/minesweeper/LICENSE000066400000000000000000000013521357507750000211540ustar00rootroot00000000000000 All files contained in this directory and its sub-directories are distributed under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE (included below). ------------------------------------------------------------------------ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar 14 rue de Plaisance, 75014 Paris, France Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. js_of_ocaml-3.5.2/examples/minesweeper/README000066400000000000000000000000721357507750000210250ustar00rootroot00000000000000This is a port of the Minesweeper example from O'Browser. js_of_ocaml-3.5.2/examples/minesweeper/dune000066400000000000000000000005521357507750000210260ustar00rootroot00000000000000(executables (names main) (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx))) (rule (targets main.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:main.bc} -o %{targets} --pretty))) (alias (name default) (deps main.js index.html (glob_files sprites/*.{png,svg}))) js_of_ocaml-3.5.2/examples/minesweeper/index.html000066400000000000000000000006441357507750000221470ustar00rootroot00000000000000 Minesweeper
js_of_ocaml-3.5.2/examples/minesweeper/main.ml000066400000000000000000000034641357507750000214330ustar00rootroot00000000000000(* Js_of_ocaml examples * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2008 Benjamin Canou * * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION * *) open Js_of_ocaml module Html = Dom_html let js = Js.string let document = Html.window##.document let int_input name value = let res = document##createDocumentFragment in Dom.appendChild res (document##createTextNode (js name)); let input = Html.createInput ~_type:(js "text") document in input##.value := js (string_of_int !value); input##.onchange := Html.handler (fun _ -> (try value := int_of_string (Js.to_string input##.value) with Invalid_argument _ -> ()); input##.value := js (string_of_int !value); Js._false); Dom.appendChild res input; res let button name callback = let res = document##createDocumentFragment in let input = Html.createInput ~_type:(js "submit") document in input##.value := js name; input##.onclick := Html.handler callback; Dom.appendChild res input; res let onload _ = let main = Js.Opt.get (document##getElementById (js "main")) (fun () -> assert false) in let nbr, nbc, nbm = ref 10, ref 12, ref 15 in Dom.appendChild main (int_input "Number of columns" nbr); Dom.appendChild main (Html.createBr document); Dom.appendChild main (int_input "Number of rows" nbc); Dom.appendChild main (Html.createBr document); Dom.appendChild main (int_input "Number of mines" nbm); Dom.appendChild main (Html.createBr document); Dom.appendChild main (button "nouvelle partie" (fun _ -> let div = Html.createDiv document in Dom.appendChild main div; Minesweeper.run div !nbc !nbr !nbm; Js._false)); Js._false let _ = Html.window##.onload := Html.handler onload js_of_ocaml-3.5.2/examples/minesweeper/minesweeper.ml000066400000000000000000000155061357507750000230320ustar00rootroot00000000000000(* Js_of_ocaml examples * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2008 Benjamin Canou * * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION * *) open Js_of_ocaml module Html = Dom_html let js = Js.string let document = Html.window##.document type config = { nbcols : int ; nbrows : int ; nbmines : int } let default_config = { nbcols = 10; nbrows = 10; nbmines = 15 } type cell = { mutable mined : bool ; mutable seen : bool ; mutable flag : bool ; mutable nbm : int } type board = cell array array let iter_on_cell cf f = for i = 0 to cf.nbcols - 1 do for j = 0 to cf.nbrows - 1 do f (i, j) done done let random_list_mines lc m = let cell_list = ref [] in while List.length !cell_list < m do let n = Random.int lc in if not (List.mem n !cell_list) then cell_list := n :: !cell_list done; !cell_list let generate_seed () = let t = Sys.time () in let n = int_of_float (t *. 1000.0) in Random.init (n mod 100000) let valid cf (i, j) = i >= 0 && i < cf.nbcols && j >= 0 && j < cf.nbrows let neighbours cf (x, y) = let ngb = [ x - 1, y - 1 ; x - 1, y ; x - 1, y + 1 ; x, y - 1 ; x, y + 1 ; x + 1, y - 1 ; x + 1, y ; x + 1, y + 1 ] in List.filter (valid cf) ngb let initialize_board cf = let cell_init () = { mined = false; seen = false; flag = false; nbm = 0 } in let copy_cell_init b (i, j) = b.(i).(j) <- cell_init () in let set_mined b n = b.(n / cf.nbrows).(n mod cf.nbrows).mined <- true in let count_mined_adj b (i, j) = let x = ref 0 in let inc_if_mined (i, j) = if b.(i).(j).mined then incr x in List.iter inc_if_mined (neighbours cf (i, j)); !x in let set_count b (i, j) = if not b.(i).(j).mined then b.(i).(j).nbm <- count_mined_adj b (i, j) in let list_mined = random_list_mines (cf.nbcols * cf.nbrows) cf.nbmines in let board = Array.make_matrix cf.nbcols cf.nbrows (cell_init ()) in iter_on_cell cf (copy_cell_init board); List.iter (set_mined board) list_mined; iter_on_cell cf (set_count board); board let cells_to_see bd cf (i, j) = let visited = Array.make_matrix cf.nbcols cf.nbrows false in let rec relevant = function | [] -> [], [] | ((x, y) as c) :: l -> let cell = bd.(x).(y) in if cell.mined || cell.flag || cell.seen || visited.(x).(y) then relevant l else let l1, l2 = relevant l in visited.(x).(y) <- true; if cell.nbm = 0 then l1, c :: l2 else c :: l1, l2 in let rec cells_to_see_rec = function | [] -> [] | ((x, y) as c) :: l -> if bd.(x).(y).nbm <> 0 then c :: cells_to_see_rec l else let l1, l2 = relevant (neighbours cf c) in (c :: l1) @ cells_to_see_rec (l2 @ l) in visited.(i).(j) <- true; cells_to_see_rec [ i, j ] let b0 = 3 let l1 = 15 let l2 = l1 let l4 = 20 + (2 * b0) let l3 = (l4 * default_config.nbcols) + (2 * b0) let l5 = 40 + (2 * b0) let h1 = l1 let h2 = 30 let h3 = l5 + 20 + (2 * b0) let h4 = h2 let h5 = 20 + (2 * b0) let h6 = l5 + (2 * b0) type demin_cf = { bd : cell array array ; dom : Html.imageElement Js.t array array ; cf : config ; mutable nb_marked_cells : int ; mutable nb_hidden_cells : int ; mutable flag_switch_on : bool } let draw_cell dom bd = dom##.src := js (if bd.flag then "sprites/flag.png" else if bd.mined then "sprites/bomb.png" else if bd.seen then if bd.nbm = 0 then "sprites/empty.png" else "sprites/" ^ string_of_int bd.nbm ^ ".png" else "sprites/normal.png") let draw_board d = for y = 0 to d.cf.nbrows - 1 do for x = 0 to d.cf.nbcols - 1 do draw_cell d.dom.(y).(x) d.bd.(x).(y) done done let disable_events d = for y = 0 to d.cf.nbrows - 1 do for x = 0 to d.cf.nbcols - 1 do d.dom.(y).(x)##.onclick := Html.handler (fun _ -> Html.window##alert (js "GAME OVER"); Js._false) done done let mark_cell d i j = if d.bd.(i).(j).flag then ( d.nb_marked_cells <- d.nb_marked_cells - 1; d.bd.(i).(j).flag <- false) else ( d.nb_marked_cells <- d.nb_marked_cells + 1; d.bd.(i).(j).flag <- true); draw_cell d.dom.(j).(i) d.bd.(i).(j) let reveal d i j = let reveal_cell (i, j) = d.bd.(i).(j).seen <- true; draw_cell d.dom.(j).(i) d.bd.(i).(j); d.nb_hidden_cells <- d.nb_hidden_cells - 1 in List.iter reveal_cell (cells_to_see d.bd d.cf (i, j)); if d.nb_hidden_cells = 0 then ( draw_board d; disable_events d; Html.window##alert (js "YOU WIN")) let create_demin nb_c nb_r nb_m = let nbc = max default_config.nbcols nb_c and nbr = max default_config.nbrows nb_r in let nbm = min (nbc * nbr) (max 1 nb_m) in let cf = { nbcols = nbc; nbrows = nbr; nbmines = nbm } in generate_seed (); { cf ; bd = initialize_board cf ; dom = Array.make nbr [||] ; nb_marked_cells = 0 ; nb_hidden_cells = (cf.nbrows * cf.nbcols) - cf.nbmines ; flag_switch_on = false } type mode = | Normal | Flag let init_table d board_div = let mode = ref Normal in let buf = document##createDocumentFragment in Dom.appendChild buf (document##createTextNode (js "Mode : ")); let img = Html.createImg document in Dom.appendChild buf img; img##.src := js "sprites/bomb.png"; img##.onclick := Html.handler (fun _ -> (match !mode with | Normal -> mode := Flag; img##.src := js "sprites/flag.png" | Flag -> mode := Normal; img##.src := js "sprites/bomb.png"); Js._false); Dom.appendChild buf (Html.createBr document); for y = 0 to d.cf.nbrows - 1 do let imgs = ref [] in for x = 0 to d.cf.nbcols - 1 do let img = Html.createImg document in imgs := img :: !imgs; img##.src := js "sprites/normal.png"; img##.onclick := Html.handler (fun _ -> (match !mode with | Normal -> if d.bd.(x).(y).seen then () else if d.flag_switch_on then mark_cell d x y else if d.bd.(x).(y).flag then () else if d.bd.(x).(y).mined then ( draw_board d; disable_events d; Html.window##alert (js "YOU LOSE")) else reveal d x y | Flag -> d.bd.(x).(y).flag <- not d.bd.(x).(y).flag; draw_cell img d.bd.(x).(y)); Js._false); Dom.appendChild buf img done; Dom.appendChild buf (Html.createBr document); d.dom.(y) <- Array.of_list (List.rev !imgs) done; board_div##.style##.lineHeight := js "0"; Dom.appendChild board_div buf let run div nbc nbr nbm = let d = create_demin nbc nbr nbm in init_table d div js_of_ocaml-3.5.2/examples/minesweeper/sprites/000077500000000000000000000000001357507750000216375ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/minesweeper/sprites/1.png000066400000000000000000000011001357507750000224750ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8U"A}5h 8\i``*'lfh*~M$"l$36,ԻFqo*议^uUw Iz-lDT鵄'9T* $;IZc\`H@I~TO ð_WE9s7󑼐|sH8$Mccu]L&<"WU(ilP.!"(JNOUI8I${rzF} ŀ7TjڃTǞ')/ٳ3z0 Ub*\z>5˶yr`Z3X,4 ̶y)m[ ûe01FQfT@DstM397$} EQk IwGD~c?`VS3E}U}^|>yRm̄IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/2.png000066400000000000000000000013121357507750000225030ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<GIDAT8J#QƿsM$XhZZXFAaW|Aːvd&woMvbp~;\! h4q93$<t *$Mp]wyJk=O<"0$'&&uݸ1ٲ!!"xF&9HQB ʅ~G~ϧi $Tx̆&Fm#XCar7j?/m"U+1Z@Eg"Tp~܋chJO,J>Ae-R7H]jT~9 ֖k]nm):LXn_vG\ #763R|`dҳN69)H|u?k@_:@k2ɜEɁ6AT*mjRHbuuu#"GڲsNIΏ/J#B̪j 8*ȑ\_W.8-IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/4.png000066400000000000000000000012121357507750000225040ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8kQϽLDQ -!("Bt \ D⮫@r'n *M-VPt)nAQQl&EMH:͝{{Bt2$$ $1lf|u\.!0 +$(R\xD H% 0cf[8!"SՑ8$*rE?0%YHsma / _Bo]\,m52=k-5k `*3H -H={TBMya # 73g4tZxzgz >0eUȩIhz͘W+лӐ$\wq,>z<@o˯-"[r2|ɃR_;=@|{nDptT9~rH2kzrylCIP6E-"YLDg8P镍sM$kl''1(25!fY!9@EdWs6[,F!Y6UP'Y+J] -a۪}@IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/5.png000066400000000000000000000012721357507750000225130ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<7IDAT8U=OA}s04R!PB?@((H ::hLp(,#K$=/9⏳JSofv$u I{W"y155! qHoc:%733s*$TծVcA@D̲ gɜX$sqcLhbj`evvU5cI鎞EP8DG!|?:zV $ư@Uߣg$FИrdrB@KUӜFVC̶1v|/HDŶoƘ///6Ʒϫ+:{uzFo$|luDeeL5OO}T6ݬ^,.z 6 /Cs~G./:?Gsa&qw|u@*շlZtbqAAggdƘ:ɒ'H$Ǣ:`Pw곪NIT*-,k$쩄ɜ| J$/VWW͂IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/6.png000066400000000000000000000013741357507750000225170ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<yIDAT8?KcALދl͢ ( h*" ("X EP$K2g%!&qWwn1s;$B$!9DFY].Mr'@D>\m[*|Bh`d2@Q )r$_IvK۶ IF CJ){:vw9?M^@ZjSZ|x@abű1`XV+ X\\{yω^Z * Hїokk( ϖ s|b8 O:/{{p==4< 6UTJuP0, +Eh;9+EON•6[)J$NOse۰66`mn¸AG2nSZ 8=];waTAjR*nnC>?La/jj %ZN 0S):l4}ЕH@J(}TA1i!DNkC!Xp=>Br@(r$$ii82ֺ̫[m*)ԀUJl$GGG&Ɉֺ W& J ]޿IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/7.png000066400000000000000000000011541357507750000225140ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8UJ#Q=uv7 [Ő.U6ډE;AlM3 b+F@-Dfwbcc8?\sfDQT"%"RU%j}~јD$ϜsZ['. (ɣfy.aTh41Dd1H>aHvsD ɮGeNNEҤ5UmY(yJ\]A< /I$}zi1;;t:I.l%6Pf:)̴\@A=$aT0 z!^_Mz$|\]^D#`Q'w: 3c3IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/8.png000066400000000000000000000014421357507750000225150ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8K[aƟDG?ЂP(t(Y*n tP)֡:dꤝEAh;MnҜopy9WHbd0I4Z!}}}Up]wd}y^wD@Ix/U8J1O{$/HviD tyV:p{V.F"GFpZ:lrf%¶ wrT ,zio$j6ZFpvwDϞ+>~D͛&Z $QWx=/AupT<,mpt0`*iXTHlnGu˪X<%h"Ӄo?68tt Ў?GS-WƼ<\YA(CW :8@cx c溈DQBӧVmv@QEP@mXQT1Bi|}$2X#\?3sc۴̡*hYHkkb16b UPu1TBȶvho/IJZ|>_(˯%˅I iST8΅v Iϓ0"ry^}%vll\,L2'T*UI zaJ0IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/bomb.png000066400000000000000000000021021357507750000232570ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8Oh\UͼL2;2RHh몕ڥ 4R]׊JЭQnZ *b颸jKESZjk!83;ysČ#·wݣD l)a1 Z1uebb DO(,;kn8s~ 1flNΒ$b/4$ˑz3! !FբPTd2C7G_FE;An׹}6ZkA)j%nݺcN !w4 ҋc$ j5.]JRD*ɓ'TU>|eYt^eYo}R 2$ 8C\Rw^vލ8۷ ._'cl&\ץl>Zk Bq6t0 jK@kѣGfwx Ο?e1Ft:MEZ-رcž l1Rm#Β$ S(HRqyuJΝZ"HQ)Ž{8uIR$IB>|3gPT`q2Ɣ"rR#q͛7vs:4j(j=Ed3o}z.ߨpl84IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/empty.png000066400000000000000000000006231357507750000235040ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8A@WYʬf'%7#x&k\jHldd; .(n$IJ` 1"Br5P$m7.)XfH `X,ֶm_:O{oW>(s>33Irt`RMn1/e"&Ib N+ߩe#fOIglFMmfԱI)5@@%)`])@eIr3{M)57lZvp(2"_A T"IW"eIENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/flag.png000066400000000000000000000013371357507750000232620ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<\IDAT8KAyMzXH[=W=*OO^\Th6X۴ͼP87}߾&cΫꌪ2xsxSUEU] г֖9<<ƽV "߆ pwU/:wnyvFTccc7^Tu^TuZ[Noaw^o" >CuzbLO''Z]R "eUUhn U{ޡ4(<ئ$i}<2 'gLrf@#$crssat= \.q|9ttB"o(x}pSj@"{=AiSǩj<[X{1_ǓԫUJM}(2?Z5VS [+*&IÖ_a˅B~Z1e%aSD:Qd"MOU(CZ-0Tuqsn D$ia\lmmmFq3n8r:pIENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/normal.png000066400000000000000000000006621357507750000236410ustar00rootroot00000000000000PNG  IHDR sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org</IDAT810EĨ [%| LRu0]dzaZ\OMd,(zȥH.IV$[z6p)%t]"1zU]vr 8~u=D"tK˺}$1F_$d-$+O2E @6 ,s03x3> ! 4+# )E.2\~8;\nEd(uYU'GJq)%xsy? Unt:|a}sFkI6v-"ϝ*IENDB`js_of_ocaml-3.5.2/examples/minesweeper/sprites/scalable.svg000066400000000000000000000261561357507750000241400ustar00rootroot00000000000000 image/svg+xml 8 js_of_ocaml-3.5.2/examples/ocsigen8-100x30.png000066400000000000000000000062751357507750000207130ustar00rootroot00000000000000PNG  IHDRd[sRGB pHYs\F\FCAtIME -5^odtEXtCommentCreated with The GIMPd%n &IDATh{pU?}ޛA@0` ,",U ,qZ) p(FEKZ}*SgaDWs۷_AB.)_U:{~t_D\Vp=3uϟ|9>ϸu[\\]AbUۯkl 7Ԭ[>\wm۶yjvSO=>:u* }  (š|]FݰK655>k֬I2iTTTp;vP]]!CJmޠ0]~xFJ)to())) }7+mߟ?g m,!6 0(tdׯrɓ'?Re z1{ bqðd,{05Aϝ;!f^{?=!1Lz:Zv$͑ݣxvv6&M5}{سgO>$^CUU7 G$L;e[ " ne{{7nُU\.%auofݧq-D[O`Ĵ1L)?i7f~yoR`96EG ᨁimfB_`08xڴib1>cB7t.{njkk|۶q/?|Ϟ={u;3˗RUl[6~[DEMLR=^k׬Ed]LJ~O,F4n_qSudeG9IR^bB42( ---Hؾ};mN^^]]]liiaѢE\.0M)eBa޽PWW@ p|饗xG)++CUU(--e%'8s~0}[#N%ۈ˝[a岅T]'0c, o0cA@RpQj~mQUYG-f7nf)//8mF0O?GR^^￟-[8g*l̘֭137dttt-a-|y''٫ض{Z6>L] S7ˋUzrUo1ֿCqO%]ʫa>\(;v져?0駟xv_J/_>bIaE]_q@ [πO[w)q.\${FJϏDQvtFɰl\n/ݍT,YBwVmQIСCZj bŊaegOOH7ʌ|Wرc;v 3fPWWǔ)SFU1 )m>|r0:s6:-w4 .(L 3zTd0j a6jBܼMa!UUU8pظq#A{7P~~>&gFQQ?~:^|EΝ;Gmm-<ȈU؎$nh1Ag=}y(䳦(BKlY"qcq?珖.J-EMzau&/" A"o۷3~x6oތVvɻロ&c͚5g 9~8>,/2^v [n+WrJyǙ8q H,AQTUe ?" F :144-2#9uOQT7mIw.Jf9MG>fU7R#l3-MCȸ5XӇ]]~2*((iRU)eZUUM6ٰahbʘ5k03^x1xM6rx4i^[ED Ⱦ'AQ\<,[4i5`4NTh]ͤJHG@+Slbʍ_IHN-n9BCC۷bnvYtWO*V^M}}=> H\dfDRSvb(mBC܈[5PB{7o]~?rgzKA/o~KSrK~;~I 1{, -]atqPWgEA a2x}IamT2uH:X;ȤKX xf;NHa:覃$3 EMp$3hBAn-pAGo@@H6iCݿ35ĜlP%Mg읟QBҞVEiInOc yv_v(/ _o^;!"9'mB4B:GH,[`rg8 X5=јE41Fi ,G`"Edp&B} =xHb]GB8p뿲Hm;F= ;~!#HɇMh)%"Nض=|ĸi7 A7ltNv36Y@I2S$K)/)Tq+v{NѴ%=9.[C[hiXN"!>!A^|AL[`9߲/OQBVl Np-2ه%mW~Ó3'h%YWĪ; si r5?iB+ R RODʤT6%+Q)pS`*@:&/вT7B˄3H.tgK% 2Ka~㊽jCN"!q-:Hk|*n]؆p .Ts𸁣SO(؆pL#yw7}?߶ʖNiLc}N]d`:eߛɏFZdhпLIENDB`js_of_ocaml-3.5.2/examples/planet/000077500000000000000000000000001357507750000171065ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/planet/dune000066400000000000000000000005401357507750000177630ustar00rootroot00000000000000(executables (names planet) (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx)) ) (rule (targets planet.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:planet.bc} -o %{targets} --pretty))) (alias (name default) (deps planet.js index.html texture.jpg)) js_of_ocaml-3.5.2/examples/planet/index.html000066400000000000000000000010561357507750000211050ustar00rootroot00000000000000 Planet js_of_ocaml-3.5.2/examples/planet/planet.ml000066400000000000000000000536411357507750000207340ustar00rootroot00000000000000(* Js_of_ocaml example * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* - stop animation when not needed ==> not visible ==> no change (paused, follow rotation and no lighting) - Options: ==> larger/smaller - adaptative size ==> time 3 frames and take min ==> if fast, try larger image IDEAS ===== - saisons - satellites: geostationnaires, différentes altitudes ==> trajectoire + mouvement du satellite - affiche l'axe de rotation de la terre, la direction du soleil - autres planètes Sphere tessellation... http://sol.gfxile.net/sphere/index.html http://www.nihilogic.dk/labs/canvas3dtexture_0.2/ Stop animation when not visible! ===> use window.onfocus/onblur http://visibleearth.nasa.gov/view_rec.php?id=2431 http://maps.jpl.nasa.gov/ *) open Js_of_ocaml open Js_of_ocaml_lwt let width = 600 let height = width let pi = 4. *. atan 1. let obliquity = 23.5 *. pi /. 180. let gamma = 2. let dark = 0.2 ** gamma (****) let doc = Dom_html.document let button_type = Js.string "button" let button txt action = let b = Dom_html.createInput ~_type:button_type doc in b##.value := Js.string txt; b##.onclick := Dom_html.handler (fun _ -> action (); Js._true); b let toggle_button txt1 txt2 action = let state = ref false in let txt1 = Js.string txt1 in let txt2 = Js.string txt2 in let b = Dom_html.createInput ~_type:button_type doc in b##.value := txt1; b##.onclick := Dom_html.handler (fun _ -> state := not !state; b##.value := if !state then txt2 else txt1; action !state; Js._true); b let checkbox txt checked action = let b = Dom_html.createInput ~_type:(Js.string "checkbox") doc in b##.checked := Js.bool checked; b##.onclick := Dom_html.handler (fun _ -> action (Js.to_bool b##.checked); Js._true); let lab = Dom_html.createLabel doc in Dom.appendChild lab b; Dom.appendChild lab (doc##createTextNode (Js.string txt)); lab let radio txt name checked action = let b = Dom_html.createInput ~name:(Js.string name) ~_type:(Js.string "radio") doc in b##.checked := Js.bool checked; b##.onclick := Dom_html.handler (fun _ -> action (); Js._true); let lab = Dom_html.createLabel doc in Dom.appendChild lab b; Dom.appendChild lab (doc##createTextNode (Js.string txt)); lab (****) type vertex = { x : float ; y : float ; z : float } let vertex x y z = { x; y; z } type matrix = { r1 : vertex ; r2 : vertex ; r3 : vertex } let vect { x = x1; y = y1; z = z1 } { x = x2; y = y2; z = z2 } = { x = x2 -. x1; y = y2 -. y1; z = z2 -. z1 } let cross_product { x = x1; y = y1; z = z1 } { x = x2; y = y2; z = z2 } = { x = (y1 *. z2) -. (y2 *. z1) ; y = (z1 *. x2) -. (z2 *. x1) ; z = (x1 *. y2) -. (x2 *. y1) } let dot_product { x = x1; y = y1; z = z1 } { x = x2; y = y2; z = z2 } = (x1 *. x2) +. (y1 *. y2) +. (z1 *. z2) let matrix_vect_mul m { x; y; z } = let { r1; r2; r3 } = m in let x' = (x *. r1.x) +. (y *. r1.y) +. (z *. r1.z) in let y' = (x *. r2.x) +. (y *. r2.y) +. (z *. r2.z) in let z' = (x *. r3.x) +. (y *. r3.y) +. (z *. r3.z) in { x = x'; y = y'; z = z' } let matrix_transp m = let { r1; r2; r3 } = m in { r1 = { x = r1.x; y = r2.x; z = r3.x } ; r2 = { x = r1.y; y = r2.y; z = r3.y } ; r3 = { x = r1.z; y = r2.z; z = r3.z } } let matrix_mul m m' = let m' = matrix_transp m' in { r1 = matrix_vect_mul m' m.r1 ; r2 = matrix_vect_mul m' m.r2 ; r3 = matrix_vect_mul m' m.r3 } let normalize v = let { x; y; z } = v in let r = sqrt ((x *. x) +. (y *. y) +. (z *. z)) in { x = x /. r; y = y /. r; z = z /. r } let xz_rotation phi = let cos_phi = cos phi in let sin_phi = sin phi in { r1 = vertex cos_phi 0. sin_phi ; r2 = vertex 0. 1. 0. ; r3 = vertex (-.sin_phi) 0. cos_phi } let xy_rotation phi = let cos_phi = cos phi in let sin_phi = sin phi in { r1 = vertex cos_phi sin_phi 0. ; r2 = vertex (-.sin_phi) cos_phi 0. ; r3 = vertex 0. 0. 1. } let yz_rotation phi = let cos_phi = cos phi in let sin_phi = sin phi in { r1 = vertex 1. 0. 0. ; r2 = vertex 0. cos_phi sin_phi ; r3 = vertex 0. (-.sin_phi) cos_phi } let matrix_identity = xz_rotation 0. (* Assumes that m is orthogonal *) let rotate_normal m v = matrix_vect_mul (matrix_transp m) v (****) type face = { v1 : int ; v2 : int ; v3 : int } let face v1 v2 v3 = { v1; v2; v3 } type t = { vertices : vertex array ; faces : face array } let rotate_object m o = { o with vertices = Array.map (fun v -> matrix_vect_mul m v) o.vertices } let octahedron = { vertices = [| vertex 0. 0. 1. ; vertex 1. 0. 0. ; vertex 0. 1. 0. ; vertex (-1.) 0. 0. ; vertex 0. (-1.) 0. ; vertex 0. 0. (-1.) |] ; faces = [| face 0 1 2 ; face 0 2 3 ; face 0 3 4 ; face 0 4 1 ; face 1 5 2 ; face 1 4 5 ; face 3 5 4 ; face 3 2 5 |] } (****) (* 0 <= phi < 2pi *) (* -pi/2 <= theta <= pi/2 *) let tesselate_sphere p_div t_div = let p_delta = 2. *. pi /. float p_div in let t_delta = pi /. float t_div in let t_offset = (pi -. t_delta) /. 2. in let n = t_div * p_div in let vertices = Array.make (n + 2) (vertex 0. 0. 0.) in let faces = Array.make (n * 2) (face 0 0 0) in let north = n and south = n + 1 in vertices.(north) <- vertex 0. (-1.) 0.; vertices.(south) <- vertex 0. 1. 0.; for i = 0 to p_div - 1 do for j = 0 to t_div - 1 do let phi = float i *. p_delta in let theta = (float j *. t_delta) -. t_offset in let x = cos phi *. cos theta in let y = sin theta in let z = sin phi *. cos theta in let k = (i * t_div) + j in vertices.(k) <- vertex x y z; if j = 0 then ( faces.(2 * k) <- face north k ((k + t_div) mod n); faces.((2 * k) + 1) <- face south ((k + (2 * t_div) - 1) mod n) (k + t_div - 1)) else ( faces.(2 * k) <- face k ((k + t_div) mod n) (k - 1); faces.((2 * k) + 1) <- face (k - 1) ((k + t_div) mod n) ((k + t_div - 1) mod n)) done done; { vertices; faces } (****) let divide all o = let vn = if all then Array.length o.vertices + (Array.length o.faces * 3 / 2) else Array.length o.vertices + 16 in let vertices = Array.make vn (vertex 0. 0. 0.) in let j = ref (Array.length o.vertices) in Array.blit o.vertices 0 vertices 0 !j; let fn = if all then 4 * Array.length o.faces else Array.length o.faces + 24 in let faces = Array.make fn (face 0 0 0) in let midpoints = Hashtbl.create 17 in let midpoint v1 v2 = let p = if v1 < v2 then v1, v2 else v2, v1 in try Hashtbl.find midpoints p with Not_found -> let v1 = o.vertices.(v1) in let v2 = o.vertices.(v2) in let v = { x = (v1.x +. v2.x) /. 2.; y = (v1.y +. v2.y) /. 2.; z = (v1.z +. v2.z) /. 2. } in let v = if all || abs_float v1.y = 1. || abs_float v2.y = 1. then normalize v else v in let res = !j in assert (res < Array.length vertices); vertices.(res) <- v; Hashtbl.add midpoints p res; incr j; res in let k = ref 0 in for i = 0 to Array.length o.faces - 1 do let { v1; v2; v3 } = o.faces.(i) in if all || abs_float o.vertices.(v1).y = 1. || abs_float o.vertices.(v2).y = 1. || abs_float o.vertices.(v3).y = 1. then ( let w1 = midpoint v1 v2 in let w2 = midpoint v2 v3 in let w3 = midpoint v3 v1 in faces.(!k) <- { v1; v2 = w1; v3 = w3 }; faces.(!k + 1) <- { v1 = w1; v2; v3 = w2 }; faces.(!k + 2) <- { v1 = w3; v2 = w2; v3 }; faces.(!k + 3) <- { v1 = w1; v2 = w2; v3 = w3 }; k := !k + 4) else ( faces.(!k) <- o.faces.(i); incr k) done; assert (!j = Array.length vertices); assert (!k = Array.length faces); { vertices; faces } (****) module Html = Dom_html let create_canvas w h = let c = Html.createCanvas Html.document in c##.width := w; c##.height := h; c (****) let ( >>= ) = Lwt.bind let lwt_wrap f = let t, w = Lwt.task () in let cont x = Lwt.wakeup w x in f cont; t (****) let load_image src = let img = Html.createImg Html.document in lwt_wrap (fun c -> img##.onload := Html.handler (fun _ -> c (); Js._false); img##.src := src) >>= fun () -> Lwt.return img (****) let shadow texture = let w = texture##.width in let h = texture##.height in let canvas = create_canvas w h in let ctx = canvas##getContext Html._2d_ in let w, h = w / 8, h / 8 in let img = ctx##getImageData 0. 0. (float w) (float h) in let data = img##.data in let inv_gamma = 1. /. gamma in let update_shadow obliquity = let cos_obl = cos obliquity in let sin_obl = -.sin obliquity in for j = 0 to h - 1 do for i = 0 to (w / 2) - 1 do let k = truncate (4. *. (float i +. (float j *. float w))) in let k' = truncate (4. *. (float w -. float i +. (float j *. float w) -. 1.)) in let theta = ((float j /. float h) -. 0.5) *. pi in let phi = float i /. float w *. 2. *. pi in let x = cos phi *. cos theta in let y = sin theta in (* let z = sin phi *. cos theta in *) let x, _y = (x *. cos_obl) +. (y *. sin_obl), (-.x *. sin_obl) +. (y *. cos_obl) in let c = if x > 0. then dark else dark -. (x *. (1. -. dark) *. 1.2) in let c = if c <= 1. then c else 1. in let c = 255 - truncate (255.99 *. (c ** inv_gamma)) in Html.pixel_set data (k + 3) c; Html.pixel_set data (k' + 3) c done done; ctx##putImageData img 0. 0.; ctx##.globalCompositeOperation := Js.string "copy"; ctx##save; ctx##scale (8. *. float (w + 2) /. float w) (8. *. float (h + 2) /. float h); ctx##translate (-1.) (-1.); ctx##drawImage_fromCanvas canvas 0. 0.; ctx##restore in update_shadow obliquity; let w = texture##.width in let h = texture##.height in let canvas' = create_canvas w h in let ctx' = canvas'##getContext Html._2d_ in let no_lighting = ref false in let update_texture lighting phi = if lighting then ( no_lighting := false; let phi = mod_float phi (2. *. pi) in ctx'##drawImage texture 0. 0.; let i = truncate (mod_float (((2. *. pi) -. phi) *. float w /. 2. /. pi) (float w)) in ctx'##drawImage_fromCanvas canvas (float i) 0.; ctx'##drawImage_fromCanvas canvas (float i -. float w) 0.) else if not !no_lighting then ( ctx'##drawImage texture 0. 0.; no_lighting := true) in (* Dom.appendChild Html.document##body canvas'; *) canvas', update_shadow, update_texture (****) let to_uv tw th { x; y; z } = let cst1 = ((tw /. 2.) -. 0.99) /. pi in let cst2 = th /. 2. in let cst3 = (th -. 0.99) /. pi in let u = mod_float (float (truncate (tw -. (atan2 z x *. cst1)))) tw in let v = float (truncate (cst2 +. (asin y *. cst3))) in assert (0. <= u); assert (u < tw); assert (0. <= v); assert (v < th); u, v let min (u : float) v = if u < v then u else v let max (u : float) v = if u < v then v else u let precompute_mapping_info tw th uv f = let { v1; v2; v3 } = f in let u1, v1 = uv.(v1) in let u2, v2 = uv.(v2) in let u3, v3 = uv.(v3) in let mid = tw /. 2. in let u1 = if u1 = 0. && (u2 > mid || u3 > mid) then tw -. 2. else u1 in let u2 = if u2 = 0. && (u1 > mid || u3 > mid) then tw -. 2. else u2 in let u3 = if u3 = 0. && (u2 > mid || u1 > mid) then tw -. 2. else u3 in let mth = th -. 2. in let u1 = if v1 = 0. || v1 >= mth then (u2 +. u3) /. 2. else u1 in let u2 = if v2 = 0. || v2 >= mth then (u1 +. u3) /. 2. else u2 in let u3 = if v3 = 0. || v3 >= mth then (u2 +. u1) /. 2. else u3 in let u1 = max 1. u1 in let u2 = max 1. u2 in let u3 = max 1. u3 in let v1 = max 1. v1 in let v2 = max 1. v2 in let v3 = max 1. v3 in let du2 = u2 -. u1 in let du3 = u3 -. u1 in let dv2 = v2 -. v1 in let dv3 = v3 -. v1 in let su = (dv2 *. du3) -. (dv3 *. du2) in let sv = (du2 *. dv3) -. (du3 *. dv2) in let dv3 = dv3 /. sv in let dv2 = dv2 /. sv in let du3 = du3 /. su in let du2 = du2 /. su in let u = max 0. (min u1 (min u2 u3) -. 4.) in let v = max 0. (min v1 (min v2 v3) -. 4.) in let u' = min tw (max u1 (max u2 u3) +. 4.) in let v' = min th (max v1 (max v2 v3) +. 4.) in let du = u' -. u in let dv = v' -. v in u1, v1, du2, dv2, du3, dv3, u, v, du, dv let draw ctx _img shd o _uv normals face_info dir = Array.iteri (fun i { v1; v2; v3 } -> let { x = x1; y = y1; z = _z1 } = o.vertices.(v1) in let { x = x2; y = y2; z = _z2 } = o.vertices.(v2) in let { x = x3; y = y3; z = _z3 } = o.vertices.(v3) in if dot_product normals.(i) dir >= 0. then ( ctx##beginPath; ctx##moveTo x1 y1; ctx##lineTo x2 y2; ctx##lineTo x3 y3; ctx##closePath; ctx##save; ctx##clip; let u1, v1, du2, dv2, du3, dv3, u, v, du, dv = face_info.(i) in let dx2 = x2 -. x1 in let dx3 = x3 -. x1 in let dy2 = y2 -. y1 in let dy3 = y3 -. y1 in let a = (dx2 *. dv3) -. (dx3 *. dv2) in let b = (dx2 *. du3) -. (dx3 *. du2) in let c = x1 -. (a *. u1) -. (b *. v1) in let d = (dy2 *. dv3) -. (dy3 *. dv2) in let e = (dy2 *. du3) -. (dy3 *. du2) in let f = y1 -. (d *. u1) -. (e *. v1) in ctx##transform a d b e c f; (* let (u1, v1) = uv.(v1) in let (u2, v2) = uv.(v2) in let (u3, v3) = uv.(v3) in let mid = tw /. 2. in let u1 = if u1 = 0. && (u2 > mid || u3 > mid) then tw -. 2. else u1 in let u2 = if u2 = 0. && (u1 > mid || u3 > mid) then tw -. 2. else u2 in let u3 = if u3 = 0. && (u2 > mid || u1 > mid) then tw -. 2. else u3 in let mth = th -. 2. in let u1 = if v1 = 0. || v1 >= mth then (u2 +. u3) /. 2. else u1 in let u2 = if v2 = 0. || v2 >= mth then (u1 +. u3) /. 2. else u2 in let u3 = if v3 = 0. || v3 >= mth then (u2 +. u1) /. 2. else u3 in let u1 = max 1. u1 in let u2 = max 1. u2 in let u3 = max 1. u3 in let v1 = max 1. v1 in let v2 = max 1. v2 in let v3 = max 1. v3 in let du2 = u2 -. u1 in let du3 = u3 -. u1 in let dv2 = v2 -. v1 in let dv3 = v3 -. v1 in let dx2 = x2 -. x1 in let dx3 = x3 -. x1 in let dy2 = y2 -. y1 in let dy3 = y3 -. y1 in let a = (dx2*.dv3-.dx3*.dv2) /. (du2*.dv3-.du3*.dv2) in let b = (dx2*.du3-.dx3*.du2) /. (dv2*.du3-.dv3*.du2) in let c = x1 -. a *. u1 -. b *. v1 in let d = (dy2*.dv3-.dy3*.dv2) /. (du2*.dv3-.du3*.dv2) in let e = (dy2*.du3-.dy3*.du2) /. (dv2*.du3-.dv3*.du2) in let f = y1 -. d *. u1 -. e *. v1 in ctx##transform (a, d, b, e, c, f); let u = max 0. (min u1 (min u2 u3) -. 4.) in let v = max 0. (min v1 (min v2 v3) -. 4.) in let u' = min tw (max u1 (max u2 u3) +. 4.) in let v' = min th (max v1 (max v2 v3) +. 4.) in let du = u' -. u in let dv = v' -. v in *) ctx##drawImage_fullFromCanvas shd u v du dv u v du dv; ctx##restore)) o.faces let ( >> ) x f = f x (* let o = tesselate_sphere 8 6 let o = octahedron >> divide true >> divide true >> divide false *) let o = tesselate_sphere 12 8 (* let o = octahedron >> divide true >> divide true >> divide true *) let v = { x = 0.; y = 0.; z = 1. } let _texture = Js.string "black.jpg" let _texture = Js.string "../planet/land_ocean_ice_cloud_2048.jpg" let texture = Js.string "../planet/texture.jpg" let start _ = Lwt.ignore_result (load_image texture >>= fun texture -> let shd, update_shadow, update_texture = shadow texture in let canvas = create_canvas width height in let canvas' = create_canvas width height in Dom.appendChild Html.document##.body canvas; let ctx = canvas##getContext Html._2d_ in let ctx' = canvas'##getContext Html._2d_ in let r = float width /. 2. in let tw = float texture##.width in let th = float texture##.height in let uv = Array.map (fun v -> to_uv tw th v) o.vertices in let normals = Array.map (fun { v1; v2; v3 } -> let v1 = o.vertices.(v1) in let v2 = o.vertices.(v2) in let v3 = o.vertices.(v3) in cross_product (vect v1 v2) (vect v1 v3)) o.faces in let face_info = Array.map (fun f -> precompute_mapping_info tw th uv f) o.faces in let paused = ref false in let follow = ref false in let lighting = ref true in let clipped = ref true in let obl = ref obliquity in let m_obliq = ref (xy_rotation (-.obliquity)) in let m = ref matrix_identity in let phi_rot = ref 0. in let rateText = doc##createTextNode (Js.string "") in let add = Dom.appendChild in let ctrl = Html.createDiv doc in ctrl##.className := Js.string "controls"; let d = Html.createDiv doc in add d (doc##createTextNode (Js.string "Click and drag mouse to rotate.")); add ctrl d; let form = Html.createDiv doc in let br () = Html.createBr doc in (add form (toggle_button "Pause" "Resume" (fun p -> paused := p)); add form (br ()); add form (toggle_button "Follow rotation" "Fixed position" (fun f -> follow := f)); add form (br ()); add form (button "Reset orientation" (fun () -> m := matrix_identity; phi_rot := 0.; m_obliq := xy_rotation (-. !obl))); add form (br ()); let lab = Html.createLabel doc in add lab (doc##createTextNode (Js.string "Date:")); let s = Html.createSelect doc in List.iter (fun txt -> let o = Html.createOption doc in add o (doc##createTextNode (Js.string txt)); s##add o Js.null) [ "December solstice"; "Equinox"; "June solstice" ]; s##.onchange := Html.handler (fun _ -> let o = match s##.selectedIndex with | 0 -> obliquity | 1 -> 0. | _ -> -.obliquity in update_shadow o; obl := o; (*m_obliq := xy_rotation (-. o);*) Js._true); add lab s; add form lab); Dom.appendChild ctrl form; let form = Html.createDiv doc in add form (checkbox "Lighting" true (fun l -> lighting := l)); add form (br ()); add form (checkbox "Clip" true (fun l -> clipped := l)); add form (br ()); add form (doc##createTextNode (Js.string "Frames per second: ")); add form rateText; add ctrl form; add doc##.body ctrl; let p = Html.createP doc in p##.innerHTML := Js.string "Credit: Visual Earth, Nasa"; add doc##.body p; let mx = ref 0 in let my = ref 0 in canvas##.onmousedown := Dom_html.handler (fun ev -> mx := ev##.clientX; my := ev##.clientY; let c1 = Html.addEventListener Html.document Html.Event.mousemove (Dom_html.handler (fun ev -> let x = ev##.clientX and y = ev##.clientY in let dx = x - !mx and dy = y - !my in if dy != 0 then m := matrix_mul (yz_rotation (2. *. float dy /. float width)) !m; if dx != 0 then m := matrix_mul (xz_rotation (2. *. float dx /. float width)) !m; mx := x; my := y; Js._true)) Js._true in let c2 = ref Js.null in c2 := Js.some (Html.addEventListener Html.document Html.Event.mouseup (Dom_html.handler (fun _ -> Html.removeEventListener c1; Js.Opt.iter !c2 Html.removeEventListener; Js._true)) Js._true); Js._false); let ti = ref (new%js Js.date_now)##getTime in let fps = ref 0. in let rec loop t phi = let rotation = xz_rotation (phi -. !phi_rot) in update_texture !lighting phi; let m = matrix_mul !m (matrix_mul !m_obliq rotation) in let o' = rotate_object m o in let v' = rotate_normal m v in ctx'##clearRect 0. 0. (float width) (float height); ctx'##save; if !clipped then ( ctx'##beginPath; ctx'##arc r r (r *. 0.95) 0. (-2. *. pi) Js._true; ctx'##clip); ctx'##setTransform (r -. 2.) 0. 0. (r -. 2.) r r; ctx'##.globalCompositeOperation := Js.string "lighter"; draw ctx' texture shd o' uv normals face_info v'; ctx'##restore; ctx##.globalCompositeOperation := Js.string "copy"; ctx##drawImage_fromCanvas canvas' 0. 0.; (try ignore (ctx##getImageData 0. 0. 1. 1.) with _ -> ()); let t' = (new%js Js.date_now)##getTime in (fps := let hz = 1000. /. (t' -. !ti) in if !fps = 0. then hz else (0.9 *. !fps) +. (0.1 *. hz)); rateText##.data := Js.string (Printf.sprintf "%.2f" !fps); ti := t'; Lwt_js.sleep 0.01 >>= fun () -> let t' = (new%js Js.date_now)##getTime in let dt = t' -. t in let dt = if dt < 0. then 0. else if dt > 1000. then 0. else dt in let angle = 2. *. pi *. dt /. 1000. /. 10. in (* if true then Lwt.return () else *) if (not !paused) && !follow then phi_rot := !phi_rot +. angle; loop t' (if !paused then phi else phi +. angle) in loop (new%js Js.date_now)##getTime 0.); Js._false let _ = Html.window##.onload := Html.handler start js_of_ocaml-3.5.2/examples/planet/texture.jpg000066400000000000000000002700661357507750000213230ustar00rootroot00000000000000JFIFHHC      C  ""   :tE !1"A2Q#BaqR3b$Cr%Sc7!1AQaq"2BRbr# ?O@ t].@ t].@ t].@ t].@ t].@ t].@ t].@ t].@ t].@ t].@ t].@ t].@<S8 *iTo+2'cg T|}_d-Jc@b  ^lt,To,UX-X鷰݀kL9%@r|GHs9H`< 0AI^s qjp%e?f I 4N?Q!)mJt|08 qU_Wc Q4)n VoP^?sfX8>m }Q  @0` t[:#* lJHX ~ﬡ=GKqC$&H 4u"uqScE;t].1o@Tj W&ȳߪ ڝg||,*ytR6 Uz:`[O}'I; ckS?9ʹ"`H.M2V9R<@ Ȫ@$| ?=m",@`Od(=b LSaup$#5tG<:t].@ t].@ t].@ t].@ Hzg.?4|e'ߏzbq'!s6% ekǎT+p<O@r$oBI?ɺ5U'3m/cVU,Mgx LcuFgQ/@_cc~hh 镜Բ C}+%֏ '^2H8I_6||'Rs$  (Uፏ<}xL-\Rmz۟N6>1C>%R }ACMK_čW J'OOW~FѼRxs9#< UuW{w¨QA$~~?|"wd* >(/=THW&Q[Z8>,J&Ii42ˠȳ jGo`3m&28x`,x LnAkw^kvr͒V|H"BیH[zp"Yh)+Fb_UiUPu͋O#JY`C2ޔ|Ӆ?JWUF\`S0_w4(mTrbW('\ZjZҺ?&L[V")}2/ygu]G4 AP Ѫz=YtRÍ7bQ. y&(ɉ~q_v4}Os;k:<.A8 yR[#&Ւ Ȇ$1n-nۣO&h0BMQv2PƂ8HezhW`3^U~Xדp3YH!`*"$0z$묅Uu$]0:].@ ]+_@ t]57].jP'@ >XbhO4+9i6s"#4I_`s8E#>onUgFļwǷD`ۢ$?tM"@y=.k(4 [~G5:p=w Y[!^Kk+*w"0LdF!k ʪ!9r 5;:\_W rHՁF&M$];v:rJq`q&ny"BV[|F'#O9_u@iݣ\:̑ V 7?i櫎zI;ȯǟ_K "N6D@Y(Qɲ:=#vw$ZoB(L,TDaz{KL1nF5\ خ1JbɩW8_zU'}W؋o1IAEx+_$M]aO 8p|H| aG?'N({t8Pl@wDLnݵ=S D 9&k_*_L{G EŖ /XY2Ntp4@zS??cg㪂d;ae:*V dȪr4n2iW}Y- Qs֜5 " E*lyQ,Ra턒c+#AgPQ=-tPvcbc? '<:Nqv2 8~y_@nAF9x?lx&,$ry:y!rʎOьd7c#]3MtG+"Y"q/ERJeI v .:h4AR7Y) ڥM|o?B =ҩă< 6lGCvƃ"MWŨ8z7˿C؁( - /deɺ#YrT|P7h4>zR]? cyǑ~Oٷwqd*@DDdd(tV_Skkz[@W\>ptF,G"y^\BfCŊ˓HCmO]HOkUH,G(qWDI֐ M>$ES^9ʔg 7͏SToǟgA KI|U|t ֒Ѯ.uA@=,~F\~|=מ*qZg=.@ SEܖFp$j+B,$$,`zqiK-?\t'$P*G`-~I&?ԟ7ha<397"϶yi(uRT)a~b*S]V$Z/;D*_gǚ+ WM.ž%d՟tH ߦAi73`i3NJ?tOBrHpsZ"tbvIEũop<оD8wMӑmk49HU6kǛ `m=Wύ^o8ۙ6@3N&AE#B%ZiH # U\/ 4=ˣԷ]S Rs㞣|S4 GQ =+EU)> 'Zq7'-qO#5u_/PdkOY>}:v6MM$.cĀ4Í]ݨkMꑩ^ R()x3ǴhUK4DGgXTR|b&=`]^ 5;LrE& ĩ 54E~:T֩˭mIнI$|X|u_kzMvf"g66z⺳20i閝M~W"Q 9 <5V)zxv`Ai䯑@+ ڽRO{6Tz#'Y5Ct f#]&{WL2j2 #byWJ4>?$BPބ*31cŀ7ރ[o޿GS.n]T.KL41=)mn3cڌv/|ne9AT[Uuk"r4 I>[<7W!|L#Vf*+ħ?󛗷}@pKQ ,tWUd|Q6BN eKlV@+CjT;,T`~mZ:9$uD\? GS1$]'P "!GZM{8vd')-Ti?:@r}_K O=fШOGCC0cfGtjE)1Q: F_TP9}G?@i3 Co(^ .C3H?Gx+?ؕcz>c8Nw ZMhry&U6>1 ~'sWAILtzvh?GGu.ۄs 9o)DhѠÞ-_g8uLR,<@yi{91o[Do럁9s β H?_ ARcq@T <?M7?2Ȓb$ +^y}gUœcz7~ҳzi(0|r??=y /R8ƾx#ŐV(80i1RpyV LMˮC鴋$^4TeUa\8"W2Kk', @֕#b* /ŋ,C6 HW6HU7/U-HW($Zyk>@Le}>Z$ ڭj|;Vs=TIX,+Yiz'ohx(jKDlxhVK w!mMdH/}́P c<;m ۷e2PE&"/=ÖP&bq+ fX\*p~ۡܛi%qTDž6 "x+&z8HQe T?fX<=2h ~] /gT٣jdBwj$[xؘ_|Zla\m,&Y{?6]mwL/|+,J"_͟Ga!ٮx7E!K#ZF31bWIOr{_iiuјSe?HbE+]45i]&y+\@/9m %dN׹LuH!($* ߐ@]O@[pK.y$}ߚ+UP92)Pd? Ey4_gX:a$ˊC'+wܻ|i' 78:BHMstww1O?>VkUyz}ot @<SwD DXuN^%"/>igەxraTB("K-mD "wM^ ]F0 ѪhL;Km9Aɠ_*9W7MVĒLɦm^()_JpU *۹ȬtEOǙHڿG$L+q *ũBHbU-aFg܌K&B]cX`yQӆ3woHfPC~l_.l栗ce/-@,$I-KPD b*Ks|Nq[8bE}9Wf:8H4f &9Mqc:Xgm &9V \SG#zPwVuCHFeQF5w_xo=`yMYy%WȢ y?%G Ƕ":T2cHܢsFRHGfbrIá[j-[_[nꃏm/bmQ&c*/%K:DQ GZdK5GKB2a&6,ӭ3_7KvݴrEF~UX8o!-mц"5|,f,ƈ>ӈpt3ks}-LjU>(Z"@ <ࡐ}8<,fV(by Q]clr}Y55zc4X=aV+ϴ!?jHPJ3Q aʸoFc,}0Җ^َM;uQ*eE1!%z3e^=:/}50 tLRB0&sחN1NJl闔ZDofu];A >+#,YpOAm[r< Va.31qXv+u>}EMKJcPY0X߹b[5bCC߲DwZlOB%YRI3qyӫ*$>l,*9P5nRWgAV#-^ >3uhRɱ͚!T  ܛ *`̏,z"g _Ԕp>(:e@j8g);nz 4M reЙNvȐStW 5 C!?kY uJo})΃[mzѡ\T7SzԁDH-B&T*Qi51>o1-Az XI`P٠جR )H<:_/Ov ;[$Y)_ۗ($d 1T졵^#v韓 >DwDKF%Q(B"Hֱ/'% N%=ҦMUQl>~jwÚj  ЇE9K(.hҖAߐi`Ԩ$]& )>~}l$Ɨwf>M}+VOOFEoOHG1urɈG$3GY""7=ns4-c_M.܄D@1 -Q΃7#L dɩ̓jIpo75@.g}'M(&LOaE!ERMW # &I`!HHQeJ%WC*E(ǜ _pvE,X吥Oí#mӺ5{N=,t„YU5bI:-.⺘C`8G@=i##.X״O< y˃- FAY3$FKȜ\<{6VI}OIزw.]F̆$2Yx$X B/DA>ڽ=&H# "yjN,&jCЮtcG,a.r 0[<4k(_IiXloxqCo#X"x[Ntj>l* .oDq$';\Fض-QR@6&+ʁ~L-w?򁨆H+c y خU=`N.9+ȡ=6커ZAhEȏmhQ:Z6qOsźiRCp"A W$53˾v4,zW1>D,\W{PgĊV1!W)ND@)b'9R˾iѬ"$OoK.n @FXeR-d9 ߦʤ=U]bHuMn4k!chY-!Iˬ֞9V^ *w ꡋE$x@ iwyrB8 pE$SE b*yEJiAXVDaAzLUr4RxO:iS-wm[knleg.=‡V' *X%T Z7}E]ycg Llr[ R@@4ǣ;V-W'Ohkq&PT)$gުHM;T+ d'Ri9n\c[6]LŲBIp\ x !-AXzl#g yEΑ&EqYAa,xJ, /'Ĝ;mf9r86VFhYg_Oм`e=L/0}G-(KUn>"yܯJyd;jg19FH[ i) AbzhkƗqۮDo=6-1+i YؕaᣍI` Fe~oΧ;k7MFF `▤*!7D/ˆ< O<(StР=}Ze)s`xQĊQ!6޸~ˑƫqz20@7Y,rFF2HNJ-@'?4Vpx؂uEdZleGMpJj'r[{Z .Jʄ$J DUЄAuZ]Qj hWb d]@TXf]w 73&3i8n9늿xaiOC 56é]FYF- J{d6lC< U=qpwR%<.SxoLYb@.)Ee>ŗu'( _֦*WU/u;5q`LZܐ#Gf8҂ 9Rpm%*KڿVX4P%-I9P,T@ aC6WJwj6MѓPMJלkZ$.V(ФLX"Jr|PTQG(rVI;&>Zui=P5CG"D_[b^9ꨅSFJ͸IIu:O OSWH X~}^Cdᾷ7];'M6>,Ue9 ?TIRy?5<"od흅ŧw cA4̫>1 %u`o)EGn}p.\ł9dy6 _5}F@eT$M+ Ve$ ZbR9e 4eɕ.ŀYl xV<\Cw @)q|`p. d|>20QÒ8$مw/!Eu_6:`?pwtfI\E3YZ<UUȠq8PiG.(E +mApŻm;$La<2CM|ĩu(y4nZր EMґGImϹ!V|ު #ğ,=%YIS߮>i ~:EjoKd2|W+ǚ'4!B.82 JߪϨJtYMɈ'l~UB׶^:ֆm?y@j13/9WMsn@Rֿ1E8MH5]VS %[Ab8gbIVު#]i6XTP!~ܲ B KnmhwM6itEޢE1`1J?jV`>"MI RM!%"nr&%5GNKDY`n$Q@g{u7PȢ rYs䳐-@x[o ok/V N۔ţPWgUdjUUVUURj U>QsNAOo}DVdΏmVh Uk?*1O~PG0T/ށys=E8nkcW/rKVޛ; ShWb@$Q/txBK]wkBq  :ϵ .x[4}MPipCJjA@S!*2:VQvk#t&NM=o:DD)T 6XZ 4f5sI'F69 S$E $Ѯ/o$r'-_E`@?-U{np`cLҵ RG ?}0&ye,_` ++ 2kUd`@sjc(qQhGco|zREj*1fNW}/4s)uP@q. T Tc3MDb>开Y+_Q2u&@ zm+),[zv w3@sb̅P0>YRǃʑ:>Ik!1f0Ί twrv^{oyfM+>zƤ&7]KI$[ru) wj 聗Qr"NEA/Ҧ5Ȉ~&릝}> v nX&o&~sXRPT.cRNI.;+lIQCeu<Ë׏kI5M'ʤUu4[)cl|(;cYQ):|ry5R}VkiI}ICMA?)8WRbM9O$D4#!7,6L)qV,}9RoU :X43lP<_xnfUޗNiXgfy4K5VsInݽ7LPX5ےTRESd3#o5kYF>QHi$Z #P rCl kإ8D jԝLI݊$)%U"bYízl$WGAY,(g*K)ERP7<oHMa (pא<M"7kGGs˕?r9nz0[SOiRȇ7"6V$$60LY.~ZԫHstԺ_JR&ؕiM65R '" TRJ:10~U3SJ%SeKk˳hƦC*Qˤr&U)_HWpi9k3KwܻXڭfRC1TT4'F6FuTv{GVuLO"`id+lA*U+3;c3r\ K`rM"҂2ƭ+/>\iE>FpBAs馓{P ŕKlTt&;ϩԪ"XtAV5S[SJ&{{? 1E[K4q(֣!c~}}Hﭻ`eM." d/– B` ц|66 3k?UC4ڙO4q3b/^bbUTDFoӾϳC z!J46ITRDd.=7p7/[ͼQnUW[Ӂĺ+cf ԶY*K|UqWZRIkw¥QJKFM2s,zLIG jE;'&( cZ~&^IS<49ZFxuZTSPp(6{InTh1K RIU$5bH'+{V`/Z #ݻfő%.8(r#*E/{ %* 6*~%}'xkT#68?矍ȑ` v WG9fJ4LFDVb̴VԂ:nlK#̺4R- ,= (@#=FWR/[ĂU,kYu>7{ DhA P,a k96HP#/-8䱱4Tl au| Is~<|Mm[BκիI#=LYoP3_,I$e,O7bM Aϭ7vfc1AToGůМ `J\$rvt.$oUd@GxxU.-qI$3oII䂱ݰQalMK)5~;JoAm*ʭy{IV%Xl{8+ÇUDq9JG=t(3Qr:}Wi&2ClI D^.UqJ w=Y]9DY 1]P >BVk_3:YbUeQ"b$C1ċH8W"@[ؓݑ# W+/fգ @ﲶMY`Y S^'IZe,Uq*ugӡ =HՉd- ni?"+< q\%@yEjbұʢU欩-x~On%P\L/^)?$}Op ww_O6[x_) vg$Dh)U~eYc[Ysb}YbBN4F+3LwtDž֊=gx}%O駰0¾pENݕ c|o, ̪ӂߞ5djCDa6Txh$LrPb!ϧ `"~H!ۮK}I"r#5`JJ$I.%lP23pN7@={y'MN'h5L!ٌwa+)J3iNڄ7b]\_G"jA3O 6FK9^PZW$OŸ#"Q0-GokedL }FTANI?O G)('Z/pi=:ڵ:yl dI'AUY94NwOe㩔}^@36Hėm=1"4v^kO.F+j4JP,"Uru}Z(j8M!CQVVuT?`HxFȟ,- JXce\"PAyxcuajq>5ܙxFr{TEL*.^04{w/x$,fW*EV4)|L@[(FQV*@muGձ0w|/2/=7iݣOI!`co4P*I4OR0-Ez*n*V%;~a</[1d8-c (FEbDģ_[ͬ/l)U%_ծҔm,j&<|@BBJ1o}UcXڕ]F"Z*^4 K,qkV%;׵K_#1yFɭIrV}>h/N5V.$8I%)TdSӔox]ɦ]Hf9X/ j `gkGkjj-ZV"k2x{ǟ} M8a~˪M,#YR37,R& ]WԖp4zxr! X216+< lV4 :YvR大G}d&G}idz=fRw,~* H\&"@bu U JzskCꡞWKPj" j;31J8u--zҌ8ķOWelq## {J%l&u^F8)>j&C0՞Zt[xYpm0(%CjN{V]gX8Ӳ3i1>#'Sڶ5T;GAqx|4m|u|P[}OؤQ4I`VaJF#t,M^y:9R4-hJgKVF0 Iqym-˧]pEw]4`)l,Lvls1µJ'&?113:||.pƮiljM2V`ၬh*%̊,f8Q좫G{5}˧ڣ?%G e.[θ8Y,Rd݌k[dmoE6~ %N%ؓt(ՍaMN%)jKD-)ފZ)b eF ϺpKx$3  j6C$ئ#:b 2ťd1Ed-3hУRO[tD%$ V9PNI!lCw6ZU*Aqυ-x6AuZ`EM\U cRI < Ͽ{llW6h ")I[ Ă=Q ai= quo.Ҷ{g}Y2ʘ I's.b6錤Z颞:[ TW<*Xwk?gw'oo"0Y` U(28y6*P|iKLq{O71blIxfy5ljPKW5ڶs$M&NwJUV*oLdĪU߆/vի,OrAxfhYdA=gUMr$i)E"?Y>ӥJ[yHiՏxNXZ%q qc~zdg,ip\o29 p1CO dڻWUM EH]J $MWԗ+dR?,.P!~7 ȣwb^R.Cݘ~=EVݬT$r3Atf9]m``neD@3nAwF#D|q}+#*5MU}2hqNI`L$f#s.J>5y-W&h|:to>[I7%++Ȭ㍁ĺmxii£deݍ{`Uo[w}-/g1wd*"fTHB=KӗJ۟L֒Īj\ߍPzChKk4K eAPeXUFPjf4Q_ Jwl9trΪŤ"r\Yse}inUOSLYn][O\ХfGDŞ㯣i5k(FєFG+[ Mk#ɔ5tjJY(tE$ `M6[2d"@S74X9i1iյ 1.լ}&h$OL\@8V%X0VMs!pWCoi\:˭I玳QcTa\-OWS!dn sHLUR0S{ eϟCF/kﯝrO~O瞽c6NU6#y8*2Ifʃ@$Mu}%IqjebMm]X(LMKA$(xP}d c&;uzQ[oWO4A- LC+{N/Kw|oNc=.^VD ¼c=Q/PU|1+qZRPHEkCpIej¤ ZE 9,rUu)% yF7ྞfE}?$dOLS= Ӌ,|7be.Yaq ]PHZip&MOcL:d<޻{Mκo:XI nx 5ZCW>o-t}姼:=6Q@H9.IجDT_O\N)sstmʾReZI¹[{ayV9&ʹk/NRS+yd6]c(57ʰIhnF\JTUU42-fR(A)/٤ܶOu2xڭbK0 .dŘ5aF%?6ݓ)m `i'ؙ Wi4zaIŇXi*ʣqڰȞ/8t Sg?Ӥ ˳ -G}iɆcqjC3lU$,Z;eGWRi';9&O|i]z<gb*,*Q>7^U4/SUT/ĥ%ɼlʺ[vdp]+~?ɑ=m-;S46%Ra]^`O˲+)Tu,<S.B.D8x%KW#W濴N!Q,6'X=fԩ6%,JVCpTuͺ8m+ڑzUҶ. kqYU`Zİ?pz ?"5Rׅi{UꜩEcv6hY K03GB&k xpȭ)XbQ_e I7yGL[û@9IL4 Nq&|LVOjn!6hCNV,>(*v'ˍ~3,6yƞ$rn(7W[>)c[qbJ:u 퐻LюA*19{`39뫾k;Tڒ}LFM@Uwg nSKѹa|!">H&@pXd6.kjRg̮VV>$_ebq=P0CɢRQF_#,$U4m[k8DPAҎ'*F߶>JLA1|dag.> A뢬?>L?ET$G$T;Ol5J!p (p~]5TJG; G.ݵd=)%CJ,hcCS VoUJ >U#)ʮɬIPe} M^?Wr (?vJ5|(%L#itB+&W+E &sdMV#ѐbaf*ϛ$2w2S@XK hϒʲ7cnEDŽ`(\q\UH7 O1q < * PbڽVHr5DfۃAE6uw0-:&M[@?GDas>i)@^m,XR#) okWH:aU(S#E1G1y4rxȯFj t <\cby4I"4 oŋ5+#Mx-'B6!)Zi&1hN'`)"2{';鈆TUUÔ*iq(,:tzoXZi>$ʼnZُ@e$5Y bˊ9QjX(0FȤ1 ˕v,ȶ(uI'3Awn;xA.V)(E#i6¶@*Ñ@uݛ1) L~+(dBxa#jh}a`ir~q|y$=Y v=R"4F8S S5UI5@?uc(]۴tݫm'iTi%V_R‚ʍdun+LH.ݗAa-,ɚ4 FzLJ I(ٕkܼ:[y} {XnxcaצbzcY ߹MBD|je$oی{H&mBJK)i ?RPUUK{E-nm@N]oMt5ܠ3I0Z>%`LA5֫\%Gj[i I<]|€:24]=FЧ \6P2p99FPK"5t{?CE4/Vz '٣E@͝NmichmM+Iz VavDH:6+q9@kk7i4FE0tAjTUlgͭQLvYtv 2H-*j18gUwIJ,g¹82O[:Uj dI*pP}_@O%c4k+K(hԯFUiZX "qຩXL=Wbh_4,я`NEӘ@=7n41$ FNAUFFDiS|G딜]4Rչ+ƔU~Ek,R1x@3_rBpg4c4%? 7RwO|s5ItY6fgbU'*bM289٣ Q?ͷa_;zck+8ȏ!A )Ds(ZT?bkh w9 "4 qZR+|N3tҸc-%7s9RN@PMG$:Hr@"m5zX>UUZ$[iUz(Y:g&f1Ԧ"T?[ơ-vZH_ė,UIK/g{ݽ'%) {oNKrJ$ uaIݾirSJkZíS9Շ2y\Tdb,/"_>(?ϢܛᅹQϽr Ґa>XO/\KVCNS1VO(uFSH!Q0x e pΥj抛EƝG UI 8wN!6nӵM5*ѷZڛIY~ᕴq̌  $:A玾zIJ*ΧKi#WbUjTo@OkmEUYݱRV*DK18wT~oc:g\Ĵo$hXyy//1i%;--6E_4Z|D:Mvm6J.$ƩAw]U>h91)]X;;j22Q^<7 RqBj hs@yFL#1v,Qכ~cFPc3<{ fVn:w봐B"8<{\ 8r:UsX\ NVHf1ʿi%h:؉;UڹQ"fO#̈Rolp*S>epɍMd@O<(ZAfUU +ⲥ><*p_yּ]}6鞧tA>N21-eQ4I =vу䮾 oM6ޘDOEZĖH~oܘĐя[$ET DTsAJ+;5F+³Y&DKs)t{_bGI݈k7w K쏀ٽ̤4*qjUTK_vhᾹr]Cy3iIWW3f_'dBN'ļW“Jd498$˯GEq q`@zۧ(ew~tg4ˣBi.cƋd) @ V뽯h\%ǹ6-Ft亜 )=q&E`SQiidZsS#k ˥՜1P`J˩#>"]4`ʛiHI5)!X,N!m$!\aQqQ>*ҳ&8~=$Ivao~$6HwiH%g =UbǒwHcpҍ\5_p"huN@)_,IKC * ctM4d4}٠fjK )Ir-y'cWj G5vrq광 Ү()p* k-'N.(w9g<inN5:Pĕ&U_P$d*U%߷RDo]ٸ1.ze8Ҡand1K(a qQp=Z|běQx8z.7ۺ]}-=B:,*Ջ.I#+7$!L=hDF} Dk6} |t#;_rQ%( !x)4ݳ?۫>[>A4{PFɐKC6sJԌ*ݹ/ȈR$$֖ Ud+G KY/^#^Se DL93*2 ;t~ )~_pk[[w&5$ #.LhW ]4]HFF_n MaI0 A}3PegAI]?+.l#6CMH-X<wWLm@nSHCGԐpV"KtC=tcՙ`A gT3}iESϸRʕ$-x7V3jϨ5P{v٨],cUٮW]Zs|g65Ne8{xs3*N-VﮏJ9E0KiP-#-׾P5Yob(LǾKO0`)r(V\UUW ԷIYݴL遦5t:vs pDh#Ic3K6+S 'irڛw\ˣzw恧i"I>,`A@0Qޚ8voGSw$TrOZd96p P-,tk.H*˶rH r*tMCHbriY,,X&Z>}O7RJȾDS'}>~`gO?]tۈȀ(P?4PEYUI"`w+Em&b8$Ƹ*r=2#D>/M׀8y'|@ ;|s9Hِ9,Q#?'[x[Q |ؒKI&7ˆK ב1&d@䳪jPg(7dsA$qQJfWxcӫnP$ojo%Q$E-FY?K6Mm5[qiRL'a`Q Pg0I0y C^X6@LA+IGm{ڦNXXNE@0J_Xʁ*VsoN)XVUBz2 $r$[k^aMI8`O,-O鎭43873#zeIoDvAl̔ld@ m_$]@o}8EY@3$>& @KcrqI:q(|hԷg>;etd6JgT{97=bniI<7*ClI % y8U_ ZޗTb&ӣۚ)F;Q4ڣ9ʸk.5;Q :.g+m.@'2!BH<8V`x+fuN Jٸ)Yda_êu5<\.Ӊi(t7M(TAmQlIDLhR EsFt3vj!|y)TTp"ĩK֪nɧU8_EDU,JK&&Z%(LV@2ZKlXe#ebˋ:H׿aꌈF )81P mO3 b!Tb>ofq)DWX6RMMQbC1?fXAȖaU=MM};LIIXMJT,D 헿Aphwm$7Qi)WVf(Igd2 >|iY. U%M8t8x2쿵KtSEشfJ@Z *`9ׅN.uU25;]v= Jb)2hqRG~箶=4- Ke}M7G[5?<^4qefVY|}cv~O8A|]/55a{'N$4^8͚_czhY9#ʖ̋N\ j7P}Ưt}QDє!deX'FǓ)~c>ԴE5%✑qg|g9ݺ ܽaƮ/(𬬅dCl䩮<\ q~$᭿z3cJOU0 K?~J=˼{~Nu[D>hȍCy1?)(@W_:N;u:4qFYJ/'JSC.wEԑbr;YJBȗQG0$)pn\n=57OB‡M_j։`f.RèVR clJԡ'MeM+ΟKp t[h!mKq犩@o}͚s>R~i,EhbM$/M곅צm)-TD.CGےƱʮ6j lMd3wϾOiC^1_Ѯm@4 jv,(:{GC[MX *<օpHn;Td4p|`c85Ljz-C)#Z'JzCG~ًk\$גy45Jlj`%R9??T#=$Hd_$BOI8 Hɀ}ű y%}@ ޷ru*89_{x*‡?u|j)v_RQvT̷9iuu1:#,ޒ7w$7HŁ%K hl馘;oZӨ}9FQ0`U Ɉ bJHdV6ӟl$d`EZ |by|';B[ӦnÉGU %v]Wӈzi+6`+c+ZUi̵C zv9~8ʪ@#L-G۩`s7tXAR KdԔh $3CJ{`˭RfP*wJa7FL̥"2 >Bedkf[>bSWS_)(Y3 *V^vk7JY:ytF LxR`M~|5gNSS^Y8$;U$ kt(e`@˕59Jx;AIéA<`,m#zqZ䌀@}cql9 0M C)Cd2RAFA2rVB^nC>EUC#QN! _CD_Fvyf.W,2*, cD7MM,*T[j. rMjcԢpUQWh Ym$LS]⻙ΟZpZ&eMKx(K5]OhRIc2H4>XQ 4"Ff_K@V6O4XH lj⫀l`Qd(rÖ ͐MnOͳVX)`x cVbgl\N}V Eg$P5eMyjNI!"F ;Ɖ6ܒqp5B v\]6uOx-p}>%wEU=,Q wǐ @S1P0`>$UOBx`vU8l #{@b yB'*o0nJJɆ$X4:Ƅz4`J[Y;V~nzqrCax+o_cFOnqeاq5Dza9x6m=uCO?9~"J @'`־8n89-Z z4Vڹ'xŲ~((^/0?Y64ye8j7KtVQzda${A<]׸S<_05Vufgnq2ׁO F<t.ɽ9g;߂M {AF*GU{|ryndÚ{/[.#Y ?^IO9˞O|m$Z1@ l|zf")Ze@=5\Ӟ0󞝿>j>ݤMEoU`I @0ʱ1Xad+^iLʄÕo=tۋӅY1S?0|?OyCA`G+ү~|&9eG'{[O˵@ʹ45f|㐓(IV?'S Z[{4qɽV?A6i6Ptfg,kԒL8DTh0ioqBt꒺Kd\:d\6BglnڟV2a-b-Wk~ JUpҧmUUx<)YyhxluH2?H`00+VQҪJvI?f[Ɯʱs,jII +&4˝6kMS}z20kȯqE`HwUP~ ),*&a]nfyuR*%Rw96(5 ~P5q!h6˗n}_\NR%ͽ #zY$ϧLh(!Wl؞Oh_1srܼ˦1o[ᱢ2iZlb;HۗzшPU݉oS{zf-UI*IbQcY9@e%8۸9ZnWW,0YxW-T%#(lY)۔z=^ŪPW+Lj`}>P2<4ceymzQA,#\Wf8 ?ͥF_DOuur,* ̇DE/|jmN@[T=Oig500!O)ly&0#>Qg{vtt2W%.#BnVtP>"qRr$(P,c/&7Eo!yu B%q3*61~2^zh}8*]{)2;eB)(4€{uq\L8`=(K 6"H1,/u@fgxe$` h!o>^uMTOLaDbj?x"f=v 8 eU[\֭vUtwFM>5$LKS%[ ɮ{ R]0Fi\@πGpWLE&Xr}KdK)1Ƹ!q,JYEwyU.D), ,TZ!OáQLI#eXeɊX!D1}}hJYd7 ,ZI;oifF`Q͖.4mN|Jawv:Dsi |0*<؅*'-R.{{Zwfr#4j}ʤ-y1{zB2d\(Cd1j,GPX+!5z`˰`Rf#h:䩺ZohW:*o@3v &n 7û0q.AONߠ;ϩ4کcH cUkjW[)U S{=.]>@V^jςxt(\/K,r!.$1͜nWFo\7${he}x5aՇj\OɮjMUSg Hݤ}vBp5i0U8#yH^mJkMT4 Xv:Xf*0$T8>*T.(IIXwmЀ4'J0UyFIyO2F9#t%\>*[ R#pC-O#I9n 249p @! &tԲ3g^inaoQY lmY}X,l"Jp=@T @8-XNܨ+~CI.q,. ~S86 mEsQ; :hrVc|@k4:}]VM"RjN"ЀeRŴ/uj&!U* @ {r`*Cfwi;3qEPYFjF Ϛll=?kϤ=[=coG-svWt;h17t:)KD )%+d-X pƯ.@ڨg8#D& YC iͯ0n{b nc6A[XݗY۹#ݥ >u_c_w TG8e0Eժ*&jn!=MMAʥJr\Jᪧ:BY\1H慵*kx|M-wNGU+d6G ̤oWJWɜ(SlvM )oNtE[=H$Co1wϊ_S!hSK/S~B5;0W\Hb~G69jv9+|5oGWiOIЀ18犢?ק쮑+^lljHy6|PóۡEi(s*-jdidQژ~I$Ys+)q=~ ZK1s=RpE4)﮾DvY/5jjᶓ>[xmH*DbO.S"A<>1S\SQtp[q<Ýh;7 K~ԇFK dU(*?nE ^7xx޻uYjNWώu)ETem޿βqX]EKfK3:_jM$V۴P%N2q%} )WױTg\;5jW\ԣ6SYTŴŹnQIMvg,!fC/ɬ={C\#8T,ۻ~4ޖL>TRېj"IXEB\HdcY2V)F* ? 0UIYVsHs&FuJ,b_4.<ןU7|sJ,kyo"iFږIy6|+רw ~([(($Vr8@ΪeݨזȇQ}}'%`ı4>}MuJB(]LFED,1ޔtC^ '9p|]Jrk^JfR,g]d \kUx ׊in5l6C,,2[ʲ(BI$0a/>$7׽6:K6)#0I;$bO#ޗBM/(YYpћ_5*,LP"< xJ|m:n¢;Y79岚`gI>eUc(M T`jU7n.R=m{yŦ-P@,Jb(v<]ˮ\+ϩ_t =mHFʒ " o<6 eҴ:iWJdb)^q)@W f2uE~ZwM2Q#{e @^ Źm Ltb%duɐ?hFWppJ[Ӥ@.'*;(\Xt(/])MeĈuB3ՑTyW&|Y )Ix*R2= y$bqAA F#z[K$4~D̰[Uc',2na4Ktnj);,P ߂9&{gHwJjU'ʏ YX({LJ%4bXܫhS!e?*H~y:BoN3*"`dYb'%H&< )_ҫQ\ăa(b+2 m#MmHG`kyrM8>#yf=A@_sTm"";wֲѝ( lʳ*>$$ u6}ۛm:G^Mn: JDMQO X1fswc]QW>'j!$a(ifZn6]NNn0^ZH$bMǗUKT٭I7mny"ԙJy(@ܳY )k >܅c0Q>UX* tQW_}i!$@3& T-$F1'e_ ᶝMڰ JVJ2jVzcFӢYewʡH 2CQ9db]X1Ѻv}Նɕ|\$A_+Ĺ4oU"vD: X,QQ9Y[?h MS zj0m0F@ 7{WB دZ]99b#/809 ̠Vh4gnQI/De@Œ*dGJ5,zE=$:{zk4lY}NVB!o}_z c47MvRt4r)d (h%qW5AHQWR]B9v0G$6KzA 8YY?, /.X[c~HϢ %WQX~ ٴmؖťVީdVvEhPAm9qg:EaF$UT4UK}fV6͗^q}~·~EyP8& P}؋۷i3VHaYpˌ˧,C)(7|_%ɠ]OS\2;ObB)usԚDfMT •c3@oդW) _ >bx:=tOdUwڈxJ7X1"cSU;=<>#wNY<;W7{h|gXb`pe%9=^V&ۨ*Ŗ&Տ&x'p0-yL&-"90j6 Qc ?Z#Хp]Yy['WzJCٺ>eҤ[SDDS!Upb!fS2! 3[`=0x|uUO&wOJLcTmPL9~CZ:*TIr뱿"oahC,PE(ky؜ ҾQu-MZ,Jrg5xY-mCҒYr yu+{  ;~F`h|_Xm2ބ,3o<EP~8`qd9TDþAm4dI`k$U 0lIPO8p%2Q+ʋMȅ[B$1l;0iMMM#ji}ޛ[0ABB; \1 :m:ƙM :՟=H-.d| H >d[*I &Y/^f& Xy6y8{;fiM]߁~möˠ֦o$;kZQeĖc+4pJKj2]rm_S%Wy$_UMRRqԟE>ŵ,-/5PaqMH)vr*w2!R ׮@V˻o4qBDuI. & !X,[Y[߯A{Chzz`11Yrb X$1%"\{yE׼iI>.Ij&CU> Q])gNC7fm{n3|}Vت X6'!$QE`6!AW'Y-,EHIW2/,@^l!{pXj5N0Ecj$ [#|ҺPԥw)i`41.ArY{ٌCuTT{R1έk6 jFpdykR'4"CFYNQOM\l"Ā`[$}^1C5Y`8q d#!O>c~n6dc㥕>X@JHr $0OHɰMͣhּigWӛF((SDfP)PCq5⏳ER1DǨNHQ@ U Ko)C۲ɯQrj|82UUM*[pw;4vΞYT4 DqybEW:$RynfETjtzpsŃ$7YbZ@8!zX!zx-<ʏrv0"!UQ8]D1O P2B H6TO [:)vxvشGHEIA, iq:?iͦ2~n[|MF8Cz1+`l(+0P)cB#2%tZs`cHPƖ1ulQj1f.c蝄OͼϤuzӗuM WXF1cIUMđHln;^ u !f*IQİB]W*0/ME(1ukYWـ`V>$2씐>ʏi NOO 36v?nǨ CQt8PP|+j"suQHmvO_kiUF5rU@#pclK͖$lm7-L5JN8c;c)P<5͑h6BћR1RURaYB I>eyuF Wi)d%VrjUH1*ʵI]N_-ɪ|Y^M\SkGt2"5u_q1" }؞:M1J徫1*}J"-$0hōKcQJZJss^P$a4XCQ T^+>X&'1ۜr4;ޗq1Ŭ,e(hoQ T *Hn_h}ݞ(=Lɧ"F \&r%[uV"EA!y5UxTS Zϲ"SLG U'fqAqvvkQ.@ējj?~e*;=?w6pD~I e,B,Nzoߨ8A"gU UAEYo_E$dlnڭQ 4JʩzLMSV`bBYR `ޠzcuMf-"FXB!p-^ТW]3A$1FM0cOdjÏ2.iOPv(Id4W)S%Eabel?ঝU-˪S*SA]S FNXL%DȄXхhG(dWRK" zuTCɮQiSMTjAOsj'J{e_3vُfм V&5W%84BTUUG\չwǠOfC# řYT)>krV:4OnޚSme5Y`Q6y2-L%Bw*SwKrw^4o@-$(&8 ,>\nGK|WRi7P8do?/Yk$GkvI3 6>@Q`yS_U[vZ{^sDhڽC D U KD w 5m*D%^E\ yI"׊g'wʏ-fs^a"EU Blb[fzCMхM5%UJYYT/mg5$#K#2ő8U@\thkdXX}$,~ P;$wWz84hf QnpqkwlFǷ H"@NnJB)g^8a2[m~] S߷l]ʳ(TbJ'gRU͙vTDaY }J` G+B5!r1)`9{s Z4ʧs0ڦ4ج@Z)L@rU{'HHLJ룙r JKP%/4*8Hkwvfdxf2{ܪ+9=W􃈲L2Sľ[4w[\]@cmU%\룇ܩ;Ujz6Sު-EgX򒫅i%oPeҚDͺCM|fEZrHa+uo@1w慄aQF ULYH (S1uzmNB4^OVDpH f!-dy[ݹv}Gꎒ$I#<`X+J2һ8Ί#Gm/~\j[uiyA "D*,i< $Ee\RF6@dܢ p YQ+乶$ncM>շ?T[EFt ?Pnj[%5 rgFDriEcϠ9nA>l:SvP 4&!\+s0V"`w20ӔiWI'@Y~ee Q-JQ N idLr$C>aJ UʱQ8*NkaNΞ jYc[rA:T_~`wGcӣU[7,[J3h͡-$}סm:/rD<Y V*%T) .<| dߣWUϞwO(^tA)`Ym$Jš%yݿTHvMF@$JPBBYhNfC?L}gjS$ 2*LX y@{wݥWcx(5.Y+*)aN;]Kz]P1b n8ʤ/j8sf03CZYƧȪ$F$#.Uq! +īQAdݥ˧t+s i*$J*:}(mE6 Q3~ *HBH$3e`2_z< gv鴚$v~-5Ob0v/̌HmAUOLq@tòS3FDD)3*Si)$W^7;UVW'zU{~I7)6ERoG2dy_+x(ܻasNr23 {Vq͔ SקO(IŔ ~#$\IfIUP5UȲ`An۫j1+|H ,1\ ^Jњ~IEϧ=sIXF+,lZm}G)֞˾6#MnQ5]O0eZPC O\8<]7y n>nh]!#|1flho:Uqg"NɃS,>ILT QEB$ب3츿ΕiU 9 ^k,;v;> tpG&IItr B݈:o VTf`iVSH4' Bi}§‡UeC+U$6¯SGDx5ۚmu3ŜaF5` .'mM6X~R$FOsJX#o}x:触D(B?CzQɑosdd:Qܘn#zxCQ uPAuMq5y$6j~(lI4c!oh>06hZiHad3U٤ rYG<, tMxEd24SF3E AuTG>tutSS) Q ThZl:} ?}P}$:whILL*f DrHq_Mȳl5UF'uKNƐ)#M]oM,Q.; C]JJH\>B8JW@-b*lH3R-(ijPg,ԩ a;=A%ދ6~$қ+Wcįx~e޶>޺Lcu[e@} IFvD<py{W[f}EtB#'`;(T߀־xUxcG[BS")pEEJ;it-45RIP@ @B2҂-UgǧC9pbI, TX@1G5F=gfttrK`82N\0A#r ȾRF2_D0իhaceDed25Qks"njI*;@'$/"B!Xf 95„M'~19~8frUIeʋiM墓d}o`Y4$c*r` lr|D]xjTOSK#d1ȂR7TdLH \u΢mrieH5Ze.Lr) r qt[kZ'$K{U;ɵM9BECz؅PA [\ՁѾe;XiR !8P[2_jP 5b9h5zv0{E)82x"ĊmG\ZڀfTOj:zTelͶ$muݣ#cP`[, tzWuz09 h)SZ aUÉ:mZz5(KXp@E. !UHFE+m'f]k]f4FSn/<ŏ`P kK`Cʚ}3Oc*VIUEɀ.ˮ=S\:JorEmD)/grpLhTOL`ak5S.sye?6cFLҼCB.Y*+}Kiz+vI4j@Y bqhʳ b`Qr;$:E?Mltj$ȸr5"$QttYԪ)5:[^`fCGԭΌ\RZGT,y5Bi]]h}E1R 3  9Xcvc$#t8KIy/$ܙ,cVVYų@,G7 ~-_&&96$;,PddyYed>l9c$jvv֚Կ Av*@6,:|2" }=& RQ,s 6xi]̋jт5+r%h -i9Ըy/q0EݫnED $_Bҋ,M._~‘{kvMie>%UN6j PkwJN!-e9K[šӉBOMOG ;Zm֥q^i\XZpMzKtgɞ=S^9=>ƖS4Wj>: N($]>YYo ,0 E[e"[Izi(ͩc TAC6HR,Qt.4ry!09pSku\,{DsbH*̝R@lЃNWIF\7t 1lQEQD^!4m=[p5CW~=o&tۤu@[d U F7 `ضcM32[+S0|3V 0 \SKv5pǨӦS;UJ1`>V|Ye}QC#nJ|L'Ff -$E<"v,ɴ褛Xy $_H\">m >_*kr KA 6eA=&@h%Ge?actds_UfO+G QJ2>Eb*6]'h9 6o-TKѝ2H<oF-lO@(lFn /ir6֋9coSrFz!$ XLYvsF<5Bv3&wdsS;!I6#L{'a6u3>1b,ߐ`6 xW+in)M #,=pR٥JFUؓ4:xu۾@ɯNL)&U=ƸuB)O ~qԌ1!ط-4Ɓ0#xɾVS2H‰5GF$*=R7ݸe])#T#KQ.|v$un#$_L$a|h=.@!SS5K6ƞ66xŅ!Ǽ(XyU؋CHt *ZbҸ`]I-;=Yäн1H\JYʳX 3!5Jy;97VRzFT:9}C3ju(}`٥s{'7 l2KDs1*ceХYe4z߈UgӝJɥy >rM\*]o,-qוe_b0ۢgV ;ZmE:Tv]A#X4`qӛ[?@MS.Zb Mk,@rn\DnybJ(TMJꁅ$ lx'2G`HɼƘ -[ܥ)@xP8: 8J#ecC 1'*?;H?Nꄰ`4n9b`H$bT9)MVi(Z(l lY^ІMS+HhT7 ?6 KpWTewftT4bhL>G22fUE=9PȟrcŁwnv}L3\~,6* 'I@ixF}bw.=oa"# H5GP.8qV]dQW=t:"X.+}A(uȜ N:PՓ?' ~}$MM&*RG,aXE1-@2j(xպ[5P>tNUIy X Q،, O ~?ZIғOF]7i2JYbJpr,I*6IeU"={8F'Wikk:Z-M;>) 1 ZbH08/@-7OԒ*]d\婣-lӂHN(b"M\ H@ >|ِx ?S%G{UH&Th2_@XKM֚/ W7KYC bEUvrH"6- rT;WѾ*_)88>!n۟#)eTcT nNe/ [Y_]lH^lЍqOº\n>m>w-zzXi%%iH,Tdz)p2lBhe rul%^EDZ@Z-"ؒ<bdyKőU_%_.~}[`@!O }-ǀH7U =+[|{t .*;U4`HB( JipMJ- C^sf:_In O Mn'0^փ&aeN$nj fڽ0͒K@Zm"X E4PF#HGGt@T&69>ܶiK̅C0K\#Fv+`twti _wnҢ,sƀ!l (;Iexh2w~l[D!E^HLG("T8| KC`vNvFkKKq,KN8[&D . 7ݵM&d\1r1HefF}uMo;<EtV.y 1Q1ם_ z?9*YlDwI,qqG$s" 3a%::E~;i?USxjS DYlFggeAc1eI6XlXb*F$|O~'MU[C(~~Y}Ium>åciPgB *0*P,Cuªm̨om<1Chc~1TթXP]gV X O^Nt1t|rȉAT1ȥ tQ fjc s;WgM.㤁&&W܋+F¨TArzvPtjk;csvӔ8JCX9xL abV_]Ct4ۥY5 lW]֤si '/?)TjG TS Mj}b\eKDbUcouRVIVO1?P"qU&&odW`5d.-# ;/uu<=>^jWM+9 hd=AP Ѹ`icҮ.g0;M>ݸ˾i[qE'سSɐa"*)')g]QohAt꤇o~g}X]P'zW<u=L",dv[,#Oޚ[.F5Uv!.MԸUD0JPSbuy2"/{6],!qXHpA 3o1C .[k1P>~QmF: U ⑼zKH Ҋ1fM]~W ;HG,j6Hp"@?iŤhP>r4>Ⱦ,20ȸ%Ȝ_i4 Fz-܀)!6& M Q tߜ^B>YWjf?!xy*@f(\-+7QikuӠd;Rd@5b+3@rٻKUHbonWXS4*F3"9kb"XKX \EN? .sī!;!i"Ƭ?heaaN'IwtW snEp1u{T Kb 4=;oh3o+,V%2 +:l+siF4Rb@f1V>T t Rq#:1K#O,>$X*X'4-GCyk7Nj$t[[1K'%P 2ĩ M!7Inѳ&,u}~w}JeKGwZSJۮ5Mvv%mǖj@ etE0xë1̒V%<5:^i&~+$yURJVP !Y,Bbkή{} s!ja+lcG"b /G7[>QU&ھ9t ,sc.>+ߩlCp{xB } ZcC @ϓlnMRkJ;4γh.???o&Nm{T ZCkdچ>h K wMrz=.mAMc)/솦vkExye˙SYE7}2[2i"Y%Q2p܂èruzy # ,leCU Zf[UkHqDMڽ36s%pT$dCR~n)Fi`LI#QR@2RO#4I4n=NϪuE!`%TW\H$AVP} f־%uҗ=c@X-d4ZAk (>E](4~iuE*HeH58O*[Y%Sɹ^ C\=7Gϛ<׋oF9? 9O8>T|l> e4웾j84k [ayfDZqS rEHy08F0q覎.WqޤvDm#C %=e A̒VhA,TOfۍ@{nZ'f=@fNCju!Fso.qgݠn4z!K>UhCiDq+/ZE _ݥ}DnpzJѫG<=Տ&A(̑n}Fփϡ?P$ɆG  HTR1eb[yn!i)`Y`'uҘ~5](Ԓxrk.̪IT /7oˀ5O+C=E/|ഉhtW!ZX39ĒIm#U&mG6jZ$ Ueo|568_2Ne&6Ǐ-ӤS"*%!T6:BT;#ǏlӒ{nm'@l4IEhF U)HO@_b0=@ j%ꘒ(ן)6^B=#*oP3"YZ9գ8'nKՀCv^YuR FH$b@P řaU BOhh¹*jdkR,7+Fz{Z$0+Ċ<p@.JV@ @494mK..O!Hvon36Vil@\C&%'O*d3R v'svVp9/܀E2.^#D"E()HM'53v(du*%cI6\k_;*u<ޛ$/n1Ҕ䃍_Ѝ5{kU?m\qgSF|;#p2ɲ.<AbOw6Ѫ!1,+0K! a.LWׂsʪji?8隹5zLlNu+vig U1-[2Pir;i~v4NTi3gd%\T;UYV#GeEi~nj]CiN&gӍC1bϜJYE| u+^E+6]Wm괪k fr2PH 0BF-U*m՟h{~ZؒƤj}S T"YJ ?;ڧA굄,bQ+&f8NFI6M:xzA21Bǘw Q<-*˅\`!!Ȩ q9 =i6Nŭd$A c:Ok'Uu kIJ [" or @Ӷ:XufaJ4$׫FI$2HD1 c8P.1?To(<[i=)Δc#S+bd 2bp'fi\"mǧVEC4Fh~ҚO 羿i Ĺ ZGy7`Ǟ$u;c:9U}{A!I\ {ܚDjJ GI`!!G~< lҼe@2 +-*٥ @'L58c>>;5\ q@11iSV,ۍ!$Ȓ;3TȺdE'"bN*('2Z;Ȫ0NvwO"cs}p4ԛ٠|דCy?UPk4R Ź&ZWZmvŕ]ť8ǟ_5?ѯ]wNmpmtz!aęzFb($ב)bTyZg0/RxϩT~MpJGK ) [[Aޟt$$"FR#4Q-i+yv>U٠()2CܳfWxݲ[!AJr -0`TvN}D%($@J9 u|6rI9b\r*,͉2^'^ ~Ⱥm\mKhDEN,T(Ǵ7&d(,1[_hwK`TxH^Td +35Gt䈳/(OM'1V&XwjSmlR#}(B1Rf'bI>&,@u=LzmLg)ʰ􊱑#2d(cdY:ׇ?.Dn[ 3!<{S X`ΞU\R`:6?ƲM"N&l=qˤ,m7j}Nѻ}S U#UɈUAsVdp Z&Nh{"F3,ʟd7 @j\1p}}=JCXJXx_P: 5bP)frN$;N歯/sE*B ‰YYgD/ {KtRUb66DH4{65FPrLY' 0d,Ej`1[rCdX Y:N[d < <>.iU%)"5 4Uph'ijEE " jA RG,i#P l@Ck&۴5FSȧ*`( =5ev!s+nXV( wr%RW69:ݿS.Y ڽD&WUPFQ!glo E,\D+5D2A)/սGG.]qPd#R+~/,VdEB}WFXH"o ƭ.N2%z#k$jG%-S2H ts"i(o5~˺&iT#AU⍙Mi"9-.ߥp~jEx} úADtom '~qGu9o~yr_9i #S>ܒi7WQܚ&:cqGI$ UI7ѳH~>+iTf@7S{w.6ذ`lQ<Hvw-3NZ\p^W0Աo{'Gϴ 19e`{G^ ~0gқg6#6i`emJ[0= R|r$k4?]& O"2^I%/J${OJ1niy΃~vOS)d#\) i&B̥ B/.&C'Q &Tm,ޡbB nAlQyl͋i)`Ģt ۸s_!De%.H*j`/i5E4nލX9~Z&\/)68$7ʕ؉. Vu(ߦT2hsa$\ب"zUN{fj'v艩92@MV$>Ћ$[[}]:Tx{Z;@1.&=T8W^eP4)v=$fVHWn`I<zds\T}"e׆$H|PϏ7㞭t_V?S*AsGFIGTaGK}}4,M) f7-FWR|{H6Ac6YG(bK1kL+v!h$#HYvX1H BYZFV9T pTwa ~ٷ$ڭ`NR,Bى z(O+UR.4Y~;}5-$ɟc(\xk#CRegB PaSD1%N3"Ipո (( tz~ t]3?rPW6O*=XXg-Bk 7+h48Jr6bGתs1=jwtpC(H̀iW%T$u>*gjyB_rڻB-DQ*N\((rI~WG.#\e{$08={C.<¯|\l,5y|Qj:|d|si&ɈW6J|e}ߜ _4ľ +i;Q6E* /sn[x} y5$iԍ$&DRu˯­b)P.,8kK 5NHFRƭe ofP@ d8!ꪠA6zjN**bn~@̭Kz$j28x扆j&8U/$GtGLs.ZMKɊ: Nz3],E+۽hM9REՎz9=Y`E26-[:ŁV>/*4᷻q"Cd2ypx k©?߶z:m3 1qbƙU[ROSOb`-D1,q'k(}@V>m 㹻yrjtH&-DV*bޢJ<^+5&@ZZSEnƱ4}4 BlX7 ~z!\^ ѭR f\GWA;N|aV|oM/'qlqL(4'lýKH MU]T? ϲ OR1 2VUԪC{Uo;j= X%?"{s`Ll%+ ò;VՍ^TޮY QKI`S,ꌌK0'ctDFDX'ƫ.24mHÀzgí>(&pGQq5LaBc|u4ӈ?渪Z*ٝꪆ'ɫOmj \WC>?\oG?d治 /Ǐw*x ;& 4EŎ _ 'r2]T'gSAf%FYL®gP/y zF.畻S2mp&adp \·@d!cv_yWi2w4Ї_O H\pѦ(p$P#ĚZmتU˛Hv2Ӓ%b@8QRU%<_E_e#lVy[hF*i4QWCe9++,PR@V,Øc~BFC5p߶xpURr;mP,>r׈Z5OJ26!N Sl1mNX(P"%,?fI2lcmjDHF%17Yȃ\bt0 #9cQoɍY1V+1O!@`n{[=~4=hH9(2W 5%:=]#ׄc"0xaP$3V* O'S]NoMF\rPS)fD1,UYۮ`}46)Lp,N dd!(VBe^_I}D9*1}0XJ$T81~VQ ;{SXm24jb #Q%}#MK ?P{H^Lx> u]n• in7Y)O|(ϒ+5"/?`xsuջz==k.EKDȐ ?O$۽ɮ_mi'v)~||&A}`hܒ;ǔ|p*~|P'pk#E{XK{Sjg+xuq-3YJy5Z M:ɡ]ic(!lWЬEKG|5frD 5Nur 2D1C!?bȪ8.XS\%mQ܏c!T{*YzyV ˯/=Y1 1X9X87\ ok,gmm= `|M s`h9lk3Q8 i6c*ɐ~,_rq^:_>%[_iGP ^ic -)8]"@Zi`TzI2B04h˿gcYQ}Q IoG 1tYoSiŽu OޚԍTʔExug.+,jLsmW٠v%(FVBi,"ʪmKEʃ{u:&"r R2-z/2$I52"N{v~6-5d)393k%,FE$SpNΎT^n3>j 9ROs?˞GRm}(Mk5 hG#hd4AW$WoOZw*#YPRK)mcW9!jj/s'ڐi$xĉ)(ONHʭW x 9o`.JZ)S/%W@Ȱ{$4 Ml/oG HXPBL@,ĜNfK@g{5* 9>B R)#RZ@NQ/AWW@!J%( 8<6~ K7DxP&VU XɫwT$թUDdX |>JT1z|4^>W:^bO<߸Ѩ$TlY Q*@,>3u)~.5O |[+Y!@RƨJ^۰:UsnRIY݅`1hvGUݛU|8(ɍD=r)H*hx__boD{M;72M{O5W#ʼnKsڷy]v%^Fy#'s@TxQ\2=;Qzs;@kp2Q`)k32%k{_T%oi*.EM !ܰrIJ _:c 4wwdT!X &רicm2r1Ney11M4Z% .@HI(IK8\ڻT7Ll:۷]E$8B+8-B~G$g8zi0BӹƇaӶo\=E]R DjqڅJ"K!j}&[w#zEx˖dA ,2&:~? jxZ_,[O*Y/ͶtX&PEG/=y*g|۾G0Om|X( D5T;z!TE@|~HՒI'Ń}뼺tI@\^^dAhyQ4i4QIe#bb4z DЎz_T6F&je{6HҐH +O |sA$f˹=qvje 7'BtU׿;\y_ R`@\H|z$ 7@r4klV]r LkP1f4N,-M;GWOMǨ{/jq}uB~}HHAlTp =\:'؂w=R&DJX"Xo;OoGVNFPBK"H<4聒w6K xk+'xWC.rڶ'C 4jC F?kuF=5'*jU1ii.=jx E `MŃk<=:i T!@*K݋'!$DUB`AiFHƹ>h bd%f@IҎ#$?܎-HI< AlEU릭? w T'IVC 3$%}:,~a ֋a_&d>ĕFQf!F8mKesУ"暐b7WWR8  ݇W旍hCS(*X5dī0W + ;jlZW eV'+lI&X笸O4YRo=f͒G`%?߃߁\Y˽=ذ%"@h߃ \Oӟ|:E4?͈ 'v98a8LL%2),>D9,%h}d~ =֎ťۈQR; .퉌(r;~F;i*S2*$On險\wm΂x1HAArTW/R5;jIbȒ+UP+aR͊8Ϡq;lG-;jEʆ0F\1`1.2|~mϴRj+2̊LZ*a1OU_~S۴^O %Fɒ#PȖ2 zUMߡ d p]TMi%G&J1@ҠYԌZO P;woC9P.2sP[`c%!}'^rx M$5-C0M7Gm`GHO%@`rQ[!C!ķغ-;.Mn(7sFqvTb=IuV>򤷜gܰo;<+D%˔)eA!9D8Q3;L=Tjtm^hJ\r +cY qDybYLN[r@X*[ڮb{Cu״KTD©Q ,0M7pݧqWQ/(+*JiW[ vP?|*Qʞq0lA# j V_p;Ksm$ⲩ?QM/YCI@B1eWԿy~ $蚃qv d aq$iH[vӚ@G ԂIIi T FW4Xݻ쯨E5X)q*H"*XcS ZQGYa$x$8ZW d&R8dDa:o`xN )2CXeE1!4xv !y6Y8'Hd& i@ Du?6n$h54-d`d#aQ$WKV|`Kv7SiMK8'PbJ88{V $~Tyѯ$^rdl،J}aLwfBH1yUbƜ;jmE3zr7@'7]NJ33RK!ڶ*D`=X*CY $..S<OXZfHΟ93-\R4zUSww7 ].F >("fyhb/"' ~8+g}g$&Liw X -H#ã+E*84?-I)%Ԋ˪i0 3ٷbIu*KBPq7oWeT'n{<|BќdUXD!*Ķ=n,0 )5zxD+֗;2qgKx)7K@!zʵZu[ YaߤE+E12HFS,VI7L+Z%C_Gٯ;@3%(Ȉ 3>(Ȝ֊(q>Y,({sU*s]tW㾞$XMUuڴH;]ĕZ ?D{l[?'2iv9bVuF\[21Ş>C}@Q$!ED8o9 >k+y0ҡ Gfu_!фӈXP%0eG,A [SQ'rwI]8UMdiX eIhA淶Z=`"-RqD$f Yk*qU^<1ͥR6uo}U/QBG oji>Yt`vլv :Z2 ~ bxNu4쟰=sn>JH*  V4| l%MM,DI߇Wg0OӼ{B1[5é|ĆjA:Re. 50(`9E s 7]_[8=ꢨc6WE<[o'+ꆯGZ9UhmJ0'ߠI{ Ɩ8 2b*e81 *\ e@ndI}N~CDF\IرȤL/p>Ta=maI3ə%PK::woxm=ѷ$/ ŀսQZtnޗwu=T}ܱ_*"uJ^ߘëE49 Fʂ6 dH(88T']I#ڽ_Lb 8TGW1P@4 Tx˱ʚ-G(JhM%EI` 䩜6;IBJ)sXs4cH%Lw߸ɍϴtlGuӴn d-19~ϨoS@eI[I")'P߬XӼ ,̓d#h!Q?1Ȫh(^zQ ;ƠfXaBG1`F )+3,lUV}?@k{T[LG(2bحQj5WTݥoSK4 Fcͳ *;f8Q ѿs*#d%h02Y#S Cd:MIRT_OvC|M7r} ;5I V:BN.C&6J$-hUNqi]ͦ="B!a`p>I>@4?\8~&4\1P +P  ~ b?Th!z=lP:#Tx%R_6/zR>6m\=?qI,EB\\ؼPbA\VxߪѣZqO,g#~h[5$\8|,tbW$ oz+3aMĕ +$=i0pT틠 Kd"!'9bT Nj$_peK.窩ej;J}~xU潂B^9Q2Ҁ` Չ(S<'^bOKP4(ĕ*1"+[ 5{iK%$U0(+誙V@z]Myt;6H0\j[iHn'92Ȁy8ϷȢ*M.xC$hJTpJM-"`9, 7[*~"uETu=E`#p"H0V0V=MJ /Q&#,+Q& U hHbvi8];@UŕX-uUk-]i݀vξhHGM%x2Pf_}@ յzH`ŧFӺY#:UT;y7oдw $J&8c*xp13niog>썶I$oӂ慱a B[xޘ+C%}v I$AAތ(Pdp\A VQhs#ew kͲY>AWU&XFjMjǶ[#v"3 eED*bX{A ~@Ӭm).9]'0¡XضN6k鐼lЈZMih`avQ!`)8TJ7GMyZ@9Ӑ-W`1rBK3t.5 cx݅ z\ӂ&8A&Tm#xYeΤxłΒr 6<:27,=>Y$L@Vi Hd-m'$rH^F T5z[%ԜvԾogq{O=&35GxaԳsGP"CǓF[< Uti;]q&t-7pM-)ԿW6M*(,澦-C ??qU͊g!q:p_*x֗mifTRnI)&H}  +(% ],m86ĿVeWK3F-?\1~ixo+2yeڤeJȭDL#}Y]yeV =/nuwTw z%Pu3bB,kB]0LtcDӳ}6]^tn}GǕ%M+Q"AhBdU*$y缻;Sn%T\P>ΏJq@R9즨Vd~מm:)#hiN.6 d>!L~S}tC,b?_Y!5* c]TOKC#șT>E%4/ KHU%3֟/>KRS jH#1LZ؜@-\FNЂIrX5Շ mL1 >Ct5ۏmf HDQeIuN ,H2M*0-ͷ>CVigTTQ*p4gB!v?c miqI=YNEQ!*B$C`tԘ]vnM-$4A|d,GbB>mOMfS3!N?,HExH3ϴimDqv Y]2+=+,ƀܐ.tQ64j}LcX(pgEDRr0*p󾱿_]Av$:2l\s(RU b7gBf6>vl!|e1M+8DquQ{rmĻ,QtY!TɄlZ[]QeA&-?0lnf"lR>⽱hiE°`Wx1_ӇO6Zf]=Fq_,1,gǂK(c& oQxaDs d*sP7Szc&Ҩ]+Fc .XHmفYK;3VS=yioLt%ҲJmh3˾FAa\vGRKI0uE5)!eLldPT ŋ^~@uUK[NGH>$:F-*Pޠ\څ4QGQ٤ xD!:q\C)4c*| 5Zwkۦ .^KV""%BhƟanz7ڷE)#!P60Me#+E~9DXҍcm++eOWV 芥M*3)>Mu:ⲍ𗄣uȳD գhjWr'UdWId$YJ-e /6>9>Ħ2joRU^*ɧnii̫JRT8o[YxR 9uۺ֞WRoHiu+,Êf`#b9p3tş~@'m!`+!'"!)|UR>.?z]_ym fqJj-t 36T,dŊ2r;oUu,7!J"6 />ɚ+;5=pj99->^*j/]1mO=0$\4 dP#p#`ݳY:wn~]mL*G#EVWV H˛{o?U(-1qYcys](*LqťkӜfR=?iݴ*J|G4Gm/~g) ɕ2ljrbUre @Vs^BYPϢyD$G$`$kB $ځ .=*>&NR+:GUMR p2FPFD_I_[t>b2NF~fnUdiF  *}sfhm,Wk,A&]֎"~C#{aF)V-D;bYV0՛QeHϹ`b&!6$ hH9bGZ\6D$">njD%ՏzFЎ9I SܧoȤܰ$`1!0{DPVCϋFRe$[wqCA G #0s^~CR4񶜗ɨS}6ΕԐJS0Qso3H,SFrȺ2l}W]8jL5zyO P5 Ψ3@ 8"ꅲAݛfpP tVIx,4YUQЕz!;^=]fFRJ;d!$c % \n.gר K ,FL!*YH++,AϷ8XFux =D,S)P\UQ_>ݛϥjtTWS 3~4u&WӄX1tH|LnϬaʊ߸ L>ЬBC%Zk~ ;軺mvR[?_'1IYA L ~{u % u #cR啤K=dHi%χz2H4hH@l~k@&#oMHQɕB-CS(.嘂Y*<%.9NeM3j{C]NgyԾP3,ACDxoJMLUvQxQ|ڼ!'A~VpmVWj3uE1,$2Z.~۷-ƻNdbHWNzq16'B.nZpHtzQG+vydʼn sH٪DME*n1u$@qA |g;_1Z]{&$T;tUU䀓\]uO-#%Zoْcj REv"UHeg>=@ÃSVSOT9?:Vi%$-d-9/\q"wA'1<@ِ5vȈJM6(oOєj o!NcTw{51h!`yřY(ŕ=VhE.,,s`"?ב.>UrY2\բ <*qj^?rDuGO+4!9QmSlD}^|OaЫp]s}'oUWy9޶}VG}dm lY <]~/zjjY,em5EmeWT_Y ]Q8ȻS*Q}uu+&qǁJڕ>e#Ц#Rq57{ѳ˯yZI= 1G]fѱE+QS]?Ey۔f^SBHi}@]XmsZh]?2wiF:µx*{hRRx2Ka_lȻAřE%x>8sDg[ HC$jvM2RO[ڬʄabi ,I?3bM# ON/=36{]J6 5+ySȉ$ٔ*ܴeDg(}VaOI.DR[ZX=6g0#QU?OOl{CSreG}3zJ`(Ɖ~["uؘ\,247c I<~%W"uM;.U9c-EcXE1%y$j]n^A ﻰPƪ# BQ*$ԊIiQi[\Dgaۑ@l4%A!U㎕MYXU='{o6k"ٯ9zt;lŲ I&1q-DgRl2STNm~}> Diuu'JAIf Oj DL(V'(Ĩɸj`**ʛV^_m7U7#(W ˊaIbՆ6!5Kښ=TLZAzn9OŪ,%ۓiuz1v[ +T6u\QrUcCr>2T$bt )ÆI!0Yv7+FH|V9Z-SYBnb`uZ(H aVHYQZ.O^w~~bhcݶM\Gn)xefY؍Š 1ջPzS׎Ikv7uuz'Tq +9R c ǖ!h;}G0#@4[D\PrW;ɨQ%ÞYYq1N8bȫVBORUoD\J}!XfȮA"2kUj ;Q{B*aCSFădR 2dT"?/Nt}߷ KC* V #TqÆQZt85N@_.QB&YD:\bh;XNOu%GRZ*]oMdL;E$N@# 1"]>(ȅ Ny3;oڽrh XQ,Y>),`*(-i-m[m[~H'[~T16fH#^-rǏ /*-;MચxMm݁=>5Z@HdžoF"SAsLzx\RbwekA&P:4.haQl@Uۓ.JV%V65^A84h>V}vHMXV }X`=Q(IY82ףcR;ԼJ RA`qf,8*9yW\UANTl!Gǒ(0-'!|ϟ^T+ݽDl ĀU*'nGƩqo|qvE_8D-_?O2k^I49ǎ(y⺡w^ʒSjbF[ ̓(7wi#ȬarIo㣁#N?1@#󸸌?opnڌEb?8礸FcA sӓ O!'QWt4Z*b>9g7 `Z Р?=Dm`I8fR5#? ۪@Ѵ~87ʑMu;fhȯQ-Ƞߞl>\t 4 ,DI-$P$9&]T.A\ٛadf#6~.L[vWH] i(LexS XBB- 2t?^I_tMS{@@sRG|8Ɲc"D!@aA n8^~+xP\C f6=<2$VRY_#nyjݾ~XzƮ YD_#iaBq1R \)Mw7WY1aOQILȨ6sz,jjp[w욡=@ 9 GOwG/JwvUF=B*琣OPzc7x|Kj}0l$S ?.$\HfƺJYB 7^ X眒(ܷ xYAɺ5b?iR) cu:9͑~9'E SG D=dqdvo|!eq\~xQH4AqPTW"Qvb)T!]Eb_CH薄Fj- ɧTVa_U X. WU>Ԍ%^MJe|Ԉ:},ϥgZ6rK* W$5Gjy;oY=I |xzj 0 ]q̟$O'=5BтBOCQ w#c,Q>IP,)I/#Gbdڇqi&MUUުÜ?iit?7<>+O Ο9+xlxQ ū"|s_oCH}H R0yvHQ$E8jn }FEI7~@M>8h_Pe*]o ҭ 1$i6 DSASaǰ ~-F HG[ǸR p)@ ꏷPNi6UYi4Ӕ TSzf!Xn]FoI¾nܰA gI,q fl ذսcoxvΣF̱% 34eH!T7d$)ڊi6RBM =B2,^Y ߢ%iڶ+ܔy"%bP+X9pm^`^{wYVCxI q!@Gǻd+/9bF<6 !]gO)Xݹhlp0)JG <:Zt4̩7_Ÿ˻l*;deb<&?!+JU(zZHok53ȓk0ʌrPHBBnb榧0w_4f}c ҈$rWxxdKDivND>A]?+ڑS]rRA~k9N+ ɿ6~8uHij ?#IXZw6SGi o* + ͋ E.y2X7%TT`⹊N#K)'gQ(& \|NjYa0_BMJ} Mb)Ӕ t(+1&i$ZZ^1xi9rq\Va`+iI&ԍUe2Y(ĜuE]!{32GV" d2fI# O癙a}5iG.2FS nT+2G90 jXi]. Co q]b#$\M MѱRWkdhhBЫfϝPdJP5L@htޠNŶc|{7r㏒%*l*9do%bPX}dY3ee5MfDPՐɉC0(Z~_ O'Tl驚P~FjL)*9Xڜ^% :-6èh(R؂IFԣ ;I%vJaSed(ͨ,JJbE:2{l)UfQ5_*ANiqdc r-"ʙxGϲ9&ȶ$q$KQZqHf@AE뒡#&8+ RXz0Ҟ TݙO;v-bm-= p^_$diT2MS3%kfyYg.꜒PF=ʀTN2NgPɦua yя rQչlz+ 0!Bo?\ >:2rAX bέDPʼcARmty#9`y.«o@k?ɨTYx4|U7;) O%'40@y"344$Lý6a1P `㒳su֚d n:^Q\1(YW D* p~m^DS@(/l VC%,ڵ$zV1 r>||/DϦ-)QQp22*̨ae/. J"'kKTb宇ǟon’eu٥6k.y+d!GXQB*7d5S E}&6hLnP8v_y8Ф-#iQr~ pqk@ Q_*qXqO+9pXRAbSW:f.#ӟFl$hSGCU &?ۃpӡd1RG6?$X# uC%?7|)t ,Gg Oj5t~ZZ9"x&_7sZXDY!yedh'M vN}"Y %|I d%#9PdP/WO_j).2E 6Gρj K4vbTM<:D _ Yj#UZYh~?n s٦fDwnYq`Jo܀7L.:FD*? ƍ2S6mi.G9tSǩ?Rd 2YP {R*,} I[bK΀Q)ʤ!C*6a[fK_.ZtuwDS. kEg-aYE^9hnsu,2RlIv)1~LۦF^/LIQL)oߦԧ7~yDj Ż{橖m\KqA7"$e`e$Y^%OoHM_9$U ͚P?m8UWqB$@#aS`9\\ 6xH X Iu-jBn) J6x᪻-OضZ-P? h cVOq4\"/Sv SJ/ Uj$ZnK3B,YYʅ}9$do'u+2vLŨY|"ohb_ZSL sqc,{X ^AFOT}u0†Y p\#2ItmxWlXHsåc,G,yO><׎C-7yskZMRK`q+1 yRNJ4:d.$uhT8i'{6j,$>hh,^zJOf7W%0zubT3H%Q>_RIg/}Y._/_}35XG!B}ơ~ K !Bťi~p̝-${[;g&p!uqԀLb} ͦ3]tR}ɹCGڃdtLi@UI>7zu]"qY$^*PIZ q%Jy~rxMCB62?xSaKF"K}i%hHMdlui q i@Tb{T1Ȝ,zMϸh7xchh3؆1}WTX#vgO>tH3~6љ4zi!t`)lO ָ%"\/13DCL \*Y'srj꣈Y"_͊=C>ә[S4ɯIIW n9: ?` qM|[ u:iUe@ όkdVva0S(@MY_'-&|UB%K]e4\a@P?_REIܝ5zNPņe81uER#jFOȈqZiHƎ)(R7s$ćsLtȾUqUM}gȶ0!BY-Ĥd*#.Q'Rk $m m*ǚQAs9N0G Kɾ*]#a|Q"_D4Tɤ=(B(c~I'dH;t::y#7&W`8l. sG[><_bn!qczJHDvIQıX`/Uǎ?5x) ?ȫG\1.Z~}ժO39Ũa (dQ%9}+414}l7Js#PH iJ:B__OK+C,r) H!WYUAbT'.O.Ȫie@(UMzbɦGm^ߤˀ9rn<6 r*وH$n-tRɍ]晴<?-‚|ߓ))qGX@qW͏-W:1GdO䄔p[ۡhUL|3(>b@ iM}Yؗ;m}s l䁐7SzVx-+n.\cKIw8>؅,B 7x QuɥBGt稺 ICrI!r? *e˻mL4tBG$ @΍ od|ǥΰjmf,GeV8A+`cR %rN:m5k\ eI6,@eR姓"[Mut: {hdAl$nX$A4򞼊S?#&TMf#n (Zʨa($ kl(gd۴8quI@3"DtzEx>(m ҙ{ BV"Ö,#Yi_5R~Z'gV%`5^o0ǟy~qC%SD=6>ߏ>lTvO!'ڡc[=Zeō{l}u|m ?G&KM,.ÒIr*) ʀ(!C 㶢ˡ N2أsFɍ@\OԉO1#^I%QqR_ e6$YTU:дP)1@?nCcfowڿxqMbal?@㣌8M7nT 7lY1Z覶2Ghhe1'DG [o퐕$gB@Wjİ$_. umg#f西$葛Ŧ+W#f&z$ @GI ^VU(|) P3cIJ}lɷÚرT$R>sB~oO }dp /}i$p |V+[(ϠZEn^7OQY b KlBG4}B548>,lGH;*Yr%CW|P-QM|$شR xO=G*Zi%@`;7j <qi$6I?u28;"ҩ"du^萂Iغ3; HR GZzk堾Zh;/KTͯ5422KlIvS2⾺*PJ869\>:>]hohaԞpQT4XBoANt߱|+]rk'{y4H˫Τ8İ +T$ޚcUsB#읷JM +&&  %|_d%}/>a2\QA_=..r{ز$(˃|tG??铜_Lvj2Jmr}řbs35iiF2W~ydAFC":dW@t ].@ t].@ t@@zڥ mJ/a=( WL$]??ߠ}Glg.]2 jeH&R:`hg=)5io0g/?[?Hf1b,N>x=%yfZJ':b!c26_$͏@I:K耓`܃].@ t].@ W1@ 1=A@' _@}fW/yz"m1t].@ _@@ 5`Oaz?g#ElO@lHzoeP=:_>z@aAcP@6`kg&JPWz>G@G1(5jJ:b¾z,8}!Hr$ߦb=!<ƾO:$p;6@s6􆎽!tW,BUttzU@@ɮt]j\23 c.4gIˢ(W#=b^:њt`HLr §㎁A ʟ7 CWr:N"Ȟs#SXlecT_'6G2_!#n5@='Lj1Ҁ16do(>O@_?Cd]"].@   Rb͞2 Y :V:W YtCs# t Ծ逳'I?=jA8^:b6AgQ(Etl$Sf:F@:`sit@SL ?=2 |ϩ?Ӡfz04|?Sz}_LR#c}1 Ǡf@џ:Rn4:$p`:jH.6@I)A9Y:@& 0#:`,GtV= 7/bO5@Ѷ"OPt23c;=# Y?1t+ =,V:``3@ W*UǦX8@tUk]*W@Ǡ@ r(^: (5m >z$ Ѩя!'NE?萃B`hB Bz$ _??dhn_c/!Fz$ tHhB ~IH@GtHAӅ}m鞁GHA@0D_D ϢB 3U萃 tHA/LPg'p! 2#͂t=/=d:C106@.t@ @ #@@t].@ t].@ t].@ t]. bt.@ t@tt]t]`js_of_ocaml-3.5.2/examples/separate_compilation/000077500000000000000000000000001357507750000220255ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/separate_compilation/dune000066400000000000000000000023151357507750000227040ustar00rootroot00000000000000(rule (targets main.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:main.bc} -o %{targets} --pretty))) (rule (targets module1.cmo module1.cmi) (action (run ocamlc -g -c %{dep:module1.ml}))) (rule (targets module2.cmo module2.cmi) (deps module1.cmi) (action (run ocamlc -g -c %{dep:module2.ml}))) (rule (targets module1.js) (action (run %{bin:js_of_ocaml} --noruntime --pretty --source-map %{dep:module1.cmo} -o %{targets}))) (rule (targets module2.js) (action (run %{bin:js_of_ocaml} --noruntime --pretty --source-map %{dep:module2.cmo} -o %{targets}))) (rule (targets stdlib.js) (action (run %{bin:js_of_ocaml} --noruntime --pretty --source-map %{lib:stdlib:stdlib.cma} -o %{targets}))) (rule (targets myruntime.js) (action (run %{bin:js_of_ocaml} --noruntime --pretty --source-map --runtime-only %{lib:js_of_ocaml-compiler:runtime.js} -o %{targets}))) (rule (targets bin.js) (action (run %{bin:jsoo_link} %{dep:myruntime.js} %{dep:stdlib.js} %{dep:module1.js} %{dep:module2.js} -o %{targets}))) (alias (name default) (deps myruntime.js stdlib.js module1.js module2.js bin.js index.html)) js_of_ocaml-3.5.2/examples/separate_compilation/index.html000066400000000000000000000011301357507750000240150ustar00rootroot00000000000000 Separate compilation js_of_ocaml-3.5.2/examples/separate_compilation/module1.ml000066400000000000000000000001161357507750000237230ustar00rootroot00000000000000let hello_string = "hello" let hello name = Printf.printf "hello %s!\n" name js_of_ocaml-3.5.2/examples/separate_compilation/module2.ml000066400000000000000000000001051357507750000237220ustar00rootroot00000000000000let () = try raise Not_found with Not_found -> Module1.hello "world" js_of_ocaml-3.5.2/examples/webgl/000077500000000000000000000000001357507750000167235ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/webgl/dune000066400000000000000000000006071357507750000176040ustar00rootroot00000000000000(executables (names webgldemo) (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx))) (rule (targets webgldemo.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:webgldemo.bc} -o %{targets} --pretty -I ./ --file %{dep:monkey.model}))) (alias (name default) (deps webgldemo.js index.html)) js_of_ocaml-3.5.2/examples/webgl/index.html000066400000000000000000000025641357507750000207270ustar00rootroot00000000000000 WebGL monkey
frames per second
js_of_ocaml-3.5.2/examples/webgl/monkey.model000066400000000000000000001612711357507750000212570ustar00rootroot00000000000000# Blender v2.61 (sub 0) OBJ File: '' # www.blender.org o Monkey v 0.436361 0.667417 -0.179002 v -0.438639 0.667417 -0.179002 v 0.498861 0.589292 -0.108690 v -0.501139 0.589292 -0.108690 v 0.545736 0.479917 -0.069627 v -0.548014 0.479917 -0.069627 v 0.350423 0.518980 0.008498 v -0.352702 0.518980 0.008498 v 0.350423 0.620542 -0.046190 v -0.352702 0.620542 -0.046190 v 0.350423 0.683042 -0.147752 v -0.352702 0.683042 -0.147752 v 0.272298 0.698667 -0.179002 v -0.274577 0.698667 -0.179002 v 0.201986 0.643980 -0.108690 v -0.204264 0.643980 -0.108690 v 0.155111 0.550230 -0.069627 v -0.157389 0.550230 -0.069627 v 0.076986 0.558042 -0.257127 v -0.079264 0.558042 -0.257127 v 0.139486 0.643980 -0.257127 v -0.141764 0.643980 -0.257127 v 0.241048 0.698667 -0.257127 v -0.243327 0.698667 -0.257127 v 0.272298 0.698667 -0.343065 v -0.274577 0.698667 -0.343065 v 0.201986 0.643980 -0.405565 v -0.204264 0.643980 -0.405565 v 0.155111 0.550230 -0.452440 v -0.157389 0.550230 -0.452440 v 0.350423 0.518980 -0.530565 v -0.352702 0.518980 -0.530565 v 0.350423 0.620542 -0.468065 v -0.352702 0.620542 -0.468065 v 0.350423 0.683042 -0.374315 v -0.352702 0.683042 -0.374315 v 0.436361 0.667417 -0.343065 v -0.438639 0.667417 -0.343065 v 0.498861 0.589292 -0.405565 v -0.501139 0.589292 -0.405565 v 0.545736 0.479917 -0.452440 v -0.548014 0.479917 -0.452440 v 0.623861 0.464292 -0.257127 v -0.626139 0.464292 -0.257127 v 0.561361 0.573667 -0.257127 v -0.563639 0.573667 -0.257127 v 0.467611 0.659605 -0.257127 v -0.469889 0.659605 -0.257127 v 0.475423 0.675230 -0.257127 v -0.477702 0.675230 -0.257127 v 0.444173 0.683042 -0.350877 v -0.446452 0.683042 -0.350877 v 0.350423 0.706480 -0.389940 v -0.352702 0.706480 -0.389940 v 0.264486 0.722105 -0.350877 v -0.266764 0.722105 -0.350877 v 0.225423 0.722105 -0.257127 v -0.227702 0.722105 -0.257127 v 0.264486 0.722105 -0.171190 v -0.266764 0.722105 -0.171190 v 0.350423 0.729917 -0.257127 v -0.352702 0.729917 -0.257127 v 0.350423 0.706480 -0.132127 v -0.352702 0.706480 -0.132127 v 0.444173 0.683042 -0.171190 v -0.446452 0.683042 -0.171190 v -0.001139 0.643980 -0.444627 v -0.001139 0.722105 -0.366502 v -0.001139 0.636167 0.664748 v -0.001139 0.683042 0.305373 v -0.001139 0.698667 0.172560 v -0.001139 0.620542 0.758498 v -0.001139 0.503355 -0.421190 v -0.001139 0.472105 -0.585252 v -0.001139 -0.645083 -0.913377 v -0.001139 -0.949770 -0.577440 v -0.001139 -0.926333 -0.085252 v -0.001139 -0.449770 0.367873 v 0.201986 0.464292 0.172560 v -0.204264 0.464292 0.172560 v 0.311361 0.472105 0.422560 v -0.313639 0.472105 0.422560 v 0.350423 0.472105 0.680373 v -0.352702 0.472105 0.680373 v 0.366048 0.433042 0.875685 v -0.368327 0.433042 0.875685 v 0.326986 0.425230 0.930373 v -0.329264 0.425230 0.930373 v 0.178548 0.456480 0.953810 v -0.180827 0.456480 0.953810 v -0.001139 0.479917 0.969435 v 0.436361 0.433042 0.125685 v -0.438639 0.433042 0.125685 v 0.631673 0.440855 0.024123 v -0.633952 0.440855 0.024123 v 0.826986 0.347105 -0.163377 v -0.829264 0.347105 -0.163377 v 0.858236 0.495542 -0.444627 v -0.860514 0.495542 -0.444627 v 0.709798 0.526792 -0.499315 v -0.712077 0.526792 -0.499315 v 0.491048 0.589292 -0.616502 v -0.493327 0.589292 -0.616502 v 0.319173 0.636167 -0.772752 v -0.321452 0.636167 -0.772752 v 0.155111 0.659605 -0.733690 v -0.157389 0.659605 -0.733690 v 0.061361 0.651792 -0.507127 v -0.063639 0.651792 -0.507127 v 0.162923 0.675230 -0.429002 v -0.165202 0.675230 -0.429002 v 0.123861 0.667417 -0.319627 v -0.126139 0.667417 -0.319627 v 0.201986 0.643980 -0.108690 v -0.204264 0.643980 -0.108690 v 0.373861 0.604917 -0.030565 v -0.376139 0.604917 -0.030565 v 0.491048 0.573667 -0.077440 v -0.493327 0.573667 -0.077440 v 0.623861 0.550230 -0.202440 v -0.626139 0.550230 -0.202440 v 0.639486 0.550230 -0.311815 v -0.641764 0.550230 -0.311815 v 0.600423 0.565855 -0.389940 v -0.602702 0.565855 -0.389940 v 0.428548 0.620542 -0.452440 v -0.430827 0.620542 -0.452440 v 0.248861 0.659605 -0.483690 v -0.251139 0.659605 -0.483690 v -0.001139 0.636167 0.750685 v 0.108236 0.636167 0.703810 v -0.110514 0.636167 0.703810 v 0.116048 0.612730 0.820998 v -0.118327 0.612730 0.820998 v 0.061361 0.597105 0.867873 v -0.063639 0.597105 0.867873 v -0.001139 0.589292 0.875685 v -0.001139 0.651792 0.180373 v -0.001139 0.643980 0.125685 v 0.100423 0.643980 0.133498 v -0.102702 0.643980 0.133498 v 0.123861 0.651792 0.211623 v -0.126139 0.651792 0.211623 v 0.084798 0.643980 0.274123 v -0.087077 0.643980 0.274123 v 0.397298 0.573667 0.031935 v -0.399577 0.573667 0.031935 v 0.616048 0.526792 -0.069627 v -0.618327 0.526792 -0.069627 v 0.725423 0.503355 -0.218065 v -0.727702 0.503355 -0.218065 v 0.741048 0.558042 -0.389940 v -0.743327 0.558042 -0.389940 v 0.686361 0.628355 -0.429002 v -0.688639 0.628355 -0.429002 v 0.436361 0.698667 -0.561815 v -0.438639 0.698667 -0.561815 v 0.311361 0.737730 -0.655565 v -0.313639 0.737730 -0.655565 v 0.201986 0.753355 -0.632127 v -0.204264 0.753355 -0.632127 v 0.100423 0.745542 -0.444627 v -0.102702 0.745542 -0.444627 v 0.123861 0.714292 0.086623 v -0.126139 0.714292 0.086623 v 0.209798 0.612730 0.430373 v -0.212077 0.612730 0.430373 v 0.248861 0.589292 0.688185 v -0.251139 0.589292 0.688185 v 0.264486 0.565855 0.805373 v -0.266764 0.565855 0.805373 v 0.233236 0.534605 0.899123 v -0.235514 0.534605 0.899123 v 0.162923 0.534605 0.914748 v -0.165202 0.534605 0.914748 v -0.001139 0.542417 0.930373 v -0.001139 0.628355 -0.061815 v -0.001139 0.667417 -0.225877 v 0.326986 0.643980 -0.491502 v -0.329264 0.643980 -0.491502 v 0.162923 0.651792 -0.155565 v -0.165202 0.651792 -0.155565 v 0.131673 0.659605 -0.225877 v -0.133952 0.659605 -0.225877 v 0.116048 0.636167 0.672560 v -0.118327 0.636167 0.672560 v 0.076986 0.651792 0.430373 v -0.079264 0.651792 0.430373 v -0.001139 0.651792 0.430373 v -0.001139 0.643980 0.313185 v 0.092611 0.683042 0.258498 v -0.094889 0.683042 0.258498 v 0.131673 0.698667 0.211623 v -0.133952 0.698667 0.211623 v 0.108236 0.683042 0.117873 v -0.110514 0.683042 0.117873 v 0.037923 0.683042 0.110060 v -0.040202 0.683042 0.110060 v -0.001139 0.729917 0.188185 v 0.045736 0.714292 0.133498 v -0.048014 0.714292 0.133498 v 0.092611 0.714292 0.141310 v -0.094889 0.714292 0.141310 v 0.108236 0.729917 0.211623 v -0.110514 0.729917 0.211623 v 0.076986 0.706480 0.235060 v -0.079264 0.706480 0.235060 v -0.001139 0.706480 0.274123 v 0.256673 0.456480 0.297560 v -0.258952 0.456480 0.297560 v 0.162923 0.612730 0.227248 v -0.165202 0.612730 0.227248 v 0.178548 0.612730 0.297560 v -0.180827 0.612730 0.297560 v 0.233236 0.456480 0.235060 v -0.235514 0.456480 0.235060 v -0.001139 0.589292 0.860060 v 0.045736 0.589292 0.852248 v -0.048014 0.589292 0.852248 v 0.092611 0.612730 0.805373 v -0.094889 0.612730 0.805373 v 0.092611 0.628355 0.727248 v -0.094889 0.628355 0.727248 v -0.001139 0.558042 0.766310 v 0.092611 0.565855 0.735060 v -0.094889 0.565855 0.735060 v 0.092611 0.542417 0.797560 v -0.094889 0.542417 0.797560 v 0.045736 0.534605 0.836623 v -0.048014 0.534605 0.836623 v -0.001139 0.534605 0.844435 v 0.170736 0.683042 -0.233690 v -0.173014 0.683042 -0.233690 v 0.186361 0.675230 -0.171190 v -0.188639 0.675230 -0.171190 v 0.334798 0.659605 -0.444627 v -0.337077 0.659605 -0.444627 v 0.272298 0.675230 -0.436815 v -0.274577 0.675230 -0.436815 v 0.420736 0.675230 -0.413377 v -0.423014 0.675230 -0.413377 v 0.561361 0.597105 -0.366502 v -0.563639 0.597105 -0.366502 v 0.584798 0.589292 -0.304002 v -0.587077 0.589292 -0.304002 v 0.576986 0.581480 -0.210252 v -0.579264 0.581480 -0.210252 v 0.475423 0.620542 -0.116502 v -0.477702 0.620542 -0.116502 v 0.373861 0.643980 -0.077440 v -0.376139 0.643980 -0.077440 v 0.225423 0.683042 -0.124315 v -0.227702 0.683042 -0.124315 v 0.178548 0.683042 -0.311815 v -0.180827 0.683042 -0.311815 v 0.209798 0.683042 -0.389940 v -0.212077 0.683042 -0.389940 v 0.233236 0.659605 -0.374315 v -0.235514 0.659605 -0.374315 v 0.194173 0.659605 -0.311815 v -0.196452 0.659605 -0.311815 v 0.241048 0.659605 -0.139940 v -0.243327 0.659605 -0.139940 v 0.373861 0.628355 -0.100877 v -0.376139 0.628355 -0.100877 v 0.459798 0.604917 -0.132127 v -0.462077 0.604917 -0.132127 v 0.545736 0.573667 -0.225877 v -0.548014 0.573667 -0.225877 v 0.553548 0.573667 -0.296190 v -0.555827 0.573667 -0.296190 v 0.530111 0.581480 -0.350877 v -0.532389 0.581480 -0.350877 v 0.412923 0.651792 -0.405565 v -0.415202 0.651792 -0.405565 v 0.280111 0.667417 -0.413377 v -0.282389 0.667417 -0.413377 v 0.334798 0.651792 -0.421190 v -0.337077 0.651792 -0.421190 v 0.201986 0.651792 -0.186815 v -0.204264 0.651792 -0.186815 v 0.194173 0.651792 -0.241502 v -0.196452 0.651792 -0.241502 v 0.108236 0.511167 -0.475877 v -0.110514 0.511167 -0.475877 v 0.194173 0.518980 -0.679002 v -0.196452 0.518980 -0.679002 v 0.334798 0.495542 -0.702440 v -0.337077 0.495542 -0.702440 v 0.483236 0.456480 -0.569627 v -0.485514 0.456480 -0.569627 v 0.678548 0.393980 -0.468065 v -0.680827 0.393980 -0.468065 v 0.795736 0.362730 -0.421190 v -0.798014 0.362730 -0.421190 v 0.772298 0.276792 -0.179002 v -0.774577 0.276792 -0.179002 v 0.600423 0.315855 -0.014940 v -0.602702 0.315855 -0.014940 v 0.436361 0.370542 0.078810 v -0.438639 0.370542 0.078810 v -0.001139 0.190855 -0.913377 v -0.001139 -0.176333 -0.999315 v -0.001139 -0.770083 0.180373 v -0.001139 0.089292 0.445998 v -0.001139 0.362730 0.961623 v -0.001139 0.245542 0.789748 v -0.001139 0.222105 0.555373 v -0.001139 0.183042 0.469435 v 0.850423 -0.043520 -0.249315 v -0.852702 -0.043520 -0.249315 v 0.858236 -0.145083 -0.335252 v -0.860514 -0.145083 -0.335252 v 0.772298 -0.535708 -0.280565 v -0.774577 -0.535708 -0.280565 v 0.459798 -0.801333 -0.452440 v -0.462077 -0.801333 -0.452440 v 0.733236 -0.027895 0.031935 v -0.735514 -0.027895 0.031935 v 0.592611 -0.262270 0.110060 v -0.594889 -0.262270 0.110060 v 0.639486 -0.527895 -0.007127 v -0.641764 -0.527895 -0.007127 v 0.334798 -0.762270 -0.069627 v -0.337077 -0.762270 -0.069627 v 0.233236 0.308042 0.336623 v -0.235514 0.308042 0.336623 v 0.178548 0.159605 0.399123 v -0.180827 0.159605 0.399123 v 0.287923 0.284605 0.695998 v -0.290202 0.284605 0.695998 v 0.248861 0.292417 0.485060 v -0.251139 0.292417 0.485060 v 0.326986 0.300230 0.899123 v -0.329264 0.300230 0.899123 v 0.139486 0.268980 0.742873 v -0.141764 0.268980 0.742873 v 0.123861 0.261167 0.524123 v -0.126139 0.261167 0.524123 v 0.162923 0.339292 0.930373 v -0.165202 0.339292 0.930373 v 0.217611 0.331480 0.266310 v -0.219889 0.331480 0.266310 v 0.209798 0.370542 0.211623 v -0.212077 0.370542 0.211623 v 0.201986 0.401792 0.156935 v -0.204264 0.401792 0.156935 v 0.209798 0.065855 0.375685 v -0.212077 0.065855 0.375685 v 0.295736 -0.363833 0.297560 v -0.298014 -0.363833 0.297560 v 0.342611 -0.637270 0.133498 v -0.344889 -0.637270 0.133498 v 0.451986 -0.481020 -0.882127 v -0.454264 -0.481020 -0.882127 v 0.451986 -0.168520 -0.944627 v -0.454264 -0.168520 -0.944627 v 0.451986 0.136167 -0.866502 v -0.454264 0.136167 -0.866502 v 0.459798 0.331480 -0.538377 v -0.462077 0.331480 -0.538377 v 0.725423 0.237730 -0.421190 v -0.727702 0.237730 -0.421190 v 0.631673 0.183042 -0.468065 v -0.633952 0.183042 -0.468065 v 0.639486 -0.043520 -0.718065 v -0.641764 -0.043520 -0.718065 v 0.795736 0.026792 -0.577440 v -0.798014 0.026792 -0.577440 v 0.795736 -0.215395 -0.632127 v -0.798014 -0.215395 -0.632127 v 0.639486 -0.293520 -0.764940 v -0.641764 -0.293520 -0.764940 v 0.639486 -0.543520 -0.694627 v -0.641764 -0.543520 -0.694627 v 0.795736 -0.457583 -0.554002 v -0.798014 -0.457583 -0.554002 v 0.616048 -0.684145 -0.343065 v -0.618327 -0.684145 -0.343065 v 0.483236 -0.645083 -0.038377 v -0.485514 -0.645083 -0.038377 v 0.819173 -0.301333 -0.343065 v -0.821452 -0.301333 -0.343065 v 0.405111 0.050230 0.156935 v -0.407389 0.050230 0.156935 v 0.428548 -0.309145 0.180373 v -0.430827 -0.309145 0.180373 v 0.889486 -0.332583 -0.421190 v -0.891764 -0.332583 -0.421190 v 0.772298 -0.223208 0.125685 v -0.774577 -0.223208 0.125685 v 1.037923 -0.426333 0.086623 v -1.040202 -0.426333 0.086623 v 1.280111 -0.527895 -0.069627 v -1.282389 -0.527895 -0.069627 v 1.350423 -0.520083 -0.335252 v -1.352702 -0.520083 -0.335252 v 1.233236 -0.520083 -0.522752 v -1.235514 -0.520083 -0.522752 v 1.022298 -0.410708 -0.491502 v -1.024577 -0.410708 -0.491502 v 1.014486 -0.387270 -0.429002 v -1.016764 -0.387270 -0.429002 v 1.186361 -0.488833 -0.452440 v -1.188639 -0.488833 -0.452440 v 1.264486 -0.504458 -0.304002 v -1.266764 -0.504458 -0.304002 v 1.209798 -0.504458 -0.093065 v -1.212077 -0.504458 -0.093065 v 1.030111 -0.402895 0.024123 v -1.032389 -0.402895 0.024123 v 0.826986 -0.231020 0.055373 v -0.829264 -0.231020 0.055373 v 0.920736 -0.316958 -0.374315 v -0.923014 -0.316958 -0.374315 v 0.944173 -0.387270 -0.319627 v -0.946452 -0.387270 -0.319627 v 0.881673 -0.309145 0.008498 v -0.883952 -0.309145 0.008498 v 1.037923 -0.465395 -0.014940 v -1.040202 -0.465395 -0.014940 v 1.186361 -0.543520 -0.108690 v -1.188639 -0.543520 -0.108690 v 1.233236 -0.543520 -0.264940 v -1.235514 -0.543520 -0.264940 v 1.170736 -0.535708 -0.374315 v -1.173014 -0.535708 -0.374315 v 1.022298 -0.457583 -0.358690 v -1.024577 -0.457583 -0.358690 v 0.842611 -0.309145 -0.304002 v -0.844889 -0.309145 -0.304002 v 0.834798 -0.371645 -0.186815 v -0.837077 -0.371645 -0.186815 v 0.756673 -0.371645 -0.108690 v -0.758952 -0.371645 -0.108690 v 0.819173 -0.371645 -0.100877 v -0.821452 -0.371645 -0.100877 v 0.842611 -0.371645 -0.030565 v -0.844889 -0.371645 -0.030565 v 0.811361 -0.371645 0.000685 v -0.813639 -0.371645 0.000685 v 0.725423 -0.168520 -0.014940 v -0.727702 -0.168520 -0.014940 v 0.717611 -0.270083 0.008498 v -0.719889 -0.270083 0.008498 v 0.717611 -0.285708 -0.054002 v -0.719889 -0.285708 -0.054002 v 0.795736 -0.309145 -0.218065 v -0.798014 -0.309145 -0.218065 v 0.889486 -0.363833 -0.257127 v -0.891764 -0.363833 -0.257127 v 0.889486 -0.418520 -0.249315 v -0.891764 -0.418520 -0.249315 v 0.811361 -0.418520 0.000685 v -0.813639 -0.418520 0.000685 v 0.850423 -0.418520 -0.030565 v -0.852702 -0.418520 -0.030565 v 0.826986 -0.418520 -0.093065 v -0.829264 -0.418520 -0.093065 v 0.764486 -0.418520 -0.108690 v -0.766764 -0.418520 -0.108690 v 0.842611 -0.418520 -0.186815 v -0.844889 -0.418520 -0.186815 v 1.037923 -0.512270 -0.343065 v -1.040202 -0.512270 -0.343065 v 1.186361 -0.582583 -0.358690 v -1.188639 -0.582583 -0.358690 v 1.256673 -0.590395 -0.257127 v -1.258952 -0.590395 -0.257127 v 1.209798 -0.582583 -0.100877 v -1.212077 -0.582583 -0.100877 v 1.045736 -0.520083 -0.014940 v -1.048014 -0.520083 -0.014940 v 0.881673 -0.363833 0.000685 v -0.883952 -0.363833 0.000685 v 0.951986 -0.441958 -0.304002 v -0.954264 -0.441958 -0.304002 v 0.889486 -0.426333 -0.124315 v -0.891764 -0.426333 -0.124315 v 0.936361 -0.434145 -0.077440 v -0.938639 -0.434145 -0.077440 v 0.998861 -0.465395 -0.139940 v -1.001139 -0.465395 -0.139940 v 0.959798 -0.449770 -0.186815 v -0.962077 -0.449770 -0.186815 v 1.014486 -0.473208 -0.249315 v -1.016764 -0.473208 -0.249315 v 1.053548 -0.481020 -0.202440 v -1.055827 -0.481020 -0.202440 v 1.108236 -0.488833 -0.225877 v -1.110514 -0.488833 -0.225877 v 1.084798 -0.488833 -0.288377 v -1.087077 -0.488833 -0.288377 v 1.022298 -0.582583 -0.452440 v -1.024577 -0.582583 -0.452440 v 1.248861 -0.645083 -0.483690 v -1.251139 -0.645083 -0.483690 v 1.366048 -0.598208 -0.311815 v -1.368327 -0.598208 -0.311815 v 1.311361 -0.629458 -0.069627 v -1.313639 -0.629458 -0.069627 v 1.037923 -0.590395 0.070998 v -1.040202 -0.590395 0.070998 v 0.787923 -0.426333 0.110060 v -0.790202 -0.426333 0.110060 v 0.858236 -0.481020 -0.397752 v -0.860514 -0.481020 -0.397752 vn 0.664993 0.719363 0.200752 vn -0.664993 0.719363 0.200752 vn 0.829427 0.468924 0.303581 vn -0.829427 0.468924 0.303581 vn 0.415548 0.444931 0.793320 vn -0.415548 0.444931 0.793320 vn 0.359950 0.781960 0.508895 vn -0.359950 0.781960 0.508895 vn -0.078666 0.838353 0.539423 vn 0.078666 0.838353 0.539423 vn -0.269627 0.468532 0.841296 vn 0.269627 0.468532 0.841296 vn -0.770656 0.541966 0.335204 vn 0.770656 0.541966 0.335204 vn -0.468941 0.861650 0.194045 vn 0.468941 0.861650 0.194045 vn -0.476731 0.858116 -0.190693 vn 0.476731 0.858116 -0.190693 vn -0.767202 0.552142 -0.326404 vn 0.767202 0.552142 -0.326404 vn -0.251927 0.518169 -0.817333 vn 0.251927 0.518169 -0.817333 vn -0.094933 0.816423 -0.569597 vn 0.094933 0.816423 -0.569597 vn 0.366742 0.759680 -0.537015 vn -0.366742 0.759680 -0.537015 vn 0.414055 0.489830 -0.767219 vn -0.414055 0.489830 -0.767219 vn 0.827747 0.477141 -0.295247 vn -0.827747 0.477141 -0.295247 vn 0.671345 0.714459 -0.197092 vn -0.671345 0.714459 -0.197092 vn 0.811107 -0.486664 -0.324443 vn -0.811107 -0.486664 -0.324443 vn 0.205152 -0.533396 -0.820610 vn -0.205152 -0.533396 -0.820610 vn -0.422314 -0.460706 -0.780641 vn 0.422314 -0.460706 -0.780641 vn -0.824061 -0.465773 -0.322458 vn 0.824061 -0.465773 -0.322458 vn -0.813733 -0.464991 0.348743 vn 0.813733 -0.464991 0.348743 vn -0.422314 -0.460706 0.780641 vn 0.422314 -0.460706 0.780641 vn 0.205152 -0.533396 0.820610 vn -0.205152 -0.533396 0.820610 vn 0.799477 -0.487486 0.350990 vn -0.799477 -0.487486 0.350990 vn 0.400039 0.914375 0.062344 vn -0.400039 0.914375 0.062344 vn 0.306938 0.935429 0.175393 vn -0.306938 0.935429 0.175393 vn 0.094512 0.978473 0.183464 vn -0.094512 0.978473 0.183464 vn -0.062353 0.997652 0.028342 vn 0.062353 0.997652 0.028342 vn -0.062357 0.997716 -0.025982 vn 0.062357 0.997716 -0.025982 vn 0.099561 0.979891 -0.172922 vn -0.099561 0.979891 -0.172922 vn 0.303571 0.938310 -0.165584 vn -0.303571 0.938310 -0.165584 vn 0.400163 0.914659 -0.057166 vn -0.400163 0.914659 -0.057166 vn 0.123091 0.492366 0.861641 vn -0.123091 0.492366 0.861641 vn 0.218986 0.452010 0.864715 vn -0.218986 0.452010 0.864715 vn 0.590198 0.666788 0.455038 vn -0.590198 0.666788 0.455038 vn 0.768894 0.637372 0.050585 vn -0.768894 0.637372 0.050585 vn 0.779649 0.619721 -0.089960 vn -0.779649 0.619721 -0.089960 vn 0.324141 0.473874 0.818765 vn -0.324141 0.473874 0.818765 vn 0.385730 0.641707 0.662891 vn -0.385730 0.641707 0.662891 vn 0.689468 0.590607 0.419306 vn -0.689468 0.590607 0.419306 vn 0.658751 0.658751 0.363449 vn -0.658751 0.658751 0.363449 vn 0.546548 0.750910 -0.370702 vn -0.546548 0.750910 -0.370702 vn 0.506447 0.570645 -0.646433 vn -0.506447 0.570645 -0.646433 vn 0.609244 0.601532 -0.516701 vn -0.609244 0.601532 -0.516701 vn -0.044065 0.749110 -0.660979 vn 0.044065 0.749110 -0.660979 vn -0.724614 0.611014 -0.318742 vn 0.724614 0.611014 -0.318742 vn -0.588034 0.588034 -0.555366 vn 0.588034 0.588034 -0.555366 vn 0.536054 0.748241 0.390872 vn -0.536054 0.748241 0.390872 vn 0.220695 0.855193 0.468977 vn -0.220695 0.855193 0.468977 vn -0.079395 0.842940 0.532117 vn 0.079395 0.842940 0.532117 vn -0.082465 0.748963 0.657461 vn 0.082465 0.748963 0.657461 vn 0.045703 0.822647 0.566712 vn -0.045703 0.822647 0.566712 vn 0.278428 0.936532 0.213040 vn -0.278428 0.936532 0.213040 vn 0.381303 0.906285 0.182362 vn -0.381303 0.906285 0.182362 vn 0.335744 0.896916 0.287781 vn -0.335744 0.896916 0.287781 vn 0.376240 0.924559 -0.060276 vn -0.376240 0.924559 -0.060276 vn -0.135216 0.953890 -0.267974 vn 0.135216 0.953890 -0.267974 vn 0.396091 0.810186 0.432099 vn -0.396091 0.810186 0.432099 vn 0.185557 0.950977 0.247409 vn -0.185557 0.950977 0.247409 vn 0.009907 0.980786 0.194836 vn -0.009907 0.980786 0.194836 vn 0.072066 0.713795 0.696637 vn -0.072066 0.713795 0.696637 vn 0.186336 0.798582 0.572317 vn -0.186336 0.798582 0.572317 vn 0.315685 0.909388 0.270843 vn -0.315685 0.909388 0.270843 vn 0.306302 0.951566 0.026481 vn -0.306302 0.951566 0.026481 vn 0.326550 0.936111 0.130620 vn -0.326550 0.936111 0.130620 vn -0.013675 0.998256 -0.057434 vn 0.013675 0.998256 -0.057434 vn -0.002626 0.997839 0.065647 vn 0.002626 0.997839 0.065647 vn 0.000000 1.000000 -0.000000 vn 0.817393 -0.044183 0.574384 vn -0.817393 -0.044183 0.574384 vn 0.949363 -0.214372 -0.229685 vn -0.949363 -0.214372 -0.229685 vn 0.082479 -0.412393 -0.907265 vn -0.082479 -0.412393 -0.907265 vn -0.883624 0.304698 -0.355481 vn 0.883624 0.304698 -0.355481 vn 0.420706 0.221827 0.879659 vn -0.420706 0.221827 0.879659 vn 0.287348 0.766261 0.574696 vn -0.287348 0.766261 0.574696 vn -0.654224 0.457957 -0.601886 vn 0.654224 0.457957 -0.601886 vn 0.105227 0.605054 -0.789201 vn -0.105227 0.605054 -0.789201 vn 0.758175 0.583212 -0.291606 vn -0.758175 0.583212 -0.291606 vn 0.388922 0.583383 0.713024 vn -0.388922 0.583383 0.713024 vn 0.046274 0.971764 -0.231372 vn -0.046274 0.971764 -0.231372 vn 0.033480 0.915131 0.401765 vn -0.033480 0.915131 0.401765 vn -0.445163 0.880854 0.161016 vn 0.445163 0.880854 0.161016 vn -0.218218 0.872872 0.436436 vn 0.218218 0.872872 0.436436 vn 0.434064 0.891591 0.129046 vn -0.434064 0.891591 0.129046 vn 0.300753 0.952384 -0.050125 vn -0.300753 0.952384 -0.050125 vn 0.812285 0.499568 -0.301039 vn -0.812285 0.499568 -0.301039 vn 0.875310 0.409336 -0.257444 vn -0.875310 0.409336 -0.257444 vn 0.938484 0.305959 -0.160113 vn -0.938484 0.305959 -0.160113 vn 0.223706 0.722743 0.653910 vn -0.223706 0.722743 0.653910 vn -0.153610 0.967743 0.199693 vn 0.153610 0.967743 0.199693 vn -0.273275 0.956462 0.102478 vn 0.273275 0.956462 0.102478 vn -0.097590 0.975900 -0.195180 vn 0.097590 0.975900 -0.195180 vn -0.158235 0.271260 -0.949410 vn 0.158235 0.271260 -0.949410 vn -0.693430 0.132784 -0.708183 vn 0.693430 0.132784 -0.708183 vn -1.000000 0.000000 0.000000 vn 1.000000 0.000000 0.000000 vn 0.305141 0.118119 0.944953 vn -0.305141 0.118119 0.944953 vn 0.029814 0.954056 0.298142 vn -0.029814 0.954056 0.298142 vn 0.135293 0.927720 0.347895 vn -0.135293 0.927720 0.347895 vn -0.508542 0.815786 0.275460 vn 0.508542 0.815786 0.275460 vn -0.384277 0.922265 0.041921 vn 0.384277 0.922265 0.041921 vn -0.208288 0.977353 -0.037385 vn 0.208288 0.977353 -0.037385 vn -0.572078 0.667424 0.476731 vn 0.572078 0.667424 0.476731 vn -0.136922 0.643534 0.753071 vn 0.136922 0.643534 0.753071 vn 0.408843 0.681405 0.607070 vn -0.408843 0.681405 0.607070 vn 0.574030 0.707038 0.413022 vn -0.574030 0.707038 0.413022 vn 0.566534 0.818328 0.096843 vn -0.566534 0.818328 0.096843 vn 0.570336 0.812892 -0.118000 vn -0.570336 0.812892 -0.118000 vn 0.482289 0.671879 -0.562117 vn -0.482289 0.671879 -0.562117 vn 0.260407 0.747255 -0.611390 vn -0.260407 0.747255 -0.611390 vn 0.163956 0.918156 -0.360704 vn -0.163956 0.918156 -0.360704 vn -0.017820 0.968216 -0.249479 vn 0.017820 0.968216 -0.249479 vn 0.327339 0.848105 0.416613 vn -0.327339 0.848105 0.416613 vn 0.281070 0.923516 0.260994 vn -0.281070 0.923516 0.260994 vn -0.254193 0.714916 0.651368 vn 0.254193 0.714916 0.651368 vn -0.026016 0.533323 0.845512 vn 0.026016 0.533323 0.845512 vn -0.351808 0.899066 0.260599 vn 0.351808 0.899066 0.260599 vn -0.352308 0.935819 0.011010 vn 0.352308 0.935819 0.011010 vn -0.131654 0.877691 -0.460788 vn 0.131654 0.877691 -0.460788 vn -0.034219 0.787044 -0.615947 vn 0.034219 0.787044 -0.615947 vn 0.360263 0.727731 -0.583625 vn -0.360263 0.727731 -0.583625 vn 0.498784 0.685828 -0.529958 vn -0.498784 0.685828 -0.529958 vn 0.666667 0.666667 0.333333 vn -0.666667 0.666667 0.333333 vn 0.816466 0.572745 0.073116 vn -0.816466 0.572745 0.073116 vn 0.784010 0.609785 -0.116150 vn -0.784010 0.609785 -0.116150 vn -0.530629 -0.246147 -0.811076 vn 0.530629 -0.246147 -0.811076 vn -0.851109 -0.372958 -0.369480 vn 0.851109 -0.372958 -0.369480 vn -0.244586 -0.433121 -0.867516 vn 0.244586 -0.433121 -0.867516 vn 0.592382 -0.303006 -0.746506 vn -0.592382 -0.303006 -0.746506 vn 0.368548 -0.311777 -0.875767 vn -0.368548 -0.311777 -0.875767 vn 0.282140 -0.287988 -0.915128 vn -0.282140 -0.287988 -0.915128 vn 0.856131 -0.499077 -0.134021 vn -0.856131 -0.499077 -0.134021 vn 0.534226 -0.437577 0.723276 vn -0.534226 -0.437577 0.723276 vn 0.384903 -0.436800 0.813053 vn -0.384903 -0.436800 0.813053 vn 0.233519 -0.780017 0.580553 vn -0.233519 -0.780017 0.580553 vn 0.244866 -0.967802 0.058301 vn -0.244866 -0.967802 0.058301 vn 0.116271 -0.883661 0.453458 vn -0.116271 -0.883661 0.453458 vn 0.115196 -0.138826 0.983594 vn -0.115196 -0.138826 0.983594 vn 0.118366 -0.225972 0.966916 vn -0.118366 -0.225972 0.966916 vn 0.959736 -0.280774 0.008508 vn -0.959736 -0.280774 0.008508 vn 0.931868 -0.324194 -0.162851 vn -0.931868 -0.324194 -0.162851 vn 0.162606 -0.986474 -0.020695 vn -0.162606 -0.986474 -0.020695 vn -0.018766 -0.975838 0.217687 vn 0.018766 -0.975838 0.217687 vn 0.753776 -0.588391 0.292605 vn -0.753776 -0.588391 0.292605 vn 0.919601 -0.367840 -0.137940 vn -0.919601 -0.367840 -0.137940 vn 0.929736 -0.194399 -0.312729 vn -0.929736 -0.194399 -0.312729 vn 0.912018 -0.232856 -0.337641 vn -0.912018 -0.232856 -0.337641 vn 0.940691 -0.060690 -0.333793 vn -0.940691 -0.060690 -0.333793 vn 0.176090 -0.440225 0.880451 vn -0.176090 -0.440225 0.880451 vn 0.370784 -0.799083 0.473270 vn -0.370784 -0.799083 0.473270 vn 0.310668 -0.466002 0.828449 vn -0.310668 -0.466002 0.828449 vn 0.279339 -0.128692 0.951529 vn -0.279339 -0.128692 0.951529 vn 0.313873 -0.180715 0.932108 vn -0.313873 -0.180715 0.932108 vn 0.976161 -0.060864 0.208341 vn -0.976161 -0.060864 0.208341 vn 0.826725 0.244727 0.506592 vn -0.826725 0.244727 0.506592 vn 0.344853 -0.931486 0.115800 vn -0.344853 -0.931486 0.115800 vn 0.120261 0.235495 -0.964406 vn -0.120261 0.235495 -0.964406 vn 0.127513 -0.185137 -0.974405 vn -0.127513 -0.185137 -0.974405 vn 0.349226 -0.724138 -0.594697 vn -0.349226 -0.724138 -0.594697 vn 0.415251 -0.144855 -0.898100 vn -0.415251 -0.144855 -0.898100 vn 0.184540 0.686258 -0.703559 vn -0.184540 0.686258 -0.703559 vn 0.605564 0.160824 -0.779377 vn -0.605564 0.160824 -0.779377 vn 0.703301 -0.205264 -0.680614 vn -0.703301 -0.205264 -0.680614 vn 0.667944 -0.716631 -0.200725 vn -0.667944 -0.716631 -0.200725 vn 0.494774 -0.752756 -0.434231 vn -0.494774 -0.752756 -0.434231 vn 0.642323 -0.176121 -0.745924 vn -0.642323 -0.176121 -0.745924 vn 0.718225 0.152966 -0.678788 vn -0.718225 0.152966 -0.678788 vn 0.738828 0.544366 -0.397240 vn -0.738828 0.544366 -0.397240 vn 0.342771 -0.157888 -0.926056 vn -0.342771 -0.157888 -0.926056 vn 0.226983 0.786746 -0.574030 vn -0.226983 0.786746 -0.574030 vn -0.172189 -0.979491 -0.104638 vn 0.172189 -0.979491 -0.104638 vn 0.042460 0.401319 -0.914954 vn -0.042460 0.401319 -0.914954 vn -0.161572 0.969432 -0.184654 vn 0.161572 0.969432 -0.184654 vn 0.979149 0.048332 -0.197308 vn -0.979149 0.048332 -0.197308 vn 0.946968 0.307922 -0.091845 vn -0.946968 0.307922 -0.091845 vn 0.979450 -0.066136 -0.190536 vn -0.979450 -0.066136 -0.190536 vn 0.993775 -0.106953 -0.031195 vn -0.993775 -0.106953 -0.031195 vn 0.711563 0.050060 0.700836 vn -0.711563 0.050060 0.700836 vn 0.372160 0.084651 0.924300 vn -0.372160 0.084651 0.924300 vn 0.446529 0.231010 0.864434 vn -0.446529 0.231010 0.864434 vn 0.606579 0.240489 0.757778 vn -0.606579 0.240489 0.757778 vn 0.732489 0.240675 0.636817 vn -0.732489 0.240675 0.636817 vn 0.263732 0.853252 0.449896 vn -0.263732 0.853252 0.449896 vn 0.556817 -0.767332 0.318051 vn -0.556817 -0.767332 0.318051 vn 0.500431 -0.818999 0.280730 vn -0.500431 -0.818999 0.280730 vn 0.318954 -0.420485 0.849389 vn -0.318954 -0.420485 0.849389 vn 0.719759 -0.279303 0.635561 vn -0.719759 -0.279303 0.635561 vn 0.497205 -0.747333 0.440774 vn -0.497205 -0.747333 0.440774 vn 0.350559 0.855666 -0.380715 vn -0.350559 0.855666 -0.380715 vn 0.456551 0.873015 -0.171485 vn -0.456551 0.873015 -0.171485 vn 0.258262 0.960298 -0.105487 vn -0.258262 0.960298 -0.105487 vn 0.245528 0.966063 0.080238 vn -0.245528 0.966063 0.080238 vn 0.464292 0.883654 0.059909 vn -0.464292 0.883654 0.059909 vn 0.622461 0.720981 0.304514 vn -0.622462 0.720981 0.304514 vn 0.450020 0.602706 -0.658959 vn -0.450021 0.602706 -0.658959 vn -0.266664 0.488415 -0.830868 vn 0.266664 0.488415 -0.830868 vn -0.828395 0.511137 -0.229130 vn 0.828395 0.511137 -0.229130 vn -0.525061 0.772732 0.356645 vn 0.525061 0.772732 0.356645 vn 0.454637 0.687284 0.566521 vn -0.454637 0.687284 0.566521 vn 0.699600 0.555239 0.449743 vn -0.699601 0.555238 0.449743 vn 0.722010 -0.112644 0.682652 vn -0.722010 -0.112644 0.682652 vn -0.191904 0.938824 -0.285975 vn 0.191904 0.938824 -0.285975 vn 0.904808 -0.204748 0.373365 vn -0.904808 -0.204748 0.373365 vn 0.103418 0.982467 -0.155126 vn -0.103418 0.982467 -0.155126 vn 0.084056 0.353037 -0.931826 vn -0.084056 0.353037 -0.931826 vn 0.644606 0.759399 0.088302 vn -0.644606 0.759399 0.088302 vn 0.430935 0.767848 -0.474029 vn -0.430935 0.767848 -0.474029 vn 0.803235 0.346222 0.484711 vn -0.803235 0.346222 0.484711 vn 0.581122 0.701353 0.412797 vn -0.581122 0.701353 0.412797 vn 0.591001 0.682205 0.430482 vn -0.591001 0.682205 0.430482 vn 0.981815 -0.059145 0.180394 vn -0.981815 -0.059145 0.180394 vn 0.910486 -0.117482 0.396502 vn -0.910486 -0.117482 0.396502 vn 0.997202 -0.072524 0.018131 vn -0.997202 -0.072524 0.018131 vn 0.731310 0.192450 0.654330 vn -0.731310 0.192450 0.654330 vn 0.786718 0.107280 0.607919 vn -0.786718 0.107280 0.607919 vn 0.702247 0.117041 0.702247 vn -0.702247 0.117041 0.702247 vn 0.184048 -0.051124 -0.981587 vn -0.184048 -0.051124 -0.981587 vn 0.935190 0.128359 -0.330067 vn -0.935190 0.128359 -0.330067 vn 0.663348 0.055279 0.746267 vn -0.663348 0.055279 0.746267 vn -0.008522 0.076694 -0.997018 vn 0.008522 0.076694 -0.997018 vn 0.623691 0.335381 0.706066 vn -0.623692 0.335381 0.706065 vn 0.273312 0.358722 0.892535 vn -0.273312 0.358722 0.892535 vn -0.832769 -0.219977 0.508041 vn 0.832769 -0.219977 0.508041 vn -0.833909 -0.498081 -0.237721 vn 0.833909 -0.498081 -0.237721 vn -0.565464 -0.253882 -0.784726 vn 0.565464 -0.253882 -0.784726 vn -0.055965 0.067158 -0.996172 vn 0.055965 0.067158 -0.996172 vn 0.144498 0.989255 -0.022230 vn -0.144498 0.989255 -0.022230 vn 0.327452 0.942664 -0.064498 vn -0.327452 0.942664 -0.064498 vn 0.312667 0.949580 -0.023160 vn -0.312667 0.949580 -0.023160 vn 0.170988 0.984893 -0.027358 vn -0.170988 0.984893 -0.027358 vn 0.348658 0.892906 -0.284879 vn -0.348659 0.892906 -0.284879 vn 0.400582 0.915617 0.034336 vn -0.400583 0.915617 0.034336 vn 0.257194 0.964478 0.060280 vn -0.257194 0.964478 0.060280 vn 0.063697 0.997913 0.010616 vn -0.063697 0.997913 0.010616 vn -0.363700 0.610078 -0.703936 vn 0.363700 0.610078 -0.703936 vn 0.629882 0.775881 -0.035457 vn -0.629882 0.775881 -0.035457 vn 0.447210 0.871726 0.200243 vn -0.447210 0.871726 0.200243 vn 0.507163 0.834843 0.214062 vn -0.507163 0.834843 0.214062 vn 0.525823 0.809259 -0.261934 vn -0.525823 0.809259 -0.261934 vn 0.297964 0.757979 -0.580246 vn -0.297964 0.757979 -0.580246 vn 0.093038 -0.080501 0.992403 vn -0.093038 -0.080501 0.992403 vn 0.500580 0.007971 0.865653 vn -0.500580 0.007971 0.865653 vn 0.928516 0.274791 0.249696 vn -0.928516 0.274791 0.249696 vn 0.839260 -0.037780 -0.542416 vn -0.839260 -0.037780 -0.542416 vn -0.235534 -0.258908 -0.936744 vn 0.235534 -0.258908 -0.936744 vn -0.449919 -0.128548 -0.883769 vn 0.449919 -0.128548 -0.883769 vn -0.538363 -0.842656 0.009753 vn 0.538364 -0.842656 0.009753 vn -0.191040 -0.981286 0.024097 vn 0.191040 -0.981286 0.024097 vn 0.404624 -0.914097 -0.026581 vn -0.404624 -0.914097 -0.026581 vn -0.781868 0.019678 -0.623133 vn 0.781868 0.019678 -0.623133 vn 0.542773 -0.814160 0.206254 vn -0.542773 -0.814160 0.206254 vn -0.247398 -0.294522 0.923066 vn 0.247398 -0.294522 0.923066 s off f 47//1 1//1 3//1 f 47//1 3//1 45//1 f 4//2 2//2 48//2 f 4//2 48//2 46//2 f 45//3 3//3 5//3 f 45//3 5//3 43//3 f 6//4 4//4 46//4 f 6//4 46//4 44//4 f 3//5 9//5 7//5 f 3//5 7//5 5//5 f 8//6 10//6 4//6 f 8//6 4//6 6//6 f 1//7 11//7 9//7 f 1//7 9//7 3//7 f 10//8 12//8 2//8 f 10//8 2//8 4//8 f 11//9 13//9 15//9 f 11//9 15//9 9//9 f 16//10 14//10 12//10 f 16//10 12//10 10//10 f 9//11 15//11 17//11 f 9//11 17//11 7//11 f 18//12 16//12 10//12 f 18//12 10//12 8//12 f 15//13 21//13 19//13 f 15//13 19//13 17//13 f 20//14 22//14 16//14 f 20//14 16//14 18//14 f 13//15 23//15 21//15 f 13//15 21//15 15//15 f 22//16 24//16 14//16 f 22//16 14//16 16//16 f 23//17 25//17 27//17 f 23//17 27//17 21//17 f 28//18 26//18 24//18 f 28//18 24//18 22//18 f 21//19 27//19 29//19 f 21//19 29//19 19//19 f 30//20 28//20 22//20 f 30//20 22//20 20//20 f 27//21 33//21 31//21 f 27//21 31//21 29//21 f 32//22 34//22 28//22 f 32//22 28//22 30//22 f 25//23 35//23 33//23 f 25//23 33//23 27//23 f 34//24 36//24 26//24 f 34//24 26//24 28//24 f 35//25 37//25 39//25 f 35//25 39//25 33//25 f 40//26 38//26 36//26 f 40//26 36//26 34//26 f 33//27 39//27 41//27 f 33//27 41//27 31//27 f 42//28 40//28 34//28 f 42//28 34//28 32//28 f 39//29 45//29 43//29 f 39//29 43//29 41//29 f 44//30 46//30 40//30 f 44//30 40//30 42//30 f 37//31 47//31 45//31 f 37//31 45//31 39//31 f 46//32 48//32 38//32 f 46//32 38//32 40//32 f 47//33 37//33 51//33 f 47//33 51//33 49//33 f 52//34 38//34 48//34 f 52//34 48//34 50//34 f 37//35 35//35 53//35 f 37//35 53//35 51//35 f 54//36 36//36 38//36 f 54//36 38//36 52//36 f 35//37 25//37 55//37 f 35//37 55//37 53//37 f 56//38 26//38 36//38 f 56//38 36//38 54//38 f 25//39 23//39 57//39 f 25//39 57//39 55//39 f 58//40 24//40 26//40 f 58//40 26//40 56//40 f 23//41 13//41 59//41 f 23//41 59//41 57//41 f 60//42 14//42 24//42 f 60//42 24//42 58//42 f 13//43 11//43 63//43 f 13//43 63//43 59//43 f 64//44 12//44 14//44 f 64//44 14//44 60//44 f 11//45 1//45 65//45 f 11//45 65//45 63//45 f 66//46 2//46 12//46 f 66//46 12//46 64//46 f 1//47 47//47 49//47 f 1//47 49//47 65//47 f 50//48 48//48 2//48 f 50//48 2//48 66//48 f 61//49 65//49 49//49 f 50//50 66//50 62//50 f 63//51 65//51 61//51 f 62//52 66//52 64//52 f 61//53 59//53 63//53 f 64//54 60//54 62//54 f 61//55 57//55 59//55 f 60//56 58//56 62//56 f 61//57 55//57 57//57 f 58//58 56//58 62//58 f 61//59 53//59 55//59 f 56//60 54//60 62//60 f 61//61 51//61 53//61 f 54//62 52//62 62//62 f 61//63 49//63 51//63 f 52//64 50//64 62//64 f 89//65 174//65 176//65 f 89//65 176//65 91//65 f 176//66 175//66 90//66 f 176//66 90//66 91//66 f 87//67 172//67 174//67 f 87//67 174//67 89//67 f 175//68 173//68 88//68 f 175//68 88//68 90//68 f 85//69 170//69 172//69 f 85//69 172//69 87//69 f 173//70 171//70 86//70 f 173//70 86//70 88//70 f 83//71 168//71 170//71 f 83//71 170//71 85//71 f 171//72 169//72 84//72 f 171//72 84//72 86//72 f 81//73 166//73 168//73 f 81//73 168//73 83//73 f 169//74 167//74 82//74 f 169//74 82//74 84//74 f 79//75 92//75 146//75 f 79//75 146//75 164//75 f 147//76 93//76 80//76 f 147//76 80//76 165//76 f 92//77 94//77 148//77 f 92//77 148//77 146//77 f 149//78 95//78 93//78 f 149//78 93//78 147//78 f 94//79 96//79 150//79 f 94//79 150//79 148//79 f 151//80 97//80 95//80 f 151//80 95//80 149//80 f 96//81 98//81 152//81 f 96//81 152//81 150//81 f 153//82 99//82 97//82 f 153//82 97//82 151//82 f 98//83 100//83 154//83 f 98//83 154//83 152//83 f 155//84 101//84 99//84 f 155//84 99//84 153//84 f 100//85 102//85 156//85 f 100//85 156//85 154//85 f 157//86 103//86 101//86 f 157//86 101//86 155//86 f 102//87 104//87 158//87 f 102//87 158//87 156//87 f 159//88 105//88 103//88 f 159//88 103//88 157//88 f 104//89 106//89 160//89 f 104//89 160//89 158//89 f 161//90 107//90 105//90 f 161//90 105//90 159//90 f 106//91 108//91 162//91 f 106//91 162//91 160//91 f 163//92 109//92 107//92 f 163//92 107//92 161//92 f 108//93 67//93 68//93 f 108//93 68//93 162//93 f 68//94 67//94 109//94 f 68//94 109//94 163//94 f 110//95 128//95 160//95 f 110//95 160//95 162//95 f 161//96 129//96 111//96 f 161//96 111//96 163//96 f 128//97 179//97 158//97 f 128//97 158//97 160//97 f 159//98 180//98 129//98 f 159//98 129//98 161//98 f 126//99 156//99 158//99 f 126//99 158//99 179//99 f 159//100 157//100 127//100 f 159//100 127//100 180//100 f 124//101 154//101 156//101 f 124//101 156//101 126//101 f 157//102 155//102 125//102 f 157//102 125//102 127//102 f 122//103 152//103 154//103 f 122//103 154//103 124//103 f 155//104 153//104 123//104 f 155//104 123//104 125//104 f 120//105 150//105 152//105 f 120//105 152//105 122//105 f 153//106 151//106 121//106 f 153//106 121//106 123//106 f 118//107 148//107 150//107 f 118//107 150//107 120//107 f 151//108 149//108 119//108 f 151//108 119//108 121//108 f 116//109 146//109 148//109 f 116//109 148//109 118//109 f 149//110 147//110 117//110 f 149//110 117//110 119//110 f 114//111 164//111 146//111 f 114//111 146//111 116//111 f 147//112 165//112 115//112 f 147//112 115//112 117//112 f 114//113 181//113 177//113 f 114//113 177//113 164//113 f 177//114 182//114 115//114 f 177//114 115//114 165//114 f 110//115 162//115 68//115 f 110//115 68//115 112//115 f 68//116 163//116 111//116 f 68//116 111//116 113//116 f 112//117 68//117 178//117 f 112//117 178//117 183//117 f 178//118 68//118 113//118 f 178//118 113//118 184//118 f 177//119 181//119 183//119 f 177//119 183//119 178//119 f 184//120 182//120 177//120 f 184//120 177//120 178//120 f 135//121 137//121 176//121 f 135//121 176//121 174//121 f 176//122 137//122 136//122 f 176//122 136//122 175//122 f 133//123 135//123 174//123 f 133//123 174//123 172//123 f 175//124 136//124 134//124 f 175//124 134//124 173//124 f 131//125 133//125 172//125 f 131//125 172//125 170//125 f 173//126 134//126 132//126 f 173//126 132//126 171//126 f 166//127 187//127 185//127 f 166//127 185//127 168//127 f 186//128 188//128 167//128 f 186//128 167//128 169//128 f 131//129 170//129 168//129 f 131//129 168//129 185//129 f 169//130 171//130 132//130 f 169//130 132//130 186//130 f 144//131 190//131 189//131 f 144//131 189//131 187//131 f 189//132 190//132 145//132 f 189//132 145//132 188//132 f 185//133 187//133 189//133 f 185//133 189//133 69//133 f 189//134 188//134 186//134 f 189//134 186//134 69//134 f 130//135 131//135 185//135 f 130//135 185//135 69//135 f 186//135 132//135 130//135 f 186//135 130//135 69//135 f 142//136 193//136 191//136 f 142//136 191//136 144//136 f 192//137 194//137 143//137 f 192//137 143//137 145//137 f 140//138 195//138 193//138 f 140//138 193//138 142//138 f 194//139 196//139 141//139 f 194//139 141//139 143//139 f 139//140 197//140 195//140 f 139//140 195//140 140//140 f 196//141 198//141 139//141 f 196//141 139//141 141//141 f 138//142 71//142 197//142 f 138//142 197//142 139//142 f 198//143 71//143 138//143 f 198//143 138//143 139//143 f 190//144 144//144 191//144 f 190//144 191//144 70//144 f 192//145 145//145 190//145 f 192//145 190//145 70//145 f 70//146 191//146 206//146 f 70//146 206//146 208//146 f 207//147 192//147 70//147 f 207//147 70//147 208//147 f 71//148 199//148 200//148 f 71//148 200//148 197//148 f 201//149 199//149 71//149 f 201//149 71//149 198//149 f 197//150 200//150 202//150 f 197//150 202//150 195//150 f 203//151 201//151 198//151 f 203//151 198//151 196//151 f 195//152 202//152 204//152 f 195//152 204//152 193//152 f 205//153 203//153 196//153 f 205//153 196//153 194//153 f 193//154 204//154 206//154 f 193//154 206//154 191//154 f 207//155 205//155 194//155 f 207//155 194//155 192//155 f 199//156 204//156 202//156 f 199//156 202//156 200//156 f 203//157 205//157 199//157 f 203//157 199//157 201//157 f 199//158 208//158 206//158 f 199//158 206//158 204//158 f 207//159 208//159 199//159 f 207//159 199//159 205//159 f 139//160 140//160 164//160 f 139//160 164//160 177//160 f 165//161 141//161 139//161 f 165//161 139//161 177//161 f 140//162 142//162 211//162 f 140//162 211//162 164//162 f 212//163 143//163 141//163 f 212//163 141//163 165//163 f 142//164 144//164 213//164 f 142//164 213//164 211//164 f 214//165 145//165 143//165 f 214//165 143//165 212//165 f 144//166 187//166 166//166 f 144//166 166//166 213//166 f 167//167 188//167 145//167 f 167//167 145//167 214//167 f 81//168 209//168 213//168 f 81//168 213//168 166//168 f 214//169 210//169 82//169 f 214//169 82//169 167//169 f 209//170 215//170 211//170 f 209//170 211//170 213//170 f 212//171 216//171 210//171 f 212//171 210//171 214//171 f 79//172 164//172 211//172 f 79//172 211//172 215//172 f 212//173 165//173 80//173 f 212//173 80//173 216//173 f 131//174 130//174 72//174 f 131//174 72//174 222//174 f 72//175 130//175 132//175 f 72//175 132//175 223//175 f 133//176 131//176 222//176 f 133//176 222//176 220//176 f 223//177 132//177 134//177 f 223//177 134//177 221//177 f 135//178 133//178 220//178 f 135//178 220//178 218//178 f 221//179 134//179 136//179 f 221//179 136//179 219//179 f 137//180 135//180 218//180 f 137//180 218//180 217//180 f 219//181 136//181 137//181 f 219//181 137//181 217//181 f 217//182 218//182 229//182 f 217//182 229//182 231//182 f 230//183 219//183 217//183 f 230//183 217//183 231//183 f 218//184 220//184 227//184 f 218//184 227//184 229//184 f 228//185 221//185 219//185 f 228//185 219//185 230//185 f 220//186 222//186 225//186 f 220//186 225//186 227//186 f 226//187 223//187 221//187 f 226//187 221//187 228//187 f 222//188 72//188 224//188 f 222//188 224//188 225//188 f 224//189 72//189 223//189 f 224//189 223//189 226//189 f 224//190 231//190 229//190 f 224//190 229//190 225//190 f 230//191 231//191 224//191 f 230//191 224//191 226//191 f 225//192 229//192 227//192 f 228//193 230//193 226//193 f 183//194 181//194 234//194 f 183//194 234//194 232//194 f 235//195 182//195 184//195 f 235//195 184//195 233//195 f 112//196 183//196 232//196 f 112//196 232//196 254//196 f 233//197 184//197 113//197 f 233//197 113//197 255//197 f 110//198 112//198 254//198 f 110//198 254//198 256//198 f 255//199 113//199 111//199 f 255//199 111//199 257//199 f 181//200 114//200 252//200 f 181//200 252//200 234//200 f 253//201 115//201 182//201 f 253//201 182//201 235//201 f 114//202 116//202 250//202 f 114//202 250//202 252//202 f 251//203 117//203 115//203 f 251//203 115//203 253//203 f 116//204 118//204 248//204 f 116//204 248//204 250//204 f 249//205 119//205 117//205 f 249//205 117//205 251//205 f 118//206 120//206 246//206 f 118//206 246//206 248//206 f 247//207 121//207 119//207 f 247//207 119//207 249//207 f 120//208 122//208 244//208 f 120//208 244//208 246//208 f 245//209 123//209 121//209 f 245//209 121//209 247//209 f 122//210 124//210 242//210 f 122//210 242//210 244//210 f 243//211 125//211 123//211 f 243//211 123//211 245//211 f 124//212 126//212 240//212 f 124//212 240//212 242//212 f 241//213 127//213 125//213 f 241//213 125//213 243//213 f 126//214 179//214 236//214 f 126//214 236//214 240//214 f 237//215 180//215 127//215 f 237//215 127//215 241//215 f 179//216 128//216 238//216 f 179//216 238//216 236//216 f 239//217 129//217 180//217 f 239//217 180//217 237//217 f 128//218 110//218 256//218 f 128//218 256//218 238//218 f 257//219 111//219 129//219 f 257//219 129//219 239//219 f 238//220 256//220 258//220 f 238//220 258//220 276//220 f 259//221 257//221 239//221 f 259//221 239//221 277//221 f 236//222 238//222 276//222 f 236//222 276//222 278//222 f 277//223 239//223 237//223 f 277//223 237//223 279//223 f 240//224 236//224 278//224 f 240//224 278//224 274//224 f 279//225 237//225 241//225 f 279//225 241//225 275//225 f 242//226 240//226 274//226 f 242//226 274//226 272//226 f 275//227 241//227 243//227 f 275//227 243//227 273//227 f 244//228 242//228 272//228 f 244//228 272//228 270//228 f 273//229 243//229 245//229 f 273//229 245//229 271//229 f 246//230 244//230 270//230 f 246//230 270//230 268//230 f 271//231 245//231 247//231 f 271//231 247//231 269//231 f 248//232 246//232 268//232 f 248//232 268//232 266//232 f 269//233 247//233 249//233 f 269//233 249//233 267//233 f 250//234 248//234 266//234 f 250//234 266//234 264//234 f 267//235 249//235 251//235 f 267//235 251//235 265//235 f 252//236 250//236 264//236 f 252//236 264//236 262//236 f 265//237 251//237 253//237 f 265//237 253//237 263//237 f 234//238 252//238 262//238 f 234//238 262//238 280//238 f 263//239 253//239 235//239 f 263//239 235//239 281//239 f 256//240 254//240 260//240 f 256//240 260//240 258//240 f 261//241 255//241 257//241 f 261//241 257//241 259//241 f 254//242 232//242 282//242 f 254//242 282//242 260//242 f 283//243 233//243 255//243 f 283//243 255//243 261//243 f 232//244 234//244 280//244 f 232//244 280//244 282//244 f 281//245 235//245 233//245 f 281//245 233//245 283//245 f 67//246 108//246 284//246 f 67//246 284//246 73//246 f 285//247 109//247 67//247 f 285//247 67//247 73//247 f 108//248 106//248 286//248 f 108//248 286//248 284//248 f 287//249 107//249 109//249 f 287//249 109//249 285//249 f 106//250 104//250 288//250 f 106//250 288//250 286//250 f 289//251 105//251 107//251 f 289//251 107//251 287//251 f 104//252 102//252 290//252 f 104//252 290//252 288//252 f 291//253 103//253 105//253 f 291//253 105//253 289//253 f 102//254 100//254 292//254 f 102//254 292//254 290//254 f 293//255 101//255 103//255 f 293//255 103//255 291//255 f 100//256 98//256 294//256 f 100//256 294//256 292//256 f 295//257 99//257 101//257 f 295//257 101//257 293//257 f 98//258 96//258 296//258 f 98//258 296//258 294//258 f 297//259 97//259 99//259 f 297//259 99//259 295//259 f 96//260 94//260 298//260 f 96//260 298//260 296//260 f 299//261 95//261 97//261 f 299//261 97//261 297//261 f 94//262 92//262 300//262 f 94//262 300//262 298//262 f 301//263 93//263 95//263 f 301//263 95//263 299//263 f 308//264 309//264 328//264 f 308//264 328//264 338//264 f 329//265 309//265 308//265 f 329//265 308//265 339//265 f 307//266 308//266 338//266 f 307//266 338//266 336//266 f 339//267 308//267 307//267 f 339//267 307//267 337//267 f 306//268 307//268 336//268 f 306//268 336//268 340//268 f 337//269 307//269 306//269 f 337//269 306//269 341//269 f 89//270 91//270 306//270 f 89//270 306//270 340//270 f 306//271 91//271 90//271 f 306//271 90//271 341//271 f 87//272 89//272 340//272 f 87//272 340//272 334//272 f 341//273 90//273 88//273 f 341//273 88//273 335//273 f 85//274 87//274 334//274 f 85//274 334//274 330//274 f 335//275 88//275 86//275 f 335//275 86//275 331//275 f 83//276 85//276 330//276 f 83//276 330//276 332//276 f 331//277 86//277 84//277 f 331//277 84//277 333//277 f 330//278 336//278 338//278 f 330//278 338//278 332//278 f 339//279 337//279 331//279 f 339//279 331//279 333//279 f 330//280 334//280 340//280 f 330//280 340//280 336//280 f 341//281 335//281 331//281 f 341//281 331//281 337//281 f 326//282 332//282 338//282 f 326//282 338//282 328//282 f 339//283 333//283 327//283 f 339//283 327//283 329//283 f 81//284 83//284 332//284 f 81//284 332//284 326//284 f 333//285 84//285 82//285 f 333//285 82//285 327//285 f 209//286 342//286 344//286 f 209//286 344//286 215//286 f 345//287 343//287 210//287 f 345//287 210//287 216//287 f 81//288 326//288 342//288 f 81//288 342//288 209//288 f 343//289 327//289 82//289 f 343//289 82//289 210//289 f 79//290 215//290 344//290 f 79//290 344//290 346//290 f 345//291 216//291 80//291 f 345//291 80//291 347//291 f 79//292 346//292 300//292 f 79//292 300//292 92//292 f 301//293 347//293 80//293 f 301//293 80//293 93//293 f 77//294 324//294 352//294 f 77//294 352//294 304//294 f 353//295 325//295 77//295 f 353//295 77//295 304//295 f 304//296 352//296 350//296 f 304//296 350//296 78//296 f 351//297 353//297 304//297 f 351//297 304//297 78//297 f 78//298 350//298 348//298 f 78//298 348//298 305//298 f 349//299 351//299 78//299 f 349//299 78//299 305//299 f 305//300 348//300 328//300 f 305//300 328//300 309//300 f 329//301 349//301 305//301 f 329//301 305//301 309//301 f 326//302 328//302 348//302 f 326//302 348//302 342//302 f 349//303 329//303 327//303 f 349//303 327//303 343//303 f 296//304 298//304 318//304 f 296//304 318//304 310//304 f 319//305 299//305 297//305 f 319//305 297//305 311//305 f 76//306 316//306 324//306 f 76//306 324//306 77//306 f 325//307 317//307 76//307 f 325//307 76//307 77//307 f 302//308 358//308 356//308 f 302//308 356//308 303//308 f 357//309 359//309 302//309 f 357//309 302//309 303//309 f 303//310 356//310 354//310 f 303//310 354//310 75//310 f 355//311 357//311 303//311 f 355//311 303//311 75//311 f 75//312 354//312 316//312 f 75//312 316//312 76//312 f 317//313 355//313 75//313 f 317//313 75//313 76//313 f 292//314 294//314 362//314 f 292//314 362//314 364//314 f 363//315 295//315 293//315 f 363//315 293//315 365//315 f 364//316 362//316 368//316 f 364//316 368//316 366//316 f 369//317 363//317 365//317 f 369//317 365//317 367//317 f 366//318 368//318 370//318 f 366//318 370//318 372//318 f 371//319 369//319 367//319 f 371//319 367//319 373//319 f 372//320 370//320 376//320 f 372//320 376//320 374//320 f 377//321 371//321 373//321 f 377//321 373//321 375//321 f 314//322 378//322 374//322 f 314//322 374//322 376//322 f 375//323 379//323 315//323 f 375//323 315//323 377//323 f 316//324 354//324 374//324 f 316//324 374//324 378//324 f 375//325 355//325 317//325 f 375//325 317//325 379//325 f 354//326 356//326 372//326 f 354//326 372//326 374//326 f 373//327 357//327 355//327 f 373//327 355//327 375//327 f 356//328 358//328 366//328 f 356//328 366//328 372//328 f 367//329 359//329 357//329 f 367//329 357//329 373//329 f 358//330 360//330 364//330 f 358//330 364//330 366//330 f 365//331 361//331 359//331 f 365//331 359//331 367//331 f 290//332 292//332 364//332 f 290//332 364//332 360//332 f 365//333 293//333 291//333 f 365//333 291//333 361//333 f 74//334 360//334 358//334 f 74//334 358//334 302//334 f 359//335 361//335 74//335 f 359//335 74//335 302//335 f 284//336 286//336 288//336 f 284//336 288//336 290//336 f 289//337 287//337 285//337 f 289//337 285//337 291//337 f 284//338 290//338 360//338 f 284//338 360//338 74//338 f 361//339 291//339 285//339 f 361//339 285//339 74//339 f 73//340 284//340 74//340 f 74//341 285//341 73//341 f 294//342 296//342 310//342 f 294//342 310//342 362//342 f 311//343 297//343 295//343 f 311//343 295//343 363//343 f 310//344 312//344 368//344 f 310//344 368//344 362//344 f 369//345 313//345 311//345 f 369//345 311//345 363//345 f 312//346 382//346 370//346 f 312//346 370//346 368//346 f 371//347 383//347 313//347 f 371//347 313//347 369//347 f 314//348 376//348 370//348 f 314//348 370//348 382//348 f 371//349 377//349 315//349 f 371//349 315//349 383//349 f 348//350 350//350 386//350 f 348//350 386//350 384//350 f 387//351 351//351 349//351 f 387//351 349//351 385//351 f 318//352 384//352 386//352 f 318//352 386//352 320//352 f 387//353 385//353 319//353 f 387//353 319//353 321//353 f 298//354 300//354 384//354 f 298//354 384//354 318//354 f 385//355 301//355 299//355 f 385//355 299//355 319//355 f 300//356 344//356 342//356 f 300//356 342//356 384//356 f 343//357 345//357 301//357 f 343//357 301//357 385//357 f 342//358 348//358 384//358 f 385//359 349//359 343//359 f 300//360 346//360 344//360 f 345//361 347//361 301//361 f 314//362 322//362 380//362 f 314//362 380//362 378//362 f 381//363 323//363 315//363 f 381//363 315//363 379//363 f 316//364 378//364 380//364 f 316//364 380//364 324//364 f 381//365 379//365 317//365 f 381//365 317//365 325//365 f 320//366 386//366 380//366 f 320//366 380//366 322//366 f 381//367 387//367 321//367 f 381//367 321//367 323//367 f 350//368 352//368 380//368 f 350//368 380//368 386//368 f 381//369 353//369 351//369 f 381//369 351//369 387//369 f 324//370 380//370 352//370 f 353//371 381//371 325//371 f 400//372 388//372 414//372 f 400//372 414//372 402//372 f 415//373 389//373 401//373 f 415//373 401//373 403//373 f 400//374 402//374 404//374 f 400//374 404//374 398//374 f 405//375 403//375 401//375 f 405//375 401//375 399//375 f 398//376 404//376 406//376 f 398//376 406//376 396//376 f 407//377 405//377 399//377 f 407//377 399//377 397//377 f 396//378 406//378 408//378 f 396//378 408//378 394//378 f 409//379 407//379 397//379 f 409//379 397//379 395//379 f 394//380 408//380 410//380 f 394//380 410//380 392//380 f 411//381 409//381 395//381 f 411//381 395//381 393//381 f 392//382 410//382 412//382 f 392//382 412//382 390//382 f 413//383 411//383 393//383 f 413//383 393//383 391//383 f 410//384 420//384 418//384 f 410//384 418//384 412//384 f 419//385 421//385 411//385 f 419//385 411//385 413//385 f 408//386 422//386 420//386 f 408//386 420//386 410//386 f 421//387 423//387 409//387 f 421//387 409//387 411//387 f 406//388 424//388 422//388 f 406//388 422//388 408//388 f 423//389 425//389 407//389 f 423//389 407//389 409//389 f 404//390 426//390 424//390 f 404//390 424//390 406//390 f 425//391 427//391 405//391 f 425//391 405//391 407//391 f 402//392 428//392 426//392 f 402//392 426//392 404//392 f 427//393 429//393 403//393 f 427//393 403//393 405//393 f 402//394 414//394 416//394 f 402//394 416//394 428//394 f 417//395 415//395 403//395 f 417//395 403//395 429//395 f 318//396 320//396 444//396 f 318//396 444//396 442//396 f 445//397 321//397 319//397 f 445//397 319//397 443//397 f 320//398 390//398 412//398 f 320//398 412//398 444//398 f 413//399 391//399 321//399 f 413//399 321//399 445//399 f 310//400 318//400 442//400 f 310//400 442//400 312//400 f 443//401 319//401 311//401 f 443//401 311//401 313//401 f 382//402 430//402 414//402 f 382//402 414//402 388//402 f 415//403 431//403 383//403 f 415//403 383//403 389//403 f 412//404 418//404 440//404 f 412//404 440//404 444//404 f 441//405 419//405 413//405 f 441//405 413//405 445//405 f 438//406 446//406 444//406 f 438//406 444//406 440//406 f 445//407 447//407 439//407 f 445//407 439//407 441//407 f 434//408 446//408 438//408 f 434//408 438//408 436//408 f 439//409 447//409 435//409 f 439//409 435//409 437//409 f 432//410 448//410 446//410 f 432//410 446//410 434//410 f 447//411 449//411 433//411 f 447//411 433//411 435//411 f 430//412 448//412 432//412 f 430//412 432//412 450//412 f 433//413 449//413 431//413 f 433//413 431//413 451//413 f 414//414 430//414 450//414 f 414//414 450//414 416//414 f 451//415 431//415 415//415 f 451//415 415//415 417//415 f 312//416 448//416 430//416 f 312//416 430//416 382//416 f 431//417 449//417 313//417 f 431//417 313//417 383//417 f 312//418 442//418 446//418 f 312//418 446//418 448//418 f 447//419 443//419 313//419 f 447//419 313//419 449//419 f 442//420 444//420 446//420 f 447//421 445//421 443//421 f 416//422 450//422 452//422 f 416//422 452//422 476//422 f 453//423 451//423 417//423 f 453//423 417//423 477//423 f 450//424 432//424 462//424 f 450//424 462//424 452//424 f 463//425 433//425 451//425 f 463//425 451//425 453//425 f 432//426 434//426 460//426 f 432//426 460//426 462//426 f 461//427 435//427 433//427 f 461//427 433//427 463//427 f 434//428 436//428 458//428 f 434//428 458//428 460//428 f 459//429 437//429 435//429 f 459//429 435//429 461//429 f 436//430 438//430 456//430 f 436//430 456//430 458//430 f 457//431 439//431 437//431 f 457//431 437//431 459//431 f 438//432 440//432 454//432 f 438//432 454//432 456//432 f 455//433 441//433 439//433 f 455//433 439//433 457//433 f 440//434 418//434 474//434 f 440//434 474//434 454//434 f 475//435 419//435 441//435 f 475//435 441//435 455//435 f 428//436 416//436 476//436 f 428//436 476//436 464//436 f 477//437 417//437 429//437 f 477//437 429//437 465//437 f 426//438 428//438 464//438 f 426//438 464//438 466//438 f 465//439 429//439 427//439 f 465//439 427//439 467//439 f 424//440 426//440 466//440 f 424//440 466//440 468//440 f 467//441 427//441 425//441 f 467//441 425//441 469//441 f 422//442 424//442 468//442 f 422//442 468//442 470//442 f 469//443 425//443 423//443 f 469//443 423//443 471//443 f 420//444 422//444 470//444 f 420//444 470//444 472//444 f 471//445 423//445 421//445 f 471//445 421//445 473//445 f 418//446 420//446 472//446 f 418//446 472//446 474//446 f 473//447 421//447 419//447 f 473//447 419//447 475//447 f 458//448 456//448 480//448 f 458//448 480//448 478//448 f 481//449 457//449 459//449 f 481//449 459//449 479//449 f 478//450 480//450 482//450 f 478//450 482//450 484//450 f 483//451 481//451 479//451 f 483//451 479//451 485//451 f 484//452 482//452 488//452 f 484//452 488//452 486//452 f 489//453 483//453 485//453 f 489//453 485//453 487//453 f 486//454 488//454 490//454 f 486//454 490//454 492//454 f 491//455 489//455 487//455 f 491//455 487//455 493//455 f 464//456 476//456 486//456 f 464//456 486//456 492//456 f 487//457 477//457 465//457 f 487//457 465//457 493//457 f 452//458 484//458 486//458 f 452//458 486//458 476//458 f 487//459 485//459 453//459 f 487//459 453//459 477//459 f 452//460 462//460 478//460 f 452//460 478//460 484//460 f 479//461 463//461 453//461 f 479//461 453//461 485//461 f 458//462 478//462 462//462 f 458//462 462//462 460//462 f 463//463 479//463 459//463 f 463//463 459//463 461//463 f 454//464 474//464 480//464 f 454//464 480//464 456//464 f 481//465 475//465 455//465 f 481//465 455//465 457//465 f 472//466 482//466 480//466 f 472//466 480//466 474//466 f 481//467 483//467 473//467 f 481//467 473//467 475//467 f 470//468 488//468 482//468 f 470//468 482//468 472//468 f 483//469 489//469 471//469 f 483//469 471//469 473//469 f 468//470 490//470 488//470 f 468//470 488//470 470//470 f 489//471 491//471 469//471 f 489//471 469//471 471//471 f 466//472 492//472 490//472 f 466//472 490//472 468//472 f 491//473 493//473 467//473 f 491//473 467//473 469//473 f 464//474 492//474 466//474 f 467//475 493//475 465//475 f 392//476 390//476 504//476 f 392//476 504//476 502//476 f 505//477 391//477 393//477 f 505//477 393//477 503//477 f 394//478 392//478 502//478 f 394//478 502//478 500//478 f 503//479 393//479 395//479 f 503//479 395//479 501//479 f 396//480 394//480 500//480 f 396//480 500//480 498//480 f 501//481 395//481 397//481 f 501//481 397//481 499//481 f 398//482 396//482 498//482 f 398//482 498//482 496//482 f 499//483 397//483 399//483 f 499//483 399//483 497//483 f 400//484 398//484 496//484 f 400//484 496//484 494//484 f 497//485 399//485 401//485 f 497//485 401//485 495//485 f 388//486 400//486 494//486 f 388//486 494//486 506//486 f 495//487 401//487 389//487 f 495//487 389//487 507//487 f 494//488 502//488 504//488 f 494//488 504//488 506//488 f 505//489 503//489 495//489 f 505//489 495//489 507//489 f 494//490 496//490 500//490 f 494//490 500//490 502//490 f 501//491 497//491 495//491 f 501//491 495//491 503//491 f 496//492 498//492 500//492 f 501//493 499//493 497//493 f 314//494 382//494 388//494 f 314//494 388//494 506//494 f 389//495 383//495 315//495 f 389//495 315//495 507//495 f 314//496 506//496 504//496 f 314//496 504//496 322//496 f 505//497 507//497 315//497 f 505//497 315//497 323//497 f 320//498 322//498 504//498 f 320//498 504//498 390//498 f 505//499 323//499 321//499 f 505//499 321//499 391//499 js_of_ocaml-3.5.2/examples/webgl/webgldemo.ml000066400000000000000000000234551357507750000212330ustar00rootroot00000000000000(* Js_of_ocaml example * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2012 Pierre Chambart * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js_of_ocaml_lwt open Lwt open Js let error f = Printf.ksprintf (fun s -> Firebug.console##error (Js.string s); failwith s) f let debug f = Printf.ksprintf (fun s -> Firebug.console##log (Js.string s)) f let alert f = Printf.ksprintf (fun s -> Dom_html.window##alert (Js.string s); failwith s) f let check_error gl = if gl##getError <> gl##._NO_ERROR_ then error "WebGL error" let init_canvas canvas_id = let canvas = Opt.get (Opt.bind (Dom_html.document##getElementById (string canvas_id)) Dom_html.CoerceTo.canvas) (fun () -> error "can't find canvas element %s" canvas_id) in let gl = Opt.get (try WebGL.getContext canvas with _ -> null) (fun () -> alert "can't initialise webgl context") in canvas, gl let load_shader (gl : WebGL.renderingContext t) shader text = gl##shaderSource shader text; gl##compileShader shader; if not (to_bool (gl##getShaderParameter shader gl##._COMPILE_STATUS_)) then error "An error occurred compiling the shaders: \n%s\n%s" (to_string text) (to_string (gl##getShaderInfoLog shader)) let create_program (gl : WebGL.renderingContext t) vert_src frag_src = let vertexShader = gl##createShader gl##._VERTEX_SHADER_ in let fragmentShader = gl##createShader gl##._FRAGMENT_SHADER_ in load_shader gl vertexShader vert_src; load_shader gl fragmentShader frag_src; let prog = gl##createProgram in gl##attachShader prog vertexShader; gl##attachShader prog fragmentShader; gl##linkProgram prog; if not (to_bool (gl##getProgramParameter prog gl##._LINK_STATUS_)) then error "Unable to link the shader program."; prog let get_source src_id = let script = Opt.get (Opt.bind (Dom_html.document##getElementById (string src_id)) Dom_html.CoerceTo.script) (fun () -> error "can't find script element %s" src_id) in script##.text let float32array a = let array = new%js Typed_array.float32Array (Array.length a) in Array.iteri (fun i v -> Typed_array.set array i v) a; array let int16array a = let array = new%js Typed_array.int16Array (Array.length a) in Array.iteri (fun i v -> Typed_array.set array i v) a; array module Proj3D = struct type t = float array let scale x y z = [| x; 0.; 0.; 0.; 0.; y; 0.; 0.; 0.; 0.; z; 0.; 0.; 0.; 0.; 1. |] let translate x y z = [| 1.; 0.; 0.; 0.; 0.; 1.; 0.; 0.; 0.; 0.; 1.; 0.; x; y; z; 1. |] let rotate_x t = [| 1.; 0.; 0.; 0.; 0.; cos t; sin t; 0.; 0.; -.sin t; cos t; 0.; 0.; 0.; 0.; 1. |] let rotate_y t = [| cos t; 0.; -.sin t; 0.; 0.; 1.; 0.; 0.; sin t; 0.; cos t; 0.; 0.; 0.; 0.; 1. |] let c i j = (i * 4) + j let o i = i / 4, i mod 4 let mult m1 m2 = let v p = let i, j = o p in (m1.(c i 0) *. m2.(c 0 j)) +. (m1.(c i 1) *. m2.(c 1 j)) +. (m1.(c i 2) *. m2.(c 2 j)) +. (m1.(c i 3) *. m2.(c 3 j)) in Array.init 16 v let array m = float32array m end type line = | V of (float * float * float) | VN of (float * float * float) | F of ((int * int) * (int * int) * (int * int)) let line_regexp = Regexp.regexp "(v|vn|f)\\ ([^\\ ]+)\\ ([^\\ ]+)\\ ([^\\ ]+)" let couple_regexp = Regexp.regexp "([0-9]+)//([0-9]+)" let read_coord_couple c = match Regexp.string_match couple_regexp c 0 with | None -> None | Some res -> ( match List.map (Regexp.matched_group res) [ 1; 2 ] with | [ Some v; Some vn ] -> Some (int_of_string v, int_of_string vn) | _ -> None) let read_line l = match Regexp.string_match line_regexp l 0 with | None -> None | Some res -> ( match List.map (Regexp.matched_group res) [ 1; 2; 3; 4 ] with | [ Some "v"; Some x; Some y; Some z ] -> Some (V (float_of_string x, float_of_string y, float_of_string z)) | [ Some "vn"; Some x; Some y; Some z ] -> Some (VN (float_of_string x, float_of_string y, float_of_string z)) | [ Some "f"; Some x; Some y; Some z ] -> ( match List.map read_coord_couple [ x; y; z ] with | [ Some x; Some y; Some z ] -> Some (F (x, y, z)) | _ -> None) | _ -> None) let concat a = let length = Array.fold_left (fun len l -> len + List.length l) 0 a in let next = let pos = ref (-1) in let l = ref [] in let rec aux _ = match !l with | t :: q -> l := q; t | [] -> incr pos; l := a.(!pos); aux 0 in aux in Array.init length next let make_model vertex norm face = let vertex' = Array.init (Array.length face) (fun i -> let (av, _an), (bv, _bn), (cv, _cn) = face.(i) in let a1, a2, a3 = vertex.(av - 1) in let b1, b2, b3 = vertex.(bv - 1) in let c1, c2, c3 = vertex.(cv - 1) in [ a1; a2; a3; b1; b2; b3; c1; c2; c3 ]) in let norm' = Array.init (Array.length face) (fun i -> let (_av, an), (_bv, bn), (_cv, cn) = face.(i) in let a1, a2, a3 = norm.(an - 1) in let b1, b2, b3 = norm.(bn - 1) in let c1, c2, c3 = norm.(cn - 1) in [ a1; a2; a3; b1; b2; b3; c1; c2; c3 ]) in let vertex = float32array (concat vertex') in let norm = float32array (concat norm') in vertex, norm let read_model a = let vertex = ref [] in let norm = ref [] in let face = ref [] in Array.iter (fun s -> match read_line s with | None -> () | Some (F (a, b, c)) -> face := (a, b, c) :: !face | Some (V (a, b, c)) -> vertex := (a, b, c) :: !vertex | Some (VN (a, b, c)) -> norm := (a, b, c) :: !norm) a; make_model (Array.of_list (List.rev !vertex)) (Array.of_list (List.rev !norm)) (Array.of_list (List.rev !face)) let http_get url = XmlHttpRequest.get url >>= fun r -> let cod = r.XmlHttpRequest.code in let msg = r.XmlHttpRequest.content in if cod = 0 || cod = 200 then Lwt.return msg else fst (Lwt.wait ()) let getfile f = try Lwt.return (Sys_js.read_file ~name:f) with Not_found -> http_get f >|= fun s -> s let fetch_model s = getfile s >|= fun s -> let a = Regexp.split (Regexp.regexp "\n") s in read_model (Array.of_list a) let pi = 4. *. atan 1. let start (pos, norm) = let fps_text = Dom_html.document##createTextNode (Js.string "loading") in Opt.iter (Opt.bind (Dom_html.document##getElementById (string "fps")) Dom_html.CoerceTo.element) (fun span -> Dom.appendChild span fps_text); debug "init canvas"; let _canvas, gl = init_canvas "canvas" in debug "create program"; let prog = create_program gl (get_source "vertex-shader") (get_source "fragment-shader") in debug "use program"; gl##useProgram prog; check_error gl; debug "program loaded"; gl##enable gl##._DEPTH_TEST_; gl##depthFunc gl##._LESS; let proj_loc = gl##getUniformLocation prog (string "u_proj") in let lightPos_loc = gl##getUniformLocation prog (string "u_lightPos") in let ambientLight_loc = gl##getUniformLocation prog (string "u_ambientLight") in let lightPos = float32array [| 3.; 0.; -1. |] in let ambientLight = float32array [| 0.1; 0.1; 0.1 |] in gl##uniform3fv_typed lightPos_loc lightPos; gl##uniform3fv_typed ambientLight_loc ambientLight; let pos_attr = gl##getAttribLocation prog (string "a_position") in gl##enableVertexAttribArray pos_attr; let array_buffer = gl##createBuffer in gl##bindBuffer gl##._ARRAY_BUFFER_ array_buffer; gl##bufferData gl##._ARRAY_BUFFER_ pos gl##._STATIC_DRAW_; gl##vertexAttribPointer pos_attr 3 gl##._FLOAT _false 0 0; let norm_attr = gl##getAttribLocation prog (string "a_normal") in gl##enableVertexAttribArray norm_attr; let norm_buffer = gl##createBuffer in gl##bindBuffer gl##._ARRAY_BUFFER_ norm_buffer; gl##bufferData gl##._ARRAY_BUFFER_ norm gl##._STATIC_DRAW_; gl##vertexAttribPointer norm_attr 3 gl##._FLOAT _false 0 0; let mat = Proj3D.(mult (rotate_x (pi /. 2.)) (mult (scale 0.5 0.5 0.5) (translate 0. 0. 0.))) in check_error gl; debug "ready"; let get_time () = (new%js date_now)##getTime in let last_draw = ref (get_time ()) in let draw_times = Queue.create () in let rec f () = let t = (new%js date_now)##getTime /. 1000. in let mat' = Proj3D.mult mat (Proj3D.rotate_y (1. *. t)) in gl##uniformMatrix4fv_typed proj_loc _false (Proj3D.array mat'); gl##clear (gl##._DEPTH_BUFFER_BIT_ lor gl##._COLOR_BUFFER_BIT_); gl##drawArrays gl##._TRIANGLES 0 (pos##.length / 3); check_error gl; let now = get_time () in Queue.push (now -. !last_draw) draw_times; last_draw := now; if Queue.length draw_times > 50 then ignore (Queue.pop draw_times); let fps = 1. /. Queue.fold ( +. ) 0. draw_times *. float_of_int (Queue.length draw_times) *. 1000. in fps_text##.data := string (Printf.sprintf "%.1f" fps); Lwt_js.sleep 0.02 >>= f in f () let go _ = ignore (debug "fetching model"; catch (fun () -> fetch_model "monkey.model" >>= start) (fun exn -> error "uncaught exception: %s" (Printexc.to_string exn))); _true let _ = Dom_html.window##.onload := Dom_html.handler go js_of_ocaml-3.5.2/examples/wiki/000077500000000000000000000000001357507750000165665ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/wiki/dune000066400000000000000000000005401357507750000174430ustar00rootroot00000000000000(executables (names main) (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx))) (ocamllex wikicreole) (rule (targets main.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:main.bc} -o %{targets} --pretty))) (alias (name default) (deps main.js index.html)) js_of_ocaml-3.5.2/examples/wiki/index.html000066400000000000000000000006521357507750000205660ustar00rootroot00000000000000 Realtime wiki syntax parsing js_of_ocaml-3.5.2/examples/wiki/main.ml000066400000000000000000000040651357507750000200510ustar00rootroot00000000000000(* Js_of_ocaml example * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js_of_ocaml_lwt module Html = Dom_html let ( >>= ) = Lwt.bind let replace_child p n = Js.Opt.iter p##.firstChild (fun c -> Dom.removeChild p c); Dom.appendChild p n let onload _ = let d = Html.document in let body = Js.Opt.get (d##getElementById (Js.string "wiki_demo")) (fun () -> assert false) in let textbox = Html.createTextarea d in textbox##.rows := 20; textbox##.cols := 80; textbox##.value := Js.string Test.test1; let preview = Html.createDiv d in preview##.style##.border := Js.string "1px black dashed"; preview##.style##.padding := Js.string "5px"; Dom.appendChild body textbox; Dom.appendChild body (Html.createBr d); Dom.appendChild body preview; let rec dyn_preview old_text n = let text = Js.to_string textbox##.value in let n = if text <> old_text then ( (try let rendered = Wiki_syntax.xml_of_wiki text in replace_child preview rendered with _ -> ()); 20) else max 0 (n - 1) in Lwt_js.sleep (if n = 0 then 0.5 else 0.1) >>= fun () -> dyn_preview text n in ignore (dyn_preview "" 0); Js._false let _ = Html.window##.onload := Html.handler onload js_of_ocaml-3.5.2/examples/wiki/test.ml000066400000000000000000000012011357507750000200710ustar00rootroot00000000000000(* This is demo input for wiki. It will be loaded automatically into window on startup *) let test1 = "\n\n\ ====this is h4\n\n\ # number list el 1\n\ # number list e2 2 //with italic text\n\n\n\ //with italic\n\n\ * bullet list el1 ** with bold text\n\ * bullet list el2 ** with bold // and italic text\n\n\ <>\n\n\ [[http://ya.ru|Link to Yandex]]\n\n\ [[http://google.com]]\n\n\ {{http://icons-search.com/img/yellowicon/firefox_win.zip/Firefox_Thunderbird_Win-icons-Firefox.ico-128x128.png|mail \ icon}}\n\n\ {{{\n\ == [[Nowiki]]:\n\ //**don't** format//\n\ }}}\n\n\n" js_of_ocaml-3.5.2/examples/wiki/wiki_syntax.ml000066400000000000000000000074721357507750000215030ustar00rootroot00000000000000(* Ocsimore * Copyright (C) 2008 * Laboratoire PPS - Universit Paris Diderot - CNRS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml (** Pretty print wiki to DOM elements @author Vincent Balat *) module Html = Dom_html module W = Wikicreole (* let create n ?attrs children = let m = create n ?attrs () in List.iter (Js.Node.append m) children ; m *) let node x = (x : #Dom.node Js.t :> Dom.node Js.t) let ( <| ) e l = List.iter (fun c -> Dom.appendChild e c) l; node e let list_builder d tag c = d##createElement (Js.string tag) <| List.map (fun (c, l) -> d##createElement (Js.string "li") <| c @ match l with | Some v -> [ v ] | None -> []) c let builder = let d = Html.document in { W.chars = (fun s -> node (d##createTextNode (Js.string s))) ; W.strong_elem = (fun s -> d##createElement (Js.string "strong") <| s) ; W.em_elem = (fun s -> d##createElement (Js.string "em") <| s) ; W.a_elem = (fun addr s -> let a = Html.createA d in a##.href := Js.string addr; a <| s) ; W.youtube_elem = (fun addr _s -> let i = Html.createIframe d in i##.width := Js.string "480"; i##.height := Js.string "360"; let video_link = "http://youtube.com/embed/" ^ Js.to_string (Js.encodeURI (Js.string addr)) in i##.src := Js.string video_link; i##.frameBorder := Js.string "0"; node i) ; W.br_elem = (fun () -> node (d##createElement (Js.string "br"))) ; W.img_elem = (fun addr alt -> let i = Html.createImg d in i##.src := Js.string addr; i##.alt := Js.string alt; node i) ; W.tt_elem = (fun s -> d##createElement (Js.string "tt") <| s) ; W.p_elem = (fun s -> d##createElement (Js.string "p") <| s) ; W.pre_elem = (fun s -> let p = d##createElement (Js.string "pre") in Dom.appendChild p (d##createTextNode (Js.string (String.concat "" s))); node p) ; W.h1_elem = (fun s -> d##createElement (Js.string "h1") <| s) ; W.h2_elem = (fun s -> d##createElement (Js.string "h2") <| s) ; W.h3_elem = (fun s -> d##createElement (Js.string "h3") <| s) ; W.h4_elem = (fun s -> d##createElement (Js.string "h4") <| s) ; W.h5_elem = (fun s -> d##createElement (Js.string "h5") <| s) ; W.h6_elem = (fun s -> d##createElement (Js.string "h6") <| s) ; W.ul_elem = (fun s -> list_builder d "ul" s) ; W.ol_elem = (fun s -> list_builder d "ol" s) ; W.hr_elem = (fun () -> node (d##createElement (Js.string "hr"))) ; W.table_elem = (fun rows -> let rows = List.map (fun entries -> d##createElement (Js.string "tr") <| List.map (fun (h, c) -> let kind = if h then "th" else "td" in d##createElement (Js.string kind) <| c) entries) rows in d##createElement (Js.string "table") <| [ d##createElement (Js.string "tbody") <| rows ]) ; W.inline = (fun x -> x) } let xml_of_wiki s = Html.createDiv Html.document <| W.from_string builder s js_of_ocaml-3.5.2/examples/wiki/wikicreole.mll000066400000000000000000000337471357507750000214470ustar00rootroot00000000000000{ (* Ocsimore * Copyright (C) 2008 * Laboratoire PPS - Universit Paris Diderot - CNRS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Parser for Wikicreole @author Jrme Vouillon *) type ('flow, 'inline, 'a_content) builder = { chars : string -> 'a_content; strong_elem : 'inline list -> 'a_content; em_elem : 'inline list -> 'a_content; br_elem : unit -> 'a_content; img_elem : string -> string -> 'a_content; tt_elem : 'inline list -> 'a_content; a_elem : string -> 'a_content list -> 'inline; youtube_elem : string -> 'a_content list -> 'inline; p_elem : 'inline list -> 'flow; pre_elem : string list -> 'flow; h1_elem : 'inline list -> 'flow; h2_elem : 'inline list -> 'flow; h3_elem : 'inline list -> 'flow; h4_elem : 'inline list -> 'flow; h5_elem : 'inline list -> 'flow; h6_elem : 'inline list -> 'flow; ul_elem : ('inline list * 'flow option) list -> 'flow; ol_elem : ('inline list * 'flow option) list -> 'flow; hr_elem : unit -> 'flow; table_elem : (bool * 'inline list) list list -> 'flow; inline : 'a_content -> 'inline } type style = Bold | Italic type list_kind = Unordered | Ordered type ('inline, 'flow) stack = Style of style * 'inline list * ('inline, 'flow) stack | Link of string * ('inline, 'flow) stack (* Not that we do not save anything in the case of links, as links cannot be nested *) | Paragraph | Heading of int | List_item of ('inline, 'flow) stack | List of list_kind * ('inline list * 'flow option) list * ('inline, 'flow) stack | Table of (bool * 'inline list) list list | Row of (bool * 'inline list) list * ('inline, 'flow) stack | Entry of bool * ('inline, 'flow) stack type ('flow, 'inline, 'a_content) ctx = { build : ('flow, 'inline, 'a_content) builder; mutable italic : bool; mutable bold : bool; mutable heading : bool; mutable link : bool; mutable list_level : int; mutable inline_mix : 'inline list; mutable link_content : 'a_content list; mutable pre_content : string list; mutable list : ('inline list * 'flow option) list; mutable flow : 'flow list; mutable stack : ('inline, 'flow) stack } let count c s = let n = ref 0 in for i = 0 to String.length s - 1 do if s.[i] = c then incr n done; !n let push c v = match c.stack with Link _ -> c.link_content <- v :: c.link_content | _ -> c.inline_mix <- c.build.inline v :: c.inline_mix let push_string c s = push c (c.build.chars s) let push_chars c lexbuf = push_string c (Lexing.lexeme lexbuf) let get_style c style = match style with Bold -> c.bold | Italic -> c.italic let set_style c style v = match style with Bold -> c.bold <- v | Italic -> c.italic <- v let pop_style c style inline stack = let elt = match style with Bold -> c.build.strong_elem | Italic -> c.build.em_elem in let inline' = c.inline_mix in c.stack <- stack; c.inline_mix <- inline; push c (elt (List.rev inline')); set_style c style false let style_change c style = if get_style c style then begin match c.stack with Style (s, inline, stack) when s = style -> pop_style c style inline stack | _ -> match style with Italic -> push_string c "//" | Bold -> push_string c "**" end else begin c.stack <- Style (style, c.inline_mix, c.stack); c.inline_mix <- []; set_style c style true end let pop_link c addr stack = c.stack <- stack; c.inline_mix <- c.build.a_elem addr (List.rev c.link_content) :: c.inline_mix; c.link_content <- []; c.link <- false let close_entry c = match c.stack with Entry (heading, Row (entries, stack)) -> c.stack <- Row ((heading, List.rev c.inline_mix) :: entries, stack); c.inline_mix <- []; true | Row _ -> true | Table _ -> c.stack <- Row ([(false, List.rev c.inline_mix)], c.stack); c.inline_mix <- []; true | _ -> false let close_row c = close_entry c && match c.stack with Row (entries, Table rows) -> c.stack <- Table (List.rev entries :: rows); true | Table _ -> true | _ -> assert false let rec end_paragraph c lev = match c.stack with Style (style, inline, stack) -> pop_style c style inline stack; end_paragraph c lev | Link (addr, stack) -> pop_link c addr stack; end_paragraph c lev | Paragraph -> if c.inline_mix <> [] then begin c.flow <- c.build.p_elem (List.rev c.inline_mix) :: c.flow; c.inline_mix <- [] end; c.stack <- Paragraph | Heading l -> let f = match l with | 1 -> c.build.h1_elem | 2 -> c.build.h2_elem | 3 -> c.build.h3_elem | 4 -> c.build.h4_elem | 5 -> c.build.h5_elem | _ -> c.build.h6_elem in c.flow <- f (List.rev c.inline_mix) :: c.flow; c.inline_mix <- []; c.heading <- false; c.stack <- Paragraph | List_item stack -> c.list <- (List.rev c.inline_mix, None) :: c.list; c.stack <- stack; c.inline_mix <- []; end_paragraph c lev | List (kind, lst, stack) -> if lev < c.list_level then begin c.list_level <- c.list_level - 1; let elt = match kind with Unordered -> c.build.ul_elem | Ordered -> c.build.ol_elem in let cur_lst = elt (List.rev c.list) in if c.list_level = 0 then c.flow <- cur_lst :: c.flow else begin match lst with (l, None) :: rem -> c.list <- (l, Some cur_lst) :: rem; | _ -> assert false end; c.stack <- stack; end_paragraph c lev end | Entry _ -> ignore (close_row c); end_paragraph c lev | Row _ -> assert false | Table rows -> c.flow <- c.build.table_elem (List.rev rows) :: c.flow; c.stack <- Paragraph let rec correct_kind_rec stack kind n = match stack with List_item stack -> correct_kind_rec stack kind n | List (k, _lst, stack) -> if n = 0 then k = kind else correct_kind_rec stack kind (n - 1) | Style (_, _, stack) -> correct_kind_rec stack kind n | Link _ | Heading _ | Paragraph | Entry _ | Row _ | Table _ -> assert false let correct_kind c kind lev = lev = c.list_level + 1 || (lev <= c.list_level && correct_kind_rec c.stack kind (c.list_level - lev)) let start_list_item c kind lev = let correct = correct_kind c kind lev in if lev = 1 || correct then begin (* If we have an item of a different kind at level 1, we close the previous list and start a new one of the right kind *) end_paragraph c (if correct then lev else 0); if lev = c.list_level then begin c.stack <- List_item c.stack end else (* if lev = c.list_level + 1 then *) begin c.list_level <- lev; c.stack <- List_item (List (kind, c.list, c.stack)); c.list <- [] end; true end else false let start_table_row c heading = if not (close_row c) then begin end_paragraph c 0; c.stack <- Table [] end; c.stack <- Entry (heading, Row ([], c.stack)) } let line_break = '\n' | '\r' | "\r\n" let white_space = [ ' ' '\t' ] (* XXX Should we consider form feed and zero-width space as white spaces as well ? *) let not_line_break = [^ '\n' '\r'] let reserved_chars = [ '*' '/' '\\' '=' '[' ']' '{' '~' '|' 'h' 'f' ] let punctuation = [ ',' '.' '?' '!' ':' ';' '"' '\'' ] let first_char = (not_line_break # ['~' '|']) | ('=' +) let next_chars = not_line_break # reserved_chars rule parse_bol c = parse line_break { end_paragraph c 0; parse_bol c lexbuf } | white_space * ("=" | "==" | "===" | "====" | "=====" | "======") { end_paragraph c 0; assert (c.stack = Paragraph); c.stack <- Heading (count '=' (Lexing.lexeme lexbuf)); c.heading <- true; parse_rem c lexbuf } | white_space * "*" + { let lev = count '*' (Lexing.lexeme lexbuf) in if not (start_list_item c Unordered lev) then begin let s = Lexing.lexeme lexbuf in let l = String.length s - lev in if l > 0 then push_string c (String.sub s 0 l); for _i = 1 to lev / 2 do style_change c Bold done; if lev land 1 = 1 then push_string c "*" end; parse_rem c lexbuf } | white_space * "#" + { let lev = count '#' (Lexing.lexeme lexbuf) in if not (start_list_item c Ordered lev) then push_chars c lexbuf; parse_rem c lexbuf } | white_space * "----" white_space * (line_break | eof) { end_paragraph c 0; c.flow <- c.build.hr_elem () :: c.flow; parse_bol c lexbuf } | white_space * "{{{" (line_break | eof) { end_paragraph c 0; parse_nowiki c lexbuf } | white_space * "|" { start_table_row c false; parse_rem c lexbuf } | white_space * "|=" { start_table_row c true; parse_rem c lexbuf } | "" { parse_rem c lexbuf } and parse_rem c = parse line_break { (* Headings are single lines *) if c.heading then end_paragraph c 0 else push_chars c lexbuf; parse_bol c lexbuf } | "**" { style_change c Bold; parse_rem c lexbuf } | "//" { style_change c Italic; parse_rem c lexbuf } | "=" + white_space * (line_break | eof) { if c.heading then end_paragraph c 0 else push_chars c lexbuf; parse_bol c lexbuf } | "[[" (']' ? (not_line_break # [ ']' '|' ])) + "]]" { if c.link then push_chars c lexbuf else let s = Lexing.lexeme lexbuf in let addr = String.sub s 2 (String.length s - 4) in c.inline_mix <- c.build.a_elem addr [c.build.chars addr] :: c.inline_mix; parse_rem c lexbuf } | "<' ? (not_line_break # [ '>' ])) + ">>" { if c.link then push_chars c lexbuf else let s = Lexing.lexeme lexbuf in let addr = String.sub s 10 (String.length s - 12) in c.inline_mix <- c.build.youtube_elem addr [c.build.chars addr] :: c.inline_mix; parse_rem c lexbuf } | "[[" (']' ? (not_line_break # [ ']' '|' ])) + "|" { if c.link then push_chars c lexbuf else begin let s = Lexing.lexeme lexbuf in let addr = String.sub s 2 (String.length s - 3) in c.stack <- Link (addr, c.stack); c.link <- true end; parse_rem c lexbuf } | "]]" { begin match c.stack with Link (addr, stack) -> pop_link c addr stack | _ -> push_chars c lexbuf end; parse_rem c lexbuf } | ("http:" | "ftp:") (not_line_break # white_space) * (not_line_break # white_space # punctuation) { if c.link then push_chars c lexbuf else let addr = Lexing.lexeme lexbuf in c.inline_mix <- c.build.a_elem addr [c.build.chars addr] :: c.inline_mix; parse_rem c lexbuf } | "\\\\" { push c (c.build.br_elem ()); parse_rem c lexbuf } | "{{" (not_line_break # ['|' '{']) (not_line_break # '|') * '|' ('}' ? (not_line_break # '}')) * "}}" { let s = Lexing.lexeme lexbuf in let i = String.index s '|' in let url = String.sub s 2 (i - 2) in let alt = String.sub s (i + 1) (String.length s - i - 3) in push c (c.build.img_elem url alt); parse_rem c lexbuf } | "{{{" ('}' ? '}' ? (not_line_break # '}')) * '}' * "}}" { let s = Lexing.lexeme lexbuf in let txt = String.sub s 3 (String.length s - 6) in push c (c.build.tt_elem [c.build.inline (c.build.chars txt)]); parse_rem c lexbuf } | '~' (not_line_break # white_space) { let s = Lexing.lexeme lexbuf in (* It amounts to the same to quote a UTF-8 char or its first byte *) push_string c (String.sub s 1 1); parse_rem c lexbuf } | '|' white_space* (line_break | eof) { if not (close_row c) then push_chars c lexbuf; parse_bol c lexbuf } | '|' { if close_entry c then c.stack <- Entry (false, c.stack) else push_chars c lexbuf; parse_rem c lexbuf } | "|=" { if close_entry c then c.stack <- Entry (true, c.stack) else push_chars c lexbuf; parse_rem c lexbuf } | first_char next_chars * | '~' { push_chars c lexbuf; parse_rem c lexbuf } | eof { end_paragraph c 0 } and parse_nowiki c = parse white_space + "}}}" (line_break | eof) { let s = Lexing.lexeme lexbuf in c.pre_content <- String.sub s 1 (String.length s - 1) :: c.pre_content; parse_nowiki c lexbuf } | ("}}}" (line_break | eof)) | eof { c.flow <- c.build.pre_elem (List.rev c.pre_content) :: c.flow; c.pre_content <- []; parse_bol c lexbuf } | not_line_break * (line_break | eof) { c.pre_content <- Lexing.lexeme lexbuf :: c.pre_content; parse_nowiki c lexbuf } { let context b = { build = b; italic = false; bold = false; heading = false; link = false; list_level = 0; inline_mix = []; link_content = []; pre_content = []; list = []; flow = []; stack = Paragraph } let from_lexbuf b lexbuf = let c = context b in parse_bol c lexbuf; List.rev c.flow let from_channel b ch = from_lexbuf b (Lexing.from_channel ch) let from_string b s = from_lexbuf b (Lexing.from_string s) } js_of_ocaml-3.5.2/examples/wysiwyg/000077500000000000000000000000001357507750000173455ustar00rootroot00000000000000js_of_ocaml-3.5.2/examples/wysiwyg/dune000066400000000000000000000005111357507750000202200ustar00rootroot00000000000000(executables (names main) (libraries js_of_ocaml-lwt) (preprocess (pps js_of_ocaml-ppx))) (rule (targets main.js) (action (run %{bin:js_of_ocaml} --noruntime %{lib:js_of_ocaml-compiler:runtime.js} --source-map %{dep:main.bc} -o %{targets} --pretty))) (alias (name default) (deps main.js index.html)) js_of_ocaml-3.5.2/examples/wysiwyg/index.html000066400000000000000000000006521357507750000213450ustar00rootroot00000000000000 Kakadu's WYSIWYG wiki editor js_of_ocaml-3.5.2/examples/wysiwyg/main.ml000066400000000000000000000175371357507750000206400ustar00rootroot00000000000000(* Js_of_ocaml example * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Dmitry Kosarev * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js_of_ocaml_lwt module Html = Dom_html let ( >>= ) = Lwt.bind let ( |> ) x f = f x exception Break of bool let is_visible_text s = (* TODO: rewrite with regexps. *) let len = String.length s in let rec loop i = if i >= len then () else if s.[i] = '\\' && i < len - 1 && s.[i + 1] = '\\' then loop (i + 2) else match s.[i] with | '\n' -> loop (i + 1) | _ -> raise (Break true) in try loop 0; false with Break b -> b open Dom let rec html2wiki body = let ans = Buffer.create 10 in let add_str ?(surr = "") s = if is_visible_text s then Buffer.add_string ans (surr ^ s ^ surr) else () in let childNodes = body##.childNodes in for i = 0 to childNodes##.length - 1 do Js.Opt.iter (childNodes##item i) (fun node -> match Js.to_string node##.nodeName with | "B" -> let inner = html2wiki node in add_str inner ~surr:"**" | "I" -> let inner = html2wiki node in add_str inner ~surr:"//" | "#text" -> ( match Js.Opt.to_option node##.nodeValue with | Some x -> Buffer.add_string ans (Js.to_string x) | None -> ()) | "P" -> let inner = html2wiki node in add_str (inner ^ "\n\n") | "BR" -> Buffer.add_string ans "\\\\" | "HR" -> Buffer.add_string ans "----" | "DIV" -> let inner = html2wiki node in Buffer.add_string ans inner | "A" -> let x : element Js.t Js.opt = Js.some (Js.Unsafe.coerce node) in let el = Js.Opt.get x (fun _ -> assert false) in Js.Opt.case (el##getAttribute (Js.string "wysitype")) (fun () -> Buffer.add_string ans "^error_in_anchor^") (fun s -> let url = Js.Opt.get (el##getAttribute (Js.string "href")) (fun _ -> assert false) |> Js.to_string in match Js.to_string s with | "global" -> let desc = html2wiki node in Buffer.add_string ans (String.concat "" [ "[["; url; "|"; desc; "]]" ]) | "wiki" -> String.concat "" [ "[["; url; "]]" ] |> Buffer.add_string ans | _ -> Buffer.add_string ans "^error2_in_anchor^") | ("H1" | "H2" | "H3") as hh -> let n = int_of_char hh.[1] - int_of_char '0' + 1 in let prefix = String.make n '=' in let inner = html2wiki node in Buffer.add_string ans (prefix ^ inner ^ "\n\n") | _ as name -> Buffer.add_string ans ("^" ^ name ^ "^")) done; Buffer.contents ans let onload _ = let d = Html.document in let body = Js.Opt.get (d##getElementById (Js.string "wiki_demo")) (fun () -> assert false) in let iframe = Html.createIframe d in iframe##.style##.border := Js.string "2px green solid"; iframe##.src := Js.string "#"; iframe##.id := Js.string "wysiFrame"; Dom.appendChild body iframe; Js.Opt.iter iframe##.contentDocument (fun iDoc -> iDoc##open_; iDoc##write (Js.string "

Camelusbactrianus

"); iDoc##close; iDoc##.designMode := Js.string "On"; let iWin = iframe##.contentWindow in Dom.appendChild body (Html.createBr d); (* see http://www.quirksmode.org/dom/execCommand.html * http://www.mozilla.org/editor/midas-spec.html *) let createButton ?(show = Js._false) ?(value = None) title action = let but = Html.createInput ?_type:(Some (Js.string "submit")) d in but##.value := Js.string title; let wrap s = match s with | None -> Js.null | Some s -> Js.some (Js.string s) in but##.onclick := Html.handler (fun _ -> iWin##focus; iDoc##execCommand (Js.string action) show (wrap value); Js._true); Dom.appendChild body but; but in ignore (createButton "hr" "inserthorizontalrule"); ignore (createButton "remove format" "removeformat"); ignore (createButton "B" "bold"); ignore (createButton "I" "italic"); Dom.appendChild body (Html.createBr d); ignore (createButton "p" "formatblock" ~value:(Some "p")); ignore (createButton "h1" "formatblock" ~value:(Some "h1")); ignore (createButton "h2" "formatblock" ~value:(Some "h2")); ignore (createButton "h3" "formatblock" ~value:(Some "h3")); let prompt query default = Js.Opt.get (iWin##prompt (Js.string query) (Js.string default)) (fun () -> Js.string default) |> Js.to_string in (createButton "link" "inserthtml")##.onclick := Html.handler (fun _ -> let link = prompt "Enter a link" "http://google.ru" in let desc = prompt "Enter description" "desc" in let link = String.concat "" [ "
"; desc; "" ] in iWin##alert (Js.string link); iDoc##execCommand (Js.string "inserthtml") Js._false (Js.some (Js.string link)); Js._true); (createButton "link2wiki" "inserthtml")##.onclick := Html.handler (fun _ -> let link = prompt "Enter a wikipage" "lololo" in let link = [ ""; link; "" ] |> String.concat "" in iWin##alert (Js.string link); iDoc##execCommand (Js.string "inserthtml") Js._false (Js.some (Js.string link)); Js._true); Dom.appendChild body (Html.createBr d); let preview = Html.createTextarea d in preview##.readOnly := Js._true; preview##.cols := 34; preview##.rows := 10; preview##.style##.border := Js.string "1px black solid"; preview##.style##.padding := Js.string "5px"; Dom.appendChild body preview; let wikiFrame = Html.createTextarea d in wikiFrame##.id := Js.string "wikiFrame"; wikiFrame##.readOnly := Js._true; wikiFrame##.cols := 34; wikiFrame##.rows := 10; preview##.style##.border := Js.string "2px blue solid"; preview##.style##.padding := Js.string "5px"; Dom.appendChild body wikiFrame; let rec dyn_preview old_text n = let text = Js.to_string iDoc##.body##.innerHTML in let n = if text <> old_text then ( (try preview##.value := Js.string text; wikiFrame##.value := Js.string (html2wiki (iDoc##.body :> Dom.node Js.t)) with _ -> ()); 20) else max 0 (n - 1) in Lwt_js.sleep (if n = 0 then 0.5 else 0.1) >>= fun () -> dyn_preview text n in ignore (dyn_preview "" 0)); Js._false let _ = Html.window##.onload := Html.handler onload js_of_ocaml-3.5.2/js_of_ocaml-compiler.opam000066400000000000000000000015531357507750000207520ustar00rootroot00000000000000opam-version: "2.0" maintainer: "dev@ocsigen.org" authors: "Ocsigen team" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" homepage: "http://ocsigen.github.io/js_of_ocaml" dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git" synopsis: "Compiler from OCaml bytecode to Javascript" description: """ Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js """ build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "ocaml" {>= "4.02.0"} "dune" {>= "1.11.1"} "ppx_expect" {with-test & >= "0.12.0"} "cmdliner" "ocaml-migrate-parsetree" "yojson" # It's optional, but we want users to be able to use source-map without pain. ] depopts: [ "ocamlfind" ] conflicts: [ "ocamlfind" {< "1.5.1"} "js_of_ocaml" {< "3.0"} ] js_of_ocaml-3.5.2/js_of_ocaml-lwt.opam000066400000000000000000000013061357507750000177420ustar00rootroot00000000000000opam-version: "2.0" maintainer: "dev@ocsigen.org" authors: "Ocsigen team" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" homepage: "http://ocsigen.github.io/js_of_ocaml" dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git" synopsis: "Compiler from OCaml bytecode to Javascript" description: """ Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js """ build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "ocaml" {>= "4.02.0"} "dune" {>= "1.11.1"} "lwt" {>= "2.4.4"} "js_of_ocaml" {>= "3.2"} "js_of_ocaml-ppx" ] depopts: [ "graphics" "lwt_log" ] js_of_ocaml-3.5.2/js_of_ocaml-ocamlbuild.opam000066400000000000000000000011271357507750000212500ustar00rootroot00000000000000opam-version: "2.0" maintainer: "dev@ocsigen.org" authors: "Ocsigen team" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" homepage: "http://ocsigen.github.io/js_of_ocaml" dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git" synopsis: "Compiler from OCaml bytecode to Javascript" description: """ Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js """ build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "dune" {>= "1.11.1"} "ocamlbuild" ] js_of_ocaml-3.5.2/js_of_ocaml-ppx.opam000066400000000000000000000013071357507750000177440ustar00rootroot00000000000000opam-version: "2.0" maintainer: "dev@ocsigen.org" authors: "Ocsigen team" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" homepage: "http://ocsigen.github.io/js_of_ocaml" dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git" synopsis: "Compiler from OCaml bytecode to Javascript" description: """ Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js """ build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "ocaml" {>= "4.02.0"} "dune" {>= "1.11.1"} "ocaml-migrate-parsetree" {>= "1.4"} "ppx_tools_versioned" {>= "5.2.3"} "js_of_ocaml" {>= "3.0"} ] js_of_ocaml-3.5.2/js_of_ocaml-ppx_deriving_json.opam000066400000000000000000000012441357507750000226640ustar00rootroot00000000000000opam-version: "2.0" maintainer: "dev@ocsigen.org" authors: "Ocsigen team" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" homepage: "http://ocsigen.github.io/js_of_ocaml" dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git" synopsis: "Compiler from OCaml bytecode to Javascript" description: """ Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js """ build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "ocaml" {>= "4.04.1"} "dune" {>= "1.11.1"} "js_of_ocaml" "ocaml-migrate-parsetree" "ppxlib" {>= "0.9.0"} ] js_of_ocaml-3.5.2/js_of_ocaml-toplevel.opam000066400000000000000000000013031357507750000207630ustar00rootroot00000000000000opam-version: "2.0" maintainer: "dev@ocsigen.org" authors: "Ocsigen team" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" homepage: "http://ocsigen.github.io/js_of_ocaml" dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git" synopsis: "Compiler from OCaml bytecode to Javascript" description: """ Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js """ build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "ocaml" {>= "4.02.0"} "dune" {>= "1.11.1"} "ocamlfind" {>= "1.5.1"} "js_of_ocaml-compiler" "js_of_ocaml-ppx" "js_of_ocaml" {>= "3.0"} ] js_of_ocaml-3.5.2/js_of_ocaml-tyxml.opam000066400000000000000000000012771357507750000203200ustar00rootroot00000000000000opam-version: "2.0" maintainer: "dev@ocsigen.org" authors: "Ocsigen team" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" homepage: "http://ocsigen.github.io/js_of_ocaml" dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git" synopsis: "Compiler from OCaml bytecode to Javascript" description: """ Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js """ build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "ocaml" {>= "4.02.0"} "dune" {>= "1.11.1"} "tyxml" {>= "4.3"} "reactiveData" {>= "0.2"} "js_of_ocaml" {>= "3.0"} "js_of_ocaml-ppx" ]js_of_ocaml-3.5.2/js_of_ocaml.opam000066400000000000000000000013441357507750000171400ustar00rootroot00000000000000opam-version: "2.0" maintainer: "dev@ocsigen.org" authors: "Ocsigen team" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" homepage: "http://ocsigen.github.io/js_of_ocaml" dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git" synopsis: "Compiler from OCaml bytecode to Javascript" description: """ Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js """ name: "js_of_ocaml" build: [["dune" "build" "-p" name "-j" jobs]] depends: [ "ocaml" {>= "4.02.0"} "dune" {>= "1.11.1"} "ocaml-migrate-parsetree" {>= "1.4"} "ppx_tools_versioned" {>= "5.2.3"} "uchar" "js_of_ocaml-compiler" ] js_of_ocaml-3.5.2/lib/000077500000000000000000000000001357507750000145535ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/deriving_json/000077500000000000000000000000001357507750000174135ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/deriving_json/deriving_Json.ml000066400000000000000000000232711357507750000225520ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright Grégoire Henry 2010. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Json **) open! Deriving_Json_import module Lexer = Deriving_Json_lexer type 'a t = { write : Buffer.t -> 'a -> unit ; read : Lexer.lexbuf -> 'a } let make write read = { write; read } let read t = t.read let write t = t.write let convert t f1 f2 = { write = (fun buf a -> t.write buf (f2 a)); read = (fun buf -> f1 (t.read buf)) } let to_string t v = let buf = Buffer.create 50 in t.write buf v; Buffer.contents buf (*let to_channel t oc v = let buf = Buffer.create 50 in t.write buf v; Buffer.output_buffer oc buf *) let from_string t s = t.read (Lexer.init_lexer (Lexing.from_string s)) (* let from_channel t ic = t.read (Lexer.init_lexer (Lexing.from_channel ic)) *) (** Deriver **) module type Json_min = sig type a val write : Buffer.t -> a -> unit val read : Lexer.lexbuf -> a end module type Json_min' = sig type a val write : Buffer.t -> a -> unit val read : Lexer.lexbuf -> a val match_variant : [ `Cst of int | `NCst of int ] -> bool val read_variant : Lexer.lexbuf -> [ `Cst of int | `NCst of int ] -> a end module type Json_min'' = sig type a val t : a t end module type Json_converter = sig type a type b val t : a t val from_ : a -> b val to_ : b -> a end module type Json = sig type a val t : a t val write : Buffer.t -> a -> unit val read : Lexer.lexbuf -> a val to_string : a -> string (* val to_channel: out_channel -> a -> unit *) val from_string : string -> a (* val from_channel: in_channel -> a *) val match_variant : [ `Cst of int | `NCst of int ] -> bool val read_variant : Lexer.lexbuf -> [ `Cst of int | `NCst of int ] -> a end module Defaults (J : Json_min) : Json with type a = J.a = struct include J let t = { write; read } let to_string v = to_string t v (* let to_channel oc v = to_channel t oc v *) let from_string s = from_string t s (* let from_channel ic = from_channel t ic *) let match_variant _hash = assert false let read_variant _buf _hash = assert false end module Defaults' (J : Json_min') : Json with type a = J.a = struct include J let t = { write; read } let to_string v = to_string t v (* let to_channel oc v = to_channel t oc v *) let from_string s = from_string t s (* let from_channel ic = from_channel t ic *) end module Defaults'' (J : Json_min'') : Json with type a = J.a = struct include J let read = t.read let write = t.write let to_string v = to_string t v (* let to_channel oc v = to_channel t oc v *) let from_string s = from_string t s (* let from_channel ic = from_channel t ic *) let match_variant _hash = assert false let read_variant _buf _hash = assert false end module Convert (J : Json_converter) : Json with type a = J.b = struct module Tmp : Json with type a = J.b = Defaults'' (struct type a = J.b let t = convert J.t J.from_ J.to_ end) include Tmp end (** Predefs *) module Json_undef (T : sig type a end) = Defaults (struct type a = T.a let write _buf _ = failwith "Unimplemented" let read _buf = failwith "Unimplemented" end) module Json_char = Defaults (struct type a = char let write buffer c = Buffer.add_string buffer (string_of_int (int_of_char c)) let read buf = char_of_int (Lexer.read_bounded_int ~max:255 buf) end) module Json_bool = Defaults (struct type a = bool let write buffer b = Buffer.add_char buffer (if b then '1' else '0') let read buf = 1 = Lexer.read_tag_2 0 1 buf end) module Json_unit = Defaults (struct type a = unit let write buffer () = Buffer.add_char buffer '0' let read buf = ignore (Lexer.read_tag_1 0 buf) end) module Json_int = Defaults (struct type a = int let write buffer i = Printf.bprintf buffer "%d" i let read buf = Lexer.read_int buf end) module Json_int32 = Defaults (struct type a = int32 let write buffer i = Printf.bprintf buffer "%ld" i let read buf = Lexer.read_int32 buf end) module Json_int64 = Defaults (struct type a = int64 let mask24 = Int64.of_int 0xffffff let mask16 = Int64.of_int 0xffff let write buffer i = Printf.bprintf buffer "[255,%Ld,%Ld,%Ld]" (Int64.logand i mask24) (Int64.logand (Int64.shift_right i 24) mask24) (Int64.logand (Int64.shift_right i 48) mask16) let read buf = Lexer.read_lbracket buf; ignore (Lexer.read_tag_1 255 buf); Lexer.read_comma buf; let h1 = Lexer.read_int64 buf in Lexer.read_comma buf; let h2 = Int64.shift_left (Lexer.read_int64 buf) 24 in Lexer.read_comma buf; let h3 = Int64.shift_left (Lexer.read_int64 buf) 48 in Lexer.read_rbracket buf; Int64.logor h3 (Int64.logor h2 h1) end) module Json_nativeint = Json_undef (struct type a = nativeint end) (* module Json_num = Json_undef(struct type a = Num.num end) *) module Json_float = Defaults (struct type a = float let write buffer f = (* "%.15g" can be (much) shorter; "%.17g" is round-trippable *) let s = Printf.sprintf "%.15g" f in if Poly.(float_of_string s = f) then Buffer.add_string buffer s else Printf.bprintf buffer "%.17g" f let read buf = Lexer.read_number buf end) module Json_string = Defaults (struct (* Given that JSON must be valid UTF-8 and that OCaml string are just a sequence of byte we need to "embed" byte string in an UTF-8 sequence. Each byte af an OCaml string is considered as Unicode code point (< 256) and then encoded in UTF-8. Hence, bytes greater than 127 are "wrapped" in two bytes. *) type a = string let write buffer s = Buffer.add_char buffer '\"'; for i = 0 to String.length s - 1 do match s.[i] with | '\"' -> Buffer.add_string buffer "\\\"" | '\\' -> Buffer.add_string buffer "\\\\" | '\b' -> Buffer.add_string buffer "\\b" | '\x0C' -> Buffer.add_string buffer "\\f" | '\n' -> Buffer.add_string buffer "\\n" | '\r' -> Buffer.add_string buffer "\\r" | '\t' -> Buffer.add_string buffer "\\t" | c when Poly.(c <= '\x1F') -> (* Other control characters are escaped. *) Printf.bprintf buffer "\\u%04X" (int_of_char c) | c when Poly.(c < '\x80') -> Buffer.add_char buffer s.[i] | _c (* >= '\x80' *) -> (* Bytes greater than 127 are embedded in a UTF-8 sequence. *) Buffer.add_char buffer (Char.chr (0xC2 lor (Char.code s.[i] lsr 6))); Buffer.add_char buffer (Char.chr (0x80 lor (Char.code s.[i] land 0x3F))) done; Buffer.add_char buffer '\"' let read buf = Lexer.read_string buf end) let read_list f buf = let rec aux l c = match Lexer.read_case buf with | `Cst 0 -> for _i = c downto 1 do Lexer.read_rbracket buf done; List.rev l | `NCst 0 -> Lexer.read_comma buf; let x = f buf in Lexer.read_comma buf; aux (x :: l) (succ c) | _ -> Lexer.tag_error ~typename:"list" buf in aux [] 0 let write_list f buffer xs = let rec aux l c = match l with | [] -> Buffer.add_char buffer '0'; for _i = c downto 1 do Buffer.add_char buffer ']' done | x :: xs -> Printf.bprintf buffer "[0,%a," f x; aux xs (succ c) in aux xs 0 module Json_list (A : Json) = Defaults (struct type a = A.a list let read = read_list A.read let write = write_list A.write end) let read_ref f buf = match Lexer.read_case buf with | `NCst 0 -> Lexer.read_comma buf; let x = f buf in Lexer.read_rbracket buf; ref x | _ -> Lexer.tag_error ~typename:"ref" buf let write_ref f buffer r = Printf.bprintf buffer "[0,%a]" f !r module Json_ref (A : Json) = Defaults (struct type a = A.a ref let write = write_ref A.write let read = read_ref A.read end) let read_option f buf = match Lexer.read_case buf with | `Cst 0 -> None | `NCst 0 -> Lexer.read_comma buf; let x = f buf in Lexer.read_rbracket buf; Some x | _ -> Lexer.tag_error ~typename:"option" buf let write_option f buffer o = match o with | None -> Buffer.add_char buffer '0' | Some x -> Printf.bprintf buffer "[0,%a]" f x module Json_option (A : Json) = Defaults (struct type a = A.a option let read = read_option A.read let write = write_option A.write end) let read_array f buf = let rec read_list acc buf = match Lexer.read_comma_or_rbracket buf with | `RBracket -> acc | `Comma -> let x = f buf in read_list (x :: acc) buf in match Lexer.read_case buf with (* We allow the tag 254 in case of float array *) | `NCst 0 | `NCst 254 -> Array.of_list (List.rev (read_list [] buf)) | _ -> Lexer.tag_error ~typename:"array" buf let write_array f buffer a = Buffer.add_string buffer "[0"; for i = 0 to Array.length a - 1 do Buffer.add_char buffer ','; f buffer a.(i) done; Buffer.add_char buffer ']' module Json_array (A : Json) = Defaults (struct type a = A.a array let read = read_array A.read let write = write_array A.write end) js_of_ocaml-3.5.2/lib/deriving_json/deriving_Json.mli000066400000000000000000000131371357507750000227230ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright Grégoire Henry 2010. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Typesafe IO (based on the {i deriving} library). @see the source code of {i deriving} @see the documentation of the original {i deriving} library by Jeremy Yallop. *) type 'a t (** The type of JSON parser/printer for value of type ['a]. *) val make : (Buffer.t -> 'a -> unit) -> (Deriving_Json_lexer.lexbuf -> 'a) -> 'a t val write : 'a t -> Buffer.t -> 'a -> unit val read : 'a t -> Deriving_Json_lexer.lexbuf -> 'a val to_string : 'a t -> 'a -> string (** [to_string Json.t v] marshal the [v] of type [ty] to a JSON string.*) val from_string : 'a t -> string -> 'a (** [from_string Json.t s] safely unmarshal the JSON [s] into an OCaml value of type [ty]. Throws [Failure] if the received value isn't the javascript representation of a value of type [ty]. *) (** The signature of the JSON class. *) module type Json = sig type a val t : a t val write : Buffer.t -> a -> unit val read : Deriving_Json_lexer.lexbuf -> a val to_string : a -> string val from_string : string -> a (**/**) val match_variant : [ `Cst of int | `NCst of int ] -> bool val read_variant : Deriving_Json_lexer.lexbuf -> [ `Cst of int | `NCst of int ] -> a end (**/**) (** {2 Conversion } *) val convert : 'a t -> ('a -> 'b) -> ('b -> 'a) -> 'b t (** [convert (t : 'a t) (from_ : 'a -> 'b) (to_ : 'b -> 'a)] generate a JSON parser/printer for value of type ['b] using the parser/printer of type ['a] provided by [t] *) (** The signature of the Converter class. *) module type Json_converter = sig type a type b val t : a t val from_ : a -> b val to_ : b -> a end (** Generate a JSON class from a Converter *) module Convert (J : Json_converter) : Json with type a = J.b (** {3 Examples } *) (** Parse and serialize a map as if it was an array of tuple. {[ (* My map module *) module StringMap = Map.Make(String) (* Use deriving_json syntax to generate the JSON class for the array of tuple *) type 'a t = (string * 'a) array deriving (Json) (* generate the JSON class for StringMap *) module Json_string_map_t(A : Deriving_Json.Json) : Deriving_Json.Json with type a = A.a StringMap.t = struct module S = Json_t(A) include Deriving_Json.Convert(struct type a = A.a t type b = A.a StringMap.t let t = S.t let to_ : b -> A.a t = fun a -> Array.of_list (StringMap.bindings a) let from_ : A.a t -> b = fun l -> Array.fold_left (fun map (x,v) -> StringMap.add x v map) StringMap.empty l end) end ]} You can then ask the syntax extension to use the JSON class [Json_string_map_t] for [StringMap.t] by registering an alias {[Pa_deriving_Json.register_predefs ["StringMap";"t"] ["string_map_t"]]} *) (**/**) (** Deriver *) module type Json_min = sig type a val write : Buffer.t -> a -> unit val read : Deriving_Json_lexer.lexbuf -> a end module type Json_min' = sig type a val write : Buffer.t -> a -> unit val read : Deriving_Json_lexer.lexbuf -> a val match_variant : [ `Cst of int | `NCst of int ] -> bool val read_variant : Deriving_Json_lexer.lexbuf -> [ `Cst of int | `NCst of int ] -> a end module type Json_min'' = sig type a val t : a t end module Defaults (J : Json_min) : Json with type a = J.a module Defaults' (J : Json_min') : Json with type a = J.a module Defaults'' (J : Json_min'') : Json with type a = J.a module Json_char : Json with type a = char module Json_bool : Json with type a = bool module Json_unit : Json with type a = unit module Json_int : Json with type a = int module Json_int32 : Json with type a = int32 module Json_int64 : Json with type a = int64 module Json_nativeint : Json with type a = nativeint (* module Json_num : Json with type a = Num.num *) module Json_float : Json with type a = float module Json_string : Json with type a = string module Json_list (A : Json) : Json with type a = A.a list module Json_ref (A : Json) : Json with type a = A.a ref module Json_option (A : Json) : Json with type a = A.a option module Json_array (A : Json) : Json with type a = A.a array val read_list : (Deriving_Json_lexer.lexbuf -> 'a) -> Deriving_Json_lexer.lexbuf -> 'a list val write_list : (Buffer.t -> 'a -> unit) -> Buffer.t -> 'a list -> unit val read_ref : (Deriving_Json_lexer.lexbuf -> 'a) -> Deriving_Json_lexer.lexbuf -> 'a ref val write_ref : (Buffer.t -> 'a -> unit) -> Buffer.t -> 'a ref -> unit val read_option : (Deriving_Json_lexer.lexbuf -> 'a) -> Deriving_Json_lexer.lexbuf -> 'a option val write_option : (Buffer.t -> 'a -> unit) -> Buffer.t -> 'a option -> unit val read_array : (Deriving_Json_lexer.lexbuf -> 'a) -> Deriving_Json_lexer.lexbuf -> 'a array val write_array : (Buffer.t -> 'a -> unit) -> Buffer.t -> 'a array -> unit js_of_ocaml-3.5.2/lib/deriving_json/deriving_Json_import.ml000066400000000000000000000036031357507750000241410ustar00rootroot00000000000000(* Js_of_ocaml * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Poly = struct external ( < ) : 'a -> 'a -> bool = "%lessthan" external ( <= ) : 'a -> 'a -> bool = "%lessequal" external ( <> ) : 'a -> 'a -> bool = "%notequal" external ( = ) : 'a -> 'a -> bool = "%equal" external ( > ) : 'a -> 'a -> bool = "%greaterthan" external ( >= ) : 'a -> 'a -> bool = "%greaterequal" external compare : 'a -> 'a -> int = "%compare" external equal : 'a -> 'a -> bool = "%equal" end module Int_replace_polymorphic_compare = struct let ( < ) (x : int) y = x < y let ( <= ) (x : int) y = x <= y let ( <> ) (x : int) y = x <> y let ( = ) (x : int) y = x = y let ( > ) (x : int) y = x > y let ( >= ) (x : int) y = x >= y let compare (x : int) y = compare x y let equal (x : int) y = x = y let max (x : int) y = if x >= y then x else y let min (x : int) y = if x <= y then x else y end module String = struct include String let equal (x : string) (y : string) = Poly.equal x y end module Char = struct include Char let equal (x : char) (y : char) = Poly.equal x y end include Int_replace_polymorphic_compare js_of_ocaml-3.5.2/lib/deriving_json/deriving_Json_lexer.mli000066400000000000000000000042201357507750000241130ustar00rootroot00000000000000(* Copyright (c) 2010 Martin Jambon Copyright (c) 2010 Grégoire Henry All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *) type lexbuf val init_lexer : ?buf:Buffer.t -> Lexing.lexbuf -> lexbuf (** Create a fresh lexbuf record. *) val tag_error : typename:string -> lexbuf -> 'a val read_int : lexbuf -> int val read_bounded_int : ?min:int -> max:int -> lexbuf -> int val read_tag_1 : int -> lexbuf -> int val read_tag_2 : int -> int -> lexbuf -> int val read_int32 : lexbuf -> int32 val read_int64 : lexbuf -> int64 val read_number : lexbuf -> float val read_string : lexbuf -> string val read_case : lexbuf -> [ `Cst of int | `NCst of int ] val read_vcase : lexbuf -> [ `Cst of int | `NCst of int ] val read_comma : lexbuf -> unit val read_lbracket : lexbuf -> unit val read_rbracket : lexbuf -> unit val read_comma_or_rbracket : lexbuf -> [ `Comma | `RBracket ] js_of_ocaml-3.5.2/lib/deriving_json/deriving_Json_lexer.mll000066400000000000000000000276731357507750000241370ustar00rootroot00000000000000(* Copyright (c) 2010 Martin Jambon Copyright (c) 2010 Grégoire Henry All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *) { open! Deriving_Json_import module Lexing = (* We override Lexing.engine in order to avoid creating a new position record each time a rule is matched. This reduces total parsing time by about 31%. *) struct include Lexing external c_engine : lex_tables -> int -> lexbuf -> int = "caml_lex_engine" let engine tbl state buf = let result = c_engine tbl state buf in (* if result >= 0 then begin buf.lex_start_p <- buf.lex_curr_p; buf.lex_curr_p <- {buf.lex_curr_p with pos_cnum = buf.lex_abs_pos + buf.lex_curr_pos}; end; *) result end open Printf open Lexing type lexbuf = { buf : Buffer.t; (* Buffer used to accumulate substrings *) mutable lnum : int; (* Current line number (starting from 1) *) mutable bol : int; (* Absolute position of the first character of the current line (starting from 0) *) lexbuf : Lexing.lexbuf; } let dec c = Char.code c - 48 let hex c = match c with '0'..'9' -> int_of_char c - int_of_char '0' | 'a'..'f' -> int_of_char c - int_of_char 'a' + 10 | 'A'..'F' -> int_of_char c - int_of_char 'A' + 10 | _ -> assert false let json_error msg = failwith ("Deriving.Json: " ^ msg) let custom_error descr v lexbuf = let offs = lexbuf.lex_abs_pos in let bol = v.bol in let pos1 = offs + lexbuf.lex_start_pos - bol in let pos2 = max pos1 (offs + lexbuf.lex_curr_pos - bol - 1) in let bytes = if pos1 = pos2 then sprintf "byte %i" (pos1+1) else sprintf "bytes %i-%i" (pos1+1) (pos2+1) in let msg = sprintf "Line %i, %s:\n%s" v.lnum bytes descr in json_error msg let eof_error v lexbuf = custom_error "Unexpected end of input" v lexbuf let byte_error v lexbuf = custom_error "Unexpected byte in string" v lexbuf let tag_error ~typename v = custom_error (Printf.sprintf "Unexpected constructor %s for Json_%s" (Lexing.lexeme v.lexbuf) typename) v v.lexbuf let lexer_error descr v lexbuf = custom_error (sprintf "%s '%s'" descr (Lexing.lexeme lexbuf)) v lexbuf let min10 = min_int / 10 - (if min_int mod 10 = 0 then 0 else 1) let max10 = max_int / 10 + (if max_int mod 10 = 0 then 0 else 1) exception Int_overflow let extract_positive_int lexbuf = let start = lexbuf.lex_start_pos in let stop = lexbuf.lex_curr_pos in let s = lexbuf.lex_buffer in let n = ref 0 in for i = start to stop - 1 do if !n >= max10 then raise Int_overflow else n := 10 * !n + dec (Bytes.get s i) done; if !n < 0 then raise Int_overflow else !n let extract_negative_int lexbuf = let start = lexbuf.lex_start_pos + 1 in let stop = lexbuf.lex_curr_pos in let s = lexbuf.lex_buffer in let n = ref 0 in for i = start to stop - 1 do if !n <= min10 then raise Int_overflow else n := 10 * !n - dec (Bytes.get s i) done; if !n > 0 then raise Int_overflow else !n let newline v lexbuf = v.lnum <- v.lnum + 1; v.bol <- lexbuf.lex_abs_pos + lexbuf.lex_curr_pos } let space = [' ' '\t' '\r']+ let digit = ['0'-'9'] let nonzero = ['1'-'9'] let digits = digit+ let frac = '.' digits let e = ['e' 'E']['+' '-']? let exp = e digits let positive_int = (digit | nonzero digits) let float = '-'? positive_int (frac | exp | frac exp) let number = '-'? positive_int (frac | exp | frac exp)? let hex = [ '0'-'9' 'a'-'f' 'A'-'F' ] let ident = ['a'-'z' 'A'-'Z' '_']['a'-'z' 'A'-'Z' '_' '0'-'9']* rule finish_string v = parse '"' { Buffer.contents v.buf } | '\\' { finish_escaped_char v lexbuf; finish_string v lexbuf } | _ as c { if Poly.(c < '\x80') then Buffer.add_char v.buf c else finish_utf8_encoded_byte v c lexbuf; finish_string v lexbuf } | eof { eof_error v lexbuf } and finish_utf8_encoded_byte v c1 = parse | _ as c2 { (* Even if encoded in UTF-8, a byte could not be greater than 255 ! *) if Poly.('\xC2' <= c1) && Poly.(c1 < '\xC4') && Poly.('\x80' <= c2) && Poly.(c2 < '\xC0') then let c = ((Char.code c1 lsl 6) lor Char.code c2) land 0xFF in Buffer.add_char v.buf (Char.chr c) else byte_error v lexbuf } | eof { eof_error v lexbuf } and finish_escaped_char v = parse '"' | '\\' | '/' as c { Buffer.add_char v.buf c } | 'b' { Buffer.add_char v.buf '\b' } | 'f' { Buffer.add_char v.buf '\012' } | 'n' { Buffer.add_char v.buf '\n' } | 'r' { Buffer.add_char v.buf '\r' } | 't' { Buffer.add_char v.buf '\t' } | 'u' (hex as a) (hex as b) (hex as c) (hex as d) { (* Even if encoded in UTF-8, a byte could not be greater than 255 ! *) if hex a = 0 && hex b = 0 then let c = (hex c lsl 4) lor hex d in Buffer.add_char v.buf (Char.chr c) else byte_error v lexbuf } | _ { lexer_error "Invalid escape sequence" v lexbuf } | eof { eof_error v lexbuf } and read_comma v = parse | ',' { () } | _ { lexer_error "Expected ',' but found" v lexbuf } | eof { eof_error v lexbuf } and read_comma_or_rbracket v = parse | ',' { `Comma } | ']' { `RBracket } | _ { lexer_error "Expected ',' or ']' but found" v lexbuf } | eof { eof_error v lexbuf } and finish_comment v = parse | "*/" { () } | eof { lexer_error "Unterminated comment" v lexbuf } | '\n' { newline v lexbuf; finish_comment v lexbuf } | _ { finish_comment v lexbuf } (* Readers expecting a particular JSON construct *) and read_space v = parse | "//"[^'\n']* ('\n'|eof) { newline v lexbuf; read_space v lexbuf } | "/*" { finish_comment v lexbuf; read_space v lexbuf } | '\n' { newline v lexbuf; read_space v lexbuf } | [' ' '\t' '\r']+ { read_space v lexbuf } | "" { () } and read_int v = parse positive_int { try extract_positive_int lexbuf with Int_overflow -> lexer_error "Int overflow" v lexbuf } | '-' positive_int { try extract_negative_int lexbuf with Int_overflow -> lexer_error "Int overflow" v lexbuf } | _ { lexer_error "Expected integer but found" v lexbuf } | eof { eof_error v lexbuf } and read_positive_int v = parse positive_int { try extract_positive_int lexbuf with Int_overflow -> lexer_error "Int overflow" v lexbuf } | _ { lexer_error "Expected integer but found" v lexbuf } | eof { eof_error v lexbuf } and read_int32 v = parse '-'? positive_int { try Int32.of_string (Lexing.lexeme lexbuf) with _ -> lexer_error "Int32 overflow" v lexbuf } | _ { lexer_error "Expected int32 but found" v lexbuf } | eof { eof_error v lexbuf } and read_int64 v = parse '-'? positive_int { try Int64.of_string (Lexing.lexeme lexbuf) with _ -> lexer_error "Int32 overflow" v lexbuf } | _ { lexer_error "Expected int64 but found" v lexbuf } | eof { eof_error v lexbuf } and read_number v = parse | "NaN" { nan } | "Infinity" { infinity } | "-Infinity" { neg_infinity } | number { float_of_string (lexeme lexbuf) } | _ { lexer_error "Expected number but found" v lexbuf } | eof { eof_error v lexbuf } and read_string v = parse '"' { Buffer.clear v.buf; finish_string v lexbuf } | _ { lexer_error "Expected '\"' but found" v lexbuf } | eof { eof_error v lexbuf } and read_lbracket v = parse '[' { () } | _ { lexer_error "Expected '[' but found" v lexbuf } | eof { eof_error v lexbuf } and read_rbracket v = parse ']' { () } | _ { lexer_error "Expected ']' but found" v lexbuf } | eof { eof_error v lexbuf } and read_case v = parse | positive_int { try `Cst (extract_positive_int lexbuf) with Int_overflow -> lexer_error "Int overflow" v lexbuf } | '[' { read_space v lexbuf; `NCst (read_positive_int v lexbuf) } | _ { lexer_error "Expected positive integer or '[' but found" v lexbuf } | eof { eof_error v lexbuf } and read_vcase v = parse | positive_int { try `Cst (extract_positive_int lexbuf) with Int_overflow -> lexer_error "Int overflow" v lexbuf } | '-'? positive_int { try `Cst (extract_negative_int lexbuf) with Int_overflow -> lexer_error "Int overflow" v lexbuf } | '[' { read_space v lexbuf; let zero = read_positive_int v lexbuf in if (zero <> 0) then lexer_error (Printf.sprintf "Expected 0 but found %d" zero) v lexbuf; read_space v lexbuf; read_comma v lexbuf; read_space v lexbuf; `NCst (read_int v lexbuf) } | _ { lexer_error "Expected positive integer or '[' but found" v lexbuf } | eof { eof_error v lexbuf } { let init_lexer ?buf lexbuf = let buf = match buf with None -> Buffer.create 256 | Some buf -> buf in { buf = buf; lnum = 1; bol = 0; lexbuf = lexbuf; } let read_bounded_int min max v lexbuf = let n = read_int v lexbuf in if n < min || n > max then lexer_error (Printf.sprintf "Int outside of bounds [%d - %d]" min max) v lexbuf else n let read_tag_1 n v lexbuf = if n = read_int v lexbuf then n else lexer_error (Printf.sprintf "Int expected to be %d" n) v lexbuf let read_tag_2 n1 n2 v lexbuf = let n = read_int v lexbuf in if n = n1 || n = n2 then n else lexer_error (Printf.sprintf "Int expected to be either %d or %d" n1 n2) v lexbuf let read_int v = read_space v v.lexbuf; read_int v v.lexbuf let read_bounded_int ?(min = 0) ~max v = read_space v v.lexbuf; read_bounded_int min max v v.lexbuf let read_tag_1 n v = read_space v v.lexbuf; read_tag_1 n v v.lexbuf let read_tag_2 n1 n2 v = read_space v v.lexbuf; read_tag_2 n1 n2 v v.lexbuf let read_int32 v = read_space v v.lexbuf; read_int32 v v.lexbuf let read_int64 v = read_space v v.lexbuf; read_int64 v v.lexbuf let read_number v = read_space v v.lexbuf; read_number v v.lexbuf let read_string v = read_space v v.lexbuf; read_string v v.lexbuf let read_case v = read_space v v.lexbuf; read_case v v.lexbuf let read_vcase v = read_space v v.lexbuf; read_vcase v v.lexbuf let read_lbracket v = read_space v v.lexbuf; read_lbracket v v.lexbuf let read_rbracket v = read_space v v.lexbuf; read_rbracket v v.lexbuf let read_comma v = read_space v v.lexbuf; read_comma v v.lexbuf let read_comma_or_rbracket v = read_space v v.lexbuf; read_comma_or_rbracket v v.lexbuf } js_of_ocaml-3.5.2/lib/deriving_json/dune000066400000000000000000000003061357507750000202700ustar00rootroot00000000000000(library (name js_of_ocaml_deriving) (public_name js_of_ocaml.deriving) (synopsis "Runtime library for the class Json.") (libraries bytes) (wrapped false)) (ocamllex deriving_Json_lexer) js_of_ocaml-3.5.2/lib/deriving_json/tests/000077500000000000000000000000001357507750000205555ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/deriving_json/tests/dune000066400000000000000000000002561357507750000214360ustar00rootroot00000000000000(library (name deriving_expect_tests) (libraries unix js_of_ocaml js_of_ocaml.deriving) (inline_tests (modes js)) (preprocess (pps ppx_expect ppx_deriving_json)))js_of_ocaml-3.5.2/lib/deriving_json/tests/json_convert.ml000066400000000000000000000036751357507750000236330ustar00rootroot00000000000000(* Js_of_ocaml example * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* Json conversion *) open Js_of_ocaml let str = let b = Buffer.create 256 in for i = 0 to 255 do Buffer.add_char b (Char.chr i) done; Buffer.contents b [@@@ocaml.warning "-39"] type t = int list * float option * string [@@deriving json] let test t v = if v = Json.unsafe_input (Json.output v) then () else print_endline "Not equal"; if v = Deriving_Json.from_string t (Js.to_string (Json.output v)) then () else print_endline "Not equal"; if v = Json.unsafe_input (Js.string (Deriving_Json.to_string t v)) then () else print_endline "Not equal"; if v = Deriving_Json.from_string t (Deriving_Json.to_string t v) then () else print_endline "Not equal" let%expect_test _ = test json ([ 1; 2; 3 ], Some 1., str); [%expect {||}] type intseq = | Z | S of int * intseq [@@deriving json] let%expect_test _ = test intseq_json (S (1, S (2, S (3, Z)))); [%expect {||}] type 'a seq = | ZZ | SS of 'a * 'a seq [@@deriving json] type w = int seq [@@deriving json] let%expect_test _ = test w_json (SS (1, SS (2, SS (3, ZZ)))); [%expect {||}] js_of_ocaml-3.5.2/lib/js_of_ocaml/000077500000000000000000000000001357507750000170265ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/js_of_ocaml/cSS.ml000066400000000000000000000762151357507750000200630ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Raphaël Proust * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import module Color = struct (*The type of CSS colors. First by name and then by constructor.*) type name = | Aliceblue | Antiquewhite | Aqua | Aquamarine | Azure | Beige | Bisque | Black | Blanchedalmond | Blue | Blueviolet | Brown | Burlywood | Cadetblue | Chartreuse | Chocolate | Coral | Cornflowerblue | Cornsilk | Crimson | Cyan | Darkblue | Darkcyan | Darkgoldenrod | Darkgray | Darkgreen | Darkgrey | Darkkhaki | Darkmagenta | Darkolivegreen | Darkorange | Darkorchid | Darkred | Darksalmon | Darkseagreen | Darkslateblue | Darkslategray | Darkslategrey | Darkturquoise | Darkviolet | Deeppink | Deepskyblue | Dimgray | Dimgrey | Dodgerblue | Firebrick | Floralwhite | Forestgreen | Fuchsia | Gainsboro | Ghostwhite | Gold | Goldenrod | Gray | Grey | Green | Greenyellow | Honeydew | Hotpink | Indianred | Indigo | Ivory | Khaki | Lavender | Lavenderblush | Lawngreen | Lemonchiffon | Lightblue | Lightcoral | Lightcyan | Lightgoldenrodyellow | Lightgray | Lightgreen | Lightgrey | Lightpink | Lightsalmon | Lightseagreen | Lightskyblue | Lightslategray | Lightslategrey | Lightsteelblue | Lightyellow | Lime | Limegreen | Linen | Magenta | Maroon | Mediumaquamarine | Mediumblue | Mediumorchid | Mediumpurple | Mediumseagreen | Mediumslateblue | Mediumspringgreen | Mediumturquoise | Mediumvioletred | Midnightblue | Mintcream | Mistyrose | Moccasin | Navajowhite | Navy | Oldlace | Olive | Olivedrab | Orange | Orangered | Orchid | Palegoldenrod | Palegreen | Paleturquoise | Palevioletred | Papayawhip | Peachpuff | Peru | Pink | Plum | Powderblue | Purple | Red | Rosybrown | Royalblue | Saddlebrown | Salmon | Sandybrown | Seagreen | Seashell | Sienna | Silver | Skyblue | Slateblue | Slategray | Slategrey | Snow | Springgreen | Steelblue | Tan | Teal | Thistle | Tomato | Turquoise | Violet | Wheat | White | Whitesmoke | Yellow | Yellowgreen let string_of_name = function | Aliceblue -> "aliceblue" | Antiquewhite -> "antiquewhite" | Aqua -> "aqua" | Aquamarine -> "aquamarine" | Azure -> "azure" | Beige -> "beige" | Bisque -> "bisque" | Black -> "black" | Blanchedalmond -> "blanchedalmond" | Blue -> "blue" | Blueviolet -> "blueviolet" | Brown -> "brown" | Burlywood -> "burlywood" | Cadetblue -> "cadetblue" | Chartreuse -> "chartreuse" | Chocolate -> "chocolate" | Coral -> "coral" | Cornflowerblue -> "cornflowerblue" | Cornsilk -> "cornsilk" | Crimson -> "crimson" | Cyan -> "cyan" | Darkblue -> "darkblue" | Darkcyan -> "darkcyan" | Darkgoldenrod -> "darkgoldenrod" | Darkgray -> "darkgray" | Darkgreen -> "darkgreen" | Darkgrey -> "darkgrey" | Darkkhaki -> "darkkhaki" | Darkmagenta -> "darkmagenta" | Darkolivegreen -> "darkolivegreen" | Darkorange -> "darkorange" | Darkorchid -> "darkorchid" | Darkred -> "darkred" | Darksalmon -> "darksalmon" | Darkseagreen -> "darkseagreen" | Darkslateblue -> "darkslateblue" | Darkslategray -> "darkslategray" | Darkslategrey -> "darkslategrey" | Darkturquoise -> "darkturquoise" | Darkviolet -> "darkviolet" | Deeppink -> "deeppink" | Deepskyblue -> "deepskyblue" | Dimgray -> "dimgray" | Dimgrey -> "dimgrey" | Dodgerblue -> "dodgerblue" | Firebrick -> "firebrick" | Floralwhite -> "floralwhite" | Forestgreen -> "forestgreen" | Fuchsia -> "fuchsia" | Gainsboro -> "gainsboro" | Ghostwhite -> "ghostwhite" | Gold -> "gold" | Goldenrod -> "goldenrod" | Gray -> "gray" | Green -> "green" | Greenyellow -> "greenyellow" | Grey -> "grey" | Honeydew -> "honeydew" | Hotpink -> "hotpink" | Indianred -> "indianred" | Indigo -> "indigo" | Ivory -> "ivory" | Khaki -> "khaki" | Lavender -> "lavender" | Lavenderblush -> "lavenderblush" | Lawngreen -> "lawngreen" | Lemonchiffon -> "lemonchiffon" | Lightblue -> "lightblue" | Lightcoral -> "lightcoral" | Lightcyan -> "lightcyan" | Lightgoldenrodyellow -> "lightgoldenrodyellow" | Lightgray -> "lightgray" | Lightgreen -> "lightgreen" | Lightgrey -> "lightgrey" | Lightpink -> "lightpink" | Lightsalmon -> "lightsalmon" | Lightseagreen -> "lightseagreen" | Lightskyblue -> "lightskyblue" | Lightslategray -> "lightslategray" | Lightslategrey -> "lightslategrey" | Lightsteelblue -> "lightsteelblue" | Lightyellow -> "lightyellow" | Lime -> "lime" | Limegreen -> "limegreen" | Linen -> "linen" | Magenta -> "magenta" | Maroon -> "maroon" | Mediumaquamarine -> "mediumaquamarine" | Mediumblue -> "mediumblue" | Mediumorchid -> "mediumorchid" | Mediumpurple -> "mediumpurple" | Mediumseagreen -> "mediumseagreen" | Mediumslateblue -> "mediumslateblue" | Mediumspringgreen -> "mediumspringgreen" | Mediumturquoise -> "mediumturquoise" | Mediumvioletred -> "mediumvioletred" | Midnightblue -> "midnightblue" | Mintcream -> "mintcream" | Mistyrose -> "mistyrose" | Moccasin -> "moccasin" | Navajowhite -> "navajowhite" | Navy -> "navy" | Oldlace -> "oldlace" | Olive -> "olive" | Olivedrab -> "olivedrab" | Orange -> "orange" | Orangered -> "orangered" | Orchid -> "orchid" | Palegoldenrod -> "palegoldenrod" | Palegreen -> "palegreen" | Paleturquoise -> "paleturquoise" | Palevioletred -> "palevioletred" | Papayawhip -> "papayawhip" | Peachpuff -> "peachpuff" | Peru -> "peru" | Pink -> "pink" | Plum -> "plum" | Powderblue -> "powderblue" | Purple -> "purple" | Red -> "red" | Rosybrown -> "rosybrown" | Royalblue -> "royalblue" | Saddlebrown -> "saddlebrown" | Salmon -> "salmon" | Sandybrown -> "sandybrown" | Seagreen -> "seagreen" | Seashell -> "seashell" | Sienna -> "sienna" | Silver -> "silver" | Skyblue -> "skyblue" | Slateblue -> "slateblue" | Slategray -> "slategray" | Slategrey -> "slategrey" | Snow -> "snow" | Springgreen -> "springgreen" | Steelblue -> "steelblue" | Tan -> "tan" | Teal -> "teal" | Thistle -> "thistle" | Tomato -> "tomato" | Turquoise -> "turquoise" | Violet -> "violet" | Wheat -> "wheat" | White -> "white" | Whitesmoke -> "whitesmoke" | Yellow -> "yellow" | Yellowgreen -> "yellowgreen" let name_of_string = function | "aliceblue" -> Aliceblue | "antiquewhite" -> Antiquewhite | "aqua" -> Aqua | "aquamarine" -> Aquamarine | "azure" -> Azure | "beige" -> Beige | "bisque" -> Bisque | "black" -> Black | "blanchedalmond" -> Blanchedalmond | "blue" -> Blue | "blueviolet" -> Blueviolet | "brown" -> Brown | "burlywood" -> Burlywood | "cadetblue" -> Cadetblue | "chartreuse" -> Chartreuse | "chocolate" -> Chocolate | "coral" -> Coral | "cornflowerblue" -> Cornflowerblue | "cornsilk" -> Cornsilk | "crimson" -> Crimson | "cyan" -> Cyan | "darkblue" -> Darkblue | "darkcyan" -> Darkcyan | "darkgoldenrod" -> Darkgoldenrod | "darkgray" -> Darkgray | "darkgreen" -> Darkgreen | "darkgrey" -> Darkgrey | "darkkhaki" -> Darkkhaki | "darkmagenta" -> Darkmagenta | "darkolivegreen" -> Darkolivegreen | "darkorange" -> Darkorange | "darkorchid" -> Darkorchid | "darkred" -> Darkred | "darksalmon" -> Darksalmon | "darkseagreen" -> Darkseagreen | "darkslateblue" -> Darkslateblue | "darkslategray" -> Darkslategray | "darkslategrey" -> Darkslategrey | "darkturquoise" -> Darkturquoise | "darkviolet" -> Darkviolet | "deeppink" -> Deeppink | "deepskyblue" -> Deepskyblue | "dimgray" -> Dimgray | "dimgrey" -> Dimgrey | "dodgerblue" -> Dodgerblue | "firebrick" -> Firebrick | "floralwhite" -> Floralwhite | "forestgreen" -> Forestgreen | "fuchsia" -> Fuchsia | "gainsboro" -> Gainsboro | "ghostwhite" -> Ghostwhite | "gold" -> Gold | "goldenrod" -> Goldenrod | "gray" -> Gray | "green" -> Green | "greenyellow" -> Greenyellow | "grey" -> Grey | "honeydew" -> Honeydew | "hotpink" -> Hotpink | "indianred" -> Indianred | "indigo" -> Indigo | "ivory" -> Ivory | "khaki" -> Khaki | "lavender" -> Lavender | "lavenderblush" -> Lavenderblush | "lawngreen" -> Lawngreen | "lemonchiffon" -> Lemonchiffon | "lightblue" -> Lightblue | "lightcoral" -> Lightcoral | "lightcyan" -> Lightcyan | "lightgoldenrodyellow" -> Lightgoldenrodyellow | "lightgray" -> Lightgray | "lightgreen" -> Lightgreen | "lightgrey" -> Lightgrey | "lightpink" -> Lightpink | "lightsalmon" -> Lightsalmon | "lightseagreen" -> Lightseagreen | "lightskyblue" -> Lightskyblue | "lightslategray" -> Lightslategray | "lightslategrey" -> Lightslategrey | "lightsteelblue" -> Lightsteelblue | "lightyellow" -> Lightyellow | "lime" -> Lime | "limegreen" -> Limegreen | "linen" -> Linen | "magenta" -> Magenta | "maroon" -> Maroon | "mediumaquamarine" -> Mediumaquamarine | "mediumblue" -> Mediumblue | "mediumorchid" -> Mediumorchid | "mediumpurple" -> Mediumpurple | "mediumseagreen" -> Mediumseagreen | "mediumslateblue" -> Mediumslateblue | "mediumspringgreen" -> Mediumspringgreen | "mediumturquoise" -> Mediumturquoise | "mediumvioletred" -> Mediumvioletred | "midnightblue" -> Midnightblue | "mintcream" -> Mintcream | "mistyrose" -> Mistyrose | "moccasin" -> Moccasin | "navajowhite" -> Navajowhite | "navy" -> Navy | "oldlace" -> Oldlace | "olive" -> Olive | "olivedrab" -> Olivedrab | "orange" -> Orange | "orangered" -> Orangered | "orchid" -> Orchid | "palegoldenrod" -> Palegoldenrod | "palegreen" -> Palegreen | "paleturquoise" -> Paleturquoise | "palevioletred" -> Palevioletred | "papayawhip" -> Papayawhip | "peachpuff" -> Peachpuff | "peru" -> Peru | "pink" -> Pink | "plum" -> Plum | "powderblue" -> Powderblue | "purple" -> Purple | "red" -> Red | "rosybrown" -> Rosybrown | "royalblue" -> Royalblue | "saddlebrown" -> Saddlebrown | "salmon" -> Salmon | "sandybrown" -> Sandybrown | "seagreen" -> Seagreen | "seashell" -> Seashell | "sienna" -> Sienna | "silver" -> Silver | "skyblue" -> Skyblue | "slateblue" -> Slateblue | "slategray" -> Slategray | "slategrey" -> Slategrey | "snow" -> Snow | "springgreen" -> Springgreen | "steelblue" -> Steelblue | "tan" -> Tan | "teal" -> Teal | "thistle" -> Thistle | "tomato" -> Tomato | "turquoise" -> Turquoise | "violet" -> Violet | "wheat" -> Wheat | "white" -> White | "whitesmoke" -> Whitesmoke | "yellow" -> Yellow | "yellowgreen" -> Yellowgreen | s -> raise (Invalid_argument (s ^ " is not a valid color name")) let rgb_of_name = function | Aliceblue -> 240, 248, 255 | Antiquewhite -> 250, 235, 215 | Aqua -> 0, 255, 255 | Aquamarine -> 127, 255, 212 | Azure -> 240, 255, 255 | Beige -> 245, 245, 220 | Bisque -> 255, 228, 196 | Black -> 0, 0, 0 | Blanchedalmond -> 255, 235, 205 | Blue -> 0, 0, 255 | Blueviolet -> 138, 43, 226 | Brown -> 165, 42, 42 | Burlywood -> 222, 184, 135 | Cadetblue -> 95, 158, 160 | Chartreuse -> 127, 255, 0 | Chocolate -> 210, 105, 30 | Coral -> 255, 127, 80 | Cornflowerblue -> 100, 149, 237 | Cornsilk -> 255, 248, 220 | Crimson -> 220, 20, 60 | Cyan -> 0, 255, 255 | Darkblue -> 0, 0, 139 | Darkcyan -> 0, 139, 139 | Darkgoldenrod -> 184, 134, 11 | Darkgray -> 169, 169, 169 | Darkgreen -> 0, 100, 0 | Darkgrey -> 169, 169, 169 | Darkkhaki -> 189, 183, 107 | Darkmagenta -> 139, 0, 139 | Darkolivegreen -> 85, 107, 47 | Darkorange -> 255, 140, 0 | Darkorchid -> 153, 50, 204 | Darkred -> 139, 0, 0 | Darksalmon -> 233, 150, 122 | Darkseagreen -> 143, 188, 143 | Darkslateblue -> 72, 61, 139 | Darkslategray -> 47, 79, 79 | Darkslategrey -> 47, 79, 79 | Darkturquoise -> 0, 206, 209 | Darkviolet -> 148, 0, 211 | Deeppink -> 255, 20, 147 | Deepskyblue -> 0, 191, 255 | Dimgray -> 105, 105, 105 | Dimgrey -> 105, 105, 105 | Dodgerblue -> 30, 144, 255 | Firebrick -> 178, 34, 34 | Floralwhite -> 255, 250, 240 | Forestgreen -> 34, 139, 34 | Fuchsia -> 255, 0, 255 | Gainsboro -> 220, 220, 220 | Ghostwhite -> 248, 248, 255 | Gold -> 255, 215, 0 | Goldenrod -> 218, 165, 32 | Gray -> 128, 128, 128 | Green -> 0, 128, 0 | Greenyellow -> 173, 255, 47 | Grey -> 128, 128, 128 | Honeydew -> 240, 255, 240 | Hotpink -> 255, 105, 180 | Indianred -> 205, 92, 92 | Indigo -> 75, 0, 130 | Ivory -> 255, 255, 240 | Khaki -> 240, 230, 140 | Lavender -> 230, 230, 250 | Lavenderblush -> 255, 240, 245 | Lawngreen -> 124, 252, 0 | Lemonchiffon -> 255, 250, 205 | Lightblue -> 173, 216, 230 | Lightcoral -> 240, 128, 128 | Lightcyan -> 224, 255, 255 | Lightgoldenrodyellow -> 250, 250, 210 | Lightgray -> 211, 211, 211 | Lightgreen -> 144, 238, 144 | Lightgrey -> 211, 211, 211 | Lightpink -> 255, 182, 193 | Lightsalmon -> 255, 160, 122 | Lightseagreen -> 32, 178, 170 | Lightskyblue -> 135, 206, 250 | Lightslategray -> 119, 136, 153 | Lightslategrey -> 119, 136, 153 | Lightsteelblue -> 176, 196, 222 | Lightyellow -> 255, 255, 224 | Lime -> 0, 255, 0 | Limegreen -> 50, 205, 50 | Linen -> 250, 240, 230 | Magenta -> 255, 0, 255 | Maroon -> 128, 0, 0 | Mediumaquamarine -> 102, 205, 170 | Mediumblue -> 0, 0, 205 | Mediumorchid -> 186, 85, 211 | Mediumpurple -> 147, 112, 219 | Mediumseagreen -> 60, 179, 113 | Mediumslateblue -> 123, 104, 238 | Mediumspringgreen -> 0, 250, 154 | Mediumturquoise -> 72, 209, 204 | Mediumvioletred -> 199, 21, 133 | Midnightblue -> 25, 25, 112 | Mintcream -> 245, 255, 250 | Mistyrose -> 255, 228, 225 | Moccasin -> 255, 228, 181 | Navajowhite -> 255, 222, 173 | Navy -> 0, 0, 128 | Oldlace -> 253, 245, 230 | Olive -> 128, 128, 0 | Olivedrab -> 107, 142, 35 | Orange -> 255, 165, 0 | Orangered -> 255, 69, 0 | Orchid -> 218, 112, 214 | Palegoldenrod -> 238, 232, 170 | Palegreen -> 152, 251, 152 | Paleturquoise -> 175, 238, 238 | Palevioletred -> 219, 112, 147 | Papayawhip -> 255, 239, 213 | Peachpuff -> 255, 218, 185 | Peru -> 205, 133, 63 | Pink -> 255, 192, 203 | Plum -> 221, 160, 221 | Powderblue -> 176, 224, 230 | Purple -> 128, 0, 128 | Red -> 255, 0, 0 | Rosybrown -> 188, 143, 143 | Royalblue -> 65, 105, 225 | Saddlebrown -> 139, 69, 19 | Salmon -> 250, 128, 114 | Sandybrown -> 244, 164, 96 | Seagreen -> 46, 139, 87 | Seashell -> 255, 245, 238 | Sienna -> 160, 82, 45 | Silver -> 192, 192, 192 | Skyblue -> 135, 206, 235 | Slateblue -> 106, 90, 205 | Slategray -> 112, 128, 144 | Slategrey -> 112, 128, 144 | Snow -> 255, 250, 250 | Springgreen -> 0, 255, 127 | Steelblue -> 70, 130, 180 | Tan -> 210, 180, 140 | Teal -> 0, 128, 128 | Thistle -> 216, 191, 216 | Tomato -> 255, 99, 71 | Turquoise -> 64, 224, 208 | Violet -> 238, 130, 238 | Wheat -> 245, 222, 179 | White -> 255, 255, 255 | Whitesmoke -> 245, 245, 245 | Yellow -> 255, 255, 0 | Yellowgreen -> 154, 205, 50 type t = | Name of name | RGB of (int * int * int) (**Red, Green and Blue values. Clipped to [[0..255]] by most (All?) browsers.*) | RGB_percent of (int * int * int) (**RGB channels are specified as a percentage of their maximal value.*) | RGBA of (int * int * int * float) (**Same as RGB with additional transparency argument. Opacity should be in [0.] (completely transparent) and [1.] (completely opaque).*) | RGBA_percent of (int * int * int * float) (**RGB channels specified as percentage of their maximal value. Alpha channel (opacity) is still a [0.] to [1.] float.*) | HSL of (int * int * int) (**Hue, Saturation and Lightness values. Hue is an angle in degree (in interval [[0..360[]). Saturation is a percentage ([[0..100]]) with [0] being colorless. Lightness is also a percentage ([[0..100]]) with [0] being black.*) | HSLA of (int * int * int * float) (**Same as HSL with an opacity argument between [0.] and [1.].*) let rgb ?a r g b = match a with | None -> RGB (r, g, b) | Some a -> RGBA (r, g, b, a) let hsl ?a h s l = match a with | None -> HSL (h, s, l) | Some a -> HSLA (h, s, l, a) let string_of_t = function | Name n -> string_of_name n | RGB (r, g, b) -> Printf.sprintf "rgb(%d,%d,%d)" r g b | RGB_percent (r, g, b) -> Printf.sprintf "rgb(%d%%,%d%%,%d%%)" r g b | RGBA (r, g, b, a) -> Printf.sprintf "rgba(%d,%d,%d,%f)" r g b a | RGBA_percent (r, g, b, a) -> Printf.sprintf "rgba(%d%%,%d%%,%d%%,%f)" r g b a | HSL (h, s, l) -> Printf.sprintf "hsl(%d,%d%%,%d%%)" h s l | HSLA (h, s, l, a) -> Printf.sprintf "hsla(%d,%d%%,%d%%,%f)" h s l a let hex_of_rgb (red, green, blue) = let in_range i = if i < 0 || i > 255 then raise (Invalid_argument (string_of_int i ^ " is out of valid range")) in in_range red; in_range green; in_range blue; Printf.sprintf "#%02X%02X%02X" red green blue (*Ocaml <-> JS representation*) type js_t = Js.js_string Js.t (*TODO? be more restrictive, clip values into standard range*) let js_t_of_js_string s = let rgb_re = new%js Js.regExp (Js.bytestring "^rgb\\(\\s*\\d*,\\s*\\d*,\\s*\\d*\\)$") in let rgb_pct_re = new%js Js.regExp (Js.bytestring "^rgb\\(\\s*\\d*%,\\s*\\d*%,\\s*\\d*%\\)$") in let rgba_re = new%js Js.regExp (Js.bytestring "^rgba\\(\\s*\\d*,\\s*\\d*,\\s*\\d*,\\d*\\.?\\d*\\)$") in let rgba_pct_re = new%js Js.regExp (Js.bytestring "^rgba\\(\\s*\\d*%,\\s*\\d*%,\\s*\\d*%,\\d*\\.?\\d*\\)$") in let hsl_re = new%js Js.regExp (Js.bytestring "^hsl\\(\\s*\\d*,\\s*\\d*%,\\s*\\d*%\\)$") in let hsla_re = new%js Js.regExp (Js.bytestring "^hsla\\(\\s*\\d*,\\s*\\d*%,\\s*\\d*%,\\d*\\.?\\d*\\)$") in if Js.to_bool (rgb_re##test s) || Js.to_bool (rgba_re##test s) || Js.to_bool (rgb_pct_re##test s) || Js.to_bool (rgba_pct_re##test s) || Js.to_bool (hsl_re##test s) || Js.to_bool (hsla_re##test s) then s else if List.mem (Js.to_string s) [ "aliceblue" ; "antiquewhite" ; "aqua" ; "aquamarine" ; "azure" ; "beige" ; "bisque" ; "black" ; "blanchedalmond" ; "blue" ; "blueviolet" ; "brown" ; "burlywood" ; "cadetblue" ; "chartreuse" ; "chocolate" ; "coral" ; "cornflowerblue" ; "cornsilk" ; "crimson" ; "cyan" ; "darkblue" ; "darkcyan" ; "darkgoldenrod" ; "darkgray" ; "darkgreen" ; "darkgrey" ; "darkkhaki" ; "darkmagenta" ; "darkolivegreen" ; "darkorange" ; "darkorchid" ; "darkred" ; "darksalmon" ; "darkseagreen" ; "darkslateblue" ; "darkslategray" ; "darkslategrey" ; "darkturquoise" ; "darkviolet" ; "deeppink" ; "deepskyblue" ; "dimgray" ; "dimgrey" ; "dodgerblue" ; "firebrick" ; "floralwhite" ; "forestgreen" ; "fuchsia" ; "gainsboro" ; "ghostwhite" ; "gold" ; "goldenrod" ; "gray" ; "green" ; "greenyellow" ; "grey" ; "honeydew" ; "hotpink" ; "indianred" ; "indigo" ; "ivory" ; "khaki" ; "lavender" ; "lavenderblush" ; "lawngreen" ; "lemonchiffon" ; "lightblue" ; "lightcoral" ; "lightcyan" ; "lightgoldenrodyellow" ; "lightgray" ; "lightgreen" ; "lightgrey" ; "lightpink" ; "lightsalmon" ; "lightseagreen" ; "lightskyblue" ; "lightslategray" ; "lightslategrey" ; "lightsteelblue" ; "lightyellow" ; "lime" ; "limegreen" ; "linen" ; "magenta" ; "maroon" ; "mediumaquamarine" ; "mediumblue" ; "mediumorchid" ; "mediumpurple" ; "mediumseagreen" ; "mediumslateblue" ; "mediumspringgreen" ; "mediumturquoise" ; "mediumvioletred" ; "midnightblue" ; "mintcream" ; "mistyrose" ; "moccasin" ; "navajowhite" ; "navy" ; "oldlace" ; "olive" ; "olivedrab" ; "orange" ; "orangered" ; "orchid" ; "palegoldenrod" ; "palegreen" ; "paleturquoise" ; "palevioletred" ; "papayawhip" ; "peachpuff" ; "peru" ; "pink" ; "plum" ; "powderblue" ; "purple" ; "red" ; "rosybrown" ; "royalblue" ; "saddlebrown" ; "salmon" ; "sandybrown" ; "seagreen" ; "seashell" ; "sienna" ; "silver" ; "skyblue" ; "slateblue" ; "slategray" ; "slategrey" ; "snow" ; "springgreen" ; "steelblue" ; "tan" ; "teal" ; "thistle" ; "tomato" ; "turquoise" ; "violet" ; "wheat" ; "white" ; "whitesmoke" ; "yellow" ; "yellowgreen" ] then s else raise (Invalid_argument (Js.to_string s ^ " is not a valid color")) let name cn = Js.string (string_of_name cn) (*TODO? inline function calls*) let js = function | Name n -> name n | (RGB _ | RGB_percent _ | RGBA _ | RGBA_percent _ | HSL _ | HSLA _) as c -> Js.string (string_of_t c) let ml c = let s = Js.to_string c in try Name (name_of_string s) with Invalid_argument _ -> ( let fail () = raise (Invalid_argument (s ^ " is not a valid color")) in let re_rgb = Regexp.regexp "(rgba?)\\((?:(\\d*),(\\d*),(\\d*)(?:,(\\d*(?:\\.\\d*)?))?)\\)" in let re_rgb_pct = Regexp.regexp "(rgba?)\\((?:(\\d*)%,(\\d*)%,(\\d*)%(?:,(\\d*(?:\\.\\d*)?))?)\\)" in let re_hsl = Regexp.regexp "(hsla?)\\((?:(\\d*),(\\d*)%,(\\d*)%(?:,(\\d*(?:\\.\\d*)?))?)\\)" in let i_of_s_o = function | None -> fail () | Some i -> ( try int_of_string i with Invalid_argument s | Failure s -> raise (Invalid_argument ("color conversion error (" ^ i ^ "): " ^ s))) in let f_of_s f = try float_of_string f with Invalid_argument s | Failure s -> raise (Invalid_argument ("color conversion error (" ^ f ^ "): " ^ s)) in match Regexp.string_match re_rgb s 0 with | Some r -> ( let red = Regexp.matched_group r 2 in let green = Regexp.matched_group r 3 in let blue = Regexp.matched_group r 4 in let alpha = Regexp.matched_group r 5 in match Regexp.matched_group r 1 with | Some "rgb" -> ( match alpha with | Some _ -> fail () | None -> RGB (i_of_s_o red, i_of_s_o green, i_of_s_o blue)) | Some "rgba" -> ( match alpha with | None -> fail () | Some a -> RGBA (i_of_s_o red, i_of_s_o green, i_of_s_o blue, f_of_s a)) | Some _ | None -> fail ()) | None -> ( match Regexp.string_match re_rgb_pct s 0 with | Some r -> ( let red = Regexp.matched_group r 2 in let green = Regexp.matched_group r 3 in let blue = Regexp.matched_group r 4 in let alpha = Regexp.matched_group r 5 in match Regexp.matched_group r 1 with | Some "rgb" -> ( match alpha with | Some _ -> fail () | None -> RGB_percent (i_of_s_o red, i_of_s_o green, i_of_s_o blue)) | Some "rgba" -> ( match alpha with | None -> fail () | Some a -> RGBA_percent (i_of_s_o red, i_of_s_o green, i_of_s_o blue, f_of_s a) ) | Some _ | None -> fail ()) | None -> ( match Regexp.string_match re_hsl s 0 with | Some r -> ( let red = Regexp.matched_group r 2 in let green = Regexp.matched_group r 3 in let blue = Regexp.matched_group r 4 in let alpha = Regexp.matched_group r 5 in match Regexp.matched_group r 1 with | Some "hsl" -> ( match alpha with | Some _ -> fail () | None -> HSL (i_of_s_o red, i_of_s_o green, i_of_s_o blue)) | Some "hsla" -> ( match alpha with | None -> fail () | Some a -> HSLA (i_of_s_o red, i_of_s_o green, i_of_s_o blue, f_of_s a)) | Some _ | None -> fail ()) | None -> fail ()))) end module Length = struct (* http://www.w3.org/TR/css3-values/#lengths *) (*TODO: type js_t = private Js.string Js.t val js_t_of_t val t_of_js_t val t_of_string *) type t = | Zero (*relative*) | Em of float | Ex of float | Px of float | Gd of float | Rem of float | Vw of float | Vh of float | Vm of float | Ch of float (*absolute*) | Mm of float | Cm of float | In of float | Pt of float | Pc of float let string_of_t = function | Zero -> "0" | Em f -> Printf.sprintf "%f%s" f "em" | Ex f -> Printf.sprintf "%f%s" f "ex" | Px f -> Printf.sprintf "%f%s" f "px" | Gd f -> Printf.sprintf "%f%s" f "gd" | Rem f -> Printf.sprintf "%f%s" f "rem" | Vw f -> Printf.sprintf "%f%s" f "vw" | Vh f -> Printf.sprintf "%f%s" f "vh" | Vm f -> Printf.sprintf "%f%s" f "vm" | Ch f -> Printf.sprintf "%f%s" f "ch" | Mm f -> Printf.sprintf "%f%s" f "mm" | Cm f -> Printf.sprintf "%f%s" f "cm" | In f -> Printf.sprintf "%f%s" f "in" | Pt f -> Printf.sprintf "%f%s" f "pt" | Pc f -> Printf.sprintf "%f%s" f "pc" type js_t = Js.js_string Js.t let js t = Js.string (string_of_t t) let ml t = let s = Js.to_string t in if String.equal s "0" then Zero else let fail () = raise (Invalid_argument (s ^ " is not a valid length")) in let re = Regexp.regexp "^(\\d*(?:\\.\\d*)?)\\s*(\\S*)$" in match Regexp.string_match re s 0 with | None -> fail () | Some r -> ( let f = match Regexp.matched_group r 1 with | None -> fail () | Some f -> ( try float_of_string f with Invalid_argument s -> raise (Invalid_argument ("length conversion error: " ^ s))) in match Regexp.matched_group r 2 with | None -> fail () | Some "em" -> Em f | Some "ex" -> Ex f | Some "px" -> Px f | Some "gd" -> Gd f | Some "rem" -> Rem f | Some "vw" -> Vw f | Some "vh" -> Vh f | Some "vm" -> Vm f | Some "ch" -> Ch f | Some "mm" -> Mm f | Some "cm" -> Cm f | Some "in" -> In f | Some "pt" -> Pt f | Some "pc" -> Pc f | Some _ -> fail ()) end module Angle = struct type t = | Deg of float | Grad of float | Rad of float | Turns of float let string_of_t = function | Deg f -> Printf.sprintf "%f%s" f "deg" | Grad f -> Printf.sprintf "%f%s" f "grad" | Rad f -> Printf.sprintf "%f%s" f "rad" | Turns f -> Printf.sprintf "%f%s" f "turns" type js_t = Js.js_string Js.t let js t = Js.string (string_of_t t) let ml j = let s = Js.to_string j in let re = Regexp.regexp "^(\\d*(?:\\.\\d*))(deg|grad|rad|turns)$" in let fail () = raise (Invalid_argument (s ^ " is not a valid length")) in match Regexp.string_match re s 0 with | None -> fail () | Some r -> ( let f = match Regexp.matched_group r 1 with | None -> fail () | Some f -> ( try float_of_string f with Invalid_argument s -> raise (Invalid_argument ("length conversion error: " ^ s))) in match Regexp.matched_group r 2 with | Some "deg" -> Deg f | Some "grad" -> Grad f | Some "rad" -> Rad f | Some "turns" -> Turns f | Some _ | None -> fail ()) end js_of_ocaml-3.5.2/lib/js_of_ocaml/cSS.mli000066400000000000000000000177511357507750000202340ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Raphaël Proust * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** This module contains a few types and values to ease the use of CSS properties and such. If you think a feature is missing, consider sending a patch or an RFE to the mailing list. This module contain submodules each with a signature similar to: {[ type t (* type the module is focused on *) type js_t (* valid js representation of values of type t *) val js: t -> js_t (* conversion *) val ml: js_t -> t (* conversion *) ]} Additional functions (string conversion, standard operation, etc.) are sometime available. Some module have several different types instead of just one. *) module Color : sig (**All about CSS colors. MDC documentation here: https://developer.mozilla.org/en/CSS/color_value . Specifications here: http://www.w3.org/TR/css3-color/#svg-color .*) (**The colors by name.*) type name = | Aliceblue | Antiquewhite | Aqua | Aquamarine | Azure | Beige | Bisque | Black | Blanchedalmond | Blue | Blueviolet | Brown | Burlywood | Cadetblue | Chartreuse | Chocolate | Coral | Cornflowerblue | Cornsilk | Crimson | Cyan | Darkblue | Darkcyan | Darkgoldenrod | Darkgray | Darkgreen | Darkgrey | Darkkhaki | Darkmagenta | Darkolivegreen | Darkorange | Darkorchid | Darkred | Darksalmon | Darkseagreen | Darkslateblue | Darkslategray | Darkslategrey | Darkturquoise | Darkviolet | Deeppink | Deepskyblue | Dimgray | Dimgrey | Dodgerblue | Firebrick | Floralwhite | Forestgreen | Fuchsia | Gainsboro | Ghostwhite | Gold | Goldenrod | Gray | Grey | Green | Greenyellow | Honeydew | Hotpink | Indianred | Indigo | Ivory | Khaki | Lavender | Lavenderblush | Lawngreen | Lemonchiffon | Lightblue | Lightcoral | Lightcyan | Lightgoldenrodyellow | Lightgray | Lightgreen | Lightgrey | Lightpink | Lightsalmon | Lightseagreen | Lightskyblue | Lightslategray | Lightslategrey | Lightsteelblue | Lightyellow | Lime | Limegreen | Linen | Magenta | Maroon | Mediumaquamarine | Mediumblue | Mediumorchid | Mediumpurple | Mediumseagreen | Mediumslateblue | Mediumspringgreen | Mediumturquoise | Mediumvioletred | Midnightblue | Mintcream | Mistyrose | Moccasin | Navajowhite | Navy | Oldlace | Olive | Olivedrab | Orange | Orangered | Orchid | Palegoldenrod | Palegreen | Paleturquoise | Palevioletred | Papayawhip | Peachpuff | Peru | Pink | Plum | Powderblue | Purple | Red | Rosybrown | Royalblue | Saddlebrown | Salmon | Sandybrown | Seagreen | Seashell | Sienna | Silver | Skyblue | Slateblue | Slategray | Slategrey | Snow | Springgreen | Steelblue | Tan | Teal | Thistle | Tomato | Turquoise | Violet | Wheat | White | Whitesmoke | Yellow | Yellowgreen val string_of_name : name -> string (**Gives the string equivalent of the argument.*) val rgb_of_name : name -> int * int * int (**Converts a color name into three integers representing the Red, Green and Blue channels. Channel values are in between [0] and [255].*) val hex_of_rgb : int * int * int -> string (** Convert a tuple of three integers between [0] and [255] into a hex string *) (**The type of colors, either by name, by Red-Green-Blue constructor or by Hue-Saturation-Lightness constructors.*) type t = | Name of name (**A color by name*) | RGB of (int * int * int) (**Red, Green and Blue values. Clipped to [0..255] by most (All?) browsers.*) | RGB_percent of (int * int * int) (**RBG channels are specified as a percentage of their maximal value.*) | RGBA of (int * int * int * float) (**Same as RGB with additional transparency argument. Opacity should be between [0.] (completely transparent) and [1.] (completely opaque).*) | RGBA_percent of (int * int * int * float) (**RGB channels specified as percentage of their maximal value. Alpha channel (opacity) is still a [0.] to [1.] float.*) | HSL of (int * int * int) (**Hue, Saturation and Lightness values. Hue is an angle in degree (in interval [0..360]). Saturation is a percentage ([0..100]) with [0] being colorless. Lightness is also a percentage ([0..100]) with [0] being black.*) | HSLA of (int * int * int * float) (**Same as HSL with an opacity argument between [0.] and [1.].*) val rgb : ?a:float -> int -> int -> int -> t (**build a color from the values of red, green, and blue channels. optional [a] argument can be used to specify alpha channel (aka opacity).*) val hsl : ?a:float -> int -> int -> int -> t (**build a color from the values of hue, saturation, and lightness channels. optional [a] argument can be used to specify alpha channel (aka opacity).*) type js_t = private Js.js_string Js.t (**A [js_t] is a valid string representation of a CSS color*) (**A few conversion functions*) val string_of_t : t -> string (**Convert to a string representation (for debugging purpose mainly).*) val js : t -> js_t (**Projection from OCaml to Js. [js c] is equivalent to [Js.string (string_of_t c)] but with a [js_t] return type.*) val ml : js_t -> t (**Projection from Js to OCaml. The function is the dual of [js].*) val js_t_of_js_string : Js.js_string Js.t -> js_t (**Checks the well-formedness of a string or fails with [Invalid_argument]*) end module Length : sig (**The type of length attributes. Mdc documentation: https://developer.mozilla.org/en/CSS/length and specification: http://www.w3.org/TR/css3-values/#lengths *) type t = | Zero (**For 0, unit is optional*) | Em of float (**Relative to the font size *) | Ex of float (**Relative to the x-height *) | Px of float (**Relative to the viewing device *) | Gd of float (**Relative to the grid *) | Rem of float (**Relative to the font size of the root *) | Vw of float (**Relative to the viewport's width *) | Vh of float (**Relative to the viewport's height *) | Vm of float (**Relative to the smallest of the viewport's width or height *) | Ch of float (**Relative to the width of a char '0' *) | Mm of float (** in Milimeter *) | Cm of float (** in Centimeter *) | In of float (** in Inch *) | Pt of float (** in Points (72pt = 1in)*) | Pc of float (** in Picas (1pc = 12pt)*) type js_t = private Js.js_string Js.t (** Js representation of lengths. *) (**Conversion functions*) val string_of_t : t -> string val js : t -> js_t val ml : js_t -> t end module Angle : sig type t = | Deg of float | Grad of float | Rad of float | Turns of float type js_t = private Js.js_string Js.t val string_of_t : t -> string val js : t -> js_t val ml : js_t -> t end js_of_ocaml-3.5.2/lib/js_of_ocaml/dom.ml000066400000000000000000000266551357507750000201550ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open! Import class type ['node] nodeList = object method item : int -> 'node t opt meth method length : int readonly_prop end let list_of_nodeList (nodeList : 'a nodeList t) = let length = nodeList##.length in let rec add_item acc i = if i < length then match Opt.to_option (nodeList##item i) with | None -> add_item acc (i + 1) | Some e -> add_item (e :: acc) (i + 1) else List.rev acc in add_item [] 0 type nodeType = | OTHER (* Will not happen *) | ELEMENT | ATTRIBUTE | TEXT | CDATA_SECTION | ENTITY_REFERENCE | ENTITY | PROCESSING_INSTRUCTION | COMMENT | DOCUMENT | DOCUMENT_TYPE | DOCUMENT_FRAGMENT | NOTATION module DocumentPosition = struct type t = int type mask = int let disconnected = 0x01 let preceding = 0x02 let following = 0x04 let contains = 0x08 let contained_by = 0x10 let implementation_specific = 0x20 let has t mask = t land mask = mask let add x y = x lor y let ( + ) = add end class type node = object method nodeName : js_string t readonly_prop method nodeValue : js_string t opt readonly_prop method nodeType : nodeType readonly_prop method parentNode : node t opt prop method childNodes : node nodeList t prop method firstChild : node t opt prop method lastChild : node t opt prop method previousSibling : node t opt prop method nextSibling : node t opt prop method namespaceURI : js_string t opt prop method insertBefore : node t -> node t opt -> node t meth method replaceChild : node t -> node t -> node t meth method removeChild : node t -> node t meth method appendChild : node t -> node t meth method hasChildNodes : bool t meth method cloneNode : bool t -> node t meth method compareDocumentPosition : node t -> DocumentPosition.t meth method lookupNamespaceURI : js_string t -> js_string t opt meth method lookupPrefix : js_string t -> js_string t opt meth end let appendChild (p : #node t) (n : #node t) = ignore (p##appendChild (n :> node t)) let removeChild (p : #node t) (n : #node t) = ignore (p##removeChild (n :> node t)) let replaceChild (p : #node t) (n : #node t) (o : #node t) = ignore (p##replaceChild (n :> node t) (o :> node t)) let insertBefore (p : #node t) (n : #node t) (o : #node t opt) = ignore (p##insertBefore (n :> node t) (o :> node t opt)) (** Specification of [Attr] objects. *) class type attr = object inherit node method name : js_string t readonly_prop method specified : bool t readonly_prop method value : js_string t prop method ownerElement : element t prop end (** Specification of [NamedNodeMap] objects. *) and ['node] namedNodeMap = object method getNamedItem : js_string t -> 'node t opt meth method setNamedItem : 'node t -> 'node t opt meth method removeNamedItem : js_string t -> 'node t opt meth method item : int -> 'node t opt meth method length : int readonly_prop end (** Specification of [Element] objects. *) and element = object inherit node method tagName : js_string t readonly_prop method getAttribute : js_string t -> js_string t opt meth method setAttribute : js_string t -> js_string t -> unit meth method removeAttribute : js_string t -> unit meth method hasAttribute : js_string t -> bool t meth method getAttributeNS : js_string t -> js_string t -> js_string t opt meth method setAttributeNS : js_string t -> js_string t -> js_string t -> unit meth method removeAttributeNS : js_string t -> js_string t -> unit meth method hasAttributeNS : js_string t -> js_string t -> bool t meth method getAttributeNode : js_string t -> attr t opt meth method setAttributeNode : attr t -> attr t opt meth method removeAttributeNode : attr t -> attr t meth method getAttributeNodeNS : js_string t -> js_string t -> attr t opt meth method setAttributeNodeNS : attr t -> attr t opt meth method getElementsByTagName : js_string t -> element nodeList t meth method attributes : attr namedNodeMap t readonly_prop end class type characterData = object inherit node method data : js_string t prop method length : int readonly_prop method subjs_stringData : int -> int -> js_string t meth method appendData : js_string t -> unit meth method insertData : int -> js_string t -> unit meth method deleteData : int -> int -> unit meth method replaceData : int -> int -> js_string t -> unit meth end class type comment = characterData class type text = characterData class type documentFragment = node class type ['element] document = object inherit node method documentElement : 'element t readonly_prop method createDocumentFragment : documentFragment t meth method createElement : js_string t -> 'element t meth method createElementNS : js_string t -> js_string t -> 'element t meth method createTextNode : js_string t -> text t meth method createAttribute : js_string t -> attr t meth method createComment : js_string t -> comment t meth method getElementById : js_string t -> 'element t opt meth method getElementsByTagName : js_string t -> 'element nodeList t meth method importNode : element t -> bool t -> 'element t meth method adoptNode : element t -> 'element t meth end type node_type = | Element of element t | Attr of attr t | Text of text t | Other of node t let nodeType e = match e##.nodeType with | ELEMENT -> Element (Js.Unsafe.coerce e) | ATTRIBUTE -> Attr (Js.Unsafe.coerce e) | CDATA_SECTION | TEXT -> Text (Js.Unsafe.coerce e) | _ -> Other (e :> node t) module CoerceTo = struct let cast (e : #node Js.t) t = if e##.nodeType == t then Js.some (Js.Unsafe.coerce e) else Js.null let element e : element Js.t Js.opt = cast e ELEMENT let text e : text Js.t Js.opt = if e##.nodeType == TEXT || e##.nodeType == CDATA_SECTION then Js.some (Js.Unsafe.coerce e) else Js.null let attr e : attr Js.t Js.opt = cast e ATTRIBUTE end type ('a, 'b) event_listener = ('a, 'b -> bool t) meth_callback opt (** The type of event listener functions. The first type parameter ['a] is the type of the target object; the second parameter ['b] is the type of the event object. *) class type ['a] event = object method _type : js_string t readonly_prop method target : 'a t opt readonly_prop method currentTarget : 'a t opt readonly_prop (* Legacy methods *) method srcElement : 'a t opt readonly_prop end class type ['a, 'b] customEvent = object inherit ['a] event method detail : 'b Js.opt Js.readonly_prop end let no_handler : ('a, 'b) event_listener = Js.null let window_event () : 'a #event t = Js.Unsafe.pure_js_expr "event" (* The function preventDefault must be called explicitly when using addEventListener... *) let handler f = Js.some (Js.Unsafe.callback (fun e -> (* depending on the internet explorer version, e can be null or undefined. *) if not (Js.Opt.test (some e)) then ( let e = window_event () in let res = f e in if not (Js.to_bool res) then e##.returnValue := res; res) else let res = f e in if not (Js.to_bool res) then (Js.Unsafe.coerce e)##preventDefault; res)) let full_handler f = Js.some (Js.Unsafe.meth_callback (fun this e -> (* depending on the internet explorer version, e can be null or undefined *) if not (Js.Opt.test (some e)) then ( let e = window_event () in let res = f this e in if not (Js.to_bool res) then e##.returnValue := res; res) else let res = f this e in if not (Js.to_bool res) then (Js.Unsafe.coerce e)##preventDefault; res)) let invoke_handler (f : ('a, 'b) event_listener) (this : 'a) (event : 'b) : bool t = Js.Unsafe.call f this [| Js.Unsafe.inject event |] let eventTarget (e : (< .. > as 'a) #event t) : 'a t = let target = Opt.get e##.target (fun () -> Opt.get e##.srcElement (fun () -> raise Not_found)) in if Js.instanceof target Js.Unsafe.global##._Node then (* Workaround for Safari bug *) let target' : node Js.t = Js.Unsafe.coerce target in if target'##.nodeType == TEXT then Js.Unsafe.coerce (Opt.get target'##.parentNode (fun () -> assert false)) else target else target module Event = struct type 'a typ = Js.js_string Js.t let make s = Js.string s end type event_listener_id = unit -> unit class type event_listener_options = object method capture : bool t writeonly_prop method once : bool t writeonly_prop method passive : bool t writeonly_prop end let addEventListenerWithOptions (e : (< .. > as 'a) t) typ ?capture ?once ?passive h = if (Js.Unsafe.coerce e)##.addEventListener == Js.undefined then let ev = (Js.string "on")##concat typ in let callback e = Js.Unsafe.call (h, e, [||]) in let () = (Js.Unsafe.coerce e)##attachEvent ev callback in fun () -> (Js.Unsafe.coerce e)##detachEvent ev callback else let opts : event_listener_options t = Js.Unsafe.obj [||] in let iter t f = match t with | None -> () | Some b -> f b in iter capture (fun b -> opts##.capture := b); iter once (fun b -> opts##.once := b); iter passive (fun b -> opts##.passive := b); let () = (Js.Unsafe.coerce e)##addEventListener typ h opts in fun () -> (Js.Unsafe.coerce e)##removeEventListener typ h opts let addEventListener (e : (< .. > as 'a) t) typ h capt = addEventListenerWithOptions e typ ~capture:capt h let removeEventListener id = id () let preventDefault ev = if Js.Optdef.test (Js.Unsafe.coerce ev)##.preventDefault (* IE hack *) then (Js.Unsafe.coerce ev)##preventDefault else (Js.Unsafe.coerce ev)##.returnValue := Js.bool false let createCustomEvent ?bubbles ?cancelable ?detail typ = let opt_iter f = function | None -> () | Some x -> f x in let opts = Unsafe.obj [||] in opt_iter (fun x -> opts##.bubbles := bool x) bubbles; opt_iter (fun x -> opts##.cancelable := bool x) cancelable; opt_iter (fun x -> opts##.detail := some x) detail; let constr : ( ('a, 'b) #customEvent Js.t Event.typ -> < detail : 'b opt prop > t -> ('a, 'b) customEvent t) constr = Unsafe.global##._CustomEvent in new%js constr typ opts (* IE < 9 *) class type stringList = object method item : int -> js_string t opt meth method length : int readonly_prop method contains : js_string t -> bool t meth end js_of_ocaml-3.5.2/lib/js_of_ocaml/dom.mli000066400000000000000000000243501357507750000203140ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** DOM binding This is a partial binding to the DOM Core API. *) open Js (** {2 DOM objects} *) (** Specification of [NodeList] objects. *) class type ['node] nodeList = object method item : int -> 'node t opt meth method length : int readonly_prop end type nodeType = | OTHER (* Will not happen *) | ELEMENT | ATTRIBUTE | TEXT | CDATA_SECTION | ENTITY_REFERENCE | ENTITY | PROCESSING_INSTRUCTION | COMMENT | DOCUMENT | DOCUMENT_TYPE | DOCUMENT_FRAGMENT | NOTATION module DocumentPosition : sig type t = private int type mask = private int val disconnected : mask val preceding : mask val following : mask val contains : mask val contained_by : mask val implementation_specific : mask val has : t -> mask -> bool val add : mask -> mask -> mask val ( + ) : mask -> mask -> mask end (** Specification of [Node] objects. *) class type node = object method nodeName : js_string t readonly_prop method nodeValue : js_string t opt readonly_prop method nodeType : nodeType readonly_prop method parentNode : node t opt prop method childNodes : node nodeList t prop method firstChild : node t opt prop method lastChild : node t opt prop method previousSibling : node t opt prop method nextSibling : node t opt prop method namespaceURI : js_string t opt prop method insertBefore : node t -> node t opt -> node t meth method replaceChild : node t -> node t -> node t meth method removeChild : node t -> node t meth method appendChild : node t -> node t meth method hasChildNodes : bool t meth method cloneNode : bool t -> node t meth method compareDocumentPosition : node t -> DocumentPosition.t meth method lookupNamespaceURI : js_string t -> js_string t opt meth method lookupPrefix : js_string t -> js_string t opt meth end (** Specification of [Attr] objects. *) class type attr = object inherit node method name : js_string t readonly_prop method specified : bool t readonly_prop method value : js_string t prop method ownerElement : element t prop end (** Specification of [NamedNodeMap] objects. *) and ['node] namedNodeMap = object method getNamedItem : js_string t -> 'node t opt meth method setNamedItem : 'node t -> 'node t opt meth method removeNamedItem : js_string t -> 'node t opt meth method item : int -> 'node t opt meth method length : int readonly_prop end (** Specification of [Element] objects. *) and element = object inherit node method tagName : js_string t readonly_prop method getAttribute : js_string t -> js_string t opt meth method setAttribute : js_string t -> js_string t -> unit meth method removeAttribute : js_string t -> unit meth method hasAttribute : js_string t -> bool t meth method getAttributeNS : js_string t -> js_string t -> js_string t opt meth method setAttributeNS : js_string t -> js_string t -> js_string t -> unit meth method removeAttributeNS : js_string t -> js_string t -> unit meth method hasAttributeNS : js_string t -> js_string t -> bool t meth method getAttributeNode : js_string t -> attr t opt meth method setAttributeNode : attr t -> attr t opt meth method removeAttributeNode : attr t -> attr t meth method getAttributeNodeNS : js_string t -> js_string t -> attr t opt meth method setAttributeNodeNS : attr t -> attr t opt meth method getElementsByTagName : js_string t -> element nodeList t meth method attributes : attr namedNodeMap t readonly_prop end (** Specification of [CharacterData] objects. *) class type characterData = object inherit node method data : js_string t prop method length : int readonly_prop method subjs_stringData : int -> int -> js_string t meth method appendData : js_string t -> unit meth method insertData : int -> js_string t -> unit meth method deleteData : int -> int -> unit meth method replaceData : int -> int -> js_string t -> unit meth end class type comment = characterData (** Specification of [Comment] objects *) class type text = characterData (** Specification of [Text] objects. *) class type documentFragment = node (** Specification of [DocumentFragment] objects. *) (** Specification of [Document] objects. *) class type ['element] document = object inherit node method documentElement : 'element t readonly_prop method createDocumentFragment : documentFragment t meth method createElement : js_string t -> 'element t meth method createElementNS : js_string t -> js_string t -> 'element t meth method createTextNode : js_string t -> text t meth method createAttribute : js_string t -> attr t meth method createComment : js_string t -> comment t meth method getElementById : js_string t -> 'element t opt meth method getElementsByTagName : js_string t -> 'element nodeList t meth method importNode : element t -> bool t -> 'element t meth method adoptNode : element t -> 'element t meth end (** {2 Helper functions} *) val insertBefore : #node t -> #node t -> #node t opt -> unit (** [insertBefore p n c] inserts node [n] as child of node [p], just before node [c], or as last child if [p] is empty. The expression [insertBefore n c p] behave the same as [p##insertBefore n c] but avoid the need of coercing the different objects to [node t]. *) val replaceChild : #node t -> #node t -> #node t -> unit (** The expression [replaceChild p n c] behave the same as [p##replaceChild n c] (replace [c] by [n] in [p]) but avoid the need of coercing the different objects to [node t]. *) val removeChild : #node t -> #node t -> unit (** The expression [removeChild n c] behave the same as [n##removeChild c] (remove [c] from [n]) but avoid the need of coercing the different objects to [node t]. *) val appendChild : #node t -> #node t -> unit (** The expression [appendChild n c] behave the same as [n##appendChild c] (appends [c] to [n]) but avoid the need of coercing the different objects to [node t]. *) val list_of_nodeList : 'a nodeList t -> 'a t list type node_type = | Element of element t | Attr of attr t | Text of text t | Other of node t val nodeType : #node t -> node_type module CoerceTo : sig val element : #node t -> element t opt val text : #node t -> text t opt val attr : #node t -> attr t opt end (** {2 Events} *) type (-'a, -'b) event_listener (** The type of event listener functions. The first type parameter ['a] is the type of the target object; the second parameter ['b] is the type of the event object. *) class type ['a] event = object method _type : js_string t readonly_prop method target : 'a t opt readonly_prop method currentTarget : 'a t opt readonly_prop (* Legacy methods *) method srcElement : 'a t opt readonly_prop end class type ['a, 'b] customEvent = object inherit ['a] event method detail : 'b Js.opt Js.readonly_prop end (** {2 Event handlers} *) val no_handler : ('a, 'b) event_listener (** Void event handler (Javascript [null] value). *) val handler : (('e #event t as 'b) -> bool t) -> ('a, 'b) event_listener (** Create an event handler that invokes the provided function. If the handler returns false, the default action is prevented. *) val full_handler : ('a -> ('e #event t as 'b) -> bool t) -> ('a, 'b) event_listener (** Create an event handler that invokes the provided function. The event target (implicit parameter [this]) is also passed as argument to the function. *) val invoke_handler : ('a, 'b) event_listener -> 'a -> 'b -> bool t (** Invoke an existing handler. Useful to chain event handlers. *) val eventTarget : (< .. > as 'a) #event t -> 'a t (** Returns which object is the target of this event. It raises [Not_found] in case there is no target (if the event has not been triggered yet) *) type event_listener_id module Event : sig type 'a typ val make : string -> 'a typ end val addEventListenerWithOptions : (< .. > t as 'a) -> 'b Event.typ -> ?capture:bool t -> ?once:bool t -> ?passive:bool t -> ('a, 'b) event_listener -> event_listener_id (** Add an event listener. This function matches the option-object variant of the [addEventListener] DOM method, except that it returns an id for removing the listener. *) val addEventListener : (< .. > t as 'a) -> 'b Event.typ -> ('a, 'b) event_listener -> bool t -> event_listener_id (** Add an event listener. This function matches the useCapture boolean variant of the [addEventListener] DOM method, except that it returns an id for removing the listener. *) val removeEventListener : event_listener_id -> unit (** Remove the given event listener. *) val preventDefault : 'a #event Js.t -> unit (** Call this to prevent the default handler for the event. To stop propagation of the event, call {!Dom_html.stopPropagation}. *) val createCustomEvent : ?bubbles:bool -> ?cancelable:bool -> ?detail:'b -> ('a, 'b) #customEvent Js.t Event.typ -> ('a, 'b) customEvent Js.t (** Create a custom event of given type. *) (** {2 Other DOM objects} *) class type stringList = object method item : int -> js_string t opt meth method length : int readonly_prop method contains : js_string t -> bool t meth end js_of_ocaml-3.5.2/lib/js_of_ocaml/dom_events.ml000066400000000000000000000023511357507750000215240ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Javascript events. *) open! Import module Typ = Dom_html.Event type listener = Dom_html.event_listener_id let listen ?(capture = false) target typ cb = Dom_html.addEventListener target typ (Dom_html.full_handler (fun n e -> Js.bool (cb n e))) (Js.bool capture) let stop_listen = Dom_html.removeEventListener js_of_ocaml-3.5.2/lib/js_of_ocaml/dom_events.mli000066400000000000000000000023101357507750000216700ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Javascript events *) module Typ : sig include module type of Dom_html.Event end type listener val listen : ?capture:bool -> (#Dom_html.eventTarget as 'a) Js.t -> (#Dom_html.event as 'b) Js.t Typ.typ -> ('a Js.t -> 'b Js.t -> bool) -> listener val stop_listen : listener -> unit js_of_ocaml-3.5.2/lib/js_of_ocaml/dom_html.ml000066400000000000000000002467351357507750000212040ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open! Import external caml_js_on_ie : unit -> bool t = "caml_js_on_ie" let onIE = Js.to_bool (caml_js_on_ie ()) external html_escape : js_string t -> js_string t = "caml_js_html_escape" external decode_html_entities : js_string t -> js_string t = "caml_js_html_entities" class type cssStyleDeclaration = object method animation : js_string t prop method animationDelay : js_string t prop method animationDirection : js_string t prop method animationDuration : js_string t prop method animationFillMode : js_string t prop method animationIterationCount : js_string t prop method animationName : js_string t prop method animationPlayState : js_string t prop method animationTimingFunction : js_string t prop method background : js_string t prop method backgroundAttachment : js_string t prop method backgroundColor : js_string t prop method backgroundImage : js_string t prop method backgroundPosition : js_string t prop method backgroundRepeat : js_string t prop method border : js_string t prop method borderBottom : js_string t prop method borderBottomColor : js_string t prop method borderBottomStyle : js_string t prop method borderBottomWidth : js_string t prop method borderCollapse : js_string t prop method borderColor : js_string t prop method borderLeft : js_string t prop method borderLeftColor : js_string t prop method borderLeftStyle : js_string t prop method borderLeftWidth : js_string t prop method borderRadius : js_string t prop method borderRight : js_string t prop method borderRightColor : js_string t prop method borderRightStyle : js_string t prop method borderRightWidth : js_string t prop method borderSpacing : js_string t prop method borderStyle : js_string t prop method borderTop : js_string t prop method borderTopColor : js_string t prop method borderTopStyle : js_string t prop method borderTopWidth : js_string t prop method borderWidth : js_string t prop method bottom : js_string t prop method captionSide : js_string t prop method clear : js_string t prop method clip : js_string t prop method color : js_string t prop method content : js_string t prop method counterIncrement : js_string t prop method counterReset : js_string t prop method cssFloat : js_string t prop method cssText : js_string t prop method cursor : js_string t prop method direction : js_string t prop method display : js_string t prop method emptyCells : js_string t prop method fill : js_string t prop method font : js_string t prop method fontFamily : js_string t prop method fontSize : js_string t prop method fontStyle : js_string t prop method fontVariant : js_string t prop method fontWeight : js_string t prop method height : js_string t prop method left : js_string t prop method letterSpacing : js_string t prop method lineHeight : js_string t prop method listStyle : js_string t prop method listStyleImage : js_string t prop method listStylePosition : js_string t prop method listStyleType : js_string t prop method margin : js_string t prop method marginBottom : js_string t prop method marginLeft : js_string t prop method marginRight : js_string t prop method marginTop : js_string t prop method maxHeight : js_string t prop method maxWidth : js_string t prop method minHeight : js_string t prop method minWidth : js_string t prop method opacity : js_string t optdef prop method outline : js_string t prop method outlineColor : js_string t prop method outlineOffset : js_string t prop method outlineStyle : js_string t prop method outlineWidth : js_string t prop method overflow : js_string t prop method overflowX : js_string t prop method overflowY : js_string t prop method padding : js_string t prop method paddingBottom : js_string t prop method paddingLeft : js_string t prop method paddingRight : js_string t prop method paddingTop : js_string t prop method pageBreakAfter : js_string t prop method pageBreakBefore : js_string t prop method pointerEvents : js_string t prop method position : js_string t prop method right : js_string t prop method stroke : js_string t prop method strokeWidth : js_string t prop method tableLayout : js_string t prop method textAlign : js_string t prop method textAnchor : js_string t prop method textDecoration : js_string t prop method textIndent : js_string t prop method textTransform : js_string t prop method top : js_string t prop method transform : js_string t prop method verticalAlign : js_string t prop method visibility : js_string t prop method whiteSpace : js_string t prop method width : js_string t prop method wordSpacing : js_string t prop method zIndex : js_string t prop end type ('a, 'b) event_listener = ('a, 'b) Dom.event_listener type mouse_button = | No_button | Left_button | Middle_button | Right_button class type event = object inherit [element] Dom.event end and ['a] customEvent = object inherit [element, 'a] Dom.customEvent end and focusEvent = object inherit event method relatedTarget : element t opt optdef readonly_prop end and mouseEvent = object inherit event method relatedTarget : element t opt optdef readonly_prop method clientX : int readonly_prop method clientY : int readonly_prop method screenX : int readonly_prop method screenY : int readonly_prop method ctrlKey : bool t readonly_prop method shiftKey : bool t readonly_prop method altKey : bool t readonly_prop method metaKey : bool t readonly_prop method button : int readonly_prop method which : mouse_button optdef readonly_prop method fromElement : element t opt optdef readonly_prop method toElement : element t opt optdef readonly_prop method pageX : int optdef readonly_prop method pageY : int optdef readonly_prop end and keyboardEvent = object inherit event method altKey : bool t readonly_prop method shiftKey : bool t readonly_prop method ctrlKey : bool t readonly_prop method metaKey : bool t readonly_prop method location : int readonly_prop method key : js_string t optdef readonly_prop method code : js_string t optdef readonly_prop method which : int optdef readonly_prop method charCode : int optdef readonly_prop method keyCode : int readonly_prop method keyIdentifier : js_string t optdef readonly_prop end and mousewheelEvent = object (* All browsers but Firefox *) inherit mouseEvent method wheelDelta : int readonly_prop method wheelDeltaX : int optdef readonly_prop method wheelDeltaY : int optdef readonly_prop end and mouseScrollEvent = object (* Firefox *) inherit mouseEvent method detail : int readonly_prop method axis : int optdef readonly_prop method _HORIZONTAL_AXIS : int optdef readonly_prop method _VERTICAL_AXIS : int optdef readonly_prop end and touchEvent = object inherit event method touches : touchList t readonly_prop method targetTouches : touchList t readonly_prop method changedTouches : touchList t readonly_prop method ctrlKey : bool t readonly_prop method shiftKey : bool t readonly_prop method altKey : bool t readonly_prop method metaKey : bool t readonly_prop method relatedTarget : element t opt optdef readonly_prop end and touchList = object method length : int readonly_prop method item : int -> touch t optdef meth end and touch = object method identifier : int readonly_prop method target : element t optdef readonly_prop method screenX : int readonly_prop method screenY : int readonly_prop method clientX : int readonly_prop method clientY : int readonly_prop method pageX : int readonly_prop method pageY : int readonly_prop end and dragEvent = object inherit mouseEvent method dataTransfer : dataTransfer t readonly_prop end and dataTransfer = object method dropEffect : js_string t prop method effectAllowed : js_string t prop method files : File.fileList t readonly_prop method types : js_string t js_array t readonly_prop method addElement : element t -> unit meth method clearData : js_string t -> unit meth method clearData_all : unit meth method getData : js_string t -> js_string t meth method setData : js_string t -> js_string t -> unit meth method setDragImage : element t -> int -> int -> unit meth end and eventTarget = object ('self) method onclick : ('self t, mouseEvent t) event_listener writeonly_prop method ondblclick : ('self t, mouseEvent t) event_listener writeonly_prop method onmousedown : ('self t, mouseEvent t) event_listener writeonly_prop method onmouseup : ('self t, mouseEvent t) event_listener writeonly_prop method onmouseover : ('self t, mouseEvent t) event_listener writeonly_prop method onmousemove : ('self t, mouseEvent t) event_listener writeonly_prop method onmouseout : ('self t, mouseEvent t) event_listener writeonly_prop method onkeypress : ('self t, keyboardEvent t) event_listener writeonly_prop method onkeydown : ('self t, keyboardEvent t) event_listener writeonly_prop method onkeyup : ('self t, keyboardEvent t) event_listener writeonly_prop method onscroll : ('self t, event t) event_listener writeonly_prop method ondragstart : ('self t, dragEvent t) event_listener writeonly_prop method ondragend : ('self t, dragEvent t) event_listener writeonly_prop method ondragenter : ('self t, dragEvent t) event_listener writeonly_prop method ondragover : ('self t, dragEvent t) event_listener writeonly_prop method ondragleave : ('self t, dragEvent t) event_listener writeonly_prop method ondrag : ('self t, dragEvent t) event_listener writeonly_prop method ondrop : ('self t, dragEvent t) event_listener writeonly_prop method onanimationstart : ('self t, animationEvent t) event_listener writeonly_prop method onanimationend : ('self t, animationEvent t) event_listener writeonly_prop method onanimationiteration : ('self t, animationEvent t) event_listener writeonly_prop method onanimationcancel : ('self t, animationEvent t) event_listener writeonly_prop method ongotpointercapture : ('self t, pointerEvent t) event_listener writeonly_prop method onlostpointercapture : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerenter : ('self t, pointerEvent t) event_listener writeonly_prop method onpointercancel : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerdown : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerleave : ('self t, pointerEvent t) event_listener writeonly_prop method onpointermove : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerout : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerover : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerup : ('self t, pointerEvent t) event_listener writeonly_prop method dispatchEvent : event t -> bool t meth end and popStateEvent = object inherit event method state : Js.Unsafe.any readonly_prop end and pointerEvent = object inherit mouseEvent method pointerId : int Js.readonly_prop method width : float Js.readonly_prop method height : float Js.readonly_prop method pressure : float Js.readonly_prop method tangentialPressure : float Js.readonly_prop method tiltX : int Js.readonly_prop method tiltY : int Js.readonly_prop method twist : int Js.readonly_prop method pointerType : Js.js_string Js.t Js.readonly_prop method isPrimary : bool Js.t Js.readonly_prop end and storageEvent = object inherit event method key : js_string t opt readonly_prop method oldValue : js_string t opt readonly_prop method newValue : js_string t opt readonly_prop method url : js_string t readonly_prop method storageArea : storage t opt readonly_prop end and storage = object method length : int readonly_prop method key : int -> js_string t opt meth method getItem : js_string t -> js_string t opt meth method setItem : js_string t -> js_string t -> unit meth method removeItem : js_string t -> unit meth method clear : unit meth end and hashChangeEvent = object inherit event method oldURL : js_string t readonly_prop method newURL : js_string t readonly_prop end and animationEvent = object inherit event method animationName : js_string t readonly_prop method elapsedTime : float readonly_prop method pseudoElement : js_string t readonly_prop end and mediaEvent = object inherit event end and nodeSelector = object method querySelector : js_string t -> element t opt meth method querySelectorAll : js_string t -> element Dom.nodeList t meth end and tokenList = object method length : int readonly_prop method item : int -> js_string t optdef meth method contains : js_string t -> bool t meth method add : js_string t -> unit meth method remove : js_string t -> unit meth method toggle : js_string t -> bool t meth method stringifier : js_string t prop end and element = object inherit Dom.element inherit nodeSelector method id : js_string t prop method title : js_string t prop method lang : js_string t prop method dir : js_string t prop method className : js_string t prop method classList : tokenList t readonly_prop method style : cssStyleDeclaration t prop method innerHTML : js_string t prop method outerHTML : js_string t prop method textContent : js_string t opt prop method clientLeft : int readonly_prop method clientTop : int readonly_prop method clientWidth : int readonly_prop method clientHeight : int readonly_prop method offsetLeft : int readonly_prop method offsetTop : int readonly_prop method offsetParent : element t opt readonly_prop method offsetWidth : int readonly_prop method offsetHeight : int readonly_prop method scrollLeft : int prop method scrollTop : int prop method scrollWidth : int prop method scrollHeight : int prop method getClientRects : clientRectList t meth method getBoundingClientRect : clientRect t meth method scrollIntoView : bool t -> unit meth method click : unit meth method focus : unit meth method blur : unit meth inherit eventTarget end and clientRect = object method top : float readonly_prop method right : float readonly_prop method bottom : float readonly_prop method left : float readonly_prop method width : float optdef readonly_prop method height : float optdef readonly_prop end and clientRectList = object method length : int readonly_prop method item : int -> clientRect t opt meth end let no_handler : ('a, 'b) event_listener = Dom.no_handler let handler = Dom.handler let full_handler = Dom.full_handler let invoke_handler = Dom.invoke_handler module Event = struct type 'a typ = 'a Dom.Event.typ let click = Dom.Event.make "click" let dblclick = Dom.Event.make "dblclick" let mousedown = Dom.Event.make "mousedown" let mouseup = Dom.Event.make "mouseup" let mouseover = Dom.Event.make "mouseover" let mousemove = Dom.Event.make "mousemove" let mouseout = Dom.Event.make "mouseout" let keypress = Dom.Event.make "keypress" let keydown = Dom.Event.make "keydown" let keyup = Dom.Event.make "keyup" let mousewheel = Dom.Event.make "mousewheel" let _DOMMouseScroll = Dom.Event.make "DOMMouseScroll" let touchstart = Dom.Event.make "touchstart" let touchmove = Dom.Event.make "touchmove" let touchend = Dom.Event.make "touchend" let touchcancel = Dom.Event.make "touchcancel" let dragstart = Dom.Event.make "dragstart" let dragend = Dom.Event.make "dragend" let dragenter = Dom.Event.make "dragenter" let dragover = Dom.Event.make "dragover" let dragleave = Dom.Event.make "dragleave" let drag = Dom.Event.make "drag" let drop = Dom.Event.make "drop" let hashchange = Dom.Event.make "hashchange" let change = Dom.Event.make "change" let input = Dom.Event.make "input" let timeupdate = Dom.Event.make "timeupdate" let submit = Dom.Event.make "submit" let scroll = Dom.Event.make "scroll" let focus = Dom.Event.make "focus" let blur = Dom.Event.make "blur" let load = Dom.Event.make "load" let unload = Dom.Event.make "unload" let beforeunload = Dom.Event.make "beforeunload" let resize = Dom.Event.make "resize" let orientationchange = Dom.Event.make "orientationchange" let popstate = Dom.Event.make "popstate" let error = Dom.Event.make "error" let abort = Dom.Event.make "abort" let select = Dom.Event.make "select" let online = Dom.Event.make "online" let offline = Dom.Event.make "offline" let checking = Dom.Event.make "checking" let noupdate = Dom.Event.make "noupdate" let downloading = Dom.Event.make "downloading" let progress = Dom.Event.make "progress" let updateready = Dom.Event.make "updateready" let cached = Dom.Event.make "cached" let obsolete = Dom.Event.make "obsolete" let domContentLoaded = Dom.Event.make "DOMContentLoaded" let animationstart = Dom.Event.make "animationstart" let animationend = Dom.Event.make "animationend" let animationiteration = Dom.Event.make "animationiteration" let animationcancel = Dom.Event.make "animationcancel" let canplay = Dom.Event.make "canplay" let canplaythrough = Dom.Event.make "canplaythrough" let durationchange = Dom.Event.make "durationchange" let emptied = Dom.Event.make "emptied" let ended = Dom.Event.make "ended" let gotpointercapture = Dom.Event.make "gotpointercapture" let loadeddata = Dom.Event.make "loadeddata" let loadedmetadata = Dom.Event.make "loadedmetadata" let loadstart = Dom.Event.make "loadstart" let lostpointercapture = Dom.Event.make "lostpointercapture" let pause = Dom.Event.make "pause" let play = Dom.Event.make "play" let playing = Dom.Event.make "playing" let pointerenter = Dom.Event.make "pointerenter" let pointercancel = Dom.Event.make "pointercancel" let pointerdown = Dom.Event.make "pointerdown" let pointerleave = Dom.Event.make "pointerleave" let pointermove = Dom.Event.make "pointermove" let pointerout = Dom.Event.make "pointerout" let pointerover = Dom.Event.make "pointerover" let pointerup = Dom.Event.make "pointerup" let ratechange = Dom.Event.make "ratechange" let seeked = Dom.Event.make "seeked" let seeking = Dom.Event.make "seeking" let stalled = Dom.Event.make "stalled" let suspend = Dom.Event.make "suspend" let volumechange = Dom.Event.make "volumechange" let waiting = Dom.Event.make "waiting" let make = Dom.Event.make end type event_listener_id = Dom.event_listener_id let addEventListener = Dom.addEventListener let addEventListenerWithOptions = Dom.addEventListenerWithOptions let removeEventListener = Dom.removeEventListener let createCustomEvent = Dom.createCustomEvent class type ['node] collection = object method length : int readonly_prop method item : int -> 'node t opt meth method namedItem : js_string t -> 'node t opt meth end class type htmlElement = element class type headElement = object inherit element method profile : js_string t prop end class type linkElement = object inherit element method disabled : bool t prop method charset : js_string t prop method crossorigin : js_string t prop method href : js_string t prop method hreflang : js_string t prop method media : js_string t prop method rel : js_string t prop method rev : js_string t prop method target : js_string t prop method _type : js_string t prop end class type titleElement = object inherit element method text : js_string t prop end class type metaElement = object inherit element method content : js_string t prop method httpEquiv : js_string t prop method name : js_string t prop method scheme : js_string t prop end class type baseElement = object inherit element method href : js_string t prop method target : js_string t prop end class type styleElement = object inherit element method disabled : bool t prop method media : js_string t prop method _type : js_string t prop end class type bodyElement = element class type formElement = object inherit element method elements : element collection t readonly_prop method length : int readonly_prop method acceptCharset : js_string t prop method action : js_string t prop method enctype : js_string t prop method _method : js_string t prop method target : js_string t prop method submit : unit meth method reset : unit meth method onsubmit : ('self t, event t) event_listener writeonly_prop end class type optGroupElement = object inherit element method disabled : bool t prop method label : js_string t prop end class type optionElement = object inherit optGroupElement method form : formElement t opt readonly_prop method defaultSelected : bool t prop method text : js_string t readonly_prop method index : int readonly_prop method selected : bool t prop method value : js_string t prop end class type selectElement = object ('self) inherit element method _type : js_string t readonly_prop method selectedIndex : int prop method value : js_string t prop method length : int prop method form : formElement t opt readonly_prop method options : optionElement collection t readonly_prop method disabled : bool t prop method multiple : bool t prop method name : js_string t readonly_prop method size : int prop method tabIndex : int prop method add : #optGroupElement t -> #optGroupElement t opt -> unit meth method remove : int -> unit meth method required : bool t writeonly_prop method onchange : ('self t, event t) event_listener prop method oninput : ('self t, event t) event_listener prop end class type inputElement = object ('self) inherit element method defaultValue : js_string t prop method defaultChecked : js_string t prop method form : formElement t opt readonly_prop method accept : js_string t prop method accessKey : js_string t prop method align : js_string t prop method alt : js_string t prop method checked : bool t prop method disabled : bool t prop method maxLength : int prop method name : js_string t readonly_prop method readOnly : bool t prop method required : bool t writeonly_prop method size : int prop method src : js_string t prop method tabIndex : int prop method _type : js_string t readonly_prop method useMap : js_string t prop method value : js_string t prop method select : unit meth method files : File.fileList t optdef readonly_prop method placeholder : js_string t writeonly_prop method selectionDirection : js_string t prop method selectionStart : int prop method selectionEnd : int prop method onselect : ('self t, event t) event_listener prop method onchange : ('self t, event t) event_listener prop method oninput : ('self t, event t) event_listener prop method onblur : ('self t, focusEvent t) event_listener prop method onfocus : ('self t, focusEvent t) event_listener prop end class type textAreaElement = object ('self) inherit element method defaultValue : js_string t prop method form : formElement t opt readonly_prop method accessKey : js_string t prop method cols : int prop method disabled : bool t prop method name : js_string t readonly_prop method readOnly : bool t prop method rows : int prop method selectionDirection : js_string t prop method selectionEnd : int prop method selectionStart : int prop method tabIndex : int prop method _type : js_string t readonly_prop method value : js_string t prop method select : unit meth method required : bool t writeonly_prop method placeholder : js_string t writeonly_prop method onselect : ('self t, event t) event_listener prop method onchange : ('self t, event t) event_listener prop method oninput : ('self t, event t) event_listener prop method onblur : ('self t, focusEvent t) event_listener prop method onfocus : ('self t, focusEvent t) event_listener prop end class type buttonElement = object inherit element method form : formElement t opt readonly_prop method accessKey : js_string t prop method disabled : bool t prop method name : js_string t readonly_prop method tabIndex : int prop method _type : js_string t readonly_prop method value : js_string t prop end class type labelElement = object inherit element method form : formElement t opt readonly_prop method accessKey : js_string t prop method htmlFor : js_string t prop end class type fieldSetElement = object inherit element method form : formElement t opt readonly_prop end class type legendElement = object inherit element method form : formElement t opt readonly_prop method accessKey : js_string t prop end class type uListElement = element class type oListElement = element class type dListElement = element class type liElement = element class type divElement = element class type paragraphElement = element class type headingElement = element class type quoteElement = object inherit element method cite : js_string t prop end class type preElement = element class type brElement = element class type hrElement = element class type modElement = object inherit element method cite : js_string t prop method dateTime : js_string t prop end class type anchorElement = object inherit element method accessKey : js_string t prop method charset : js_string t prop method coords : js_string t prop method href : js_string t prop method hreflang : js_string t prop method name : js_string t prop method rel : js_string t prop method rev : js_string t prop method shape : js_string t prop method tabIndex : int prop method target : js_string t prop method _type : js_string t prop end class type imageElement = object ('self) inherit element method alt : js_string t prop method src : js_string t prop method useMap : js_string t prop method isMap : bool t prop method width : int prop method height : int prop method naturalWidth : int optdef readonly_prop method naturalHeight : int optdef readonly_prop method complete : bool t prop method onload : ('self t, event t) event_listener prop method onerror : ('self t, event t) event_listener prop method onabort : ('self t, event t) event_listener prop end class type objectElement = object inherit element method form : formElement t opt readonly_prop method code : js_string t prop method archive : js_string t prop method codeBase : js_string t prop method codeType : js_string t prop method data : js_string t prop method declare : bool t prop method height : js_string t prop method name : js_string t prop method standby : js_string t prop method tabIndex : int prop method _type : js_string t prop method useMap : js_string t prop method width : js_string t prop method document : Dom.element Dom.document t opt readonly_prop end class type paramElement = object inherit element method name : js_string t prop method _type : js_string t prop method value : js_string t prop method valueType : js_string t prop end class type areaElement = object inherit element method accessKey : js_string t prop method alt : js_string t prop method coords : js_string t prop method href : js_string t prop method noHref : bool t prop method shape : js_string t prop method tabIndex : int prop method target : js_string t prop end class type mapElement = object inherit element method areas : areaElement collection t readonly_prop method name : js_string t prop end class type scriptElement = object inherit element method text : js_string t prop method charset : js_string t prop method defer : bool t prop method src : js_string t prop method _type : js_string t prop method async : bool t prop end class type embedElement = object inherit element method src : js_string t prop method height : js_string t prop method width : js_string t prop method _type : js_string t prop end class type tableCellElement = object inherit element method cellIndex : int readonly_prop method abbr : js_string t prop method align : js_string t prop method axis : js_string t prop method ch : js_string t prop method chOff : js_string t prop method colSpan : int prop method headers : js_string t prop method rowSpan : int prop method scope : js_string t prop method vAlign : js_string t prop end class type tableRowElement = object inherit element method rowIndex : int readonly_prop method sectionRowIndex : int readonly_prop method cells : tableCellElement collection t readonly_prop method align : js_string t prop method ch : js_string t prop method chOff : js_string t prop method vAlign : js_string t prop method insertCell : int -> tableCellElement t meth method deleteCell : int -> unit meth end class type tableColElement = object inherit element method align : js_string t prop method ch : js_string t prop method chOff : js_string t prop method span : int prop method vAlign : js_string t prop method width : js_string t prop end class type tableSectionElement = object inherit element method align : js_string t prop method ch : js_string t prop method chOff : js_string t prop method vAlign : js_string t prop method rows : tableRowElement collection t readonly_prop method insertRow : int -> tableRowElement t meth method deleteRow : int -> unit meth end class type tableCaptionElement = element class type tableElement = object inherit element method caption : tableCaptionElement t prop method tHead : tableSectionElement t prop method tFoot : tableSectionElement t prop method rows : tableRowElement collection t readonly_prop method tBodies : tableSectionElement collection t readonly_prop method align : js_string t prop method border : js_string t prop method cellPadding : js_string t prop method cellSpacing : js_string t prop method frame : js_string t prop method rules : js_string t prop method summary : js_string t prop method width : js_string t prop method createTHead : tableSectionElement t meth method deleteTHead : unit meth method createTFoot : tableSectionElement t meth method deleteTFoot : unit meth method createCaption : tableCaptionElement t meth method deleteCaption : unit meth method insertRow : int -> tableRowElement t meth method deleteRow : int -> unit meth end class type timeRanges = object method length : int readonly_prop method start : int -> float meth method end_ : int -> float meth end type networkState = | NETWORK_EMPTY | NETWORK_IDLE | NETWORK_LOADING | NETWORK_NO_SOURCE type readyState = | HAVE_NOTHING | HAVE_METADATA | HAVE_CURRENT_DATA | HAVE_FUTURE_DATA | HAVE_ENOUGH_DATA (* http://www.w3schools.com/tags/ref_av_dom.asp *) (* only features supported by all browser. (IE9+) *) class type mediaElement = object inherit element method canPlayType : js_string t -> js_string t meth method load : unit meth method play : unit meth method pause : unit meth method autoplay : bool t prop method buffered : timeRanges t readonly_prop method controls : bool t prop method currentSrc : js_string t readonly_prop method currentTime : float prop method duration : float readonly_prop method ended : bool t readonly_prop method loop : bool t prop method mediagroup : js_string t prop method muted : bool t prop method networkState_int : int readonly_prop method networkState : networkState readonly_prop method paused : bool t readonly_prop method playbackRate : float prop method played : timeRanges t readonly_prop method preload : js_string t prop method readyState_int : int readonly_prop method readyState : readyState readonly_prop method seekable : timeRanges t readonly_prop method seeking : bool t readonly_prop method src : js_string t prop method volume : float prop method oncanplay : ('self t, mediaEvent t) event_listener writeonly_prop method oncanplaythrough : ('self t, mediaEvent t) event_listener writeonly_prop method ondurationchange : ('self t, mediaEvent t) event_listener writeonly_prop method onemptied : ('self t, mediaEvent t) event_listener writeonly_prop method onended : ('self t, mediaEvent t) event_listener writeonly_prop method onloadeddata : ('self t, mediaEvent t) event_listener writeonly_prop method onloadedmetadata : ('self t, mediaEvent t) event_listener writeonly_prop method onloadstart : ('self t, mediaEvent t) event_listener writeonly_prop method onpause : ('self t, mediaEvent t) event_listener writeonly_prop method onplay : ('self t, mediaEvent t) event_listener writeonly_prop method onplaying : ('self t, mediaEvent t) event_listener writeonly_prop method onratechange : ('self t, mediaEvent t) event_listener writeonly_prop method onseeked : ('self t, mediaEvent t) event_listener writeonly_prop method onseeking : ('self t, mediaEvent t) event_listener writeonly_prop method onstalled : ('self t, mediaEvent t) event_listener writeonly_prop method onsuspend : ('self t, mediaEvent t) event_listener writeonly_prop method onvolumechange : ('self t, mediaEvent t) event_listener writeonly_prop method onwaiting : ('self t, mediaEvent t) event_listener writeonly_prop end class type audioElement = object inherit mediaElement end class type videoElement = object inherit mediaElement end type context = js_string t let _2d_ = Js.string "2d" type canvasPattern class type canvasElement = object inherit element method width : int prop method height : int prop method toDataURL : js_string t meth method toDataURL_type : js_string t -> js_string t meth method toDataURL_type_compression : js_string t -> float -> js_string t meth method getContext : js_string t -> canvasRenderingContext2D t meth end and canvasRenderingContext2D = object method canvas : canvasElement t readonly_prop method save : unit meth method restore : unit meth method scale : float -> float -> unit meth method rotate : float -> unit meth method translate : float -> float -> unit meth method transform : float -> float -> float -> float -> float -> float -> unit meth method setTransform : float -> float -> float -> float -> float -> float -> unit meth method globalAlpha : float prop method globalCompositeOperation : js_string t prop method strokeStyle : js_string t writeonly_prop method strokeStyle_gradient : canvasGradient t writeonly_prop method strokeStyle_pattern : canvasPattern t writeonly_prop method fillStyle : js_string t writeonly_prop method fillStyle_gradient : canvasGradient t writeonly_prop method fillStyle_pattern : canvasPattern t writeonly_prop method createLinearGradient : float -> float -> float -> float -> canvasGradient t meth method createRadialGradient : float -> float -> float -> float -> float -> float -> canvasGradient t meth method createPattern : imageElement t -> js_string t -> canvasPattern t meth method createPattern_fromCanvas : canvasElement t -> js_string t -> canvasPattern t meth method createPattern_fromVideo : videoElement t -> js_string t -> canvasPattern t meth method lineWidth : float prop method lineCap : js_string t prop method lineJoin : js_string t prop method miterLimit : float prop method shadowOffsetX : float prop method shadowOffsetY : float prop method shadowBlur : float prop method shadowColor : js_string t prop method clearRect : float -> float -> float -> float -> unit meth method fillRect : float -> float -> float -> float -> unit meth method strokeRect : float -> float -> float -> float -> unit meth method beginPath : unit meth method closePath : unit meth method moveTo : float -> float -> unit meth method lineTo : float -> float -> unit meth method quadraticCurveTo : float -> float -> float -> float -> unit meth method bezierCurveTo : float -> float -> float -> float -> float -> float -> unit meth method arcTo : float -> float -> float -> float -> float -> unit meth method rect : float -> float -> float -> float -> unit meth method arc : float -> float -> float -> float -> float -> bool t -> unit meth method fill : unit meth method stroke : unit meth method clip : unit meth method isPointInPath : float -> float -> bool t meth method drawFocusRing : #element t -> float -> float -> bool t -> bool t meth method font : js_string t prop method textAlign : js_string t prop method textBaseline : js_string t prop method fillText : js_string t -> float -> float -> unit meth method fillText_withWidth : js_string t -> float -> float -> float -> unit meth method strokeText : js_string t -> float -> float -> unit meth method strokeText_withWidth : js_string t -> float -> float -> float -> unit meth method measureText : js_string t -> textMetrics t meth method drawImage : imageElement t -> float -> float -> unit meth method drawImage_withSize : imageElement t -> float -> float -> float -> float -> unit meth method drawImage_full : imageElement t -> float -> float -> float -> float -> float -> float -> float -> float -> unit meth method drawImage_fromCanvas : canvasElement t -> float -> float -> unit meth method drawImage_fromCanvasWithSize : canvasElement t -> float -> float -> float -> float -> unit meth method drawImage_fullFromCanvas : canvasElement t -> float -> float -> float -> float -> float -> float -> float -> float -> unit meth method drawImage_fromVideoWithVideo : videoElement t -> float -> float -> unit meth method drawImage_fromVideoWithSize : videoElement t -> float -> float -> float -> float -> unit meth method drawImage_fullFromVideo : videoElement t -> float -> float -> float -> float -> float -> float -> float -> float -> unit meth method createImageData : int -> int -> imageData t meth method getImageData : float -> float -> float -> float -> imageData t meth method putImageData : imageData t -> float -> float -> unit meth end and canvasGradient = object method addColorStop : float -> js_string t -> unit meth end and textMetrics = object method width : float readonly_prop end and imageData = object method width : int readonly_prop method height : int readonly_prop method data : canvasPixelArray t readonly_prop end and canvasPixelArray = object method length : int readonly_prop end external pixel_get : canvasPixelArray t -> int -> int = "caml_js_get" external pixel_set : canvasPixelArray t -> int -> int -> unit = "caml_js_set" class type range = object method collapsed : bool t readonly_prop method startOffset : int readonly_prop method endOffset : int readonly_prop method startContainer : Dom.node t readonly_prop method endContainer : Dom.node t readonly_prop method setStart : Dom.node t -> int -> unit meth method setEnd : Dom.node t -> int -> unit meth method setStartBefore : Dom.node t -> unit meth method setEndBefore : Dom.node t -> unit meth method setStartAfter : Dom.node t -> unit meth method setEndAfter : Dom.node t -> unit meth method selectNode : Dom.node t -> unit meth method selectNodeContents : Dom.node t -> unit meth method collapse : bool t -> unit meth method cloneContents : Dom.documentFragment t meth method extractContents : Dom.documentFragment t meth method deleteContents : unit meth method insertNode : Dom.node t -> unit meth method surroundContents : Dom.node t -> unit meth method cloneRange : range t meth method toString : js_string t meth end (** Information on current selection *) class type selection = object method anchorNode : Dom.node t readonly_prop method anchorOffset : int readonly_prop method focusNode : Dom.node t readonly_prop method focusOffset : int readonly_prop method isCollapsed : bool t readonly_prop method rangeCount : int readonly_prop method getRangeAt : int -> range t meth method collapse : bool t -> unit meth method extend : Dom.node t -> int -> unit meth method modify : js_string t -> js_string t -> js_string t -> unit meth method collapseToStart : unit meth method collapseToEnd : unit meth method selectAllChildren : Dom.node t -> unit meth method addRange : range t -> unit meth method removeRange : range t -> unit meth method removeAllRanges : unit meth method deleteFromDocument : unit meth method containsNode : Dom.node t -> bool t -> bool t meth method toString : js_string t meth end class type document = object inherit [element] Dom.document inherit nodeSelector inherit eventTarget method title : js_string t prop method referrer : js_string t readonly_prop method domain : js_string t prop method _URL : js_string t readonly_prop method head : headElement t prop method body : bodyElement t prop method documentElement : htmlElement t readonly_prop method images : imageElement collection t readonly_prop method applets : element collection t readonly_prop method links : element collection t readonly_prop method forms : formElement collection t readonly_prop method anchors : element collection t readonly_prop method cookie : js_string t prop method designMode : js_string t prop method open_ : unit meth method close : unit meth method write : js_string t -> unit meth method execCommand : js_string t -> bool t -> js_string t opt -> unit meth method createRange : range t meth method readyState : js_string t readonly_prop method getElementsByClassName : js_string t -> element Dom.nodeList t meth method getElementsByName : js_string t -> element Dom.nodeList t meth method activeElement : element t opt readonly_prop inherit eventTarget end type interval_id type timeout_id type animation_frame_request_id class type location = object method href : js_string t prop method protocol : js_string t prop method host : js_string t prop method hostname : js_string t prop method origin : js_string t optdef readonly_prop method port : js_string t prop method pathname : js_string t prop method search : js_string t prop method hash : js_string t prop method assign : js_string t -> unit meth method replace : js_string t -> unit meth method reload : unit meth end let location_origin (loc : location t) = Optdef.case loc##.origin (fun () -> let protocol = loc##.protocol in let hostname = loc##.hostname in let port = loc##.port in if protocol##.length = 0 && hostname##.length = 0 then Js.string "" else let origin = protocol##concat_2 (Js.string "//") hostname in if port##.length > 0 then origin##concat_2 (Js.string ":") loc##.port else origin) (fun o -> o) class type history = object method length : int readonly_prop method state : Js.Unsafe.any readonly_prop method go : int opt -> unit meth method back : unit meth method forward : unit meth method pushState : 'a. 'a -> js_string t -> js_string t opt -> unit meth method replaceState : 'a. 'a -> js_string t -> js_string t opt -> unit meth end class type undoManager = object end class type navigator = object method appCodeName : js_string t readonly_prop method appName : js_string t readonly_prop method appVersion : js_string t readonly_prop method cookieEnabled : bool t readonly_prop method onLine : bool t readonly_prop method platform : js_string t readonly_prop method userAgent : js_string t readonly_prop method language : js_string t optdef readonly_prop method userLanguage : js_string t optdef readonly_prop end class type screen = object method width : int readonly_prop method height : int readonly_prop method availWidth : int readonly_prop method availHeight : int readonly_prop end class type applicationCache = object method status : int readonly_prop method update : unit meth method abort : unit meth method swapCache : unit meth method onchecking : (applicationCache t, event t) event_listener prop method onerror : (applicationCache t, event t) event_listener prop method onnoupdate : (applicationCache t, event t) event_listener prop method ondownloading : (applicationCache t, event t) event_listener prop method onprogress : (applicationCache t, event t) event_listener prop method onupdateready : (applicationCache t, event t) event_listener prop method oncached : (applicationCache t, event t) event_listener prop method onobsolete : (applicationCache t, event t) event_listener prop inherit eventTarget end class type _URL = object method createObjectURL : #File.blob t -> js_string t meth method revokeObjectURL : js_string t -> unit meth end class type window = object inherit eventTarget method document : document t readonly_prop method applicationCache : applicationCache t readonly_prop method name : js_string t prop method location : location t readonly_prop method history : history t readonly_prop method undoManager : undoManager t readonly_prop method navigator : navigator t readonly_prop method getSelection : selection t meth method close : unit meth method closed : bool t readonly_prop method stop : unit meth method focus : unit meth method blur : unit meth method scroll : int -> int -> unit meth method scrollBy : int -> int -> unit meth method sessionStorage : storage t optdef readonly_prop method localStorage : storage t optdef readonly_prop method top : window t readonly_prop method parent : window t readonly_prop method frameElement : element t opt readonly_prop method open_ : js_string t -> js_string t -> js_string t opt -> window t opt meth method alert : js_string t -> unit meth method confirm : js_string t -> bool t meth method prompt : js_string t -> js_string t -> js_string t opt meth method print : unit meth method setInterval : (unit -> unit) Js.callback -> float -> interval_id meth method clearInterval : interval_id -> unit meth method setTimeout : (unit -> unit) Js.callback -> float -> timeout_id meth method clearTimeout : timeout_id -> unit meth method requestAnimationFrame : (float -> unit) Js.callback -> animation_frame_request_id meth method cancelAnimationFrame : animation_frame_request_id -> unit meth method screen : screen t readonly_prop method innerWidth : int optdef readonly_prop method innerHeight : int optdef readonly_prop method outerWidth : int optdef readonly_prop method outerHeight : int optdef readonly_prop method getComputedStyle : #element t -> cssStyleDeclaration t meth method getComputedStyle_pseudoElt : #element t -> js_string t -> cssStyleDeclaration t meth method atob : js_string t -> js_string t meth method btoa : js_string t -> js_string t meth method onload : (window t, event t) event_listener prop method onunload : (window t, event t) event_listener prop method onbeforeunload : (window t, event t) event_listener prop method onblur : (window t, focusEvent t) event_listener prop method onfocus : (window t, focusEvent t) event_listener prop method onresize : (window t, event t) event_listener prop method onorientationchange : (window t, event t) event_listener prop method onpopstate : (window t, popStateEvent t) event_listener prop method onhashchange : (window t, hashChangeEvent t) event_listener prop method ononline : (window t, event t) event_listener writeonly_prop method onoffline : (window t, event t) event_listener writeonly_prop method _URL : _URL t readonly_prop method devicePixelRatio : float readonly_prop end let window : window t = Js.Unsafe.global (* The toplevel object *) let document = window##.document let getElementById id = Js.Opt.case (document##getElementById (Js.string id)) (fun () -> raise Not_found) (fun pnode -> pnode) let getElementById_exn id = Js.Opt.case (document##getElementById (Js.string id)) (fun () -> failwith (Printf.sprintf "getElementById_exn: %S not found" id)) (fun pnode -> pnode) let getElementById_opt id = Js.Opt.to_option (document##getElementById (Js.string id)) let getElementById_coerce id coerce = Js.Opt.case (document##getElementById (Js.string id)) (fun () -> None) (fun e -> Js.Opt.to_option (coerce e)) (****) class type frameSetElement = object inherit element method cols : js_string t prop method rows : js_string t prop end class type frameElement = object inherit element method frameBorder : js_string t prop method longDesc : js_string t prop method marginHeight : js_string t prop method marginWidth : js_string t prop method name : js_string t prop method noResize : bool t prop method scrolling : js_string t prop method src : js_string t prop method contentDocument : document t opt readonly_prop end class type iFrameElement = object inherit element method frameBorder : js_string t prop method height : js_string t prop method width : js_string t prop method longDesc : js_string t prop method marginHeight : js_string t prop method marginWidth : js_string t prop method name : js_string t prop method scrolling : js_string t prop method src : js_string t prop method contentDocument : document t opt readonly_prop method contentWindow : window t readonly_prop end (****) (*XXX Should provide creation functions a la lablgtk... *) let opt_iter x f = match x with | None -> () | Some v -> f v let createElement (doc : document t) name = doc##createElement (Js.string name) let unsafeCreateElement doc name = Js.Unsafe.coerce (createElement doc name) let createElementSyntax = ref `Unknown let rec unsafeCreateElementEx ?_type ?name doc elt = if Poly.(_type = None) && Poly.(name = None) then Js.Unsafe.coerce (createElement doc elt) else match !createElementSyntax with | `Standard -> let res = Js.Unsafe.coerce (createElement doc elt) in opt_iter _type (fun t -> res##._type := t); opt_iter name (fun n -> res##.name := n); res | `Extended -> let a = new%js Js.array_empty in ignore (a##push_2 (Js.string "<") (Js.string elt)); opt_iter _type (fun t -> ignore (a##push_3 (Js.string " type=\"") (html_escape t) (Js.string "\""))); opt_iter name (fun n -> ignore (a##push_3 (Js.string " name=\"") (html_escape n) (Js.string "\""))); ignore (a##push (Js.string ">")); Js.Unsafe.coerce (doc##createElement (a##join (Js.string ""))) | `Unknown -> createElementSyntax := if try let el : inputElement Js.t = Js.Unsafe.coerce (document##createElement (Js.string "")) in el##.tagName##toLowerCase == Js.string "input" && el##.name == Js.string "x" with _ -> false then `Extended else `Standard; unsafeCreateElementEx ?_type ?name doc elt let createHtml doc : htmlElement t = unsafeCreateElement doc "html" let createHead doc : headElement t = unsafeCreateElement doc "head" let createLink doc : linkElement t = unsafeCreateElement doc "link" let createTitle doc : titleElement t = unsafeCreateElement doc "title" let createMeta doc : metaElement t = unsafeCreateElement doc "meta" let createBase doc : baseElement t = unsafeCreateElement doc "base" let createStyle doc : styleElement t = unsafeCreateElement doc "style" let createBody doc : bodyElement t = unsafeCreateElement doc "body" let createForm doc : formElement t = unsafeCreateElement doc "form" let createOptgroup doc : optGroupElement t = unsafeCreateElement doc "optgroup" let createOption doc : optionElement t = unsafeCreateElement doc "option" let createSelect ?_type ?name doc : selectElement t = unsafeCreateElementEx ?_type ?name doc "select" let createInput ?_type ?name doc : inputElement t = unsafeCreateElementEx ?_type ?name doc "input" let createTextarea ?_type ?name doc : textAreaElement t = unsafeCreateElementEx ?_type ?name doc "textarea" let createButton ?_type ?name doc : buttonElement t = unsafeCreateElementEx ?_type ?name doc "button" let createLabel doc : labelElement t = unsafeCreateElement doc "label" let createFieldset doc : fieldSetElement t = unsafeCreateElement doc "fieldset" let createLegend doc : legendElement t = unsafeCreateElement doc "legend" let createUl doc : uListElement t = unsafeCreateElement doc "ul" let createOl doc : oListElement t = unsafeCreateElement doc "ol" let createDl doc : dListElement t = unsafeCreateElement doc "dl" let createLi doc : liElement t = unsafeCreateElement doc "li" let createDiv doc : divElement t = unsafeCreateElement doc "div" let createEmbed doc : embedElement t = unsafeCreateElement doc "embed" let createP doc : paragraphElement t = unsafeCreateElement doc "p" let createH1 doc : headingElement t = unsafeCreateElement doc "h1" let createH2 doc : headingElement t = unsafeCreateElement doc "h2" let createH3 doc : headingElement t = unsafeCreateElement doc "h3" let createH4 doc : headingElement t = unsafeCreateElement doc "h4" let createH5 doc : headingElement t = unsafeCreateElement doc "h5" let createH6 doc : headingElement t = unsafeCreateElement doc "h6" let createQ doc : quoteElement t = unsafeCreateElement doc "q" let createBlockquote doc : quoteElement t = unsafeCreateElement doc "blockquote" let createPre doc : preElement t = unsafeCreateElement doc "pre" let createBr doc : brElement t = unsafeCreateElement doc "br" let createHr doc : hrElement t = unsafeCreateElement doc "hr" let createIns doc : modElement t = unsafeCreateElement doc "ins" let createDel doc : modElement t = unsafeCreateElement doc "del" let createA doc : anchorElement t = unsafeCreateElement doc "a" let createImg doc : imageElement t = unsafeCreateElement doc "img" let createObject doc : objectElement t = unsafeCreateElement doc "object" let createParam doc : paramElement t = unsafeCreateElement doc "param" let createMap doc : mapElement t = unsafeCreateElement doc "map" let createArea doc : areaElement t = unsafeCreateElement doc "area" let createScript doc : scriptElement t = unsafeCreateElement doc "script" let createTable doc : tableElement t = unsafeCreateElement doc "table" let createCaption doc : tableCaptionElement t = unsafeCreateElement doc "caption" let createCol doc : tableColElement t = unsafeCreateElement doc "col" let createColgroup doc : tableColElement t = unsafeCreateElement doc "colgroup" let createThead doc : tableSectionElement t = unsafeCreateElement doc "thead" let createTfoot doc : tableSectionElement t = unsafeCreateElement doc "tfoot" let createTbody doc : tableSectionElement t = unsafeCreateElement doc "tbody" let createTr doc : tableRowElement t = unsafeCreateElement doc "tr" let createTh doc : tableCellElement t = unsafeCreateElement doc "th" let createTd doc : tableCellElement t = unsafeCreateElement doc "td" let createSub doc = createElement doc "sub" let createSup doc = createElement doc "sup" let createSpan doc = createElement doc "span" let createTt doc = createElement doc "tt" let createI doc = createElement doc "i" let createB doc = createElement doc "b" let createBig doc = createElement doc "big" let createSmall doc = createElement doc "small" let createEm doc = createElement doc "em" let createStrong doc = createElement doc "strong" let createCite doc = createElement doc "cite" let createDfn doc = createElement doc "dfn" let createCode doc = createElement doc "code" let createSamp doc = createElement doc "samp" let createKbd doc = createElement doc "kbd" let createVar doc = createElement doc "var" let createAbbr doc = createElement doc "abbr" let createDd doc = createElement doc "dd" let createDt doc = createElement doc "dt" let createNoscript doc = createElement doc "noscript" let createAddress doc = createElement doc "address" let createFrameset doc : frameSetElement t = unsafeCreateElement doc "frameset" let createFrame doc : frameElement t = unsafeCreateElement doc "frame" let createIframe doc : iFrameElement t = unsafeCreateElement doc "iframe" let createAudio doc : audioElement t = unsafeCreateElement doc "audio" let createVideo doc : audioElement t = unsafeCreateElement doc "video" exception Canvas_not_available let createCanvas doc : canvasElement t = let c = unsafeCreateElement doc "canvas" in if not (Opt.test c##.getContext) then raise Canvas_not_available; c let html_element : htmlElement t constr = Js.Unsafe.global##._HTMLElement module CoerceTo = struct let element : #Dom.node Js.t -> element Js.t Js.opt = if def html_element == undefined then (* ie < 9 does not have HTMLElement: we have to cheat to check that something is an html element *) fun e -> if def (Js.Unsafe.coerce e)##.innerHTML == undefined then Js.null else Js.some (Js.Unsafe.coerce e) else fun e -> if Js.instanceof e html_element then Js.some (Js.Unsafe.coerce e) else Js.null let unsafeCoerce tag (e : #element t) = if e##.tagName##toLowerCase == Js.string tag then Js.some (Js.Unsafe.coerce e) else Js.null let a e = unsafeCoerce "a" e let area e = unsafeCoerce "area" e let base e = unsafeCoerce "base" e let blockquote e = unsafeCoerce "blockquote" e let body e = unsafeCoerce "body" e let br e = unsafeCoerce "br" e let button e = unsafeCoerce "button" e let canvas e = unsafeCoerce "canvas" e let caption e = unsafeCoerce "caption" e let col e = unsafeCoerce "col" e let colgroup e = unsafeCoerce "colgroup" e let del e = unsafeCoerce "del" e let div e = unsafeCoerce "div" e let dl e = unsafeCoerce "dl" e let fieldset e = unsafeCoerce "fieldset" e let embed e = unsafeCoerce "embed" e let form e = unsafeCoerce "form" e let frameset e = unsafeCoerce "frameset" e let frame e = unsafeCoerce "frame" e let h1 e = unsafeCoerce "h1" e let h2 e = unsafeCoerce "h2" e let h3 e = unsafeCoerce "h3" e let h4 e = unsafeCoerce "h4" e let h5 e = unsafeCoerce "h5" e let h6 e = unsafeCoerce "h6" e let head e = unsafeCoerce "head" e let hr e = unsafeCoerce "hr" e let html e = unsafeCoerce "html" e let iframe e = unsafeCoerce "iframe" e let img e = unsafeCoerce "img" e let input e = unsafeCoerce "input" e let ins e = unsafeCoerce "ins" e let label e = unsafeCoerce "label" e let legend e = unsafeCoerce "legend" e let li e = unsafeCoerce "li" e let link e = unsafeCoerce "link" e let map e = unsafeCoerce "map" e let meta e = unsafeCoerce "meta" e let _object e = unsafeCoerce "object" e let ol e = unsafeCoerce "ol" e let optgroup e = unsafeCoerce "optgroup" e let option e = unsafeCoerce "option" e let p e = unsafeCoerce "p" e let param e = unsafeCoerce "param" e let pre e = unsafeCoerce "pre" e let q e = unsafeCoerce "q" e let script e = unsafeCoerce "script" e let select e = unsafeCoerce "select" e let style e = unsafeCoerce "style" e let table e = unsafeCoerce "table" e let tbody e = unsafeCoerce "tbody" e let td e = unsafeCoerce "td" e let textarea e = unsafeCoerce "textarea" e let tfoot e = unsafeCoerce "tfoot" e let th e = unsafeCoerce "th" e let thead e = unsafeCoerce "thead" e let title e = unsafeCoerce "title" e let tr e = unsafeCoerce "tr" e let ul e = unsafeCoerce "ul" e let audio e = unsafeCoerce "audio" e let video e = unsafeCoerce "video" e let unsafeCoerceEvent constr (ev : #event t) = if def constr != undefined && Js.instanceof ev constr then Js.some (Js.Unsafe.coerce ev) else Js.null let mouseEvent ev = unsafeCoerceEvent Js.Unsafe.global##._MouseEvent ev let keyboardEvent ev = unsafeCoerceEvent Js.Unsafe.global##._KeyboardEvent ev let wheelEvent ev = unsafeCoerceEvent Js.Unsafe.global##._WheelEvent ev let mouseScrollEvent ev = unsafeCoerceEvent Js.Unsafe.global##._MouseScrollEvent ev let popStateEvent ev = unsafeCoerceEvent Js.Unsafe.global##._PopStateEvent ev end (****) let eventTarget = Dom.eventTarget let eventRelatedTarget (e : #mouseEvent t) = Optdef.get e##.relatedTarget (fun () -> match Js.to_string e##._type with | "mouseover" -> Optdef.get e##.fromElement (fun () -> assert false) | "mouseout" -> Optdef.get e##.toElement (fun () -> assert false) | _ -> Js.null) let eventAbsolutePosition' (e : #mouseEvent t) = let body = document##.body in let html = document##.documentElement in ( e##.clientX + body##.scrollLeft + html##.scrollLeft , e##.clientY + body##.scrollTop + html##.scrollTop ) let eventAbsolutePosition (e : #mouseEvent t) = Optdef.case e##.pageX (fun () -> eventAbsolutePosition' e) (fun x -> Optdef.case e##.pageY (fun () -> eventAbsolutePosition' e) (fun y -> x, y)) let elementClientPosition (e : #element t) = let r = e##getBoundingClientRect in let body = document##.body in let html = document##.documentElement in ( truncate r##.left - body##.clientLeft - html##.clientLeft , truncate r##.top - body##.clientTop - html##.clientTop ) let getDocumentScroll () = let body = document##.body in let html = document##.documentElement in body##.scrollLeft + html##.scrollLeft, body##.scrollTop + html##.scrollTop let buttonPressed (ev : #mouseEvent Js.t) = Js.Optdef.case ev##.which (fun () -> match ev##.button with | 1 -> Left_button | 2 -> Right_button | 4 -> Middle_button | _ -> No_button) (fun x -> x) let hasMousewheelEvents () = let d = createDiv document in d##setAttribute (Js.string "onmousewheel") (Js.string "return;"); Js.typeof (Js.Unsafe.get d (Js.string "onmousewheel")) == Js.string "function" let addMousewheelEventListenerWithOptions e ?capture ?once ?passive h = if hasMousewheelEvents () then addEventListenerWithOptions ?capture ?once ?passive e Event.mousewheel (handler (fun (e : mousewheelEvent t) -> let dx = -Optdef.get e##.wheelDeltaX (fun () -> 0) / 40 in let dy = -Optdef.get e##.wheelDeltaY (fun () -> e##.wheelDelta) / 40 in h (e :> mouseEvent t) ~dx ~dy)) else addEventListenerWithOptions ?capture ?once ?passive e Event._DOMMouseScroll (handler (fun (e : mouseScrollEvent t) -> let d = e##.detail in if e##.axis == e##._HORIZONTAL_AXIS then h (e :> mouseEvent t) ~dx:d ~dy:0 else h (e :> mouseEvent t) ~dx:0 ~dy:d)) let addMousewheelEventListener e h capt = addMousewheelEventListenerWithOptions ~capture:capt e h (*****) module Keyboard_code = struct type t = | Unidentified (* Alphabetic Characters *) | KeyA | KeyB | KeyC | KeyD | KeyE | KeyF | KeyG | KeyH | KeyI | KeyJ | KeyK | KeyL | KeyM | KeyN | KeyO | KeyP | KeyQ | KeyR | KeyS | KeyT | KeyU | KeyV | KeyW | KeyX | KeyY | KeyZ (* Digits *) | Digit0 | Digit1 | Digit2 | Digit3 | Digit4 | Digit5 | Digit6 | Digit7 | Digit8 | Digit9 | Minus | Equal (* Whitespace *) | Tab | Enter | Space (* Editing *) | Escape | Backspace | Insert | Delete | CapsLock (* Misc Printable *) | BracketLeft | BracketRight | Semicolon | Quote | Backquote | Backslash | Comma | Period | Slash (* Function keys *) | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 (* Numpad keys *) | Numpad0 | Numpad1 | Numpad2 | Numpad3 | Numpad4 | Numpad5 | Numpad6 | Numpad7 | Numpad8 | Numpad9 | NumpadMultiply | NumpadSubtract | NumpadAdd | NumpadDecimal | NumpadEqual | NumpadEnter | NumpadDivide | NumLock (* Modifier keys *) | ControlLeft | ControlRight | MetaLeft | MetaRight | ShiftLeft | ShiftRight | AltLeft | AltRight (* Arrow keys *) | ArrowLeft | ArrowRight | ArrowUp | ArrowDown (* Navigation *) | PageUp | PageDown | Home | End (* Sound *) | VolumeMute | VolumeDown | VolumeUp (* Media *) | MediaTrackPrevious | MediaTrackNext | MediaPlayPause | MediaStop (* Browser special *) | ContextMenu | BrowserSearch | BrowserHome | BrowserFavorites | BrowserRefresh | BrowserStop | BrowserForward | BrowserBack (* Misc *) | OSLeft | OSRight | ScrollLock | PrintScreen | IntlBackslash | IntlYen | Pause let try_code v = match Js.to_string v with (* Alphabetic Characters *) | "KeyA" -> KeyA | "KeyB" -> KeyB | "KeyC" -> KeyC | "KeyD" -> KeyD | "KeyE" -> KeyE | "KeyF" -> KeyF | "KeyG" -> KeyG | "KeyH" -> KeyH | "KeyI" -> KeyI | "KeyJ" -> KeyJ | "KeyK" -> KeyK | "KeyL" -> KeyL | "KeyM" -> KeyM | "KeyN" -> KeyN | "KeyO" -> KeyO | "KeyP" -> KeyP | "KeyQ" -> KeyQ | "KeyR" -> KeyR | "KeyS" -> KeyS | "KeyT" -> KeyT | "KeyU" -> KeyU | "KeyV" -> KeyV | "KeyW" -> KeyW | "KeyX" -> KeyX | "KeyY" -> KeyY | "KeyZ" -> KeyZ (* Digits *) | "Digit0" -> Digit0 | "Digit1" -> Digit1 | "Digit2" -> Digit2 | "Digit3" -> Digit3 | "Digit4" -> Digit4 | "Digit5" -> Digit5 | "Digit6" -> Digit6 | "Digit7" -> Digit7 | "Digit8" -> Digit8 | "Digit9" -> Digit9 | "Minus" -> Minus | "Equal" -> Equal (* Whitespace *) | "Tab" -> Tab | "Enter" -> Enter | "Space" -> Space (* Editing *) | "Escape" -> Escape | "Backspace" -> Backspace | "Insert" -> Insert | "Delete" -> Delete | "CapsLock" -> CapsLock (* Misc Printable *) | "BracketLeft" -> BracketLeft | "BracketRight" -> BracketRight | "Semicolon" -> Semicolon | "Quote" -> Quote | "Backquote" -> Backquote | "Backslash" -> Backslash | "Comma" -> Comma | "Period" -> Period | "Slash" -> Slash (* Function keys *) | "F1" -> F1 | "F2" -> F2 | "F3" -> F3 | "F4" -> F4 | "F5" -> F5 | "F6" -> F6 | "F7" -> F7 | "F8" -> F8 | "F9" -> F9 | "F10" -> F10 | "F11" -> F11 | "F12" -> F12 (* Numpad keys *) | "Numpad0" -> Numpad0 | "Numpad1" -> Numpad1 | "Numpad2" -> Numpad2 | "Numpad3" -> Numpad3 | "Numpad4" -> Numpad4 | "Numpad5" -> Numpad5 | "Numpad6" -> Numpad6 | "Numpad7" -> Numpad7 | "Numpad8" -> Numpad8 | "Numpad9" -> Numpad9 | "NumpadMultiply" -> NumpadMultiply | "NumpadSubtract" -> NumpadSubtract | "NumpadAdd" -> NumpadAdd | "NumpadDecimal" -> NumpadDecimal | "NumpadEqual" -> NumpadEqual | "NumpadEnter" -> NumpadEnter | "NumpadDivide" -> NumpadDivide | "NumLock" -> NumLock (* Modifier keys *) | "ControlLeft" -> ControlLeft | "ControlRight" -> ControlRight | "MetaLeft" -> MetaLeft | "MetaRight" -> MetaRight | "ShiftLeft" -> ShiftLeft | "ShiftRight" -> ShiftRight | "AltLeft" -> AltLeft | "AltRight" -> AltRight (* Arrow keys *) | "ArrowLeft" -> ArrowLeft | "ArrowRight" -> ArrowRight | "ArrowUp" -> ArrowUp | "ArrowDown" -> ArrowDown (* Navigation *) | "PageUp" -> PageUp | "PageDown" -> PageDown | "Home" -> Home | "End" -> End (* Sound *) | "VolumeMute" -> VolumeMute | "VolumeDown" -> VolumeDown | "VolumeUp" -> VolumeUp (* Media *) | "MediaTrackPrevious" -> MediaTrackPrevious | "MediaTrackNext" -> MediaTrackNext | "MediaPlayPause" -> MediaPlayPause | "MediaStop" -> MediaStop (* Browser special *) | "ContextMenu" -> ContextMenu | "BrowserSearch" -> BrowserSearch | "BrowserHome" -> BrowserHome | "BrowserFavorites" -> BrowserFavorites | "BrowserRefresh" -> BrowserRefresh | "BrowserStop" -> BrowserStop | "BrowserForward" -> BrowserForward | "BrowserBack" -> BrowserBack (* Misc *) | "OSLeft" -> OSLeft | "OSRight" -> OSRight | "ScrollLock" -> ScrollLock | "PrintScreen" -> PrintScreen | "IntlBackslash" -> IntlBackslash | "IntlYen" -> IntlYen | "Pause" -> Pause | _ -> Unidentified let try_key_code_left = function | 16 -> ShiftLeft | 17 -> ControlLeft | 18 -> AltLeft | 91 -> MetaLeft | _ -> Unidentified let try_key_code_right = function | 16 -> ShiftRight | 17 -> ControlRight | 18 -> AltRight | 91 -> MetaRight | _ -> Unidentified let try_key_code_numpad = function | 46 -> NumpadDecimal | 45 -> Numpad0 | 35 -> Numpad1 | 40 -> Numpad2 | 34 -> Numpad3 | 37 -> Numpad4 | 12 -> Numpad5 | 39 -> Numpad6 | 36 -> Numpad7 | 38 -> Numpad8 | 33 -> Numpad9 | 13 -> NumpadEnter | 111 -> NumpadDivide | 107 -> NumpadAdd | 109 -> NumpadSubtract | 106 -> NumpadMultiply | 110 -> NumpadDecimal | 96 -> Numpad0 | 97 -> Numpad1 | 98 -> Numpad2 | 99 -> Numpad3 | 100 -> Numpad4 | 101 -> Numpad5 | 102 -> Numpad6 | 103 -> Numpad7 | 104 -> Numpad8 | 105 -> Numpad9 | _ -> Unidentified let try_key_code_normal = function | 27 -> Escape | 112 -> F1 | 113 -> F2 | 114 -> F3 | 115 -> F4 | 116 -> F5 | 117 -> F6 | 118 -> F7 | 119 -> F8 | 120 -> F9 | 121 -> F10 | 122 -> F11 | 123 -> F12 | 42 -> PrintScreen | 145 -> ScrollLock | 19 -> Pause | 192 -> Backquote | 49 -> Digit1 | 50 -> Digit2 | 51 -> Digit3 | 52 -> Digit4 | 53 -> Digit5 | 54 -> Digit6 | 55 -> Digit7 | 56 -> Digit8 | 57 -> Digit9 | 48 -> Digit0 | 189 -> Minus | 187 -> Equal | 8 -> Backspace | 9 -> Tab | 81 -> KeyQ | 87 -> KeyW | 69 -> KeyE | 82 -> KeyR | 84 -> KeyT | 89 -> KeyY | 85 -> KeyU | 73 -> KeyI | 79 -> KeyO | 80 -> KeyP | 219 -> BracketLeft | 221 -> BracketRight | 220 -> Backslash | 20 -> CapsLock | 65 -> KeyA | 83 -> KeyS | 68 -> KeyD | 70 -> KeyF | 71 -> KeyG | 72 -> KeyH | 74 -> KeyJ | 75 -> KeyK | 76 -> KeyL | 186 -> Semicolon | 222 -> Quote | 13 -> Enter | 90 -> KeyZ | 88 -> KeyX | 67 -> KeyC | 86 -> KeyV | 66 -> KeyB | 78 -> KeyN | 77 -> KeyM | 188 -> Comma | 190 -> Period | 191 -> Slash | 32 -> Space | 93 -> ContextMenu | 45 -> Insert | 36 -> Home | 33 -> PageUp | 46 -> Delete | 35 -> End | 34 -> PageDown | 37 -> ArrowLeft | 40 -> ArrowDown | 39 -> ArrowRight | 38 -> ArrowUp | _ -> Unidentified let make_unidentified _ = Unidentified let try_next value f = function | Unidentified -> Optdef.case value make_unidentified f | v -> v let run_next value f = function | Unidentified -> f value | v -> v let get_key_code evt = evt##.keyCode let try_key_location evt = match evt##.location with | 1 -> run_next (get_key_code evt) try_key_code_left | 2 -> run_next (get_key_code evt) try_key_code_right | 3 -> run_next (get_key_code evt) try_key_code_numpad | _ -> make_unidentified let ( |> ) x f = f x let of_event evt = Unidentified |> try_next evt##.code try_code |> try_key_location evt |> run_next (get_key_code evt) try_key_code_normal let of_key_code = try_key_code_normal end module Keyboard_key = struct type t = Uchar.t option let char_of_int value = if 0 < value then try Some (Uchar.of_int value) with _ -> None else None let empty_string _ = Js.string "" let none _ = None let of_event evt = let key = Optdef.get evt##.key empty_string in match key##.length with | 0 -> Optdef.case evt##.charCode none char_of_int | 1 -> char_of_int (int_of_float (key##charCodeAt 0)) | _ -> None end (*****) let element : #Dom.element t -> element t = Js.Unsafe.coerce type taggedElement = | A of anchorElement t | Area of areaElement t | Audio of audioElement t | Base of baseElement t | Blockquote of quoteElement t | Body of bodyElement t | Br of brElement t | Button of buttonElement t | Canvas of canvasElement t | Caption of tableCaptionElement t | Col of tableColElement t | Colgroup of tableColElement t | Del of modElement t | Div of divElement t | Dl of dListElement t | Embed of embedElement t | Fieldset of fieldSetElement t | Form of formElement t | Frameset of frameSetElement t | Frame of frameElement t | H1 of headingElement t | H2 of headingElement t | H3 of headingElement t | H4 of headingElement t | H5 of headingElement t | H6 of headingElement t | Head of headElement t | Hr of hrElement t | Html of htmlElement t | Iframe of iFrameElement t | Img of imageElement t | Input of inputElement t | Ins of modElement t | Label of labelElement t | Legend of legendElement t | Li of liElement t | Link of linkElement t | Map of mapElement t | Meta of metaElement t | Object of objectElement t | Ol of oListElement t | Optgroup of optGroupElement t | Option of optionElement t | P of paramElement t | Param of paramElement t | Pre of preElement t | Q of quoteElement t | Script of scriptElement t | Select of selectElement t | Style of styleElement t | Table of tableElement t | Tbody of tableSectionElement t | Td of tableCellElement t | Textarea of textAreaElement t | Tfoot of tableSectionElement t | Th of tableCellElement t | Thead of tableSectionElement t | Title of titleElement t | Tr of tableRowElement t | Ul of uListElement t | Video of videoElement t | Other of element t let other e = Other (e : #element t :> element t) let tagged (e : #element t) = let tag = Js.to_bytestring e##.tagName##toLowerCase in if String.length tag = 0 then other e else match String.unsafe_get tag 0 with | 'a' -> ( match tag with | "a" -> A (Js.Unsafe.coerce e) | "area" -> Area (Js.Unsafe.coerce e) | "audio" -> Audio (Js.Unsafe.coerce e) | _ -> other e) | 'b' -> ( match tag with | "base" -> Base (Js.Unsafe.coerce e) | "blockquote" -> Blockquote (Js.Unsafe.coerce e) | "body" -> Body (Js.Unsafe.coerce e) | "br" -> Br (Js.Unsafe.coerce e) | "button" -> Button (Js.Unsafe.coerce e) | _ -> other e) | 'c' -> ( match tag with | "canvas" -> Canvas (Js.Unsafe.coerce e) | "caption" -> Caption (Js.Unsafe.coerce e) | "col" -> Col (Js.Unsafe.coerce e) | "colgroup" -> Colgroup (Js.Unsafe.coerce e) | _ -> other e) | 'd' -> ( match tag with | "del" -> Del (Js.Unsafe.coerce e) | "div" -> Div (Js.Unsafe.coerce e) | "dl" -> Dl (Js.Unsafe.coerce e) | _ -> other e) | 'e' -> ( match tag with | "embed" -> Embed (Js.Unsafe.coerce e) | _ -> other e) | 'f' -> ( match tag with | "fieldset" -> Fieldset (Js.Unsafe.coerce e) | "form" -> Form (Js.Unsafe.coerce e) | "frameset" -> Frameset (Js.Unsafe.coerce e) | "frame" -> Frame (Js.Unsafe.coerce e) | _ -> other e) | 'h' -> ( match tag with | "h1" -> H1 (Js.Unsafe.coerce e) | "h2" -> H2 (Js.Unsafe.coerce e) | "h3" -> H3 (Js.Unsafe.coerce e) | "h4" -> H4 (Js.Unsafe.coerce e) | "h5" -> H5 (Js.Unsafe.coerce e) | "h6" -> H6 (Js.Unsafe.coerce e) | "head" -> Head (Js.Unsafe.coerce e) | "hr" -> Hr (Js.Unsafe.coerce e) | "html" -> Html (Js.Unsafe.coerce e) | _ -> other e) | 'i' -> ( match tag with | "iframe" -> Iframe (Js.Unsafe.coerce e) | "img" -> Img (Js.Unsafe.coerce e) | "input" -> Input (Js.Unsafe.coerce e) | "ins" -> Ins (Js.Unsafe.coerce e) | _ -> other e) | 'l' -> ( match tag with | "label" -> Label (Js.Unsafe.coerce e) | "legend" -> Legend (Js.Unsafe.coerce e) | "li" -> Li (Js.Unsafe.coerce e) | "link" -> Link (Js.Unsafe.coerce e) | _ -> other e) | 'm' -> ( match tag with | "map" -> Map (Js.Unsafe.coerce e) | "meta" -> Meta (Js.Unsafe.coerce e) | _ -> other e) | 'o' -> ( match tag with | "object" -> Object (Js.Unsafe.coerce e) | "ol" -> Ol (Js.Unsafe.coerce e) | "optgroup" -> Optgroup (Js.Unsafe.coerce e) | "option" -> Option (Js.Unsafe.coerce e) | _ -> other e) | 'p' -> ( match tag with | "p" -> P (Js.Unsafe.coerce e) | "param" -> Param (Js.Unsafe.coerce e) | "pre" -> Pre (Js.Unsafe.coerce e) | _ -> other e) | 'q' -> ( match tag with | "q" -> Q (Js.Unsafe.coerce e) | _ -> other e) | 's' -> ( match tag with | "script" -> Script (Js.Unsafe.coerce e) | "select" -> Select (Js.Unsafe.coerce e) | "style" -> Style (Js.Unsafe.coerce e) | _ -> other e) | 't' -> ( match tag with | "table" -> Table (Js.Unsafe.coerce e) | "tbody" -> Tbody (Js.Unsafe.coerce e) | "td" -> Td (Js.Unsafe.coerce e) | "textarea" -> Textarea (Js.Unsafe.coerce e) | "tfoot" -> Tfoot (Js.Unsafe.coerce e) | "th" -> Th (Js.Unsafe.coerce e) | "thead" -> Thead (Js.Unsafe.coerce e) | "title" -> Title (Js.Unsafe.coerce e) | "tr" -> Tr (Js.Unsafe.coerce e) | _ -> other e) | 'u' -> ( match tag with | "ul" -> Ul (Js.Unsafe.coerce e) | _ -> other e) | 'v' -> ( match tag with | "video" -> Video (Js.Unsafe.coerce e) | _ -> other e) | _ -> other e let opt_tagged e = Opt.case e (fun () -> None) (fun e -> Some (tagged e)) type taggedEvent = | MouseEvent of mouseEvent t | KeyboardEvent of keyboardEvent t | MousewheelEvent of mousewheelEvent t | MouseScrollEvent of mouseScrollEvent t | PopStateEvent of popStateEvent t | OtherEvent of event t let taggedEvent (ev : #event Js.t) = Js.Opt.case (CoerceTo.mouseEvent ev) (fun () -> Js.Opt.case (CoerceTo.keyboardEvent ev) (fun () -> Js.Opt.case (CoerceTo.wheelEvent ev) (fun () -> Js.Opt.case (CoerceTo.mouseScrollEvent ev) (fun () -> Js.Opt.case (CoerceTo.popStateEvent ev) (fun () -> OtherEvent (ev :> event t)) (fun ev -> PopStateEvent ev)) (fun ev -> MouseScrollEvent ev)) (fun ev -> MousewheelEvent ev)) (fun ev -> KeyboardEvent ev)) (fun ev -> MouseEvent ev) let opt_taggedEvent ev = Opt.case ev (fun () -> None) (fun ev -> Some (taggedEvent ev)) let stopPropagation ev = let e = Js.Unsafe.coerce ev in Optdef.case e##.stopPropagation (fun () -> e##.cancelBubble := Js._true) (fun _ -> e##_stopPropagation) let _requestAnimationFrame : (unit -> unit) Js.callback -> unit = Js.Unsafe.pure_expr (fun _ -> let w = Js.Unsafe.coerce window in let l = [ w##.requestAnimationFrame ; w##.mozRequestAnimationFrame ; w##.webkitRequestAnimationFrame ; w##.oRequestAnimationFrame ; w##.msRequestAnimationFrame ] in try let req = List.find (fun c -> Js.Optdef.test c) l in fun callback -> Js.Unsafe.fun_call req [| Js.Unsafe.inject callback |] with Not_found -> let now () = (new%js Js.date_now)##getTime in let last = ref (now ()) in fun callback -> let t = now () in let dt = !last +. (1000. /. 60.) -. t in let dt = if Poly.(dt < 0.) then 0. else dt in last := t; ignore (window##setTimeout callback dt)) (****) let hasPushState () = Js.Optdef.test (Js.Unsafe.coerce window##.history)##.pushState let hasPlaceholder () = let i = createInput document in Js.Optdef.test (Js.Unsafe.coerce i)##.placeholder let hasRequired () = let i = createInput document in Js.Optdef.test (Js.Unsafe.coerce i)##.required let overflow_limit = 2147483_000. (* ms *) type timeout_id_safe = timeout_id option ref let setTimeout callback d : timeout_id_safe = let id = ref None in let rec loop d () = let step, remain = if Poly.(d > overflow_limit) then overflow_limit, d -. overflow_limit else d, 0. in let cb = if Poly.(remain = 0.) then callback else loop remain in id := Some (window##setTimeout (Js.wrap_callback cb) step) in loop d (); id let clearTimeout (id : timeout_id_safe) = match !id with | None -> () | Some x -> id := None; window##clearTimeout x let js_array_of_collection (c : #element collection Js.t) : #element Js.t Js.js_array Js.t = Js.Unsafe.(meth_call (js_expr "[].slice") "call" [| inject c |]) js_of_ocaml-3.5.2/lib/js_of_ocaml/dom_html.mli000066400000000000000000002122351357507750000213410ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** DOM HTML binding This is a partial binding to the DOM HTML API. *) open Js (** {2 CSS style declaration} *) class type cssStyleDeclaration = object method animation : js_string t prop method animationDelay : js_string t prop method animationDirection : js_string t prop method animationDuration : js_string t prop method animationFillMode : js_string t prop method animationIterationCount : js_string t prop method animationName : js_string t prop method animationPlayState : js_string t prop method animationTimingFunction : js_string t prop method background : js_string t prop method backgroundAttachment : js_string t prop method backgroundColor : js_string t prop method backgroundImage : js_string t prop method backgroundPosition : js_string t prop method backgroundRepeat : js_string t prop method border : js_string t prop method borderBottom : js_string t prop method borderBottomColor : js_string t prop method borderBottomStyle : js_string t prop method borderBottomWidth : js_string t prop method borderCollapse : js_string t prop method borderColor : js_string t prop method borderLeft : js_string t prop method borderLeftColor : js_string t prop method borderLeftStyle : js_string t prop method borderLeftWidth : js_string t prop method borderRadius : js_string t prop method borderRight : js_string t prop method borderRightColor : js_string t prop method borderRightStyle : js_string t prop method borderRightWidth : js_string t prop method borderSpacing : js_string t prop method borderStyle : js_string t prop method borderTop : js_string t prop method borderTopColor : js_string t prop method borderTopStyle : js_string t prop method borderTopWidth : js_string t prop method borderWidth : js_string t prop method bottom : js_string t prop method captionSide : js_string t prop method clear : js_string t prop method clip : js_string t prop method color : js_string t prop method content : js_string t prop method counterIncrement : js_string t prop method counterReset : js_string t prop method cssFloat : js_string t prop method cssText : js_string t prop method cursor : js_string t prop method direction : js_string t prop method display : js_string t prop method emptyCells : js_string t prop method fill : js_string t prop method font : js_string t prop method fontFamily : js_string t prop method fontSize : js_string t prop method fontStyle : js_string t prop method fontVariant : js_string t prop method fontWeight : js_string t prop method height : js_string t prop method left : js_string t prop method letterSpacing : js_string t prop method lineHeight : js_string t prop method listStyle : js_string t prop method listStyleImage : js_string t prop method listStylePosition : js_string t prop method listStyleType : js_string t prop method margin : js_string t prop method marginBottom : js_string t prop method marginLeft : js_string t prop method marginRight : js_string t prop method marginTop : js_string t prop method maxHeight : js_string t prop method maxWidth : js_string t prop method minHeight : js_string t prop method minWidth : js_string t prop method opacity : js_string t optdef prop method outline : js_string t prop method outlineColor : js_string t prop method outlineOffset : js_string t prop method outlineStyle : js_string t prop method outlineWidth : js_string t prop method overflow : js_string t prop method overflowX : js_string t prop method overflowY : js_string t prop method padding : js_string t prop method paddingBottom : js_string t prop method paddingLeft : js_string t prop method paddingRight : js_string t prop method paddingTop : js_string t prop method pageBreakAfter : js_string t prop method pageBreakBefore : js_string t prop method pointerEvents : js_string t prop (* SVG-only on many browsers *) method position : js_string t prop method right : js_string t prop method stroke : js_string t prop method strokeWidth : js_string t prop method tableLayout : js_string t prop method textAlign : js_string t prop method textAnchor : js_string t prop method textDecoration : js_string t prop method textIndent : js_string t prop method textTransform : js_string t prop method top : js_string t prop method transform : js_string t prop method verticalAlign : js_string t prop method visibility : js_string t prop method whiteSpace : js_string t prop method width : js_string t prop method wordSpacing : js_string t prop method zIndex : js_string t prop end (** {2 Events} *) type (-'a, -'b) event_listener = ('a, 'b) Dom.event_listener (** The type of event listener functions. The first type parameter ['a] is the type of the target object; the second parameter ['b] is the type of the event object. *) type mouse_button = | No_button | Left_button | Middle_button | Right_button class type event = object inherit [element] Dom.event end and ['a] customEvent = object inherit [element, 'a] Dom.customEvent end and focusEvent = object inherit event method relatedTarget : element t opt optdef readonly_prop end and mouseEvent = object inherit event method relatedTarget : element t opt optdef readonly_prop method clientX : int readonly_prop (* Relative to viewport *) method clientY : int readonly_prop method screenX : int readonly_prop (* Relative to the edge of the screen *) method screenY : int readonly_prop method ctrlKey : bool t readonly_prop method shiftKey : bool t readonly_prop method altKey : bool t readonly_prop method metaKey : bool t readonly_prop method which : mouse_button optdef readonly_prop (* Legacy methods *) method button : int readonly_prop method fromElement : element t opt optdef readonly_prop method toElement : element t opt optdef readonly_prop method pageX : int optdef readonly_prop method pageY : int optdef readonly_prop end and keyboardEvent = object inherit event method altKey : bool t readonly_prop method shiftKey : bool t readonly_prop method ctrlKey : bool t readonly_prop method metaKey : bool t readonly_prop method location : int readonly_prop (* Standardized but not fully supported properties *) method key : js_string t optdef readonly_prop method code : js_string t optdef readonly_prop (* Deprecated properties *) method which : int optdef readonly_prop method charCode : int optdef readonly_prop method keyCode : int readonly_prop method keyIdentifier : js_string t optdef readonly_prop end and mousewheelEvent = object (* All browsers but Firefox *) inherit mouseEvent method wheelDelta : int readonly_prop method wheelDeltaX : int optdef readonly_prop method wheelDeltaY : int optdef readonly_prop end and mouseScrollEvent = object (* Firefox *) inherit mouseEvent method detail : int readonly_prop method axis : int optdef readonly_prop method _HORIZONTAL_AXIS : int optdef readonly_prop method _VERTICAL_AXIS : int optdef readonly_prop end and touchEvent = object inherit event method touches : touchList t readonly_prop method targetTouches : touchList t readonly_prop method changedTouches : touchList t readonly_prop method ctrlKey : bool t readonly_prop method shiftKey : bool t readonly_prop method altKey : bool t readonly_prop method metaKey : bool t readonly_prop method relatedTarget : element t opt optdef readonly_prop end and touchList = object method length : int readonly_prop method item : int -> touch t optdef meth end and touch = object method identifier : int readonly_prop method target : element t optdef readonly_prop method screenX : int readonly_prop method screenY : int readonly_prop method clientX : int readonly_prop method clientY : int readonly_prop method pageX : int readonly_prop method pageY : int readonly_prop end and dragEvent = object inherit mouseEvent method dataTransfer : dataTransfer t readonly_prop end and dataTransfer = object method dropEffect : js_string t prop method effectAllowed : js_string t prop method files : File.fileList t readonly_prop method types : js_string t js_array t readonly_prop method addElement : element t -> unit meth method clearData : js_string t -> unit meth method clearData_all : unit meth method getData : js_string t -> js_string t meth method setData : js_string t -> js_string t -> unit meth method setDragImage : element t -> int -> int -> unit meth end (** Common properties of event target objects: [onclick], [onkeypress], ... *) and eventTarget = object ('self) method onclick : ('self t, mouseEvent t) event_listener writeonly_prop method ondblclick : ('self t, mouseEvent t) event_listener writeonly_prop method onmousedown : ('self t, mouseEvent t) event_listener writeonly_prop method onmouseup : ('self t, mouseEvent t) event_listener writeonly_prop method onmouseover : ('self t, mouseEvent t) event_listener writeonly_prop method onmousemove : ('self t, mouseEvent t) event_listener writeonly_prop method onmouseout : ('self t, mouseEvent t) event_listener writeonly_prop method onkeypress : ('self t, keyboardEvent t) event_listener writeonly_prop method onkeydown : ('self t, keyboardEvent t) event_listener writeonly_prop method onkeyup : ('self t, keyboardEvent t) event_listener writeonly_prop method onscroll : ('self t, event t) event_listener writeonly_prop method ondragstart : ('self t, dragEvent t) event_listener writeonly_prop method ondragend : ('self t, dragEvent t) event_listener writeonly_prop method ondragenter : ('self t, dragEvent t) event_listener writeonly_prop method ondragover : ('self t, dragEvent t) event_listener writeonly_prop method ondragleave : ('self t, dragEvent t) event_listener writeonly_prop method ondrag : ('self t, dragEvent t) event_listener writeonly_prop method ondrop : ('self t, dragEvent t) event_listener writeonly_prop method onanimationstart : ('self t, animationEvent t) event_listener writeonly_prop method onanimationend : ('self t, animationEvent t) event_listener writeonly_prop method onanimationiteration : ('self t, animationEvent t) event_listener writeonly_prop method onanimationcancel : ('self t, animationEvent t) event_listener writeonly_prop method ongotpointercapture : ('self t, pointerEvent t) event_listener writeonly_prop method onlostpointercapture : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerenter : ('self t, pointerEvent t) event_listener writeonly_prop method onpointercancel : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerdown : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerleave : ('self t, pointerEvent t) event_listener writeonly_prop method onpointermove : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerout : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerover : ('self t, pointerEvent t) event_listener writeonly_prop method onpointerup : ('self t, pointerEvent t) event_listener writeonly_prop method dispatchEvent : event t -> bool t meth end and popStateEvent = object inherit event method state : Js.Unsafe.any readonly_prop end and pointerEvent = object inherit mouseEvent method pointerId : int Js.readonly_prop method width : float Js.readonly_prop method height : float Js.readonly_prop method pressure : float Js.readonly_prop method tangentialPressure : float Js.readonly_prop method tiltX : int Js.readonly_prop method tiltY : int Js.readonly_prop method twist : int Js.readonly_prop method pointerType : Js.js_string Js.t Js.readonly_prop method isPrimary : bool Js.t Js.readonly_prop end and storageEvent = object inherit event method key : js_string t opt readonly_prop method oldValue : js_string t opt readonly_prop method newValue : js_string t opt readonly_prop method url : js_string t readonly_prop method storageArea : storage t opt readonly_prop end (** Storage *) and storage = object method length : int readonly_prop method key : int -> js_string t opt meth method getItem : js_string t -> js_string t opt meth method setItem : js_string t -> js_string t -> unit meth method removeItem : js_string t -> unit meth method clear : unit meth end and hashChangeEvent = object inherit event method oldURL : js_string t readonly_prop method newURL : js_string t readonly_prop end and animationEvent = object inherit event method animationName : js_string t readonly_prop method elapsedTime : float readonly_prop method pseudoElement : js_string t readonly_prop end and mediaEvent = object inherit event end (** {2 HTML elements} *) and nodeSelector = object method querySelector : js_string t -> element t opt meth method querySelectorAll : js_string t -> element Dom.nodeList t meth end and tokenList = object method length : int readonly_prop method item : int -> js_string t optdef meth method contains : js_string t -> bool t meth method add : js_string t -> unit meth method remove : js_string t -> unit meth method toggle : js_string t -> bool t meth method stringifier : js_string t prop end (** Properties common to all HTML elements *) and element = object inherit Dom.element inherit nodeSelector method id : js_string t prop method title : js_string t prop method lang : js_string t prop method dir : js_string t prop method className : js_string t prop method classList : tokenList t readonly_prop (* Not supported by IE9 by default. Add +classList.js to the Js_of_ocaml command line for compatibility *) method style : cssStyleDeclaration t prop method innerHTML : js_string t prop method outerHTML : js_string t prop method textContent : js_string t opt prop method clientLeft : int readonly_prop method clientTop : int readonly_prop method clientWidth : int readonly_prop method clientHeight : int readonly_prop method offsetLeft : int readonly_prop method offsetTop : int readonly_prop (* Incorrect in IE until IE7 included *) method offsetParent : element t opt readonly_prop method offsetWidth : int readonly_prop method offsetHeight : int readonly_prop method scrollLeft : int prop method scrollTop : int prop method scrollWidth : int prop method scrollHeight : int prop method getClientRects : clientRectList t meth method getBoundingClientRect : clientRect t meth method scrollIntoView : bool t -> unit meth method click : unit meth method focus : unit meth method blur : unit meth inherit eventTarget end (** Rectangular box (used for element bounding boxes) *) and clientRect = object method top : float readonly_prop method right : float readonly_prop method bottom : float readonly_prop method left : float readonly_prop method width : float optdef readonly_prop method height : float optdef readonly_prop end and clientRectList = object method length : int readonly_prop method item : int -> clientRect t opt meth end (** Collection of HTML elements *) class type ['node] collection = object method length : int readonly_prop method item : int -> 'node t opt meth method namedItem : js_string t -> 'node t opt meth end class type htmlElement = element class type headElement = object inherit element method profile : js_string t prop end class type linkElement = object inherit element method disabled : bool t prop method charset : js_string t prop method crossorigin : js_string t prop method href : js_string t prop method hreflang : js_string t prop method media : js_string t prop method rel : js_string t prop method rev : js_string t prop method target : js_string t prop method _type : js_string t prop end class type titleElement = object inherit element method text : js_string t prop end class type metaElement = object inherit element method content : js_string t prop method httpEquiv : js_string t prop method name : js_string t prop method scheme : js_string t prop end class type baseElement = object inherit element method href : js_string t prop method target : js_string t prop end class type styleElement = object inherit element method disabled : bool t prop method media : js_string t prop method _type : js_string t prop end class type bodyElement = element class type formElement = object inherit element method elements : element collection t readonly_prop method length : int readonly_prop method acceptCharset : js_string t prop method action : js_string t prop method enctype : js_string t prop method _method : js_string t prop method target : js_string t prop method submit : unit meth method reset : unit meth method onsubmit : ('self t, event t) event_listener writeonly_prop end class type optGroupElement = object inherit element method disabled : bool t prop method label : js_string t prop end class type optionElement = object inherit optGroupElement method form : formElement t opt readonly_prop method defaultSelected : bool t prop method text : js_string t readonly_prop method index : int readonly_prop method selected : bool t prop method value : js_string t prop end class type selectElement = object ('self) inherit element method _type : js_string t readonly_prop (* Cannot be changed under IE *) method selectedIndex : int prop method value : js_string t prop method length : int prop method form : formElement t opt readonly_prop method options : optionElement collection t readonly_prop method disabled : bool t prop method multiple : bool t prop method name : js_string t readonly_prop (* Cannot be changed under IE *) method size : int prop method tabIndex : int prop method add : #optGroupElement t -> #optGroupElement t opt -> unit meth method remove : int -> unit meth method required : bool t writeonly_prop (* Not supported by IE 9/Safari *) method onchange : ('self t, event t) event_listener prop method oninput : ('self t, event t) event_listener prop end class type inputElement = object ('self) inherit element method defaultValue : js_string t prop method defaultChecked : js_string t prop method form : formElement t opt readonly_prop method accept : js_string t prop method accessKey : js_string t prop method align : js_string t prop method alt : js_string t prop method checked : bool t prop method disabled : bool t prop method maxLength : int prop method name : js_string t readonly_prop (* Cannot be changed under IE *) method readOnly : bool t prop method required : bool t writeonly_prop (* Not supported by IE 9/Safari *) method size : int prop method src : js_string t prop method tabIndex : int prop method _type : js_string t readonly_prop (* Cannot be changed under IE *) method useMap : js_string t prop method value : js_string t prop method select : unit meth method files : File.fileList t optdef readonly_prop method placeholder : js_string t writeonly_prop (* Not supported by IE 9 *) method selectionDirection : js_string t prop method selectionStart : int prop method selectionEnd : int prop method onselect : ('self t, event t) event_listener prop method onchange : ('self t, event t) event_listener prop method oninput : ('self t, event t) event_listener prop method onblur : ('self t, focusEvent t) event_listener prop method onfocus : ('self t, focusEvent t) event_listener prop end class type textAreaElement = object ('self) inherit element method defaultValue : js_string t prop method form : formElement t opt readonly_prop method accessKey : js_string t prop method cols : int prop method disabled : bool t prop method name : js_string t readonly_prop (* Cannot be changed under IE *) method readOnly : bool t prop method rows : int prop method selectionDirection : js_string t prop method selectionEnd : int prop method selectionStart : int prop method tabIndex : int prop method _type : js_string t readonly_prop (* Cannot be changed under IE *) method value : js_string t prop method select : unit meth method required : bool t writeonly_prop (* Not supported by IE 9/Safari *) method placeholder : js_string t writeonly_prop (* Not supported by IE 9 *) method onselect : ('self t, event t) event_listener prop method onchange : ('self t, event t) event_listener prop method oninput : ('self t, event t) event_listener prop method onblur : ('self t, focusEvent t) event_listener prop method onfocus : ('self t, focusEvent t) event_listener prop end class type buttonElement = object inherit element method form : formElement t opt readonly_prop method accessKey : js_string t prop method disabled : bool t prop method name : js_string t readonly_prop (* Cannot be changed under IE *) method tabIndex : int prop method _type : js_string t readonly_prop (* Cannot be changed under IE *) method value : js_string t prop end class type labelElement = object inherit element method form : formElement t opt readonly_prop method accessKey : js_string t prop method htmlFor : js_string t prop end class type fieldSetElement = object inherit element method form : formElement t opt readonly_prop end class type legendElement = object inherit element method form : formElement t opt readonly_prop method accessKey : js_string t prop end class type uListElement = element class type oListElement = element class type dListElement = element class type liElement = element class type divElement = element class type paragraphElement = element class type headingElement = element class type quoteElement = object inherit element method cite : js_string t prop end class type preElement = element class type brElement = element class type hrElement = element class type modElement = object inherit element method cite : js_string t prop method dateTime : js_string t prop end class type anchorElement = object inherit element method accessKey : js_string t prop method charset : js_string t prop method coords : js_string t prop method href : js_string t prop method hreflang : js_string t prop method name : js_string t prop method rel : js_string t prop method rev : js_string t prop method shape : js_string t prop method tabIndex : int prop method target : js_string t prop method _type : js_string t prop end class type imageElement = object ('self) inherit element method alt : js_string t prop method src : js_string t prop method useMap : js_string t prop method isMap : bool t prop method width : int prop method height : int prop (* Properties naturalWidth/Height not available in all browsers. *) method naturalWidth : int optdef readonly_prop method naturalHeight : int optdef readonly_prop method complete : bool t prop method onload : ('self t, event t) event_listener prop method onerror : ('self t, event t) event_listener prop method onabort : ('self t, event t) event_listener prop end class type objectElement = object inherit element method form : formElement t opt readonly_prop method code : js_string t prop method archive : js_string t prop method codeBase : js_string t prop method codeType : js_string t prop method data : js_string t prop method declare : bool t prop method height : js_string t prop method name : js_string t prop method standby : js_string t prop method tabIndex : int prop method _type : js_string t prop method useMap : js_string t prop method width : js_string t prop method document : Dom.element Dom.document t opt readonly_prop end class type paramElement = object inherit element method name : js_string t prop method _type : js_string t prop method value : js_string t prop method valueType : js_string t prop end class type areaElement = object inherit element method accessKey : js_string t prop method alt : js_string t prop method coords : js_string t prop method href : js_string t prop method noHref : bool t prop method shape : js_string t prop method tabIndex : int prop method target : js_string t prop end class type mapElement = object inherit element method areas : areaElement collection t readonly_prop method name : js_string t prop end class type scriptElement = object inherit element method text : js_string t prop method charset : js_string t prop method defer : bool t prop method src : js_string t prop method _type : js_string t prop method async : bool t prop end class type embedElement = object inherit element method src : js_string t prop method height : js_string t prop method width : js_string t prop method _type : js_string t prop end class type tableCellElement = object inherit element method cellIndex : int readonly_prop method abbr : js_string t prop method align : js_string t prop method axis : js_string t prop method ch : js_string t prop method chOff : js_string t prop method colSpan : int prop method headers : js_string t prop method rowSpan : int prop method scope : js_string t prop method vAlign : js_string t prop end class type tableRowElement = object inherit element method rowIndex : int readonly_prop method sectionRowIndex : int readonly_prop method cells : tableCellElement collection t readonly_prop method align : js_string t prop method ch : js_string t prop method chOff : js_string t prop method vAlign : js_string t prop method insertCell : int -> tableCellElement t meth method deleteCell : int -> unit meth end class type tableColElement = object inherit element method align : js_string t prop method ch : js_string t prop method chOff : js_string t prop method span : int prop method vAlign : js_string t prop method width : js_string t prop end class type tableSectionElement = object inherit element method align : js_string t prop method ch : js_string t prop method chOff : js_string t prop method vAlign : js_string t prop method rows : tableRowElement collection t readonly_prop method insertRow : int -> tableRowElement t meth method deleteRow : int -> unit meth end class type tableCaptionElement = element class type tableElement = object inherit element method caption : tableCaptionElement t prop method tHead : tableSectionElement t prop method tFoot : tableSectionElement t prop method rows : tableRowElement collection t readonly_prop method tBodies : tableSectionElement collection t readonly_prop method align : js_string t prop method border : js_string t prop method cellPadding : js_string t prop method cellSpacing : js_string t prop method frame : js_string t prop method rules : js_string t prop method summary : js_string t prop method width : js_string t prop method createTHead : tableSectionElement t meth method deleteTHead : unit meth method createTFoot : tableSectionElement t meth method deleteTFoot : unit meth method createCaption : tableCaptionElement t meth method deleteCaption : unit meth method insertRow : int -> tableRowElement t meth method deleteRow : int -> unit meth end class type timeRanges = object method length : int readonly_prop method start : int -> float meth method end_ : int -> float meth end type networkState = | NETWORK_EMPTY | NETWORK_IDLE | NETWORK_LOADING | NETWORK_NO_SOURCE type readyState = | HAVE_NOTHING | HAVE_METADATA | HAVE_CURRENT_DATA | HAVE_FUTURE_DATA | HAVE_ENOUGH_DATA class type mediaElement = object inherit element method canPlayType : js_string t -> js_string t meth method load : unit meth method play : unit meth method pause : unit meth method autoplay : bool t prop method buffered : timeRanges t readonly_prop method controls : bool t prop method currentSrc : js_string t readonly_prop method currentTime : float prop method duration : float readonly_prop method ended : bool t readonly_prop method loop : bool t prop method mediagroup : js_string t prop method muted : bool t prop method networkState_int : int readonly_prop method networkState : networkState readonly_prop method paused : bool t readonly_prop method playbackRate : float prop method played : timeRanges t readonly_prop method preload : js_string t prop method readyState_int : int readonly_prop method readyState : readyState readonly_prop method seekable : timeRanges t readonly_prop method seeking : bool t readonly_prop method src : js_string t prop method volume : float prop method oncanplay : ('self t, mediaEvent t) event_listener writeonly_prop method oncanplaythrough : ('self t, mediaEvent t) event_listener writeonly_prop method ondurationchange : ('self t, mediaEvent t) event_listener writeonly_prop method onemptied : ('self t, mediaEvent t) event_listener writeonly_prop method onended : ('self t, mediaEvent t) event_listener writeonly_prop method onloadeddata : ('self t, mediaEvent t) event_listener writeonly_prop method onloadedmetadata : ('self t, mediaEvent t) event_listener writeonly_prop method onloadstart : ('self t, mediaEvent t) event_listener writeonly_prop method onpause : ('self t, mediaEvent t) event_listener writeonly_prop method onplay : ('self t, mediaEvent t) event_listener writeonly_prop method onplaying : ('self t, mediaEvent t) event_listener writeonly_prop method onratechange : ('self t, mediaEvent t) event_listener writeonly_prop method onseeked : ('self t, mediaEvent t) event_listener writeonly_prop method onseeking : ('self t, mediaEvent t) event_listener writeonly_prop method onstalled : ('self t, mediaEvent t) event_listener writeonly_prop method onsuspend : ('self t, mediaEvent t) event_listener writeonly_prop method onvolumechange : ('self t, mediaEvent t) event_listener writeonly_prop method onwaiting : ('self t, mediaEvent t) event_listener writeonly_prop end class type audioElement = object inherit mediaElement end class type videoElement = object inherit mediaElement end (** {2 Canvas object} *) type context val _2d_ : context type canvasPattern class type canvasElement = object inherit element method width : int prop method height : int prop method toDataURL : js_string t meth method toDataURL_type : js_string t -> js_string t meth method toDataURL_type_compression : js_string t -> float -> js_string t meth method getContext : context -> canvasRenderingContext2D t meth end and canvasRenderingContext2D = object method canvas : canvasElement t readonly_prop method save : unit meth method restore : unit meth method scale : float -> float -> unit meth method rotate : float -> unit meth method translate : float -> float -> unit meth method transform : float -> float -> float -> float -> float -> float -> unit meth method setTransform : float -> float -> float -> float -> float -> float -> unit meth method globalAlpha : float prop method globalCompositeOperation : js_string t prop method strokeStyle : js_string t writeonly_prop method strokeStyle_gradient : canvasGradient t writeonly_prop method strokeStyle_pattern : canvasPattern t writeonly_prop method fillStyle : js_string t writeonly_prop method fillStyle_gradient : canvasGradient t writeonly_prop method fillStyle_pattern : canvasPattern t writeonly_prop method createLinearGradient : float -> float -> float -> float -> canvasGradient t meth method createRadialGradient : float -> float -> float -> float -> float -> float -> canvasGradient t meth method createPattern : imageElement t -> js_string t -> canvasPattern t meth method createPattern_fromCanvas : canvasElement t -> js_string t -> canvasPattern t meth method createPattern_fromVideo : videoElement t -> js_string t -> canvasPattern t meth method lineWidth : float prop method lineCap : js_string t prop method lineJoin : js_string t prop method miterLimit : float prop method shadowOffsetX : float prop method shadowOffsetY : float prop method shadowBlur : float prop method shadowColor : js_string t prop method clearRect : float -> float -> float -> float -> unit meth method fillRect : float -> float -> float -> float -> unit meth method strokeRect : float -> float -> float -> float -> unit meth method beginPath : unit meth method closePath : unit meth method moveTo : float -> float -> unit meth method lineTo : float -> float -> unit meth method quadraticCurveTo : float -> float -> float -> float -> unit meth method bezierCurveTo : float -> float -> float -> float -> float -> float -> unit meth method arcTo : float -> float -> float -> float -> float -> unit meth method rect : float -> float -> float -> float -> unit meth method arc : float -> float -> float -> float -> float -> bool t -> unit meth method fill : unit meth method stroke : unit meth method clip : unit meth method isPointInPath : float -> float -> bool t meth method drawFocusRing : #element t -> float -> float -> bool t -> bool t meth method font : js_string t prop method textAlign : js_string t prop method textBaseline : js_string t prop method fillText : js_string t -> float -> float -> unit meth method fillText_withWidth : js_string t -> float -> float -> float -> unit meth method strokeText : js_string t -> float -> float -> unit meth method strokeText_withWidth : js_string t -> float -> float -> float -> unit meth method measureText : js_string t -> textMetrics t meth method drawImage : imageElement t -> float -> float -> unit meth method drawImage_withSize : imageElement t -> float -> float -> float -> float -> unit meth method drawImage_full : imageElement t -> float -> float -> float -> float -> float -> float -> float -> float -> unit meth method drawImage_fromCanvas : canvasElement t -> float -> float -> unit meth method drawImage_fromCanvasWithSize : canvasElement t -> float -> float -> float -> float -> unit meth method drawImage_fullFromCanvas : canvasElement t -> float -> float -> float -> float -> float -> float -> float -> float -> unit meth method drawImage_fromVideoWithVideo : videoElement t -> float -> float -> unit meth method drawImage_fromVideoWithSize : videoElement t -> float -> float -> float -> float -> unit meth method drawImage_fullFromVideo : videoElement t -> float -> float -> float -> float -> float -> float -> float -> float -> unit meth (* Method createImageData not available in Opera *) method createImageData : int -> int -> imageData t meth method getImageData : float -> float -> float -> float -> imageData t meth method putImageData : imageData t -> float -> float -> unit meth end and canvasGradient = object method addColorStop : float -> js_string t -> unit meth end and textMetrics = object method width : float readonly_prop end and imageData = object method width : int readonly_prop method height : int readonly_prop method data : canvasPixelArray t readonly_prop end and canvasPixelArray = object method length : int readonly_prop end external pixel_get : canvasPixelArray t -> int -> int = "caml_js_get" external pixel_set : canvasPixelArray t -> int -> int -> unit = "caml_js_set" (** Object representing a range **) class type range = object method collapsed : bool t readonly_prop method startOffset : int readonly_prop method endOffset : int readonly_prop method startContainer : Dom.node t readonly_prop method endContainer : Dom.node t readonly_prop method setStart : Dom.node t -> int -> unit meth method setEnd : Dom.node t -> int -> unit meth method setStartBefore : Dom.node t -> unit meth method setEndBefore : Dom.node t -> unit meth method setStartAfter : Dom.node t -> unit meth method setEndAfter : Dom.node t -> unit meth method selectNode : Dom.node t -> unit meth method selectNodeContents : Dom.node t -> unit meth method collapse : bool t -> unit meth method cloneContents : Dom.documentFragment t meth method extractContents : Dom.documentFragment t meth method deleteContents : unit meth method insertNode : Dom.node t -> unit meth method surroundContents : Dom.node t -> unit meth method cloneRange : range t meth method toString : js_string t meth end (** Information on current selection *) class type selection = object method anchorNode : Dom.node t readonly_prop method anchorOffset : int readonly_prop method focusNode : Dom.node t readonly_prop method focusOffset : int readonly_prop method isCollapsed : bool t readonly_prop method rangeCount : int readonly_prop method getRangeAt : int -> range t meth method collapse : bool t -> unit meth method extend : Dom.node t -> int -> unit meth method modify : js_string t -> js_string t -> js_string t -> unit meth method collapseToStart : unit meth method collapseToEnd : unit meth method selectAllChildren : Dom.node t -> unit meth method addRange : range t -> unit meth method removeRange : range t -> unit meth method removeAllRanges : unit meth method deleteFromDocument : unit meth method containsNode : Dom.node t -> bool t -> bool t meth method toString : js_string t meth end (** {2 Document objects} *) class type document = object inherit [element] Dom.document inherit nodeSelector inherit eventTarget method title : js_string t prop method referrer : js_string t readonly_prop method domain : js_string t prop method _URL : js_string t readonly_prop method head : headElement t prop method body : bodyElement t prop method documentElement : htmlElement t readonly_prop method images : imageElement collection t readonly_prop method applets : element collection t readonly_prop method links : element collection t readonly_prop method forms : formElement collection t readonly_prop method anchors : element collection t readonly_prop method cookie : js_string t prop method designMode : js_string t prop method open_ : unit meth method close : unit meth method write : js_string t -> unit meth method execCommand : js_string t -> bool t -> js_string t opt -> unit meth method createRange : range t meth method readyState : js_string t readonly_prop method getElementsByClassName : js_string t -> element Dom.nodeList t meth method getElementsByName : js_string t -> element Dom.nodeList t meth method activeElement : element t opt readonly_prop inherit eventTarget end val document : document t (** The current document *) val getElementById_opt : string -> element Js.t option (** [getElementById_opt id] returns the element with the id [id] in the current document. It returns [None] if there are no such element *) val getElementById_exn : string -> element Js.t (** [getElementById_exn id] returns the element with the id [id] in the current document. It raises if there are no such element *) val getElementById_coerce : string -> (element t -> 'a opt) -> 'a option (** [getElementById_coerce id coerce] returns the element with the id [id] in the current document and attempt to coerce it using the provided [coerce] function. It returns [None] if there are no such element or if the [coerce] function returns [Js.none]. Typical usage is the following: {[ match Dom_html.getElementById_coerce "myinput" Dom_html.CoerceTo.input with | None -> .. | Some input -> .. ]} *) val getElementById : string -> element Js.t (** [getElementById id] returns the element with the id [id] in the current document. It raises [Not_found] if there are no such element *) (** {2 Window objects} *) (** Location information *) class type location = object method href : js_string t prop method protocol : js_string t prop method host : js_string t prop method hostname : js_string t prop method origin : js_string t optdef readonly_prop method port : js_string t prop method pathname : js_string t prop method search : js_string t prop method hash : js_string t prop method assign : js_string t -> unit meth method replace : js_string t -> unit meth method reload : unit meth end val location_origin : location t -> js_string t (** Browser history information *) class type history = object method length : int readonly_prop method state : Js.Unsafe.any readonly_prop method go : int opt -> unit meth method back : unit meth method forward : unit meth method pushState : 'a. 'a -> js_string t -> js_string t opt -> unit meth method replaceState : 'a. 'a -> js_string t -> js_string t opt -> unit meth end class type undoManager = object end (** Undo manager *) (** Navigator information *) class type navigator = object method appCodeName : js_string t readonly_prop method appName : js_string t readonly_prop method appVersion : js_string t readonly_prop method cookieEnabled : bool t readonly_prop method onLine : bool t readonly_prop method platform : js_string t readonly_prop method userAgent : js_string t readonly_prop method language : js_string t optdef readonly_prop method userLanguage : js_string t optdef readonly_prop end class type screen = object method width : int readonly_prop method height : int readonly_prop method availWidth : int readonly_prop method availHeight : int readonly_prop end class type applicationCache = object method status : int readonly_prop method update : unit meth method abort : unit meth method swapCache : unit meth method onchecking : (applicationCache t, event t) event_listener prop method onerror : (applicationCache t, event t) event_listener prop method onnoupdate : (applicationCache t, event t) event_listener prop method ondownloading : (applicationCache t, event t) event_listener prop method onprogress : (applicationCache t, event t) event_listener prop method onupdateready : (applicationCache t, event t) event_listener prop method oncached : (applicationCache t, event t) event_listener prop method onobsolete : (applicationCache t, event t) event_listener prop inherit eventTarget end type interval_id type timeout_id type animation_frame_request_id class type _URL = object method createObjectURL : #File.blob t -> js_string t meth method revokeObjectURL : js_string t -> unit meth end (** Specification of window objects *) class type window = object inherit eventTarget method document : document t readonly_prop method applicationCache : applicationCache t readonly_prop method name : js_string t prop method location : location t readonly_prop method history : history t readonly_prop method undoManager : undoManager t readonly_prop method navigator : navigator t readonly_prop method getSelection : selection t meth method close : unit meth method closed : bool t readonly_prop method stop : unit meth method focus : unit meth method blur : unit meth method scroll : int -> int -> unit meth method scrollBy : int -> int -> unit meth method sessionStorage : storage t optdef readonly_prop method localStorage : storage t optdef readonly_prop method top : window t readonly_prop method parent : window t readonly_prop method frameElement : element t opt readonly_prop method open_ : js_string t -> js_string t -> js_string t opt -> window t opt meth method alert : js_string t -> unit meth method confirm : js_string t -> bool t meth method prompt : js_string t -> js_string t -> js_string t opt meth method print : unit meth method setInterval : (unit -> unit) Js.callback -> float -> interval_id meth method clearInterval : interval_id -> unit meth method setTimeout : (unit -> unit) Js.callback -> float -> timeout_id meth method clearTimeout : timeout_id -> unit meth method requestAnimationFrame : (float -> unit) Js.callback -> animation_frame_request_id meth method cancelAnimationFrame : animation_frame_request_id -> unit meth method screen : screen t readonly_prop method innerWidth : int optdef readonly_prop method innerHeight : int optdef readonly_prop method outerWidth : int optdef readonly_prop method outerHeight : int optdef readonly_prop method getComputedStyle : #element t -> cssStyleDeclaration t meth method getComputedStyle_pseudoElt : #element t -> js_string t -> cssStyleDeclaration t meth method atob : js_string t -> js_string t meth method btoa : js_string t -> js_string t meth method onload : (window t, event t) event_listener prop method onunload : (window t, event t) event_listener prop method onbeforeunload : (window t, event t) event_listener prop method onblur : (window t, focusEvent t) event_listener prop method onfocus : (window t, focusEvent t) event_listener prop method onresize : (window t, event t) event_listener prop method onorientationchange : (window t, event t) event_listener prop method onpopstate : (window t, popStateEvent t) event_listener prop method onhashchange : (window t, hashChangeEvent t) event_listener prop method ononline : (window t, event t) event_listener writeonly_prop method onoffline : (window t, event t) event_listener writeonly_prop method _URL : _URL t readonly_prop method devicePixelRatio : float readonly_prop end val window : window t (** The current window *) (* {2 Frames } *) class type frameSetElement = object inherit element method cols : js_string t prop method rows : js_string t prop end class type frameElement = object inherit element method frameBorder : js_string t prop method longDesc : js_string t prop method marginHeight : js_string t prop method marginWidth : js_string t prop method name : js_string t prop method noResize : bool t prop method scrolling : js_string t prop method src : js_string t prop method contentDocument : document t opt readonly_prop end class type iFrameElement = object inherit element method frameBorder : js_string t prop method height : js_string t prop method width : js_string t prop method longDesc : js_string t prop method marginHeight : js_string t prop method marginWidth : js_string t prop method name : js_string t prop method scrolling : js_string t prop method src : js_string t prop method contentDocument : document t opt readonly_prop method contentWindow : window t readonly_prop end (****) (** {2 Event handlers} *) val no_handler : ('a, 'b) event_listener (** see [Dom.no_handler] *) val handler : ((#event t as 'b) -> bool t) -> ('a, 'b) event_listener (** see [Dom.handler] *) val full_handler : ('a -> (#event t as 'b) -> bool t) -> ('a, 'b) event_listener (** see [Dom.full_handler] *) val invoke_handler : ('a, 'b) event_listener -> 'a -> 'b -> bool t (** see [Dom.invoke_handler] *) val eventTarget : #event t -> element t (** see [Dom.eventTarget] *) val eventRelatedTarget : #mouseEvent t -> element t opt (** Returns this event related target. *) (** Event types: [mousedown], [keypress], ... *) module Event : sig type 'a typ = 'a Dom.Event.typ val click : mouseEvent t typ val dblclick : mouseEvent t typ val mousedown : mouseEvent t typ val mouseup : mouseEvent t typ val mouseover : mouseEvent t typ val mousemove : mouseEvent t typ val mouseout : mouseEvent t typ val keypress : keyboardEvent t typ val keydown : keyboardEvent t typ val keyup : keyboardEvent t typ val mousewheel : mousewheelEvent t typ val _DOMMouseScroll : mouseScrollEvent t typ val touchstart : touchEvent t typ val touchmove : touchEvent t typ val touchend : touchEvent t typ val touchcancel : touchEvent t typ val dragstart : dragEvent t typ val dragend : dragEvent t typ val dragenter : dragEvent t typ val dragover : dragEvent t typ val dragleave : dragEvent t typ val drag : dragEvent t typ val drop : dragEvent t typ val hashchange : hashChangeEvent t typ val change : event t typ val input : event t typ val timeupdate : event t typ val submit : event t typ val scroll : event t typ val focus : event t typ val blur : event t typ val load : event t typ val unload : event t typ val beforeunload : event t typ val resize : event t typ val orientationchange : event t typ val popstate : popStateEvent t typ val error : event t typ val abort : event t typ val select : event t typ val online : event t typ val offline : event t typ val checking : event t typ val noupdate : event t typ val downloading : event t typ val progress : event t typ val updateready : event t typ val cached : event t typ val obsolete : event t typ val domContentLoaded : event t typ val animationstart : animationEvent t typ val animationend : animationEvent t typ val animationiteration : animationEvent t typ val animationcancel : animationEvent t typ val canplay : mediaEvent t typ val canplaythrough : mediaEvent t typ val durationchange : mediaEvent t typ val emptied : mediaEvent t typ val ended : mediaEvent t typ val gotpointercapture : pointerEvent t typ val loadeddata : mediaEvent t typ val loadedmetadata : mediaEvent t typ val loadstart : mediaEvent t typ val lostpointercapture : pointerEvent t typ val pause : mediaEvent t typ val play : mediaEvent t typ val playing : mediaEvent t typ val pointerenter : pointerEvent t typ val pointercancel : pointerEvent t typ val pointerdown : pointerEvent t typ val pointerleave : pointerEvent t typ val pointermove : pointerEvent t typ val pointerout : pointerEvent t typ val pointerover : pointerEvent t typ val pointerup : pointerEvent t typ val ratechange : mediaEvent t typ val seeked : mediaEvent t typ val seeking : mediaEvent t typ val stalled : mediaEvent t typ val suspend : mediaEvent t typ val volumechange : mediaEvent t typ val waiting : mediaEvent t typ val make : string -> 'a typ end type event_listener_id = Dom.event_listener_id val addEventListenerWithOptions : (#eventTarget t as 'a) -> 'b Event.typ -> ?capture:bool t -> ?once:bool t -> ?passive:bool t -> ('a, 'b) event_listener -> event_listener_id (** Add an event listener. This function matches the option-object variant of the [addEventListener] DOM method, except that it returns an id for removing the listener. *) val addEventListener : (#eventTarget t as 'a) -> 'b Event.typ -> ('a, 'b) event_listener -> bool t -> event_listener_id (** Add an event listener. This function matches the useCapture boolean variant of the [addEventListener] DOM method, except that it returns an id for removing the listener. *) val removeEventListener : event_listener_id -> unit (** Remove the given event listener. *) val addMousewheelEventListenerWithOptions : (#eventTarget t as 'a) -> ?capture:bool t -> ?once:bool t -> ?passive:bool t -> (mouseEvent t -> dx:int -> dy:int -> bool t) -> event_listener_id (** Add a mousewheel event listener with option-object variant of the [addEventListener] DOM method. The callback is provided the event and the numbers of ticks the mouse wheel moved. Positive means down / right. *) val addMousewheelEventListener : (#eventTarget t as 'a) -> (mouseEvent t -> dx:int -> dy:int -> bool t) -> bool t -> event_listener_id (** Add a mousewheel event listener with the useCapture boolean variant of the [addEventListener] DOM method. The callback is provided the event and the numbers of ticks the mouse wheel moved. Positive means down / right. *) val createCustomEvent : ?bubbles:bool -> ?cancelable:bool -> ?detail:'a -> 'a #customEvent Js.t Event.typ -> 'a customEvent Js.t (** See [Dom.createCustomEvent] *) (****) (** {2 Mouse event helper functions} *) val buttonPressed : #mouseEvent Js.t -> mouse_button (** {2 Position helper functions} *) val eventAbsolutePosition : #mouseEvent t -> int * int (** Returns the absolute position of the mouse pointer. *) val elementClientPosition : #element t -> int * int (** Position of an element relative to the viewport *) val getDocumentScroll : unit -> int * int (** Viewport top/left position *) (** {2 Key event helper functions} *) (** Use [Keyboard_code] when you want to identify a key that the user pressed. This should be invoked for keydown and keyup events, not keypress events. If the browser supports the standardized [key] and [code] properties, then [of_event] on a keypress event will have the correct behavior. Otherwise, it might not identify or might mis-identify which key was pressed. This occurs because the keypress event is designed for printable characters while keydown and keyup are designed for physical keys. Thus, the older properties of [keyEvent] change behavior between keydown and keypress events. This change in behavior is what causes the mapping to be incorrect. *) module Keyboard_code : sig type t = | Unidentified (* Alphabetic Characters *) | KeyA | KeyB | KeyC | KeyD | KeyE | KeyF | KeyG | KeyH | KeyI | KeyJ | KeyK | KeyL | KeyM | KeyN | KeyO | KeyP | KeyQ | KeyR | KeyS | KeyT | KeyU | KeyV | KeyW | KeyX | KeyY | KeyZ (* Digits *) | Digit0 | Digit1 | Digit2 | Digit3 | Digit4 | Digit5 | Digit6 | Digit7 | Digit8 | Digit9 | Minus | Equal (* Whitespace *) | Tab | Enter | Space (* Editing *) | Escape | Backspace | Insert | Delete | CapsLock (* Misc Printable *) | BracketLeft | BracketRight | Semicolon | Quote | Backquote | Backslash | Comma | Period | Slash (* Function keys *) | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 (* Numpad keys *) | Numpad0 | Numpad1 | Numpad2 | Numpad3 | Numpad4 | Numpad5 | Numpad6 | Numpad7 | Numpad8 | Numpad9 | NumpadMultiply | NumpadSubtract | NumpadAdd | NumpadDecimal | NumpadEqual | NumpadEnter | NumpadDivide | NumLock (* Modifier keys *) | ControlLeft | ControlRight | MetaLeft | MetaRight | ShiftLeft | ShiftRight | AltLeft | AltRight (* Arrow keys *) | ArrowLeft | ArrowRight | ArrowUp | ArrowDown (* Navigation *) | PageUp | PageDown | Home | End (* Sound *) | VolumeMute | VolumeDown | VolumeUp (* Media *) | MediaTrackPrevious | MediaTrackNext | MediaPlayPause | MediaStop (* Browser special *) | ContextMenu | BrowserSearch | BrowserHome | BrowserFavorites | BrowserRefresh | BrowserStop | BrowserForward | BrowserBack (* Misc *) | OSLeft | OSRight | ScrollLock | PrintScreen | IntlBackslash | IntlYen | Pause val of_event : keyboardEvent Js.t -> t val of_key_code : int -> t end (** Use [Keyboard_key] when you want to identify the character that the user typed. This should only be invoked on keypress events, not keydown or keyup events. *) module Keyboard_key : sig type t = Uchar.t option val of_event : keyboardEvent Js.t -> t end (****) (** {2 Helper functions for creating HTML elements} *) val createHtml : document t -> htmlElement t val createHead : document t -> headElement t val createLink : document t -> linkElement t val createTitle : document t -> titleElement t val createMeta : document t -> metaElement t val createBase : document t -> baseElement t val createStyle : document t -> styleElement t val createBody : document t -> bodyElement t val createForm : document t -> formElement t val createOptgroup : document t -> optGroupElement t val createOption : document t -> optionElement t val createSelect : ?_type:js_string t -> ?name:js_string t -> document t -> selectElement t val createInput : ?_type:js_string t -> ?name:js_string t -> document t -> inputElement t val createTextarea : ?_type:js_string t -> ?name:js_string t -> document t -> textAreaElement t val createButton : ?_type:js_string t -> ?name:js_string t -> document t -> buttonElement t val createLabel : document t -> labelElement t val createFieldset : document t -> fieldSetElement t val createLegend : document t -> legendElement t val createUl : document t -> uListElement t val createOl : document t -> oListElement t val createDl : document t -> dListElement t val createLi : document t -> liElement t val createDiv : document t -> divElement t val createEmbed : document t -> embedElement t val createP : document t -> paragraphElement t val createH1 : document t -> headingElement t val createH2 : document t -> headingElement t val createH3 : document t -> headingElement t val createH4 : document t -> headingElement t val createH5 : document t -> headingElement t val createH6 : document t -> headingElement t val createQ : document t -> quoteElement t val createBlockquote : document t -> quoteElement t val createPre : document t -> preElement t val createBr : document t -> brElement t val createHr : document t -> hrElement t val createIns : document t -> modElement t val createDel : document t -> modElement t val createA : document t -> anchorElement t val createImg : document t -> imageElement t val createObject : document t -> objectElement t val createParam : document t -> paramElement t val createMap : document t -> mapElement t val createArea : document t -> areaElement t val createScript : document t -> scriptElement t val createTable : document t -> tableElement t val createCaption : document t -> tableCaptionElement t val createCol : document t -> tableColElement t val createColgroup : document t -> tableColElement t val createThead : document t -> tableSectionElement t val createTfoot : document t -> tableSectionElement t val createTbody : document t -> tableSectionElement t val createTr : document t -> tableRowElement t val createTh : document t -> tableCellElement t val createTd : document t -> tableCellElement t val createSub : document t -> element t val createSup : document t -> element t val createSpan : document t -> element t val createTt : document t -> element t val createI : document t -> element t val createB : document t -> element t val createBig : document t -> element t val createSmall : document t -> element t val createEm : document t -> element t val createStrong : document t -> element t val createCite : document t -> element t val createDfn : document t -> element t val createCode : document t -> element t val createSamp : document t -> element t val createKbd : document t -> element t val createVar : document t -> element t val createAbbr : document t -> element t val createDd : document t -> element t val createDt : document t -> element t val createNoscript : document t -> element t val createAddress : document t -> element t val createFrameset : document t -> frameSetElement t val createFrame : document t -> frameElement t val createIframe : document t -> iFrameElement t val createAudio : document t -> audioElement t val createVideo : document t -> videoElement t exception Canvas_not_available val createCanvas : document t -> canvasElement t (** @raise Canvas_not_available when canvas elements are not supported by the browser. *) (****) (** {2 Coercion functions} *) val element : #Dom.element t -> element t (** Coercion from a general DOM element to an HTML element. (Unsafe in general.) *) type taggedElement = | A of anchorElement t | Area of areaElement t | Audio of audioElement t | Base of baseElement t | Blockquote of quoteElement t | Body of bodyElement t | Br of brElement t | Button of buttonElement t | Canvas of canvasElement t | Caption of tableCaptionElement t | Col of tableColElement t | Colgroup of tableColElement t | Del of modElement t | Div of divElement t | Dl of dListElement t | Embed of embedElement t | Fieldset of fieldSetElement t | Form of formElement t | Frameset of frameSetElement t | Frame of frameElement t | H1 of headingElement t | H2 of headingElement t | H3 of headingElement t | H4 of headingElement t | H5 of headingElement t | H6 of headingElement t | Head of headElement t | Hr of hrElement t | Html of htmlElement t | Iframe of iFrameElement t | Img of imageElement t | Input of inputElement t | Ins of modElement t | Label of labelElement t | Legend of legendElement t | Li of liElement t | Link of linkElement t | Map of mapElement t | Meta of metaElement t | Object of objectElement t | Ol of oListElement t | Optgroup of optGroupElement t | Option of optionElement t | P of paramElement t | Param of paramElement t | Pre of preElement t | Q of quoteElement t | Script of scriptElement t | Select of selectElement t | Style of styleElement t | Table of tableElement t | Tbody of tableSectionElement t | Td of tableCellElement t | Textarea of textAreaElement t | Tfoot of tableSectionElement t | Th of tableCellElement t | Thead of tableSectionElement t | Title of titleElement t | Tr of tableRowElement t | Ul of uListElement t | Video of videoElement t | Other of element t val tagged : #element t -> taggedElement val opt_tagged : #element t opt -> taggedElement option type taggedEvent = | MouseEvent of mouseEvent t | KeyboardEvent of keyboardEvent t | MousewheelEvent of mousewheelEvent t | MouseScrollEvent of mouseScrollEvent t | PopStateEvent of popStateEvent t | OtherEvent of event t val taggedEvent : #event t -> taggedEvent val opt_taggedEvent : #event t opt -> taggedEvent option val stopPropagation : #event t -> unit module CoerceTo : sig (** HTMLElement *) val element : #Dom.node t -> element t opt (* null if it is not an element *) val a : #element t -> anchorElement t opt val area : #element t -> areaElement t opt val audio : #element t -> audioElement t opt val base : #element t -> baseElement t opt val blockquote : #element t -> quoteElement t opt val body : #element t -> bodyElement t opt val br : #element t -> brElement t opt val button : #element t -> buttonElement t opt val canvas : #element t -> canvasElement t opt val caption : #element t -> tableCaptionElement t opt val col : #element t -> tableColElement t opt val colgroup : #element t -> tableColElement t opt val del : #element t -> modElement t opt val div : #element t -> divElement t opt val embed : #element t -> embedElement t opt val dl : #element t -> dListElement t opt val fieldset : #element t -> fieldSetElement t opt val form : #element t -> formElement t opt val frameset : #element t -> frameSetElement t opt val frame : #element t -> frameElement t opt val h1 : #element t -> headingElement t opt val h2 : #element t -> headingElement t opt val h3 : #element t -> headingElement t opt val h4 : #element t -> headingElement t opt val h5 : #element t -> headingElement t opt val h6 : #element t -> headingElement t opt val head : #element t -> headElement t opt val hr : #element t -> hrElement t opt val html : #element t -> htmlElement t opt val iframe : #element t -> iFrameElement t opt val img : #element t -> imageElement t opt val input : #element t -> inputElement t opt val ins : #element t -> modElement t opt val label : #element t -> labelElement t opt val legend : #element t -> legendElement t opt val li : #element t -> liElement t opt val link : #element t -> linkElement t opt val map : #element t -> mapElement t opt val meta : #element t -> metaElement t opt val _object : #element t -> objectElement t opt val ol : #element t -> oListElement t opt val optgroup : #element t -> optGroupElement t opt val option : #element t -> optionElement t opt val p : #element t -> paramElement t opt val param : #element t -> paramElement t opt val pre : #element t -> preElement t opt val q : #element t -> quoteElement t opt val script : #element t -> scriptElement t opt val select : #element t -> selectElement t opt val style : #element t -> styleElement t opt val table : #element t -> tableElement t opt val tbody : #element t -> tableSectionElement t opt val td : #element t -> tableCellElement t opt val textarea : #element t -> textAreaElement t opt val tfoot : #element t -> tableSectionElement t opt val th : #element t -> tableCellElement t opt val thead : #element t -> tableSectionElement t opt val title : #element t -> titleElement t opt val tr : #element t -> tableRowElement t opt val ul : #element t -> uListElement t opt val video : #element t -> videoElement t opt (** Event *) val mouseEvent : #event t -> mouseEvent t opt val keyboardEvent : #event t -> keyboardEvent t opt val wheelEvent : #event t -> mousewheelEvent t opt val mouseScrollEvent : #event t -> mouseScrollEvent t opt val popStateEvent : #event t -> popStateEvent t opt end type timeout_id_safe val setTimeout : (unit -> unit) -> float -> timeout_id_safe (** Same as [Dom_html.window##setTimeout cb ms] but prevents overflow with delay greater than 24 days. *) val clearTimeout : timeout_id_safe -> unit val js_array_of_collection : #element collection Js.t -> #element Js.t Js.js_array Js.t (** Convert a [Dom_html.collection] to a Js array *) (** {2 Deprecated function.} *) val _requestAnimationFrame : (unit -> unit) Js.callback -> unit (** Call the appropriate [requestAnimationFrame] method variant (depending on the navigator), or sleep for a short amount of time when there no such method is provided. We currently prefix the function name with as underscore as the interface of this function is not completely standardized yet. Thus, we leave the room to a function with a possibly refined type. This function is deprecated. Use the requestAnimationFrame of the window object instead. *) (**/**) val decode_html_entities : js_string t -> js_string t val onIE : bool val hasPushState : unit -> bool val hasPlaceholder : unit -> bool val hasRequired : unit -> bool js_of_ocaml-3.5.2/lib/js_of_ocaml/dom_svg.ml000066400000000000000000001576461357507750000210410ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * Copyright (C) 2014 Jérôme Vouillon * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open! Import let xmlns = Js.string "http://www.w3.org/2000/svg" (* translate spec from http://www.w3.org/TR/SVG/idl.html *) (* http://www.w3.org/TR/SVG/struct.html *) type error_code = | WRONG_TYPE_ERR | INVALID_VALUE_ERR | MATRIX_NOT_INVERTABLE class type svg_error = object inherit Js.error method code : error_code t readonly_prop end exception SVGError of svg_error type lengthUnitType = | LENGTHTYPE_UNKNOWN | LENGTHTYPE_NUMBER | LENGTHTYPE_PERCENTAGE | LENGTHTYPE_EMS | LENGTHTYPE_EXS | LENGTHTYPE_PX | LENGTHTYPE_CM | LENGTHTYPE_MM | LENGTHTYPE_IN | LENGTHTYPE_PT | LENGTHTYPE_PC type angleUnitType = | ANGLETYPE_UNKNOWN | ANGLETYPE_UNSPECIFIED | ANGLETYPE_DEG | ANGLETYPE_RAD | ANGLETYPE_GRAD type colorType = | COLORTYPE_UNKNOWN | COLORTYPE_RGBCOLOR | COLORTYPE_RGBCOLOR_ICCCOLOR | COLORTYPE_CURRENTCOLOR type alignmentType = | PRESERVEASPECTRATIO_UNKNOWN | PRESERVEASPECTRATIO_NONE | PRESERVEASPECTRATIO_XMINYMIN | PRESERVEASPECTRATIO_XMIDYMIN | PRESERVEASPECTRATIO_XMAXYMIN | PRESERVEASPECTRATIO_XMINYMID | PRESERVEASPECTRATIO_XMIDYMID | PRESERVEASPECTRATIO_XMAXYMID | PRESERVEASPECTRATIO_XMINYMAX | PRESERVEASPECTRATIO_XMIDYMAX | PRESERVEASPECTRATIO_XMAXYMAX type meetOrSliceType = | MEETORSLICE_UNKNOWN | MEETORSLICE_MEET | MEETORSLICE_SLICE type transformType = | TRANSFORM_UNKNOWN | TRANSFORM_MATRIX | TRANSFORM_TRANSLATE | TRANSFORM_SCALE | TRANSFORM_ROTATE | TRANSFORM_SKEWX | TRANSFORM_SKEWY type zoomAndPanType = | ZOOMANDPAN_UNKNOWN | ZOOMANDPAN_DISABLE | ZOOMANDPAN_MAGNIFY type lengthAdjust = | LENGTHADJUST_UNKNOWN | LENGTHADJUST_SPACING | LENGTHADJUST_SPACINGANDGLYPHS type unitType = | UNIT_TYPE_UNKNOWN | UNIT_TYPE_USERSPACEONUSE | UNIT_TYPE_OBJECTBOUNDINGBOX (* interface SVGRenderingIntent *) type intentType = | RENDERING_INTENT_UNKNOWN | RENDERING_INTENT_AUTO | RENDERING_INTENT_PERCEPTUAL | RENDERING_INTENT_RELATIVE_COLORIMETRIC | RENDERING_INTENT_SATURATION | RENDERING_INTENT_ABSOLUTE_COLORIMETRIC (* Path Segment Types *) type pathSegmentType = | PATHSEG_UNKNOWN | PATHSEG_CLOSEPATH | PATHSEG_MOVETO_ABS | PATHSEG_MOVETO_REL | PATHSEG_LINETO_ABS | PATHSEG_LINETO_REL | PATHSEG_CURVETO_CUBIC_ABS | PATHSEG_CURVETO_CUBIC_REL | PATHSEG_CURVETO_QUADRATIC_ABS | PATHSEG_CURVETO_QUADRATIC_REL | PATHSEG_ARC_ABS | PATHSEG_ARC_REL | PATHSEG_LINETO_HORIZONTAL_ABS | PATHSEG_LINETO_HORIZONTAL_REL | PATHSEG_LINETO_VERTICAL_ABS | PATHSEG_LINETO_VERTICAL_REL | PATHSEG_CURVETO_CUBIC_SMOOTH_ABS | PATHSEG_CURVETO_CUBIC_SMOOTH_REL | PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS | PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL (* textPath Method Types *) type textPathMethodType = | TEXTPATH_METHODTYPE_UNKNOWN | TEXTPATH_METHODTYPE_ALIGN | TEXTPATH_METHODTYPE_STRETCH (* textPath Spacing Types *) type textPathSpacingType = | TEXTPATH_SPACINGTYPE_UNKNOWN | TEXTPATH_SPACINGTYPE_AUTO | TEXTPATH_SPACINGTYPE_EXACT (* Spread Method Types *) type spreadMethodType = | SPREADMETHOD_UNKNOWN | SPREADMETHOD_PAD | SPREADMETHOD_REFLECT | SPREADMETHOD_REPEAT type suspendHandleID (****) class type ['a] animated = object method baseVal : 'a prop method animVal : 'a prop end class type ['a] list = object method numberOfItems : int readonly_prop method clear : unit meth method initialize : 'a -> 'a meth method getItem : int -> 'a meth method insertItemBefore : 'a -> int -> 'a meth method replaceItem : 'a -> int -> 'a meth method removeItem : int -> 'a meth method appendItem : 'a -> 'a meth end (****) (* interface SVGElement *) class type element = object inherit Dom.element method id : js_string t prop method xmlbase : js_string t prop method ownerSVGElement : svgElement t readonly_prop method viewportElement : element t readonly_prop end (* interface SVGAnimatedString *) and animatedString = [js_string t] animated (* interface SVGAnimatedBoolean *) and animatedBoolean = [bool t] animated (* interface SVGStringList *) and stringList = [js_string t] list (* interface SVGAnimatedEnumeration *) and animatedEnumeration = [int (*short*)] animated (* interface SVGAnimatedInteger *) and animatedInteger = [int] animated (* interface SVGAnimatedNumber *) and animatedNumber = [float] animated (* interface SVGNumberList *) and numberList = [number t] list (* interface SVGAnimatedNumberList *) and animatedNumberList = [numberList t] animated (* interface SVGLength *) and length = object method unitType : lengthUnitType readonly_prop method value : float prop method valueInSpecifiedUnits : float prop method valueAsString : js_string t prop method newValueSpecifiedUnits : lengthUnitType -> float -> unit meth method convertToSpecifiedUnits : lengthUnitType -> unit meth end (* interface SVGAnimatedLength *) and animatedLength = [length t] animated (* interface SVGLengthList *) and lengthList = [length t] list (* interface SVGAnimatedLengthList *) and animatedLengthList = [lengthList t] animated (* interface SVGAngle *) and angle = object method unitType : angleUnitType readonly_prop method value : float prop method valueInSpecifiedUnits : float prop method valueAsString : js_string t prop method newValueSpecifiedUnits : angleUnitType -> float -> unit meth method convertToSpecifiedUnits : angleUnitType -> unit meth end (* interface SVGAnimatedAngle *) and animatedAngle = [angle t] animated (* XXXXX Move it *) and rgbColor = object end (* interface SVGColor *) and color = object (* XXX inherit cssValue *) method colorType : colorType readonly_prop method rgbColor : rgbColor t readonly_prop method iccColor : iccColor t readonly_prop method setRGBColor : js_string t -> unit meth method setRGBColorICCColor : js_string t -> js_string t -> unit meth method setColor : colorType -> js_string t -> js_string t -> unit meth end (* interface SVGICCColor *) and iccColor = object method colorProfile : js_string t prop method colors : numberList t readonly_prop end (* interface SVGRect *) and rect = object method x : float prop method y : float prop method width : float prop method height : float prop end (* interface SVGAnimatedRect *) and animatedRect = [rect t] animated (* interface SVGStylable *) and stylable = object method className : animatedString t readonly_prop method style : Dom_html.cssStyleDeclaration t readonly_prop (* CSSValue getPresentationAttribute(in DOMString name); *) end (* interface SVGLocatable *) and locatable = object method nearestViewportElement : element t readonly_prop method farthestViewportElement : element t readonly_prop method getBBox : rect t meth method getCTM : matrix t meth method getScreenCTM : matrix t meth method getTransformToElement : element t -> matrix t meth end (* interface SVGTransformable *) and transformable = object inherit locatable method transform : animatedTransformList t readonly_prop end (* interface SVGTests *) and tests = object method requiredFeatures : stringList t readonly_prop method requiredExtensions : stringList t readonly_prop method systemLanguage : stringList t readonly_prop method hasExtension : js_string t -> bool t meth end (* interface SVGLangSpace *) and langSpace = object method xmllang : js_string t prop method xmlspace : js_string t prop end (* interface SVGExternalResourcesRequired *) and externalResourcesRequired = object method externalResourcesRequired : animatedBoolean t readonly_prop end (* interface SVGFitToViewBox *) and fitToViewBox = object method viewBox : animatedRect t readonly_prop method preserveAspectRatio : animatedPreserveAspectRatio t readonly_prop end (* interface SVGZoomAndPan *) and zoomAndPan = object method zoomAndPan : zoomAndPanType prop end (* interface SVGViewSpec *) and viewSpec = object inherit zoomAndPan inherit fitToViewBox method transform : transformList t readonly_prop method viewTarget : element t readonly_prop method viewBoxString : js_string t readonly_prop method preserveAspectRatioString : js_string t readonly_prop method transformString : js_string t readonly_prop method viewTargetString : js_string t readonly_prop end (* interface SVGURIReference *) and uriReference = object method href : animatedString t readonly_prop end (* interface SVGCSSRule : CSSRule *) (* const unsigned short COLOR_PROFILE_RULE = 7; *) (* }; *) (* interface SVGDocument *) and document = object inherit [element] Dom.document (*XXX inherit documentEvent *) method title : js_string t prop method referrer : js_string t readonly_prop method domain : js_string t prop method _URL : js_string t readonly_prop method rootElement : svgElement t opt readonly_prop (* rootElement will be null or undefined in an html context *) end (* interface SVGSVGElement *) and svgElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit locatable inherit fitToViewBox inherit zoomAndPan (*XXX inherit documentevent, viewcss, documentcss *) method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop method contentScriptType : js_string t prop method contentStyleType : js_string t prop method viewport : rect t readonly_prop method pixelUnitToMillimeterX : float readonly_prop method pixelUnitToMillimeterY : float readonly_prop method screenPixelUnitToMillimeterX : float readonly_prop method screenPixelUnitToMillimeterY : float readonly_prop method useCurrentView : bool t readonly_prop method currentView : viewSpec t readonly_prop method currentScale : float prop method currentTranslate : point t readonly_prop method suspendRedraw : int -> suspendHandleID meth method unsuspendRedraw : suspendHandleID -> unit meth method unsuspendRedrawAll : unit meth method forceRedraw : unit meth method pauseAnimations : unit meth method unpauseAnimations : unit meth method animationsPaused : bool t meth method getCurrentTime : float meth method setCurrentTime : int -> unit meth method getIntersectionList : rect t -> element t -> element Dom.nodeList t meth method getEnclosureList : rect t -> element t -> element Dom.nodeList t meth method checkIntersection : element t -> rect t -> bool t method checkEnclosure : element t -> rect t -> bool t method deselectAll : unit meth method createSVGNumber : number t meth method createSVGLength : length t meth method createSVGAngle : angle t meth method createSVGPoint : point t meth method createSVGMatrix : matrix t meth method createSVGRect : rect t meth method createSVGTransform : transform t meth method createSVGTransformFromMatrix : matrix t -> transform t meth method getElementById : js_string t -> Dom.element t meth end (* interface SVGGElement *) and gElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit Dom_html.eventTarget end (* interface SVGDefsElement *) and defsElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable (* XXXXXXX ? inherit Dom_html.eventTarget *) end (* interface SVGDescElement *) and descElement = object inherit element inherit langSpace inherit stylable (* XXXXXXX ? inherit Dom_html.eventTarget *) end (* interface SVGTitleElement *) and titleElement = object inherit element inherit langSpace inherit stylable end (* interface SVGSymbolElement *) and symbolElement = object inherit element inherit langSpace inherit externalResourcesRequired inherit stylable inherit fitToViewBox inherit Dom_html.eventTarget end (* interface SVGUseElement *) and useElement = object inherit element inherit uriReference inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop method instanceRoot : elementInstance t readonly_prop method animatedInstanceRoot : elementInstance t readonly_prop end and elementInstance = object inherit Dom_html.eventTarget method correspondingElement : element t readonly_prop method correspondingUseElement : useElement t readonly_prop method parentNode : elementInstance t readonly_prop method childNodes : elementInstanceList t readonly_prop method firstChild : elementInstance t readonly_prop method lastChild : elementInstance t readonly_prop method previousSibling : elementInstance t readonly_prop method nextSibling : elementInstance t readonly_prop end (* interface SVGElementInstanceList *) and elementInstanceList = object method length : int readonly_prop method item : int -> elementInstance t end (* interface SVGImageElement *) and imageElement = object inherit element inherit uriReference inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop (* readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio *) end and switchElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable end (* XXX deprecated => interface GetSVGDocument => SVGDocument getSVGDocument() *) (* interface SVGStyleElement *) and styleElement = object inherit element inherit langSpace method type_ : js_string t prop method media : js_string t prop method title : js_string t prop end (* interface SVGPoint *) and point = object method x : float readonly_prop method y : float readonly_prop method matrixTransform : matrix t -> point t meth end (* interface SVGPointList *) and pointList = [point t] list (* interface SVGMatrix *) and matrix = object method a : float readonly_prop method b : float readonly_prop method c : float readonly_prop method d : float readonly_prop method e : float readonly_prop method f : float readonly_prop method multiply : matrix t -> matrix t meth method inverse : matrix t meth method translate : float -> float -> matrix t meth method scale : float -> matrix t meth method scaleNonUniform : float -> float -> matrix t meth method rotate : float -> matrix t meth method rotateFromVector : float -> float -> matrix t meth method flipX : matrix t meth method flipY : matrix t meth method skewX : float -> matrix t meth method skewY : float -> matrix t meth end (* interface SVGTransform *) and transform = object method _type : transformType readonly_prop method matrix : matrix t readonly_prop method angle : float readonly_prop method setMatrix : matrix t -> unit meth method setTranslate : float -> float -> unit meth method setScale : float -> float -> unit meth method setRotate : float -> float -> float -> unit meth method setSkewX : float -> unit meth method setSkewY : float -> unit meth end (* interface SVGTransformList *) and transformList = object inherit [transform t] list method createSVGTransformFromMatrix : matrix -> transform t meth method consolidate : transform t meth end (* interface SVGAnimatedTransformList *) and animatedTransformList = [transformList t] animated (* interface SVGPreserveAspectRatio *) and preserveAspectRatio = object method align : alignmentType readonly_prop method meetOrSlice : meetOrSliceType readonly_prop end (* interface SVGAnimatedPreserveAspectRatio *) and animatedPreserveAspectRatio = [preserveAspectRatio t] animated (* interface SVGPathSeg *) and pathSeg = object method pathSegType : pathSegmentType readonly_prop method pathSegTypeAsLetter : js_string t readonly_prop end (* interface SVGPathSegClosePath *) and pathSegClosePath = pathSeg (* interface SVGPathSegMovetoAbs *) (* interface SVGPathSegMovetoRel *) and pathSegMoveto = object inherit pathSeg method x : float prop method y : float prop end (* interface SVGPathSegLinetoAbs *) (* interface SVGPathSegLinetoRel *) and pathSegLineto = object inherit pathSeg method x : float prop method y : float prop end (* interface SVGPathSegCurvetoCubicAbs *) (* interface SVGPathSegCurvetoCubicRel *) and pathSegCurvetoCubic = object inherit pathSeg method x : float prop method y : float prop method x1 : float prop method y1 : float prop method x2 : float prop method y2 : float prop end (* interface SVGPathSegCurvetoQuadraticAbs *) (* interface SVGPathSegCurvetoQuadraticRel *) and pathSegCurvetoQuadratic = object inherit pathSeg method x : float prop method y : float prop method x1 : float prop method y1 : float prop end (* interface SVGPathSegArcAbs *) (* interface SVGPathSegArcRel*) and pathSegArc = object inherit pathSeg method y : float prop method r1 : float prop method r2 : float prop method angle : float prop method largeArcFlag : bool t prop method sweepFlag : bool t prop end (* interface SVGPathSegLinetoHorizontalAbs *) (* interface SVGPathSegLinetoHorizontalRel *) and pathSegLinetoHorizontal = object inherit pathSeg method x : float end (* interface SVGPathSegLinetoVerticalAbs *) (* interface SVGPathSegLinetoVerticalRel *) and pathSegLinetoVertical = object inherit pathSeg method y : float end and pathSegCurvetoCubicSmooth = object inherit pathSeg method x : float method y : float method x2 : float method y2 : float end (* interface SVGPathSegCurvetoQuadraticSmoothAbs *) (* interface SVGPathSegCurvetoQuadraticSmoothRel *) and pathSegCurvetoQuadraticSmooth = object inherit pathSeg method x : float method y : float end and pathSegList = [pathSeg t] list (* interface SVGAnimatedPathData *) and animatedPathData = object method pathSegList : pathSegList t prop method normalizedPathSegList : pathSegList t prop method animatedPathSegList : pathSegList t prop method animatedNormalizedPathSegList : pathSegList t prop end (* interface SVGPathElement *) and pathElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit animatedPathData method pathLength : animatedNumber t readonly_prop method getTotalLength : float meth method getPointAtLength : float -> point t meth method getPathSegAtLength : float -> int method createSVGPathSegClosePath : pathSegClosePath meth method createSVGPathSegMovetoAbs : float -> float -> pathSegMoveto meth method createSVGPathSegMovetoRel : float -> float -> pathSegMoveto meth method createSVGPathSegLinetoAbs : float -> float -> pathSegLineto meth method createSVGPathSegLinetoRel : float -> float -> pathSegLineto meth method createSVGPathSegCurvetoCubicAbs : float -> float -> float -> float -> float -> float -> pathSegCurvetoCubic meth method createSVGPathSegCurvetoCubicRel : float -> float -> float -> float -> float -> float -> pathSegCurvetoCubic meth method createSVGPathSegCurvetoQuadraticAbs : float -> float -> float -> float -> pathSegCurvetoQuadratic meth method createSVGPathSegCurvetoQuadraticRel : float -> float -> float -> float -> pathSegCurvetoQuadratic meth method createSVGPathSegArcAbs : float -> float -> float -> float -> float -> bool t -> bool t -> pathSegArc meth method createSVGPathSegArcRel : float -> float -> float -> float -> float -> bool t -> bool t -> pathSegArc meth method createSVGPathSegLinetoHorizontalAbs : float -> pathSegLinetoHorizontal meth method createSVGPathSegLinetoHorizontalRel : float -> pathSegLinetoHorizontal meth method createSVGPathSegLinetoVerticalAbs : float -> pathSegLinetoVertical meth method createSVGPathSegLinetoVerticalRel : float -> pathSegLinetoVertical meth method createSVGPathSegCurvetoCubicSmoothAbs : float -> float -> float -> float -> pathSegCurvetoCubicSmooth meth method createSVGPathSegCurvetoCubicSmoothRel : float -> float -> float -> float -> pathSegCurvetoCubicSmooth meth method createSVGPathSegCurvetoQuadraticSmoothAbs : float -> float -> pathSegCurvetoQuadraticSmooth meth method createSVGPathSegCurvetoQuadraticSmoothRel : float -> float -> pathSegCurvetoQuadraticSmooth meth end (* interface SVGRectElement *) and rectElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop method rx : animatedLength t readonly_prop method ry : animatedLength t readonly_prop end (* interface SVGCircleElement *) and circleElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method cx : animatedLength t readonly_prop method cy : animatedLength t readonly_prop method r : animatedLength t readonly_prop end (* interface SVGEllipseElement *) and ellipseElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method cx : animatedLength t readonly_prop method cy : animatedLength t readonly_prop method rx : animatedLength t readonly_prop method ry : animatedLength t readonly_prop end (* interface SVGLineElement *) class type lineElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit Dom_html.eventTarget method x1 : animatedLength t readonly_prop method y1 : animatedLength t readonly_prop method x2 : animatedLength t readonly_prop method y2 : animatedLength t readonly_prop end (* interface SVGAnimatedPoints *) and animatedPoints = object method points : pointList t readonly_prop method animatedpoints : pointList t readonly_prop end (* interface SVGPolylineElement *) and polyLineElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit animatedPoints end (* interface SVGPolygonElement *) and polygonElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit animatedPoints end (* interface SVGTextContentElement *) and textContentElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit Dom_html.eventTarget method textLength : animatedLength t readonly_prop method lengthAdjust : lengthAdjust animated t readonly_prop method getNumberOfChars : int meth method getComputedTextLength : float meth method getSubStringLength : int -> int -> float meth method getStartPositionOfChar : int -> point t meth method getEndPositionOfChar : int -> point t meth method getExtentOfChar : int -> rect t meth method getRotationOfChar : int -> float meth method getCharNumAtPosition : point -> int meth method selectSubString : int -> int -> unit meth end (* interface SVGTextPositioningElement *) and textPositioningElement = object inherit textContentElement method x : animatedLengthList t readonly_prop method y : animatedLengthList t readonly_prop method dx : animatedLengthList t readonly_prop method dy : animatedLengthList t readonly_prop method rotate : animatedNumberList t readonly_prop end (* interface SVGTextElement *) and textElement = object inherit textPositioningElement inherit transformable end and tspanElement = textPositioningElement and trefElement = object inherit textPositioningElement inherit uriReference end (* interface SVGTextPathElement *) and textPathElementMethod = [textPathMethodType] animated and textPathElementSpacing = [textPathSpacingType] animated and textPathElement = object inherit textContentElement inherit uriReference method startOffset : animatedLength t readonly_prop method method_ : textPathElementMethod readonly_prop method spacing : textPathElementSpacing readonly_prop end (* interface SVGAltGlyphElement *) and altGlyphElement = object inherit textPositioningElement inherit uriReference method glyphRef : js_string t prop method format : js_string t prop end (* interface SVGAltGlyphDefElement *) and altGlyphDefElement = element (* interface SVGAltGlyphItemElement *) and altGlyphItemElement = element (* interface SVGGlyphRefElement *) and glyphRefElement = object inherit element inherit uriReference inherit stylable method glyphRef : js_string t prop method format : js_string t prop method x : float prop method y : float prop method dx : float prop method dy : float prop end (* interface SVGPaint : SVGColor { *) (* // Paint Types *) (* const unsigned short SVG_PAINTTYPE_UNKNOWN = 0; *) (* const unsigned short SVG_PAINTTYPE_RGBCOLOR = 1; *) (* const unsigned short SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2; *) (* const unsigned short SVG_PAINTTYPE_NONE = 101; *) (* const unsigned short SVG_PAINTTYPE_CURRENTCOLOR = 102; *) (* const unsigned short SVG_PAINTTYPE_URI_NONE = 103; *) (* const unsigned short SVG_PAINTTYPE_URI_CURRENTCOLOR = 104; *) (* const unsigned short SVG_PAINTTYPE_URI_RGBCOLOR = 105; *) (* const unsigned short SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106; *) (* const unsigned short SVG_PAINTTYPE_URI = 107; *) (* readonly attribute unsigned short paintType; *) (* readonly attribute DOMString uri; *) (* void setUri(in DOMString uri); *) (* void setPaint(in unsigned short paintType, in DOMString uri, in DOMString rgbColor, in DOMString iccColor) raises(SVGException); *) (* }; *) (* interface SVGMarkerElement : SVGElement, *) (* SVGLangSpace, *) (* SVGExternalResourcesRequired, *) (* SVGStylable, *) (* SVGFitToViewBox { *) (* // Marker Unit Types *) (* const unsigned short SVG_MARKERUNITS_UNKNOWN = 0; *) (* const unsigned short SVG_MARKERUNITS_USERSPACEONUSE = 1; *) (* const unsigned short SVG_MARKERUNITS_STROKEWIDTH = 2; *) (* // Marker Orientation Types *) (* const unsigned short SVG_MARKER_ORIENT_UNKNOWN = 0; *) (* const unsigned short SVG_MARKER_ORIENT_AUTO = 1; *) (* const unsigned short SVG_MARKER_ORIENT_ANGLE = 2; *) (* readonly attribute SVGAnimatedLength refX; *) (* readonly attribute SVGAnimatedLength refY; *) (* readonly attribute SVGAnimatedEnumeration markerUnits; *) (* readonly attribute SVGAnimatedLength markerWidth; *) (* readonly attribute SVGAnimatedLength markerHeight; *) (* readonly attribute SVGAnimatedEnumeration orientType; *) (* readonly attribute SVGAnimatedAngle orientAngle; *) (* void setOrientToAuto() raises(DOMException); *) (* void setOrientToAngle(in SVGAngle angle) raises(DOMException); *) (* }; *) (* interface SVGColorProfileElement : SVGElement, *) (* SVGURIReference, *) (* SVGRenderingIntent { *) (* attribute DOMString local; *) (* attribute DOMString name; *) (* attribute unsigned short renderingIntent; *) (* }; *) (* interface SVGColorProfileRule : SVGCSSRule, *) (* SVGRenderingIntent { *) (* attribute DOMString src setraises(DOMException); *) (* attribute DOMString name setraises(DOMException); *) (* attribute unsigned short renderingIntent setraises(DOMException); *) (* }; *) (* interface SVGGradientElement *) and animatedSpreadMethod = [spreadMethodType] animated and gradientElement = object inherit element inherit uriReference inherit stylable (* readonly attribute SVGAnimatedEnumeration gradientUnits; *) method gradientTransform : animatedTransformList t readonly_prop method spreadMethod : animatedSpreadMethod t readonly_prop end (* interface SVGLinearGradientElement *) and linearGradientElement = object inherit gradientElement method x1 : animatedLength t readonly_prop method y1 : animatedLength t readonly_prop method x2 : animatedLength t readonly_prop method y2 : animatedLength t readonly_prop end (* interface SVGRadialGradientElement *) and radialGradientElement = object inherit gradientElement method cx : animatedLength t readonly_prop method cy : animatedLength t readonly_prop method r : animatedLength t readonly_prop method fx : animatedLength t readonly_prop method fy : animatedLength t readonly_prop end (* interface SVGStopElement *) and stopElement = object inherit element inherit stylable method offset : animatedNumber t readonly_prop end (* interface SVGPatternElement *) and patternElement = object inherit element inherit uriReference inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit fitToViewBox (* readonly attribute SVGAnimatedEnumeration patternUnits; *) (* readonly attribute SVGAnimatedEnumeration patternContentUnits; *) method patternTransform : animatedTransformList t readonly_prop method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop end (* interface SVGClipPathElement *) and clipPathElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable (* readonly attribute SVGAnimatedEnumeration clipPathUnits; *) end (* interface SVGMaskElement *) and maskElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable (* readonly attribute SVGAnimatedEnumeration maskUnits; *) (* readonly attribute SVGAnimatedEnumeration maskContentUnits; *) method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop end (* interface SVGFilterElement *) and filterElement = object inherit element inherit uriReference inherit langSpace inherit externalResourcesRequired inherit stylable (* readonly attribute SVGAnimatedEnumeration filterUnits; *) (* readonly attribute SVGAnimatedEnumeration primitiveUnits; *) method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop method filterResX : animatedInteger t readonly_prop method filterResY : animatedInteger t readonly_prop method setFilterRes : int -> int -> unit meth end (* interface SVGFilterPrimitiveStandardAttributes : SVGStylable { *) (* readonly attribute SVGAnimatedLength x; *) (* readonly attribute SVGAnimatedLength y; *) (* readonly attribute SVGAnimatedLength width; *) (* readonly attribute SVGAnimatedLength height; *) (* readonly attribute SVGAnimatedString result; *) (* }; *) (* interface SVGFEBlendElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Blend Mode Types *) (* const unsigned short SVG_FEBLEND_MODE_UNKNOWN = 0; *) (* const unsigned short SVG_FEBLEND_MODE_NORMAL = 1; *) (* const unsigned short SVG_FEBLEND_MODE_MULTIPLY = 2; *) (* const unsigned short SVG_FEBLEND_MODE_SCREEN = 3; *) (* const unsigned short SVG_FEBLEND_MODE_DARKEN = 4; *) (* const unsigned short SVG_FEBLEND_MODE_LIGHTEN = 5; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedString in2; *) (* readonly attribute SVGAnimatedEnumeration mode; *) (* }; *) (* interface SVGFEColorMatrixElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Color Matrix Types *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0; *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_MATRIX = 1; *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_SATURATE = 2; *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_HUEROTATE = 3; *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedEnumeration type; *) (* readonly attribute SVGAnimatedNumberList values; *) (* }; *) (* interface SVGFEComponentTransferElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* }; *) (* interface SVGComponentTransferFunctionElement : SVGElement { *) (* // Component Transfer Types *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5; *) (* readonly attribute SVGAnimatedEnumeration type; *) (* readonly attribute SVGAnimatedNumberList tableValues; *) (* readonly attribute SVGAnimatedNumber slope; *) (* readonly attribute SVGAnimatedNumber intercept; *) (* readonly attribute SVGAnimatedNumber amplitude; *) (* readonly attribute SVGAnimatedNumber exponent; *) (* readonly attribute SVGAnimatedNumber offset; *) (* }; *) (* interface SVGFEFuncRElement : SVGComponentTransferFunctionElement { *) (* }; *) (* interface SVGFEFuncGElement : SVGComponentTransferFunctionElement { *) (* }; *) (* interface SVGFEFuncBElement : SVGComponentTransferFunctionElement { *) (* }; *) (* interface SVGFEFuncAElement : SVGComponentTransferFunctionElement { *) (* }; *) (* interface SVGFECompositeElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Composite Operators *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_OVER = 1; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_IN = 2; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_OUT = 3; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_ATOP = 4; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_XOR = 5; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_ARITHMETIC = 6; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedString in2; *) (* readonly attribute SVGAnimatedEnumeration operator; *) (* readonly attribute SVGAnimatedNumber k1; *) (* readonly attribute SVGAnimatedNumber k2; *) (* readonly attribute SVGAnimatedNumber k3; *) (* readonly attribute SVGAnimatedNumber k4; *) (* }; *) (* interface SVGFEConvolveMatrixElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Edge Mode Values *) (* const unsigned short SVG_EDGEMODE_UNKNOWN = 0; *) (* const unsigned short SVG_EDGEMODE_DUPLICATE = 1; *) (* const unsigned short SVG_EDGEMODE_WRAP = 2; *) (* const unsigned short SVG_EDGEMODE_NONE = 3; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedInteger orderX; *) (* readonly attribute SVGAnimatedInteger orderY; *) (* readonly attribute SVGAnimatedNumberList kernelMatrix; *) (* readonly attribute SVGAnimatedNumber divisor; *) (* readonly attribute SVGAnimatedNumber bias; *) (* readonly attribute SVGAnimatedInteger targetX; *) (* readonly attribute SVGAnimatedInteger targetY; *) (* readonly attribute SVGAnimatedEnumeration edgeMode; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthX; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthY; *) (* readonly attribute SVGAnimatedBoolean preserveAlpha; *) (* }; *) (* interface SVGFEDiffuseLightingElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedNumber surfaceScale; *) (* readonly attribute SVGAnimatedNumber diffuseConstant; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthX; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthY; *) (* }; *) (* interface SVGFEDistantLightElement : SVGElement { *) (* readonly attribute SVGAnimatedNumber azimuth; *) (* readonly attribute SVGAnimatedNumber elevation; *) (* }; *) (* interface SVGFEPointLightElement : SVGElement { *) (* readonly attribute SVGAnimatedNumber x; *) (* readonly attribute SVGAnimatedNumber y; *) (* readonly attribute SVGAnimatedNumber z; *) (* }; *) (* interface SVGFESpotLightElement : SVGElement { *) (* readonly attribute SVGAnimatedNumber x; *) (* readonly attribute SVGAnimatedNumber y; *) (* readonly attribute SVGAnimatedNumber z; *) (* readonly attribute SVGAnimatedNumber pointsAtX; *) (* readonly attribute SVGAnimatedNumber pointsAtY; *) (* readonly attribute SVGAnimatedNumber pointsAtZ; *) (* readonly attribute SVGAnimatedNumber specularExponent; *) (* readonly attribute SVGAnimatedNumber limitingConeAngle; *) (* }; *) (* interface SVGFEDisplacementMapElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Channel Selectors *) (* const unsigned short SVG_CHANNEL_UNKNOWN = 0; *) (* const unsigned short SVG_CHANNEL_R = 1; *) (* const unsigned short SVG_CHANNEL_G = 2; *) (* const unsigned short SVG_CHANNEL_B = 3; *) (* const unsigned short SVG_CHANNEL_A = 4; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedString in2; *) (* readonly attribute SVGAnimatedNumber scale; *) (* readonly attribute SVGAnimatedEnumeration xChannelSelector; *) (* readonly attribute SVGAnimatedEnumeration yChannelSelector; *) (* }; *) (* interface SVGFEFloodElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* }; *) (* interface SVGFEGaussianBlurElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedNumber stdDeviationX; *) (* readonly attribute SVGAnimatedNumber stdDeviationY; *) (* void setStdDeviation(in float stdDeviationX, in float stdDeviationY) raises(DOMException); *) (* }; *) (* interface SVGFEImageElement : SVGElement, *) (* SVGURIReference, *) (* SVGLangSpace, *) (* SVGExternalResourcesRequired, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; *) (* }; *) (* interface SVGFEMergeElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* }; *) (* interface SVGFEMergeNodeElement : SVGElement { *) (* readonly attribute SVGAnimatedString in1; *) (* }; *) (* interface SVGFEMorphologyElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Morphology Operators *) (* const unsigned short SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0; *) (* const unsigned short SVG_MORPHOLOGY_OPERATOR_ERODE = 1; *) (* const unsigned short SVG_MORPHOLOGY_OPERATOR_DILATE = 2; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedEnumeration operator; *) (* readonly attribute SVGAnimatedNumber radiusX; *) (* readonly attribute SVGAnimatedNumber radiusY; *) (* }; *) (* interface SVGFEOffsetElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedNumber dx; *) (* readonly attribute SVGAnimatedNumber dy; *) (* }; *) (* interface SVGFESpecularLightingElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedNumber surfaceScale; *) (* readonly attribute SVGAnimatedNumber specularConstant; *) (* readonly attribute SVGAnimatedNumber specularExponent; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthX; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthY; *) (* }; *) (* interface SVGFETileElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* }; *) (* interface SVGFETurbulenceElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Turbulence Types *) (* const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0; *) (* const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1; *) (* const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE = 2; *) (* // Stitch Options *) (* const unsigned short SVG_STITCHTYPE_UNKNOWN = 0; *) (* const unsigned short SVG_STITCHTYPE_STITCH = 1; *) (* const unsigned short SVG_STITCHTYPE_NOSTITCH = 2; *) (* readonly attribute SVGAnimatedNumber baseFrequencyX; *) (* readonly attribute SVGAnimatedNumber baseFrequencyY; *) (* readonly attribute SVGAnimatedInteger numOctaves; *) (* readonly attribute SVGAnimatedNumber seed; *) (* readonly attribute SVGAnimatedEnumeration stitchTiles; *) (* readonly attribute SVGAnimatedEnumeration type; *) (* }; *) (* interface SVGCursorElement *) and cursorElement = object inherit element inherit uriReference inherit tests inherit externalResourcesRequired method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop end (* interface SVGAElement *) and aElement = object inherit element inherit uriReference inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method target : animatedString t readonly_prop end (* interface SVGViewElement *) and viewElement = object inherit element inherit externalResourcesRequired inherit fitToViewBox inherit zoomAndPan method viewTarget : stringList t readonly_prop end (* interface SVGScriptElement *) and scriptElement = object inherit element inherit uriReference inherit externalResourcesRequired method type_ : js_string t prop end (* interface SVGZoomEvent : UIEvent *) (* readonly attribute SVGRect zoomRectScreen; *) (* readonly attribute float previousScale; *) (* readonly attribute SVGPoint previousTranslate; *) (* readonly attribute float newScale; *) (* readonly attribute SVGPoint newTranslate; *) (* }; *) (* interface SVGAnimationElement *) and animationElement = object inherit element inherit tests inherit externalResourcesRequired (* inherit elementTimeControl *) method targetElement : element t readonly_prop method getStartTime : float meth method getCurrentTime : float meth method getSimpleDuration : float meth end (* interface SVGAnimateElement *) and animateElement = object inherit animationElement inherit stylable end (* interface SVGSetElement *) and setElement = animationElement (* interface SVGAnimateMotionElement *) and animateMotionElement = animationElement (* interface SVGMPathElement *) and mPathElement = object inherit element inherit uriReference inherit externalResourcesRequired end (* interface SVGAnimateColorElement *) and animateColorElement = object inherit animationElement inherit stylable end (* interface SVGAnimateTransformElement *) and animateTransformElement = animationElement (* interface SVGFontElement *) and fontElement = object inherit element inherit stylable end (* interface SVGGlyphElement *) (* interface SVGMissingGlyphElement*) and glyphElement = object inherit element inherit stylable end (* interface SVGHKernElement : SVGElement *) (* interface SVGVKernElement : SVGElement *) (* interface SVGFontFaceElement *) class type fontFaceElement = element (* interface SVGFontFaceSrcElement *) class type fontFaceSrcElement = element (* interface SVGFontFaceUriElement *) class type fontFaceUriElement = element (* interface SVGFontFaceFormatElement *) class type fontFaceFormatElement = element (* interface SVGFontFaceNameElement *) class type fontFaceNameElement = element (* interface SVGMetadataElement *) class type metadataElement = element (* interface SVGForeignObjectElement *) class type foreignObjectElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop end let createElement (doc : document t) name = doc##createElementNS xmlns (Js.string name) let unsafeCreateElement doc name = Js.Unsafe.coerce (createElement doc name) let createA doc : aElement t = unsafeCreateElement doc "a" let createAltGlyph doc : altGlyphElement t = unsafeCreateElement doc "altglyph" let createAltGlyphDef doc : altGlyphDefElement t = unsafeCreateElement doc "altglyphdef" let createAltGlyphItem doc : altGlyphItemElement t = unsafeCreateElement doc "altglyphitem" let createAnimate doc : animateElement t = unsafeCreateElement doc "animate" let createAnimateColor doc : animateColorElement t = unsafeCreateElement doc "animatecolor" let createAnimateMotion doc : animateMotionElement t = unsafeCreateElement doc "animatemotion" let createAnimateTransform doc : animateTransformElement t = unsafeCreateElement doc "animatetransform" let createCircle doc : circleElement t = unsafeCreateElement doc "circle" let createClipPath doc : clipPathElement t = unsafeCreateElement doc "clippath" (* let createColorProfile doc : colorProfile t = unsafeCreateElement doc "color-profile" *) let createCursor doc : cursorElement t = unsafeCreateElement doc "cursor" let createDefs doc : defsElement t = unsafeCreateElement doc "defs" let createDesc doc : descElement t = unsafeCreateElement doc "desc" let createEllipse doc : ellipseElement t = unsafeCreateElement doc "ellipse" (* let createFe* *) let createFilter doc : filterElement t = unsafeCreateElement doc "filter" let createFont doc : fontElement t = unsafeCreateElement doc "font" let createFontFace doc : fontElement t = unsafeCreateElement doc "font-face" let createFontFaceFormat doc : fontElement t = unsafeCreateElement doc "font-face-format" let createFontFaceName doc : fontElement t = unsafeCreateElement doc "font-face-name" let createFontFaceSrc doc : fontElement t = unsafeCreateElement doc "font-face-src" let createFontFaceUri doc : fontElement t = unsafeCreateElement doc "font-face-uri" let createForeignObject doc : foreignObjectElement t = unsafeCreateElement doc "foreignObject" let createG doc : gElement t = unsafeCreateElement doc "g" let createGlyph doc : glyphElement t = unsafeCreateElement doc "glyph" let createGlyphRef doc : glyphElement t = unsafeCreateElement doc "glyphref" let createhkern doc : element t = unsafeCreateElement doc "hkern" let createImage doc : imageElement t = unsafeCreateElement doc "image" let createLineElement doc : lineElement t = unsafeCreateElement doc "line" let createLinearElement doc : linearGradientElement t = unsafeCreateElement doc "lineargradient" (* let createMarker doc : markerElement *) let createMask doc : maskElement t = unsafeCreateElement doc "mask" let createMetaData doc : metadataElement t = unsafeCreateElement doc "metadata" let createMissingGlyph doc : glyphElement t = unsafeCreateElement doc "missing-glyph" let createMPath doc : mPathElement t = unsafeCreateElement doc "mpath" let createPath doc : pathElement t = unsafeCreateElement doc "path" let createPattern doc : patternElement t = unsafeCreateElement doc "pattern" let createPolygon doc : polygonElement t = unsafeCreateElement doc "polygon" let createPolyline doc : polyLineElement t = unsafeCreateElement doc "polyline" let createRadialgradient doc : radialGradientElement t = unsafeCreateElement doc "radialgradient" let createRect doc : rectElement t = unsafeCreateElement doc "rect" let createScript doc : scriptElement t = unsafeCreateElement doc "script" let createSet doc : setElement t = unsafeCreateElement doc "set" let createStop doc : stopElement t = unsafeCreateElement doc "stop" let createStyle doc : styleElement t = unsafeCreateElement doc "style" let createSvg doc : svgElement t = unsafeCreateElement doc "svg" let createSwitch doc : switchElement t = unsafeCreateElement doc "switch" let createSymbol doc : symbolElement t = unsafeCreateElement doc "symbol" let createTextElement doc : textElement t = unsafeCreateElement doc "text" let createTextpath doc : textPathElement t = unsafeCreateElement doc "textpath" let createTitle doc : titleElement t = unsafeCreateElement doc "title" let createTref doc : trefElement t = unsafeCreateElement doc "tref" let createTspan doc : tspanElement t = unsafeCreateElement doc "tspan" let createUse doc : useElement t = unsafeCreateElement doc "use" let createView doc : viewElement t = unsafeCreateElement doc "view" let createvkern doc : element t = unsafeCreateElement doc "vkern" (****) let svg_element : element t constr = Js.Unsafe.global##._SVGElement let document = Js.Unsafe.global##.document let getElementById id : element t = Js.Opt.case (Js.Unsafe.global##.document##getElementById (Js.string id)) (fun () -> raise Not_found) (fun e -> if Js.instanceof e svg_element then e else raise Not_found) module CoerceTo = struct let element (e : #Dom.node Js.t) : element Js.t Js.opt = if Js.instanceof e svg_element then Js.some (Js.Unsafe.coerce e) else Js.null let unsafeCoerce (e : #element t) tag = if e##.tagName##toLowerCase == Js.string tag then Js.some (Js.Unsafe.coerce e) else Js.null let a e : aElement t opt = unsafeCoerce e "a" let altGlyph e : altGlyphElement t opt = unsafeCoerce e "altglyph" let altGlyphDef e : altGlyphDefElement t opt = unsafeCoerce e "altglyphdef" let altGlyphItem e : altGlyphItemElement t opt = unsafeCoerce e "altglyphitem" let animate e : animateElement t opt = unsafeCoerce e "animate" let animateColor e : animateColorElement t opt = unsafeCoerce e "animatecolor" let animateMotion e : animateMotionElement t opt = unsafeCoerce e "animatemotion" let animateTransform e : animateTransformElement t opt = unsafeCoerce e "animatetransform" let circle e : circleElement t opt = unsafeCoerce e "circle" let clipPath e : clipPathElement t opt = unsafeCoerce e "clippath" (* let ColorProfile e : colorProfile t opt = unsafeCoerce e "color-profile" *) let cursor e : cursorElement t opt = unsafeCoerce e "cursor" let defs e : defsElement t opt = unsafeCoerce e "defs" let desc e : descElement t opt = unsafeCoerce e "desc" let ellipse e : ellipseElement t opt = unsafeCoerce e "ellipse" (* let Fe* *) let filter e : filterElement t opt = unsafeCoerce e "filter" let font e : fontElement t opt = unsafeCoerce e "font" let fontFace e : fontElement t opt = unsafeCoerce e "font-face" let fontFaceFormat e : fontElement t opt = unsafeCoerce e "font-face-format" let fontFaceName e : fontElement t opt = unsafeCoerce e "font-face-name" let fontFaceSrc e : fontElement t opt = unsafeCoerce e "font-face-src" let fontFaceUri e : fontElement t opt = unsafeCoerce e "font-face-uri" let foreignObject e : foreignObjectElement t opt = unsafeCoerce e "foreignobject" let g e : gElement t opt = unsafeCoerce e "g" let glyph e : glyphElement t opt = unsafeCoerce e "glyph" let glyphRef e : glyphElement t opt = unsafeCoerce e "glyphref" let hkern e : element t opt = unsafeCoerce e "hkern" let image e : imageElement t opt = unsafeCoerce e "image" let lineElement e : lineElement t opt = unsafeCoerce e "line" let linearElement e : linearGradientElement t opt = unsafeCoerce e "lineargradient" (* let Marker e : markerElement *) let mask e : maskElement t opt = unsafeCoerce e "mask" let metaData e : metadataElement t opt = unsafeCoerce e "metadata" let missingGlyph e : glyphElement t opt = unsafeCoerce e "missing-glyph" let mPath e : mPathElement t opt = unsafeCoerce e "mpath" let path e : pathElement t opt = unsafeCoerce e "path" let pattern e : patternElement t opt = unsafeCoerce e "pattern" let polygon e : polygonElement t opt = unsafeCoerce e "polygon" let polyline e : polyLineElement t opt = unsafeCoerce e "polyline" let radialgradient e : radialGradientElement t opt = unsafeCoerce e "radialgradient" let rect e : rectElement t opt = unsafeCoerce e "rect" let script e : scriptElement t opt = unsafeCoerce e "script" let set e : setElement t opt = unsafeCoerce e "set" let stop e : stopElement t opt = unsafeCoerce e "stop" let style e : styleElement t opt = unsafeCoerce e "style" let svg e : svgElement t opt = unsafeCoerce e "svg" let switch e : switchElement t opt = unsafeCoerce e "switch" let symbol e : symbolElement t opt = unsafeCoerce e "symbol" let textElement e : textElement t opt = unsafeCoerce e "text" let textpath e : textPathElement t opt = unsafeCoerce e "textpath" let title e : titleElement t opt = unsafeCoerce e "title" let tref e : trefElement t opt = unsafeCoerce e "tref" let tspan e : tspanElement t opt = unsafeCoerce e "tspan" let use e : useElement t opt = unsafeCoerce e "use" let view e : viewElement t opt = unsafeCoerce e "view" let vkern e : element t opt = unsafeCoerce e "vkern" end js_of_ocaml-3.5.2/lib/js_of_ocaml/dom_svg.mli000066400000000000000000001524061357507750000211770ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * Copyright (C) 2014 Jérôme Vouillon * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** DOM SVG binding This is a partial binding to the DOM SVG API. *) open Js val xmlns : js_string t (** {2 Types} *) type error_code = | WRONG_TYPE_ERR | INVALID_VALUE_ERR | MATRIX_NOT_INVERTABLE class type svg_error = object inherit Js.error method code : error_code t readonly_prop end exception SVGError of svg_error type lengthUnitType = | LENGTHTYPE_UNKNOWN | LENGTHTYPE_NUMBER | LENGTHTYPE_PERCENTAGE | LENGTHTYPE_EMS | LENGTHTYPE_EXS | LENGTHTYPE_PX | LENGTHTYPE_CM | LENGTHTYPE_MM | LENGTHTYPE_IN | LENGTHTYPE_PT | LENGTHTYPE_PC type angleUnitType = | ANGLETYPE_UNKNOWN | ANGLETYPE_UNSPECIFIED | ANGLETYPE_DEG | ANGLETYPE_RAD | ANGLETYPE_GRAD type colorType = | COLORTYPE_UNKNOWN | COLORTYPE_RGBCOLOR | COLORTYPE_RGBCOLOR_ICCCOLOR | COLORTYPE_CURRENTCOLOR type alignmentType = | PRESERVEASPECTRATIO_UNKNOWN | PRESERVEASPECTRATIO_NONE | PRESERVEASPECTRATIO_XMINYMIN | PRESERVEASPECTRATIO_XMIDYMIN | PRESERVEASPECTRATIO_XMAXYMIN | PRESERVEASPECTRATIO_XMINYMID | PRESERVEASPECTRATIO_XMIDYMID | PRESERVEASPECTRATIO_XMAXYMID | PRESERVEASPECTRATIO_XMINYMAX | PRESERVEASPECTRATIO_XMIDYMAX | PRESERVEASPECTRATIO_XMAXYMAX type meetOrSliceType = | MEETORSLICE_UNKNOWN | MEETORSLICE_MEET | MEETORSLICE_SLICE type transformType = | TRANSFORM_UNKNOWN | TRANSFORM_MATRIX | TRANSFORM_TRANSLATE | TRANSFORM_SCALE | TRANSFORM_ROTATE | TRANSFORM_SKEWX | TRANSFORM_SKEWY type zoomAndPanType = | ZOOMANDPAN_UNKNOWN | ZOOMANDPAN_DISABLE | ZOOMANDPAN_MAGNIFY type lengthAdjust = | LENGTHADJUST_UNKNOWN | LENGTHADJUST_SPACING | LENGTHADJUST_SPACINGANDGLYPHS type unitType = | UNIT_TYPE_UNKNOWN | UNIT_TYPE_USERSPACEONUSE | UNIT_TYPE_OBJECTBOUNDINGBOX (* interface SVGRenderingIntent *) type intentType = | RENDERING_INTENT_UNKNOWN | RENDERING_INTENT_AUTO | RENDERING_INTENT_PERCEPTUAL | RENDERING_INTENT_RELATIVE_COLORIMETRIC | RENDERING_INTENT_SATURATION | RENDERING_INTENT_ABSOLUTE_COLORIMETRIC (* Path Segment Types *) type pathSegmentType = | PATHSEG_UNKNOWN | PATHSEG_CLOSEPATH | PATHSEG_MOVETO_ABS | PATHSEG_MOVETO_REL | PATHSEG_LINETO_ABS | PATHSEG_LINETO_REL | PATHSEG_CURVETO_CUBIC_ABS | PATHSEG_CURVETO_CUBIC_REL | PATHSEG_CURVETO_QUADRATIC_ABS | PATHSEG_CURVETO_QUADRATIC_REL | PATHSEG_ARC_ABS | PATHSEG_ARC_REL | PATHSEG_LINETO_HORIZONTAL_ABS | PATHSEG_LINETO_HORIZONTAL_REL | PATHSEG_LINETO_VERTICAL_ABS | PATHSEG_LINETO_VERTICAL_REL | PATHSEG_CURVETO_CUBIC_SMOOTH_ABS | PATHSEG_CURVETO_CUBIC_SMOOTH_REL | PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS | PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL (* textPath Method Types *) type textPathMethodType = | TEXTPATH_METHODTYPE_UNKNOWN | TEXTPATH_METHODTYPE_ALIGN | TEXTPATH_METHODTYPE_STRETCH (* textPath Spacing Types *) type textPathSpacingType = | TEXTPATH_SPACINGTYPE_UNKNOWN | TEXTPATH_SPACINGTYPE_AUTO | TEXTPATH_SPACINGTYPE_EXACT (* Spread Method Types *) type spreadMethodType = | SPREADMETHOD_UNKNOWN | SPREADMETHOD_PAD | SPREADMETHOD_REFLECT | SPREADMETHOD_REPEAT type suspendHandleID (****) class type ['a] animated = object method baseVal : 'a prop method animVal : 'a prop end class type ['a] list = object method numberOfItems : int readonly_prop method clear : unit meth method initialize : 'a -> 'a meth method getItem : int -> 'a meth method insertItemBefore : 'a -> int -> 'a meth method replaceItem : 'a -> int -> 'a meth method removeItem : int -> 'a meth method appendItem : 'a -> 'a meth end (****) (** {2 Elements } *) (* interface SVGElement *) class type element = object inherit Dom.element method id : js_string t prop method xmlbase : js_string t prop method ownerSVGElement : svgElement t readonly_prop method viewportElement : element t readonly_prop end (* interface SVGAnimatedString *) and animatedString = [js_string t] animated (* interface SVGAnimatedBoolean *) and animatedBoolean = [bool t] animated (* interface SVGStringList *) and stringList = [js_string t] list (* interface SVGAnimatedEnumeration *) and animatedEnumeration = [int (*short*)] animated (* interface SVGAnimatedInteger *) and animatedInteger = [int] animated (* interface SVGAnimatedNumber *) and animatedNumber = [float] animated (* interface SVGNumberList *) and numberList = [number t] list (* interface SVGAnimatedNumberList *) and animatedNumberList = [numberList t] animated (* interface SVGLength *) and length = object method unitType : lengthUnitType readonly_prop method value : float prop method valueInSpecifiedUnits : float prop method valueAsString : js_string t prop method newValueSpecifiedUnits : lengthUnitType -> float -> unit meth method convertToSpecifiedUnits : lengthUnitType -> unit meth end (* interface SVGAnimatedLength *) and animatedLength = [length t] animated (* interface SVGLengthList *) and lengthList = [length t] list (* interface SVGAnimatedLengthList *) and animatedLengthList = [lengthList t] animated (* interface SVGAngle *) and angle = object method unitType : angleUnitType readonly_prop method value : float prop method valueInSpecifiedUnits : float prop method valueAsString : js_string t prop method newValueSpecifiedUnits : angleUnitType -> float -> unit meth method convertToSpecifiedUnits : angleUnitType -> unit meth end (* interface SVGAnimatedAngle *) and animatedAngle = [angle t] animated (* XXXXX Move it *) and rgbColor = object end (* interface SVGColor *) and color = object (* XXX inherit cssValue *) method colorType : colorType readonly_prop method rgbColor : rgbColor t readonly_prop method iccColor : iccColor t readonly_prop method setRGBColor : js_string t -> unit meth method setRGBColorICCColor : js_string t -> js_string t -> unit meth method setColor : colorType -> js_string t -> js_string t -> unit meth end (* interface SVGICCColor *) and iccColor = object method colorProfile : js_string t prop method colors : numberList t readonly_prop end (* interface SVGRect *) and rect = object method x : float prop method y : float prop method width : float prop method height : float prop end (* interface SVGAnimatedRect *) and animatedRect = [rect t] animated (* interface SVGStylable *) and stylable = object method className : animatedString t readonly_prop method style : Dom_html.cssStyleDeclaration t readonly_prop (* CSSValue getPresentationAttribute(in DOMString name); *) end (* interface SVGLocatable *) and locatable = object method nearestViewportElement : element t readonly_prop method farthestViewportElement : element t readonly_prop method getBBox : rect t meth method getCTM : matrix t meth method getScreenCTM : matrix t meth method getTransformToElement : element t -> matrix t meth end (* interface SVGTransformable *) and transformable = object inherit locatable method transform : animatedTransformList t readonly_prop end (* interface SVGTests *) and tests = object method requiredFeatures : stringList t readonly_prop method requiredExtensions : stringList t readonly_prop method systemLanguage : stringList t readonly_prop method hasExtension : js_string t -> bool t meth end (* interface SVGLangSpace *) and langSpace = object method xmllang : js_string t prop method xmlspace : js_string t prop end (* interface SVGExternalResourcesRequired *) and externalResourcesRequired = object method externalResourcesRequired : animatedBoolean t readonly_prop end (* interface SVGFitToViewBox *) and fitToViewBox = object method viewBox : animatedRect t readonly_prop method preserveAspectRatio : animatedPreserveAspectRatio t readonly_prop end (* interface SVGZoomAndPan *) and zoomAndPan = object method zoomAndPan : zoomAndPanType prop end (* interface SVGViewSpec *) and viewSpec = object inherit zoomAndPan inherit fitToViewBox method transform : transformList t readonly_prop method viewTarget : element t readonly_prop method viewBoxString : js_string t readonly_prop method preserveAspectRatioString : js_string t readonly_prop method transformString : js_string t readonly_prop method viewTargetString : js_string t readonly_prop end (* interface SVGURIReference *) and uriReference = object method href : animatedString t readonly_prop end (* interface SVGCSSRule : CSSRule *) (* const unsigned short COLOR_PROFILE_RULE = 7; *) (* }; *) (* interface SVGDocument *) and document = object inherit [element] Dom.document (*XXX inherit documentEvent *) method title : js_string t prop method referrer : js_string t readonly_prop method domain : js_string t prop method _URL : js_string t readonly_prop method rootElement : svgElement t opt readonly_prop end (* interface SVGSVGElement *) and svgElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit locatable inherit fitToViewBox inherit zoomAndPan (*XXX inherit documentevent, viewcss, documentcss *) method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop method contentScriptType : js_string t prop method contentStyleType : js_string t prop method viewport : rect t readonly_prop method pixelUnitToMillimeterX : float readonly_prop method pixelUnitToMillimeterY : float readonly_prop method screenPixelUnitToMillimeterX : float readonly_prop method screenPixelUnitToMillimeterY : float readonly_prop method useCurrentView : bool t readonly_prop method currentView : viewSpec t readonly_prop method currentScale : float prop method currentTranslate : point t readonly_prop method suspendRedraw : int -> suspendHandleID meth method unsuspendRedraw : suspendHandleID -> unit meth method unsuspendRedrawAll : unit meth method forceRedraw : unit meth method pauseAnimations : unit meth method unpauseAnimations : unit meth method animationsPaused : bool t meth method getCurrentTime : float meth method setCurrentTime : int -> unit meth method getIntersectionList : rect t -> element t -> element Dom.nodeList t meth method getEnclosureList : rect t -> element t -> element Dom.nodeList t meth method checkIntersection : element t -> rect t -> bool t method checkEnclosure : element t -> rect t -> bool t method deselectAll : unit meth method createSVGNumber : number t meth method createSVGLength : length t meth method createSVGAngle : angle t meth method createSVGPoint : point t meth method createSVGMatrix : matrix t meth method createSVGRect : rect t meth method createSVGTransform : transform t meth method createSVGTransformFromMatrix : matrix t -> transform t meth method getElementById : js_string t -> Dom.element t meth end (* interface SVGGElement *) and gElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit Dom_html.eventTarget end (* interface SVGDefsElement *) and defsElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable (* XXXXXXX ? inherit Dom_html.eventTarget *) end (* interface SVGDescElement *) and descElement = object inherit element inherit langSpace inherit stylable (* XXXXXXX ? inherit Dom_html.eventTarget *) end (* interface SVGTitleElement *) and titleElement = object inherit element inherit langSpace inherit stylable end (* interface SVGSymbolElement *) and symbolElement = object inherit element inherit langSpace inherit externalResourcesRequired inherit stylable inherit fitToViewBox inherit Dom_html.eventTarget end (* interface SVGUseElement *) and useElement = object inherit element inherit uriReference inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop method instanceRoot : elementInstance t readonly_prop method animatedInstanceRoot : elementInstance t readonly_prop end and elementInstance = object inherit Dom_html.eventTarget method correspondingElement : element t readonly_prop method correspondingUseElement : useElement t readonly_prop method parentNode : elementInstance t readonly_prop method childNodes : elementInstanceList t readonly_prop method firstChild : elementInstance t readonly_prop method lastChild : elementInstance t readonly_prop method previousSibling : elementInstance t readonly_prop method nextSibling : elementInstance t readonly_prop end (* interface SVGElementInstanceList *) and elementInstanceList = object method length : int readonly_prop method item : int -> elementInstance t end (* interface SVGImageElement *) and imageElement = object inherit element inherit uriReference inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop (* readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio *) end and switchElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable end (* XXX deprecated => interface GetSVGDocument => SVGDocument getSVGDocument() *) (* interface SVGStyleElement *) and styleElement = object inherit element inherit langSpace method type_ : js_string t prop method media : js_string t prop method title : js_string t prop end (* interface SVGPoint *) and point = object method x : float readonly_prop method y : float readonly_prop method matrixTransform : matrix t -> point t meth end (* interface SVGPointList *) and pointList = [point t] list (* interface SVGMatrix *) and matrix = object method a : float readonly_prop method b : float readonly_prop method c : float readonly_prop method d : float readonly_prop method e : float readonly_prop method f : float readonly_prop method multiply : matrix t -> matrix t meth method inverse : matrix t meth method translate : float -> float -> matrix t meth method scale : float -> matrix t meth method scaleNonUniform : float -> float -> matrix t meth method rotate : float -> matrix t meth method rotateFromVector : float -> float -> matrix t meth method flipX : matrix t meth method flipY : matrix t meth method skewX : float -> matrix t meth method skewY : float -> matrix t meth end (* interface SVGTransform *) and transform = object method _type : transformType readonly_prop method matrix : matrix t readonly_prop method angle : float readonly_prop method setMatrix : matrix t -> unit meth method setTranslate : float -> float -> unit meth method setScale : float -> float -> unit meth method setRotate : float -> float -> float -> unit meth method setSkewX : float -> unit meth method setSkewY : float -> unit meth end (* interface SVGTransformList *) and transformList = object inherit [transform t] list method createSVGTransformFromMatrix : matrix -> transform t meth method consolidate : transform t meth end (* interface SVGAnimatedTransformList *) and animatedTransformList = [transformList t] animated (* interface SVGPreserveAspectRatio *) and preserveAspectRatio = object method align : alignmentType readonly_prop method meetOrSlice : meetOrSliceType readonly_prop end (* interface SVGAnimatedPreserveAspectRatio *) and animatedPreserveAspectRatio = [preserveAspectRatio t] animated (* interface SVGPathSeg *) and pathSeg = object method pathSegType : pathSegmentType readonly_prop method pathSegTypeAsLetter : js_string t readonly_prop end (* interface SVGPathSegClosePath *) and pathSegClosePath = pathSeg (* interface SVGPathSegMovetoAbs *) (* interface SVGPathSegMovetoRel *) and pathSegMoveto = object inherit pathSeg method x : float prop method y : float prop end (* interface SVGPathSegLinetoAbs *) (* interface SVGPathSegLinetoRel *) and pathSegLineto = object inherit pathSeg method x : float prop method y : float prop end (* interface SVGPathSegCurvetoCubicAbs *) (* interface SVGPathSegCurvetoCubicRel *) and pathSegCurvetoCubic = object inherit pathSeg method x : float prop method y : float prop method x1 : float prop method y1 : float prop method x2 : float prop method y2 : float prop end (* interface SVGPathSegCurvetoQuadraticAbs *) (* interface SVGPathSegCurvetoQuadraticRel *) and pathSegCurvetoQuadratic = object inherit pathSeg method x : float prop method y : float prop method x1 : float prop method y1 : float prop end (* interface SVGPathSegArcAbs *) (* interface SVGPathSegArcRel*) and pathSegArc = object inherit pathSeg method y : float prop method r1 : float prop method r2 : float prop method angle : float prop method largeArcFlag : bool t prop method sweepFlag : bool t prop end (* interface SVGPathSegLinetoHorizontalAbs *) (* interface SVGPathSegLinetoHorizontalRel *) and pathSegLinetoHorizontal = object inherit pathSeg method x : float end (* interface SVGPathSegLinetoVerticalAbs *) (* interface SVGPathSegLinetoVerticalRel *) and pathSegLinetoVertical = object inherit pathSeg method y : float end and pathSegCurvetoCubicSmooth = object inherit pathSeg method x : float method y : float method x2 : float method y2 : float end (* interface SVGPathSegCurvetoQuadraticSmoothAbs *) (* interface SVGPathSegCurvetoQuadraticSmoothRel *) and pathSegCurvetoQuadraticSmooth = object inherit pathSeg method x : float method y : float end and pathSegList = [pathSeg t] list (* interface SVGAnimatedPathData *) and animatedPathData = object method pathSegList : pathSegList t prop method normalizedPathSegList : pathSegList t prop method animatedPathSegList : pathSegList t prop method animatedNormalizedPathSegList : pathSegList t prop end (* interface SVGPathElement *) and pathElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit animatedPathData method pathLength : animatedNumber t readonly_prop method getTotalLength : float meth method getPointAtLength : float -> point t meth method getPathSegAtLength : float -> int method createSVGPathSegClosePath : pathSegClosePath meth method createSVGPathSegMovetoAbs : float -> float -> pathSegMoveto meth method createSVGPathSegMovetoRel : float -> float -> pathSegMoveto meth method createSVGPathSegLinetoAbs : float -> float -> pathSegLineto meth method createSVGPathSegLinetoRel : float -> float -> pathSegLineto meth method createSVGPathSegCurvetoCubicAbs : float -> float -> float -> float -> float -> float -> pathSegCurvetoCubic meth method createSVGPathSegCurvetoCubicRel : float -> float -> float -> float -> float -> float -> pathSegCurvetoCubic meth method createSVGPathSegCurvetoQuadraticAbs : float -> float -> float -> float -> pathSegCurvetoQuadratic meth method createSVGPathSegCurvetoQuadraticRel : float -> float -> float -> float -> pathSegCurvetoQuadratic meth method createSVGPathSegArcAbs : float -> float -> float -> float -> float -> bool t -> bool t -> pathSegArc meth method createSVGPathSegArcRel : float -> float -> float -> float -> float -> bool t -> bool t -> pathSegArc meth method createSVGPathSegLinetoHorizontalAbs : float -> pathSegLinetoHorizontal meth method createSVGPathSegLinetoHorizontalRel : float -> pathSegLinetoHorizontal meth method createSVGPathSegLinetoVerticalAbs : float -> pathSegLinetoVertical meth method createSVGPathSegLinetoVerticalRel : float -> pathSegLinetoVertical meth method createSVGPathSegCurvetoCubicSmoothAbs : float -> float -> float -> float -> pathSegCurvetoCubicSmooth meth method createSVGPathSegCurvetoCubicSmoothRel : float -> float -> float -> float -> pathSegCurvetoCubicSmooth meth method createSVGPathSegCurvetoQuadraticSmoothAbs : float -> float -> pathSegCurvetoQuadraticSmooth meth method createSVGPathSegCurvetoQuadraticSmoothRel : float -> float -> pathSegCurvetoQuadraticSmooth meth end (* interface SVGRectElement *) and rectElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop method rx : animatedLength t readonly_prop method ry : animatedLength t readonly_prop end (* interface SVGCircleElement *) and circleElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method cx : animatedLength t readonly_prop method cy : animatedLength t readonly_prop method r : animatedLength t readonly_prop end (* interface SVGEllipseElement *) and ellipseElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method cx : animatedLength t readonly_prop method cy : animatedLength t readonly_prop method rx : animatedLength t readonly_prop method ry : animatedLength t readonly_prop end (* interface SVGLineElement *) class type lineElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit Dom_html.eventTarget method x1 : animatedLength t readonly_prop method y1 : animatedLength t readonly_prop method x2 : animatedLength t readonly_prop method y2 : animatedLength t readonly_prop end (* interface SVGAnimatedPoints *) and animatedPoints = object method points : pointList t readonly_prop method animatedpoints : pointList t readonly_prop end (* interface SVGPolylineElement *) and polyLineElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit animatedPoints end (* interface SVGPolygonElement *) and polygonElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable inherit animatedPoints end (* interface SVGTextContentElement *) and textContentElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit Dom_html.eventTarget method textLength : animatedLength t readonly_prop method lengthAdjust : lengthAdjust animated t readonly_prop method getNumberOfChars : int meth method getComputedTextLength : float meth method getSubStringLength : int -> int -> float meth method getStartPositionOfChar : int -> point t meth method getEndPositionOfChar : int -> point t meth method getExtentOfChar : int -> rect t meth method getRotationOfChar : int -> float meth method getCharNumAtPosition : point -> int meth method selectSubString : int -> int -> unit meth end (* interface SVGTextPositioningElement *) and textPositioningElement = object inherit textContentElement method x : animatedLengthList t readonly_prop method y : animatedLengthList t readonly_prop method dx : animatedLengthList t readonly_prop method dy : animatedLengthList t readonly_prop method rotate : animatedNumberList t readonly_prop end (* interface SVGTextElement *) and textElement = object inherit textPositioningElement inherit transformable end and tspanElement = textPositioningElement and trefElement = object inherit textPositioningElement inherit uriReference end (* interface SVGTextPathElement *) and textPathElementMethod = [textPathMethodType] animated and textPathElementSpacing = [textPathSpacingType] animated and textPathElement = object inherit textContentElement inherit uriReference method startOffset : animatedLength t readonly_prop method method_ : textPathElementMethod readonly_prop method spacing : textPathElementSpacing readonly_prop end (* interface SVGAltGlyphElement *) and altGlyphElement = object inherit textPositioningElement inherit uriReference method glyphRef : js_string t prop method format : js_string t prop end (* interface SVGAltGlyphDefElement *) and altGlyphDefElement = element (* interface SVGAltGlyphItemElement *) and altGlyphItemElement = element (* interface SVGGlyphRefElement *) and glyphRefElement = object inherit element inherit uriReference inherit stylable method glyphRef : js_string t prop method format : js_string t prop method x : float prop method y : float prop method dx : float prop method dy : float prop end (* interface SVGPaint : SVGColor { *) (* // Paint Types *) (* const unsigned short SVG_PAINTTYPE_UNKNOWN = 0; *) (* const unsigned short SVG_PAINTTYPE_RGBCOLOR = 1; *) (* const unsigned short SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2; *) (* const unsigned short SVG_PAINTTYPE_NONE = 101; *) (* const unsigned short SVG_PAINTTYPE_CURRENTCOLOR = 102; *) (* const unsigned short SVG_PAINTTYPE_URI_NONE = 103; *) (* const unsigned short SVG_PAINTTYPE_URI_CURRENTCOLOR = 104; *) (* const unsigned short SVG_PAINTTYPE_URI_RGBCOLOR = 105; *) (* const unsigned short SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106; *) (* const unsigned short SVG_PAINTTYPE_URI = 107; *) (* readonly attribute unsigned short paintType; *) (* readonly attribute DOMString uri; *) (* void setUri(in DOMString uri); *) (* void setPaint(in unsigned short paintType, in DOMString uri, in DOMString rgbColor, in DOMString iccColor) raises(SVGException); *) (* }; *) (* interface SVGMarkerElement : SVGElement, *) (* SVGLangSpace, *) (* SVGExternalResourcesRequired, *) (* SVGStylable, *) (* SVGFitToViewBox { *) (* // Marker Unit Types *) (* const unsigned short SVG_MARKERUNITS_UNKNOWN = 0; *) (* const unsigned short SVG_MARKERUNITS_USERSPACEONUSE = 1; *) (* const unsigned short SVG_MARKERUNITS_STROKEWIDTH = 2; *) (* // Marker Orientation Types *) (* const unsigned short SVG_MARKER_ORIENT_UNKNOWN = 0; *) (* const unsigned short SVG_MARKER_ORIENT_AUTO = 1; *) (* const unsigned short SVG_MARKER_ORIENT_ANGLE = 2; *) (* readonly attribute SVGAnimatedLength refX; *) (* readonly attribute SVGAnimatedLength refY; *) (* readonly attribute SVGAnimatedEnumeration markerUnits; *) (* readonly attribute SVGAnimatedLength markerWidth; *) (* readonly attribute SVGAnimatedLength markerHeight; *) (* readonly attribute SVGAnimatedEnumeration orientType; *) (* readonly attribute SVGAnimatedAngle orientAngle; *) (* void setOrientToAuto() raises(DOMException); *) (* void setOrientToAngle(in SVGAngle angle) raises(DOMException); *) (* }; *) (* interface SVGColorProfileElement : SVGElement, *) (* SVGURIReference, *) (* SVGRenderingIntent { *) (* attribute DOMString local; *) (* attribute DOMString name; *) (* attribute unsigned short renderingIntent; *) (* }; *) (* interface SVGColorProfileRule : SVGCSSRule, *) (* SVGRenderingIntent { *) (* attribute DOMString src setraises(DOMException); *) (* attribute DOMString name setraises(DOMException); *) (* attribute unsigned short renderingIntent setraises(DOMException); *) (* }; *) (* interface SVGGradientElement *) and animatedSpreadMethod = [spreadMethodType] animated and gradientElement = object inherit element inherit uriReference inherit stylable (* readonly attribute SVGAnimatedEnumeration gradientUnits; *) method gradientTransform : animatedTransformList t readonly_prop method spreadMethod : animatedSpreadMethod t readonly_prop end (* interface SVGLinearGradientElement *) and linearGradientElement = object inherit gradientElement method x1 : animatedLength t readonly_prop method y1 : animatedLength t readonly_prop method x2 : animatedLength t readonly_prop method y2 : animatedLength t readonly_prop end (* interface SVGRadialGradientElement *) and radialGradientElement = object inherit gradientElement method cx : animatedLength t readonly_prop method cy : animatedLength t readonly_prop method r : animatedLength t readonly_prop method fx : animatedLength t readonly_prop method fy : animatedLength t readonly_prop end (* interface SVGStopElement *) and stopElement = object inherit element inherit stylable method offset : animatedNumber t readonly_prop end (* interface SVGPatternElement *) and patternElement = object inherit element inherit uriReference inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit fitToViewBox (* readonly attribute SVGAnimatedEnumeration patternUnits; *) (* readonly attribute SVGAnimatedEnumeration patternContentUnits; *) method patternTransform : animatedTransformList t readonly_prop method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop end (* interface SVGClipPathElement *) and clipPathElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable (* readonly attribute SVGAnimatedEnumeration clipPathUnits; *) end (* interface SVGMaskElement *) and maskElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable (* readonly attribute SVGAnimatedEnumeration maskUnits; *) (* readonly attribute SVGAnimatedEnumeration maskContentUnits; *) method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop end (* interface SVGFilterElement *) and filterElement = object inherit element inherit uriReference inherit langSpace inherit externalResourcesRequired inherit stylable (* readonly attribute SVGAnimatedEnumeration filterUnits; *) (* readonly attribute SVGAnimatedEnumeration primitiveUnits; *) method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop method filterResX : animatedInteger t readonly_prop method filterResY : animatedInteger t readonly_prop method setFilterRes : int -> int -> unit meth end (* interface SVGFilterPrimitiveStandardAttributes : SVGStylable { *) (* readonly attribute SVGAnimatedLength x; *) (* readonly attribute SVGAnimatedLength y; *) (* readonly attribute SVGAnimatedLength width; *) (* readonly attribute SVGAnimatedLength height; *) (* readonly attribute SVGAnimatedString result; *) (* }; *) (* interface SVGFEBlendElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Blend Mode Types *) (* const unsigned short SVG_FEBLEND_MODE_UNKNOWN = 0; *) (* const unsigned short SVG_FEBLEND_MODE_NORMAL = 1; *) (* const unsigned short SVG_FEBLEND_MODE_MULTIPLY = 2; *) (* const unsigned short SVG_FEBLEND_MODE_SCREEN = 3; *) (* const unsigned short SVG_FEBLEND_MODE_DARKEN = 4; *) (* const unsigned short SVG_FEBLEND_MODE_LIGHTEN = 5; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedString in2; *) (* readonly attribute SVGAnimatedEnumeration mode; *) (* }; *) (* interface SVGFEColorMatrixElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Color Matrix Types *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0; *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_MATRIX = 1; *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_SATURATE = 2; *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_HUEROTATE = 3; *) (* const unsigned short SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedEnumeration type; *) (* readonly attribute SVGAnimatedNumberList values; *) (* }; *) (* interface SVGFEComponentTransferElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* }; *) (* interface SVGComponentTransferFunctionElement : SVGElement { *) (* // Component Transfer Types *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4; *) (* const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5; *) (* readonly attribute SVGAnimatedEnumeration type; *) (* readonly attribute SVGAnimatedNumberList tableValues; *) (* readonly attribute SVGAnimatedNumber slope; *) (* readonly attribute SVGAnimatedNumber intercept; *) (* readonly attribute SVGAnimatedNumber amplitude; *) (* readonly attribute SVGAnimatedNumber exponent; *) (* readonly attribute SVGAnimatedNumber offset; *) (* }; *) (* interface SVGFEFuncRElement : SVGComponentTransferFunctionElement { *) (* }; *) (* interface SVGFEFuncGElement : SVGComponentTransferFunctionElement { *) (* }; *) (* interface SVGFEFuncBElement : SVGComponentTransferFunctionElement { *) (* }; *) (* interface SVGFEFuncAElement : SVGComponentTransferFunctionElement { *) (* }; *) (* interface SVGFECompositeElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Composite Operators *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_OVER = 1; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_IN = 2; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_OUT = 3; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_ATOP = 4; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_XOR = 5; *) (* const unsigned short SVG_FECOMPOSITE_OPERATOR_ARITHMETIC = 6; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedString in2; *) (* readonly attribute SVGAnimatedEnumeration operator; *) (* readonly attribute SVGAnimatedNumber k1; *) (* readonly attribute SVGAnimatedNumber k2; *) (* readonly attribute SVGAnimatedNumber k3; *) (* readonly attribute SVGAnimatedNumber k4; *) (* }; *) (* interface SVGFEConvolveMatrixElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Edge Mode Values *) (* const unsigned short SVG_EDGEMODE_UNKNOWN = 0; *) (* const unsigned short SVG_EDGEMODE_DUPLICATE = 1; *) (* const unsigned short SVG_EDGEMODE_WRAP = 2; *) (* const unsigned short SVG_EDGEMODE_NONE = 3; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedInteger orderX; *) (* readonly attribute SVGAnimatedInteger orderY; *) (* readonly attribute SVGAnimatedNumberList kernelMatrix; *) (* readonly attribute SVGAnimatedNumber divisor; *) (* readonly attribute SVGAnimatedNumber bias; *) (* readonly attribute SVGAnimatedInteger targetX; *) (* readonly attribute SVGAnimatedInteger targetY; *) (* readonly attribute SVGAnimatedEnumeration edgeMode; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthX; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthY; *) (* readonly attribute SVGAnimatedBoolean preserveAlpha; *) (* }; *) (* interface SVGFEDiffuseLightingElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedNumber surfaceScale; *) (* readonly attribute SVGAnimatedNumber diffuseConstant; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthX; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthY; *) (* }; *) (* interface SVGFEDistantLightElement : SVGElement { *) (* readonly attribute SVGAnimatedNumber azimuth; *) (* readonly attribute SVGAnimatedNumber elevation; *) (* }; *) (* interface SVGFEPointLightElement : SVGElement { *) (* readonly attribute SVGAnimatedNumber x; *) (* readonly attribute SVGAnimatedNumber y; *) (* readonly attribute SVGAnimatedNumber z; *) (* }; *) (* interface SVGFESpotLightElement : SVGElement { *) (* readonly attribute SVGAnimatedNumber x; *) (* readonly attribute SVGAnimatedNumber y; *) (* readonly attribute SVGAnimatedNumber z; *) (* readonly attribute SVGAnimatedNumber pointsAtX; *) (* readonly attribute SVGAnimatedNumber pointsAtY; *) (* readonly attribute SVGAnimatedNumber pointsAtZ; *) (* readonly attribute SVGAnimatedNumber specularExponent; *) (* readonly attribute SVGAnimatedNumber limitingConeAngle; *) (* }; *) (* interface SVGFEDisplacementMapElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Channel Selectors *) (* const unsigned short SVG_CHANNEL_UNKNOWN = 0; *) (* const unsigned short SVG_CHANNEL_R = 1; *) (* const unsigned short SVG_CHANNEL_G = 2; *) (* const unsigned short SVG_CHANNEL_B = 3; *) (* const unsigned short SVG_CHANNEL_A = 4; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedString in2; *) (* readonly attribute SVGAnimatedNumber scale; *) (* readonly attribute SVGAnimatedEnumeration xChannelSelector; *) (* readonly attribute SVGAnimatedEnumeration yChannelSelector; *) (* }; *) (* interface SVGFEFloodElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* }; *) (* interface SVGFEGaussianBlurElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedNumber stdDeviationX; *) (* readonly attribute SVGAnimatedNumber stdDeviationY; *) (* void setStdDeviation(in float stdDeviationX, in float stdDeviationY) raises(DOMException); *) (* }; *) (* interface SVGFEImageElement : SVGElement, *) (* SVGURIReference, *) (* SVGLangSpace, *) (* SVGExternalResourcesRequired, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; *) (* }; *) (* interface SVGFEMergeElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* }; *) (* interface SVGFEMergeNodeElement : SVGElement { *) (* readonly attribute SVGAnimatedString in1; *) (* }; *) (* interface SVGFEMorphologyElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Morphology Operators *) (* const unsigned short SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0; *) (* const unsigned short SVG_MORPHOLOGY_OPERATOR_ERODE = 1; *) (* const unsigned short SVG_MORPHOLOGY_OPERATOR_DILATE = 2; *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedEnumeration operator; *) (* readonly attribute SVGAnimatedNumber radiusX; *) (* readonly attribute SVGAnimatedNumber radiusY; *) (* }; *) (* interface SVGFEOffsetElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedNumber dx; *) (* readonly attribute SVGAnimatedNumber dy; *) (* }; *) (* interface SVGFESpecularLightingElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* readonly attribute SVGAnimatedNumber surfaceScale; *) (* readonly attribute SVGAnimatedNumber specularConstant; *) (* readonly attribute SVGAnimatedNumber specularExponent; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthX; *) (* readonly attribute SVGAnimatedNumber kernelUnitLengthY; *) (* }; *) (* interface SVGFETileElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* readonly attribute SVGAnimatedString in1; *) (* }; *) (* interface SVGFETurbulenceElement : SVGElement, *) (* SVGFilterPrimitiveStandardAttributes { *) (* // Turbulence Types *) (* const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0; *) (* const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1; *) (* const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE = 2; *) (* // Stitch Options *) (* const unsigned short SVG_STITCHTYPE_UNKNOWN = 0; *) (* const unsigned short SVG_STITCHTYPE_STITCH = 1; *) (* const unsigned short SVG_STITCHTYPE_NOSTITCH = 2; *) (* readonly attribute SVGAnimatedNumber baseFrequencyX; *) (* readonly attribute SVGAnimatedNumber baseFrequencyY; *) (* readonly attribute SVGAnimatedInteger numOctaves; *) (* readonly attribute SVGAnimatedNumber seed; *) (* readonly attribute SVGAnimatedEnumeration stitchTiles; *) (* readonly attribute SVGAnimatedEnumeration type; *) (* }; *) (* interface SVGCursorElement *) and cursorElement = object inherit element inherit uriReference inherit tests inherit externalResourcesRequired method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop end (* interface SVGAElement *) and aElement = object inherit element inherit uriReference inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method target : animatedString t readonly_prop end (* interface SVGViewElement *) and viewElement = object inherit element inherit externalResourcesRequired inherit fitToViewBox inherit zoomAndPan method viewTarget : stringList t readonly_prop end (* interface SVGScriptElement *) and scriptElement = object inherit element inherit uriReference inherit externalResourcesRequired method type_ : js_string t prop end (* interface SVGZoomEvent : UIEvent *) (* readonly attribute SVGRect zoomRectScreen; *) (* readonly attribute float previousScale; *) (* readonly attribute SVGPoint previousTranslate; *) (* readonly attribute float newScale; *) (* readonly attribute SVGPoint newTranslate; *) (* }; *) (* interface SVGAnimationElement *) and animationElement = object inherit element inherit tests inherit externalResourcesRequired (* inherit elementTimeControl *) method targetElement : element t readonly_prop method getStartTime : float meth method getCurrentTime : float meth method getSimpleDuration : float meth end (* interface SVGAnimateElement *) and animateElement = object inherit animationElement inherit stylable end (* interface SVGSetElement *) and setElement = animationElement (* interface SVGAnimateMotionElement *) and animateMotionElement = animationElement (* interface SVGMPathElement *) and mPathElement = object inherit element inherit uriReference inherit externalResourcesRequired end (* interface SVGAnimateColorElement *) and animateColorElement = object inherit animationElement inherit stylable end (* interface SVGAnimateTransformElement *) and animateTransformElement = animationElement (* interface SVGFontElement *) and fontElement = object inherit element inherit stylable end (* interface SVGGlyphElement *) (* interface SVGMissingGlyphElement*) and glyphElement = object inherit element inherit stylable end (* interface SVGHKernElement : SVGElement *) (* interface SVGVKernElement : SVGElement *) (* interface SVGFontFaceElement *) class type fontFaceElement = element (* interface SVGFontFaceSrcElement *) class type fontFaceSrcElement = element (* interface SVGFontFaceUriElement *) class type fontFaceUriElement = element (* interface SVGFontFaceFormatElement *) class type fontFaceFormatElement = element (* interface SVGFontFaceNameElement *) class type fontFaceNameElement = element (* interface SVGMetadataElement *) class type metadataElement = element (* interface SVGForeignObjectElement *) class type foreignObjectElement = object inherit element inherit tests inherit langSpace inherit externalResourcesRequired inherit stylable inherit transformable method x : animatedLength t readonly_prop method y : animatedLength t readonly_prop method width : animatedLength t readonly_prop method height : animatedLength t readonly_prop end (** {2 Helper functions for creating Svg elements} *) val createElement : document t -> string -> element t val createA : document t -> aElement t val createAltGlyph : document t -> altGlyphElement t val createAltGlyphDef : document t -> altGlyphDefElement t val createAltGlyphItem : document t -> altGlyphItemElement t val createAnimate : document t -> animateElement t val createAnimateColor : document t -> animateColorElement t val createAnimateMotion : document t -> animateMotionElement t val createAnimateTransform : document t -> animateTransformElement t val createCircle : document t -> circleElement t val createClipPath : document t -> clipPathElement t (* val createColorProfile : document t -> colorProfile t *) val createCursor : document t -> cursorElement t val createDefs : document t -> defsElement t val createDesc : document t -> descElement t val createEllipse : document t -> ellipseElement t (* val createFe* *) val createFilter : document t -> filterElement t val createFont : document t -> fontElement t val createFontFace : document t -> fontElement t val createFontFaceFormat : document t -> fontElement t val createFontFaceName : document t -> fontElement t val createFontFaceSrc : document t -> fontElement t val createFontFaceUri : document t -> fontElement t val createForeignObject : document t -> foreignObjectElement t val createG : document t -> gElement t val createGlyph : document t -> glyphElement t val createGlyphRef : document t -> glyphElement t val createhkern : document t -> element t val createImage : document t -> imageElement t val createLineElement : document t -> lineElement t val createLinearElement : document t -> linearGradientElement t (* val createMarker : document t -> markerElement *) val createMask : document t -> maskElement t val createMetaData : document t -> metadataElement t val createMissingGlyph : document t -> glyphElement t val createMPath : document t -> mPathElement t val createPath : document t -> pathElement t val createPattern : document t -> patternElement t val createPolygon : document t -> polygonElement t val createPolyline : document t -> polyLineElement t val createRadialgradient : document t -> radialGradientElement t val createRect : document t -> rectElement t val createScript : document t -> scriptElement t val createSet : document t -> setElement t val createStop : document t -> stopElement t val createStyle : document t -> styleElement t val createSvg : document t -> svgElement t val createSwitch : document t -> switchElement t val createSymbol : document t -> symbolElement t val createTextElement : document t -> textElement t val createTextpath : document t -> textPathElement t val createTitle : document t -> titleElement t val createTref : document t -> trefElement t val createTspan : document t -> tspanElement t val createUse : document t -> useElement t val createView : document t -> viewElement t val createvkern : document t -> element t (****) val svg_element : element t constr val document : document t (** The current document *) val getElementById : string -> element t (** [getElementById id] returns the element with the id [id] in the current document. It raises [Not_found] if there are no such element *) (** {2 Coercion functions} *) module CoerceTo : sig val element : #Dom.node t -> element t opt val a : #element t -> aElement t opt val altGlyph : #element t -> altGlyphElement t opt val altGlyphDef : #element t -> altGlyphDefElement t opt val altGlyphItem : #element t -> altGlyphItemElement t opt val animate : #element t -> animateElement t opt val animateColor : #element t -> animateColorElement t opt val animateMotion : #element t -> animateMotionElement t opt val animateTransform : #element t -> animateTransformElement t opt val circle : #element t -> circleElement t opt val clipPath : #element t -> clipPathElement t opt (* val ColorProfile : #element t -> colorProfile t opt *) val cursor : #element t -> cursorElement t opt val defs : #element t -> defsElement t opt val desc : #element t -> descElement t opt val ellipse : #element t -> ellipseElement t opt (* val Fe* *) val filter : #element t -> filterElement t opt val font : #element t -> fontElement t opt val fontFace : #element t -> fontElement t opt val fontFaceFormat : #element t -> fontElement t opt val fontFaceName : #element t -> fontElement t opt val fontFaceSrc : #element t -> fontElement t opt val fontFaceUri : #element t -> fontElement t opt val foreignObject : #element t -> foreignObjectElement t opt val g : #element t -> gElement t opt val glyph : #element t -> glyphElement t opt val glyphRef : #element t -> glyphElement t opt val hkern : #element t -> element t opt val image : #element t -> imageElement t opt val lineElement : #element t -> lineElement t opt val linearElement : #element t -> linearGradientElement t opt (* val Marker : #element t -> markerElement *) val mask : #element t -> maskElement t opt val metaData : #element t -> metadataElement t opt val missingGlyph : #element t -> glyphElement t opt val mPath : #element t -> mPathElement t opt val path : #element t -> pathElement t opt val pattern : #element t -> patternElement t opt val polygon : #element t -> polygonElement t opt val polyline : #element t -> polyLineElement t opt val radialgradient : #element t -> radialGradientElement t opt val rect : #element t -> rectElement t opt val script : #element t -> scriptElement t opt val set : #element t -> setElement t opt val stop : #element t -> stopElement t opt val style : #element t -> styleElement t opt val svg : #element t -> svgElement t opt val switch : #element t -> switchElement t opt val symbol : #element t -> symbolElement t opt val textElement : #element t -> textElement t opt val textpath : #element t -> textPathElement t opt val title : #element t -> titleElement t opt val tref : #element t -> trefElement t opt val tspan : #element t -> tspanElement t opt val use : #element t -> useElement t opt val view : #element t -> viewElement t opt val vkern : #element t -> element t opt end js_of_ocaml-3.5.2/lib/js_of_ocaml/dune000066400000000000000000000006621357507750000177100ustar00rootroot00000000000000(library (name js_of_ocaml) (public_name js_of_ocaml) (libraries uchar bytes) (c_names js_of_ocaml_stubs) (preprocess (pps ppx_js_internal))) (rule (targets js_of_ocaml_stubs.c) (deps (glob_files *.ml)) (mode promote) (action (with-stdout-to %{targets} (run ./gen_stubs/gen_stubs.exe %{deps})))) (rule (targets lib_version.ml) (deps (:input-file ../../version.ml.in)) (action (copy %{input-file} %{targets}))) js_of_ocaml-3.5.2/lib/js_of_ocaml/eventSource.ml000066400000000000000000000040521357507750000216630ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* https://developer.mozilla.org/en-US/docs/Web/API/EventSource *) open Js open Dom open! Import type state = | CONNECTING | OPEN | CLOSED class type ['a] messageEvent = object inherit ['a] Dom.event method data : js_string t readonly_prop method origin : js_string t readonly_prop method lastEventId : js_string t readonly_prop (* method source : unit *) end class type eventSource = object ('self) method url : string t readonly_prop method withCredentials : bool t readonly_prop method readyState : state readonly_prop method close : unit meth method onopen : ('self t, 'self messageEvent t) event_listener writeonly_prop method onmessage : ('self t, 'self messageEvent t) event_listener writeonly_prop method onerror : ('self t, 'self messageEvent t) event_listener writeonly_prop end class type options = object method withCredentials : bool t writeonly_prop end let withCredentials b : options t = let init = Js.Unsafe.obj [||] in init##.withCredentials := Js.bool b; init let eventSource = Js.Unsafe.global##._EventSource let eventSource_options = Js.Unsafe.global##._EventSource let addEventListener = Dom.addEventListener js_of_ocaml-3.5.2/lib/js_of_ocaml/eventSource.mli000066400000000000000000000042671357507750000220440ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** EventSource binding *) open Js open Dom type state = | CONNECTING | OPEN | CLOSED class type ['a] messageEvent = object inherit ['a] Dom.event method data : js_string t readonly_prop method origin : js_string t readonly_prop method lastEventId : js_string t readonly_prop (* method source : unit *) end class type eventSource = object ('self) method url : string t readonly_prop method withCredentials : bool t readonly_prop method readyState : state readonly_prop method close : unit meth method onopen : ('self t, 'self messageEvent t) event_listener writeonly_prop method onmessage : ('self t, 'self messageEvent t) event_listener writeonly_prop method onerror : ('self t, 'self messageEvent t) event_listener writeonly_prop end class type options = object method withCredentials : bool t writeonly_prop end val withCredentials : bool -> options t val eventSource : (js_string t -> eventSource t) constr val eventSource_options : (js_string t -> options t -> eventSource t) constr val addEventListener : (#eventSource t as 'a) -> 'b Event.typ -> ('a, 'b) event_listener -> bool t -> event_listener_id (** Add an event listener. This function matches the [addEventListener] DOM method, except that it returns an id for removing the listener. *) js_of_ocaml-3.5.2/lib/js_of_ocaml/file.ml000066400000000000000000000134001357507750000202750ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Pierre Chambart * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open Dom open! Import class type blob = object method size : int readonly_prop method _type : js_string t readonly_prop method slice : int -> int -> blob t meth method slice_withContentType : int -> int -> js_string t -> blob t meth end let blob_constr = Unsafe.global##._Blob type 'a make_blob = ?contentType:string -> ?endings:[ `Transparent | `Native ] -> 'a -> blob t let rec filter_map f = function | [] -> [] | v :: q -> ( match f v with | None -> filter_map f q | Some v' -> v' :: filter_map f q) let make_blob_options contentType endings = let options = filter_map (fun (name, v) -> match v with | None -> None | Some v -> Some (name, Unsafe.inject (string v))) [ "type", contentType ; ( "endings" , match endings with | None -> None | Some `Transparent -> Some "transparent" | Some `Native -> Some "native" ) ] in match options with | [] -> undefined | l -> Unsafe.obj (Array.of_list l) let blob_raw ?contentType ?endings a = let options = make_blob_options contentType endings in new%js blob_constr (array a) options let blob_from_string ?contentType ?endings s = blob_raw ?contentType ?endings [| string s |] let blob_from_any ?contentType ?endings l = let l = List.map (function | `arrayBuffer a -> Unsafe.inject a | `arrayBufferView a -> Unsafe.inject a | `string s -> Unsafe.inject (string s) | `js_string s -> Unsafe.inject s | `blob b -> Unsafe.inject b) l in blob_raw ?contentType ?endings (Array.of_list l) class type file = object inherit blob method name : js_string t readonly_prop method lastModifiedDate : js_string t readonly_prop end (* in firefox 3.0-3.5 file.name is not available, we use the nonstandard fileName instead *) class type file_name_only = object method name : js_string t optdef readonly_prop method fileName : js_string t optdef readonly_prop end let filename file = let file : file_name_only t = Js.Unsafe.coerce file in match Optdef.to_option file##.name with | None -> ( match Optdef.to_option file##.fileName with | None -> failwith "can't retrieve file name: not implemented" | Some name -> name) | Some name -> name type file_any = < > t let doc_constr = Unsafe.global##._Document module CoerceTo = struct external json : file_any -> 'a Opt.t = "%identity" let document (e : file_any) = if instanceof e doc_constr then Js.some (Unsafe.coerce e : element document t) else Js.null let blob (e : file_any) = if instanceof e blob_constr then Js.some (Unsafe.coerce e : #blob t) else Js.null let string (e : file_any) = if typeof e == string "string" then Js.some (Unsafe.coerce e : js_string t) else Js.null let arrayBuffer (e : file_any) = if instanceof e Typed_array.arrayBuffer then Js.some (Unsafe.coerce e : Typed_array.arrayBuffer t) else Js.null end class type fileList = object inherit [file] Dom.nodeList end class type fileError = object method code : int readonly_prop end class type ['a] progressEvent = object inherit ['a] event method lengthComputable : bool t readonly_prop method loaded : int readonly_prop method total : int readonly_prop end class type progressEventTarget = object ('self) method onloadstart : ('self t, 'self progressEvent t) event_listener writeonly_prop method onprogress : ('self t, 'self progressEvent t) event_listener writeonly_prop method onload : ('self t, 'self progressEvent t) event_listener writeonly_prop method onabort : ('self t, 'self progressEvent t) event_listener writeonly_prop method onerror : ('self t, 'self progressEvent t) event_listener writeonly_prop method onloadend : ('self t, 'self progressEvent t) event_listener writeonly_prop end type readyState = | EMPTY | LOADING | DONE class type fileReader = object ('self) method readAsArrayBuffer : #blob t -> unit meth method readAsBinaryString : #blob t -> unit meth method readAsText : #blob t -> unit meth method readAsText_withEncoding : #blob t -> js_string t -> unit meth method readAsDataURL : #blob t -> unit meth method abort : unit meth method readyState : readyState readonly_prop method result : file_any readonly_prop method error : fileError t readonly_prop inherit progressEventTarget end module ReaderEvent = struct type typ = fileReader progressEvent t Dom.Event.typ let loadstart = Event.make "loadstart" let progress = Event.make "progress" let abort = Event.make "abort" let error = Event.make "error" let load = Event.make "load" let loadend = Event.make "loadend" end let fileReader : fileReader t constr = Js.Unsafe.global##._FileReader let addEventListener = Dom.addEventListener js_of_ocaml-3.5.2/lib/js_of_ocaml/file.mli000066400000000000000000000114231357507750000204510ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Pierre Chambart * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** File API @see the documentation of the API. *) open Js open Dom class type blob = object method size : int readonly_prop method _type : js_string t readonly_prop method slice : int -> int -> blob t meth method slice_withContentType : int -> int -> js_string t -> blob t meth end type 'a make_blob = ?contentType:string -> ?endings:[ `Transparent | `Native ] -> 'a -> blob t val blob_from_string : string make_blob val blob_from_any : [ `blob of blob t | `arrayBuffer of Typed_array.arrayBuffer t | `arrayBufferView of Typed_array.arrayBufferView t | `string of string | `js_string of js_string t ] list make_blob class type file = object inherit blob method name : js_string t readonly_prop method lastModifiedDate : js_string t readonly_prop end type file_any module CoerceTo : sig val document : file_any -> element document t Opt.t val blob : file_any -> #blob t Opt.t val json : file_any -> 'a Opt.t val string : file_any -> js_string t Opt.t val arrayBuffer : file_any -> Typed_array.arrayBuffer t Opt.t end class type fileList = object inherit [file] Dom.nodeList end class type fileError = object method code : int readonly_prop end (* {2 Events} *) class type ['a] progressEvent = object inherit ['a] event method lengthComputable : bool t readonly_prop method loaded : int readonly_prop method total : int readonly_prop end class type progressEventTarget = object ('self) method onloadstart : ('self t, 'self progressEvent t) event_listener writeonly_prop method onprogress : ('self t, 'self progressEvent t) event_listener writeonly_prop method onload : ('self t, 'self progressEvent t) event_listener writeonly_prop method onabort : ('self t, 'self progressEvent t) event_listener writeonly_prop method onerror : ('self t, 'self progressEvent t) event_listener writeonly_prop method onloadend : ('self t, 'self progressEvent t) event_listener writeonly_prop end type readyState = | EMPTY | LOADING | DONE class type fileReader = object ('self) method readAsArrayBuffer : #blob t -> unit meth method readAsBinaryString : #blob t -> unit meth method readAsText : #blob t -> unit meth method readAsText_withEncoding : #blob t -> js_string t -> unit meth method readAsDataURL : #blob t -> unit meth method abort : unit meth method readyState : readyState readonly_prop method result : file_any readonly_prop method error : fileError t readonly_prop method onloadstart : ('self t, 'self progressEvent t) event_listener writeonly_prop method onprogress : ('self t, 'self progressEvent t) event_listener writeonly_prop method onload : ('self t, 'self progressEvent t) event_listener writeonly_prop method onabort : ('self t, 'self progressEvent t) event_listener writeonly_prop method onerror : ('self t, 'self progressEvent t) event_listener writeonly_prop method onloadend : ('self t, 'self progressEvent t) event_listener writeonly_prop inherit progressEventTarget end module ReaderEvent : sig type typ = fileReader progressEvent t Dom.Event.typ val loadstart : typ val progress : typ val abort : typ val error : typ val load : typ val loadend : typ end val filename : file t -> js_string t (** [filename] handles old firefox without name property *) val fileReader : fileReader t constr (* be careful, this might not be implemented in all browser. To check availability, use [Js.Optdef.to_option (Js.def fileReader)] *) val addEventListener : (#progressEventTarget t as 'a) -> 'b Event.typ -> ('a, 'b) event_listener -> bool t -> event_listener_id (** Add an event listener. This function matches the [addEventListener] DOM method, except that it returns an id for removing the listener. *) js_of_ocaml-3.5.2/lib/js_of_ocaml/firebug.ml000066400000000000000000000066431357507750000210140ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open! Import class type console = object method log : _ -> unit meth method log_2 : _ -> _ -> unit meth method log_3 : _ -> _ -> _ -> unit meth method log_4 : _ -> _ -> _ -> _ -> unit meth method log_5 : _ -> _ -> _ -> _ -> _ -> unit meth method log_6 : _ -> _ -> _ -> _ -> _ -> _ -> unit meth method log_7 : _ -> _ -> _ -> _ -> _ -> _ -> _ -> unit meth method log_8 : _ -> _ -> _ -> _ -> _ -> _ -> _ -> _ -> unit meth method debug : _ -> unit meth method debug_2 : _ -> _ -> unit meth method debug_3 : _ -> _ -> _ -> unit meth method debug_4 : _ -> _ -> _ -> _ -> unit meth method debug_5 : _ -> _ -> _ -> _ -> _ -> unit meth method info : _ -> unit meth method info_2 : _ -> _ -> unit meth method info_3 : _ -> _ -> _ -> unit meth method info_4 : _ -> _ -> _ -> _ -> unit meth method info_5 : _ -> _ -> _ -> _ -> _ -> unit meth method warn : _ -> unit meth method warn_2 : _ -> _ -> unit meth method warn_3 : _ -> _ -> _ -> unit meth method warn_4 : _ -> _ -> _ -> _ -> unit meth method warn_5 : _ -> _ -> _ -> _ -> _ -> unit meth method error : _ -> unit meth method error_2 : _ -> _ -> unit meth method error_3 : _ -> _ -> _ -> unit meth method error_4 : _ -> _ -> _ -> _ -> unit meth method error_5 : _ -> _ -> _ -> _ -> _ -> unit meth method assert_ : bool t -> unit meth method assert_1 : bool t -> _ -> unit meth method assert_2 : bool t -> _ -> _ -> unit meth method assert_3 : bool t -> _ -> _ -> _ -> unit meth method assert_4 : bool t -> _ -> _ -> _ -> _ -> unit meth method assert_5 : bool t -> _ -> _ -> _ -> _ -> _ -> unit meth method dir : _ -> unit meth method dirxml : Dom.node t -> unit meth method trace : unit meth method group : _ -> unit meth method group_2 : _ -> _ -> unit meth method group_3 : _ -> _ -> _ -> unit meth method group_4 : _ -> _ -> _ -> _ -> unit meth method group_5 : _ -> _ -> _ -> _ -> _ -> unit meth method groupCollapsed : _ -> unit meth method groupCollapsed_2 : _ -> _ -> unit meth method groupCollapsed_3 : _ -> _ -> _ -> unit meth method groupCollapsed_4 : _ -> _ -> _ -> _ -> unit meth method groupCollapsed_5 : _ -> _ -> _ -> _ -> _ -> unit meth method groupEnd : unit meth method time : js_string t -> unit meth method timeEnd : js_string t -> unit meth end external get_console : unit -> console t = "caml_js_get_console" let console = get_console () js_of_ocaml-3.5.2/lib/js_of_ocaml/firebug.mli000066400000000000000000000067111357507750000211610ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Firebug API (debugging console). @see the Firebug console API *) open Js class type console = object method log : _ -> unit meth method log_2 : _ -> _ -> unit meth method log_3 : _ -> _ -> _ -> unit meth method log_4 : _ -> _ -> _ -> _ -> unit meth method log_5 : _ -> _ -> _ -> _ -> _ -> unit meth method log_6 : _ -> _ -> _ -> _ -> _ -> _ -> unit meth method log_7 : _ -> _ -> _ -> _ -> _ -> _ -> _ -> unit meth method log_8 : _ -> _ -> _ -> _ -> _ -> _ -> _ -> _ -> unit meth method debug : _ -> unit meth method debug_2 : _ -> _ -> unit meth method debug_3 : _ -> _ -> _ -> unit meth method debug_4 : _ -> _ -> _ -> _ -> unit meth method debug_5 : _ -> _ -> _ -> _ -> _ -> unit meth method info : _ -> unit meth method info_2 : _ -> _ -> unit meth method info_3 : _ -> _ -> _ -> unit meth method info_4 : _ -> _ -> _ -> _ -> unit meth method info_5 : _ -> _ -> _ -> _ -> _ -> unit meth method warn : _ -> unit meth method warn_2 : _ -> _ -> unit meth method warn_3 : _ -> _ -> _ -> unit meth method warn_4 : _ -> _ -> _ -> _ -> unit meth method warn_5 : _ -> _ -> _ -> _ -> _ -> unit meth method error : _ -> unit meth method error_2 : _ -> _ -> unit meth method error_3 : _ -> _ -> _ -> unit meth method error_4 : _ -> _ -> _ -> _ -> unit meth method error_5 : _ -> _ -> _ -> _ -> _ -> unit meth method assert_ : bool t -> unit meth method assert_1 : bool t -> _ -> unit meth method assert_2 : bool t -> _ -> _ -> unit meth method assert_3 : bool t -> _ -> _ -> _ -> unit meth method assert_4 : bool t -> _ -> _ -> _ -> _ -> unit meth method assert_5 : bool t -> _ -> _ -> _ -> _ -> _ -> unit meth method dir : _ -> unit meth method dirxml : Dom.node t -> unit meth method trace : unit meth method group : _ -> unit meth method group_2 : _ -> _ -> unit meth method group_3 : _ -> _ -> _ -> unit meth method group_4 : _ -> _ -> _ -> _ -> unit meth method group_5 : _ -> _ -> _ -> _ -> _ -> unit meth method groupCollapsed : _ -> unit meth method groupCollapsed_2 : _ -> _ -> unit meth method groupCollapsed_3 : _ -> _ -> _ -> unit meth method groupCollapsed_4 : _ -> _ -> _ -> _ -> unit meth method groupCollapsed_5 : _ -> _ -> _ -> _ -> _ -> unit meth method groupEnd : unit meth method time : js_string t -> unit meth method timeEnd : js_string t -> unit meth end val console : console t js_of_ocaml-3.5.2/lib/js_of_ocaml/form.ml000066400000000000000000000126571357507750000203360ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Pierre Chambart * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open Dom_html open! Import class type formData = object method append : js_string t -> js_string t -> unit meth method append_blob : js_string t -> File.blob t -> unit meth end let formData : formData t constr = Js.Unsafe.global##._FormData let formData_form : (formElement t -> formData t) constr = Js.Unsafe.global##._FormData type form_elt = [ `String of js_string t | `File of File.file t ] type form_contents = [ `Fields of (string * form_elt) list ref | `FormData of formData t ] let rec filter_map f = function | [] -> [] | v :: q -> ( match f v with | None -> filter_map f q | Some v' -> v' :: filter_map f q) class type submittableElement = object method disabled : bool t prop method name : js_string t readonly_prop method value : js_string t prop end let have_content (elt : submittableElement t) = elt##.name##.length > 0 && not (Js.to_bool elt##.disabled) let get_textarea_val (elt : textAreaElement t) = if have_content (elt :> submittableElement t) then let name = to_string elt##.name in [ name, `String elt##.value ] else [] let get_select_val (elt : selectElement t) = if have_content (elt :> submittableElement t) then let name = to_string elt##.name in if to_bool elt##.multiple then let options = Array.init elt##.options##.length (fun i -> Opt.to_option (elt##.options##item i)) in filter_map (function | None -> None | Some e -> if Js.to_bool e##.selected then Some (name, `String e##.value) else None) (Array.to_list options) else [ name, `String elt##.value ] else [] class type file_input = object inherit inputElement method files : File.fileList t optdef readonly_prop method multiple : bool optdef readonly_prop end let get_input_val ?(get = false) (elt : inputElement t) = if have_content (elt :> submittableElement t) then let name = to_string elt##.name in let value = elt##.value in match to_bytestring elt##._type##toLowerCase with | "checkbox" | "radio" -> if to_bool elt##.checked then [ name, `String value ] else [] | "submit" | "reset" -> [] | "text" | "password" -> [ name, `String value ] | "file" -> ( if get then [ name, `String value ] else let elt : file_input t = Unsafe.coerce elt in match Optdef.to_option elt##.files with | None -> [] | Some list -> ( if list##.length = 0 then [ name, `String (Js.string "") ] else match Optdef.to_option elt##.multiple with | None | Some false -> ( match Opt.to_option (list##item 0) with | None -> [] | Some file -> [ name, `File file ]) | Some true -> filter_map (fun f -> match Opt.to_option f with | None -> None | Some file -> Some (name, `File file)) (Array.to_list (Array.init list##.length (fun i -> list##item i))))) | _ -> [ name, `String value ] else [] let form_elements ?get (form : formElement t) = let length = form##.elements##.length in let elements = Array.to_list (Array.init length (fun i -> Opt.to_option (form##.elements##item i))) in let contents = List.flatten (List.map (function | None -> [] (* shouldn't happen *) | Some v -> ( match tagged v with | Select v -> get_select_val v | Input v -> get_input_val ?get v | Textarea v -> get_textarea_val v | _ -> [])) elements) in contents let append (form_contents : form_contents) (form_elt : string * form_elt) = match form_contents with | `Fields list -> list := form_elt :: !list | `FormData f -> ( match form_elt with | name, `String s -> f##append (string name) s | name, `File file -> f##append_blob (string name) (file :> File.blob t)) let empty_form_contents () = match Optdef.to_option (Js.def formData) with | None -> `Fields (ref []) | Some constr -> `FormData (new%js constr) let post_form_contents form = let contents = empty_form_contents () in List.iter (append contents) (form_elements form); contents let get_form_contents form = List.map (function | name, `String s -> name, to_string s | _ -> assert false) (form_elements ~get:true form) js_of_ocaml-3.5.2/lib/js_of_ocaml/form.mli000066400000000000000000000035421357507750000205000ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Pierre Chambart * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js (** This module provides functions to manipulate forms. *) class type formData = object method append : js_string t -> js_string t -> unit meth method append_blob : js_string t -> File.blob t -> unit meth end val formData : formData t constr val formData_form : (Dom_html.formElement t -> formData t) constr (* be careful, this might not be implemented in all browser. To check availability, use [Js.Optdef.to_option (Js.def formData)] *) type form_elt = [ `String of js_string t | `File of File.file t ] type form_contents = [ `Fields of (string * form_elt) list ref | `FormData of formData t ] val append : form_contents -> string * form_elt -> unit val post_form_contents : Dom_html.formElement t -> form_contents val get_form_contents : Dom_html.formElement t -> (string * string) list val empty_form_contents : unit -> form_contents val form_elements : ?get:bool -> Dom_html.formElement t -> (string * form_elt) list js_of_ocaml-3.5.2/lib/js_of_ocaml/gen_stubs/000077500000000000000000000000001357507750000210175ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/js_of_ocaml/gen_stubs/dune000066400000000000000000000001011357507750000216650ustar00rootroot00000000000000(executable (name gen_stubs) (libraries compiler-libs.common)) js_of_ocaml-3.5.2/lib/js_of_ocaml/gen_stubs/gen_stubs.ml000066400000000000000000000022421357507750000233420ustar00rootroot00000000000000module String_set = Set.Make (String) let print_stub s = Printf.printf "void %s () {\n\ \ fprintf(stderr, \"Unimplemented Javascript primitive %s!\\n\");\n\ \ exit(1);\n\ }\n" s s let () = let mls = ref [] in Arg.parse [] (fun ml -> if not (Filename.check_suffix ml ".pp.ml") then mls := ml :: !mls) "generate dummy js stubs"; let externals = ref String_set.empty in let value_description _mapper desc = let l = List.filter (fun x -> x.[0] <> '%') desc.Parsetree.pval_prim in externals := List.fold_right String_set.add l !externals; desc in let mapper = { Ast_mapper.default_mapper with value_description } in List.iter (fun ml -> let in_ = open_in ml in (try Location.input_name := ml; let lex = Lexing.from_channel in_ in let impl = Parse.implementation lex in let (_ : Parsetree.structure) = mapper.structure mapper impl in () with exn -> Location.report_exception Format.std_formatter exn); close_in_noerr in_) !mls; print_endline "#include "; print_endline "#include "; String_set.iter print_stub !externals js_of_ocaml-3.5.2/lib/js_of_ocaml/geolocation.ml000066400000000000000000000051651357507750000216720ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2015 Stéphane Legrand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import type positionErrorCode type watchId class type coordinates = object method latitude : float Js.readonly_prop method longitude : float Js.readonly_prop method altitude : float Js.opt Js.readonly_prop method accuracy : float Js.readonly_prop method altitudeAccuracy : float Js.opt Js.readonly_prop method heading : float Js.opt Js.readonly_prop method speed : float Js.opt Js.readonly_prop end class type position = object method coords : coordinates Js.t Js.readonly_prop method timestamp : Js.date Js.readonly_prop end class type positionOptions = object method enableHighAccuracy : bool Js.writeonly_prop method timeout : int Js.writeonly_prop method maximumAge : int Js.writeonly_prop end class type positionError = object method _PERMISSION_DENIED_ : positionErrorCode Js.readonly_prop method _POSITION_UNAVAILABLE_ : positionErrorCode Js.readonly_prop method _TIMEOUT : positionErrorCode Js.readonly_prop method code : positionErrorCode Js.readonly_prop method message : Js.js_string Js.t Js.readonly_prop end class type geolocation = object method getCurrentPosition : (position Js.t -> unit) Js.callback -> (positionError Js.t -> unit) Js.callback -> positionOptions Js.t -> unit Js.meth method watchPosition : (position Js.t -> unit) Js.callback -> (positionError Js.t -> unit) Js.callback -> positionOptions Js.t -> watchId Js.meth method clearWatch : watchId -> unit Js.meth end let empty_position_options () = Js.Unsafe.obj [||] let geolocation = let x = Js.Unsafe.global##.navigator in if Js.Optdef.test x then x##.geolocation else x (* undefined *) let is_supported () = Js.Optdef.test geolocation js_of_ocaml-3.5.2/lib/js_of_ocaml/geolocation.mli000066400000000000000000000064531357507750000220440ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2015 Stéphane Legrand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Geolocation API A code example: {[ if (Geolocation.is_supported()) then let geo = Geolocation.geolocation in let options = Geolocation.empty_position_options() in let () = options##.enableHighAccuracy := true in let f_success pos = let coords = pos##.coords in let latitude = coords##.latitude in Firebug.console##debug latitude ; in let f_error err = let code = err##.code in let msg = err##.message in if code = err##._TIMEOUT then Firebug.console##debug(msg) in geo##getCurrentPosition (Js.wrap_callback f_success) (Js.wrap_callback f_error) options ]} @see for API documentation. @see for the W3C Recommendation. *) type positionErrorCode type watchId class type coordinates = object method latitude : float Js.readonly_prop method longitude : float Js.readonly_prop method altitude : float Js.opt Js.readonly_prop method accuracy : float Js.readonly_prop method altitudeAccuracy : float Js.opt Js.readonly_prop method heading : float Js.opt Js.readonly_prop method speed : float Js.opt Js.readonly_prop end class type position = object method coords : coordinates Js.t Js.readonly_prop method timestamp : Js.date Js.readonly_prop end class type positionOptions = object method enableHighAccuracy : bool Js.writeonly_prop method timeout : int Js.writeonly_prop method maximumAge : int Js.writeonly_prop end class type positionError = object method _PERMISSION_DENIED_ : positionErrorCode Js.readonly_prop method _POSITION_UNAVAILABLE_ : positionErrorCode Js.readonly_prop method _TIMEOUT : positionErrorCode Js.readonly_prop method code : positionErrorCode Js.readonly_prop method message : Js.js_string Js.t Js.readonly_prop end class type geolocation = object method getCurrentPosition : (position Js.t -> unit) Js.callback -> (positionError Js.t -> unit) Js.callback -> positionOptions Js.t -> unit Js.meth method watchPosition : (position Js.t -> unit) Js.callback -> (positionError Js.t -> unit) Js.callback -> positionOptions Js.t -> watchId Js.meth method clearWatch : watchId -> unit Js.meth end val empty_position_options : unit -> positionOptions Js.t val geolocation : geolocation Js.t val is_supported : unit -> bool js_of_ocaml-3.5.2/lib/js_of_ocaml/import.ml000066400000000000000000000036031357507750000206740ustar00rootroot00000000000000(* Js_of_ocaml * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Poly = struct external ( < ) : 'a -> 'a -> bool = "%lessthan" external ( <= ) : 'a -> 'a -> bool = "%lessequal" external ( <> ) : 'a -> 'a -> bool = "%notequal" external ( = ) : 'a -> 'a -> bool = "%equal" external ( > ) : 'a -> 'a -> bool = "%greaterthan" external ( >= ) : 'a -> 'a -> bool = "%greaterequal" external compare : 'a -> 'a -> int = "%compare" external equal : 'a -> 'a -> bool = "%equal" end module Int_replace_polymorphic_compare = struct let ( < ) (x : int) y = x < y let ( <= ) (x : int) y = x <= y let ( <> ) (x : int) y = x <> y let ( = ) (x : int) y = x = y let ( > ) (x : int) y = x > y let ( >= ) (x : int) y = x >= y let compare (x : int) y = compare x y let equal (x : int) y = x = y let max (x : int) y = if x >= y then x else y let min (x : int) y = if x <= y then x else y end module String = struct include String let equal (x : string) (y : string) = Poly.equal x y end module Char = struct include Char let equal (x : char) (y : char) = Poly.equal x y end include Int_replace_polymorphic_compare js_of_ocaml-3.5.2/lib/js_of_ocaml/intl.ml000066400000000000000000000240161357507750000203310ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2018 Stéphane Legrand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import module type Shared = sig class type object_options = object method localeMatcher : Js.js_string Js.t Js.prop end val object_options : unit -> object_options Js.t class type _object = object method supportedLocalesOf : Js.js_string Js.t Js.js_array Js.t -> object_options Js.t Js.optdef -> Js.js_string Js.t Js.js_array Js.t Js.meth end end module Shared : Shared = struct class type object_options = object method localeMatcher : Js.js_string Js.t Js.prop end let object_options () = object%js val mutable localeMatcher = Js.string "best fit" end class type _object = object method supportedLocalesOf : Js.js_string Js.t Js.js_array Js.t -> object_options Js.t Js.optdef -> Js.js_string Js.t Js.js_array Js.t Js.meth end end module Collator = struct include Shared class type resolved_options = object method locale : Js.js_string Js.t Js.readonly_prop method usage : Js.js_string Js.t Js.readonly_prop method sensitivity : Js.js_string Js.t Js.readonly_prop method ignorePunctuation : bool Js.t Js.readonly_prop method collation : Js.js_string Js.t Js.readonly_prop method numeric : bool Js.t Js.readonly_prop method caseFirst : Js.js_string Js.t Js.readonly_prop end class type options = object method localeMatcher : Js.js_string Js.t Js.prop method usage : Js.js_string Js.t Js.prop method sensitivity : Js.js_string Js.t Js.prop method ignorePunctuation : bool Js.t Js.prop method numeric : bool Js.t Js.prop method caseFirst : Js.js_string Js.t Js.prop end let options () = object%js val mutable localeMatcher = Js.string "best fit" val mutable usage = Js.string "sort" val mutable sensitivity = Js.string "variant" val mutable ignorePunctuation = Js._false val mutable numeric = Js._false val mutable caseFirst = Js.string "false" end class type t = object method compare : (Js.js_string Js.t -> Js.js_string Js.t -> int) Js.readonly_prop method resolvedOptions : unit -> resolved_options Js.t Js.meth end end module DateTimeFormat = struct include Shared class type resolved_options = object method locale : Js.js_string Js.t Js.readonly_prop method calendar : Js.js_string Js.t Js.readonly_prop method numberingSystem : Js.js_string Js.t Js.readonly_prop method timeZone : Js.js_string Js.t Js.readonly_prop method hour12 : bool Js.t Js.readonly_prop method weekday : Js.js_string Js.t Js.optdef_prop method era : Js.js_string Js.t Js.optdef_prop method year : Js.js_string Js.t Js.optdef_prop method month : Js.js_string Js.t Js.optdef_prop method day : Js.js_string Js.t Js.optdef_prop method hour : Js.js_string Js.t Js.optdef_prop method minute : Js.js_string Js.t Js.optdef_prop method second : Js.js_string Js.t Js.optdef_prop method timeZoneName : Js.js_string Js.t Js.optdef_prop end class type options = object method localeMatcher : Js.js_string Js.t Js.prop method timeZone : Js.js_string Js.t Js.optdef Js.prop method hour12 : bool Js.t Js.optdef Js.prop method hourCycle : Js.js_string Js.t Js.optdef Js.prop method formatMatcher : Js.js_string Js.t Js.prop method weekday : Js.js_string Js.t Js.optdef Js.prop method era : Js.js_string Js.t Js.optdef Js.prop method year : Js.js_string Js.t Js.optdef Js.prop method month : Js.js_string Js.t Js.optdef Js.prop method day : Js.js_string Js.t Js.optdef Js.prop method hour : Js.js_string Js.t Js.optdef Js.prop method minute : Js.js_string Js.t Js.optdef Js.prop method second : Js.js_string Js.t Js.optdef Js.prop method timeZoneName : Js.js_string Js.t Js.optdef Js.prop end let options () : options Js.t = object%js val mutable localeMatcher = Js.string "best fit" val mutable timeZone = Js.undefined val mutable hour12 = Js.undefined val mutable hourCycle = Js.undefined val mutable formatMatcher = Js.string "best fit" val mutable weekday = Js.undefined val mutable era = Js.undefined val mutable year = Js.undefined val mutable month = Js.undefined val mutable day = Js.undefined val mutable hour = Js.undefined val mutable minute = Js.undefined val mutable second = Js.undefined val mutable timeZoneName = Js.undefined end class type format_part = object method _type : Js.js_string Js.t Js.readonly_prop method _value : Js.js_string Js.t Js.readonly_prop end class type t = object method format : (Js.date Js.t -> Js.js_string Js.t) Js.readonly_prop method formatToParts : Js.date Js.t Js.optdef -> format_part Js.t Js.js_array Js.t Js.meth method resolvedOptions : unit -> resolved_options Js.t Js.meth end end module NumberFormat = struct include Shared class type resolved_options = object method locale : Js.js_string Js.t Js.readonly_prop method numberingSystem : Js.js_string Js.t Js.readonly_prop method style : Js.js_string Js.t Js.readonly_prop method currency : Js.js_string Js.t Js.optdef_prop method currencyDisplay : Js.js_string Js.t Js.optdef_prop method useGrouping : bool Js.t Js.readonly_prop method minimumIntegerDigits : int Js.optdef_prop method minimumFractionDigits : int Js.optdef_prop method maximumFractionDigits : int Js.optdef_prop method minimumSignificantDigits : int Js.optdef_prop method maximumSignificantDigits : int Js.optdef_prop end class type options = object method localeMatcher : Js.js_string Js.t Js.prop method style : Js.js_string Js.t Js.prop method currency : Js.js_string Js.t Js.optdef Js.prop method currencyDisplay : Js.js_string Js.t Js.optdef Js.prop method useGrouping : bool Js.t Js.prop method minimumIntegerDigits : int Js.optdef Js.prop method minimumFractionDigits : int Js.optdef Js.prop method maximumFractionDigits : int Js.optdef Js.prop method minimumSignificantDigits : int Js.optdef Js.prop method maximumSignificantDigits : int Js.optdef Js.prop end let options () : options Js.t = object%js val mutable localeMatcher = Js.string "best fit" val mutable style = Js.string "decimal" val mutable currency = Js.undefined val mutable currencyDisplay = Js.undefined val mutable useGrouping = Js._true val mutable minimumIntegerDigits = Js.undefined val mutable minimumFractionDigits = Js.undefined val mutable maximumFractionDigits = Js.undefined val mutable minimumSignificantDigits = Js.undefined val mutable maximumSignificantDigits = Js.undefined end class type format_part = object method _type : Js.js_string Js.t Js.readonly_prop method _value : Js.js_string Js.t Js.readonly_prop end class type t = object method format : (Js.number Js.t -> Js.js_string Js.t) Js.readonly_prop method formatToParts : Js.number Js.t Js.optdef -> format_part Js.t Js.js_array Js.t Js.meth method resolvedOptions : unit -> resolved_options Js.t Js.meth end end module PluralRules = struct include Shared class type resolved_options = object method locale : Js.js_string Js.t Js.readonly_prop method pluralCategories : Js.js_string Js.t Js.js_array Js.t Js.readonly_prop method _type : Js.js_string Js.t Js.readonly_prop method minimumIntegerDigits : int Js.optdef_prop method minimumFractionDigits : int Js.optdef_prop method maximumFractionDigits : int Js.optdef_prop method minimumSignificantDigits : int Js.optdef_prop method maximumSignificantDigits : int Js.optdef_prop end class type options = object method localeMatcher : Js.js_string Js.t Js.prop method _type : Js.js_string Js.t Js.prop end let options () : options Js.t = object%js val mutable localeMatcher = Js.string "best fit" val mutable _type = Js.string "cardinal" end class type t = object method select : Js.number Js.t -> Js.js_string Js.t Js.meth method resolvedOptions : unit -> resolved_options Js.t Js.meth end end class type intl = object method _Collator : Collator._object Js.t Js.readonly_prop method _DateTimeFormat : DateTimeFormat._object Js.t Js.readonly_prop method _NumberFormat : NumberFormat._object Js.t Js.readonly_prop method _PluralRules : PluralRules._object Js.t Js.readonly_prop method getCanonicalLocales : Js.js_string Js.t Js.js_array Js.t -> Js.js_string Js.t Js.js_array Js.t Js.meth end let intl = Js.Unsafe.global##._Intl let collator_constr = Js.Unsafe.global##._Intl##._Collator let dateTimeFormat_constr = Js.Unsafe.global##._Intl##._DateTimeFormat let numberFormat_constr = Js.Unsafe.global##._Intl##._NumberFormat let pluralRules_constr = Js.Unsafe.global##._Intl##._PluralRules let is_supported () = Js.Optdef.test intl js_of_ocaml-3.5.2/lib/js_of_ocaml/intl.mli000066400000000000000000000550471357507750000205120ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2018 Stéphane Legrand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Internationalization API A code example: {[ open Js ;; let fc v = Firebug.console##debug v in let jas a = array(Array.map (fun v -> string v) a) in if (Intl.is_supported()) then ( let intl = Intl.intl in fc (intl##getCanonicalLocales (jas [| "EN-US"; "Fr" |])) ; try let options = Intl.Collator.object_options () in options##.localeMatcher := string "lookup" ; fc ( intl##._Collator##supportedLocalesOf (jas [| "ban"; "id-u-co-pinyin"; "de-ID" |]) (def options) ) ; (* Note: the exact output may be browser-dependent *) let letterSort lang letters = letters##sort (wrap_callback (fun a b -> let collator = new%js Intl.collator_constr (def (array [| lang |])) undefined in float_of_int(collator##.compare a b))) ; letters in let a = jas [| "a"; "z"; "ä" |] in fc (letterSort (string "de") a) ; fc (letterSort (string "sv") a) ; let collator = new%js Intl.collator_constr undefined undefined in fc (collator##.compare (string "a") (string "c")) ; fc (collator##.compare (string "c") (string "a")) ; fc (collator##.compare (string "a") (string "a")) ; let collator = new%js Intl.collator_constr (def (jas [| "de" |])) undefined in fc (collator##.compare (string "ä") (string "z")) ; let collator = new%js Intl.collator_constr (def (jas [| "sv" |])) undefined in fc (collator##.compare (string "ä") (string "z")) ; let options = Intl.Collator.options () in let () = options##.sensitivity := string "base" in let collator = new%js Intl.collator_constr (def (jas [| "de" |])) (def options) in fc (collator##.compare (string "ä") (string "a")) ; let collator = new%js Intl.collator_constr (def (jas [| "sv" |])) (def options) in fc (collator##.compare (string "ä") (string "a")) ; let firstAlphabetical locale letter1 letter2 = let collator = new%js Intl.collator_constr (def (array [| locale |])) undefined in if (collator##.compare letter1 letter2) > 0 then ( letter1 ) else ( letter2 ) in fc (firstAlphabetical (string "de") (string "z") (string "ä")) ; fc (firstAlphabetical (string "sv") (string "z") (string "ä")) ; let a = jas [| "Offenbach"; "Österreich"; "Odenwald" |] in let collator = new%js Intl.collator_constr (def (jas [| "de-u-co-phonebk" |])) undefined in let a = a##sort (wrap_callback (fun v1 v2 -> float_of_int(collator##.compare v1 v2))) in fc (a##join (string ", ")) ; let a = jas [| "Congrès"; "congres"; "Assemblée"; "poisson" |] in let options = Intl.Collator.options () in let () = options##.usage := string "search" in let () = options##.sensitivity := string "base" in let collator = new%js Intl.collator_constr (def (jas [| "fr" |])) (def options) in let s = string "congres" in let matches = a##filter (wrap_callback (fun v _ _ -> bool ((collator##.compare v s) = 0))) in fc (matches##join (string ", ")) ; let options = Intl.Collator.options () in let () = options##.sensitivity := string "base" in let collator = new%js Intl.collator_constr (def (jas [| "de" |])) (def options) in let usedOptions = collator##resolvedOptions () in fc (usedOptions##.locale) ; fc (usedOptions##.usage) ; fc (usedOptions##.sensitivity) ; fc (usedOptions##.ignorePunctuation) ; fc (usedOptions##.collation) ; fc (usedOptions##.numeric) ; let date = new%js date_sec 2012 11 20 3 0 0 in (* Results below assume UTC timezone - your results may vary *) let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "en-US" |])) undefined in fc (dtf##.format date) ; let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "ban"; "id" |])) undefined in fc (dtf##.format date) ; let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "ja-JP-u-ca-japanese" |])) undefined in fc (dtf##.format date) ; let options = Intl.DateTimeFormat.options () in let () = options##.weekday := def(string "long") in let () = options##.year := def(string "numeric") in let () = options##.month := def(string "long") in let () = options##.day := def(string "numeric") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "de-DE" |])) (def options) in fc (dtf##.format date) ; let () = options##.timeZone := def(string "UTC") in let () = options##.timeZoneName := def(string "short") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "en-US" |])) (def options) in fc (dtf##.format date) ; let options = Intl.DateTimeFormat.options () in let () = options##.hour := def(string "numeric") in let () = options##.minute := def(string "numeric") in let () = options##.second := def(string "numeric") in let () = options##.timeZone := def(string "Australia/Sydney") in let () = options##.timeZoneName := def(string "short") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "en-AU" |])) (def options) in fc (dtf##.format date) ; let options = Intl.DateTimeFormat.options () in let () = options##.year := def(string "numeric") in let () = options##.month := def(string "numeric") in let () = options##.day := def(string "numeric") in let () = options##.hour := def(string "numeric") in let () = options##.minute := def(string "numeric") in let () = options##.second := def(string "numeric") in let () = options##.hour12 := def(_false) in let () = options##.timeZone := def(string "America/Los_Angeles") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "en-US" |])) (def options) in fc (dtf##.format date) ; let date = new%js date_month 2012 05 in let options = Intl.DateTimeFormat.options () in let () = options##.weekday := def(string "long") in let () = options##.year := def(string "numeric") in let () = options##.month := def(string "long") in let () = options##.day := def(string "numeric") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "sr-RS" |])) (def options) in fc (dtf##.format date) ; let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "en-GB" |])) (def options) in fc (dtf##.format date) ; let a = array [| new%js date_month 2012 08 ; new%js date_month 2012 11 ; new%js date_month 2012 03 |] in let options = Intl.DateTimeFormat.options () in let () = options##.year := def(string "numeric") in let () = options##.month := def(string "long") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "pt-BR" |])) (def options) in let formatted = array_map dtf##.format a in fc (formatted##join (string "; ")) ; let date = new%js date_sec 2012 11 17 3 0 42 in let options = Intl.DateTimeFormat.options () in let () = options##.weekday := def(string "long") in let () = options##.year := def(string "numeric") in let () = options##.month := def(string "numeric") in let () = options##.day := def(string "numeric") in let () = options##.hour := def(string "numeric") in let () = options##.minute := def(string "numeric") in let () = options##.second := def(string "numeric") in let () = options##.hour12 := def(_true) in let () = options##.timeZone := def(string "UTC") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "en-us" |])) (def options) in fc (dtf##.format date) ; let parts = dtf##formatToParts (def(date)) in fc parts ; let dateString = ( array_map (fun (v:Intl.DateTimeFormat.format_part Js.t) -> match (to_string v##._type) with | "dayPeriod" -> (string "")##concat_2 v##._value (string "") | _ -> v##._value) (dtf##formatToParts (def(date))) )##reduce (wrap_callback (fun s part _ _ -> s##concat part)) in fc dateString ; let options = Intl.DateTimeFormat.options () in let () = options##.timeZone := def(string "UTC") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "zh-CN" |])) (def options) in let ropt = dtf##resolvedOptions () in fc ropt##.locale ; fc ropt##.calendar ; fc ropt##.numberingSystem ; let options = Intl.DateTimeFormat.options () in let () = options##.timeZone := def(string "UTC") in let dtf = new%js Intl.dateTimeFormat_constr (def (jas [| "de-XX" |])) (def options) in let ropt = dtf##resolvedOptions () in fc ropt##.locale ; fc ropt##.calendar ; fc ropt##.numberingSystem ; fc ropt##.timeZone ; fc ropt##.month ; let options = Intl.DateTimeFormat.object_options () in options##.localeMatcher := string "lookup" ; fc ( intl##._DateTimeFormat##supportedLocalesOf (jas [| "ban"; "id-u-co-pinyin"; "de-ID" |]) (def options) ) ; let number = number_of_float 123456.789 in let options = Intl.NumberFormat.options () in options##.style := string "currency" ; options##.currency := def(string "EUR") ; let nf = new%js Intl.numberFormat_constr (def (jas [| "de-DE" |])) (def options) in fc (nf##.format number) ; options##.currency := def(string "JPY") ; let nf = new%js Intl.numberFormat_constr (def (jas [| "ja-JP" |])) (def options) in fc (nf##.format number) ; let options = Intl.NumberFormat.options () in options##.maximumSignificantDigits := (def 3) ; let nf = new%js Intl.numberFormat_constr (def (jas [| "en-IN" |])) (def options) in fc (nf##.format number) ; let nf = new%js Intl.numberFormat_constr (def (jas [| "de-DE" |])) undefined in fc (nf##.format number) ; let nf = new%js Intl.numberFormat_constr (def (jas [| "ar-EG" |])) undefined in fc (nf##.format number) ; let nf = new%js Intl.numberFormat_constr (def (jas [| "zh-Hans-CN-u-nu-hanidec" |])) undefined in fc (nf##.format number) ; let nf = new%js Intl.numberFormat_constr (def (jas [| "ban"; "id" |])) undefined in fc (nf##.format number) ; let amount = number_of_float 654321.987 in let options = Intl.NumberFormat.options () in options##.style := string "currency" ; options##.currency := def(string "RUB") ; let nf = new%js Intl.numberFormat_constr (def (jas [| "ru-RU" |])) (def options) in fc (nf##.format amount) ; options##.currency := def(string "USD") ; let nf = new%js Intl.numberFormat_constr (def (jas [| "en-US" |])) (def options) in fc (nf##.format amount) ; let a = array [| number_of_float 123456.789 ; number_of_float 987654.321 ; number_of_float 456789.123 |] in let nf = new%js Intl.numberFormat_constr (def (jas [| "es-ES" |])) undefined in let formatted = array_map nf##.format a in fc (formatted##join (string "; ")) ; let number = number_of_float 3500. in let options = Intl.NumberFormat.options () in options##.style := string "currency" ; options##.currency := def(string "EUR") ; let nf = new%js Intl.numberFormat_constr (def (jas [| "de-DE" |])) (def options) in fc (nf##.format number) ; let parts = nf##formatToParts (def(number)) in fc parts ; let numberString = ( array_map (fun (v:Intl.NumberFormat.format_part Js.t) -> match (to_string v##._type) with | "currency" -> (string "")##concat_2 v##._value (string "") | _ -> v##._value) (nf##formatToParts (def(number))) )##reduce (wrap_callback (fun s part _ _ -> s##concat part)) in fc numberString ; let nf = new%js Intl.numberFormat_constr (def (jas [| "de-DE" |])) undefined in let options = nf##resolvedOptions () in fc (options##.locale) ; fc (options##.numberingSystem) ; fc (options##.style) ; fc (options##.minimumIntegerDigits) ; fc (options##.minimumFractionDigits) ; fc (options##.maximumFractionDigits) ; fc (options##.useGrouping) ; let options = Intl.NumberFormat.object_options () in options##.localeMatcher := string "lookup" ; fc ( intl##._NumberFormat##supportedLocalesOf (jas [| "ban"; "id-u-co-pinyin"; "de-ID" |]) (def options) ) ; let pr = new%js Intl.pluralRules_constr undefined undefined in fc (pr##select (number_of_float 0.)) ; fc (pr##select (number_of_float 1.)) ; fc (pr##select (number_of_float 2.)) ; let pr = new%js Intl.pluralRules_constr (def (jas [| "ar-EG" |])) undefined in fc (pr##select (number_of_float 0.)) ; fc (pr##select (number_of_float 1.)) ; fc (pr##select (number_of_float 2.)) ; fc (pr##select (number_of_float 6.)) ; fc (pr##select (number_of_float 18.)) ; let options = Intl.PluralRules.options () in options##._type := string "ordinal" ; let pr = new%js Intl.pluralRules_constr (def (jas [| "en-US" |])) (def options) in fc (pr##select (number_of_float 0.)) ; fc (pr##select (number_of_float 1.)) ; fc (pr##select (number_of_float 3.)) ; fc (pr##select (number_of_float 4.)) ; fc (pr##select (number_of_float 42.)) ; let de = new%js Intl.pluralRules_constr (def (jas [| "de-DE" |])) undefined in let usedOptions = de##resolvedOptions () in fc usedOptions##.locale ; fc usedOptions##.maximumFractionDigits ; fc usedOptions##.minimumFractionDigits ; fc usedOptions##.minimumIntegerDigits ; fc usedOptions##.pluralCategories ; fc usedOptions##._type ; let options = Intl.PluralRules.object_options () in options##.localeMatcher := string "lookup" ; fc ( intl##._PluralRules##supportedLocalesOf (jas [| "ban"; "id-u-co-pinyin"; "de-ID" |]) (def options) ) ; with | Error err -> Firebug.console##debug ( string (string_of_error err)) ; ) else ( Firebug.console##debug (string "Intl is not supported!") ; ) ]} @see for API documentation. @see for the ECMAScript specification. *) module type Shared = sig class type object_options = object method localeMatcher : Js.js_string Js.t Js.prop end val object_options : unit -> object_options Js.t class type _object = object method supportedLocalesOf : Js.js_string Js.t Js.js_array Js.t -> object_options Js.t Js.optdef -> Js.js_string Js.t Js.js_array Js.t Js.meth end end module Collator : sig include Shared class type resolved_options = object method locale : Js.js_string Js.t Js.readonly_prop method usage : Js.js_string Js.t Js.readonly_prop method sensitivity : Js.js_string Js.t Js.readonly_prop method ignorePunctuation : bool Js.t Js.readonly_prop method collation : Js.js_string Js.t Js.readonly_prop method numeric : bool Js.t Js.readonly_prop method caseFirst : Js.js_string Js.t Js.readonly_prop end class type options = object method localeMatcher : Js.js_string Js.t Js.prop method usage : Js.js_string Js.t Js.prop method sensitivity : Js.js_string Js.t Js.prop method ignorePunctuation : bool Js.t Js.prop method numeric : bool Js.t Js.prop method caseFirst : Js.js_string Js.t Js.prop end val options : unit -> options Js.t class type t = object method compare : (Js.js_string Js.t -> Js.js_string Js.t -> int) Js.readonly_prop method resolvedOptions : unit -> resolved_options Js.t Js.meth end end module DateTimeFormat : sig include Shared class type resolved_options = object method locale : Js.js_string Js.t Js.readonly_prop method calendar : Js.js_string Js.t Js.readonly_prop method numberingSystem : Js.js_string Js.t Js.readonly_prop method timeZone : Js.js_string Js.t Js.readonly_prop method hour12 : bool Js.t Js.readonly_prop method weekday : Js.js_string Js.t Js.optdef_prop method era : Js.js_string Js.t Js.optdef_prop method year : Js.js_string Js.t Js.optdef_prop method month : Js.js_string Js.t Js.optdef_prop method day : Js.js_string Js.t Js.optdef_prop method hour : Js.js_string Js.t Js.optdef_prop method minute : Js.js_string Js.t Js.optdef_prop method second : Js.js_string Js.t Js.optdef_prop method timeZoneName : Js.js_string Js.t Js.optdef_prop end class type options = object method localeMatcher : Js.js_string Js.t Js.prop method timeZone : Js.js_string Js.t Js.optdef Js.prop method hour12 : bool Js.t Js.optdef Js.prop method hourCycle : Js.js_string Js.t Js.optdef Js.prop method formatMatcher : Js.js_string Js.t Js.prop method weekday : Js.js_string Js.t Js.optdef Js.prop method era : Js.js_string Js.t Js.optdef Js.prop method year : Js.js_string Js.t Js.optdef Js.prop method month : Js.js_string Js.t Js.optdef Js.prop method day : Js.js_string Js.t Js.optdef Js.prop method hour : Js.js_string Js.t Js.optdef Js.prop method minute : Js.js_string Js.t Js.optdef Js.prop method second : Js.js_string Js.t Js.optdef Js.prop method timeZoneName : Js.js_string Js.t Js.optdef Js.prop end val options : unit -> options Js.t class type format_part = object method _type : Js.js_string Js.t Js.readonly_prop method _value : Js.js_string Js.t Js.readonly_prop end class type t = object method format : (Js.date Js.t -> Js.js_string Js.t) Js.readonly_prop method formatToParts : Js.date Js.t Js.optdef -> format_part Js.t Js.js_array Js.t Js.meth method resolvedOptions : unit -> resolved_options Js.t Js.meth end end module NumberFormat : sig include Shared class type resolved_options = object method locale : Js.js_string Js.t Js.readonly_prop method numberingSystem : Js.js_string Js.t Js.readonly_prop method style : Js.js_string Js.t Js.readonly_prop method currency : Js.js_string Js.t Js.optdef_prop method currencyDisplay : Js.js_string Js.t Js.optdef_prop method useGrouping : bool Js.t Js.readonly_prop method minimumIntegerDigits : int Js.optdef_prop method minimumFractionDigits : int Js.optdef_prop method maximumFractionDigits : int Js.optdef_prop method minimumSignificantDigits : int Js.optdef_prop method maximumSignificantDigits : int Js.optdef_prop end class type options = object method localeMatcher : Js.js_string Js.t Js.prop method style : Js.js_string Js.t Js.prop method currency : Js.js_string Js.t Js.optdef Js.prop method currencyDisplay : Js.js_string Js.t Js.optdef Js.prop method useGrouping : bool Js.t Js.prop method minimumIntegerDigits : int Js.optdef Js.prop method minimumFractionDigits : int Js.optdef Js.prop method maximumFractionDigits : int Js.optdef Js.prop method minimumSignificantDigits : int Js.optdef Js.prop method maximumSignificantDigits : int Js.optdef Js.prop end val options : unit -> options Js.t class type format_part = object method _type : Js.js_string Js.t Js.readonly_prop method _value : Js.js_string Js.t Js.readonly_prop end class type t = object method format : (Js.number Js.t -> Js.js_string Js.t) Js.readonly_prop method formatToParts : Js.number Js.t Js.optdef -> format_part Js.t Js.js_array Js.t Js.meth method resolvedOptions : unit -> resolved_options Js.t Js.meth end end module PluralRules : sig include Shared class type resolved_options = object method locale : Js.js_string Js.t Js.readonly_prop method pluralCategories : Js.js_string Js.t Js.js_array Js.t Js.readonly_prop method _type : Js.js_string Js.t Js.readonly_prop method minimumIntegerDigits : int Js.optdef_prop method minimumFractionDigits : int Js.optdef_prop method maximumFractionDigits : int Js.optdef_prop method minimumSignificantDigits : int Js.optdef_prop method maximumSignificantDigits : int Js.optdef_prop end class type options = object method localeMatcher : Js.js_string Js.t Js.prop method _type : Js.js_string Js.t Js.prop end val options : unit -> options Js.t class type t = object method select : Js.number Js.t -> Js.js_string Js.t Js.meth method resolvedOptions : unit -> resolved_options Js.t Js.meth end end class type intl = object method _Collator : Collator._object Js.t Js.readonly_prop method _DateTimeFormat : DateTimeFormat._object Js.t Js.readonly_prop method _NumberFormat : NumberFormat._object Js.t Js.readonly_prop method _PluralRules : PluralRules._object Js.t Js.readonly_prop method getCanonicalLocales : Js.js_string Js.t Js.js_array Js.t -> Js.js_string Js.t Js.js_array Js.t Js.meth end val intl : intl Js.t val collator_constr : ( Js.js_string Js.t Js.js_array Js.t Js.optdef -> Collator.options Js.t Js.optdef -> Collator.t Js.t) Js.constr val dateTimeFormat_constr : ( Js.js_string Js.t Js.js_array Js.t Js.optdef -> DateTimeFormat.options Js.t Js.optdef -> DateTimeFormat.t Js.t) Js.constr val numberFormat_constr : ( Js.js_string Js.t Js.js_array Js.t Js.optdef -> NumberFormat.options Js.t Js.optdef -> NumberFormat.t Js.t) Js.constr val pluralRules_constr : ( Js.js_string Js.t Js.js_array Js.t Js.optdef -> PluralRules.options Js.t Js.optdef -> PluralRules.t Js.t) Js.constr val is_supported : unit -> bool js_of_ocaml-3.5.2/lib/js_of_ocaml/js.ml000066400000000000000000000453641357507750000200100ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import type +'a t type (-'a, +'b) meth_callback module Unsafe = struct type top type any = top t type any_js_array = any external inject : 'a -> any = "%identity" external coerce : _ t -> _ t = "%identity" external get : 'a -> 'b -> 'c = "caml_js_get" external set : 'a -> 'b -> 'c -> unit = "caml_js_set" external delete : 'a -> 'b -> unit = "caml_js_delete" external call : 'a -> 'b -> any array -> 'c = "caml_js_call" external fun_call : 'a -> any array -> 'b = "caml_js_fun_call" external meth_call : 'a -> string -> any array -> 'b = "caml_js_meth_call" external new_obj : 'a -> any array -> 'b = "caml_js_new" external new_obj_arr : 'a -> any_js_array -> 'b = "caml_ojs_new_arr" external obj : (string * any) array -> 'a = "caml_js_object" external equals : 'a -> 'b -> bool = "caml_js_equals" external pure_expr : (unit -> 'a) -> 'a = "caml_js_pure_expr" external eval_string : string -> 'a = "caml_js_eval_string" external js_expr : string -> 'a = "caml_js_expr" external pure_js_expr : string -> 'a = "caml_pure_js_expr" let global = pure_js_expr "joo_global_object" external callback : ('a -> 'b) -> ('c, 'a -> 'b) meth_callback = "%identity" external callback_with_arguments : (any_js_array -> 'b) -> ('c, any_js_array -> 'b) meth_callback = "caml_js_wrap_callback_arguments" external callback_with_arity : int -> ('a -> 'b) -> ('c, 'a -> 'b) meth_callback = "caml_js_wrap_callback_strict" external meth_callback : ('b -> 'a) -> ('b, 'a) meth_callback = "caml_js_wrap_meth_callback_unsafe" external meth_callback_with_arity : int -> ('b -> 'a) -> ('b, 'a) meth_callback = "caml_js_wrap_meth_callback_strict" external meth_callback_with_arguments : ('b -> any_js_array -> 'a) -> ('b, any_js_array -> 'a) meth_callback = "caml_js_wrap_meth_callback_arguments" (* DEPRECATED *) external variable : string -> 'a = "caml_js_var" end (****) type 'a opt = 'a type 'a optdef = 'a external debugger : unit -> unit = "debugger" let null : 'a opt = Unsafe.pure_js_expr "null" external some : 'a -> 'a opt = "%identity" let undefined : 'a optdef = Unsafe.pure_js_expr "undefined" external def : 'a -> 'a optdef = "%identity" module type OPT = sig type 'a t val empty : 'a t val return : 'a -> 'a t val map : 'a t -> ('a -> 'b) -> 'b t val bind : 'a t -> ('a -> 'b t) -> 'b t val test : 'a t -> bool val iter : 'a t -> ('a -> unit) -> unit val case : 'a t -> (unit -> 'b) -> ('a -> 'b) -> 'b val get : 'a t -> (unit -> 'a) -> 'a val option : 'a option -> 'a t val to_option : 'a t -> 'a option end module Opt : OPT with type 'a t = 'a opt = struct type 'a t = 'a opt let empty = null let return = some let map x f = if Unsafe.equals x null then null else return (f x) let bind x f = if Unsafe.equals x null then null else f x let test x = not (Unsafe.equals x null) let iter x f = if not (Unsafe.equals x null) then f x let case x f g = if Unsafe.equals x null then f () else g x let get x f = if Unsafe.equals x null then f () else x let option x = match x with | None -> empty | Some x -> return x let to_option x = case x (fun () -> None) (fun x -> Some x) end module Optdef : OPT with type 'a t = 'a optdef = struct type 'a t = 'a optdef let empty = undefined let return = def let map x f = if x == undefined then undefined else return (f x) let bind x f = if x == undefined then undefined else f x let test x = x != undefined let iter x f = if x != undefined then f x let case x f g = if x == undefined then f () else g x let get x f = if x == undefined then f () else x let option x = match x with | None -> empty | Some x -> return x let to_option x = case x (fun () -> None) (fun x -> Some x) end (****) let coerce x f g = Opt.get (f x) (fun () -> g x) let coerce_opt x f g = Opt.get (Opt.bind x f) (fun () -> g x) (****) type +'a meth type +'a gen_prop type 'a readonly_prop = < get : 'a > gen_prop type 'a writeonly_prop = < set : 'a -> unit > gen_prop type 'a prop = < get : 'a ; set : 'a -> unit > gen_prop type 'a optdef_prop = < get : 'a optdef ; set : 'a -> unit > gen_prop type +'a constr (****) type 'a callback = (unit, 'a) meth_callback external wrap_callback : ('a -> 'b) -> ('c, 'a -> 'b) meth_callback = "caml_js_wrap_callback" external wrap_meth_callback : ('a -> 'b) -> ('a, 'b) meth_callback = "caml_js_wrap_meth_callback" (****) let _true = Unsafe.pure_js_expr "true" let _false = Unsafe.pure_js_expr "false" type match_result_handle type string_array class type js_string = object method toString : js_string t meth method valueOf : js_string t meth method charAt : int -> js_string t meth method charCodeAt : int -> float meth (* This may return NaN... *) method concat : js_string t -> js_string t meth method concat_2 : js_string t -> js_string t -> js_string t meth method concat_3 : js_string t -> js_string t -> js_string t -> js_string t meth method concat_4 : js_string t -> js_string t -> js_string t -> js_string t -> js_string t meth method indexOf : js_string t -> int meth method indexOf_from : js_string t -> int -> int meth method lastIndexOf : js_string t -> int meth method lastIndexOf_from : js_string t -> int -> int meth method localeCompare : js_string t -> float meth method _match : regExp t -> match_result_handle t opt meth method replace : regExp t -> js_string t -> js_string t meth method replace_string : js_string t -> js_string t -> js_string t meth method search : regExp t -> int meth method slice : int -> int -> js_string t meth method slice_end : int -> js_string t meth method split : js_string t -> string_array t meth method split_limited : js_string t -> int -> string_array t meth method split_regExp : regExp t -> string_array t meth method split_regExpLimited : regExp t -> int -> string_array t meth method substring : int -> int -> js_string t meth method substring_toEnd : int -> js_string t meth method toLowerCase : js_string t meth method toLocaleLowerCase : js_string t meth method toUpperCase : js_string t meth method toLocaleUpperCase : js_string t meth method trim : js_string t meth method length : int readonly_prop end and regExp = object method exec : js_string t -> match_result_handle t opt meth method test : js_string t -> bool t meth method toString : js_string t meth method source : js_string t readonly_prop method global : bool t readonly_prop method ignoreCase : bool t readonly_prop method multiline : bool t readonly_prop method lastIndex : int prop end class type string_constr = object method fromCharCode : int -> js_string t meth end let string_constr = Unsafe.global##._String let regExp = Unsafe.global##._RegExp let regExp_copy = regExp let regExp_withFlags = regExp class type ['a] js_array = object method toString : js_string t meth method toLocaleString : js_string t meth method concat : 'a js_array t -> 'a js_array t meth method join : js_string t -> js_string t meth method pop : 'a optdef meth method push : 'a -> int meth method push_2 : 'a -> 'a -> int meth method push_3 : 'a -> 'a -> 'a -> int meth method push_4 : 'a -> 'a -> 'a -> 'a -> int meth method reverse : 'a js_array t meth method shift : 'a optdef meth method slice : int -> int -> 'a js_array t meth method slice_end : int -> 'a js_array t meth method sort : ('a -> 'a -> float) callback -> 'a js_array t meth method sort_asStrings : 'a js_array t meth method splice : int -> int -> 'a js_array t meth method splice_1 : int -> int -> 'a -> 'a js_array t meth method splice_2 : int -> int -> 'a -> 'a -> 'a js_array t meth method splice_3 : int -> int -> 'a -> 'a -> 'a -> 'a js_array t meth method splice_4 : int -> int -> 'a -> 'a -> 'a -> 'a -> 'a js_array t meth method unshift : 'a -> int meth method unshift_2 : 'a -> 'a -> int meth method unshift_3 : 'a -> 'a -> 'a -> int meth method unshift_4 : 'a -> 'a -> 'a -> 'a -> int meth method some : ('a -> int -> 'a js_array t -> bool t) callback -> bool t meth method every : ('a -> int -> 'a js_array t -> bool t) callback -> bool t meth method forEach : ('a -> int -> 'a js_array t -> unit) callback -> unit meth method map : ('a -> int -> 'a js_array t -> 'b) callback -> 'b js_array t meth method filter : ('a -> int -> 'a js_array t -> bool t) callback -> 'a js_array t meth method reduce_init : ('b -> 'a -> int -> 'a js_array t -> 'b) callback -> 'b -> 'b meth method reduce : ('a -> 'a -> int -> 'a js_array t -> 'a) callback -> 'a meth method reduceRight_init : ('b -> 'a -> int -> 'a js_array t -> 'b) callback -> 'b -> 'b meth method reduceRight : ('a -> 'a -> int -> 'a js_array t -> 'a) callback -> 'a meth method length : int prop end let object_constructor = Unsafe.global##._Object let object_keys o : js_string t js_array t = object_constructor##keys o let array_constructor = Unsafe.global##._Array let array_empty = array_constructor let array_length = array_constructor let array_get : 'a #js_array t -> int -> 'a optdef = Unsafe.get let array_set : 'a #js_array t -> int -> 'a -> unit = Unsafe.set let array_map_poly : 'a #js_array t -> ('a -> int -> 'a #js_array t -> 'b) callback -> 'b #js_array t = fun a cb -> (Unsafe.coerce a)##map cb let array_map f a = array_map_poly a (wrap_callback (fun x _idx _ -> f x)) let array_mapi f a = array_map_poly a (wrap_callback (fun x idx _ -> f idx x)) class type match_result = object inherit [js_string t] js_array method index : int readonly_prop method input : js_string t readonly_prop end let str_array : string_array t -> js_string t js_array t = Unsafe.coerce let match_result : match_result_handle t -> match_result t = Unsafe.coerce class type number = object method toString : js_string t meth method toString_radix : int -> js_string t meth method toLocaleString : js_string t meth method toFixed : int -> js_string t meth method toExponential : js_string t meth method toExponential_digits : int -> js_string t meth method toPrecision : int -> js_string t meth end external number_of_float : float -> number t = "caml_js_from_float" external float_of_number : number t -> float = "caml_js_to_float" class type date = object method toString : js_string t meth method toDateString : js_string t meth method toTimeString : js_string t meth method toLocaleString : js_string t meth method toLocaleDateString : js_string t meth method toLocaleTimeString : js_string t meth method valueOf : float meth method getTime : float meth method getFullYear : int meth method getUTCFullYear : int meth method getMonth : int meth method getUTCMonth : int meth method getDate : int meth method getUTCDate : int meth method getDay : int meth method getUTCDay : int meth method getHours : int meth method getUTCHours : int meth method getMinutes : int meth method getUTCMinutes : int meth method getSeconds : int meth method getUTCSeconds : int meth method getMilliseconds : int meth method getUTCMilliseconds : int meth method getTimezoneOffset : int meth method setTime : float -> float meth method setFullYear : int -> float meth method setUTCFullYear : int -> float meth method setMonth : int -> float meth method setUTCMonth : int -> float meth method setDate : int -> float meth method setUTCDate : int -> float meth method setDay : int -> float meth method setUTCDay : int -> float meth method setHours : int -> float meth method setUTCHours : int -> float meth method setMinutes : int -> float meth method setUTCMinutes : int -> float meth method setSeconds : int -> float meth method setUTCSeconds : int -> float meth method setMilliseconds : int -> float meth method setUTCMilliseconds : int -> float meth method toUTCString : js_string t meth method toISOString : js_string t meth method toJSON : 'a -> js_string t meth end class type date_constr = object method parse : js_string t -> float meth method _UTC_month : int -> int -> float meth method _UTC_day : int -> int -> float meth method _UTC_hour : int -> int -> int -> int -> float meth method _UTC_min : int -> int -> int -> int -> int -> float meth method _UTC_sec : int -> int -> int -> int -> int -> int -> float meth method _UTC_ms : int -> int -> int -> int -> int -> int -> int -> float meth method now : float meth end let date_constr = Unsafe.global##._Date let date : date_constr t = date_constr let date_now : date t constr = date_constr let date_fromTimeValue : (float -> date t) constr = date_constr let date_month : (int -> int -> date t) constr = date_constr let date_day : (int -> int -> int -> date t) constr = date_constr let date_hour : (int -> int -> int -> int -> date t) constr = date_constr let date_min : (int -> int -> int -> int -> int -> date t) constr = date_constr let date_sec : (int -> int -> int -> int -> int -> int -> date t) constr = date_constr let date_ms : (int -> int -> int -> int -> int -> int -> int -> date t) constr = date_constr class type math = object method _E : float readonly_prop method _LN2 : float readonly_prop method _LN10 : float readonly_prop method _LOG2E : float readonly_prop method _LOG10E : float readonly_prop method _PI : float readonly_prop method _SQRT1_2_ : float readonly_prop method _SQRT2 : float readonly_prop method abs : float -> float meth method acos : float -> float meth method asin : float -> float meth method atan : float -> float meth method atan2 : float -> float -> float meth method ceil : float -> float meth method cos : float -> float meth method exp : float -> float meth method floor : float -> float meth method log : float -> float meth method max : float -> float -> float meth method max_3 : float -> float -> float -> float meth method max_4 : float -> float -> float -> float -> float meth method min : float -> float -> float meth method min_3 : float -> float -> float -> float meth method min_4 : float -> float -> float -> float -> float meth method pow : float -> float -> float meth method random : float meth method round : float -> float meth method sin : float -> float meth method sqrt : float -> float meth method tan : float -> float meth end let math = Unsafe.global##._Math class type error = object method name : js_string t prop method message : js_string t prop method stack : js_string t optdef prop method toString : js_string t meth end exception Error of error t let error_constr = Unsafe.global##._Error let _ = Callback.register_exception "jsError" (Error (Unsafe.obj [||])) let raise_js_error : error t -> 'a = Unsafe.js_expr "(function (exn) { throw exn })" class type json = object method parse : js_string t -> 'a meth method stringify : 'a -> js_string t meth end let _JSON : json t = Unsafe.global##._JSON let decodeURI (s : js_string t) : js_string t = Unsafe.fun_call Unsafe.global##.decodeURI [| Unsafe.inject s |] let decodeURIComponent (s : js_string t) : js_string t = Unsafe.fun_call Unsafe.global##.decodeURIComponent [| Unsafe.inject s |] let encodeURI (s : js_string t) : js_string t = Unsafe.fun_call Unsafe.global##.encodeURI [| Unsafe.inject s |] let encodeURIComponent (s : js_string t) : js_string t = Unsafe.fun_call Unsafe.global##.encodeURIComponent [| Unsafe.inject s |] let escape (s : js_string t) : js_string t = Unsafe.fun_call Unsafe.global##.escape [| Unsafe.inject s |] let unescape (s : js_string t) : js_string t = Unsafe.fun_call Unsafe.global##.unescape [| Unsafe.inject s |] external bool : bool -> bool t = "caml_js_from_bool" external to_bool : bool t -> bool = "caml_js_to_bool" external string : string -> js_string t = "caml_js_from_string" external to_string : js_string t -> string = "caml_js_to_string" external array : 'a array -> 'a js_array t = "caml_js_from_array" external to_array : 'a js_array t -> 'a array = "caml_js_to_array" external bytestring : string -> js_string t = "caml_jsbytes_of_string" external to_bytestring : js_string t -> string = "caml_js_to_byte_string" external typeof : _ t -> js_string t = "caml_js_typeof" external instanceof : _ t -> _ constr -> bool = "caml_js_instanceof" let isNaN (i : 'a) : bool = to_bool (Unsafe.fun_call Unsafe.global##.isNaN [| Unsafe.inject i |]) let parseInt (s : js_string t) : int = let s = Unsafe.fun_call Unsafe.global##.parseInt [| Unsafe.inject s |] in if isNaN s then failwith "parseInt" else s let parseFloat (s : js_string t) : float = let s = Unsafe.fun_call Unsafe.global##.parseFloat [| Unsafe.inject s |] in if isNaN s then failwith "parseFloat" else s let _ = Printexc.register_printer (function | Error e -> Some (to_string e##toString) | _ -> None) let _ = Printexc.register_printer (fun e -> let e : < .. > t = Obj.magic e in if instanceof e array_constructor then None else Some (to_string e##toString)) let string_of_error e = to_string e##toString external get_export_var : unit -> < .. > t = "caml_js_export_var" let export_js (field : js_string t) x = Unsafe.set (get_export_var ()) field x let export field x = export_js (string field) x let export_all obj = let keys = object_keys obj in keys##forEach (wrap_callback (fun (key : js_string t) _ _ -> export_js key (Unsafe.get obj key))) (****) (* DEPRECATED *) type float_prop = float prop external float : float -> float = "%identity" external to_float : float -> float = "%identity" js_of_ocaml-3.5.2/lib/js_of_ocaml/js.mli000066400000000000000000000740451357507750000201570ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Javascript binding This module provides types and functions to interoperate with Javascript values, and gives access to Javascript standard objects. *) (** {2 Dealing with [null] and [undefined] values.} *) type +'a opt (** Type of possibly null values. *) type +'a optdef (** Type of possibly undefined values. *) val null : 'a opt (** The [null] value. *) val some : 'a -> 'a opt (** Consider a value into a possibly null value. *) val undefined : 'a optdef (** The [undefined] value *) val def : 'a -> 'a optdef (** Consider a value into a possibly undefined value. *) (** Signatures of a set of standard functions for manipulating optional values. *) module type OPT = sig type 'a t val empty : 'a t (** No value. *) val return : 'a -> 'a t (** Consider a value as an optional value. *) val map : 'a t -> ('a -> 'b) -> 'b t (** Apply a function to an optional value if it is available. Returns the result of the application. *) val bind : 'a t -> ('a -> 'b t) -> 'b t (** Apply a function returning an optional value to an optional value *) val test : 'a t -> bool (** Returns [true] if a value is available, [false] otherwise. *) val iter : 'a t -> ('a -> unit) -> unit (** Apply a function to an optional value if it is available. *) val case : 'a t -> (unit -> 'b) -> ('a -> 'b) -> 'b (** Pattern matching on optional values. *) val get : 'a t -> (unit -> 'a) -> 'a (** Get the value. If no value available, an alternative function is called to get a default value. *) val option : 'a option -> 'a t (** Convert option type. *) val to_option : 'a t -> 'a option (** Convert to option type. *) end module Opt : OPT with type 'a t = 'a opt (** Standard functions for manipulating possibly null values. *) module Optdef : OPT with type 'a t = 'a optdef (** Standard functions for manipulating possibly undefined values. *) (** {2 Types for specifying method and properties of Javascript objects} *) type +'a t (** Type of Javascript objects. The type parameter is used to specify more precisely an object. *) type +'a meth (** Type used to specify method types: a Javascript object [ t2 -> ... -> tn -> t Js.meth> Js.t] has a Javascript method [m] expecting {i n} arguments of types [t1] to [tn] and returns a value of type [t]. *) type +'a gen_prop (** Type used to specify the properties of Javascript objects. In practice you should rarely need this type directly, but should rather use the type abbreviations below instead. *) type 'a readonly_prop = < get : 'a > gen_prop (** Type of read-only properties: a Javascript object [

Js.t] has a read-only property [p] of type [t]. *) type 'a writeonly_prop = < set : 'a -> unit > gen_prop (** Type of write-only properties: a Javascript object [

Js.t] has a write-only property [p] of type [t]. *) type 'a prop = < get : 'a ; set : 'a -> unit > gen_prop (** Type of read/write properties: a Javascript object [

Js.t] has a read/write property [p] of type [t]. *) type 'a optdef_prop = < get : 'a optdef ; set : 'a -> unit > gen_prop (** Type of read/write properties that may be undefined: you can set them to a value of some type [t], but if you read them, you will get a value of type [t optdef] (that may be [undefined]). *) (** {2 Object constructors} *) type +'a constr (** A value of type [(t1 -> ... -> tn -> t Js.t) Js.constr] is a Javascript constructor expecting {i n} arguments of types [t1] to [tn] and returning a Javascript object of type [t Js.t]. Use the syntax extension [jsnew c (e1, ..., en)] to build an object using constructor [c] and arguments [e1] to [en]. *) (** {2 Callbacks to OCaml} *) type (-'a, +'b) meth_callback (** Type of callback functions. A function of type [(u, t1 -> ... -> tn -> t) meth_callback] can be called from Javascript with [this] bound to a value of type [u] and up to {i n} arguments of types [t1] to [tn]. The system takes care of currification, so less than {i n} arguments can be provided. As a special case, a callback of type [(t, unit -> t) meth_callback] can be called from Javascript with no argument. It will behave as if it was called with a single argument of type [unit]. *) type 'a callback = (unit, 'a) meth_callback (** Type of callback functions intended to be called without a meaningful [this] implicit parameter. *) external wrap_callback : ('a -> 'b) -> ('c, 'a -> 'b) meth_callback = "caml_js_wrap_callback" (** Wrap an OCaml function so that it can be invoked from Javascript. *) external wrap_meth_callback : ('b -> 'a) -> ('b, 'a) meth_callback = "caml_js_wrap_meth_callback" (** Wrap an OCaml function so that it can be invoked from Javascript. The first parameter of the function will be bound to the value of the [this] implicit parameter. *) (** {2 Javascript standard objects} *) val _true : bool t (** Javascript [true] boolean. *) val _false : bool t (** Javascript [false] boolean. *) type match_result_handle (** A handle to a match result. Use function [Js.match_result] to get the corresponding [MatchResult] object. (This type is used to resolved the mutual dependency between string and array type definitions.) *) type string_array (** Opaque type for string arrays. You can get the actual [Array] object using function [Js.str_array]. (This type is used to resolved the mutual dependency between string and array type definitions.) *) (** Specification of Javascript string objects. *) class type js_string = object method toString : js_string t meth method valueOf : js_string t meth method charAt : int -> js_string t meth method charCodeAt : int -> float meth (* This may return NaN... *) method concat : js_string t -> js_string t meth method concat_2 : js_string t -> js_string t -> js_string t meth method concat_3 : js_string t -> js_string t -> js_string t -> js_string t meth method concat_4 : js_string t -> js_string t -> js_string t -> js_string t -> js_string t meth method indexOf : js_string t -> int meth method indexOf_from : js_string t -> int -> int meth method lastIndexOf : js_string t -> int meth method lastIndexOf_from : js_string t -> int -> int meth method localeCompare : js_string t -> float meth method _match : regExp t -> match_result_handle t opt meth method replace : regExp t -> js_string t -> js_string t meth (* FIX: version of replace taking a function... *) method replace_string : js_string t -> js_string t -> js_string t meth method search : regExp t -> int meth method slice : int -> int -> js_string t meth method slice_end : int -> js_string t meth method split : js_string t -> string_array t meth method split_limited : js_string t -> int -> string_array t meth method split_regExp : regExp t -> string_array t meth method split_regExpLimited : regExp t -> int -> string_array t meth method substring : int -> int -> js_string t meth method substring_toEnd : int -> js_string t meth method toLowerCase : js_string t meth method toLocaleLowerCase : js_string t meth method toUpperCase : js_string t meth method toLocaleUpperCase : js_string t meth method trim : js_string t meth method length : int readonly_prop end (** Specification of Javascript regular expression objects. *) and regExp = object method exec : js_string t -> match_result_handle t opt meth method test : js_string t -> bool t meth method toString : js_string t meth method source : js_string t readonly_prop method global : bool t readonly_prop method ignoreCase : bool t readonly_prop method multiline : bool t readonly_prop method lastIndex : int prop end (** Specification of the string constructor, considered as an object. *) class type string_constr = object method fromCharCode : int -> js_string t meth end val string_constr : string_constr t (** The string constructor, as an object. *) val regExp : (js_string t -> regExp t) constr (** Constructor of [RegExp] objects. The expression [jsnew regExp (s)] builds the regular expression specified by string [s]. *) val regExp_withFlags : (js_string t -> js_string t -> regExp t) constr (** Constructor of [RegExp] objects. The expression [jsnew regExp (s, f)] builds the regular expression specified by string [s] using flags [f]. *) val regExp_copy : (regExp t -> regExp t) constr (** Constructor of [RegExp] objects. The expression [jsnew regExp (r)] builds a copy of regular expression [r]. *) (** Specification of Javascript regular arrays. Use [Js.array_get] and [Js.array_set] to access and set array elements. *) class type ['a] js_array = object method toString : js_string t meth method toLocaleString : js_string t meth method concat : 'a js_array t -> 'a js_array t meth method join : js_string t -> js_string t meth method pop : 'a optdef meth method push : 'a -> int meth method push_2 : 'a -> 'a -> int meth method push_3 : 'a -> 'a -> 'a -> int meth method push_4 : 'a -> 'a -> 'a -> 'a -> int meth method reverse : 'a js_array t meth method shift : 'a optdef meth method slice : int -> int -> 'a js_array t meth method slice_end : int -> 'a js_array t meth method sort : ('a -> 'a -> float) callback -> 'a js_array t meth method sort_asStrings : 'a js_array t meth method splice : int -> int -> 'a js_array t meth method splice_1 : int -> int -> 'a -> 'a js_array t meth method splice_2 : int -> int -> 'a -> 'a -> 'a js_array t meth method splice_3 : int -> int -> 'a -> 'a -> 'a -> 'a js_array t meth method splice_4 : int -> int -> 'a -> 'a -> 'a -> 'a -> 'a js_array t meth method unshift : 'a -> int meth method unshift_2 : 'a -> 'a -> int meth method unshift_3 : 'a -> 'a -> 'a -> int meth method unshift_4 : 'a -> 'a -> 'a -> 'a -> int meth method some : ('a -> int -> 'a js_array t -> bool t) callback -> bool t meth method every : ('a -> int -> 'a js_array t -> bool t) callback -> bool t meth method forEach : ('a -> int -> 'a js_array t -> unit) callback -> unit meth method map : ('a -> int -> 'a js_array t -> 'b) callback -> 'b js_array t meth method filter : ('a -> int -> 'a js_array t -> bool t) callback -> 'a js_array t meth method reduce_init : ('b -> 'a -> int -> 'a js_array t -> 'b) callback -> 'b -> 'b meth method reduce : ('a -> 'a -> int -> 'a js_array t -> 'a) callback -> 'a meth method reduceRight_init : ('b -> 'a -> int -> 'a js_array t -> 'b) callback -> 'b -> 'b meth method reduceRight : ('a -> 'a -> int -> 'a js_array t -> 'a) callback -> 'a meth method length : int prop end val object_keys : 'a t -> js_string t js_array t (** Returns jsarray containing keys of the object as Object.keys does. *) val array_empty : 'a js_array t constr (** Constructor of [Array] objects. The expression [jsnew array_empty ()] returns an empty array. *) val array_length : (int -> 'a js_array t) constr (** Constructor of [Array] objects. The expression [jsnew array_length (l)] returns an array of length [l]. *) val array_get : 'a #js_array t -> int -> 'a optdef (** Array access: [array_get a i] returns the element at index [i] of array [a]. Returns [undefined] if there is no element at this index. *) val array_set : 'a #js_array t -> int -> 'a -> unit (** Array update: [array_set a i v] puts [v] at index [i] in array [a]. *) val array_map : ('a -> 'b) -> 'a #js_array t -> 'b #js_array t (** Array map: [array_map f a] is [a##map(wrap_callback (fun elt idx arr -> f elt))]. *) val array_mapi : (int -> 'a -> 'b) -> 'a #js_array t -> 'b #js_array t (** Array mapi: [array_mapi f a] is [a##map(wrap_callback (fun elt idx arr -> f idx elt))]. *) (** Specification of match result objects *) class type match_result = object inherit [js_string t] js_array method index : int readonly_prop method input : js_string t readonly_prop end val str_array : string_array t -> js_string t js_array t (** Convert an opaque [string_array t] object into an array of string. (Used to resolved the mutual dependency between string and array type definitions.) *) val match_result : match_result_handle t -> match_result t (** Convert a match result handle into a [MatchResult] object. (Used to resolved the mutual dependency between string and array type definitions.) *) (** Specification of Javascript number objects. *) class type number = object method toString : js_string t meth method toString_radix : int -> js_string t meth method toLocaleString : js_string t meth method toFixed : int -> js_string t meth method toExponential : js_string t meth method toExponential_digits : int -> js_string t meth method toPrecision : int -> js_string t meth end external number_of_float : float -> number t = "caml_js_from_float" (** Conversion of OCaml floats to Javascript number objects. *) external float_of_number : number t -> float = "caml_js_to_float" (** Conversion of Javascript number objects to OCaml floats. *) (** Specification of Javascript date objects. *) class type date = object method toString : js_string t meth method toDateString : js_string t meth method toTimeString : js_string t meth method toLocaleString : js_string t meth method toLocaleDateString : js_string t meth method toLocaleTimeString : js_string t meth method valueOf : float meth method getTime : float meth method getFullYear : int meth method getUTCFullYear : int meth method getMonth : int meth method getUTCMonth : int meth method getDate : int meth method getUTCDate : int meth method getDay : int meth method getUTCDay : int meth method getHours : int meth method getUTCHours : int meth method getMinutes : int meth method getUTCMinutes : int meth method getSeconds : int meth method getUTCSeconds : int meth method getMilliseconds : int meth method getUTCMilliseconds : int meth method getTimezoneOffset : int meth method setTime : float -> float meth method setFullYear : int -> float meth method setUTCFullYear : int -> float meth method setMonth : int -> float meth method setUTCMonth : int -> float meth method setDate : int -> float meth method setUTCDate : int -> float meth method setDay : int -> float meth method setUTCDay : int -> float meth method setHours : int -> float meth method setUTCHours : int -> float meth method setMinutes : int -> float meth method setUTCMinutes : int -> float meth method setSeconds : int -> float meth method setUTCSeconds : int -> float meth method setMilliseconds : int -> float meth method setUTCMilliseconds : int -> float meth method toUTCString : js_string t meth method toISOString : js_string t meth method toJSON : 'a -> js_string t meth end val date_now : date t constr (** Constructor of [Date] objects: [jsnew date_now ()] returns a [Date] object initialized with the current date. *) val date_fromTimeValue : (float -> date t) constr (** Constructor of [Date] objects: [jsnew date_fromTimeValue (t)] returns a [Date] object initialized with the time value [t]. *) val date_month : (int -> int -> date t) constr (** Constructor of [Date] objects: [jsnew date_fromTimeValue (y, m)] returns a [Date] object corresponding to year [y] and month [m]. *) val date_day : (int -> int -> int -> date t) constr (** Constructor of [Date] objects: [jsnew date_fromTimeValue (y, m, d)] returns a [Date] object corresponding to year [y], month [m] and day [d]. *) val date_hour : (int -> int -> int -> int -> date t) constr (** Constructor of [Date] objects: [jsnew date_fromTimeValue (y, m, d, h)] returns a [Date] object corresponding to year [y] to hour [h]. *) val date_min : (int -> int -> int -> int -> int -> date t) constr (** Constructor of [Date] objects: [jsnew date_fromTimeValue (y, m, d, h, m')] returns a [Date] object corresponding to year [y] to minute [m']. *) val date_sec : (int -> int -> int -> int -> int -> int -> date t) constr (** Constructor of [Date] objects: [jsnew date_fromTimeValue (y, m, d, h, m', s)] returns a [Date] object corresponding to year [y] to second [s]. *) val date_ms : (int -> int -> int -> int -> int -> int -> int -> date t) constr (** Constructor of [Date] objects: [jsnew date_fromTimeValue (y, m, d, h, m', s, ms)] returns a [Date] object corresponding to year [y] to millisecond [ms]. *) (** Specification of the date constructor, considered as an object. *) class type date_constr = object method parse : js_string t -> float meth method _UTC_month : int -> int -> float meth method _UTC_day : int -> int -> float meth method _UTC_hour : int -> int -> int -> int -> float meth method _UTC_min : int -> int -> int -> int -> int -> float meth method _UTC_sec : int -> int -> int -> int -> int -> int -> float meth method _UTC_ms : int -> int -> int -> int -> int -> int -> int -> float meth method now : float meth end val date : date_constr t (** The date constructor, as an object. *) (** Specification of Javascript math object. *) class type math = object method _E : float readonly_prop method _LN2 : float readonly_prop method _LN10 : float readonly_prop method _LOG2E : float readonly_prop method _LOG10E : float readonly_prop method _PI : float readonly_prop method _SQRT1_2_ : float readonly_prop method _SQRT2 : float readonly_prop method abs : float -> float meth method acos : float -> float meth method asin : float -> float meth method atan : float -> float meth method atan2 : float -> float -> float meth method ceil : float -> float meth method cos : float -> float meth method exp : float -> float meth method floor : float -> float meth method log : float -> float meth method max : float -> float -> float meth method max_3 : float -> float -> float -> float meth method max_4 : float -> float -> float -> float -> float meth method min : float -> float -> float meth method min_3 : float -> float -> float -> float meth method min_4 : float -> float -> float -> float -> float meth method pow : float -> float -> float meth method random : float meth method round : float -> float meth method sin : float -> float meth method sqrt : float -> float meth method tan : float -> float meth end val math : math t (** The Math object *) (** Specification of Javascript error object. *) class type error = object method name : js_string t prop method message : js_string t prop method stack : js_string t optdef prop method toString : js_string t meth end val error_constr : (js_string t -> error t) constr (** Constructor of [Error] objects: [jsnew error_constr (msg)] returns an [Error] object with the message [msg]. *) val string_of_error : error t -> string val raise_js_error : error t -> 'a exception Error of error t (** The [Error] exception wrap javascript exceptions when caught by OCaml code. In case the javascript exception is not an instance of javascript [Error], it will be serialized and wrapped into a [Failure] exception. *) (** Specification of Javascript JSON object. *) class type json = object method parse : js_string t -> 'a meth method stringify : 'a -> js_string t meth end val _JSON : json t (** JSON object *) (** {2 Standard Javascript functions} *) val decodeURI : js_string t -> js_string t (** Decode a URI: replace by the corresponding byte all escape sequences but the ones corresponding to a URI reserved character and convert the string from UTF-8 to UTF-16. *) val decodeURIComponent : js_string t -> js_string t (** Decode a URIComponent: replace all escape sequences by the corresponding byte and convert the string from UTF-8 to UTF-16. *) val encodeURI : js_string t -> js_string t (** Encode a URI: convert the string to UTF-8 and replace all unsafe bytes by the corresponding escape sequence. *) val encodeURIComponent : js_string t -> js_string t (** Same as [encodeURI], but also encode URI reserved characters. *) val escape : js_string t -> js_string t (** Escape a string: unsafe UTF-16 code points are replaced by 2-digit and 4-digit escape sequences. *) val unescape : js_string t -> js_string t (** Unescape a string: 2-digit and 4-digit escape sequences are replaced by the corresponding UTF-16 code point. *) val isNaN : 'a -> bool val parseInt : js_string t -> int val parseFloat : js_string t -> float (** {2 Conversion functions between Javascript and OCaml types} *) external bool : bool -> bool t = "caml_js_from_bool" (** Conversion of booleans from OCaml to Javascript. *) external to_bool : bool t -> bool = "caml_js_to_bool" (** Conversion of booleans from Javascript to OCaml. *) external string : string -> js_string t = "caml_js_from_string" (** Conversion of strings from OCaml to Javascript. (The OCaml string is considered to be encoded in UTF-8 and is converted to UTF-16.) *) external to_string : js_string t -> string = "caml_js_to_string" (** Conversion of strings from Javascript to OCaml. *) external array : 'a array -> 'a js_array t = "caml_js_from_array" (** Conversion of arrays from OCaml to Javascript. *) external to_array : 'a js_array t -> 'a array = "caml_js_to_array" (** Conversion of arrays from Javascript to OCaml. *) external bytestring : string -> js_string t = "caml_jsbytes_of_string" (** Conversion of strings of bytes from OCaml to Javascript. (Each byte will be converted in an UTF-16 code point.) *) external to_bytestring : js_string t -> string = "caml_js_to_byte_string" (** Conversion of strings of bytes from Javascript to OCaml. (The Javascript string should only contain UTF-16 code points below 255.) *) (** {2 Convenience coercion functions} *) val coerce : 'a -> ('a -> 'b Opt.t) -> ('a -> 'b) -> 'b (** Apply a possibly failing coercion function. [coerce v c f] attempts to apply coercion [c] to value [v]. If the coercion returns [null], function [f] is called. *) val coerce_opt : 'a Opt.t -> ('a -> 'b Opt.t) -> ('a -> 'b) -> 'b (** Apply a possibly failing coercion function. [coerce_opt v c f] attempts to apply coercion [c] to value [v]. If [v] is [null] or the coercion returns [null], function [f] is called. Typical usage is the following: {[Js.coerce_opt (Dom_html.document##getElementById id) Dom_html.CoerceTo.div (fun _ -> assert false)]} *) (** {2 Type checking operators.} *) external typeof : _ t -> js_string t = "caml_js_typeof" (** Returns the type of a Javascript object. *) external instanceof : _ t -> _ constr -> bool = "caml_js_instanceof" (** Tests whether a Javascript object is an instance of a given class. *) (** {2 Debugging operations.} *) external debugger : unit -> unit = "debugger" (** Invokes any available debugging functionality. If no debugging functionality is available, it has no effect. In practice, it will insert a "debugger;" statement in the generated javascript. *) (** {2 Export functionality.} Export values to [module.exports] if it exists or to the global object otherwise. *) val export : string -> 'a -> unit (** [export name value] export [name] *) val export_all : 'a t -> unit (** [export_all obj] export every key of [obj] object. {[ export_all object%js method add x y = x +. y method abs x = abs_float x val zero = 0. end ]} *) (** {2 Unsafe operations.} *) (** Unsafe Javascript operations *) module Unsafe : sig type top type any = top t (** Top type. Used for putting values of different types in a same array. *) type any_js_array = any external inject : 'a -> any = "%identity" (** Coercion to top type. *) external coerce : _ t -> _ t = "%identity" (** Unsafe coercion between to Javascript objects. *) external get : 'a -> 'b -> 'c = "caml_js_get" (** Get the value of an object property. The expression [get o s] returns the value of property [s] of object [o]. *) external set : 'a -> 'b -> 'c -> unit = "caml_js_set" (** Set an object property. The expression [set o s v] set the property [s] of object [o] to value [v]. *) external delete : 'a -> 'b -> unit = "caml_js_delete" (** Delete an object property. The expression [delete o s] deletes property [s] of object [o]. *) external call : 'a -> 'b -> any array -> 'c = "caml_js_call" (** Performs a Javascript function call. The expression [call f o a] calls the Javascript function [f] with the arguments given by the array [a], and binding [this] to [o]. *) external fun_call : 'a -> any array -> 'b = "caml_js_fun_call" (** Performs a Javascript function call. The expression [fun_call f a] calls the Javascript function [f] with the arguments given by the array [a]. *) external meth_call : 'a -> string -> any array -> 'b = "caml_js_meth_call" (** Performs a Javascript method call. The expression [meth_call o m a] calls the Javascript method [m] of object [o] with the arguments given by the array [a]. *) external new_obj : 'a -> any array -> 'b = "caml_js_new" (** Create a Javascript object. The expression [new_obj c a] creates a Javascript object with constructor [c] using the arguments given by the array [a]. *) external new_obj_arr : 'a -> any_js_array -> 'b = "caml_ojs_new_arr" (** Same Create a Javascript object. The expression [new_obj_arr c a] creates a Javascript object with constructor [c] using the arguments given by the Javascript array [a]. *) external obj : (string * any) array -> 'a = "caml_js_object" (** Creates a Javascript literal object. The expression [obj a] creates a Javascript object whose fields are given by the array [a] *) external pure_expr : (unit -> 'a) -> 'a = "caml_js_pure_expr" (** Asserts that an expression is pure, and can therefore be optimized away by the compiler if unused. *) external eval_string : string -> 'a = "caml_js_eval_string" (** Evaluate Javascript code *) external js_expr : string -> 'a = "caml_js_expr" (** [js_expr e] will parse the JavaScript expression [e] if [e] is available at compile time or will fallback to a runtime evaluation. See [eval_string] *) external pure_js_expr : string -> 'a = "caml_pure_js_expr" (** [pure_js_expr str] behaves like [pure_expr (fun () -> js_expr str)]. *) val global : < .. > t (** Javascript global object *) external callback : ('a -> 'b) -> ('c, 'a -> 'b) meth_callback = "%identity" (** Wrap an OCaml function so that it can be invoked from Javascript. Contrary to [Js.wrap_callback], partial application and over-application are not supported: missing arguments will be set to [undefined] and extra arguments are lost. *) external callback_with_arguments : (any_js_array -> 'b) -> ('c, any_js_array -> 'b) meth_callback = "caml_js_wrap_callback_arguments" (** Wrap an OCaml function so that it can be invoked from Javascript. The first parameter of the function will be bound to the [arguments] JavaScript *) external callback_with_arity : int -> ('a -> 'b) -> ('c, 'a -> 'b) meth_callback = "caml_js_wrap_callback_strict" external meth_callback : ('b -> 'a) -> ('b, 'a) meth_callback = "caml_js_wrap_meth_callback_unsafe" (** Wrap an OCaml function so that it can be invoked from Javascript. The first parameter of the function will be bound to the value of the [this] implicit parameter. Contrary to [Js.wrap_meth_callback], partial application and over-application is not supported: missing arguments will be set to [undefined] and extra arguments are lost. *) external meth_callback_with_arguments : ('b -> any_js_array -> 'a) -> ('b, any_js_array -> 'a) meth_callback = "caml_js_wrap_meth_callback_arguments" (** Wrap an OCaml function so that it can be invoked from Javascript. The first parameter of the function will be bound to the value of the [this] implicit parameter. The second parameter of the function with be bound to the value of the [arguments]. *) external meth_callback_with_arity : int -> ('b -> 'a) -> ('b, 'a) meth_callback = "caml_js_wrap_meth_callback_strict" (** {3 Deprecated functions.} *) external variable : string -> 'a = "caml_js_var" (** Access a Javascript variable. [variable "foo"] will return the current value of variable [foo]. *) end (** {2 Deprecated functions and types.} *) external float : float -> float = "%identity" (** Conversion of OCaml floats to Javascript numbers. *) external to_float : float -> float = "%identity" (** Conversion of Javascript numbers to OCaml floats. *) type float_prop = float prop (** Type of float properties. *) js_of_ocaml-3.5.2/lib/js_of_ocaml/js_of_ocaml.ml000066400000000000000000000027121357507750000216350ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module CSS = CSS module Dom = Dom module Dom_events = Dom_events module Dom_html = Dom_html module Dom_svg = Dom_svg module EventSource = EventSource module File = File module Firebug = Firebug module Form = Form module Geolocation = Geolocation module Intl = Intl module Js = Js module Json = Json module Jstable = Jstable module MutationObserver = MutationObserver module ResizeObserver = ResizeObserver module Regexp = Regexp module Sys_js = Sys_js module Typed_array = Typed_array module Url = Url module WebGL = WebGL module WebSockets = WebSockets module Worker = Worker module XmlHttpRequest = XmlHttpRequest js_of_ocaml-3.5.2/lib/js_of_ocaml/js_of_ocaml_stubs.c000066400000000000000000000146161357507750000226750ustar00rootroot00000000000000#include #include void bigstring_of_array_buffer () { fprintf(stderr, "Unimplemented Javascript primitive bigstring_of_array_buffer!\n"); exit(1); } void bigstring_of_typed_array () { fprintf(stderr, "Unimplemented Javascript primitive bigstring_of_typed_array!\n"); exit(1); } void bigstring_to_array_buffer () { fprintf(stderr, "Unimplemented Javascript primitive bigstring_to_array_buffer!\n"); exit(1); } void bigstring_to_typed_array () { fprintf(stderr, "Unimplemented Javascript primitive bigstring_to_typed_array!\n"); exit(1); } void caml_create_file () { fprintf(stderr, "Unimplemented Javascript primitive caml_create_file!\n"); exit(1); } void caml_js_call () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_call!\n"); exit(1); } void caml_js_delete () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_delete!\n"); exit(1); } void caml_js_equals () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_equals!\n"); exit(1); } void caml_js_eval_string () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_eval_string!\n"); exit(1); } void caml_js_export_var () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_export_var!\n"); exit(1); } void caml_js_expr () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_expr!\n"); exit(1); } void caml_js_from_array () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_from_array!\n"); exit(1); } void caml_js_from_bool () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_from_bool!\n"); exit(1); } void caml_js_from_float () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_from_float!\n"); exit(1); } void caml_js_from_string () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_from_string!\n"); exit(1); } void caml_js_fun_call () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_fun_call!\n"); exit(1); } void caml_js_get () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_get!\n"); exit(1); } void caml_js_get_console () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_get_console!\n"); exit(1); } void caml_js_html_entities () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_html_entities!\n"); exit(1); } void caml_js_html_escape () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_html_escape!\n"); exit(1); } void caml_js_instanceof () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_instanceof!\n"); exit(1); } void caml_js_meth_call () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_meth_call!\n"); exit(1); } void caml_js_new () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_new!\n"); exit(1); } void caml_js_object () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_object!\n"); exit(1); } void caml_js_on_ie () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_on_ie!\n"); exit(1); } void caml_js_pure_expr () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_pure_expr!\n"); exit(1); } void caml_js_set () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_set!\n"); exit(1); } void caml_js_to_array () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_to_array!\n"); exit(1); } void caml_js_to_bool () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_to_bool!\n"); exit(1); } void caml_js_to_byte_string () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_to_byte_string!\n"); exit(1); } void caml_js_to_float () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_to_float!\n"); exit(1); } void caml_js_to_string () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_to_string!\n"); exit(1); } void caml_js_typeof () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_typeof!\n"); exit(1); } void caml_js_var () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_var!\n"); exit(1); } void caml_js_wrap_callback () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_wrap_callback!\n"); exit(1); } void caml_js_wrap_callback_arguments () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_wrap_callback_arguments!\n"); exit(1); } void caml_js_wrap_callback_strict () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_wrap_callback_strict!\n"); exit(1); } void caml_js_wrap_meth_callback () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_wrap_meth_callback!\n"); exit(1); } void caml_js_wrap_meth_callback_arguments () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_wrap_meth_callback_arguments!\n"); exit(1); } void caml_js_wrap_meth_callback_strict () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_wrap_meth_callback_strict!\n"); exit(1); } void caml_js_wrap_meth_callback_unsafe () { fprintf(stderr, "Unimplemented Javascript primitive caml_js_wrap_meth_callback_unsafe!\n"); exit(1); } void caml_jsbytes_of_string () { fprintf(stderr, "Unimplemented Javascript primitive caml_jsbytes_of_string!\n"); exit(1); } void caml_json () { fprintf(stderr, "Unimplemented Javascript primitive caml_json!\n"); exit(1); } void caml_list_mount_point () { fprintf(stderr, "Unimplemented Javascript primitive caml_list_mount_point!\n"); exit(1); } void caml_ml_set_channel_output () { fprintf(stderr, "Unimplemented Javascript primitive caml_ml_set_channel_output!\n"); exit(1); } void caml_ml_set_channel_refill () { fprintf(stderr, "Unimplemented Javascript primitive caml_ml_set_channel_refill!\n"); exit(1); } void caml_mount_autoload () { fprintf(stderr, "Unimplemented Javascript primitive caml_mount_autoload!\n"); exit(1); } void caml_ojs_new_arr () { fprintf(stderr, "Unimplemented Javascript primitive caml_ojs_new_arr!\n"); exit(1); } void caml_pure_js_expr () { fprintf(stderr, "Unimplemented Javascript primitive caml_pure_js_expr!\n"); exit(1); } void caml_read_file_content () { fprintf(stderr, "Unimplemented Javascript primitive caml_read_file_content!\n"); exit(1); } void caml_string_of_array () { fprintf(stderr, "Unimplemented Javascript primitive caml_string_of_array!\n"); exit(1); } void caml_unmount () { fprintf(stderr, "Unimplemented Javascript primitive caml_unmount!\n"); exit(1); } void debugger () { fprintf(stderr, "Unimplemented Javascript primitive debugger!\n"); exit(1); } js_of_ocaml-3.5.2/lib/js_of_ocaml/json.ml000066400000000000000000000044031357507750000203320ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright Grégoire Henry 2010. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open! Import class type json = object method parse : 'a. js_string t -> 'a meth method parse_ : 'a 'b 'c 'd. js_string t -> ('b t, js_string t -> 'c -> 'd) meth_callback -> 'a meth method stringify : 'a. 'a -> js_string t meth (* Beware that this is only works when the function argument expects exactly two arguments (no curryfication is performed). *) method stringify_ : 'a 'b 'c 'd. 'a -> (js_string t -> 'c -> 'd) -> js_string t meth end external get_json : unit -> json t = "caml_json" let json = get_json () external unsafe_equals : 'a -> 'b -> bool = "caml_js_equals" external to_byte_MlBytes : js_string t -> 'a t = "caml_js_to_byte_string" external to_byte_jsstring : 'a t -> js_string t = "caml_jsbytes_of_string" let input_reviver = let reviver _this _key value = if unsafe_equals (typeof value) (typeof (string "foo")) then to_byte_MlBytes (Unsafe.coerce value) else value in wrap_meth_callback reviver let unsafe_input s = json##parse_ s input_reviver class type obj = object method constructor : 'a. 'a constr Js.readonly_prop end let mlString_constr = let dummy_string = "" in let dummy_obj : obj t = Obj.magic dummy_string in dummy_obj##.constructor let output_reviver _key value = if instanceof value mlString_constr then to_byte_jsstring (Unsafe.coerce value) else value let output obj = json##stringify_ obj output_reviver js_of_ocaml-3.5.2/lib/js_of_ocaml/json.mli000066400000000000000000000021771357507750000205110ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright Grégoire Henry 2010. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Unsafe IO. (See {!Deriving_Json} for typesafe IO) *) val output : 'a -> Js.js_string Js.t (** Marshal any OCaml value into this JSON representation. *) val unsafe_input : Js.js_string Js.t -> 'a (** Unmarshal a string in JSON format as an OCaml value (unsafe but fast !). *) js_of_ocaml-3.5.2/lib/js_of_ocaml/jstable.ml000066400000000000000000000033141357507750000210050ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright Pierre Chambart 2012. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import type 'a t = < > Js.t let obj = Js.Unsafe.global##._Object let create () : 'a t = new%js obj let add (t : 'a t) (k : Js.js_string Js.t) (v : 'a) = (* '_' is added to avoid conflicts with objects methods *) Js.Unsafe.set t (k##concat (Js.string "_")) v let remove (t : 'a t) (k : Js.js_string Js.t) = Js.Unsafe.delete t (k##concat (Js.string "_")) let find (t : 'a t) (k : Js.js_string Js.t) : 'a Js.Optdef.t = Js.Unsafe.get t (k##concat (Js.string "_")) let keys (t : 'a t) : Js.js_string Js.t list = let key_array : Js.js_string Js.t Js.js_array Js.t = Js.Unsafe.global##._Object##keys t in let res = ref [] in for i = 0 to pred key_array##.length do let key = Js.Optdef.get (Js.array_get key_array i) (fun () -> failwith "Jstable.keys") in res := key##substring 0 (pred key##.length) :: !res done; List.rev !res js_of_ocaml-3.5.2/lib/js_of_ocaml/jstable.mli000066400000000000000000000024351357507750000211610ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright Pierre Chambart 2012. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** A minimal table implementation specialized for {!Js.js_string} keys. This is faster than regular OCaml hashtables. This implementation does not emulate the backtracking behavior of {!Hashtbl}. *) type 'a t val create : unit -> 'a t val add : 'a t -> Js.js_string Js.t -> 'a -> unit val remove : 'a t -> Js.js_string Js.t -> unit val find : 'a t -> Js.js_string Js.t -> 'a Js.optdef val keys : 'a t -> Js.js_string Js.t list js_of_ocaml-3.5.2/lib/js_of_ocaml/mutationObserver.ml000066400000000000000000000073231357507750000227350ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2015 Stéphane Legrand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import class type mutationObserverInit = object method childList : bool Js.writeonly_prop method attributes : bool Js.writeonly_prop method characterData : bool Js.writeonly_prop method subtree : bool Js.writeonly_prop method attributeOldValue : bool Js.writeonly_prop method characterDataOldValue : bool Js.writeonly_prop method attributeFilter : Js.js_string Js.t Js.js_array Js.t Js.writeonly_prop end class type mutationRecord = object method _type : Js.js_string Js.t Js.readonly_prop method target : Dom.node Js.t Js.readonly_prop method addedNodes : Dom.node Dom.nodeList Js.t Js.readonly_prop method removedNodes : Dom.node Dom.nodeList Js.t Js.readonly_prop method previousSibling : Dom.node Js.t Js.opt Js.readonly_prop method nextSibling : Dom.node Js.t Js.opt Js.readonly_prop method attributeName : Js.js_string Js.t Js.opt Js.readonly_prop method attributeNamespace : Js.js_string Js.t Js.opt Js.readonly_prop method oldValue : Js.js_string Js.t Js.opt Js.readonly_prop end class type mutationObserver = object method observe : #Dom.node Js.t -> mutationObserverInit Js.t -> unit Js.meth method disconnect : unit Js.meth method takeRecords : mutationRecord Js.t Js.js_array Js.t Js.meth end let empty_mutation_observer_init () : mutationObserverInit Js.t = Js.Unsafe.obj [||] let mutationObserver = Js.Unsafe.global##._MutationObserver let is_supported () = Js.Optdef.test mutationObserver let mutationObserver : ( (mutationRecord Js.t Js.js_array Js.t -> mutationObserver Js.t -> unit) Js.callback -> mutationObserver Js.t) Js.constr = mutationObserver let observe ~(node : #Dom.node Js.t) ~(f : mutationRecord Js.t Js.js_array Js.t -> mutationObserver Js.t -> unit) ?(child_list : bool option) ?(attributes : bool option) ?(character_data : bool option) ?(subtree : bool option) ?(attribute_old_value : bool option) ?(character_data_old_value : bool option) ?(attribute_filter : Js.js_string Js.t list option) () : mutationObserver Js.t = let opt_iter x f = match x with | None -> () | Some x -> f x in let obs = new%js mutationObserver (Js.wrap_callback f) in let cfg = empty_mutation_observer_init () in let () = opt_iter child_list (fun v -> cfg##.childList := v) in let () = opt_iter attributes (fun v -> cfg##.attributes := v) in let () = opt_iter character_data (fun v -> cfg##.characterData := v) in let () = opt_iter subtree (fun v -> cfg##.subtree := v) in let () = opt_iter attribute_old_value (fun v -> cfg##.attributeOldValue := v) in let () = opt_iter character_data_old_value (fun v -> cfg##.characterDataOldValue := v) in let () = opt_iter attribute_filter (fun l -> cfg##.attributeFilter := Js.array (Array.of_list l)) in let () = obs##observe node cfg in obs js_of_ocaml-3.5.2/lib/js_of_ocaml/mutationObserver.mli000066400000000000000000000070621357507750000231060ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2015 Stéphane Legrand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** MutationObserver API A code example: {[ if (MutationObserver.is_supported()) then let doc = Dom_html.document in let target = Js.Opt.get (doc##getElementById (Js.string "observed")) (fun () -> assert false) in let node = (target :> Dom.node Js.t) in let f records observer = Firebug.console##debug records ; Firebug.console##debug observer in MutationObserver.observe ~node ~f ~attributes:true ~child_list:true ~character_data:true () ]} @see for API documentation. @see for the Web Hypertext Application Technology Working Group (WHATWG) spec. *) class type mutationObserverInit = object method childList : bool Js.writeonly_prop method attributes : bool Js.writeonly_prop method characterData : bool Js.writeonly_prop method subtree : bool Js.writeonly_prop method attributeOldValue : bool Js.writeonly_prop method characterDataOldValue : bool Js.writeonly_prop method attributeFilter : Js.js_string Js.t Js.js_array Js.t Js.writeonly_prop end class type mutationRecord = object method _type : Js.js_string Js.t Js.readonly_prop method target : Dom.node Js.t Js.readonly_prop method addedNodes : Dom.node Dom.nodeList Js.t Js.readonly_prop method removedNodes : Dom.node Dom.nodeList Js.t Js.readonly_prop method previousSibling : Dom.node Js.t Js.opt Js.readonly_prop method nextSibling : Dom.node Js.t Js.opt Js.readonly_prop method attributeName : Js.js_string Js.t Js.opt Js.readonly_prop method attributeNamespace : Js.js_string Js.t Js.opt Js.readonly_prop method oldValue : Js.js_string Js.t Js.opt Js.readonly_prop end class type mutationObserver = object method observe : #Dom.node Js.t -> mutationObserverInit Js.t -> unit Js.meth method disconnect : unit Js.meth method takeRecords : mutationRecord Js.t Js.js_array Js.t Js.meth end val empty_mutation_observer_init : unit -> mutationObserverInit Js.t val mutationObserver : ( (mutationRecord Js.t Js.js_array Js.t -> mutationObserver Js.t -> unit) Js.callback -> mutationObserver Js.t) Js.constr val is_supported : unit -> bool val observe : node:#Dom.node Js.t -> f:(mutationRecord Js.t Js.js_array Js.t -> mutationObserver Js.t -> unit) -> ?child_list:bool -> ?attributes:bool -> ?character_data:bool -> ?subtree:bool -> ?attribute_old_value:bool -> ?character_data_old_value:bool -> ?attribute_filter:Js.js_string Js.t list -> unit -> mutationObserver Js.t (** Helper to create a new observer and connect it to a node *) js_of_ocaml-3.5.2/lib/js_of_ocaml/regexp.ml000066400000000000000000000062431357507750000206570ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Raphaël Proust, Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import type regexp = Js.regExp Js.t type result = Js.match_result Js.t let regexp s = new%js Js.regExp_withFlags (Js.bytestring s) (Js.string "g") let regexp_case_fold s = new%js Js.regExp_withFlags (Js.bytestring s) (Js.string "gi") let regexp_with_flag s f = new%js Js.regExp_withFlags (Js.bytestring s) (Js.string ("g" ^ f)) let blunt_str_array_get a i = Js.to_bytestring (Js.Optdef.get (Js.array_get a i) (fun () -> assert false)) let string_match r s i = r##.lastIndex := i; Js.Opt.to_option (Js.Opt.map (r##exec (Js.bytestring s)) Js.match_result) let search r s i = r##.lastIndex := i; Js.Opt.to_option (Js.Opt.map (r##exec (Js.bytestring s)) (fun res_pre -> let res = Js.match_result res_pre in res##.index, res)) let search_forward = search let matched_string r = blunt_str_array_get r 0 let matched_group r i = Js.Optdef.to_option (Js.Optdef.map (Js.array_get r i) Js.to_bytestring) let quote_repl_re = new%js Js.regExp_withFlags (Js.string "[$]") (Js.string "g") let quote_repl s = (Js.bytestring s)##replace quote_repl_re (Js.string "$$$$") let global_replace r s s_by = r##.lastIndex := 0; Js.to_bytestring (Js.bytestring s) ## (replace r (quote_repl s_by)) let replace_first r s s_by = let flags = match Js.to_bool r##.ignoreCase, Js.to_bool r##.multiline with | false, false -> Js.string "" | false, true -> Js.string "m" | true, false -> Js.string "i" | true, true -> Js.string "mi" in let r' = new%js Js.regExp_withFlags r##.source flags in Js.to_bytestring (Js.bytestring s) ## (replace r' (quote_repl s_by)) let list_of_js_array a = let rec aux accu idx = if idx < 0 then accu else aux (blunt_str_array_get a idx :: accu) (idx - 1) in aux [] (a##.length - 1) let split r s = r##.lastIndex := 0; list_of_js_array (Js.str_array (Js.bytestring s) ## (split_regExp r)) let bounded_split r s i = r##.lastIndex := 0; list_of_js_array (Js.str_array (Js.bytestring s) ## (split_regExpLimited r i)) (* More constructors *) let quote_re = regexp "[\\][()\\\\|+*.?{}^$]" let quote s = Js.to_bytestring (Js.bytestring s) ## (replace quote_re (Js.string "\\$&")) let regexp_string s = regexp (quote s) let regexp_string_case_fold s = regexp_case_fold (quote s) js_of_ocaml-3.5.2/lib/js_of_ocaml/regexp.mli000066400000000000000000000067741357507750000210410ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Raphaël Proust, Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Types for regexps. *) (** {i Warning:} the regexp syntax is the javascript one. It differs from the syntax used by the [Str] module from the OCaml standard library. @see Regexp object on Mozilla Developer Network. *) type regexp (** The type for regexps. *) type result (** The type for match result. *) (** Constructors *) val regexp : string -> regexp (** Simple regexp constructor. *) val regexp_case_fold : string -> regexp (** Same as [regexp] but matching will be performed in a case insensitive way. *) val regexp_with_flag : string -> string -> regexp (** Regexp constructor with flag that allow for case-insensitive search or multiline search (the global flag is always set). *) val quote : string -> string (** Escapes characters with special meaning in the regexp context. *) val regexp_string : string -> regexp (** [regexp_string s] creates a regexp matching the exact string [s]. *) val regexp_string_case_fold : string -> regexp (** Same as [regexp_string] but matching will be performed in a case insensitive way. *) (** Functions *) val string_match : regexp -> string -> int -> result option (** [string_match r s i] matches the string [s] starting from the [i]th character. Evaluates to [None] if [s] (from the [i]th character) doesn't match [r]. *) val search : regexp -> string -> int -> (int * result) option (** [search r s i] evaluates to the index of the match and the match result or [None] if [s] (starting from [i]) doesn't match [r]. *) val search_forward : regexp -> string -> int -> (int * result) option (** Same as [search]. *) val matched_string : result -> string (** [matched_string r] return the exact substring that matched when evaluating [r]. *) val matched_group : result -> int -> string option (** [matched_group r i] is the [i]th group matched. Groups in matches are * obtained with parentheses. Groups are 1-based. *) val global_replace : regexp -> string -> string -> string (** [global_replace r s by] replaces all of the matches of [r] in [s] by [by]. *) val replace_first : regexp -> string -> string -> string (** [replace_first r s by] replaces the first match of [r] in [s] by [by]. *) val split : regexp -> string -> string list (** [split r s] splits the string [s] erasing matches with [r]. [split (regexp " ") "toto tutu tata"] is [["toto";"tutu";"tata"]].*) val bounded_split : regexp -> string -> int -> string list (** [bounded_split r s i] is like [split r s] except that the result's length is less than [i]. *) js_of_ocaml-3.5.2/lib/js_of_ocaml/resizeObserver.ml000066400000000000000000000047711357507750000224020ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Alexander Yanin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import class type resizeObserverSize = object method inlineSize : float Js.readonly_prop method blockSize : float Js.readonly_prop end class type resizeObserverEntry = object method target : Dom.node Js.t Js.readonly_prop method contentRect : Dom_html.clientRect Js.t Js.readonly_prop method borderBoxSize : resizeObserverSize Js.t Js.readonly_prop method contentBoxSize : resizeObserverSize Js.t Js.readonly_prop end class type resizeObserverOptions = object method box : Js.js_string Js.t Js.writeonly_prop end class type resizeObserver = object method observe : #Dom.node Js.t -> unit Js.meth method observe_withOptions : #Dom.node Js.t -> resizeObserverOptions Js.t -> unit Js.meth method unobserve : #Dom.node Js.t -> unit Js.meth method disconnect : unit Js.meth end let empty_resize_observer_options () : resizeObserverOptions Js.t = Js.Unsafe.obj [||] let resizeObserver = Js.Unsafe.global##._ResizeObserver let is_supported () = Js.Optdef.test resizeObserver let resizeObserver : ( (resizeObserverEntry Js.t Js.js_array Js.t -> resizeObserver Js.t -> unit) Js.callback -> resizeObserver Js.t) Js.constr = resizeObserver let observe ~(node : #Dom.node Js.t) ~(f : resizeObserverEntry Js.t Js.js_array Js.t -> resizeObserver Js.t -> unit) ?(box : Js.js_string Js.t option) () : resizeObserver Js.t = let obs = new%js resizeObserver (Js.wrap_callback f) in (match box with | None -> obs##observe node | Some box -> let opts = empty_resize_observer_options () in opts##.box := box; obs##observe_withOptions node opts); obs js_of_ocaml-3.5.2/lib/js_of_ocaml/resizeObserver.mli000066400000000000000000000056041357507750000225470ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Alexander Yanin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** ResizeObserver API A code example: {[ if (ResizeObserver.is_supported ()) then let doc = Dom_html.document in let target = Js.Opt.get (doc##getElementById (Js.string "observed")) (fun () -> assert false) in let node = (target :> Dom.node Js.t) in let f entries observer = Firebug.console##debug entries; Firebug.console##debug observer in ResizeObserver.observe ~node ~f ~box:(Js.string "content-box") () ]} @see for API documentation @see for W3C draft spec *) class type resizeObserverSize = object method inlineSize : float Js.readonly_prop method blockSize : float Js.readonly_prop end class type resizeObserverEntry = object method target : Dom.node Js.t Js.readonly_prop method contentRect : Dom_html.clientRect Js.t Js.readonly_prop method borderBoxSize : resizeObserverSize Js.t Js.readonly_prop method contentBoxSize : resizeObserverSize Js.t Js.readonly_prop end class type resizeObserverOptions = object method box : Js.js_string Js.t Js.writeonly_prop end class type resizeObserver = object method observe : #Dom.node Js.t -> unit Js.meth method observe_withOptions : #Dom.node Js.t -> resizeObserverOptions Js.t -> unit Js.meth method unobserve : #Dom.node Js.t -> unit Js.meth method disconnect : unit Js.meth end val empty_resize_observer_options : unit -> resizeObserverOptions Js.t val resizeObserver : ( (resizeObserverEntry Js.t Js.js_array Js.t -> resizeObserver Js.t -> unit) Js.callback -> resizeObserver Js.t) Js.constr val is_supported : unit -> bool val observe : node:#Dom.node Js.t -> f:(resizeObserverEntry Js.t Js.js_array Js.t -> resizeObserver Js.t -> unit) -> ?box:Js.js_string Js.t -> unit -> resizeObserver Js.t (** Helper to create a new observer and connect it to a node. *) js_of_ocaml-3.5.2/lib/js_of_ocaml/sys_js.ml000066400000000000000000000043761357507750000207040ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import external create_file : name:string -> content:string -> unit = "caml_create_file" external read_file : name:string -> string = "caml_read_file_content" let update_file ~name ~content = let oc = open_out name in output_string oc content; close_out oc external set_channel_output' : out_channel -> (Js.js_string Js.t -> unit) Js.callback -> unit = "caml_ml_set_channel_output" external set_channel_input' : in_channel -> (unit -> string) Js.callback -> unit = "caml_ml_set_channel_refill" let set_channel_flusher (out_channel : out_channel) (f : string -> unit) = let f' : (Js.js_string Js.t -> unit) Js.callback = Js.wrap_callback (fun s -> f (Js.to_bytestring s)) in set_channel_output' out_channel f' let set_channel_filler (in_channel : in_channel) (f : unit -> string) = let f' : (unit -> string) Js.callback = Js.wrap_callback f in set_channel_input' in_channel f' external mount_point : unit -> string list = "caml_list_mount_point" external mount_autoload : string -> (string -> string -> string option) Js.callback -> unit = "caml_mount_autoload" external unmount : string -> unit = "caml_unmount" let mount ~path f = mount_autoload path (Js.wrap_callback (fun prefix path -> f ~prefix ~path)) let unmount ~path = unmount path let js_of_ocaml_version = if String.equal Lib_version.git_version "" then Lib_version.s else Lib_version.s ^ "+" ^ Lib_version.git_version js_of_ocaml-3.5.2/lib/js_of_ocaml/sys_js.mli000066400000000000000000000060461357507750000210510ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Javascript specific Sys functions. *) (** {2 Io.} *) val set_channel_flusher : out_channel -> (string -> unit) -> unit (** Set a callback to be called when an out_channel flush its buffer. [set_channel_flusher chan cb] install the callback [cb] for [chan] out_channel. [cb] will be called with the string to flush. *) val set_channel_filler : in_channel -> (unit -> string) -> unit (** Set a callback to be called when an in_channel wants to fill its buffer. [set_channel_filler chan cb] install the called [cb] for [chan] in_channel. The string returned by [cb] will be appended to the channel buffer. *) (** {2 Pseudo filesystem.} *) val mount_point : unit -> string list val unmount : path:string -> unit val mount : path:string -> (prefix:string -> path:string -> string option) -> unit (** Register a callback to the [path] to dynamically load missing files. Whenever a file is missing in [path], the callback is used to optionally get the content of the file. [mount ~path f] register the callback [f] to the path [path]. The callback [f] receives [(prefix,suffix)] where: - [prefix] is the path the function has been registered to. - [Filename.contact prefix suffix] is the absolute filename .*) val read_file : name:string -> string (** [read_file name] returns the content of the file [name]. Raise [Not_found] if the file does not exists. *) val create_file : name:string -> content:string -> unit (** Register a file to a Pseudo Filesystem. [create_file ~name ~content] register the file [name] with content [content] so it can be be opened with [open_in name] *) val update_file : name:string -> content:string -> unit (** Update a file in the Pseudo Filesystem. [update_file ~name ~content] update the file [name] with content [content] *) (** {2 Information.} *) val js_of_ocaml_version : string (** [js_of_ocaml_version] is the version of Js_of_ocaml. It is a string of the form ["major.minor[.patchlevel][+additional-info]"], where [major], [minor], and [patchlevel] are integers, and [additional-info] is an arbitrary string. The [[.patchlevel]] and [[+additional-info]] parts may be absent. *) js_of_ocaml-3.5.2/lib/js_of_ocaml/typed_array.ml000066400000000000000000000142071357507750000217070ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2012 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import open Js class type arrayBuffer = object method byteLength : int readonly_prop end let arrayBuffer : (int -> arrayBuffer t) constr = Js.Unsafe.global##._ArrayBuffer class type arrayBufferView = object method buffer : arrayBuffer t readonly_prop method byteOffset : int readonly_prop method byteLength : int readonly_prop end class type ['a, 'b] typedArray = object inherit arrayBufferView method _BYTES_PER_ELEMENT : int readonly_prop method length : int readonly_prop method set_fromArray : 'a js_array t -> int -> unit meth method set_fromTypedArray : ('a, 'b) typedArray t -> int -> unit meth method subarray : int -> int -> ('a, 'b) typedArray t meth method subarray_toEnd : int -> ('a, 'b) typedArray t meth method _content_type_ : 'b end type int8Array = (int, [ `Int8 ]) typedArray type uint8Array = (int, [ `Uint8 ]) typedArray type int16Array = (int, [ `Int16 ]) typedArray type uint16Array = (int, [ `Uint16 ]) typedArray type int32Array = (int, [ `Int32 ]) typedArray type uint32Array = (float, [ `Uint32 ]) typedArray type float32Array = (float, [ `Float32 ]) typedArray type float64Array = (float, [ `Float64 ]) typedArray let int8Array = Js.Unsafe.global##._Int8Array let int8Array_fromArray = int8Array let int8Array_fromTypedArray = int8Array let int8Array_fromBuffer = int8Array let int8Array_inBuffer = int8Array let uint8Array = Js.Unsafe.global##._Uint8Array let uint8Array_fromArray = uint8Array let uint8Array_fromTypedArray = uint8Array let uint8Array_fromBuffer = uint8Array let uint8Array_inBuffer = uint8Array let int16Array = Js.Unsafe.global##._Int16Array let int16Array_fromArray = int16Array let int16Array_fromTypedArray = int16Array let int16Array_fromBuffer = int16Array let int16Array_inBuffer = int16Array let uint16Array = Js.Unsafe.global##._Uint16Array let uint16Array_fromArray = uint16Array let uint16Array_fromTypedArray = uint16Array let uint16Array_fromBuffer = uint16Array let uint16Array_inBuffer = uint16Array let int32Array = Js.Unsafe.global##._Int32Array let int32Array_fromArray = int32Array let int32Array_fromTypedArray = int32Array let int32Array_fromBuffer = int32Array let int32Array_inBuffer = int32Array let uint32Array = Js.Unsafe.global##._Uint32Array let uint32Array_fromArray = uint32Array let uint32Array_fromTypedArray = uint32Array let uint32Array_fromBuffer = uint32Array let uint32Array_inBuffer = uint32Array let float32Array = Js.Unsafe.global##._Float32Array let float32Array_fromArray = float32Array let float32Array_fromTypedArray = float32Array let float32Array_fromBuffer = float32Array let float32Array_inBuffer = float32Array let float64Array = Js.Unsafe.global##._Float64Array let float64Array_fromArray = float64Array let float64Array_fromTypedArray = float64Array let float64Array_fromBuffer = float64Array let float64Array_inBuffer = float64Array let set : ('a, 'b) typedArray t -> int -> 'a -> unit = fun a i v -> array_set (Unsafe.coerce a) i v let get : ('a, 'b) typedArray t -> int -> 'a optdef = fun a i -> Js.Unsafe.get a i let unsafe_get : ('a, 'b) typedArray t -> int -> 'a = fun a i -> Js.Unsafe.get a i class type dataView = object inherit arrayBufferView method getInt8 : int -> int meth method getUint8 : int -> int meth method getInt16_ : int -> bool t -> int meth method getUint16 : int -> int meth method getUint16_ : int -> bool t -> int meth method getInt32 : int -> int meth method getInt32_ : int -> bool t -> int meth method getUint32 : int -> float meth method getUint32_ : int -> bool t -> float meth method getFloat32 : int -> float meth method getFloat32_ : int -> bool t -> float meth method getFloat64 : int -> float meth method getFloat64_ : int -> bool t -> float meth method setInt8 : int -> int -> unit meth method setUint8 : int -> int -> unit meth method setInt16 : int -> int -> unit meth method setInt16_ : int -> int -> bool t -> unit meth method setUint16 : int -> int -> unit meth method setUint16_ : int -> int -> bool t -> unit meth method setInt32 : int -> int -> unit meth method setInt32_ : int -> int -> bool t -> unit meth method setUint32 : int -> float -> unit meth method setUint32_ : int -> float -> bool t -> unit meth method setFloat32 : int -> float -> unit meth method setFloat32_ : int -> float -> bool t -> unit meth method setFloat64 : int -> float -> unit meth method setFloat64_ : int -> float -> bool t -> unit meth end let dataView = Js.Unsafe.global##._DataView let dataView_inBuffer = dataView module Bigstring = struct type t = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t external to_arrayBuffer : t -> arrayBuffer Js.t = "bigstring_to_array_buffer" external to_uint8Array : t -> uint8Array Js.t = "bigstring_to_typed_array" external of_arrayBuffer : arrayBuffer Js.t -> t = "bigstring_of_array_buffer" external of_uint8Array : uint8Array Js.t -> t = "bigstring_of_typed_array" end module String = struct external of_uint8Array : uint8Array Js.t -> string = "caml_string_of_array" let of_arrayBuffer ab = let uint8 = new%js uint8Array_fromBuffer ab in of_uint8Array uint8 end js_of_ocaml-3.5.2/lib/js_of_ocaml/typed_array.mli000066400000000000000000000155031357507750000220600ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2012 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Typed Array binding *) open Js class type arrayBuffer = object method byteLength : int readonly_prop end val arrayBuffer : (int -> arrayBuffer t) constr class type arrayBufferView = object method buffer : arrayBuffer t readonly_prop method byteOffset : int readonly_prop method byteLength : int readonly_prop end class type ['a, 'b] typedArray = object inherit arrayBufferView method _BYTES_PER_ELEMENT : int readonly_prop method length : int readonly_prop method set_fromArray : 'a js_array t -> int -> unit meth method set_fromTypedArray : ('a, 'b) typedArray t -> int -> unit meth method subarray : int -> int -> ('a, 'b) typedArray t meth method subarray_toEnd : int -> ('a, 'b) typedArray t meth method _content_type_ : 'b end type int8Array = (int, [ `Int8 ]) typedArray type uint8Array = (int, [ `Uint8 ]) typedArray type int16Array = (int, [ `Int16 ]) typedArray type uint16Array = (int, [ `Uint16 ]) typedArray type int32Array = (int, [ `Int32 ]) typedArray type uint32Array = (float, [ `Uint32 ]) typedArray type float32Array = (float, [ `Float32 ]) typedArray type float64Array = (float, [ `Float64 ]) typedArray val int8Array : (int -> int8Array t) constr val int8Array_fromArray : (int js_array t -> int8Array t) constr val int8Array_fromTypedArray : (int8Array t -> int8Array t) constr val int8Array_fromBuffer : (arrayBuffer t -> int8Array t) constr val int8Array_inBuffer : (arrayBuffer t -> int -> int -> int8Array t) constr val uint8Array : (int -> uint8Array t) constr val uint8Array_fromArray : (int js_array t -> uint8Array t) constr val uint8Array_fromTypedArray : (uint8Array t -> uint8Array t) constr val uint8Array_fromBuffer : (arrayBuffer t -> uint8Array t) constr val uint8Array_inBuffer : (arrayBuffer t -> int -> int -> uint8Array t) constr val int16Array : (int -> int16Array t) constr val int16Array_fromArray : (int js_array t -> int16Array t) constr val int16Array_fromTypedArray : (int16Array t -> int16Array t) constr val int16Array_fromBuffer : (arrayBuffer t -> int16Array t) constr val int16Array_inBuffer : (arrayBuffer t -> int -> int -> int16Array t) constr val uint16Array : (int -> uint16Array t) constr val uint16Array_fromArray : (int js_array t -> uint16Array t) constr val uint16Array_fromTypedArray : (uint16Array t -> uint16Array t) constr val uint16Array_fromBuffer : (arrayBuffer t -> uint16Array t) constr val uint16Array_inBuffer : (arrayBuffer t -> int -> int -> uint16Array t) constr val int32Array : (int -> int32Array t) constr val int32Array_fromArray : (int js_array t -> int32Array t) constr val int32Array_fromTypedArray : (int32Array t -> int32Array t) constr val int32Array_fromBuffer : (arrayBuffer t -> int32Array t) constr val int32Array_inBuffer : (arrayBuffer t -> int -> int -> int32Array t) constr val uint32Array : (int -> uint32Array t) constr val uint32Array_fromArray : (float js_array t -> uint32Array t) constr val uint32Array_fromTypedArray : (uint32Array t -> uint32Array t) constr val uint32Array_fromBuffer : (arrayBuffer t -> uint32Array t) constr val uint32Array_inBuffer : (arrayBuffer t -> int -> int -> uint32Array t) constr val float32Array : (int -> float32Array t) constr val float32Array_fromArray : (float js_array t -> float32Array t) constr val float32Array_fromTypedArray : (float32Array t -> float32Array t) constr val float32Array_fromBuffer : (arrayBuffer t -> float32Array t) constr val float32Array_inBuffer : (arrayBuffer t -> int -> int -> float32Array t) constr val float64Array : (int -> float64Array t) constr val float64Array_fromArray : (float js_array t -> float64Array t) constr val float64Array_fromTypedArray : (float64Array t -> float64Array t) constr val float64Array_fromBuffer : (arrayBuffer t -> float64Array t) constr val float64Array_inBuffer : (arrayBuffer t -> int -> int -> float64Array t) constr val set : ('a, 'b) typedArray t -> int -> 'a -> unit val get : ('a, 'b) typedArray t -> int -> 'a optdef val unsafe_get : ('a, 'b) typedArray t -> int -> 'a class type dataView = object inherit arrayBufferView method getInt8 : int -> int meth method getUint8 : int -> int meth method getInt16_ : int -> bool t -> int meth method getUint16 : int -> int meth method getUint16_ : int -> bool t -> int meth method getInt32 : int -> int meth method getInt32_ : int -> bool t -> int meth method getUint32 : int -> float meth method getUint32_ : int -> bool t -> float meth method getFloat32 : int -> float meth method getFloat32_ : int -> bool t -> float meth method getFloat64 : int -> float meth method getFloat64_ : int -> bool t -> float meth method setInt8 : int -> int -> unit meth method setUint8 : int -> int -> unit meth method setInt16 : int -> int -> unit meth method setInt16_ : int -> int -> bool t -> unit meth method setUint16 : int -> int -> unit meth method setUint16_ : int -> int -> bool t -> unit meth method setInt32 : int -> int -> unit meth method setInt32_ : int -> int -> bool t -> unit meth method setUint32 : int -> float -> unit meth method setUint32_ : int -> float -> bool t -> unit meth method setFloat32 : int -> float -> unit meth method setFloat32_ : int -> float -> bool t -> unit meth method setFloat64 : int -> float -> unit meth method setFloat64_ : int -> float -> bool t -> unit meth end val dataView : (arrayBuffer t -> dataView t) constr val dataView_inBuffer : (arrayBuffer t -> int -> int -> dataView t) constr module Bigstring : sig type t = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t val to_arrayBuffer : t -> arrayBuffer Js.t val to_uint8Array : t -> uint8Array Js.t val of_arrayBuffer : arrayBuffer Js.t -> t val of_uint8Array : uint8Array Js.t -> t end module String : sig val of_arrayBuffer : arrayBuffer Js.t -> string val of_uint8Array : uint8Array Js.t -> string end js_of_ocaml-3.5.2/lib/js_of_ocaml/url.ml000066400000000000000000000233241357507750000201660ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Raphaël Proust * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import (* Url tampering. *) let split c s = Js.str_array (s##split (Js.string (String.make 1 c))) let split_2 c s = let index = s##indexOf (Js.string (String.make 1 c)) in if index < 0 then Js.undefined else Js.def (s##slice 0 index, s##slice_end (index + 1)) exception Local_exn let interrupt () = raise Local_exn (* url (AKA percent) encoding/decoding *) let plus_re = Regexp.regexp_string "+" let escape_plus s = Regexp.global_replace plus_re s "%2B" let unescape_plus s = Regexp.global_replace plus_re s " " let plus_re_js_string = new%js Js.regExp_withFlags (Js.string "\\+") (Js.string "g") let unescape_plus_js_string s = plus_re_js_string##.lastIndex := 0; s##replace plus_re_js_string (Js.string " ") let urldecode_js_string_string s = Js.to_bytestring (Js.unescape (unescape_plus_js_string s)) let urldecode s = Js.to_bytestring (Js.unescape (Js.bytestring (unescape_plus s))) (*let urlencode_js_string_string s = Js.to_bytestring (Js.escape s)*) let urlencode ?(with_plus = true) s = if with_plus then escape_plus (Js.to_bytestring (Js.escape (Js.bytestring s))) else Js.to_bytestring (Js.escape (Js.bytestring s)) type http_url = { hu_host : string (** The host part of the url. *) ; hu_port : int (** The port for the connection if any. *) ; hu_path : string list (** The path split on ['/'] characters. *) ; hu_path_string : string (** The original entire path. *) ; hu_arguments : (string * string) list (** Arguments as a field-value association list.*) ; hu_fragment : string (** The fragment part (after the ['#'] character). *) } (** The type for HTTP url. *) type file_url = { fu_path : string list ; fu_path_string : string ; fu_arguments : (string * string) list ; fu_fragment : string } (** The type for local file urls. *) type url = | Http of http_url | Https of http_url | File of file_url (** The type for urls. [File] is for local files and [Exotic s] is for unknown/unsupported protocols. *) exception Not_an_http_protocol let is_secure prot_string = match Js.to_bytestring prot_string##toLowerCase with | "https:" | "https" -> true | "http:" | "http" -> false | "file:" | "file" | _ -> raise Not_an_http_protocol (* port number *) let default_http_port = 80 let default_https_port = 443 (* path *) let path_of_path_string s = let l = String.length s in let rec aux i = let j = try String.index_from s i '/' with Not_found -> l in let word = String.sub s i (j - i) in if j >= l then [ word ] else word :: aux (j + 1) in match aux 0 with | [ "" ] -> [] | [ ""; "" ] -> [ "" ] | a -> a (* Arguments *) let encode_arguments l = String.concat "&" (List.map (fun (n, v) -> urlencode n ^ "=" ^ urlencode v) l) let decode_arguments_js_string s = let arr = split '&' s in let len = arr##.length in let name_value_split s = split_2 '=' s in let rec aux acc idx = if idx < 0 then acc else try aux (Js.Optdef.case (Js.array_get arr idx) interrupt (fun s -> Js.Optdef.case (name_value_split s) interrupt (fun (x, y) -> let get = urldecode_js_string_string in get x, get y)) :: acc) (pred idx) with Local_exn -> aux acc (pred idx) in aux [] (len - 1) let decode_arguments s = decode_arguments_js_string (Js.bytestring s) let url_re = new%js Js.regExp (Js.bytestring "^([Hh][Tt][Tt][Pp][Ss]?)://([0-9a-zA-Z.-]+|\\[[0-9a-zA-Z.-]+\\]|\\[[0-9A-Fa-f:.]+\\])?(:([0-9]+))?(/([^\\?#]*)(\\?([^#]*))?(#(.*))?)?$") let file_re = new%js Js.regExp (Js.bytestring "^([Ff][Ii][Ll][Ee])://([^\\?#]*)(\\?([^#]*))?(#(.*))?$") let url_of_js_string s = Js.Opt.case (url_re##exec s) (fun () -> Js.Opt.case (file_re##exec s) (fun () -> None) (fun handle -> let res = Js.match_result handle in let path_str = urldecode_js_string_string (Js.Optdef.get (Js.array_get res 2) interrupt) in Some (File { fu_path = path_of_path_string path_str ; fu_path_string = path_str ; fu_arguments = decode_arguments_js_string (Js.Optdef.get (Js.array_get res 4) (fun () -> Js.bytestring "")) ; fu_fragment = Js.to_bytestring (Js.Optdef.get (Js.array_get res 6) (fun () -> Js.bytestring "")) }))) (fun handle -> let res = Js.match_result handle in let ssl = is_secure (Js.Optdef.get (Js.array_get res 1) interrupt) in let port_of_string = function | "" -> if ssl then 443 else 80 | s -> int_of_string s in let path_str = urldecode_js_string_string (Js.Optdef.get (Js.array_get res 6) (fun () -> Js.bytestring "")) in let url = { hu_host = urldecode_js_string_string (Js.Optdef.get (Js.array_get res 2) interrupt) ; hu_port = port_of_string (Js.to_bytestring (Js.Optdef.get (Js.array_get res 4) (fun () -> Js.bytestring ""))) ; hu_path = path_of_path_string path_str ; hu_path_string = path_str ; hu_arguments = decode_arguments_js_string (Js.Optdef.get (Js.array_get res 8) (fun () -> Js.bytestring "")) ; hu_fragment = urldecode_js_string_string (Js.Optdef.get (Js.array_get res 10) (fun () -> Js.bytestring "")) } in Some (if ssl then Https url else Http url)) let url_of_string s = url_of_js_string (Js.bytestring s) let string_of_url = function | File { fu_path = path; fu_arguments = args; fu_fragment = frag; _ } -> ( "file://" ^ String.concat "/" (List.map (fun x -> urlencode x) path) ^ (match args with | [] -> "" | l -> "?" ^ encode_arguments l) ^ match frag with | "" -> "" | s -> "#" ^ urlencode s) | Http { hu_host = host ; hu_port = port ; hu_path = path ; hu_arguments = args ; hu_fragment = frag ; _ } -> ( "http://" ^ urlencode host ^ (match port with | 80 -> "" | n -> ":" ^ string_of_int n) ^ "/" ^ String.concat "/" (List.map (fun x -> urlencode x) path) ^ (match args with | [] -> "" | l -> "?" ^ encode_arguments l) ^ match frag with | "" -> "" | s -> "#" ^ urlencode s) | Https { hu_host = host ; hu_port = port ; hu_path = path ; hu_arguments = args ; hu_fragment = frag ; _ } -> ( "https://" ^ urlencode host ^ (match port with | 443 -> "" | n -> ":" ^ string_of_int n) ^ "/" ^ String.concat "/" (List.map (fun x -> urlencode x) path) ^ (match args with | [] -> "" | l -> "?" ^ encode_arguments l) ^ match frag with | "" -> "" | s -> "#" ^ urlencode s) module Current = struct let l = if Js.Optdef.test (Js.Optdef.return Dom_html.window##.location) then Dom_html.window##.location else let empty = Js.string "" in object%js val mutable href = empty val mutable protocol = empty val mutable host = empty val mutable hostname = empty val mutable port = empty val mutable pathname = empty val mutable search = empty val mutable hash = empty val origin = Js.undefined method reload = () method replace _ = () method assign _ = () end let host = urldecode_js_string_string l##.hostname let protocol = urldecode_js_string_string l##.protocol let port = (fun () -> try Some (int_of_string (Js.to_bytestring l##.port)) with Failure _ -> None) () let path_string = urldecode_js_string_string l##.pathname let path = path_of_path_string path_string let arguments = decode_arguments_js_string (if l##.search##charAt 0 == Js.string "?" then l##.search##slice_end 1 else l##.search) let get_fragment () = (* location.hash doesn't have the same behavior depending on the browser Firefox bug : https://bugzilla.mozilla.org/show_bug.cgi?id=483304 *) (* let s = Js.to_bytestring (l##hash) in *) (* if String.length s > 0 && s.[0] = '#' *) (* then String.sub s 1 (String.length s - 1) *) (* else s; *) Js.Opt.case (l##.href##_match (new%js Js.regExp (Js.string "#(.*)"))) (fun () -> "") (fun res -> let res = Js.match_result res in Js.to_string (Js.Unsafe.get res 1)) let set_fragment s = l##.hash := Js.bytestring (urlencode s) let get () = url_of_js_string l##.href let set u = l##.href := Js.bytestring (string_of_url u) let as_string = urldecode_js_string_string l##.href end js_of_ocaml-3.5.2/lib/js_of_ocaml/url.mli000066400000000000000000000117671357507750000203470ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Raphaël Proust * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** This module provides functions for tampering with Url. It's main goal is to allow one to stay in the Ocaml realm without wandering into the {!Dom_html.window}##.location object. *) (** The first functions are mainly from and to string conversion functions for the different parts of a url. *) val urldecode : string -> string (** [urldecode s] swaps percent encoding characters for their usual representation. *) val urlencode : ?with_plus:bool -> string -> string (** [urlencode ?with_plus s] replace characters for their percent encoding representation. Note that the '/' (slash) character is escaped as well. If [with_plus] is [true] (default) then ['+']'s are escaped as ["%2B"]. If not, ['+']'s are left as is. *) type http_url = { hu_host : string (** The host part of the url. *) ; hu_port : int (** The port for the connection if any. *) ; hu_path : string list (** The path split on ['/'] characters. *) ; hu_path_string : string (** The original entire path. *) ; hu_arguments : (string * string) list (** Arguments as a field-value association list.*) ; hu_fragment : string (** The fragment part (after the ['#'] character). *) } (** The type for HTTP(s) url. *) type file_url = { fu_path : string list ; fu_path_string : string ; fu_arguments : (string * string) list ; fu_fragment : string } (** The type for local file urls. *) (** The type for urls. *) type url = | Http of http_url (**Non secure HTTP urls*) | Https of http_url (**Secure HTTPS urls*) | File of file_url (**Local files*) val default_http_port : int (** The default port for [Http] communications (80). *) val default_https_port : int (** The default port for [Https] communications (443). *) val path_of_path_string : string -> string list (** [path_of_path_string s] splits [s] on each ["/"] character. *) val encode_arguments : (string * string) list -> string (** [encode_arguments a] expects a list of pair of values of the form [(name,value)] were [name] is the name of an argument and [value] it's associated value. *) val decode_arguments : string -> (string * string) list (** [decode_arguments s] parses [s] returning the sliced-diced association list. *) (** The following part allow one to handle Url object in a much higher level than what a string provides. *) val url_of_string : string -> url option (** [url_of_string s] parses [s] and builds a value of type [url] if [s] is not a valid url string, it returns [None]. *) val string_of_url : url -> string (** [string_of_url u] returns a valid string representation of [u]. Note that * [string_of_url ((fun Some u -> u) (url_of_string s))] is NOT necessarily * equal to [s]. However [url_of_string (string_of_url u) = u]. *) (** This module can be used to handle the Url associated to the current document. *) module Current : sig val host : string (** The host part of the current url. *) val port : int option (** The port of the current url. *) val protocol : string (** The protocol of the current url. *) val path_string : string (** The path of the current url as one long string. *) val path : string list (** The path of the current url as a list of small string. *) val arguments : (string * string) list (** The arguments of the current url as an association list. *) val get_fragment : unit -> string (** Because the [fragment] of the Url for the current document can change dynamically, we use a functional value here. *) val set_fragment : string -> unit (** [set_fragment s] replaces the current fragment by [s]. *) val get : unit -> url option (** [get ()] returns a value of type {!url} with fields reflecting the state of the current Url. *) val set : url -> unit (** [set u] replaces the current Url for [u]. {b WARNING:} Causes the document to change. *) val as_string : string (** [as_string] is the original string representation of the current Url. It is NOT necessarily equals to [string_of_url (get ())] but [url_of_string as_string = get ()] holds. *) end js_of_ocaml-3.5.2/lib/js_of_ocaml/webGL.ml000066400000000000000000001126111357507750000203620ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2012 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open! Import type sizei = int (** 5.1 Types *) type sizeiptr = int type intptr = int type uint = int type clampf = float type void type clearBufferMask = int type beginMode type blendingFactor type blendMode type bufferTarget type bufferUsage type cullFaceMode type depthFunction type enableCap type errorCode type frontFaceDir type hintTarget type hintMode type textureUnit = int type 'a pixelStoreParam type stencilOp type fbTarget type attachmentPoint type rbTarget type texTarget type 'a parameter type 'a bufferParameter type 'a vertexAttribParam type vertexAttribPointerParam type 'a attachParam type framebufferStatus type 'a renderbufferParam type format type pixelFormat type pixelType type 'a texParam type dataType type shaderType type 'a programParam type 'a shaderParam type textureFilter type wrapMode type texFilter type uniformType type colorspaceConversion type shaderPrecisionType type objectType (** 5.2 WebGLContextAttributes *) class type contextAttributes = object method alpha : bool t prop method depth : bool t prop method stencil : bool t prop method antialias : bool t prop method premultipliedAlpha : bool t prop method preserveDrawingBuffer : bool t prop method preferLowPowerToHighPerformance : bool t prop method failIfMajorPerformanceCaveat : bool t prop end let defaultContextAttributes = Js.Unsafe.( obj [| "alpha", inject _true ; "depth", inject _true ; "stencil", inject _false ; "antialias", inject _true ; "premultipliedAlpha", inject _false ; "preserveDrawingBuffer", inject _false ; "preferLowPowerToHighPerformance", inject _false ; "failIfMajorPerformanceCaveat", inject _false |]) type buffer type framebuffer type program type renderbuffer type shader type texture type 'a uniformLocation class type activeInfo = object method size : int readonly_prop method _type : uniformType readonly_prop method name : js_string t readonly_prop end class type shaderPrecisionFormat = object method rangeMin : int readonly_prop method rangeMax : int readonly_prop method precision : int readonly_prop end class type renderingContext = object (** 5.13.1 Attributes *) method canvas : Dom_html.canvasElement t readonly_prop method drawingBufferWidth : sizei readonly_prop method drawingBufferHeight : sizei readonly_prop (** 5.13.2 Getting information about the context *) method getContextAttributes : contextAttributes t meth (** 5.13.3 Setting and getting state *) method activeTexture : textureUnit -> unit meth method blendColor : clampf -> clampf -> clampf -> clampf -> unit meth method blendEquation : blendMode -> unit meth method blendEquationSeparate : blendMode -> blendMode -> unit meth method blendFunc : blendingFactor -> blendingFactor -> unit meth method blendFuncSeparate : blendingFactor -> blendingFactor -> blendingFactor -> blendingFactor -> unit meth method clearColor : clampf -> clampf -> clampf -> clampf -> unit meth method clearDepth : clampf -> unit meth method clearStencil : int -> unit meth method colorMask : bool t -> bool t -> bool t -> bool t -> unit meth method cullFace : cullFaceMode -> unit meth method depthFunc : depthFunction -> unit meth method depthMask : bool t -> unit meth method depthRange : clampf -> clampf -> unit meth method disable : enableCap -> unit meth method enable : enableCap -> unit meth method frontFace : frontFaceDir -> unit meth method getParameter : 'a. 'a parameter -> 'a meth method getError : errorCode meth method hint : hintTarget -> hintMode -> unit meth method isEnabled : enableCap -> bool t meth method lineWidth : float -> unit meth method pixelStorei : 'a. 'a pixelStoreParam -> 'a -> unit meth method polygonOffset : float -> float -> unit meth method sampleCoverage : clampf -> bool t -> unit meth method stencilFunc : depthFunction -> int -> uint -> unit meth method stencilFuncSeparate : cullFaceMode -> depthFunction -> int -> uint -> unit meth method stencilMask : uint -> unit meth method stencilMaskSeparate : cullFaceMode -> uint -> unit meth method stencilOp : stencilOp -> stencilOp -> stencilOp -> unit meth method stencilOpSeparate : cullFaceMode -> stencilOp -> stencilOp -> stencilOp -> unit meth (** 5.13.4 Viewing and clipping *) method scissor : int -> int -> sizei -> sizei -> unit meth method viewport : int -> int -> sizei -> sizei -> unit meth (** 5.13.5 Buffer objects *) method bindBuffer : bufferTarget -> buffer t -> unit meth method bindBuffer_ : bufferTarget -> buffer t opt -> unit meth method bufferData_create : bufferTarget -> sizeiptr -> bufferUsage -> unit meth method bufferData : bufferTarget -> #Typed_array.arrayBufferView t -> bufferUsage -> unit meth method bufferData_raw : bufferTarget -> Typed_array.arrayBuffer t -> bufferUsage -> unit meth method bufferSubData : bufferTarget -> intptr -> #Typed_array.arrayBufferView t -> unit meth method bufferSubData_raw : bufferTarget -> intptr -> Typed_array.arrayBuffer t -> unit meth method createBuffer : buffer t meth method deleteBuffer : buffer t -> unit meth method getBufferParameter : 'a. bufferTarget -> 'a bufferParameter -> 'a meth method isBuffer : buffer t -> bool t meth (** 5.13.6 Framebuffer objects *) method bindFramebuffer : fbTarget -> framebuffer t -> unit meth method bindFramebuffer_ : fbTarget -> framebuffer t opt -> unit meth method checkFramebufferStatus : fbTarget -> framebufferStatus meth method createFramebuffer : framebuffer t meth method deleteFramebuffer : framebuffer t -> unit meth method framebufferRenderbuffer : fbTarget -> attachmentPoint -> rbTarget -> renderbuffer t -> unit meth method framebufferTexture2D : fbTarget -> attachmentPoint -> texTarget -> texture t -> int -> unit meth method getFramebufferAttachmentParameter : 'a. fbTarget -> attachmentPoint -> 'a attachParam -> 'a meth method isFramebuffer : framebuffer t -> bool t meth (** 5.13.7 Renderbuffer objects *) method bindRenderbuffer : rbTarget -> renderbuffer t -> unit meth method bindRenderbuffer_ : rbTarget -> renderbuffer t opt -> unit meth method createRenderbuffer : renderbuffer t meth method deleteRenderbuffer : renderbuffer t -> unit meth method getRenderbufferParameter : 'a. rbTarget -> 'a renderbufferParam -> 'a meth method isRenderbuffer : renderbuffer t -> bool t meth method renderbufferStorage : rbTarget -> format -> sizei -> sizei -> unit meth (** 5.13.8 Texture objects *) method bindTexture : texTarget -> texture t -> unit meth method bindTexture_ : texTarget -> texture t opt -> unit meth method compressedTexImage2D : texTarget -> int -> pixelFormat -> sizei -> sizei -> int -> #Typed_array.arrayBufferView t -> unit meth method compressedTexSubImage2D : texTarget -> int -> int -> int -> sizei -> sizei -> pixelFormat -> #Typed_array.arrayBufferView t -> unit meth method copyTexImage2D : texTarget -> int -> pixelFormat -> int -> int -> sizei -> sizei -> int -> unit meth method copyTexSubImage2D : texTarget -> int -> int -> int -> int -> int -> sizei -> sizei -> unit meth method createTexture : texture t meth method deleteTexture : texture t -> unit meth method generateMipmap : texTarget -> unit meth method getTexParameter : texTarget -> 'a texParam -> 'a meth method isTexture : texture t -> bool t meth method texImage2D_new : texTarget -> int -> pixelFormat -> sizei -> sizei -> int -> pixelFormat -> pixelType -> void opt -> unit meth method texImage2D_fromView : texTarget -> int -> pixelFormat -> sizei -> sizei -> int -> pixelFormat -> pixelType -> #Typed_array.arrayBufferView t -> unit meth method texImage2D_fromImageData : texTarget -> int -> pixelFormat -> pixelFormat -> pixelType -> Dom_html.imageData t -> unit meth method texImage2D_fromImage : texTarget -> int -> pixelFormat -> pixelFormat -> pixelType -> Dom_html.imageElement t -> unit meth method texImage2D_fromCanvas : texTarget -> int -> pixelFormat -> pixelFormat -> pixelType -> Dom_html.canvasElement t -> unit meth method texImage2D_fromVideo : texTarget -> int -> pixelFormat -> pixelFormat -> pixelType -> Dom_html.videoElement t -> unit meth (* method texParameterf : texTarget -> texParam -> float -> unit meth *) method texParameteri : texTarget -> 'a texParam -> 'a -> unit meth method texSubImage2D_fromView : texTarget -> int -> int -> int -> sizei -> sizei -> pixelFormat -> pixelType -> #Typed_array.arrayBufferView t -> unit meth method texSubImage2D_fromImageData : texTarget -> int -> int -> int -> pixelFormat -> pixelType -> Dom_html.imageData t -> unit meth method texSubImage2D_fromImage : texTarget -> int -> int -> int -> pixelFormat -> pixelType -> Dom_html.imageElement t -> unit meth method texSubImage2D_fromCanvas : texTarget -> int -> int -> int -> pixelFormat -> pixelType -> Dom_html.canvasElement t -> unit meth method texSubImage2D_fromVideo : texTarget -> int -> int -> int -> pixelFormat -> pixelType -> Dom_html.videoElement t -> unit meth (** 5.13.9 Programs and Shaders *) method attachShader : program t -> shader t -> unit meth method bindAttribLocation : program t -> uint -> js_string t -> unit meth method compileShader : shader t -> unit meth method createProgram : program t meth method createShader : shaderType -> shader t meth method deleteProgram : program t -> unit meth method deleteShader : shader t -> unit meth method detachShader : program t -> shader t -> unit meth method getAttachedShaders : program t -> shader t js_array t meth method getProgramParameter : 'a. program t -> 'a programParam -> 'a meth method getProgramInfoLog : program t -> js_string t meth method getShaderParameter : 'a. shader t -> 'a shaderParam -> 'a meth method getShaderPrecisionFormat : shaderType -> shaderPrecisionType -> shaderPrecisionFormat t meth method getShaderInfoLog : shader t -> js_string t meth method getShaderSource : shader t -> js_string t meth method isProgram : program t -> bool t meth method isShader : shader t -> bool t meth method linkProgram : program t -> unit meth method shaderSource : shader t -> js_string t -> unit meth method useProgram : program t -> unit meth method validateProgram : program t -> unit meth (** 5.13.10 Uniforms and attributes *) method disableVertexAttribArray : uint -> unit meth method enableVertexAttribArray : uint -> unit meth method getActiveAttrib : program t -> uint -> activeInfo t meth method getActiveUniform : program t -> uint -> activeInfo t meth method getAttribLocation : program t -> js_string t -> int meth method getUniform : 'a 'b. program t -> 'a uniformLocation t -> 'b meth method getUniformLocation : 'a. program t -> js_string t -> 'a uniformLocation t meth method getVertexAttrib : 'a. uint -> 'a vertexAttribParam -> 'a meth method getVertexAttribOffset : uint -> vertexAttribPointerParam -> sizeiptr meth method uniform1f : float uniformLocation t -> float -> unit meth method uniform1fv_typed : float uniformLocation t -> Typed_array.float32Array t -> unit meth method uniform1fv : float uniformLocation t -> float js_array t -> unit meth method uniform1i : int uniformLocation t -> int -> unit meth method uniform1iv_typed : int uniformLocation t -> Typed_array.int32Array t -> unit meth method uniform1iv : int uniformLocation t -> int js_array t -> unit meth method uniform2f : [ `vec2 ] uniformLocation t -> float -> float -> unit meth method uniform2fv_typed : [ `vec2 ] uniformLocation t -> Typed_array.float32Array t -> unit meth method uniform2fv : [ `vec2 ] uniformLocation t -> float js_array t -> unit meth method uniform2i : [ `ivec2 ] uniformLocation t -> int -> int -> unit meth method uniform2iv : [ `ivec2 ] uniformLocation t -> int js_array t -> unit meth method uniform2iv_typed : [ `ivec2 ] uniformLocation t -> Typed_array.int32Array t -> unit meth method uniform3f : [ `vec3 ] uniformLocation t -> float -> float -> float -> unit meth method uniform3fv_typed : [ `vec3 ] uniformLocation t -> Typed_array.float32Array t -> unit meth method uniform3fv : [ `vec3 ] uniformLocation t -> float js_array t -> unit meth method uniform3i : [ `ivec3 ] uniformLocation t -> int -> int -> int -> unit meth method uniform3iv : [ `ivec3 ] uniformLocation t -> int js_array t -> unit meth method uniform3iv_typed : [ `ivec3 ] uniformLocation t -> Typed_array.int32Array t -> unit meth method uniform4f : [ `vec4 ] uniformLocation t -> float -> float -> float -> float -> unit meth method uniform4fv_typed : [ `vec4 ] uniformLocation t -> Typed_array.float32Array t -> unit meth method uniform4fv : [ `vec4 ] uniformLocation t -> float js_array t -> unit meth method uniform4i : [ `ivec4 ] uniformLocation t -> int -> int -> int -> int -> unit meth method uniform4iv : [ `ivec4 ] uniformLocation t -> int js_array t -> unit meth method uniform4iv_typed : [ `ivec4 ] uniformLocation t -> Typed_array.int32Array t -> unit meth method uniformMatrix2fv : [ `mat2 ] uniformLocation t -> bool t -> float js_array t -> unit meth method uniformMatrix2fv_typed : [ `mat2 ] uniformLocation t -> bool t -> Typed_array.float32Array t -> unit meth method uniformMatrix3fv : [ `mat3 ] uniformLocation t -> bool t -> float js_array t -> unit meth method uniformMatrix3fv_typed : [ `mat3 ] uniformLocation t -> bool t -> Typed_array.float32Array t -> unit meth method uniformMatrix4fv : [ `mat4 ] uniformLocation t -> bool t -> float js_array t -> unit meth method uniformMatrix4fv_typed : [ `mat4 ] uniformLocation t -> bool t -> Typed_array.float32Array t -> unit meth method vertexAttrib1f : uint -> float -> unit meth method vertexAttrib1fv : uint -> float js_array t -> unit meth method vertexAttrib1fv_typed : uint -> Typed_array.float32Array t -> unit meth method vertexAttrib2f : uint -> float -> float -> unit meth method vertexAttrib2fv : uint -> float js_array t -> unit meth method vertexAttrib2fv_typed : uint -> Typed_array.float32Array t -> unit meth method vertexAttrib3f : uint -> float -> float -> float -> unit meth method vertexAttrib3fv : uint -> float js_array t -> unit meth method vertexAttrib3fv_typed : uint -> Typed_array.float32Array t -> unit meth method vertexAttrib4f : uint -> float -> float -> float -> float -> unit meth method vertexAttrib4fv : uint -> float js_array t -> unit meth method vertexAttrib4fv_typed : uint -> Typed_array.float32Array t -> unit meth method vertexAttribPointer : uint -> int -> dataType -> bool t -> sizei -> intptr -> unit meth (** 5.13.11 Writing to the drawing buffer *) method clear : clearBufferMask -> unit meth method drawArrays : beginMode -> int -> sizei -> unit meth method drawElements : beginMode -> sizei -> dataType -> intptr -> unit meth method finish : unit meth method flush : unit meth (** 5.13.12 Reading back pixels *) method readPixels : int -> int -> sizei -> sizei -> pixelFormat -> pixelType -> #Typed_array.arrayBufferView t -> unit meth (** 5.13.13 Detecting context lost events *) method isContextLost : bool t meth (** 5.13.14 Detecting and enabling extensions *) method getSupportedExtensions : js_string t js_array t meth method getExtension : 'a. js_string t -> 'a t opt meth (* Untyped! *) (** Constants *) method _DEPTH_BUFFER_BIT_ : clearBufferMask readonly_prop method _STENCIL_BUFFER_BIT_ : clearBufferMask readonly_prop method _COLOR_BUFFER_BIT_ : clearBufferMask readonly_prop method _POINTS : beginMode readonly_prop method _LINES : beginMode readonly_prop method _LINE_LOOP_ : beginMode readonly_prop method _LINE_STRIP_ : beginMode readonly_prop method _TRIANGLES : beginMode readonly_prop method _TRIANGLE_STRIP_ : beginMode readonly_prop method _TRIANGLE_FAN_ : beginMode readonly_prop method _ZERO : blendingFactor readonly_prop method _ONE : blendingFactor readonly_prop method _SRC_COLOR_ : blendingFactor readonly_prop method _ONE_MINUS_SRC_COLOR_ : blendingFactor readonly_prop method _SRC_ALPHA_ : blendingFactor readonly_prop method _ONE_MINUS_SRC_ALPHA_ : blendingFactor readonly_prop method _DST_ALPHA_ : blendingFactor readonly_prop method _ONE_MINUS_DST_ALPHA_ : blendingFactor readonly_prop method _DST_COLOR_ : blendingFactor readonly_prop method _ONE_MINUS_DST_COLOR_ : blendingFactor readonly_prop method _SRC_ALPHA_SATURATE_ : blendingFactor readonly_prop method _FUNC_ADD_ : blendMode readonly_prop method _FUNC_SUBTRACT_ : blendMode readonly_prop method _FUNC_REVERSE_SUBTRACT_ : blendMode readonly_prop method _CONSTANT_COLOR_ : blendMode readonly_prop method _ONE_MINUS_CONSTANT_COLOR_ : blendMode readonly_prop method _CONSTANT_ALPHA_ : blendMode readonly_prop method _ONE_MINUS_CONSTANT_ALPHA_ : blendMode readonly_prop method _ARRAY_BUFFER_ : bufferTarget readonly_prop method _ELEMENT_ARRAY_BUFFER_ : bufferTarget readonly_prop method _STREAM_DRAW_ : bufferUsage readonly_prop method _STATIC_DRAW_ : bufferUsage readonly_prop method _DYNAMIC_DRAW_ : bufferUsage readonly_prop method _FRONT : cullFaceMode readonly_prop method _BACK : cullFaceMode readonly_prop method _FRONT_AND_BACK_ : cullFaceMode readonly_prop method _CULL_FACE_ : enableCap readonly_prop method _BLEND : enableCap readonly_prop method _DITHER : enableCap readonly_prop method _STENCIL_TEST_ : enableCap readonly_prop method _DEPTH_TEST_ : enableCap readonly_prop method _SCISSOR_TEST_ : enableCap readonly_prop method _POLYGON_OFFSET_FILL_ : enableCap readonly_prop method _SAMPLE_ALPHA_TO_COVERAGE_ : enableCap readonly_prop method _SAMPLE_COVERAGE_ : enableCap readonly_prop method _NO_ERROR_ : errorCode readonly_prop method _INVALID_ENUM_ : errorCode readonly_prop method _INVALID_VALUE_ : errorCode readonly_prop method _INVALID_OPERATION_ : errorCode readonly_prop method _OUT_OF_MEMORY_ : errorCode readonly_prop method _CONTEXT_LOST_WEBGL_ : errorCode readonly_prop method _INVALID_FRAMEBUFFER_OPERATION_ : errorCode readonly_prop method _CW : frontFaceDir readonly_prop method _CCW : frontFaceDir readonly_prop method _DONT_CARE_ : hintMode readonly_prop method _FASTEST : hintMode readonly_prop method _NICEST : hintMode readonly_prop method _GENERATE_MIPMAP_HINT_ : hintTarget readonly_prop method _BLEND_EQUATION_ : blendMode parameter readonly_prop method _BLEND_EQUATION_RGB_ : blendMode parameter readonly_prop method _BLEND_EQUATION_ALPHA_ : blendMode parameter readonly_prop method _BLEND_DST_RGB_ : blendingFactor parameter readonly_prop method _BLEND_SRC_RGB_ : blendingFactor parameter readonly_prop method _BLEND_DST_ALPHA_ : blendingFactor parameter readonly_prop method _BLEND_SRC_ALPHA_ : blendingFactor parameter readonly_prop method _BLEND_COLOR_ : Typed_array.float32Array t parameter readonly_prop method _ARRAY_BUFFER_BINDING_ : buffer t opt parameter readonly_prop method _ELEMENT_ARRAY_BUFFER_BINDING_ : buffer t opt parameter readonly_prop method _CULL_FACE_PARAM : bool t parameter readonly_prop method _BLEND_PARAM : bool t parameter readonly_prop method _DITHER_PARAM : bool t parameter readonly_prop method _STENCIL_TEST_PARAM : bool t parameter readonly_prop method _DEPTH_TEST_PARAM : bool t parameter readonly_prop method _SCISSOR_TEST_PARAM : bool t parameter readonly_prop method _POLYGON_OFFSET_FILL_PARAM : bool t parameter readonly_prop method _LINE_WIDTH_ : float parameter readonly_prop method _ALIASED_POINT_SIZE_RANGE_ : Typed_array.float32Array t parameter readonly_prop method _ALIASED_LINE_WIDTH_RANGE_ : Typed_array.float32Array t parameter readonly_prop method _CULL_FACE_MODE_ : cullFaceMode parameter readonly_prop method _FRONT_FACE_ : frontFaceDir parameter readonly_prop method _DEPTH_RANGE_ : Typed_array.float32Array t parameter readonly_prop method _DEPTH_WRITEMASK_ : bool t parameter readonly_prop method _DEPTH_CLEAR_VALUE_ : float parameter readonly_prop method _DEPTH_FUNC_ : depthFunction parameter readonly_prop method _STENCIL_CLEAR_VALUE_ : int parameter readonly_prop method _STENCIL_FUNC_ : int parameter readonly_prop method _STENCIL_FAIL_ : int parameter readonly_prop method _STENCIL_PASS_DEPTH_FAIL_ : int parameter readonly_prop method _STENCIL_PASS_DEPTH_PASS_ : int parameter readonly_prop method _STENCIL_REF_ : int parameter readonly_prop method _STENCIL_VALUE_MASK_ : int parameter readonly_prop method _STENCIL_WRITEMASK_ : int parameter readonly_prop method _STENCIL_BACK_FUNC_ : int parameter readonly_prop method _STENCIL_BACK_FAIL_ : int parameter readonly_prop method _STENCIL_BACK_PASS_DEPTH_FAIL_ : int parameter readonly_prop method _STENCIL_BACK_PASS_DEPTH_PASS_ : int parameter readonly_prop method _STENCIL_BACK_REF_ : int parameter readonly_prop method _STENCIL_BACK_VALUE_MASK_ : int parameter readonly_prop method _STENCIL_BACK_WRITEMASK_ : int parameter readonly_prop method _VIEWPORT : Typed_array.int32Array t parameter readonly_prop method _SCISSOR_BOX_ : Typed_array.int32Array t parameter readonly_prop method _COLOR_CLEAR_VALUE_ : Typed_array.float32Array t parameter readonly_prop method _COLOR_WRITEMASK_ : bool t js_array t parameter readonly_prop method _UNPACK_ALIGNMENT_PARAM : int parameter readonly_prop method _PACK_ALIGNMENT_ : int parameter readonly_prop method _MAX_TEXTURE_SIZE_ : int parameter readonly_prop method _MAX_VIEWPORT_DIMS_ : Typed_array.int32Array t parameter readonly_prop method _SUBPIXEL_BITS_ : int parameter readonly_prop method _RED_BITS_ : int parameter readonly_prop method _GREEN_BITS_ : int parameter readonly_prop method _BLUE_BITS_ : int parameter readonly_prop method _ALPHA_BITS_ : int parameter readonly_prop method _DEPTH_BITS_ : int parameter readonly_prop method _STENCIL_BITS_ : int parameter readonly_prop method _POLYGON_OFFSET_UNITS_ : float parameter readonly_prop method _POLYGON_OFFSET_FACTOR_ : float parameter readonly_prop method _TEXTURE_BINDING_2D_ : texture t opt parameter readonly_prop method _TEXTURE_BINDING_CUBE_MAP_ : texture t opt parameter readonly_prop method _SAMPLE_BUFFERS_ : int parameter readonly_prop method _SAMPLES_ : int parameter readonly_prop method _SAMPLE_COVERAGE_VALUE_ : float parameter readonly_prop method _SAMPLE_COVERAGE_INVERT_ : bool t parameter readonly_prop method _NUM_COMPRESSED_TEXTURE_FORMATS_ : int parameter readonly_prop method _COMPRESSED_TEXTURE_FORMATS_ : Typed_array.uint32Array t parameter readonly_prop method _GENERATE_MIPMAP_HINT_PARAM_ : hintMode parameter readonly_prop method _BUFFER_SIZE_ : int bufferParameter readonly_prop method _BUFFER_USAGE_ : bufferUsage bufferParameter readonly_prop method _BYTE : dataType readonly_prop method _UNSIGNED_BYTE_DT : dataType readonly_prop method _SHORT : dataType readonly_prop method _UNSIGNED_SHORT_ : dataType readonly_prop method _INT : dataType readonly_prop method _UNSIGNED_INT_ : dataType readonly_prop method _FLOAT : dataType readonly_prop method _UNSIGNED_BYTE_ : pixelType readonly_prop method _UNSIGNED_SHORT_4_4_4_4_ : pixelType readonly_prop method _UNSIGNED_SHORT_5_5_5_1_ : pixelType readonly_prop method _UNSIGNED_SHORT_5_6_5_ : pixelType readonly_prop method _ALPHA : pixelFormat readonly_prop method _RGB : pixelFormat readonly_prop method _RGBA : pixelFormat readonly_prop method _LUMINANCE : pixelFormat readonly_prop method _LUMINANCE_ALPHA_ : pixelFormat readonly_prop method _STENCIL_INDEX_ : pixelFormat readonly_prop method _DEPTH_STENCIL_ : pixelFormat readonly_prop method _DEPTH_COMPONENT_ : pixelFormat readonly_prop method _FRAGMENT_SHADER_ : shaderType readonly_prop method _VERTEX_SHADER_ : shaderType readonly_prop method _MAX_VERTEX_ATTRIBS_ : int parameter readonly_prop method _MAX_VERTEX_UNIFORM_VECTORS_ : int parameter readonly_prop method _MAX_VARYING_VECTORS_ : int parameter readonly_prop method _MAX_COMBINED_TEXTURE_IMAGE_UNITS_ : int parameter readonly_prop method _MAX_VERTEX_TEXTURE_IMAGE_UNITS_ : int parameter readonly_prop method _MAX_TEXTURE_IMAGE_UNITS_ : int parameter readonly_prop method _MAX_FRAGMENT_UNIFORM_VECTORS_ : int parameter readonly_prop method _SHADER_TYPE_ : shaderType shaderParam readonly_prop method _DELETE_STATUS_ : bool t shaderParam readonly_prop method _COMPILE_STATUS_ : bool t shaderParam readonly_prop method _DELETE_STATUS_PROG : bool t programParam readonly_prop method _LINK_STATUS_ : bool t programParam readonly_prop method _VALIDATE_STATUS_ : bool t programParam readonly_prop method _ATTACHED_SHADERS_ : int programParam readonly_prop method _ACTIVE_UNIFORMS_ : int programParam readonly_prop method _ACTIVE_ATTRIBUTES_ : int programParam readonly_prop method _SHADING_LANGUAGE_VERSION_ : js_string t parameter readonly_prop method _CURRENT_PROGRAM_ : program t opt parameter readonly_prop method _VENDOR : js_string t parameter readonly_prop method _RENDERER : js_string t parameter readonly_prop method _VERSION : js_string t parameter readonly_prop method _MAX_CUBE_MAP_TEXTURE_SIZE_ : int parameter readonly_prop method _ACTIVE_TEXTURE_ : int parameter readonly_prop method _FRAMEBUFFER_BINDING_ : framebuffer t opt parameter readonly_prop method _RENDERBUFFER_BINDING_ : renderbuffer t opt parameter readonly_prop method _MAX_RENDERBUFFER_SIZE : int parameter readonly_prop method _NEVER : depthFunction readonly_prop method _LESS : depthFunction readonly_prop method _EQUAL : depthFunction readonly_prop method _LEQUAL : depthFunction readonly_prop method _GREATER : depthFunction readonly_prop method _NOTEQUAL : depthFunction readonly_prop method _GEQUAL : depthFunction readonly_prop method _ALWAYS : depthFunction readonly_prop method _KEEP : stencilOp readonly_prop method _REPLACE : stencilOp readonly_prop method _INCR : stencilOp readonly_prop method _DECR : stencilOp readonly_prop method _INVERT : stencilOp readonly_prop method _INCR_WRAP_ : stencilOp readonly_prop method _DECR_WRAP_ : stencilOp readonly_prop method _ZERO_ : stencilOp readonly_prop method _NEAREST : texFilter readonly_prop method _LINEAR : texFilter readonly_prop method _NEAREST_MIPMAP_NEAREST_ : texFilter readonly_prop method _LINEAR_MIPMAP_NEAREST_ : texFilter readonly_prop method _NEAREST_MIPMAP_LINEAR_ : texFilter readonly_prop method _LINEAR_MIPMAP_LINEAR_ : texFilter readonly_prop method _TEXTURE_MAG_FILTER_ : texFilter texParam readonly_prop method _TEXTURE_MIN_FILTER_ : texFilter texParam readonly_prop method _TEXTURE_WRAP_S_ : wrapMode texParam readonly_prop method _TEXTURE_WRAP_T_ : wrapMode texParam readonly_prop method _NONE_OT : objectType readonly_prop method _TEXTURE_OT : objectType readonly_prop method _RENDERBUFFER_OT : objectType readonly_prop method _TEXTURE_2D_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_POSITIVE_X_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_NEGATIVE_X_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_POSITIVE_Y_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_NEGATIVE_Y_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_POSITIVE_Z_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_NEGATIVE_Z_ : texTarget readonly_prop method _TEXTURE0 : textureUnit readonly_prop method _TEXTURE1 : textureUnit readonly_prop method _TEXTURE2 : textureUnit readonly_prop method _TEXTURE3 : textureUnit readonly_prop method _TEXTURE4 : textureUnit readonly_prop method _TEXTURE5 : textureUnit readonly_prop method _TEXTURE6 : textureUnit readonly_prop method _TEXTURE7 : textureUnit readonly_prop method _TEXTURE8 : textureUnit readonly_prop method _TEXTURE9 : textureUnit readonly_prop method _TEXTURE10 : textureUnit readonly_prop method _TEXTURE11 : textureUnit readonly_prop method _TEXTURE12 : textureUnit readonly_prop method _TEXTURE13 : textureUnit readonly_prop method _TEXTURE14 : textureUnit readonly_prop method _TEXTURE15 : textureUnit readonly_prop method _TEXTURE16 : textureUnit readonly_prop method _TEXTURE17 : textureUnit readonly_prop method _TEXTURE18 : textureUnit readonly_prop method _TEXTURE19 : textureUnit readonly_prop method _TEXTURE20 : textureUnit readonly_prop method _TEXTURE21 : textureUnit readonly_prop method _TEXTURE22 : textureUnit readonly_prop method _TEXTURE23 : textureUnit readonly_prop method _TEXTURE24 : textureUnit readonly_prop method _TEXTURE25 : textureUnit readonly_prop method _TEXTURE26 : textureUnit readonly_prop method _TEXTURE27 : textureUnit readonly_prop method _TEXTURE28 : textureUnit readonly_prop method _TEXTURE29 : textureUnit readonly_prop method _TEXTURE30 : textureUnit readonly_prop method _TEXTURE31 : textureUnit readonly_prop method _REPEAT : wrapMode readonly_prop method _CLAMP_TO_EDGE_ : wrapMode readonly_prop method _MIRRORED_REPEAT_ : wrapMode readonly_prop method _FLOAT_ : uniformType readonly_prop method _FLOAT_VEC2_ : uniformType readonly_prop method _FLOAT_VEC3_ : uniformType readonly_prop method _FLOAT_VEC4_ : uniformType readonly_prop method _INT_ : uniformType readonly_prop method _INT_VEC2_ : uniformType readonly_prop method _INT_VEC3_ : uniformType readonly_prop method _INT_VEC4_ : uniformType readonly_prop method _BOOL_ : uniformType readonly_prop method _BOOL_VEC2_ : uniformType readonly_prop method _BOOL_VEC3_ : uniformType readonly_prop method _BOOL_VEC4_ : uniformType readonly_prop method _FLOAT_MAT2_ : uniformType readonly_prop method _FLOAT_MAT3_ : uniformType readonly_prop method _FLOAT_MAT4_ : uniformType readonly_prop method _SAMPLER_2D_ : uniformType readonly_prop method _SAMPLER_CUBE_ : uniformType readonly_prop method _VERTEX_ATTRIB_ARRAY_ENABLED_ : bool t vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_SIZE_ : int vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_STRIDE_ : int vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_TYPE_ : int vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_NORMALIZED_ : bool t vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_POINTER_ : vertexAttribPointerParam readonly_prop method _VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ : buffer t opt vertexAttribParam readonly_prop method _CURRENT_VERTEX_ATTRIB_ : Typed_array.float32Array t vertexAttribParam readonly_prop method _LOW_FLOAT_ : shaderPrecisionType readonly_prop method _MEDIUM_FLOAT_ : shaderPrecisionType readonly_prop method _HIGH_FLOAT_ : shaderPrecisionType readonly_prop method _LOW_INT_ : shaderPrecisionType readonly_prop method _MEDIUM_INT_ : shaderPrecisionType readonly_prop method _HIGH_INT_ : shaderPrecisionType readonly_prop method _FRAMEBUFFER : fbTarget readonly_prop method _RENDERBUFFER : rbTarget readonly_prop method _RGBA4 : format readonly_prop method _RGB5_A1_ : format readonly_prop method _RGB565 : format readonly_prop method _DEPTH_COMPONENT16_ : format readonly_prop method _STENCIL_INDEX8_ : format readonly_prop method _RENDERBUFFER_WIDTH_ : int renderbufferParam readonly_prop method _RENDERBUFFER_HEIGHT_ : int renderbufferParam readonly_prop method _RENDERBUFFER_INTERNAL_FORMAT_ : format renderbufferParam readonly_prop method _RENDERBUFFER_RED_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_GREEN_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_BLUE_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_ALPHA_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_DEPTH_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_STENCIL_SIZE_ : int renderbufferParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_ : objectType attachParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_RENDERBUFFER : renderbuffer t attachParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_TEXTURE : texture t attachParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_ : int attachParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_ : int attachParam readonly_prop method _COLOR_ATTACHMENT0_ : attachmentPoint readonly_prop method _DEPTH_ATTACHMENT_ : attachmentPoint readonly_prop method _STENCIL_ATTACHMENT_ : attachmentPoint readonly_prop method _DEPTH_STENCIL_ATTACHMENT_ : attachmentPoint readonly_prop method _FRAMEBUFFER_COMPLETE_ : framebufferStatus readonly_prop method _FRAMEBUFFER_INCOMPLETE_ATTACHMENT_ : framebufferStatus readonly_prop method _FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_ : framebufferStatus readonly_prop method _FRAMEBUFFER_INCOMPLETE_DIMENSIONS_ : framebufferStatus readonly_prop method _FRAMEBUFFER_UNSUPPORTED_ : framebufferStatus readonly_prop method _UNPACK_FLIP_Y_WEBGL_PARAM : bool t parameter readonly_prop method _UNPACK_PREMULTIPLY_ALPHA_WEBGL_PARAM : bool t parameter readonly_prop method _UNPACK_COLORSPACE_CONVERSION_WEBGL_PARAM : colorspaceConversion parameter readonly_prop method _NONE : colorspaceConversion readonly_prop method _BROWSER_DEFAULT_WEBGL_ : colorspaceConversion readonly_prop method _UNPACK_ALIGNMENT_ : int pixelStoreParam readonly_prop method _UNPACK_FLIP_Y_WEBGL_ : bool t pixelStoreParam readonly_prop method _UNPACK_PREMULTIPLY_ALPHA_WEBGL_ : bool t pixelStoreParam readonly_prop method _UNPACK_COLORSPACE_CONVERSION_WEBGL_ : int pixelStoreParam readonly_prop end (** 5.14 WebGLContextEvent *) class type contextEvent = object inherit Dom_html.event method statusMessage : js_string t readonly_prop end module Event = struct let webglcontextlost = Dom_html.Event.make "webglcontextlost" let webglcontextrestored = Dom_html.Event.make "webglcontextrestored" let webglcontextcreationerror = Dom_html.Event.make "webglcontextcreationerror" end (****) class type canvasElement = object method getContext : js_string t -> renderingContext t opt meth method getContext_ : js_string t -> contextAttributes t -> renderingContext t opt meth end let getContext (c : Dom_html.canvasElement t) = let c : canvasElement t = Js.Unsafe.coerce c in let ctx = c##getContext (Js.string "webgl") in if Opt.test ctx then ctx else c ## (getContext (Js.string "experimental-webgl")) let getContextWithAttributes (c : Dom_html.canvasElement t) attribs = let c : canvasElement t = Js.Unsafe.coerce c in let ctx = c##getContext_ (Js.string "webgl") attribs in if Opt.test ctx then ctx else c##getContext_ (Js.string "experimental-webgl") attribs js_of_ocaml-3.5.2/lib/js_of_ocaml/webGL.mli000066400000000000000000001110411357507750000205270ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2012 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** WebGL binding *) open Js type sizei = int (** 5.1 Types *) type sizeiptr = int type intptr = int type uint = int type clampf = float type void type clearBufferMask = int type beginMode type blendingFactor type blendMode type bufferTarget type bufferUsage type cullFaceMode type depthFunction type enableCap type errorCode type frontFaceDir type hintTarget type hintMode type textureUnit = int type 'a pixelStoreParam type stencilOp type fbTarget type attachmentPoint type rbTarget type texTarget type 'a parameter type 'a bufferParameter type 'a vertexAttribParam type vertexAttribPointerParam type 'a attachParam type framebufferStatus type 'a renderbufferParam type format type pixelFormat type pixelType type 'a texParam type dataType type shaderType type 'a programParam type 'a shaderParam type textureFilter type wrapMode type texFilter type uniformType type colorspaceConversion type shaderPrecisionType type objectType (** 5.2 WebGLContextAttributes *) class type contextAttributes = object method alpha : bool t prop method depth : bool t prop method stencil : bool t prop method antialias : bool t prop method premultipliedAlpha : bool t prop method preserveDrawingBuffer : bool t prop method preferLowPowerToHighPerformance : bool t prop method failIfMajorPerformanceCaveat : bool t prop end val defaultContextAttributes : contextAttributes t type buffer type framebuffer type program type renderbuffer type shader type texture type 'a uniformLocation class type activeInfo = object method size : int readonly_prop method _type : uniformType readonly_prop method name : js_string t readonly_prop end class type shaderPrecisionFormat = object method rangeMin : int readonly_prop method rangeMax : int readonly_prop method precision : int readonly_prop end class type renderingContext = object (** 5.13.1 Attributes *) method canvas : Dom_html.canvasElement t readonly_prop method drawingBufferWidth : sizei readonly_prop method drawingBufferHeight : sizei readonly_prop (** 5.13.2 Getting information about the context *) method getContextAttributes : contextAttributes t meth (** 5.13.3 Setting and getting state *) method activeTexture : textureUnit -> unit meth method blendColor : clampf -> clampf -> clampf -> clampf -> unit meth method blendEquation : blendMode -> unit meth method blendEquationSeparate : blendMode -> blendMode -> unit meth method blendFunc : blendingFactor -> blendingFactor -> unit meth method blendFuncSeparate : blendingFactor -> blendingFactor -> blendingFactor -> blendingFactor -> unit meth method clearColor : clampf -> clampf -> clampf -> clampf -> unit meth method clearDepth : clampf -> unit meth method clearStencil : int -> unit meth method colorMask : bool t -> bool t -> bool t -> bool t -> unit meth method cullFace : cullFaceMode -> unit meth method depthFunc : depthFunction -> unit meth method depthMask : bool t -> unit meth method depthRange : clampf -> clampf -> unit meth method disable : enableCap -> unit meth method enable : enableCap -> unit meth method frontFace : frontFaceDir -> unit meth method getParameter : 'a. 'a parameter -> 'a meth method getError : errorCode meth method hint : hintTarget -> hintMode -> unit meth method isEnabled : enableCap -> bool t meth method lineWidth : float -> unit meth method pixelStorei : 'a. 'a pixelStoreParam -> 'a -> unit meth method polygonOffset : float -> float -> unit meth method sampleCoverage : clampf -> bool t -> unit meth method stencilFunc : depthFunction -> int -> uint -> unit meth method stencilFuncSeparate : cullFaceMode -> depthFunction -> int -> uint -> unit meth method stencilMask : uint -> unit meth method stencilMaskSeparate : cullFaceMode -> uint -> unit meth method stencilOp : stencilOp -> stencilOp -> stencilOp -> unit meth method stencilOpSeparate : cullFaceMode -> stencilOp -> stencilOp -> stencilOp -> unit meth (** 5.13.4 Viewing and clipping *) method scissor : int -> int -> sizei -> sizei -> unit meth method viewport : int -> int -> sizei -> sizei -> unit meth (** 5.13.5 Buffer objects *) method bindBuffer : bufferTarget -> buffer t -> unit meth method bindBuffer_ : bufferTarget -> buffer t opt -> unit meth method bufferData_create : bufferTarget -> sizeiptr -> bufferUsage -> unit meth method bufferData : bufferTarget -> #Typed_array.arrayBufferView t -> bufferUsage -> unit meth method bufferData_raw : bufferTarget -> Typed_array.arrayBuffer t -> bufferUsage -> unit meth method bufferSubData : bufferTarget -> intptr -> #Typed_array.arrayBufferView t -> unit meth method bufferSubData_raw : bufferTarget -> intptr -> Typed_array.arrayBuffer t -> unit meth method createBuffer : buffer t meth method deleteBuffer : buffer t -> unit meth method getBufferParameter : 'a. bufferTarget -> 'a bufferParameter -> 'a meth method isBuffer : buffer t -> bool t meth (** 5.13.6 Framebuffer objects *) method bindFramebuffer : fbTarget -> framebuffer t -> unit meth method bindFramebuffer_ : fbTarget -> framebuffer t opt -> unit meth method checkFramebufferStatus : fbTarget -> framebufferStatus meth method createFramebuffer : framebuffer t meth method deleteFramebuffer : framebuffer t -> unit meth method framebufferRenderbuffer : fbTarget -> attachmentPoint -> rbTarget -> renderbuffer t -> unit meth method framebufferTexture2D : fbTarget -> attachmentPoint -> texTarget -> texture t -> int -> unit meth method getFramebufferAttachmentParameter : 'a. fbTarget -> attachmentPoint -> 'a attachParam -> 'a meth method isFramebuffer : framebuffer t -> bool t meth (** 5.13.7 Renderbuffer objects *) method bindRenderbuffer : rbTarget -> renderbuffer t -> unit meth method bindRenderbuffer_ : rbTarget -> renderbuffer t opt -> unit meth method createRenderbuffer : renderbuffer t meth method deleteRenderbuffer : renderbuffer t -> unit meth method getRenderbufferParameter : 'a. rbTarget -> 'a renderbufferParam -> 'a meth method isRenderbuffer : renderbuffer t -> bool t meth method renderbufferStorage : rbTarget -> format -> sizei -> sizei -> unit meth (** 5.13.8 Texture objects *) method bindTexture : texTarget -> texture t -> unit meth method bindTexture_ : texTarget -> texture t opt -> unit meth method compressedTexImage2D : texTarget -> int -> pixelFormat -> sizei -> sizei -> int -> #Typed_array.arrayBufferView t -> unit meth method compressedTexSubImage2D : texTarget -> int -> int -> int -> sizei -> sizei -> pixelFormat -> #Typed_array.arrayBufferView t -> unit meth method copyTexImage2D : texTarget -> int -> pixelFormat -> int -> int -> sizei -> sizei -> int -> unit meth method copyTexSubImage2D : texTarget -> int -> int -> int -> int -> int -> sizei -> sizei -> unit meth method createTexture : texture t meth method deleteTexture : texture t -> unit meth method generateMipmap : texTarget -> unit meth method getTexParameter : texTarget -> 'a texParam -> 'a meth method isTexture : texture t -> bool t meth method texImage2D_new : texTarget -> int -> pixelFormat -> sizei -> sizei -> int -> pixelFormat -> pixelType -> void opt -> unit meth method texImage2D_fromView : texTarget -> int -> pixelFormat -> sizei -> sizei -> int -> pixelFormat -> pixelType -> #Typed_array.arrayBufferView t -> unit meth method texImage2D_fromImageData : texTarget -> int -> pixelFormat -> pixelFormat -> pixelType -> Dom_html.imageData t -> unit meth method texImage2D_fromImage : texTarget -> int -> pixelFormat -> pixelFormat -> pixelType -> Dom_html.imageElement t -> unit meth method texImage2D_fromCanvas : texTarget -> int -> pixelFormat -> pixelFormat -> pixelType -> Dom_html.canvasElement t -> unit meth method texImage2D_fromVideo : texTarget -> int -> pixelFormat -> pixelFormat -> pixelType -> Dom_html.videoElement t -> unit meth (* method texParameterf : texTarget -> texParam -> float -> unit meth *) method texParameteri : texTarget -> 'a texParam -> 'a -> unit meth method texSubImage2D_fromView : texTarget -> int -> int -> int -> sizei -> sizei -> pixelFormat -> pixelType -> #Typed_array.arrayBufferView t -> unit meth method texSubImage2D_fromImageData : texTarget -> int -> int -> int -> pixelFormat -> pixelType -> Dom_html.imageData t -> unit meth method texSubImage2D_fromImage : texTarget -> int -> int -> int -> pixelFormat -> pixelType -> Dom_html.imageElement t -> unit meth method texSubImage2D_fromCanvas : texTarget -> int -> int -> int -> pixelFormat -> pixelType -> Dom_html.canvasElement t -> unit meth method texSubImage2D_fromVideo : texTarget -> int -> int -> int -> pixelFormat -> pixelType -> Dom_html.videoElement t -> unit meth (** 5.13.9 Programs and Shaders *) method attachShader : program t -> shader t -> unit meth method bindAttribLocation : program t -> uint -> js_string t -> unit meth method compileShader : shader t -> unit meth method createProgram : program t meth method createShader : shaderType -> shader t meth method deleteProgram : program t -> unit meth method deleteShader : shader t -> unit meth method detachShader : program t -> shader t -> unit meth method getAttachedShaders : program t -> shader t js_array t meth method getProgramParameter : 'a. program t -> 'a programParam -> 'a meth method getProgramInfoLog : program t -> js_string t meth method getShaderParameter : 'a. shader t -> 'a shaderParam -> 'a meth method getShaderPrecisionFormat : shaderType -> shaderPrecisionType -> shaderPrecisionFormat t meth method getShaderInfoLog : shader t -> js_string t meth method getShaderSource : shader t -> js_string t meth method isProgram : program t -> bool t meth method isShader : shader t -> bool t meth method linkProgram : program t -> unit meth method shaderSource : shader t -> js_string t -> unit meth method useProgram : program t -> unit meth method validateProgram : program t -> unit meth (** 5.13.10 Uniforms and attributes *) method disableVertexAttribArray : uint -> unit meth method enableVertexAttribArray : uint -> unit meth method getActiveAttrib : program t -> uint -> activeInfo t meth method getActiveUniform : program t -> uint -> activeInfo t meth method getAttribLocation : program t -> js_string t -> int meth method getUniform : 'a 'b. program t -> 'a uniformLocation t -> 'b meth method getUniformLocation : 'a. program t -> js_string t -> 'a uniformLocation t meth method getVertexAttrib : 'a. uint -> 'a vertexAttribParam -> 'a meth method getVertexAttribOffset : uint -> vertexAttribPointerParam -> sizeiptr meth method uniform1f : float uniformLocation t -> float -> unit meth method uniform1fv_typed : float uniformLocation t -> Typed_array.float32Array t -> unit meth method uniform1fv : float uniformLocation t -> float js_array t -> unit meth method uniform1i : int uniformLocation t -> int -> unit meth method uniform1iv_typed : int uniformLocation t -> Typed_array.int32Array t -> unit meth method uniform1iv : int uniformLocation t -> int js_array t -> unit meth method uniform2f : [ `vec2 ] uniformLocation t -> float -> float -> unit meth method uniform2fv_typed : [ `vec2 ] uniformLocation t -> Typed_array.float32Array t -> unit meth method uniform2fv : [ `vec2 ] uniformLocation t -> float js_array t -> unit meth method uniform2i : [ `ivec2 ] uniformLocation t -> int -> int -> unit meth method uniform2iv : [ `ivec2 ] uniformLocation t -> int js_array t -> unit meth method uniform2iv_typed : [ `ivec2 ] uniformLocation t -> Typed_array.int32Array t -> unit meth method uniform3f : [ `vec3 ] uniformLocation t -> float -> float -> float -> unit meth method uniform3fv_typed : [ `vec3 ] uniformLocation t -> Typed_array.float32Array t -> unit meth method uniform3fv : [ `vec3 ] uniformLocation t -> float js_array t -> unit meth method uniform3i : [ `ivec3 ] uniformLocation t -> int -> int -> int -> unit meth method uniform3iv : [ `ivec3 ] uniformLocation t -> int js_array t -> unit meth method uniform3iv_typed : [ `ivec3 ] uniformLocation t -> Typed_array.int32Array t -> unit meth method uniform4f : [ `vec4 ] uniformLocation t -> float -> float -> float -> float -> unit meth method uniform4fv_typed : [ `vec4 ] uniformLocation t -> Typed_array.float32Array t -> unit meth method uniform4fv : [ `vec4 ] uniformLocation t -> float js_array t -> unit meth method uniform4i : [ `ivec4 ] uniformLocation t -> int -> int -> int -> int -> unit meth method uniform4iv : [ `ivec4 ] uniformLocation t -> int js_array t -> unit meth method uniform4iv_typed : [ `ivec4 ] uniformLocation t -> Typed_array.int32Array t -> unit meth method uniformMatrix2fv : [ `mat2 ] uniformLocation t -> bool t -> float js_array t -> unit meth method uniformMatrix2fv_typed : [ `mat2 ] uniformLocation t -> bool t -> Typed_array.float32Array t -> unit meth method uniformMatrix3fv : [ `mat3 ] uniformLocation t -> bool t -> float js_array t -> unit meth method uniformMatrix3fv_typed : [ `mat3 ] uniformLocation t -> bool t -> Typed_array.float32Array t -> unit meth method uniformMatrix4fv : [ `mat4 ] uniformLocation t -> bool t -> float js_array t -> unit meth method uniformMatrix4fv_typed : [ `mat4 ] uniformLocation t -> bool t -> Typed_array.float32Array t -> unit meth method vertexAttrib1f : uint -> float -> unit meth method vertexAttrib1fv : uint -> float js_array t -> unit meth method vertexAttrib1fv_typed : uint -> Typed_array.float32Array t -> unit meth method vertexAttrib2f : uint -> float -> float -> unit meth method vertexAttrib2fv : uint -> float js_array t -> unit meth method vertexAttrib2fv_typed : uint -> Typed_array.float32Array t -> unit meth method vertexAttrib3f : uint -> float -> float -> float -> unit meth method vertexAttrib3fv : uint -> float js_array t -> unit meth method vertexAttrib3fv_typed : uint -> Typed_array.float32Array t -> unit meth method vertexAttrib4f : uint -> float -> float -> float -> float -> unit meth method vertexAttrib4fv : uint -> float js_array t -> unit meth method vertexAttrib4fv_typed : uint -> Typed_array.float32Array t -> unit meth method vertexAttribPointer : uint -> int -> dataType -> bool t -> sizei -> intptr -> unit meth (** 5.13.11 Writing to the drawing buffer *) method clear : clearBufferMask -> unit meth method drawArrays : beginMode -> int -> sizei -> unit meth method drawElements : beginMode -> sizei -> dataType -> intptr -> unit meth method finish : unit meth method flush : unit meth (** 5.13.12 Reading back pixels *) method readPixels : int -> int -> sizei -> sizei -> pixelFormat -> pixelType -> #Typed_array.arrayBufferView t -> unit meth (** 5.13.13 Detecting context lost events *) method isContextLost : bool t meth (** 5.13.14 Detecting and enabling extensions *) method getSupportedExtensions : js_string t js_array t meth method getExtension : 'a. js_string t -> 'a t opt meth (* Untyped! *) (** Constants *) method _DEPTH_BUFFER_BIT_ : clearBufferMask readonly_prop method _STENCIL_BUFFER_BIT_ : clearBufferMask readonly_prop method _COLOR_BUFFER_BIT_ : clearBufferMask readonly_prop method _POINTS : beginMode readonly_prop method _LINES : beginMode readonly_prop method _LINE_LOOP_ : beginMode readonly_prop method _LINE_STRIP_ : beginMode readonly_prop method _TRIANGLES : beginMode readonly_prop method _TRIANGLE_STRIP_ : beginMode readonly_prop method _TRIANGLE_FAN_ : beginMode readonly_prop method _ZERO : blendingFactor readonly_prop method _ONE : blendingFactor readonly_prop method _SRC_COLOR_ : blendingFactor readonly_prop method _ONE_MINUS_SRC_COLOR_ : blendingFactor readonly_prop method _SRC_ALPHA_ : blendingFactor readonly_prop method _ONE_MINUS_SRC_ALPHA_ : blendingFactor readonly_prop method _DST_ALPHA_ : blendingFactor readonly_prop method _ONE_MINUS_DST_ALPHA_ : blendingFactor readonly_prop method _DST_COLOR_ : blendingFactor readonly_prop method _ONE_MINUS_DST_COLOR_ : blendingFactor readonly_prop method _SRC_ALPHA_SATURATE_ : blendingFactor readonly_prop method _FUNC_ADD_ : blendMode readonly_prop method _FUNC_SUBTRACT_ : blendMode readonly_prop method _FUNC_REVERSE_SUBTRACT_ : blendMode readonly_prop method _CONSTANT_COLOR_ : blendMode readonly_prop method _ONE_MINUS_CONSTANT_COLOR_ : blendMode readonly_prop method _CONSTANT_ALPHA_ : blendMode readonly_prop method _ONE_MINUS_CONSTANT_ALPHA_ : blendMode readonly_prop method _ARRAY_BUFFER_ : bufferTarget readonly_prop method _ELEMENT_ARRAY_BUFFER_ : bufferTarget readonly_prop method _STREAM_DRAW_ : bufferUsage readonly_prop method _STATIC_DRAW_ : bufferUsage readonly_prop method _DYNAMIC_DRAW_ : bufferUsage readonly_prop method _FRONT : cullFaceMode readonly_prop method _BACK : cullFaceMode readonly_prop method _FRONT_AND_BACK_ : cullFaceMode readonly_prop method _CULL_FACE_ : enableCap readonly_prop method _BLEND : enableCap readonly_prop method _DITHER : enableCap readonly_prop method _STENCIL_TEST_ : enableCap readonly_prop method _DEPTH_TEST_ : enableCap readonly_prop method _SCISSOR_TEST_ : enableCap readonly_prop method _POLYGON_OFFSET_FILL_ : enableCap readonly_prop method _SAMPLE_ALPHA_TO_COVERAGE_ : enableCap readonly_prop method _SAMPLE_COVERAGE_ : enableCap readonly_prop method _NO_ERROR_ : errorCode readonly_prop method _INVALID_ENUM_ : errorCode readonly_prop method _INVALID_VALUE_ : errorCode readonly_prop method _INVALID_OPERATION_ : errorCode readonly_prop method _OUT_OF_MEMORY_ : errorCode readonly_prop method _CONTEXT_LOST_WEBGL_ : errorCode readonly_prop method _INVALID_FRAMEBUFFER_OPERATION_ : errorCode readonly_prop method _CW : frontFaceDir readonly_prop method _CCW : frontFaceDir readonly_prop method _DONT_CARE_ : hintMode readonly_prop method _FASTEST : hintMode readonly_prop method _NICEST : hintMode readonly_prop method _GENERATE_MIPMAP_HINT_ : hintTarget readonly_prop method _BLEND_EQUATION_ : blendMode parameter readonly_prop method _BLEND_EQUATION_RGB_ : blendMode parameter readonly_prop method _BLEND_EQUATION_ALPHA_ : blendMode parameter readonly_prop method _BLEND_DST_RGB_ : blendingFactor parameter readonly_prop method _BLEND_SRC_RGB_ : blendingFactor parameter readonly_prop method _BLEND_DST_ALPHA_ : blendingFactor parameter readonly_prop method _BLEND_SRC_ALPHA_ : blendingFactor parameter readonly_prop method _BLEND_COLOR_ : Typed_array.float32Array t parameter readonly_prop method _ARRAY_BUFFER_BINDING_ : buffer t opt parameter readonly_prop method _ELEMENT_ARRAY_BUFFER_BINDING_ : buffer t opt parameter readonly_prop method _CULL_FACE_PARAM : bool t parameter readonly_prop method _BLEND_PARAM : bool t parameter readonly_prop method _DITHER_PARAM : bool t parameter readonly_prop method _STENCIL_TEST_PARAM : bool t parameter readonly_prop method _DEPTH_TEST_PARAM : bool t parameter readonly_prop method _SCISSOR_TEST_PARAM : bool t parameter readonly_prop method _POLYGON_OFFSET_FILL_PARAM : bool t parameter readonly_prop method _LINE_WIDTH_ : float parameter readonly_prop method _ALIASED_POINT_SIZE_RANGE_ : Typed_array.float32Array t parameter readonly_prop method _ALIASED_LINE_WIDTH_RANGE_ : Typed_array.float32Array t parameter readonly_prop method _CULL_FACE_MODE_ : cullFaceMode parameter readonly_prop method _FRONT_FACE_ : frontFaceDir parameter readonly_prop method _DEPTH_RANGE_ : Typed_array.float32Array t parameter readonly_prop method _DEPTH_WRITEMASK_ : bool t parameter readonly_prop method _DEPTH_CLEAR_VALUE_ : float parameter readonly_prop method _DEPTH_FUNC_ : depthFunction parameter readonly_prop method _STENCIL_CLEAR_VALUE_ : int parameter readonly_prop method _STENCIL_FUNC_ : int parameter readonly_prop method _STENCIL_FAIL_ : int parameter readonly_prop method _STENCIL_PASS_DEPTH_FAIL_ : int parameter readonly_prop method _STENCIL_PASS_DEPTH_PASS_ : int parameter readonly_prop method _STENCIL_REF_ : int parameter readonly_prop method _STENCIL_VALUE_MASK_ : int parameter readonly_prop method _STENCIL_WRITEMASK_ : int parameter readonly_prop method _STENCIL_BACK_FUNC_ : int parameter readonly_prop method _STENCIL_BACK_FAIL_ : int parameter readonly_prop method _STENCIL_BACK_PASS_DEPTH_FAIL_ : int parameter readonly_prop method _STENCIL_BACK_PASS_DEPTH_PASS_ : int parameter readonly_prop method _STENCIL_BACK_REF_ : int parameter readonly_prop method _STENCIL_BACK_VALUE_MASK_ : int parameter readonly_prop method _STENCIL_BACK_WRITEMASK_ : int parameter readonly_prop method _VIEWPORT : Typed_array.int32Array t parameter readonly_prop method _SCISSOR_BOX_ : Typed_array.int32Array t parameter readonly_prop method _COLOR_CLEAR_VALUE_ : Typed_array.float32Array t parameter readonly_prop method _COLOR_WRITEMASK_ : bool t js_array t parameter readonly_prop method _UNPACK_ALIGNMENT_PARAM : int parameter readonly_prop method _PACK_ALIGNMENT_ : int parameter readonly_prop method _MAX_TEXTURE_SIZE_ : int parameter readonly_prop method _MAX_VIEWPORT_DIMS_ : Typed_array.int32Array t parameter readonly_prop method _SUBPIXEL_BITS_ : int parameter readonly_prop method _RED_BITS_ : int parameter readonly_prop method _GREEN_BITS_ : int parameter readonly_prop method _BLUE_BITS_ : int parameter readonly_prop method _ALPHA_BITS_ : int parameter readonly_prop method _DEPTH_BITS_ : int parameter readonly_prop method _STENCIL_BITS_ : int parameter readonly_prop method _POLYGON_OFFSET_UNITS_ : float parameter readonly_prop method _POLYGON_OFFSET_FACTOR_ : float parameter readonly_prop method _TEXTURE_BINDING_2D_ : texture t opt parameter readonly_prop method _TEXTURE_BINDING_CUBE_MAP_ : texture t opt parameter readonly_prop method _SAMPLE_BUFFERS_ : int parameter readonly_prop method _SAMPLES_ : int parameter readonly_prop method _SAMPLE_COVERAGE_VALUE_ : float parameter readonly_prop method _SAMPLE_COVERAGE_INVERT_ : bool t parameter readonly_prop method _NUM_COMPRESSED_TEXTURE_FORMATS_ : int parameter readonly_prop method _COMPRESSED_TEXTURE_FORMATS_ : Typed_array.uint32Array t parameter readonly_prop method _GENERATE_MIPMAP_HINT_PARAM_ : hintMode parameter readonly_prop method _BUFFER_SIZE_ : int bufferParameter readonly_prop method _BUFFER_USAGE_ : bufferUsage bufferParameter readonly_prop method _BYTE : dataType readonly_prop method _UNSIGNED_BYTE_DT : dataType readonly_prop method _SHORT : dataType readonly_prop method _UNSIGNED_SHORT_ : dataType readonly_prop method _INT : dataType readonly_prop method _UNSIGNED_INT_ : dataType readonly_prop method _FLOAT : dataType readonly_prop method _UNSIGNED_BYTE_ : pixelType readonly_prop method _UNSIGNED_SHORT_4_4_4_4_ : pixelType readonly_prop method _UNSIGNED_SHORT_5_5_5_1_ : pixelType readonly_prop method _UNSIGNED_SHORT_5_6_5_ : pixelType readonly_prop method _ALPHA : pixelFormat readonly_prop method _RGB : pixelFormat readonly_prop method _RGBA : pixelFormat readonly_prop method _LUMINANCE : pixelFormat readonly_prop method _LUMINANCE_ALPHA_ : pixelFormat readonly_prop method _STENCIL_INDEX_ : pixelFormat readonly_prop method _DEPTH_STENCIL_ : pixelFormat readonly_prop method _DEPTH_COMPONENT_ : pixelFormat readonly_prop method _FRAGMENT_SHADER_ : shaderType readonly_prop method _VERTEX_SHADER_ : shaderType readonly_prop method _MAX_VERTEX_ATTRIBS_ : int parameter readonly_prop method _MAX_VERTEX_UNIFORM_VECTORS_ : int parameter readonly_prop method _MAX_VARYING_VECTORS_ : int parameter readonly_prop method _MAX_COMBINED_TEXTURE_IMAGE_UNITS_ : int parameter readonly_prop method _MAX_VERTEX_TEXTURE_IMAGE_UNITS_ : int parameter readonly_prop method _MAX_TEXTURE_IMAGE_UNITS_ : int parameter readonly_prop method _MAX_FRAGMENT_UNIFORM_VECTORS_ : int parameter readonly_prop method _SHADER_TYPE_ : shaderType shaderParam readonly_prop method _DELETE_STATUS_ : bool t shaderParam readonly_prop method _COMPILE_STATUS_ : bool t shaderParam readonly_prop method _DELETE_STATUS_PROG : bool t programParam readonly_prop method _LINK_STATUS_ : bool t programParam readonly_prop method _VALIDATE_STATUS_ : bool t programParam readonly_prop method _ATTACHED_SHADERS_ : int programParam readonly_prop method _ACTIVE_UNIFORMS_ : int programParam readonly_prop method _ACTIVE_ATTRIBUTES_ : int programParam readonly_prop method _SHADING_LANGUAGE_VERSION_ : js_string t parameter readonly_prop method _CURRENT_PROGRAM_ : program t opt parameter readonly_prop method _VENDOR : js_string t parameter readonly_prop method _RENDERER : js_string t parameter readonly_prop method _VERSION : js_string t parameter readonly_prop method _MAX_CUBE_MAP_TEXTURE_SIZE_ : int parameter readonly_prop method _ACTIVE_TEXTURE_ : textureUnit parameter readonly_prop method _FRAMEBUFFER_BINDING_ : framebuffer t opt parameter readonly_prop method _RENDERBUFFER_BINDING_ : renderbuffer t opt parameter readonly_prop method _MAX_RENDERBUFFER_SIZE : int parameter readonly_prop method _NEVER : depthFunction readonly_prop method _LESS : depthFunction readonly_prop method _EQUAL : depthFunction readonly_prop method _LEQUAL : depthFunction readonly_prop method _GREATER : depthFunction readonly_prop method _NOTEQUAL : depthFunction readonly_prop method _GEQUAL : depthFunction readonly_prop method _ALWAYS : depthFunction readonly_prop method _KEEP : stencilOp readonly_prop method _REPLACE : stencilOp readonly_prop method _INCR : stencilOp readonly_prop method _DECR : stencilOp readonly_prop method _INVERT : stencilOp readonly_prop method _INCR_WRAP_ : stencilOp readonly_prop method _DECR_WRAP_ : stencilOp readonly_prop method _ZERO_ : stencilOp readonly_prop method _NEAREST : texFilter readonly_prop method _LINEAR : texFilter readonly_prop method _NEAREST_MIPMAP_NEAREST_ : texFilter readonly_prop method _LINEAR_MIPMAP_NEAREST_ : texFilter readonly_prop method _NEAREST_MIPMAP_LINEAR_ : texFilter readonly_prop method _LINEAR_MIPMAP_LINEAR_ : texFilter readonly_prop method _TEXTURE_MAG_FILTER_ : texFilter texParam readonly_prop method _TEXTURE_MIN_FILTER_ : texFilter texParam readonly_prop method _TEXTURE_WRAP_S_ : wrapMode texParam readonly_prop method _TEXTURE_WRAP_T_ : wrapMode texParam readonly_prop method _NONE_OT : objectType readonly_prop method _TEXTURE_OT : objectType readonly_prop method _RENDERBUFFER_OT : objectType readonly_prop method _TEXTURE_2D_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_POSITIVE_X_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_NEGATIVE_X_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_POSITIVE_Y_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_NEGATIVE_Y_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_POSITIVE_Z_ : texTarget readonly_prop method _TEXTURE_CUBE_MAP_NEGATIVE_Z_ : texTarget readonly_prop method _TEXTURE0 : textureUnit readonly_prop method _TEXTURE1 : textureUnit readonly_prop method _TEXTURE2 : textureUnit readonly_prop method _TEXTURE3 : textureUnit readonly_prop method _TEXTURE4 : textureUnit readonly_prop method _TEXTURE5 : textureUnit readonly_prop method _TEXTURE6 : textureUnit readonly_prop method _TEXTURE7 : textureUnit readonly_prop method _TEXTURE8 : textureUnit readonly_prop method _TEXTURE9 : textureUnit readonly_prop method _TEXTURE10 : textureUnit readonly_prop method _TEXTURE11 : textureUnit readonly_prop method _TEXTURE12 : textureUnit readonly_prop method _TEXTURE13 : textureUnit readonly_prop method _TEXTURE14 : textureUnit readonly_prop method _TEXTURE15 : textureUnit readonly_prop method _TEXTURE16 : textureUnit readonly_prop method _TEXTURE17 : textureUnit readonly_prop method _TEXTURE18 : textureUnit readonly_prop method _TEXTURE19 : textureUnit readonly_prop method _TEXTURE20 : textureUnit readonly_prop method _TEXTURE21 : textureUnit readonly_prop method _TEXTURE22 : textureUnit readonly_prop method _TEXTURE23 : textureUnit readonly_prop method _TEXTURE24 : textureUnit readonly_prop method _TEXTURE25 : textureUnit readonly_prop method _TEXTURE26 : textureUnit readonly_prop method _TEXTURE27 : textureUnit readonly_prop method _TEXTURE28 : textureUnit readonly_prop method _TEXTURE29 : textureUnit readonly_prop method _TEXTURE30 : textureUnit readonly_prop method _TEXTURE31 : textureUnit readonly_prop method _REPEAT : wrapMode readonly_prop method _CLAMP_TO_EDGE_ : wrapMode readonly_prop method _MIRRORED_REPEAT_ : wrapMode readonly_prop method _FLOAT_ : uniformType readonly_prop method _FLOAT_VEC2_ : uniformType readonly_prop method _FLOAT_VEC3_ : uniformType readonly_prop method _FLOAT_VEC4_ : uniformType readonly_prop method _INT_ : uniformType readonly_prop method _INT_VEC2_ : uniformType readonly_prop method _INT_VEC3_ : uniformType readonly_prop method _INT_VEC4_ : uniformType readonly_prop method _BOOL_ : uniformType readonly_prop method _BOOL_VEC2_ : uniformType readonly_prop method _BOOL_VEC3_ : uniformType readonly_prop method _BOOL_VEC4_ : uniformType readonly_prop method _FLOAT_MAT2_ : uniformType readonly_prop method _FLOAT_MAT3_ : uniformType readonly_prop method _FLOAT_MAT4_ : uniformType readonly_prop method _SAMPLER_2D_ : uniformType readonly_prop method _SAMPLER_CUBE_ : uniformType readonly_prop method _VERTEX_ATTRIB_ARRAY_ENABLED_ : bool t vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_SIZE_ : int vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_STRIDE_ : int vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_TYPE_ : int vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_NORMALIZED_ : bool t vertexAttribParam readonly_prop method _VERTEX_ATTRIB_ARRAY_POINTER_ : vertexAttribPointerParam readonly_prop method _VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ : buffer t opt vertexAttribParam readonly_prop method _CURRENT_VERTEX_ATTRIB_ : Typed_array.float32Array t vertexAttribParam readonly_prop method _LOW_FLOAT_ : shaderPrecisionType readonly_prop method _MEDIUM_FLOAT_ : shaderPrecisionType readonly_prop method _HIGH_FLOAT_ : shaderPrecisionType readonly_prop method _LOW_INT_ : shaderPrecisionType readonly_prop method _MEDIUM_INT_ : shaderPrecisionType readonly_prop method _HIGH_INT_ : shaderPrecisionType readonly_prop method _FRAMEBUFFER : fbTarget readonly_prop method _RENDERBUFFER : rbTarget readonly_prop method _RGBA4 : format readonly_prop method _RGB5_A1_ : format readonly_prop method _RGB565 : format readonly_prop method _DEPTH_COMPONENT16_ : format readonly_prop method _STENCIL_INDEX8_ : format readonly_prop method _RENDERBUFFER_WIDTH_ : int renderbufferParam readonly_prop method _RENDERBUFFER_HEIGHT_ : int renderbufferParam readonly_prop method _RENDERBUFFER_INTERNAL_FORMAT_ : format renderbufferParam readonly_prop method _RENDERBUFFER_RED_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_GREEN_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_BLUE_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_ALPHA_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_DEPTH_SIZE_ : int renderbufferParam readonly_prop method _RENDERBUFFER_STENCIL_SIZE_ : int renderbufferParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_ : objectType attachParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_RENDERBUFFER : renderbuffer t attachParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_TEXTURE : texture t attachParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_ : int attachParam readonly_prop method _FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_ : int attachParam readonly_prop method _COLOR_ATTACHMENT0_ : attachmentPoint readonly_prop method _DEPTH_ATTACHMENT_ : attachmentPoint readonly_prop method _STENCIL_ATTACHMENT_ : attachmentPoint readonly_prop method _DEPTH_STENCIL_ATTACHMENT_ : attachmentPoint readonly_prop method _FRAMEBUFFER_COMPLETE_ : framebufferStatus readonly_prop method _FRAMEBUFFER_INCOMPLETE_ATTACHMENT_ : framebufferStatus readonly_prop method _FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_ : framebufferStatus readonly_prop method _FRAMEBUFFER_INCOMPLETE_DIMENSIONS_ : framebufferStatus readonly_prop method _FRAMEBUFFER_UNSUPPORTED_ : framebufferStatus readonly_prop method _UNPACK_FLIP_Y_WEBGL_PARAM : bool t parameter readonly_prop method _UNPACK_PREMULTIPLY_ALPHA_WEBGL_PARAM : bool t parameter readonly_prop method _UNPACK_COLORSPACE_CONVERSION_WEBGL_PARAM : colorspaceConversion parameter readonly_prop method _NONE : colorspaceConversion readonly_prop method _BROWSER_DEFAULT_WEBGL_ : colorspaceConversion readonly_prop method _UNPACK_ALIGNMENT_ : int pixelStoreParam readonly_prop method _UNPACK_FLIP_Y_WEBGL_ : bool t pixelStoreParam readonly_prop method _UNPACK_PREMULTIPLY_ALPHA_WEBGL_ : bool t pixelStoreParam readonly_prop method _UNPACK_COLORSPACE_CONVERSION_WEBGL_ : int pixelStoreParam readonly_prop end (** 5.14 WebGLContextEvent *) class type contextEvent = object inherit Dom_html.event method statusMessage : js_string t readonly_prop end module Event : sig val webglcontextlost : contextEvent t Dom_html.Event.typ val webglcontextrestored : contextEvent t Dom_html.Event.typ val webglcontextcreationerror : contextEvent t Dom_html.Event.typ end (** Get a context *) val getContext : Dom_html.canvasElement t -> renderingContext t opt val getContextWithAttributes : Dom_html.canvasElement t -> contextAttributes t -> renderingContext t opt js_of_ocaml-3.5.2/lib/js_of_ocaml/webSockets.ml000066400000000000000000000053671357507750000215040ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2012 Jacques-Pascal Deplaix * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open! Import type readyState = | CONNECTING | OPEN | CLOSING | CLOSED class type ['a] closeEvent = object inherit ['a] Dom.event method code : int Js.readonly_prop method reason : Js.js_string Js.t Js.readonly_prop method wasClean : bool Js.t Js.readonly_prop end class type ['a] messageEvent = object inherit ['a] Dom.event method data : Js.js_string Js.t Js.readonly_prop method data_buffer : Typed_array.arrayBuffer Js.t Js.readonly_prop method data_blob : File.blob Js.t Js.readonly_prop end class type webSocket = object ('self) inherit Dom_html.eventTarget method url : Js.js_string Js.t Js.readonly_prop method readyState : readyState Js.readonly_prop method bufferedAmount : int Js.readonly_prop method onopen : ('self Js.t, 'self Dom.event Js.t) Dom.event_listener Js.writeonly_prop method onclose : ('self Js.t, 'self closeEvent Js.t) Dom.event_listener Js.writeonly_prop method onerror : ('self Js.t, 'self Dom.event Js.t) Dom.event_listener Js.writeonly_prop method extensions : Js.js_string Js.t Js.readonly_prop method protocol : Js.js_string Js.t Js.readonly_prop method close : unit Js.meth method close_withCode : int -> unit Js.meth method close_withCodeAndReason : int -> Js.js_string Js.t -> unit Js.meth method onmessage : ('self Js.t, 'self messageEvent Js.t) Dom.event_listener Js.writeonly_prop method binaryType : Js.js_string Js.t Js.prop method send : Js.js_string Js.t -> unit Js.meth method send_buffer : Typed_array.arrayBuffer Js.t -> unit Js.meth method send_blob : File.blob Js.t -> unit Js.meth end let webSocket = Js.Unsafe.global##._WebSocket let webSocket_withProtocol = webSocket let webSocket_withProtocols = webSocket let is_supported () = Js.Optdef.test webSocket js_of_ocaml-3.5.2/lib/js_of_ocaml/webSockets.mli000066400000000000000000000056211357507750000216460ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2012 Jacques-Pascal Deplaix * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** WebSocket binding *) type readyState = | CONNECTING | OPEN | CLOSING | CLOSED class type ['a] closeEvent = object inherit ['a] Dom.event method code : int Js.readonly_prop method reason : Js.js_string Js.t Js.readonly_prop method wasClean : bool Js.t Js.readonly_prop end class type ['a] messageEvent = object inherit ['a] Dom.event method data : Js.js_string Js.t Js.readonly_prop method data_buffer : Typed_array.arrayBuffer Js.t Js.readonly_prop method data_blob : File.blob Js.t Js.readonly_prop end class type webSocket = object ('self) inherit Dom_html.eventTarget method url : Js.js_string Js.t Js.readonly_prop method readyState : readyState Js.readonly_prop method bufferedAmount : int Js.readonly_prop method onopen : ('self Js.t, 'self Dom.event Js.t) Dom.event_listener Js.writeonly_prop method onclose : ('self Js.t, 'self closeEvent Js.t) Dom.event_listener Js.writeonly_prop method onerror : ('self Js.t, 'self Dom.event Js.t) Dom.event_listener Js.writeonly_prop method extensions : Js.js_string Js.t Js.readonly_prop method protocol : Js.js_string Js.t Js.readonly_prop method close : unit Js.meth method close_withCode : int -> unit Js.meth method close_withCodeAndReason : int -> Js.js_string Js.t -> unit Js.meth method onmessage : ('self Js.t, 'self messageEvent Js.t) Dom.event_listener Js.writeonly_prop method binaryType : Js.js_string Js.t Js.prop method send : Js.js_string Js.t -> unit Js.meth method send_buffer : Typed_array.arrayBuffer Js.t -> unit Js.meth method send_blob : File.blob Js.t -> unit Js.meth end val webSocket : (Js.js_string Js.t -> webSocket Js.t) Js.constr val webSocket_withProtocol : (Js.js_string Js.t -> Js.js_string Js.t -> webSocket Js.t) Js.constr val webSocket_withProtocols : (Js.js_string Js.t -> Js.js_string Js.t Js.js_array Js.t -> webSocket Js.t) Js.constr val is_supported : unit -> bool js_of_ocaml-3.5.2/lib/js_of_ocaml/worker.ml000066400000000000000000000045031357507750000206730ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2015 OCamlPro: Grégoire Henry, Çağdaş Bozman. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open Dom_html open! Import class type ['a, 'b] worker = object ('self) inherit eventTarget method onerror : ('self t, errorEvent t) event_listener writeonly_prop method onmessage : ('self t, 'b messageEvent t) event_listener writeonly_prop method postMessage : 'a -> unit meth method terminate : unit meth end and errorEvent = object inherit event method msg : js_string t readonly_prop method filename : js_string t readonly_prop method lineno : int t readonly_prop method colno : int t readonly_prop method error : Unsafe.any -> unit meth end and ['a] messageEvent = object inherit event method data : 'a readonly_prop end let worker = Unsafe.global##._Worker let create script = new%js worker (string script) let import_scripts scripts : unit = if Unsafe.global##.importScripts == undefined then invalid_arg "Worker.import_scripts is undefined"; Unsafe.fun_call Unsafe.global##.importScripts (Array.map (fun s -> Unsafe.inject (string s)) (Array.of_list scripts)) let set_onmessage handler = if Unsafe.global##.onmessage == undefined then invalid_arg "Worker.onmessage is undefined"; let js_handler (ev : 'a messageEvent Js.t) = handler ev##.data in Unsafe.global##.onmessage := wrap_callback js_handler let post_message msg = if Unsafe.global##.postMessage == undefined then invalid_arg "Worker.onmessage is undefined"; Unsafe.global##postMessage msg js_of_ocaml-3.5.2/lib/js_of_ocaml/worker.mli000066400000000000000000000041201357507750000210370ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2015 OCamlPro: Grégoire Henry, Çağdaş Bozman. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Low-level bindgins to javascript Web Workers. See {{:https://developer.mozilla.org/en-US/docs/Web/API/Worker} the documented Javascript API} and some more general documentation {{:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers} about the usage of WebWorker}. *) open Js open Dom_html class type ['a, 'b] worker = object ('self) inherit eventTarget method onerror : ('self t, errorEvent t) event_listener writeonly_prop method onmessage : ('self t, 'b messageEvent t) event_listener writeonly_prop method postMessage : 'a -> unit meth method terminate : unit meth end and errorEvent = object inherit event method msg : js_string t readonly_prop method filename : js_string t readonly_prop method lineno : int t readonly_prop method colno : int t readonly_prop method error : Unsafe.any -> unit meth end and ['a] messageEvent = object inherit event method data : 'a readonly_prop end val create : string -> ('a, 'b) worker t (** {2 Global function to be used by the worker.} *) val import_scripts : string list -> unit val set_onmessage : ('a -> unit) -> unit val post_message : 'a -> unit js_of_ocaml-3.5.2/lib/js_of_ocaml/xmlHttpRequest.ml000066400000000000000000000072231357507750000223750ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js open! Import type readyState = | UNSENT | OPENED | HEADERS_RECEIVED | LOADING | DONE type _ response = | ArrayBuffer : Typed_array.arrayBuffer t Opt.t response | Blob : #File.blob t Opt.t response | Document : Dom.element Dom.document t Opt.t response | JSON : 'a Opt.t response | Text : js_string t response | Default : string response class type xmlHttpRequest = object ('self) method onreadystatechange : (unit -> unit) Js.callback Js.writeonly_prop method readyState : readyState readonly_prop method _open : js_string t -> js_string t -> bool t -> unit meth method _open_full : js_string t -> js_string t -> bool t -> js_string t opt -> js_string t opt -> unit meth method setRequestHeader : js_string t -> js_string t -> unit meth method overrideMimeType : js_string t -> unit meth method send : js_string t opt -> unit meth method send_blob : #File.blob t -> unit meth method send_document : Dom.element Dom.document t -> unit meth method send_formData : Form.formData t -> unit meth method abort : unit meth method status : int readonly_prop method statusText : js_string t readonly_prop method getResponseHeader : js_string t -> js_string t opt meth method getAllResponseHeaders : js_string t meth method response : File.file_any readonly_prop method responseText : js_string t opt readonly_prop method responseXML : Dom.element Dom.document t opt readonly_prop method responseType : js_string t prop method withCredentials : bool t writeonly_prop inherit File.progressEventTarget method ontimeout : ('self t, 'self File.progressEvent t) Dom.event_listener writeonly_prop method upload : xmlHttpRequestUpload t optdef readonly_prop end and xmlHttpRequestUpload = object ('self) inherit File.progressEventTarget end module Event = struct type typ = xmlHttpRequest File.progressEvent t Dom.Event.typ let readystatechange = Dom.Event.make "readystatechange" let loadstart = Dom.Event.make "loadstart" let progress = Dom.Event.make "progress" let abort = Dom.Event.make "abort" let error = Dom.Event.make "error" let load = Dom.Event.make "load" let timeout = Dom.Event.make "timeout" let loadend = Dom.Event.make "loadend" end let create () : xmlHttpRequest Js.t = let xmlHttpRequest = Js.Unsafe.global##._XMLHttpRequest in let activeXObject = Js.Unsafe.global##.activeXObject in try new%js xmlHttpRequest with _ -> ( try new%js activeXObject (Js.string "Msxml2.XMLHTTP") with _ -> ( try new%js activeXObject (Js.string "Msxml3.XMLHTTP") with _ -> ( try new%js activeXObject (Js.string "Microsoft.XMLHTTP") with _ -> assert false))) js_of_ocaml-3.5.2/lib/js_of_ocaml/xmlHttpRequest.mli000066400000000000000000000063621357507750000225510ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** XmlHttpRequest object. *) open Js type readyState = | UNSENT | OPENED | HEADERS_RECEIVED | LOADING | DONE type _ response = | ArrayBuffer : Typed_array.arrayBuffer t Opt.t response | Blob : #File.blob t Opt.t response | Document : Dom.element Dom.document t Opt.t response | JSON : 'a Opt.t response | Text : js_string t response | Default : string response class type xmlHttpRequest = object ('self) method onreadystatechange : (unit -> unit) Js.callback Js.writeonly_prop method readyState : readyState readonly_prop method _open : js_string t -> js_string t -> bool t -> unit meth method _open_full : js_string t -> js_string t -> bool t -> js_string t opt -> js_string t opt -> unit meth method setRequestHeader : js_string t -> js_string t -> unit meth method overrideMimeType : js_string t -> unit meth method send : js_string t opt -> unit meth method send_blob : #File.blob t -> unit meth method send_document : Dom.element Dom.document t -> unit meth method send_formData : Form.formData t -> unit meth method abort : unit meth method status : int readonly_prop method statusText : js_string t readonly_prop method getResponseHeader : js_string t -> js_string t opt meth method getAllResponseHeaders : js_string t meth method response : File.file_any readonly_prop method responseText : js_string t opt readonly_prop method responseXML : Dom.element Dom.document t opt readonly_prop method responseType : js_string t prop method withCredentials : bool t writeonly_prop inherit File.progressEventTarget method ontimeout : ('self t, 'self File.progressEvent t) Dom.event_listener writeonly_prop method upload : xmlHttpRequestUpload t optdef readonly_prop end and xmlHttpRequestUpload = object ('self) inherit File.progressEventTarget end val create : unit -> xmlHttpRequest t (** The next part of this module allow one to use Ocaml with no need for Javascript documentation. *) module Event : sig type typ = xmlHttpRequest File.progressEvent t Dom.Event.typ val readystatechange : xmlHttpRequest Dom.event t Dom.Event.typ val loadstart : typ val progress : typ val abort : typ val error : typ val load : typ val timeout : typ val loadend : typ end js_of_ocaml-3.5.2/lib/lwt/000077500000000000000000000000001357507750000153615ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/lwt/dune000066400000000000000000000002061357507750000162350ustar00rootroot00000000000000(library (name js_of_ocaml_lwt) (public_name js_of_ocaml-lwt) (libraries js_of_ocaml lwt) (preprocess (pps js_of_ocaml-ppx))) js_of_ocaml-3.5.2/lib/lwt/graphics/000077500000000000000000000000001357507750000171615ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/lwt/graphics/dune000066400000000000000000000010441357507750000200360ustar00rootroot00000000000000(* -*- tuareg -*- *) open Jbuild_plugin.V1 let graphics_exists = try match run_and_read_lines "ocamlfind query -a-format -predicates byte graphics" with | path :: _ -> Sys.file_exists path | _ -> false with _ -> false let () = let jbuild = if graphics_exists then {| (library (name graphics_js) (public_name js_of_ocaml-lwt.graphics) (synopsis "Graphics for js_of_ocaml.") (optional) (libraries js_of_ocaml js_of_ocaml-lwt lwt graphics) (preprocess (pps js_of_ocaml-ppx))) |} else {||} in send jbuild js_of_ocaml-3.5.2/lib/lwt/graphics/graphics_js.ml000066400000000000000000000107361357507750000220160ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js_of_ocaml_lwt open! Import include Graphics type context let _ = Callback.register_exception "Graphics.Graphic_failure" (Graphic_failure "") let ( >>= ) = Lwt.bind let get_context () = Js.Unsafe.(fun_call (variable "caml_gr_state_get") [||]) let set_context ctx = Js.Unsafe.(fun_call (variable "caml_gr_state_set") [| inject ctx |]) let create_context canvas w h = Js.Unsafe.( fun_call (variable "caml_gr_state_create") [| inject canvas; inject w; inject h |]) let document_of_context ctx = Js.Unsafe.(fun_call (variable "caml_gr_doc_of_state") [| inject ctx |]) let open_canvas x = let ctx = create_context x x##.width x##.height in set_context ctx let compute_real_pos elt = let rec loop elt left top = let top = elt##.offsetTop - elt##.scrollTop + top and left = elt##.offsetLeft - elt##.scrollLeft + left in match Js.Opt.to_option elt##.offsetParent with | None -> top, left | Some p -> loop p left top in loop elt 0 0 let mouse_pos () = let ctx = get_context () in let elt = ctx##.canvas in Lwt_js_events.mousemove elt >>= fun ev -> let top, left = compute_real_pos elt in Lwt.return ( Js.Optdef.get ev##.pageX (fun _ -> 0) - left , elt##.height - (Js.Optdef.get ev##.pageY (fun _ -> 0) - top) ) let button_down () = let ctx = get_context () in let elt = ctx##.canvas in Lwt_js_events.mousedown elt >>= fun _ev -> Lwt.return true let read_key () = (* let ctx = get_context() in *) (* let elt = ctx##canvas in *) let doc = document_of_context (get_context ()) in Lwt_js_events.keypress doc >>= fun ev -> Lwt.return (Char.chr ev##.keyCode) let loop elist f : unit = let ctx = get_context () in let elt = ctx##.canvas in let doc = document_of_context (get_context ()) in let button = ref false in let null = char_of_int 0 in let mouse_x, mouse_y = ref 0, ref 0 in let get_pos_mouse () = !mouse_x, !mouse_y in if List.mem Button_down elist then elt##.onmousedown := Dom_html.handler (fun _ev -> let mouse_x, mouse_y = get_pos_mouse () in button := true; let s = { mouse_x; mouse_y; button = true; keypressed = false; key = null } in f s; Js._true); if List.mem Button_up elist then elt##.onmouseup := Dom_html.handler (fun _ev -> let mouse_x, mouse_y = get_pos_mouse () in button := false; let s = { mouse_x; mouse_y; button = false; keypressed = false; key = null } in f s; Js._true); elt##.onmousemove := Dom_html.handler (fun ev -> let cy, cx = compute_real_pos elt in mouse_x := Js.Optdef.get ev##.pageX (fun _ -> 0) - cx; mouse_y := elt##.height - (Js.Optdef.get ev##.pageY (fun _ -> 0) - cy); (if List.mem Mouse_motion elist then let mouse_x, mouse_y = get_pos_mouse () in let s = { mouse_x; mouse_y; button = !button; keypressed = false; key = null } in f s); Js._true); (* EventListener sur le doc car pas de moyen simple de le faire sur un canvasElement *) if List.mem Key_pressed elist then doc##.onkeypress := Dom_html.handler (fun ev -> (* Uncaught Invalid_argument char_of_int with key € for example *) let key = try char_of_int (Js.Optdef.get ev##.charCode (fun _ -> 0)) with Invalid_argument _ -> null in let mouse_x, mouse_y = get_pos_mouse () in let s = { mouse_x; mouse_y; button = !button; keypressed = true; key } in f s; Js._true) let loop_at_exit events handler : unit = at_exit (fun _ -> loop events handler) js_of_ocaml-3.5.2/lib/lwt/graphics/graphics_js.mli000066400000000000000000000047751357507750000221750ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Javascript binding for Graphics lib *) open Js_of_ocaml include module type of Graphics (** {2 Initializations} *) type context (** type of a graphic context *) val open_graph : string -> unit (** Open a graphics window. The graphics window is cleared and the current point is set to (0, 0). The string argument is used to pass optional information on the desired graphics mode, the graphics window size, and so on. Specification can be found at http://www.w3schools.com/jsref/met_win_open.asp. Note: an extra specification is available, "target", to specifies the target attribute or the name of the window. *) val open_canvas : Dom_html.canvasElement Js.t -> unit (** use a canvas to setup the current context *) val get_context : unit -> context (** Get the current context *) val set_context : context -> unit (** Set the current context *) (** {2 Mouse and keyboard events} *) val loop : event list -> (status -> unit) -> unit (** Loops forever and listen to the given events. Those events automatically returns a status record, which is used by the function given in argument. *) (** {2 Mouse and keyboard polling} *) val mouse_pos : unit -> (int * int) Lwt.t (** Return the position of the mouse cursor, relative to the graphics window. If the mouse cursor is outside of the graphics window, [mouse_pos()] returns a point outside of the range [0..size_x()-1, 0..size_y()-1]. *) val button_down : unit -> bool Lwt.t (** Return [true] if the mouse button is pressed, [false] otherwise. *) val read_key : unit -> char Lwt.t (** Wait for a key to be pressed, and return the corresponding character. Keypresses are queued. *) js_of_ocaml-3.5.2/lib/lwt/graphics/import.ml000066400000000000000000000036031357507750000210270ustar00rootroot00000000000000(* Js_of_ocaml * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Poly = struct external ( < ) : 'a -> 'a -> bool = "%lessthan" external ( <= ) : 'a -> 'a -> bool = "%lessequal" external ( <> ) : 'a -> 'a -> bool = "%notequal" external ( = ) : 'a -> 'a -> bool = "%equal" external ( > ) : 'a -> 'a -> bool = "%greaterthan" external ( >= ) : 'a -> 'a -> bool = "%greaterequal" external compare : 'a -> 'a -> int = "%compare" external equal : 'a -> 'a -> bool = "%equal" end module Int_replace_polymorphic_compare = struct let ( < ) (x : int) y = x < y let ( <= ) (x : int) y = x <= y let ( <> ) (x : int) y = x <> y let ( = ) (x : int) y = x = y let ( > ) (x : int) y = x > y let ( >= ) (x : int) y = x >= y let compare (x : int) y = compare x y let equal (x : int) y = x = y let max (x : int) y = if x >= y then x else y let min (x : int) y = if x <= y then x else y end module String = struct include String let equal (x : string) (y : string) = Poly.equal x y end module Char = struct include Char let equal (x : char) (y : char) = Poly.equal x y end include Int_replace_polymorphic_compare js_of_ocaml-3.5.2/lib/lwt/import.ml000066400000000000000000000036031357507750000172270ustar00rootroot00000000000000(* Js_of_ocaml * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Poly = struct external ( < ) : 'a -> 'a -> bool = "%lessthan" external ( <= ) : 'a -> 'a -> bool = "%lessequal" external ( <> ) : 'a -> 'a -> bool = "%notequal" external ( = ) : 'a -> 'a -> bool = "%equal" external ( > ) : 'a -> 'a -> bool = "%greaterthan" external ( >= ) : 'a -> 'a -> bool = "%greaterequal" external compare : 'a -> 'a -> int = "%compare" external equal : 'a -> 'a -> bool = "%equal" end module Int_replace_polymorphic_compare = struct let ( < ) (x : int) y = x < y let ( <= ) (x : int) y = x <= y let ( <> ) (x : int) y = x <> y let ( = ) (x : int) y = x = y let ( > ) (x : int) y = x > y let ( >= ) (x : int) y = x >= y let compare (x : int) y = compare x y let equal (x : int) y = x = y let max (x : int) y = if x >= y then x else y let min (x : int) y = if x <= y then x else y end module String = struct include String let equal (x : string) (y : string) = Poly.equal x y end module Char = struct include Char let equal (x : char) (y : char) = Poly.equal x y end include Int_replace_polymorphic_compare js_of_ocaml-3.5.2/lib/lwt/js_of_ocaml_lwt.ml000066400000000000000000000021451357507750000210560ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module XmlHttpRequest = struct include Js_of_ocaml.XmlHttpRequest include Lwt_xmlHttpRequest end module File = struct include Js_of_ocaml.File include Lwt_file end module Jsonp = Lwt_jsonp module Lwt_js = Lwt_js module Lwt_js_events = Lwt_js_events js_of_ocaml-3.5.2/lib/lwt/log/000077500000000000000000000000001357507750000161425ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/lwt/log/dune000066400000000000000000000003151357507750000170170ustar00rootroot00000000000000(library (name lwt_log_js) (public_name js_of_ocaml-lwt.logger) (synopsis "Lwt logger for js_of_ocaml.") (optional) (libraries js_of_ocaml lwt lwt_log.core) (preprocess (pps js_of_ocaml-ppx))) js_of_ocaml-3.5.2/lib/lwt/log/import.ml000066400000000000000000000036031357507750000200100ustar00rootroot00000000000000(* Js_of_ocaml * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Poly = struct external ( < ) : 'a -> 'a -> bool = "%lessthan" external ( <= ) : 'a -> 'a -> bool = "%lessequal" external ( <> ) : 'a -> 'a -> bool = "%notequal" external ( = ) : 'a -> 'a -> bool = "%equal" external ( > ) : 'a -> 'a -> bool = "%greaterthan" external ( >= ) : 'a -> 'a -> bool = "%greaterequal" external compare : 'a -> 'a -> int = "%compare" external equal : 'a -> 'a -> bool = "%equal" end module Int_replace_polymorphic_compare = struct let ( < ) (x : int) y = x < y let ( <= ) (x : int) y = x <= y let ( <> ) (x : int) y = x <> y let ( = ) (x : int) y = x = y let ( > ) (x : int) y = x > y let ( >= ) (x : int) y = x >= y let compare (x : int) y = compare x y let equal (x : int) y = x = y let max (x : int) y = if x >= y then x else y let min (x : int) y = if x <= y then x else y end module String = struct include String let equal (x : string) (y : string) = Poly.equal x y end module Char = struct include Char let equal (x : char) (y : char) = Poly.equal x y end include Int_replace_polymorphic_compare js_of_ocaml-3.5.2/lib/lwt/log/lwt_log_js.ml000066400000000000000000000134311357507750000206410ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) include Lwt_log_core open Js_of_ocaml open! Import let js_val = Lwt.new_key () let console = make ~close:(fun _ -> Lwt.return_unit) ~output:(fun section level logs -> let str = Js.string (Printf.sprintf "[%s] %s" (Section.name section) (String.concat "\n" logs)) in (match level, Lwt.get js_val with | Debug, None -> Firebug.console##debug str | Debug, Some v -> Firebug.console##debug_2 str v | Info, None | Notice, None -> Firebug.console##info str | Info, Some v | Notice, Some v -> Firebug.console##info_2 str v | Warning, None -> Firebug.console##warn str | Warning, Some v -> Firebug.console##warn_2 str v | Error, None | Fatal, None -> Firebug.console##error str | Error, Some v | Fatal, Some v -> Firebug.console##error_2 str v); Lwt.return_unit) let log ?inspect ?exn ?section ?location ?logger ~level message = let inspect = match inspect with | None -> None | Some v -> Some (Obj.repr v) in Lwt.with_value js_val inspect (fun () -> log ?exn ?section ?location ?logger ~level message) let log_f ?inspect ?exn ?section ?location ?logger ~level format = Printf.ksprintf (log ?inspect ?exn ?section ?location ?logger ~level) format let ign_log ?inspect ?exn ?section ?location ?logger ~level message = try ignore (log ?inspect ?exn ?section ?location ?logger ~level message) with _ -> () let ign_log_f ?inspect ?exn ?section ?location ?logger ~level format = Printf.ksprintf (ign_log ?inspect ?exn ?section ?location ?logger ~level) format let debug ?inspect ?exn ?section ?location ?logger msg = log ?inspect ?exn ?section ?location ?logger ~level:Debug msg let debug_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (debug ?inspect ?exn ?section ?location ?logger) fmt let info ?inspect ?exn ?section ?location ?logger msg = log ?inspect ?exn ?section ?location ?logger ~level:Info msg let info_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (info ?inspect ?exn ?section ?location ?logger) fmt let notice ?inspect ?exn ?section ?location ?logger msg = log ?inspect ?exn ?section ?location ?logger ~level:Notice msg let notice_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (notice ?inspect ?exn ?section ?location ?logger) fmt let warning ?inspect ?exn ?section ?location ?logger msg = log ?inspect ?exn ?section ?location ?logger ~level:Warning msg let warning_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (warning ?inspect ?exn ?section ?location ?logger) fmt let error ?inspect ?exn ?section ?location ?logger msg = log ?inspect ?exn ?section ?location ?logger ~level:Error msg let error_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (error ?inspect ?exn ?section ?location ?logger) fmt let fatal ?inspect ?exn ?section ?location ?logger msg = log ?inspect ?exn ?section ?location ?logger ~level:Fatal msg let fatal_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (fatal ?inspect ?exn ?section ?location ?logger) fmt let ign_debug ?inspect ?exn ?section ?location ?logger msg = ign_log ?inspect ?exn ?section ?location ?logger ~level:Debug msg let ign_debug_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (ign_debug ?inspect ?exn ?section ?location ?logger) fmt let ign_info ?inspect ?exn ?section ?location ?logger msg = ign_log ?inspect ?exn ?section ?location ?logger ~level:Info msg let ign_info_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (ign_info ?inspect ?exn ?section ?location ?logger) fmt let ign_notice ?inspect ?exn ?section ?location ?logger msg = ign_log ?inspect ?exn ?section ?location ?logger ~level:Notice msg let ign_notice_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (ign_notice ?inspect ?exn ?section ?location ?logger) fmt let ign_warning ?inspect ?exn ?section ?location ?logger msg = ign_log ?inspect ?exn ?section ?location ?logger ~level:Warning msg let ign_warning_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (ign_warning ?inspect ?exn ?section ?location ?logger) fmt let ign_error ?inspect ?exn ?section ?location ?logger msg = ign_log ?inspect ?exn ?section ?location ?logger ~level:Error msg let ign_error_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (ign_error ?inspect ?exn ?section ?location ?logger) fmt let ign_fatal ?inspect ?exn ?section ?location ?logger msg = ign_log ?inspect ?exn ?section ?location ?logger ~level:Fatal msg let ign_fatal_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (ign_fatal ?inspect ?exn ?section ?location ?logger) fmt (*let raise_error ?inspect ?exn ?section ?location ?logger msg = Lwt.ignore_result (log ?inspect ?exn ?section ?location ?logger ~level:Error msg); failwith msg *) (*let raise_error_f ?inspect ?exn ?section ?location ?logger fmt = Printf.ksprintf (raise_error ?inspect ?exn ?section ?location ?logger) fmt *) js_of_ocaml-3.5.2/lib/lwt/log/lwt_log_js.mli000066400000000000000000000152231357507750000210130ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) include module type of Lwt_log_core with type level = Lwt_log_core.level and type logger = Lwt_log_core.logger and type section = Lwt_log_core.section and type template = Lwt_log_core.template and module Section = Lwt_log_core.Section (** Lwt logger for js_of_ocaml *) (** {2 Predefined logger} *) val console : Lwt_log_core.logger (** Logger that use the javascript console object. *) (** {2 Logging functions} *) val log : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> level:level -> string -> unit Lwt.t (** [log ?section ?logger ~level message] logs a message. [section] defaults to {!Section.main}. If [logger] is not specified, then the default one is used instead (see {!default}). If [exn] is provided, then its string representation (= [Printexc.to_string exn]) will be append to the message, and if possible the backtrace will also be logged. If [inspect] is provided, it will be append to the message. [location] contains the location of the logging directive, it is of the form [(file_name, line, column)]. *) val log_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> level:level -> ('a, unit, string, unit Lwt.t) format4 -> 'a (** [log_f] is the same as [log] except that it takes a format string *) val ign_log : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> level:level -> string -> unit (** Same as {!log} but ignore the resulting thread. *) val ign_log_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> level:level -> ('a, unit, string, unit) format4 -> 'a (** Same as {!log_f} but ignore the resulting thread. *) (** The following functions are the same as {!log} except that their name determines which level is used. For example [info msg] is the same as [log ~level:Info msg]. *) val debug : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit Lwt.t val debug_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a val ign_debug : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit val ign_debug_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit) format4 -> 'a val info : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit Lwt.t val info_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a val ign_info : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit val ign_info_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit) format4 -> 'a val notice : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit Lwt.t val notice_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a val ign_notice : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit val ign_notice_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit) format4 -> 'a val warning : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit Lwt.t val warning_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a val ign_warning : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit val ign_warning_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit) format4 -> 'a val error : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit Lwt.t val error_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a val ign_error : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit val ign_error_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit) format4 -> 'a val fatal : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit Lwt.t val fatal_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a val ign_fatal : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> string -> unit val ign_fatal_f : ?inspect:'v -> ?exn:exn -> ?section:section -> ?location:string * int * int -> ?logger:logger -> ('a, unit, string, unit) format4 -> 'a js_of_ocaml-3.5.2/lib/lwt/lwt_file.ml000066400000000000000000000040161357507750000175210ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Pierre Chambart * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js open Dom open File open! Import let read_with_filereader (fileReader : fileReader t constr) kind file = let reader = new%js fileReader in let res, w = Lwt.task () in reader##.onloadend := handler (fun _ -> if reader##.readyState == DONE then Lwt.wakeup w (match Opt.to_option (CoerceTo.string reader##.result) with | None -> assert false (* can't happen: called with good readAs_ *) | Some s -> s) else (); (* CCC TODO: handle errors *) Js._false); Lwt.on_cancel res (fun () -> reader##abort); (match kind with | `BinaryString -> reader##readAsBinaryString file | `Text -> reader##readAsText file | `Text_withEncoding e -> reader##readAsText_withEncoding file e | `DataURL -> reader##readAsDataURL file); res let reader kind file = read_with_filereader fileReader kind file let readAsBinaryString file = reader `BinaryString file let readAsText file = reader `Text file let readAsText_withEncoding file e = reader (`Text_withEncoding e) file let readAsDataURL file = reader `DataURL file js_of_ocaml-3.5.2/lib/lwt/lwt_file.mli000066400000000000000000000022371357507750000176750ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2011 Pierre Chambart * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js open File val readAsBinaryString : #blob t -> js_string t Lwt.t val readAsText : #blob t -> js_string t Lwt.t val readAsText_withEncoding : #blob t -> js_string t -> js_string t Lwt.t val readAsDataURL : #blob t -> js_string t Lwt.t js_of_ocaml-3.5.2/lib/lwt/lwt_js.ml000066400000000000000000000030221357507750000172120ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open! Import let sleep d = let t, w = Lwt.task () in let id = Dom_html.setTimeout (Lwt.wakeup w) (d *. 1000.) in Lwt.on_cancel t (fun () -> Dom_html.clearTimeout id); t let yield () = sleep 0. let wakeup = function | 1 -> ignore (Dom_html.window##setTimeout (Js.wrap_callback Lwt.wakeup_paused) 0.) | _ -> () let () = Lwt.register_pause_notifier wakeup let prerr_string s = Firebug.console##log (Js.string s) let _ = Lwt.async_exception_hook := fun exn -> prerr_string "Exception during Lwt.async: "; prerr_string (Printexc.to_string exn); Printexc.print_backtrace stderr js_of_ocaml-3.5.2/lib/lwt/lwt_js.mli000066400000000000000000000023261357507750000173710ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Javascript specific Lwt functions. *) val sleep : float -> unit Lwt.t (** [sleep d] is a threads which remain suspended for [d] seconds and then terminates. *) val yield : unit -> unit Lwt.t (** [yield ()] is a threads which suspends itself and then resumes as soon as possible and terminates. *) js_of_ocaml-3.5.2/lib/lwt/lwt_js_events.ml000066400000000000000000000563251357507750000206140ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Vincent Balat * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open! Import let ( >>= ) = Lwt.bind let async f = Lwt.async (fun () -> Lwt_js.yield () >>= f) let opt_map f = function | None -> None | Some x -> Some (f x) let make_event event_kind ?use_capture ?passive target = let el = ref Js.null in let t, w = Lwt.task () in let cancel () = Js.Opt.iter !el Dom_html.removeEventListener in Lwt.on_cancel t cancel; el := Js.some (Dom.addEventListenerWithOptions ?capture:(opt_map Js.bool use_capture) ?passive:(opt_map Js.bool passive) target event_kind (Dom_html.handler (fun (ev : #Dom_html.event Js.t) -> cancel (); Lwt.wakeup w ev; Js.bool true)) (* true because we do not want to prevent default -> the user can use the preventDefault function above. *)); t let catch_cancel f x = Lwt.catch (fun () -> f x) (function | Lwt.Canceled -> Lwt.return () | e -> Lwt.fail e) let with_error_log f x = Lwt.catch (fun () -> f x) (fun e -> Firebug.console##log (Js.string (Printexc.to_string e)); Lwt.return ()) let seq_loop evh ?(cancel_handler = false) ?use_capture ?passive target handler = let cancelled = ref false in let cur = ref (Lwt.fail (Failure "Lwt_js_event")) in (* Using Lwt.fail as default, to be polymorphic *) let cur_handler = ref (Lwt.return ()) in let lt, _lw = Lwt.task () in Lwt.on_cancel lt (fun () -> Lwt.cancel !cur; if cancel_handler then Lwt.cancel !cur_handler; cancelled := true); let rec aux () = if not !cancelled (* In the case it has been cancelled during the previous handler, we do not reinstall the event handler *) then ( let t = evh ?use_capture ?passive target in cur := t; t >>= fun e -> cur_handler := with_error_log (handler e) lt; !cur_handler >>= aux) else Lwt.return () in Lwt.async (catch_cancel aux); lt let async_loop evh ?use_capture ?passive target handler = let cancelled = ref false in let cur = ref (Lwt.fail (Failure "Lwt_js_event")) in let lt, _lw = Lwt.task () in Lwt.on_cancel lt (fun () -> Lwt.cancel !cur; cancelled := true); let rec aux () = if not !cancelled then ( let t = evh ?use_capture ?passive target in cur := t; t >>= fun e -> Lwt.async (fun () -> with_error_log (handler e) lt); aux ()) else Lwt.return () in Lwt.async (catch_cancel aux); lt let buffered_loop evh ?(cancel_handler = false) ?(cancel_queue = true) ?use_capture ?passive target handler = let cancelled = ref false in let queue = ref [] in let cur = ref (Lwt.fail (Failure "Lwt_js_event")) in let cur_handler = ref (Lwt.return ()) in let lt, _lw = Lwt.task () in let spawn = Lwt_condition.create () in Lwt.on_cancel lt (fun () -> Lwt.cancel !cur; if cancel_handler then Lwt.cancel !cur_handler; if cancel_queue then queue := []; cancelled := true); let rec spawner () = if not !cancelled then ( let t = evh ?use_capture ?passive target in cur := t; t >>= fun e -> queue := e :: !queue; Lwt_condition.signal spawn (); spawner ()) else Lwt.return () in let rec runner () = cur_handler := Lwt.return (); if not !cancelled then ( match !queue with | [] -> Lwt_condition.wait spawn >>= runner | e :: tl -> queue := tl; cur_handler := with_error_log (handler e) lt; !cur_handler >>= runner) else Lwt.return () in Lwt.async (catch_cancel spawner); Lwt.async runner; lt let func_limited_loop event limited_func ?use_capture ?passive target handler = let count = ref 0 in async_loop event ?use_capture ?passive target (fun ev lt -> incr count; let nb = !count in limited_func () >>= fun _ -> if !count = nb then handler ev lt else Lwt.return ()) let limited_loop event ?(elapsed_time = 0.1) = func_limited_loop event (fun () -> Lwt_js.sleep elapsed_time) let click ?use_capture ?passive target = make_event Dom_html.Event.click ?use_capture ?passive target let dblclick ?use_capture ?passive target = make_event Dom_html.Event.dblclick ?use_capture ?passive target let mousedown ?use_capture ?passive target = make_event Dom_html.Event.mousedown ?use_capture ?passive target let mouseup ?use_capture ?passive target = make_event Dom_html.Event.mouseup ?use_capture ?passive target let mouseover ?use_capture ?passive target = make_event Dom_html.Event.mouseover ?use_capture ?passive target let mousemove ?use_capture ?passive target = make_event Dom_html.Event.mousemove ?use_capture ?passive target let mouseout ?use_capture ?passive target = make_event Dom_html.Event.mouseout ?use_capture ?passive target let keypress ?use_capture ?passive target = make_event Dom_html.Event.keypress ?use_capture ?passive target let keydown ?use_capture ?passive target = make_event Dom_html.Event.keydown ?use_capture ?passive target let keyup ?use_capture ?passive target = make_event Dom_html.Event.keyup ?use_capture ?passive target let change ?use_capture ?passive target = make_event Dom_html.Event.change ?use_capture ?passive target let input ?use_capture ?passive target = make_event Dom_html.Event.input ?use_capture ?passive target let timeupdate ?use_capture ?passive target = make_event Dom_html.Event.timeupdate ?use_capture ?passive target let dragstart ?use_capture ?passive target = make_event Dom_html.Event.dragstart ?use_capture ?passive target let dragend ?use_capture ?passive target = make_event Dom_html.Event.dragend ?use_capture ?passive target let dragenter ?use_capture ?passive target = make_event Dom_html.Event.dragenter ?use_capture ?passive target let dragover ?use_capture ?passive target = make_event Dom_html.Event.dragover ?use_capture ?passive target let dragleave ?use_capture ?passive target = make_event Dom_html.Event.dragleave ?use_capture ?passive target let drag ?use_capture ?passive target = make_event Dom_html.Event.drag ?use_capture ?passive target let drop ?use_capture ?passive target = make_event Dom_html.Event.drop ?use_capture ?passive target let focus ?use_capture ?passive target = make_event Dom_html.Event.focus ?use_capture ?passive target let blur ?use_capture ?passive target = make_event Dom_html.Event.blur ?use_capture ?passive target let scroll ?use_capture ?passive target = make_event Dom_html.Event.scroll ?use_capture ?passive target let submit ?use_capture ?passive target = make_event Dom_html.Event.submit ?use_capture ?passive target let select ?use_capture ?passive target = make_event Dom_html.Event.select ?use_capture ?passive target let abort ?use_capture ?passive target = make_event Dom_html.Event.abort ?use_capture ?passive target let error ?use_capture ?passive target = make_event Dom_html.Event.error ?use_capture ?passive target let load ?use_capture ?passive target = make_event Dom_html.Event.load ?use_capture ?passive target let canplay ?use_capture ?passive target = make_event Dom_html.Event.canplay ?use_capture ?passive target let canplaythrough ?use_capture ?passive target = make_event Dom_html.Event.canplaythrough ?use_capture ?passive target let durationchange ?use_capture ?passive target = make_event Dom_html.Event.durationchange ?use_capture ?passive target let emptied ?use_capture ?passive target = make_event Dom_html.Event.emptied ?use_capture ?passive target let ended ?use_capture ?passive target = make_event Dom_html.Event.ended ?use_capture ?passive target let loadeddata ?use_capture ?passive target = make_event Dom_html.Event.loadeddata ?use_capture ?passive target let loadedmetadata ?use_capture ?passive target = make_event Dom_html.Event.loadedmetadata ?use_capture ?passive target let loadstart ?use_capture ?passive target = make_event Dom_html.Event.loadstart ?use_capture ?passive target let pause ?use_capture ?passive target = make_event Dom_html.Event.pause ?use_capture ?passive target let play ?use_capture ?passive target = make_event Dom_html.Event.play ?use_capture ?passive target let playing ?use_capture ?passive target = make_event Dom_html.Event.playing ?use_capture ?passive target let ratechange ?use_capture ?passive target = make_event Dom_html.Event.ratechange ?use_capture ?passive target let seeked ?use_capture ?passive target = make_event Dom_html.Event.seeked ?use_capture ?passive target let seeking ?use_capture ?passive target = make_event Dom_html.Event.seeking ?use_capture ?passive target let stalled ?use_capture ?passive target = make_event Dom_html.Event.stalled ?use_capture ?passive target let suspend ?use_capture ?passive target = make_event Dom_html.Event.suspend ?use_capture ?passive target let volumechange ?use_capture ?passive target = make_event Dom_html.Event.volumechange ?use_capture ?passive target let waiting ?use_capture ?passive target = make_event Dom_html.Event.waiting ?use_capture ?passive target (* special case for mousewheel, because it depends on the browser *) let mousewheel ?use_capture ?passive target = let el = ref Js.null in let t, w = Lwt.task () in let cancel () = Js.Opt.iter !el Dom_html.removeEventListener in Lwt.on_cancel t cancel; el := Js.some (Dom_html.addMousewheelEventListenerWithOptions ?capture:(opt_map Js.bool use_capture) ?passive:(opt_map Js.bool passive) target (fun (ev : #Dom_html.event Js.t) ~dx ~dy -> Firebug.console##log ev; cancel (); Lwt.wakeup w (ev, (dx, dy)); Js.bool true) (* true because we do not want to prevent default -> the user can use the preventDefault function above. *)); t (* let _DOMMouseScroll ?use_capture ?passive target = make_event Dom_html.Event._DOMMouseScroll ?use_capture ?passive target *) let touchstart ?use_capture ?passive target = make_event Dom_html.Event.touchstart ?use_capture ?passive target let touchmove ?use_capture ?passive target = make_event Dom_html.Event.touchmove ?use_capture ?passive target let touchend ?use_capture ?passive target = make_event Dom_html.Event.touchend ?use_capture ?passive target let touchcancel ?use_capture ?passive target = make_event Dom_html.Event.touchcancel ?use_capture ?passive target let lostpointercapture ?use_capture ?passive target = make_event Dom_html.Event.lostpointercapture ?use_capture ?passive target let gotpointercapture ?use_capture ?passive target = make_event Dom_html.Event.gotpointercapture ?use_capture ?passive target let pointerenter ?use_capture ?passive target = make_event Dom_html.Event.pointerenter ?use_capture ?passive target let pointercancel ?use_capture ?passive target = make_event Dom_html.Event.pointercancel ?use_capture ?passive target let pointerdown ?use_capture ?passive target = make_event Dom_html.Event.pointerdown ?use_capture ?passive target let pointerleave ?use_capture ?passive target = make_event Dom_html.Event.pointerleave ?use_capture ?passive target let pointermove ?use_capture ?passive target = make_event Dom_html.Event.pointermove ?use_capture ?passive target let pointerout ?use_capture ?passive target = make_event Dom_html.Event.pointerout ?use_capture ?passive target let pointerover ?use_capture ?passive target = make_event Dom_html.Event.pointerover ?use_capture ?passive target let pointerup ?use_capture ?passive target = make_event Dom_html.Event.pointerup ?use_capture ?passive target let clicks ?cancel_handler ?use_capture ?passive t = seq_loop click ?cancel_handler ?use_capture ?passive t let dblclicks ?cancel_handler ?use_capture ?passive t = seq_loop dblclick ?cancel_handler ?use_capture ?passive t let mousedowns ?cancel_handler ?use_capture ?passive t = seq_loop mousedown ?cancel_handler ?use_capture ?passive t let mouseups ?cancel_handler ?use_capture ?passive t = seq_loop mouseup ?cancel_handler ?use_capture ?passive t let mouseovers ?cancel_handler ?use_capture ?passive t = seq_loop mouseover ?cancel_handler ?use_capture ?passive t let mousemoves ?cancel_handler ?use_capture ?passive t = seq_loop mousemove ?cancel_handler ?use_capture ?passive t let mouseouts ?cancel_handler ?use_capture ?passive t = seq_loop mouseout ?cancel_handler ?use_capture ?passive t let keypresses ?cancel_handler ?use_capture ?passive t = seq_loop keypress ?cancel_handler ?use_capture ?passive t let keydowns ?cancel_handler ?use_capture ?passive t = seq_loop keydown ?cancel_handler ?use_capture ?passive t let keyups ?cancel_handler ?use_capture ?passive t = seq_loop keyup ?cancel_handler ?use_capture ?passive t let changes ?cancel_handler ?use_capture ?passive t = seq_loop change ?cancel_handler ?use_capture ?passive t let inputs ?cancel_handler ?use_capture ?passive t = seq_loop input ?cancel_handler ?use_capture ?passive t let timeupdates ?cancel_handler ?use_capture ?passive t = seq_loop timeupdate ?cancel_handler ?use_capture ?passive t let dragstarts ?cancel_handler ?use_capture ?passive t = seq_loop dragstart ?cancel_handler ?use_capture ?passive t let dragends ?cancel_handler ?use_capture ?passive t = seq_loop dragend ?cancel_handler ?use_capture ?passive t let dragenters ?cancel_handler ?use_capture ?passive t = seq_loop dragenter ?cancel_handler ?use_capture ?passive t let dragovers ?cancel_handler ?use_capture ?passive t = seq_loop dragover ?cancel_handler ?use_capture ?passive t let dragleaves ?cancel_handler ?use_capture ?passive t = seq_loop dragleave ?cancel_handler ?use_capture ?passive t let drags ?cancel_handler ?use_capture ?passive t = seq_loop drag ?cancel_handler ?use_capture ?passive t let drops ?cancel_handler ?use_capture ?passive t = seq_loop drop ?cancel_handler ?use_capture ?passive t let mousewheels ?cancel_handler ?use_capture ?passive t = seq_loop mousewheel ?cancel_handler ?use_capture ?passive t let touchstarts ?cancel_handler ?use_capture ?passive t = seq_loop touchstart ?cancel_handler ?use_capture ?passive t let touchmoves ?cancel_handler ?use_capture ?passive t = seq_loop touchmove ?cancel_handler ?use_capture ?passive t let touchends ?cancel_handler ?use_capture ?passive t = seq_loop touchend ?cancel_handler ?use_capture ?passive t let touchcancels ?cancel_handler ?use_capture ?passive t = seq_loop touchcancel ?cancel_handler ?use_capture ?passive t let focuses ?cancel_handler ?use_capture ?passive t = seq_loop focus ?cancel_handler ?use_capture ?passive t let blurs ?cancel_handler ?use_capture ?passive t = seq_loop blur ?cancel_handler ?use_capture ?passive t let scrolls ?cancel_handler ?use_capture ?passive t = seq_loop scroll ?cancel_handler ?use_capture ?passive t let submits ?cancel_handler ?use_capture ?passive t = seq_loop submit ?cancel_handler ?use_capture ?passive t let selects ?cancel_handler ?use_capture ?passive t = seq_loop select ?cancel_handler ?use_capture ?passive t let aborts ?cancel_handler ?use_capture ?passive t = seq_loop abort ?cancel_handler ?use_capture ?passive t let errors ?cancel_handler ?use_capture ?passive t = seq_loop error ?cancel_handler ?use_capture ?passive t let loads ?cancel_handler ?use_capture ?passive t = seq_loop load ?cancel_handler ?use_capture ?passive t let canplays ?cancel_handler ?use_capture ?passive t = seq_loop canplay ?cancel_handler ?use_capture ?passive t let canplaythroughs ?cancel_handler ?use_capture ?passive t = seq_loop canplaythrough ?cancel_handler ?use_capture ?passive t let durationchanges ?cancel_handler ?use_capture ?passive t = seq_loop durationchange ?cancel_handler ?use_capture ?passive t let emptieds ?cancel_handler ?use_capture ?passive t = seq_loop emptied ?cancel_handler ?use_capture ?passive t let endeds ?cancel_handler ?use_capture ?passive t = seq_loop ended ?cancel_handler ?use_capture ?passive t let loadeddatas ?cancel_handler ?use_capture ?passive t = seq_loop loadeddata ?cancel_handler ?use_capture ?passive t let loadedmetadatas ?cancel_handler ?use_capture ?passive t = seq_loop loadedmetadata ?cancel_handler ?use_capture ?passive t let loadstarts ?cancel_handler ?use_capture ?passive t = seq_loop loadstart ?cancel_handler ?use_capture ?passive t let pauses ?cancel_handler ?use_capture ?passive t = seq_loop pause ?cancel_handler ?use_capture ?passive t let plays ?cancel_handler ?use_capture ?passive t = seq_loop play ?cancel_handler ?use_capture ?passive t let playings ?cancel_handler ?use_capture ?passive t = seq_loop playing ?cancel_handler ?use_capture ?passive t let ratechanges ?cancel_handler ?use_capture ?passive t = seq_loop ratechange ?cancel_handler ?use_capture ?passive t let seekeds ?cancel_handler ?use_capture ?passive t = seq_loop seeked ?cancel_handler ?use_capture ?passive t let seekings ?cancel_handler ?use_capture ?passive t = seq_loop seeking ?cancel_handler ?use_capture ?passive t let stalleds ?cancel_handler ?use_capture ?passive t = seq_loop stalled ?cancel_handler ?use_capture ?passive t let suspends ?cancel_handler ?use_capture ?passive t = seq_loop suspend ?cancel_handler ?use_capture ?passive t let volumechanges ?cancel_handler ?use_capture ?passive t = seq_loop volumechange ?cancel_handler ?use_capture ?passive t let waitings ?cancel_handler ?use_capture ?passive t = seq_loop waiting ?cancel_handler ?use_capture ?passive t let lostpointercaptures ?cancel_handler ?use_capture ?passive t = seq_loop lostpointercapture ?cancel_handler ?use_capture ?passive t let gotpointercaptures ?cancel_handler ?use_capture ?passive t = seq_loop gotpointercapture ?cancel_handler ?use_capture ?passive t let pointerenters ?cancel_handler ?use_capture ?passive t = seq_loop pointerenter ?cancel_handler ?use_capture ?passive t let pointercancels ?cancel_handler ?use_capture ?passive t = seq_loop pointercancel ?cancel_handler ?use_capture ?passive t let pointerdowns ?cancel_handler ?use_capture ?passive t = seq_loop pointerdown ?cancel_handler ?use_capture ?passive t let pointerleaves ?cancel_handler ?use_capture ?passive t = seq_loop pointerleave ?cancel_handler ?use_capture ?passive t let pointermoves ?cancel_handler ?use_capture ?passive t = seq_loop pointermove ?cancel_handler ?use_capture ?passive t let pointerouts ?cancel_handler ?use_capture ?passive t = seq_loop pointerout ?cancel_handler ?use_capture ?passive t let pointerovers ?cancel_handler ?use_capture ?passive t = seq_loop pointerover ?cancel_handler ?use_capture ?passive t let pointerups ?cancel_handler ?use_capture ?passive t = seq_loop pointerup ?cancel_handler ?use_capture ?passive t let transition_evn = lazy (let e = Dom_html.createDiv Dom_html.document in try snd (List.find (fun (propname, _evname) -> Js.Unsafe.get e##.style propname != Js.undefined) [ "WebkitTransition", [ Dom.Event.make "webkitTransitionEnd" ] ; "MozTransition", [ Dom.Event.make "transitionend" ] ; ( "OTransition" , [ Dom.Event.make "oTransitionEnd"; Dom.Event.make "otransitionend" ] ) ; "transition", [ Dom.Event.make "transitionend" ] ]) with Not_found -> []) let transitionend elt = match Lazy.force transition_evn with | [] -> Lwt.return () | l -> Lwt.pick (List.map (fun ev -> make_event ev elt) l) >>= fun _ -> Lwt.return () let transitionends ?cancel_handler elt f = seq_loop (fun ?use_capture:_ ?passive:_ target -> transitionend target) ?cancel_handler elt (fun _ cancel -> f cancel) let request_animation_frame () = let t, s = Lwt.wait () in Dom_html._requestAnimationFrame (Js.wrap_callback (fun () -> Lwt.wakeup s ())); t let onload () = make_event Dom_html.Event.load Dom_html.window let domContentLoaded = let complete = Js.string "complete" in let doc = Dom_html.window##.document in fun () -> if doc##.readyState == complete then Lwt.return_unit else let t, w = Lwt.task () in let wakeup w _ = if Lwt.is_sleeping t then Lwt.wakeup w () in let wakeup_exn w e = if Lwt.is_sleeping t then Lwt.wakeup_exn w e in (* https://github.com/dperini/ContentLoaded/blob/master/src/contentloaded.js *) let regular = make_event Dom_html.Event.domContentLoaded doc in Lwt.on_any regular (wakeup w) (wakeup_exn w); (* ie8 *) let readystatechange = async_loop (make_event (Dom.Event.make "readystatechange")) doc (fun e _ -> if doc##.readyState == complete then wakeup w e; Lwt.return_unit) in (* fallback, just in case *) let init = make_event Dom_html.Event.load Dom_html.window in Lwt.on_any init (wakeup w) (wakeup_exn w); (* clean and return *) Lwt.bind t (fun _e -> Lwt.cancel regular; Lwt.cancel readystatechange; Lwt.cancel init; Lwt.return_unit) let onunload () = make_event Dom_html.Event.unload Dom_html.window let onbeforeunload () = make_event Dom_html.Event.beforeunload Dom_html.window let onresize () = make_event Dom_html.Event.resize Dom_html.window let onorientationchange () = make_event Dom_html.Event.orientationchange Dom_html.window let onpopstate () = make_event Dom_html.Event.popstate Dom_html.window let onhashchange () = make_event Dom_html.Event.hashchange Dom_html.window let onorientationchange_or_onresize () = Lwt.pick [ onresize (); onorientationchange () ] let onresizes t = seq_loop (fun ?use_capture:_ ?passive:_ () -> onresize ()) () t let onorientationchanges t = seq_loop (fun ?use_capture:_ ?passive:_ () -> onorientationchange ()) () t let onpopstates t = seq_loop (fun ?use_capture:_ ?passive:_ () -> onpopstate ()) () t let onhashchanges t = seq_loop (fun ?use_capture:_ ?passive:_ () -> onhashchange ()) () t let onorientationchanges_or_onresizes t = seq_loop (fun ?use_capture:_ ?passive:_ () -> onorientationchange_or_onresize ()) () t let limited_onresizes ?elapsed_time t = limited_loop (fun ?use_capture:_ ?passive:_ () -> onresize ()) ?elapsed_time () t let limited_onorientationchanges ?elapsed_time t = limited_loop (fun ?use_capture:_ ?passive:_ () -> onorientationchange ()) ?elapsed_time () t let limited_onorientationchanges_or_onresizes ?elapsed_time t = limited_loop (fun ?use_capture:_ ?passive:_ () -> onorientationchange_or_onresize ()) ?elapsed_time () t js_of_ocaml-3.5.2/lib/lwt/lwt_js_events.mli000066400000000000000000000665511357507750000207670ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Vincent Balat * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Programming mouse or keyboard events handlers using Lwt *) open Js_of_ocaml (** Reminder: Event capturing starts with the outer most element in the DOM and works inwards to the HTML element the event took place on (capture phase) and then out again (bubbling phase). Examples of use: Waiting for a click on [elt1] before continuing: {[let%lwt _ = Lwt_js_events.click elt1 in]} Doing some operation for each value change in input element [inp]: {[Lwt_js_events.(async (fun () -> clicks inp1 (fun ev _ -> ...) ))]} Defining a thread that waits for ESC key on an element: {[let rec esc elt = let%lwt ev = keydown elt in if ev##.keyCode = 27 then Lwt.return ev else esc elt]} Waiting for a click or escape key before continuing: {[let%lwt () = Lwt.pick [(let%lwt _ = esc Dom_html.document in Lwt.return ()); (let%lwt _ = click Dom_html.document in Lwt.return ())] in ...]} {2 Create Lwt threads for events} *) val make_event : (#Dom_html.event as 'a) Js.t Dom_html.Event.typ -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> 'a Js.t Lwt.t (** [make_event ev target] creates a Lwt thread that waits for the event [ev] to happen on [target] (once). This thread isa cancellable using [Lwt.cancel]. If you set the optional parameter [~use_capture:true], the event will be caught during the capture phase, otherwise it is caught during the bubbling phase (default). If you set the optional parameter [~passive:true], the user agent will ignore [preventDefault] calls inside the event callback. *) val seq_loop : (?use_capture:bool -> ?passive:bool -> 'target -> 'event Lwt.t) -> ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> 'target -> ('event -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t (** [seq_loop (make_event ev) target handler] creates a looping Lwt thread that waits for the event [ev] to happen on [target], then execute handler, and start again waiting for the event. Events happening during the execution of the handler are ignored. See [async_loop] and [buffered_loop] for alternative semantics. For example, the [clicks] function below is defined by: [let clicks ?use_capture ?passive t = seq_loop click ?use_capture ?passive t] The thread returned is cancellable using [Lwt.cancel]. In order for the loop thread to be canceled from within the handler, the latter receives the former as its second parameter. By default, cancelling the loop will not cancel the potential currently running handler. This behaviour can be changed by setting the [cancel_handler] parameter to true. *) val async_loop : (?use_capture:bool -> ?passive:bool -> 'target -> 'event Lwt.t) -> ?use_capture:bool -> ?passive:bool -> 'target -> ('event -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t (** [async_loop] is similar to [seq_loop], but each handler runs independently. No event is thus missed, but since several instances of the handler can be run concurrently, it is up to the programmer to ensure that they interact correctly. Cancelling the loop will not cancel the potential currently running handlers. *) val buffered_loop : (?use_capture:bool -> ?passive:bool -> 'target -> 'event Lwt.t) -> ?cancel_handler:bool -> ?cancel_queue:bool -> ?use_capture:bool -> ?passive:bool -> 'target -> ('event -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t (** [buffered_loop] is similar to [seq_loop], but any event that occurs during an execution of the handler is queued instead of being ignored. No event is thus missed, but there can be a non predictable delay between its trigger and its treatment. It is thus a good idea to use this loop with handlers whose running time is short, so the memorized event still makes sense when the handler is eventually executed. It is also up to the programmer to ensure that event handlers terminate so the queue will eventually be emptied. By default, cancelling the loop will not cancel the (potential) currently running handler, but any other queued event will be dropped. This behaviour can be customized using the two optional parameters [cancel_handler] and [cancel_queue]. *) val async : (unit -> unit Lwt.t) -> unit (** [async t] records a thread to be executed later. It is implemented by calling yield, then Lwt.async. This is useful if you want to create a new event listener when you are inside an event handler. This avoids the current event to be caught by the new event handler (if it propagates). *) val func_limited_loop : (?use_capture:bool -> ?passive:bool -> 'a -> 'b Lwt.t) -> (unit -> 'a Lwt.t) -> ?use_capture:bool -> ?passive:bool -> 'a -> ('b -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t (** [func_limited_loop event delay_fun target handler] will behave like [Lwt_js_events.async_loop event target handler] but it will run [delay_fun] first, and execute [handler] only when [delay_fun] is finished and no other event occurred in the meantime. This allows to limit the number of events caught. Be careful, it is an asynchrone loop, so if you give too little time, several instances of your handler could be run in same time **) val limited_loop : (?use_capture:bool -> ?passive:bool -> 'a -> 'b Lwt.t) -> ?elapsed_time:float -> ?use_capture:bool -> ?passive:bool -> 'a -> ('b -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t (** Same as func_limited_loop but take time instead of function By default elapsed_time = 0.1s = 100ms **) (** {2 Predefined functions for some types of events} *) val click : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.t val dblclick : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.t val mousedown : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.t val mouseup : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.t val mouseover : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.t val mousemove : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.t val mouseout : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.t val keypress : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.keyboardEvent Js.t Lwt.t val keydown : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.keyboardEvent Js.t Lwt.t val keyup : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.keyboardEvent Js.t Lwt.t val input : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val timeupdate : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val change : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val dragstart : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.t val dragend : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.t val dragenter : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.t val dragover : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.t val dragleave : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.t val drag : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.t val drop : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.t val focus : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val blur : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val scroll : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val submit : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val select : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val mousewheel : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t * (int * int)) Lwt.t (** This function returns the event, together with the numbers of ticks the mouse wheel moved. Positive means down or right. This interface is compatible with all (recent) browsers. *) val touchstart : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.touchEvent Js.t Lwt.t val touchmove : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.touchEvent Js.t Lwt.t val touchend : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.touchEvent Js.t Lwt.t val touchcancel : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.touchEvent Js.t Lwt.t val lostpointercapture : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val gotpointercapture : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val pointerenter : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val pointercancel : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val pointerdown : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val pointerleave : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val pointermove : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val pointerout : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val pointerover : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val pointerup : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.pointerEvent Js.t Lwt.t val transitionend : #Dom_html.eventTarget Js.t -> unit Lwt.t (** Returns when a CSS transition terminates on the element. *) val transitionends : ?cancel_handler:bool -> #Dom_html.eventTarget Js.t -> (unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val load : ?use_capture:bool -> ?passive:bool -> #Dom_html.imageElement Js.t -> Dom_html.event Js.t Lwt.t val error : ?use_capture:bool -> ?passive:bool -> #Dom_html.imageElement Js.t -> Dom_html.event Js.t Lwt.t val abort : ?use_capture:bool -> ?passive:bool -> #Dom_html.imageElement Js.t -> Dom_html.event Js.t Lwt.t val canplay : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val canplaythrough : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val durationchange : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val emptied : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val ended : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val loadeddata : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val loadedmetadata : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val loadstart : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val pause : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val play : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val playing : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val ratechange : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val seeked : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val seeking : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val stalled : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val suspend : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val volumechange : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val waiting : ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.t val clicks : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val dblclicks : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val mousedowns : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val mouseups : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val mouseovers : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val mousemoves : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val mouseouts : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val keypresses : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.keyboardEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val keydowns : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.keyboardEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val keyups : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.keyboardEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val inputs : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val timeupdates : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val changes : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val dragstarts : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val dragends : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val dragenters : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val dragovers : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val dragleaves : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val drags : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val drops : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val mousewheels : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t * (int * int) -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val touchstarts : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.touchEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val touchmoves : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.touchEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val touchends : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.touchEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val touchcancels : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.touchEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val focuses : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val blurs : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val scrolls : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val submits : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val selects : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val loads : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.imageElement Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val errors : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.imageElement Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val aborts : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.imageElement Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val canplays : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val canplaythroughs : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val durationchanges : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val emptieds : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val endeds : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val loadeddatas : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val loadedmetadatas : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val loadstarts : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pauses : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val plays : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val playings : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val ratechanges : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val seekeds : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val seekings : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val stalleds : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val suspends : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val volumechanges : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val waitings : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val lostpointercaptures : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val gotpointercaptures : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pointerenters : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pointercancels : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pointerdowns : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pointerleaves : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pointermoves : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pointerouts : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pointerovers : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val pointerups : ?cancel_handler:bool -> ?use_capture:bool -> ?passive:bool -> #Dom_html.eventTarget Js.t -> (Dom_html.pointerEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val request_animation_frame : unit -> unit Lwt.t (** Returns when a repaint of the window by the browser starts. (see JS method [window.requestAnimationFrame]) *) val onload : unit -> Dom_html.event Js.t Lwt.t (** Returns when the page is loaded *) val domContentLoaded : unit -> unit Lwt.t val onunload : unit -> Dom_html.event Js.t Lwt.t val onbeforeunload : unit -> Dom_html.event Js.t Lwt.t val onresize : unit -> Dom_html.event Js.t Lwt.t val onorientationchange : unit -> Dom_html.event Js.t Lwt.t val onpopstate : unit -> Dom_html.popStateEvent Js.t Lwt.t val onhashchange : unit -> Dom_html.hashChangeEvent Js.t Lwt.t val onorientationchange_or_onresize : unit -> Dom_html.event Js.t Lwt.t val onresizes : (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val onorientationchanges : (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val onpopstates : (Dom_html.popStateEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val onhashchanges : (Dom_html.hashChangeEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val onorientationchanges_or_onresizes : (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val limited_onresizes : ?elapsed_time:float -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val limited_onorientationchanges : ?elapsed_time:float -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t val limited_onorientationchanges_or_onresizes : ?elapsed_time:float -> (Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.t js_of_ocaml-3.5.2/lib/lwt/lwt_jsonp.ml000066400000000000000000000075211357507750000177370ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open! Import let rec random_identifier size = let b = Buffer.create size in for _i = 0 to size - 1 do Buffer.add_char b (Char.chr (97 + Random.int 26)) done; let s = Buffer.contents b in if Js.Optdef.test (Js.Unsafe.get Dom_html.window (Js.string s)) then (* name already in use, choose another one*) random_identifier size else s let raw_call name uri error_cb user_cb = let script = Dom_html.(createScript document) in let finalize () = Js.Unsafe.delete Dom_html.window (Js.string name); Js.Opt.iter script##.parentNode (fun parent -> Dom.removeChild parent script) in let executed = ref false in Js.Unsafe.set Dom_html.window (Js.string name) (fun x -> executed := true; finalize (); user_cb x); script##.src := Js.string uri; script##._type := Js.string "text/javascript"; script##.async := Js._true; ((Js.Unsafe.coerce script)##.onerror := fun x -> finalize (); error_cb x); ((Js.Unsafe.coerce script)##.onload := fun x -> Lwt.async (fun () -> Lwt.bind (Lwt_js.sleep 1.) (fun () -> if !executed then Lwt.return_unit else ( Firebug.console##warn (Js.string "Jsonp: script loaded but callback not executed"); finalize (); error_cb x; Lwt.return_unit)))); let init () = ignore (Dom.appendChild Dom_html.document##.body script) in init, finalize let call_ prefix make_uri error_cb user_cb = let name = prefix ^ random_identifier 10 in let uri = make_uri name in raw_call name uri error_cb user_cb let call_custom_url ?timeout ?(prefix = "") make_uri = let t, w = Lwt.task () in let init, finalize = call_ prefix make_uri (fun _ -> Lwt.cancel t) (Lwt.wakeup w) in Lwt.on_cancel t finalize; let new_t = match timeout with | None -> t | Some delay -> let wait = Lwt.bind (Lwt_js.sleep delay) (fun () -> Lwt.cancel t; t) in Lwt.choose [ wait; t ] in init (); new_t let add_param name value l = let l = List.filter (fun (x, _) -> not (String.equal x name)) l in (name, value) :: l let call ?timeout ?(param = "callback") ?(prefix = "") url = let make_uri cbname = match Url.url_of_string url with | None -> failwith "Jsonp.call: Cannot parse url" | Some url -> let new_url = match url with | Url.Http http -> Url.Http { http with Url.hu_arguments = add_param param cbname http.Url.hu_arguments } | Url.Https http -> Url.Https { http with Url.hu_arguments = add_param param cbname http.Url.hu_arguments } | Url.File file -> Url.File { file with Url.fu_arguments = add_param param cbname file.Url.fu_arguments } in Url.string_of_url new_url in call_custom_url ?timeout ~prefix make_uri js_of_ocaml-3.5.2/lib/lwt/lwt_jsonp.mli000066400000000000000000000030151357507750000201020ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** This module provides helpers to perform JSONP calls *) val call : ?timeout:float -> ?param:string -> ?prefix:string -> string -> 'b Lwt.t (** [call ~timeout ~param url] do a jsonp call using [url]. It uses the named query parameter [param] (default "callback") to pass the name of the callback. It uses [prefix] to generate random string for callback name. If a timeout is given and there are no answer before [timeout] seconds, the lwt thread will be cancelled. *) val call_custom_url : ?timeout:float -> ?prefix:string -> (string -> string) -> 'b Lwt.t (** [call_custom_url ~timeout make_url]. Same as [call] but let you build your own url given a callback name *) js_of_ocaml-3.5.2/lib/lwt/lwt_xmlHttpRequest.ml000066400000000000000000000223741357507750000216220ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open Js open XmlHttpRequest open! Import let encode_url l = String.concat "&" (List.map (function | name, `String s -> Url.urlencode name ^ "=" ^ Url.urlencode (to_string s) | name, `File s -> Url.urlencode name ^ "=" ^ Url.urlencode (to_string s##.name)) l) (* Higher level interface: *) type 'response generic_http_frame = { url : string ; code : int ; headers : string -> string option ; content : 'response ; content_xml : unit -> Dom.element Dom.document t option } (** type of the http headers *) type http_frame = string generic_http_frame exception Wrong_headers of (int * (string -> string option)) let default_response url code headers req = { url ; code ; content = Js.Opt.case req##.responseText (fun () -> "") (fun x -> Js.to_string x) ; content_xml = (fun () -> match Js.Opt.to_option req##.responseXML with | None -> None | Some doc -> if Js.some doc##.documentElement == Js.null then None else Some doc) ; headers } let text_response url code headers req = { url ; code ; content = Js.Opt.case req##.responseText (fun () -> Js.string "") (fun x -> x) ; content_xml = (fun () -> assert false) ; headers } let document_response url code headers req = { url ; code ; content = File.CoerceTo.document req##.response ; content_xml = (fun () -> assert false) ; headers } let json_response url code headers req = { url ; code ; content = File.CoerceTo.json req##.response ; content_xml = (fun () -> assert false) ; headers } let blob_response url code headers req = { url ; code ; content = File.CoerceTo.blob req##.response ; content_xml = (fun () -> assert false) ; headers } let arraybuffer_response url code headers req = { url ; code ; content = File.CoerceTo.arrayBuffer req##.response ; content_xml = (fun () -> assert false) ; headers } let has_get_args url = try ignore (String.index url '?'); true with Not_found -> false let perform_raw ?(headers = []) ?content_type ?(get_args = []) ?(check_headers = fun _ _ -> true) ?progress ?upload_progress ?contents ?override_mime_type ?override_method ?with_credentials (type resptype) ~(response_type : resptype response) url = let contents_normalization = function | `POST_form args -> let only_strings = List.for_all (fun x -> match x with | _, `String _ -> true | _ -> false) args in let form_contents = if only_strings then `Fields (ref []) else Form.empty_form_contents () in List.iter (fun (name, value) -> Form.append form_contents (name, value)) args; `Form_contents form_contents | (`String _ | `Form_contents _) as x -> x | `Blob b -> `Blob (b : #File.blob Js.t :> File.blob Js.t) in let contents = match contents with | None -> None | Some c -> Some (contents_normalization c) in let method_to_string m = match m with | `GET -> "GET" | `POST -> "POST" | `HEAD -> "HEAD" | `PUT -> "PUT" | `DELETE -> "DELETE" | `OPTIONS -> "OPTIONS" | `PATCH -> "PATCH" in let method_, content_type = let override_method m = match override_method with | None -> m | Some v -> method_to_string v in let override_content_type c = match content_type with | None -> Some c | Some _ -> content_type in match contents with | None -> override_method "GET", content_type | Some (`Form_contents form) -> ( match form with | `Fields _strings -> ( override_method "POST" , override_content_type "application/x-www-form-urlencoded" ) | `FormData _ -> override_method "POST", content_type) | Some (`String _ | `Blob _) -> override_method "POST", content_type in let url = if Poly.(get_args = []) then url else url ^ (if has_get_args url then "&" else "?") ^ Url.encode_arguments get_args in let (res : resptype generic_http_frame Lwt.t), w = Lwt.task () in let req = create () in req##_open (Js.string method_) (Js.string url) Js._true; (match override_mime_type with | None -> () | Some mime_type -> req##overrideMimeType (Js.string mime_type)); (match response_type with | ArrayBuffer -> req##.responseType := Js.string "arraybuffer" | Blob -> req##.responseType := Js.string "blob" | Document -> req##.responseType := Js.string "document" | JSON -> req##.responseType := Js.string "json" | Text -> req##.responseType := Js.string "text" | Default -> req##.responseType := Js.string ""); (match with_credentials with | Some c -> req##.withCredentials := Js.bool c | None -> ()); (match content_type with | Some content_type -> req##setRequestHeader (Js.string "Content-type") (Js.string content_type) | _ -> ()); List.iter (fun (n, v) -> req##setRequestHeader (Js.string n) (Js.string v)) headers; let headers s = Opt.case (req##getResponseHeader (Js.bytestring s)) (fun () -> None) (fun v -> Some (Js.to_string v)) in let do_check_headers = let st = ref `Not_yet in fun () -> if Poly.(!st = `Not_yet) then if check_headers req##.status headers then st := `Passed else ( Lwt.wakeup_exn w (Wrong_headers (req##.status, headers)); st := `Failed; req##abort); Poly.(!st <> `Failed) in req##.onreadystatechange := Js.wrap_callback (fun _ -> match req##.readyState with (* IE doesn't have the same semantics for HEADERS_RECEIVED. so we wait til LOADING to check headers. See: http://msdn.microsoft.com/en-us/library/ms534361(v=vs.85).aspx *) | HEADERS_RECEIVED when not Dom_html.onIE -> ignore (do_check_headers ()) | LOADING when Dom_html.onIE -> ignore (do_check_headers ()) | DONE -> (* If we didn't catch a previous event, we check the header. *) if do_check_headers () then let response : resptype generic_http_frame = match response_type with | ArrayBuffer -> arraybuffer_response url req##.status headers req | Blob -> blob_response url req##.status headers req | Document -> document_response url req##.status headers req | JSON -> json_response url req##.status headers req | Text -> text_response url req##.status headers req | Default -> default_response url req##.status headers req in Lwt.wakeup w response | _ -> ()); (match progress with | Some progress -> req##.onprogress := Dom.handler (fun e -> progress e##.loaded e##.total; Js._true) | None -> ()); Optdef.iter req##.upload (fun upload -> match upload_progress with | Some upload_progress -> upload##.onprogress := Dom.handler (fun e -> upload_progress e##.loaded e##.total; Js._true) | None -> ()); (match contents with | None -> req##send Js.null | Some (`Form_contents (`Fields l)) -> req##send (Js.some (string (encode_url !l))) | Some (`Form_contents (`FormData f)) -> req##send_formData f | Some (`String s) -> req##send (Js.some (Js.string s)) | Some (`Blob b) -> req##send_blob b); Lwt.on_cancel res (fun () -> req##abort); res let perform_raw_url ?(headers = []) ?content_type ?(get_args = []) ?check_headers ?progress ?upload_progress ?contents ?override_mime_type ?override_method ?with_credentials url = perform_raw ~headers ?content_type ~get_args ?contents ?check_headers ?progress ?upload_progress ?override_mime_type ?override_method ?with_credentials ~response_type:Default url let perform ?(headers = []) ?content_type ?(get_args = []) ?check_headers ?progress ?upload_progress ?contents ?override_mime_type ?override_method ?with_credentials url = perform_raw ~headers ?content_type ~get_args ?contents ?check_headers ?progress ?upload_progress ?override_mime_type ?override_method ?with_credentials ~response_type:Default (Url.string_of_url url) let get s = perform_raw_url s js_of_ocaml-3.5.2/lib/lwt/lwt_xmlHttpRequest.mli000066400000000000000000000115121357507750000217630ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** XmlHttpRequest object. *) open Js_of_ocaml open Js open XmlHttpRequest type 'response generic_http_frame = { url : string ; code : int ; headers : string -> string option ; content : 'response ; content_xml : unit -> Dom.element Dom.document t option } (** The type for XHR results. The code field is the http status code of the answer. The headers field is a function associating values to any header name. *) type http_frame = string generic_http_frame exception Wrong_headers of (int * (string -> string option)) (** The exception raise by perform functions when the check_headers parameter returned false. The parameter of the exception is a function is like the [headers] function of [http_frame] *) val perform_raw : ?headers:(string * string) list -> ?content_type:string -> ?get_args:(string * string) list -> ?check_headers:((* [] *) int -> (string -> string option) -> bool) -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) -> ?contents: [< `POST_form of (string * Form.form_elt) list | `Form_contents of Form.form_contents | `String of string | `Blob of #File.blob Js.t ] -> ?override_mime_type:string -> ?override_method:[< `GET | `POST | `HEAD | `PUT | `DELETE | `OPTIONS | `PATCH ] -> ?with_credentials:bool -> response_type:'a response -> string -> 'a generic_http_frame Lwt.t (** [perform_raw] is the same as {!perform_raw_url} except that an additional response_type argument can be given to set the XMLHttpRequest responseType, and hence return different types of data for GET requests. *) val perform_raw_url : ?headers:(string * string) list -> ?content_type:string -> ?get_args:(string * string) list -> ?check_headers:((* [] *) int -> (string -> string option) -> bool) -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) -> ?contents: [< `POST_form of (string * Form.form_elt) list | `Form_contents of Form.form_contents | `String of string | `Blob of #File.blob Js.t ] -> ?override_mime_type:string -> ?override_method:[< `GET | `POST | `HEAD | `PUT | `DELETE | `OPTIONS | `PATCH ] -> ?with_credentials:bool -> string -> http_frame Lwt.t (** [perform_raw_url] makes an asynchronous request to the specified [url] with specified options. The result is a cancelable thread returning an HTTP frame. By default, if [post_args] and [form_arg] are [None], a GET request is used. If [post_args] or [form_arg] is [Some _] (even [Some []]) then a POST request is made. But if [override_method] is set, the request method is forced, no matter the [post_args] or [form_arg] value. For example, with [override_method] set to [`PUT] and [form_arg] set to [Some _] a PUT request including the form data will be made. The [check_headers] argument is run as soon as the answer code and headers are available. If it returns false, the request is canceled and the functions raise the [Wrong_headers] exception *) val perform : ?headers:(string * string) list -> ?content_type:string -> ?get_args:(string * string) list -> ?check_headers:((* [] *) int -> (string -> string option) -> bool) -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) -> ?contents: [< `POST_form of (string * Form.form_elt) list | `Form_contents of Form.form_contents | `String of string | `Blob of #File.blob Js.t ] -> ?override_mime_type:string -> ?override_method:[< `GET | `POST | `HEAD | `PUT | `DELETE | `OPTIONS | `PATCH ] -> ?with_credentials:bool -> Url.url -> http_frame Lwt.t (** [perform] is the same as {!perform_raw_url} except that the Url argument has type {!Url.url}. *) val get : string -> http_frame Lwt.t (** [get url] makes an asynchronous request to the specified [url] *) js_of_ocaml-3.5.2/lib/tests/000077500000000000000000000000001357507750000157155ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/tests/css_angle.ml000066400000000000000000000026701357507750000202120ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml let%expect_test _ = let a = [ CSS.Angle.Rad 0.1 ; CSS.Angle.Turns 0.12 ; CSS.Angle.Deg 5.4 ; CSS.Angle.Turns 0. ; CSS.Angle.Grad 10.0 ; CSS.Angle.Grad 0.10 ] in List.iter (fun c -> try let js = CSS.Angle.js c in let ml = CSS.Angle.ml js in if c = ml then () else Printf.printf "%s <> %s\n%!" (CSS.Angle.string_of_t c) (CSS.Angle.string_of_t ml) with exn -> print_endline (Printexc.to_string exn)) a; [%expect {||}] js_of_ocaml-3.5.2/lib/tests/css_color.ml000066400000000000000000000032461357507750000202420ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml let%expect_test _ = let cols = [ CSS.Color.RGB (120, 3, 56) ; CSS.Color.RGBA (120, 3, 56, 1.) ; CSS.Color.RGB_percent (10, 3, 60) ; CSS.Color.RGBA_percent (100, 53, 60, 0.45) ; CSS.Color.HSL (120, 75, 56) ; CSS.Color.HSLA (180, 3, 56, 0.2) ; CSS.Color.RGB (CSS.Color.rgb_of_name CSS.Color.Dodgerblue) ; CSS.Color.RGB (CSS.Color.rgb_of_name CSS.Color.Pink) ; CSS.Color.Name CSS.Color.Hotpink ; CSS.Color.Name CSS.Color.Cornsilk ] in List.iter (fun c -> try let js = CSS.Color.js c in let ml = CSS.Color.ml js in if c = ml then () else Printf.printf "%s %s" (CSS.Color.string_of_t c) (CSS.Color.string_of_t ml) with exn -> print_endline (Printexc.to_string exn)) cols; [%expect {||}] js_of_ocaml-3.5.2/lib/tests/css_length.ml000066400000000000000000000032541357507750000204040ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* CSS.Length testing *) open Js_of_ocaml let%expect_test _ = let ls = [ CSS.Length.Em 0.1 ; CSS.Length.Ex 0.12 ; CSS.Length.Px 5.4 ; CSS.Length.Gd 0. ; CSS.Length.Rem 10.0 ; CSS.Length.Vw 0.10 ; CSS.Length.Vh 0.1 ; CSS.Length.Vm 0.5 ; CSS.Length.Ch 20.6 ; CSS.Length.Zero ; CSS.Length.Mm 100. ; CSS.Length.Cm 10.1 ; CSS.Length.In 0.1 ; CSS.Length.Pt 10.2 ; CSS.Length.Pc 103.1 ] in List.iter (fun c -> try let js = CSS.Length.js c in let ml = CSS.Length.ml js in if c = ml then () else Printf.printf "%s %s\n%!" (CSS.Length.string_of_t c) (CSS.Length.string_of_t ml) with exn -> print_endline (Printexc.to_string exn)) ls; [%expect {||}] js_of_ocaml-3.5.2/lib/tests/dune000066400000000000000000000002271357507750000165740ustar00rootroot00000000000000(library (name jsoo_lib_expect_tests) (libraries js_of_ocaml unix) (inline_tests (modes js)) (preprocess (pps ppx_js_internal ppx_expect)))js_of_ocaml-3.5.2/lib/tests/index.html000066400000000000000000000005021357507750000177070ustar00rootroot00000000000000 Tests js_of_ocaml-3.5.2/lib/tests/poly_compare.ml000066400000000000000000000105351357507750000207440ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2019 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml let%expect_test "poly equal" = let obj1 = Js.Unsafe.obj [||] in let obj2 = Js.Unsafe.obj [||] in assert (List.mem obj1 [ obj1 ]); assert (List.mem obj1 [ obj2; obj1 ]); assert (not (List.mem obj1 [ obj2 ])); () let%expect_test "poly equal neg" = let obj1 = Js.Unsafe.obj [||] in let obj2 = Js.Unsafe.obj [||] in assert (obj1 <> obj2); assert (not (obj1 <> obj1)); () let%expect_test "poly compare" = let obj1 = Js.Unsafe.obj [| "a", Js.Unsafe.inject 0 |] in let obj2 = Js.Unsafe.obj [| "a", Js.Unsafe.inject 0 |] in (match List.sort compare [ obj1; obj1 ] with | [ a; b ] -> if a == obj1 && b == obj2 then print_endline "preserve" else print_endline "not preserve" | _ -> assert false); [%expect {| not preserve |}]; (match List.sort compare [ obj2; obj1 ] with | [ a; b ] -> if a == obj2 && b == obj1 then print_endline "preserve" else print_endline "not preserve" | _ -> assert false); [%expect {| not preserve |}] type pack = Pack : 'a -> pack let%expect_test "number comparison" = assert (Pack 2 = Pack 2.); assert (Pack (Js.Unsafe.js_expr "Number(2)") = Pack 2.); assert (Pack (Js.Unsafe.js_expr "new Number(2)") = Pack 2.); assert (Pack 2 <> Pack 2.1); assert (Pack (Js.Unsafe.js_expr "Number(2.1)") <> Pack 2.); assert (Pack (Js.Unsafe.js_expr "new Number(2.1)") <> Pack 2.); assert ( Pack (Js.Unsafe.js_expr "new Number(2.1)") = Pack (Js.Unsafe.js_expr "new Number(2.1)")) let%expect_test "string comparison" = assert (Pack (Js.Unsafe.js_expr "String(2)") = Pack (Js.string "2")); assert (Pack (Js.Unsafe.js_expr "String('abc')") = Pack (Js.string "abc")); assert (Pack (Js.Unsafe.js_expr "new String('abc')") = Pack (Js.string "abc")); assert (Pack (Js.Unsafe.js_expr "String(1)") <> Pack (Js.string "2")); assert (Pack (Js.Unsafe.js_expr "String('abcd')") <> Pack (Js.string "abc")); assert (Pack (Js.Unsafe.js_expr "new String('abcd')") <> Pack (Js.string "abc")); assert ( Pack (Js.Unsafe.js_expr "new String('abcd')") = Pack (Js.Unsafe.js_expr "new String('abcd')")) let%expect_test "symbol comparison" = let s1 = Pack (Js.Unsafe.js_expr "Symbol('2')") in let s2 = Pack (Js.Unsafe.js_expr "Symbol('2')") in assert (s1 <> s2); assert (s1 = s1); assert (compare s1 s1 = 0); assert (compare s1 s2 = 1); assert (compare s2 s1 = 1) let%expect_test "object comparison" = let s1 = Pack (Js.Unsafe.js_expr "{}") in let s2 = Pack (Js.Unsafe.js_expr "{}") in assert (s1 <> s2); assert (s1 = s1); assert (compare s1 s1 = 0); assert (compare s1 s2 = 1); assert (compare s2 s1 = 1) let%expect_test "poly compare" = let l = [ Pack (object end) ; Pack 0 ; Pack (Some "") ; Pack None ; Pack (Js.Unsafe.obj [| "a", Js.Unsafe.inject 0 |]) ; Pack (Js.Unsafe.obj [| "a", Js.Unsafe.inject 0 |]) ; Pack (Js.undefined) ; Pack (Js.null) ] |> List.mapi (fun i x -> i, x) in let l' = List.sort (fun (_, a) (_, b) -> compare a b) l in List.iter (fun (i, _) -> Printf.printf "%d\n" i) l'; print_endline ""; [%expect {| 1 3 2 0 6 7 5 4 |}]; let l' = List.sort (fun (_, a) (_, b) -> compare a b) (List.rev l) in let l'' = List.sort (fun (_, a) (_, b) -> compare a b) (List.rev l') in List.iter (fun (i, _) -> Printf.printf "%d\n" i) l'; print_endline ""; [%expect {| 3 1 2 0 4 5 7 6 |}]; List.iter (fun (i, _) -> Printf.printf "%d\n" i) l''; print_endline ""; [%expect {| 1 3 2 0 4 5 6 7 |}] js_of_ocaml-3.5.2/lib/tests/regexp1.ml000066400000000000000000000037401357507750000176260ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml let%expect_test _ = let re1 = Regexp.regexp "ab?" in let re2 = Regexp.regexp "\\." in let re3 = Regexp.regexp_string "(.)\\(.)" in let s1 = "totobtutua" in let s2 = "rr.ee.ab.a.b.bb.a.ee." in (match Regexp.string_match re1 s1 0 with | None -> print_endline "Can't match 1 1" | Some r -> let x = Regexp.matched_string r in if x = "a" then () else print_endline ("Wrong match 1 1: " ^ x)); [%expect {||}]; (match Regexp.string_match re1 s2 0 with | None -> print_endline "Can't match 1 2" | Some r -> let x = Regexp.matched_string r in if x = "ab" then () else print_endline ("Wrong match 1 2: " ^ x)); [%expect {||}]; (let l = Regexp.split re2 s2 in if l = [ "rr"; "ee"; "ab"; "a"; "b"; "bb"; "a"; "ee"; "" ] then () else print_endline "Wrong split 2 2"); [%expect {||}]; (let x = Regexp.global_replace re2 s2 "" in if x = "rreeababbbaee" then () else print_endline ("Wrong replacement 2 2: " ^ x)); [%expect {||}]; (match Regexp.string_match re3 "(.)\\(.)" 0 with | None -> print_endline "Quote 3 3" | Some _ -> ()); [%expect {||}] js_of_ocaml-3.5.2/lib/tests/time.ml000066400000000000000000000045471357507750000172170ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2013 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) let log_failure_tm name tmg = let open Unix in Printf.printf "%s: s:%d; m:%d; h:%d; D:%d; M:%d; Y:%d; WD:%d; YD:%d; dst:%b" name tmg.tm_sec tmg.tm_min tmg.tm_hour tmg.tm_mday tmg.tm_mon tmg.tm_year tmg.tm_wday tmg.tm_yday tmg.tm_isdst let now = 1377134255.469 (* +. 24. *. 60. *. 60. *. 1. *) (* check gmtime *) let tmg = Unix.gmtime now let%expect_test _ = (match tmg with | { Unix.tm_sec = 35 ; Unix.tm_min = 17 ; Unix.tm_hour = 1 ; Unix.tm_mday = 22 ; Unix.tm_mon = 7 ; Unix.tm_year = 113 ; Unix.tm_wday = 4 ; Unix.tm_yday = 233 ; Unix.tm_isdst = false } -> () | _ -> log_failure_tm "Unix.gmtime" tmg); [%expect {||}] (* check localetime *) (* let tm = Unix.localtime now let () = match tm with | {Unix.tm_sec = 35; Unix.tm_min = 17; Unix.tm_hour = 18; Unix.tm_mday = 21; Unix.tm_mon = 7; Unix.tm_year = 113; Unix.tm_wday = 3; Unix.tm_yday = 232; Unix.tm_isdst = true} -> log_success () | _ -> log_failure_tm "Unix.localtime" tm (* check normalization *) let norm = Unix.mktime {tm with Unix.tm_mon = 9; Unix.tm_mday = 40} let _ = match norm with | (1384049855., {Unix.tm_sec = 35; Unix.tm_min = 17; Unix.tm_hour = 18; Unix.tm_mday = 9; Unix.tm_mon = 10; Unix.tm_year = 113; Unix.tm_wday = 6; Unix.tm_yday = 312; Unix.tm_isdst = false}) -> log_success () | (1384049855.,tm) -> log_failure_tm "Unix.mktime" tm | (wrong,tm) -> log_failure_tm "Unix.mktime" tm; log_failure (Printf.sprintf "Unix.mktime: %.0f <> 1384049855" wrong) *) js_of_ocaml-3.5.2/lib/tests/unix.js000066400000000000000000000003641357507750000172410ustar00rootroot00000000000000//Phantom if(joo_global_object.phantom && joo_global_object.phantom.exit) joo_global_object.quit = joo_global_object.phantom.exit; if(joo_global_object.onerror) joo_global_object.onerror = function() { joo_global_object.caml_sys_exit(1);} js_of_ocaml-3.5.2/lib/tests/url1.ml000066400000000000000000000030641357507750000171350ustar00rootroot00000000000000(* Js_of_ocaml tests * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2010 Jérôme Vouillon * Laboratoire PPS - CNRS Université Paris Diderot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml let url_string_url u = Url.url_of_string (Url.string_of_url u) let url = "http://ocsigen.org/js_of_ocaml/" let%expect_test _ = (match Url.url_of_string url with | None -> print_endline "can't parse current url2" | Some u -> ( match url_string_url u with | None -> print_endline "can't parse pretty-printed url" | Some v -> if u = v then () else print_endline "no fixpoint")); [%expect {||}] let%expect_test _ = let t1 = Url.urlencode "/toto+ blah&tutu" in let t2 = Url.urlencode ~with_plus:false "/toto+ blah&tutu" in if t1 = "/toto%2B%20blah%26tutu" && t2 = "/toto+%20blah%26tutu" then () else print_endline "escaping error"; [%expect {||}] js_of_ocaml-3.5.2/lib/tyxml/000077500000000000000000000000001357507750000157305ustar00rootroot00000000000000js_of_ocaml-3.5.2/lib/tyxml/dune000066400000000000000000000003231357507750000166040ustar00rootroot00000000000000(library (name js_of_ocaml_tyxml) (public_name js_of_ocaml-tyxml) (synopsis "Tyxml for js_of_ocaml.") (libraries js_of_ocaml tyxml tyxml.functor react reactiveData) (preprocess (pps js_of_ocaml-ppx))) js_of_ocaml-3.5.2/lib/tyxml/import.ml000066400000000000000000000036031357507750000175760ustar00rootroot00000000000000(* Js_of_ocaml * http://www.ocsigen.org/js_of_ocaml/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Poly = struct external ( < ) : 'a -> 'a -> bool = "%lessthan" external ( <= ) : 'a -> 'a -> bool = "%lessequal" external ( <> ) : 'a -> 'a -> bool = "%notequal" external ( = ) : 'a -> 'a -> bool = "%equal" external ( > ) : 'a -> 'a -> bool = "%greaterthan" external ( >= ) : 'a -> 'a -> bool = "%greaterequal" external compare : 'a -> 'a -> int = "%compare" external equal : 'a -> 'a -> bool = "%equal" end module Int_replace_polymorphic_compare = struct let ( < ) (x : int) y = x < y let ( <= ) (x : int) y = x <= y let ( <> ) (x : int) y = x <> y let ( = ) (x : int) y = x = y let ( > ) (x : int) y = x > y let ( >= ) (x : int) y = x >= y let compare (x : int) y = compare x y let equal (x : int) y = x = y let max (x : int) y = if x >= y then x else y let min (x : int) y = if x <= y then x else y end module String = struct include String let equal (x : string) (y : string) = Poly.equal x y end module Char = struct include Char let equal (x : char) (y : char) = Poly.equal x y end include Int_replace_polymorphic_compare js_of_ocaml-3.5.2/lib/tyxml/js_of_ocaml_tyxml.ml000066400000000000000000000017051357507750000217750ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2017 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) module Tyxml_js = Tyxml_js module Tyxml_cast = Tyxml_cast module Tyxml_cast_sigs = Tyxml_cast_sigs js_of_ocaml-3.5.2/lib/tyxml/tyxml_cast.ml000066400000000000000000000220551357507750000204550ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open! Import module MakeTo (C : sig type 'a elt val elt : 'a elt -> Dom.node Js.t end) : Tyxml_cast_sigs.TO with type 'a elt = 'a C.elt = struct type 'a elt = 'a C.elt let rebuild_node _ x = Js.Unsafe.coerce (C.elt x) let of_element elt = rebuild_node "of_element" elt let of_node elt = rebuild_node "of_node" elt let of_pcdata elt = rebuild_node "of_pcdata" elt let of_html elt = rebuild_node "of_html" elt let of_head elt = rebuild_node "of_head" elt let of_link elt = rebuild_node "of_link" elt let of_title elt = rebuild_node "of_title" elt let of_meta elt = rebuild_node "of_meta" elt let of_base elt = rebuild_node "of_base" elt let of_style elt = rebuild_node "of_style" elt let of_body elt = rebuild_node "of_body" elt let of_form elt = rebuild_node "of_form" elt let of_optgroup elt = rebuild_node "of_optgroup" elt let of_option elt = rebuild_node "of_option" elt let of_select elt = rebuild_node "of_select" elt let of_input elt = rebuild_node "of_input" elt let of_textarea elt = rebuild_node "of_textarea" elt let of_button elt = rebuild_node "of_button" elt let of_label elt = rebuild_node "of_label" elt let of_fieldset elt = rebuild_node "of_fieldset" elt let of_legend elt = rebuild_node "of_legend" elt let of_ul elt = rebuild_node "of_ul" elt let of_ol elt = rebuild_node "of_ol" elt let of_dl elt = rebuild_node "of_dl" elt let of_li elt = rebuild_node "of_li" elt let of_div elt = rebuild_node "of_div" elt let of_p elt = rebuild_node "of_p" elt let of_heading elt = rebuild_node "of_heading" elt let of_blockquote elt = rebuild_node "of_blockquote" elt let of_pre elt = rebuild_node "of_pre" elt let of_br elt = rebuild_node "of_br" elt let of_hr elt = rebuild_node "of_hr" elt let of_ins elt = rebuild_node "of_ins" elt let of_del elt = rebuild_node "of_del" elt let of_a elt = rebuild_node "of_a" elt let of_img elt = rebuild_node "of_img" elt let of_object elt = rebuild_node "of_object" elt let of_param elt = rebuild_node "of_param" elt let of_area elt = rebuild_node "of_area" elt let of_map elt = rebuild_node "of_map" elt let of_script elt = rebuild_node "of_script" elt let of_td elt = rebuild_node "of_td" elt let of_tr elt = rebuild_node "of_tr" elt let of_col elt = rebuild_node "of_col" elt let of_tfoot elt = rebuild_node "of_tfoot" elt let of_thead elt = rebuild_node "of_thead" elt let of_tbody elt = rebuild_node "of_tbody" elt let of_caption elt = rebuild_node "of_caption" elt let of_table elt = rebuild_node "of_table" elt let of_canvas elt = rebuild_node "of_canvas" elt let of_iframe elt = rebuild_node "of_iframe" elt let of_audio elt = rebuild_node "of_audio" elt let of_video elt = rebuild_node "of_video" elt (* Dom_html.headingElement *) let of_h1 elt = rebuild_node "of_h1" elt let of_h2 elt = rebuild_node "of_h2" elt let of_h3 elt = rebuild_node "of_h3" elt let of_h4 elt = rebuild_node "of_h4" elt let of_h5 elt = rebuild_node "of_h5" elt let of_h6 elt = rebuild_node "of_h6" elt (* Dom_html.element *) let of_abbr elt = rebuild_node "of_abbr" elt let of_address elt = rebuild_node "of_address" elt let of_article elt = rebuild_node "of_article" elt let of_aside elt = rebuild_node "of_aside" elt let of_b elt = rebuild_node "of_b" elt let of_bdo elt = rebuild_node "of_bdo" elt let of_cite elt = rebuild_node "of_cite" elt let of_code elt = rebuild_node "of_code" elt let of_colgroup elt = rebuild_node "of_colgroup" elt let of_command elt = rebuild_node "of_command" elt let of_datalist elt = rebuild_node "of_datalist" elt let of_dd elt = rebuild_node "of_dd" elt let of_details elt = rebuild_node "of_details" elt let of_dfn elt = rebuild_node "of_dfn" elt let of_dt elt = rebuild_node "of_dt" elt let of_em elt = rebuild_node "of_em" elt let of_embed elt = rebuild_node "of_embed" elt let of_figcaption elt = rebuild_node "of_figcaption" elt let of_figure elt = rebuild_node "of_figure" elt let of_footer elt = rebuild_node "of_footer" elt let of_header elt = rebuild_node "of_header" elt let of_hgroup elt = rebuild_node "of_hgroup" elt let of_i elt = rebuild_node "of_i" elt let of_kbd elt = rebuild_node "of_kbd" elt let of_keygen elt = rebuild_node "of_keygen" elt let of_main elt = rebuild_node "of_main" elt let of_mark elt = rebuild_node "of_mark" elt let of_menu elt = rebuild_node "of_menu" elt let of_meter elt = rebuild_node "of_meter" elt let of_nav elt = rebuild_node "of_nav" elt let of_noscript elt = rebuild_node "of_noscript" elt let of_output elt = rebuild_node "of_output" elt let of_progress elt = rebuild_node "of_progress" elt let of_q elt = rebuild_node "of_q" elt let of_rp elt = rebuild_node "of_rp" elt let of_rt elt = rebuild_node "of_rt" elt let of_ruby elt = rebuild_node "of_ruby" elt let of_samp elt = rebuild_node "of_samp" elt let of_section elt = rebuild_node "of_section" elt let of_small elt = rebuild_node "of_small" elt let of_source elt = rebuild_node "of_source" elt let of_span elt = rebuild_node "of_span" elt let of_strong elt = rebuild_node "of_strong" elt let of_sub elt = rebuild_node "of_sub" elt let of_summary elt = rebuild_node "of_summary" elt let of_sup elt = rebuild_node "of_sup" elt let of_th elt = rebuild_node "of_th" elt let of_time elt = rebuild_node "of_time" elt let of_u elt = rebuild_node "of_u" elt let of_var elt = rebuild_node "of_var" elt let of_wbr elt = rebuild_node "of_wbr" elt end module MakeOf (C : sig type 'a elt val elt : Dom.node Js.t -> 'a elt end) : Tyxml_cast_sigs.OF with type 'a elt = 'a C.elt = struct type 'a elt = 'a C.elt let rebuild_node _ x = C.elt (Js.Unsafe.coerce x) let of_element elt = rebuild_node "of_element" elt let of_html elt = rebuild_node "of_html" elt let of_head elt = rebuild_node "of_head" elt let of_link elt = rebuild_node "of_link" elt let of_title elt = rebuild_node "of_title" elt let of_meta elt = rebuild_node "of_meta" elt let of_base elt = rebuild_node "of_base" elt let of_style elt = rebuild_node "of_style" elt let of_body elt = rebuild_node "of_body" elt let of_form elt = rebuild_node "of_form" elt let of_optGroup elt = rebuild_node "of_optGroup" elt let of_option elt = rebuild_node "of_option" elt let of_select elt = rebuild_node "of_select" elt let of_input elt = rebuild_node "of_input" elt let of_textArea elt = rebuild_node "of_textArea" elt let of_button elt = rebuild_node "of_button" elt let of_label elt = rebuild_node "of_label" elt let of_fieldSet elt = rebuild_node "of_fieldSet" elt let of_legend elt = rebuild_node "of_legend" elt let of_uList elt = rebuild_node "of_uList" elt let of_oList elt = rebuild_node "of_oList" elt let of_dList elt = rebuild_node "of_dList" elt let of_li elt = rebuild_node "of_li" elt let of_div elt = rebuild_node "of_div" elt let of_paragraph elt = rebuild_node "of_paragraph" elt let of_heading elt = rebuild_node "of_heading" elt let of_quote elt = rebuild_node "of_quote" elt let of_pre elt = rebuild_node "of_pre" elt let of_br elt = rebuild_node "of_br" elt let of_hr elt = rebuild_node "of_hr" elt let of_mod elt = rebuild_node "of_mod" elt let of_anchor elt = rebuild_node "of_anchor" elt let of_image elt = rebuild_node "of_image" elt let of_object elt = rebuild_node "of_object" elt let of_param elt = rebuild_node "of_param" elt let of_area elt = rebuild_node "of_area" elt let of_map elt = rebuild_node "of_map" elt let of_script elt = rebuild_node "of_script" elt let of_embed elt = rebuild_node "of_embed" elt let of_tableCell elt = rebuild_node "of_tableCell" elt let of_tableRow elt = rebuild_node "of_tableRow" elt let of_tableCol elt = rebuild_node "of_tableCol" elt let of_tableSection elt = rebuild_node "of_tableSection" elt let of_tableCaption elt = rebuild_node "of_tableCaption" elt let of_table elt = rebuild_node "of_table" elt let of_canvas elt = rebuild_node "of_canvas" elt let of_iFrame elt = rebuild_node "of_iFrame" elt let of_audio elt = rebuild_node "of_audio" elt let of_video elt = rebuild_node "of_video" elt end js_of_ocaml-3.5.2/lib/tyxml/tyxml_cast.mli000066400000000000000000000022321357507750000206210ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Cast to and from Tyxml types *) open Js_of_ocaml module MakeTo (C : sig type 'a elt val elt : 'a elt -> Dom.node Js.t end) : Tyxml_cast_sigs.TO with type 'a elt = 'a C.elt module MakeOf (C : sig type 'a elt val elt : Dom.node Js.t -> 'a elt end) : Tyxml_cast_sigs.OF with type 'a elt = 'a C.elt js_of_ocaml-3.5.2/lib/tyxml/tyxml_cast_sigs.ml000066400000000000000000000305421357507750000215020ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Signatures to cast to and from Tyxml types *) open Js_of_ocaml open! Import module type OF = sig type 'a elt val of_element : Dom_html.element Js.t -> 'a elt val of_html : Dom_html.htmlElement Js.t -> [> Html_types.html ] elt val of_head : Dom_html.headElement Js.t -> [> Html_types.head ] elt val of_link : Dom_html.linkElement Js.t -> [> Html_types.link ] elt val of_title : Dom_html.titleElement Js.t -> [> Html_types.title ] elt val of_meta : Dom_html.metaElement Js.t -> [> Html_types.meta ] elt val of_base : Dom_html.baseElement Js.t -> [> Html_types.base ] elt val of_style : Dom_html.styleElement Js.t -> [> Html_types.style ] elt val of_body : Dom_html.bodyElement Js.t -> [> Html_types.body ] elt val of_form : Dom_html.formElement Js.t -> [> Html_types.form ] elt val of_optGroup : Dom_html.optGroupElement Js.t -> [> Html_types.optgroup ] elt val of_option : Dom_html.optionElement Js.t -> [> Html_types.selectoption ] elt val of_select : Dom_html.selectElement Js.t -> [> Html_types.select ] elt val of_input : Dom_html.inputElement Js.t -> [> Html_types.input ] elt val of_textArea : Dom_html.textAreaElement Js.t -> [> Html_types.textarea ] elt val of_button : Dom_html.buttonElement Js.t -> [> Html_types.button ] elt val of_label : Dom_html.labelElement Js.t -> [> Html_types.label ] elt val of_fieldSet : Dom_html.fieldSetElement Js.t -> [> Html_types.fieldset ] elt val of_legend : Dom_html.legendElement Js.t -> [> Html_types.legend ] elt val of_uList : Dom_html.uListElement Js.t -> [> Html_types.ul ] elt val of_oList : Dom_html.oListElement Js.t -> [> Html_types.ol ] elt val of_dList : Dom_html.dListElement Js.t -> [> Html_types.dl ] elt val of_li : Dom_html.liElement Js.t -> [> Html_types.li ] elt val of_div : Dom_html.divElement Js.t -> [> Html_types.div ] elt val of_paragraph : Dom_html.paragraphElement Js.t -> [> Html_types.p ] elt val of_heading : Dom_html.headingElement Js.t -> [> Html_types.heading ] elt val of_quote : Dom_html.quoteElement Js.t -> [> Html_types.blockquote ] elt val of_pre : Dom_html.preElement Js.t -> [> Html_types.pre ] elt val of_br : Dom_html.brElement Js.t -> [> Html_types.br ] elt val of_hr : Dom_html.hrElement Js.t -> [> Html_types.hr ] elt val of_mod : Dom_html.modElement Js.t -> [> 'a Html_types.del | 'a Html_types.ins ] elt val of_anchor : Dom_html.anchorElement Js.t -> [> 'a Html_types.a ] elt val of_image : Dom_html.imageElement Js.t -> [> Html_types.img ] elt val of_object : Dom_html.objectElement Js.t -> [> 'a Html_types.object_ ] elt val of_param : Dom_html.paramElement Js.t -> [> Html_types.param ] elt val of_area : Dom_html.areaElement Js.t -> [> Html_types.area ] elt val of_map : Dom_html.mapElement Js.t -> [> 'a Html_types.map ] elt val of_script : Dom_html.scriptElement Js.t -> [> Html_types.script ] elt val of_embed : Dom_html.embedElement Js.t -> [> Html_types.embed ] elt val of_tableCell : Dom_html.tableCellElement Js.t -> [> Html_types.td | Html_types.th ] elt val of_tableRow : Dom_html.tableRowElement Js.t -> [> Html_types.tr ] elt val of_tableCol : Dom_html.tableColElement Js.t -> [> Html_types.col ] elt val of_tableSection : Dom_html.tableSectionElement Js.t -> [> Html_types.tfoot | Html_types.thead | Html_types.tbody ] elt val of_tableCaption : Dom_html.tableCaptionElement Js.t -> [> Html_types.caption ] elt val of_table : Dom_html.tableElement Js.t -> [> Html_types.table ] elt val of_canvas : Dom_html.canvasElement Js.t -> [> 'a Html_types.canvas ] elt val of_iFrame : Dom_html.iFrameElement Js.t -> [> Html_types.iframe ] elt val of_audio : Dom_html.audioElement Js.t -> [> 'a Html_types.audio ] elt val of_video : Dom_html.videoElement Js.t -> [> 'a Html_types.video ] elt end module type TO = sig type 'a elt val of_element : 'a elt -> Dom_html.element Js.t val of_node : 'a elt -> Dom.node Js.t val of_pcdata : [< Html_types.pcdata ] elt -> Dom.text Js.t val of_html : [< Html_types.html ] elt -> Dom_html.htmlElement Js.t val of_head : [< Html_types.head ] elt -> Dom_html.headElement Js.t val of_link : [< Html_types.link ] elt -> Dom_html.linkElement Js.t val of_title : [< Html_types.title ] elt -> Dom_html.titleElement Js.t val of_meta : [< Html_types.meta ] elt -> Dom_html.metaElement Js.t val of_base : [< Html_types.base ] elt -> Dom_html.baseElement Js.t val of_style : [< Html_types.style ] elt -> Dom_html.styleElement Js.t val of_body : [< Html_types.body ] elt -> Dom_html.bodyElement Js.t val of_form : [< Html_types.form ] elt -> Dom_html.formElement Js.t val of_optgroup : [< Html_types.optgroup ] elt -> Dom_html.optGroupElement Js.t val of_option : [< Html_types.selectoption ] elt -> Dom_html.optionElement Js.t val of_select : [< Html_types.select ] elt -> Dom_html.selectElement Js.t val of_input : [< Html_types.input ] elt -> Dom_html.inputElement Js.t val of_textarea : [< Html_types.textarea ] elt -> Dom_html.textAreaElement Js.t val of_button : [< Html_types.button ] elt -> Dom_html.buttonElement Js.t val of_label : [< Html_types.label ] elt -> Dom_html.labelElement Js.t val of_fieldset : [< Html_types.fieldset ] elt -> Dom_html.fieldSetElement Js.t val of_legend : [< Html_types.legend ] elt -> Dom_html.legendElement Js.t val of_ul : [< Html_types.ul ] elt -> Dom_html.uListElement Js.t val of_ol : [< Html_types.ol ] elt -> Dom_html.oListElement Js.t val of_dl : [< Html_types.dl ] elt -> Dom_html.dListElement Js.t val of_li : [< Html_types.li ] elt -> Dom_html.liElement Js.t val of_div : [< Html_types.div ] elt -> Dom_html.divElement Js.t val of_p : [< Html_types.p ] elt -> Dom_html.paragraphElement Js.t val of_heading : [< Html_types.heading ] elt -> Dom_html.headingElement Js.t val of_blockquote : [< Html_types.blockquote ] elt -> Dom_html.quoteElement Js.t val of_pre : [< Html_types.pre ] elt -> Dom_html.preElement Js.t val of_br : [< Html_types.br ] elt -> Dom_html.brElement Js.t val of_hr : [< Html_types.hr ] elt -> Dom_html.hrElement Js.t val of_del : [< 'a Html_types.del ] elt -> Dom_html.modElement Js.t val of_ins : [< 'a Html_types.ins ] elt -> Dom_html.modElement Js.t val of_a : [< 'a Html_types.a ] elt -> Dom_html.anchorElement Js.t val of_img : [< Html_types.img_interactive ] elt -> Dom_html.imageElement Js.t val of_object : [< 'a Html_types.object_ ] elt -> Dom_html.objectElement Js.t val of_param : [< Html_types.param ] elt -> Dom_html.paramElement Js.t val of_area : [< Html_types.area ] elt -> Dom_html.areaElement Js.t val of_map : [< 'a Html_types.map ] elt -> Dom_html.mapElement Js.t val of_script : [< Html_types.script ] elt -> Dom_html.scriptElement Js.t val of_td : [< Html_types.td | Html_types.td ] elt -> Dom_html.tableCellElement Js.t val of_tr : [< Html_types.tr ] elt -> Dom_html.tableRowElement Js.t val of_col : [< Html_types.col ] elt -> Dom_html.tableColElement Js.t val of_tfoot : [< Html_types.tfoot ] elt -> Dom_html.tableSectionElement Js.t val of_thead : [< Html_types.thead ] elt -> Dom_html.tableSectionElement Js.t val of_tbody : [< Html_types.tbody ] elt -> Dom_html.tableSectionElement Js.t val of_caption : [< Html_types.caption ] elt -> Dom_html.tableCaptionElement Js.t val of_table : [< Html_types.table ] elt -> Dom_html.tableElement Js.t val of_canvas : [< 'a Html_types.canvas ] elt -> Dom_html.canvasElement Js.t val of_iframe : [< Html_types.iframe ] elt -> Dom_html.iFrameElement Js.t val of_audio : [< 'a Html_types.audio_interactive ] elt -> Dom_html.audioElement Js.t val of_video : [< 'a Html_types.video_interactive ] elt -> Dom_html.videoElement Js.t (* Dom_html.headingElement *) val of_h1 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h2 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h3 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h4 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h5 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h6 : Html_types.heading elt -> Dom_html.headingElement Js.t (* Dom_html.element *) val of_abbr : [> Html_types.abbr ] elt -> Dom_html.element Js.t val of_address : [> Html_types.address ] elt -> Dom_html.element Js.t val of_article : [> Html_types.article ] elt -> Dom_html.element Js.t val of_aside : [> Html_types.aside ] elt -> Dom_html.element Js.t val of_b : [> Html_types.b ] elt -> Dom_html.element Js.t val of_bdo : [> Html_types.bdo ] elt -> Dom_html.element Js.t val of_cite : [> Html_types.cite ] elt -> Dom_html.element Js.t val of_code : [> Html_types.code ] elt -> Dom_html.element Js.t val of_colgroup : [> Html_types.colgroup ] elt -> Dom_html.element Js.t val of_command : [> Html_types.command ] elt -> Dom_html.element Js.t val of_datalist : [> Html_types.datalist ] elt -> Dom_html.element Js.t val of_dd : [> Html_types.dd ] elt -> Dom_html.element Js.t val of_details : [> Html_types.details ] elt -> Dom_html.element Js.t val of_dfn : [> Html_types.dfn ] elt -> Dom_html.element Js.t val of_dt : [> Html_types.dt ] elt -> Dom_html.element Js.t val of_em : [> Html_types.em ] elt -> Dom_html.element Js.t val of_embed : [> Html_types.embed ] elt -> Dom_html.element Js.t val of_figcaption : [> Html_types.figcaption ] elt -> Dom_html.element Js.t val of_figure : [> Html_types.figure ] elt -> Dom_html.element Js.t val of_footer : [> Html_types.footer ] elt -> Dom_html.element Js.t val of_header : [> Html_types.header ] elt -> Dom_html.element Js.t val of_hgroup : [> Html_types.hgroup ] elt -> Dom_html.element Js.t val of_i : [> Html_types.i ] elt -> Dom_html.element Js.t val of_kbd : [> Html_types.kbd ] elt -> Dom_html.element Js.t val of_keygen : [> Html_types.keygen ] elt -> Dom_html.element Js.t val of_main : [> Html_types.main ] elt -> Dom_html.element Js.t val of_mark : [> Html_types.mark ] elt -> Dom_html.element Js.t val of_menu : [> Html_types.menu ] elt -> Dom_html.element Js.t val of_meter : [> Html_types.meter ] elt -> Dom_html.element Js.t val of_nav : [> Html_types.nav ] elt -> Dom_html.element Js.t val of_noscript : [> Html_types.noscript ] elt -> Dom_html.element Js.t val of_output : [> Html_types.output_elt ] elt -> Dom_html.element Js.t val of_progress : [> Html_types.progress ] elt -> Dom_html.element Js.t val of_q : [> Html_types.q ] elt -> Dom_html.element Js.t val of_rp : [> Html_types.rp ] elt -> Dom_html.element Js.t val of_rt : [> Html_types.rt ] elt -> Dom_html.element Js.t val of_ruby : [> Html_types.ruby ] elt -> Dom_html.element Js.t val of_samp : [> Html_types.samp ] elt -> Dom_html.element Js.t val of_section : [> Html_types.section ] elt -> Dom_html.element Js.t val of_small : [> Html_types.small ] elt -> Dom_html.element Js.t val of_source : [> Html_types.source ] elt -> Dom_html.element Js.t val of_span : [> Html_types.span ] elt -> Dom_html.element Js.t val of_strong : [> Html_types.strong ] elt -> Dom_html.element Js.t val of_sub : [> Html_types.sub ] elt -> Dom_html.element Js.t val of_summary : [> Html_types.summary ] elt -> Dom_html.element Js.t val of_sup : [> Html_types.sup ] elt -> Dom_html.element Js.t val of_th : [> Html_types.th ] elt -> Dom_html.element Js.t val of_time : [> Html_types.time ] elt -> Dom_html.element Js.t val of_u : [> Html_types.u ] elt -> Dom_html.element Js.t val of_var : [> Html_types.var ] elt -> Dom_html.element Js.t val of_wbr : [> Html_types.wbr ] elt -> Dom_html.element Js.t end js_of_ocaml-3.5.2/lib/tyxml/tyxml_cast_sigs.mli000066400000000000000000000305251357507750000216540ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Signatures to cast to and from Tyxml types *) open Js_of_ocaml module type OF = sig type 'a elt val of_element : Dom_html.element Js.t -> 'a elt val of_html : Dom_html.htmlElement Js.t -> [> Html_types.html ] elt val of_head : Dom_html.headElement Js.t -> [> Html_types.head ] elt val of_link : Dom_html.linkElement Js.t -> [> Html_types.link ] elt val of_title : Dom_html.titleElement Js.t -> [> Html_types.title ] elt val of_meta : Dom_html.metaElement Js.t -> [> Html_types.meta ] elt val of_base : Dom_html.baseElement Js.t -> [> Html_types.base ] elt val of_style : Dom_html.styleElement Js.t -> [> Html_types.style ] elt val of_body : Dom_html.bodyElement Js.t -> [> Html_types.body ] elt val of_form : Dom_html.formElement Js.t -> [> Html_types.form ] elt val of_optGroup : Dom_html.optGroupElement Js.t -> [> Html_types.optgroup ] elt val of_option : Dom_html.optionElement Js.t -> [> Html_types.selectoption ] elt val of_select : Dom_html.selectElement Js.t -> [> Html_types.select ] elt val of_input : Dom_html.inputElement Js.t -> [> Html_types.input ] elt val of_textArea : Dom_html.textAreaElement Js.t -> [> Html_types.textarea ] elt val of_button : Dom_html.buttonElement Js.t -> [> Html_types.button ] elt val of_label : Dom_html.labelElement Js.t -> [> Html_types.label ] elt val of_fieldSet : Dom_html.fieldSetElement Js.t -> [> Html_types.fieldset ] elt val of_legend : Dom_html.legendElement Js.t -> [> Html_types.legend ] elt val of_uList : Dom_html.uListElement Js.t -> [> Html_types.ul ] elt val of_oList : Dom_html.oListElement Js.t -> [> Html_types.ol ] elt val of_dList : Dom_html.dListElement Js.t -> [> Html_types.dl ] elt val of_li : Dom_html.liElement Js.t -> [> Html_types.li ] elt val of_div : Dom_html.divElement Js.t -> [> Html_types.div ] elt val of_paragraph : Dom_html.paragraphElement Js.t -> [> Html_types.p ] elt val of_heading : Dom_html.headingElement Js.t -> [> Html_types.heading ] elt val of_quote : Dom_html.quoteElement Js.t -> [> Html_types.blockquote ] elt val of_pre : Dom_html.preElement Js.t -> [> Html_types.pre ] elt val of_br : Dom_html.brElement Js.t -> [> Html_types.br ] elt val of_hr : Dom_html.hrElement Js.t -> [> Html_types.hr ] elt val of_mod : Dom_html.modElement Js.t -> [> 'a Html_types.del | 'a Html_types.ins ] elt val of_anchor : Dom_html.anchorElement Js.t -> [> 'a Html_types.a ] elt val of_image : Dom_html.imageElement Js.t -> [> Html_types.img ] elt val of_object : Dom_html.objectElement Js.t -> [> 'a Html_types.object_ ] elt val of_param : Dom_html.paramElement Js.t -> [> Html_types.param ] elt val of_area : Dom_html.areaElement Js.t -> [> Html_types.area ] elt val of_map : Dom_html.mapElement Js.t -> [> 'a Html_types.map ] elt val of_script : Dom_html.scriptElement Js.t -> [> Html_types.script ] elt val of_embed : Dom_html.embedElement Js.t -> [> Html_types.embed ] elt val of_tableCell : Dom_html.tableCellElement Js.t -> [> Html_types.td | Html_types.th ] elt val of_tableRow : Dom_html.tableRowElement Js.t -> [> Html_types.tr ] elt val of_tableCol : Dom_html.tableColElement Js.t -> [> Html_types.col ] elt val of_tableSection : Dom_html.tableSectionElement Js.t -> [> Html_types.tfoot | Html_types.thead | Html_types.tbody ] elt val of_tableCaption : Dom_html.tableCaptionElement Js.t -> [> Html_types.caption ] elt val of_table : Dom_html.tableElement Js.t -> [> Html_types.table ] elt val of_canvas : Dom_html.canvasElement Js.t -> [> 'a Html_types.canvas ] elt val of_iFrame : Dom_html.iFrameElement Js.t -> [> Html_types.iframe ] elt val of_audio : Dom_html.audioElement Js.t -> [> 'a Html_types.audio ] elt val of_video : Dom_html.videoElement Js.t -> [> 'a Html_types.video ] elt end module type TO = sig type 'a elt val of_element : 'a elt -> Dom_html.element Js.t val of_node : 'a elt -> Dom.node Js.t val of_pcdata : [< Html_types.pcdata ] elt -> Dom.text Js.t val of_html : [< Html_types.html ] elt -> Dom_html.htmlElement Js.t val of_head : [< Html_types.head ] elt -> Dom_html.headElement Js.t val of_link : [< Html_types.link ] elt -> Dom_html.linkElement Js.t val of_title : [< Html_types.title ] elt -> Dom_html.titleElement Js.t val of_meta : [< Html_types.meta ] elt -> Dom_html.metaElement Js.t val of_base : [< Html_types.base ] elt -> Dom_html.baseElement Js.t val of_style : [< Html_types.style ] elt -> Dom_html.styleElement Js.t val of_body : [< Html_types.body ] elt -> Dom_html.bodyElement Js.t val of_form : [< Html_types.form ] elt -> Dom_html.formElement Js.t val of_optgroup : [< Html_types.optgroup ] elt -> Dom_html.optGroupElement Js.t val of_option : [< Html_types.selectoption ] elt -> Dom_html.optionElement Js.t val of_select : [< Html_types.select ] elt -> Dom_html.selectElement Js.t val of_input : [< Html_types.input ] elt -> Dom_html.inputElement Js.t val of_textarea : [< Html_types.textarea ] elt -> Dom_html.textAreaElement Js.t val of_button : [< Html_types.button ] elt -> Dom_html.buttonElement Js.t val of_label : [< Html_types.label ] elt -> Dom_html.labelElement Js.t val of_fieldset : [< Html_types.fieldset ] elt -> Dom_html.fieldSetElement Js.t val of_legend : [< Html_types.legend ] elt -> Dom_html.legendElement Js.t val of_ul : [< Html_types.ul ] elt -> Dom_html.uListElement Js.t val of_ol : [< Html_types.ol ] elt -> Dom_html.oListElement Js.t val of_dl : [< Html_types.dl ] elt -> Dom_html.dListElement Js.t val of_li : [< Html_types.li ] elt -> Dom_html.liElement Js.t val of_div : [< Html_types.div ] elt -> Dom_html.divElement Js.t val of_p : [< Html_types.p ] elt -> Dom_html.paragraphElement Js.t val of_heading : [< Html_types.heading ] elt -> Dom_html.headingElement Js.t val of_blockquote : [< Html_types.blockquote ] elt -> Dom_html.quoteElement Js.t val of_pre : [< Html_types.pre ] elt -> Dom_html.preElement Js.t val of_br : [< Html_types.br ] elt -> Dom_html.brElement Js.t val of_hr : [< Html_types.hr ] elt -> Dom_html.hrElement Js.t val of_del : [< 'a Html_types.del ] elt -> Dom_html.modElement Js.t val of_ins : [< 'a Html_types.ins ] elt -> Dom_html.modElement Js.t val of_a : [< 'a Html_types.a ] elt -> Dom_html.anchorElement Js.t val of_img : [< Html_types.img_interactive ] elt -> Dom_html.imageElement Js.t val of_object : [< 'a Html_types.object_ ] elt -> Dom_html.objectElement Js.t val of_param : [< Html_types.param ] elt -> Dom_html.paramElement Js.t val of_area : [< Html_types.area ] elt -> Dom_html.areaElement Js.t val of_map : [< 'a Html_types.map ] elt -> Dom_html.mapElement Js.t val of_script : [< Html_types.script ] elt -> Dom_html.scriptElement Js.t val of_td : [< Html_types.td | Html_types.td ] elt -> Dom_html.tableCellElement Js.t val of_tr : [< Html_types.tr ] elt -> Dom_html.tableRowElement Js.t val of_col : [< Html_types.col ] elt -> Dom_html.tableColElement Js.t val of_tfoot : [< Html_types.tfoot ] elt -> Dom_html.tableSectionElement Js.t val of_thead : [< Html_types.thead ] elt -> Dom_html.tableSectionElement Js.t val of_tbody : [< Html_types.tbody ] elt -> Dom_html.tableSectionElement Js.t val of_caption : [< Html_types.caption ] elt -> Dom_html.tableCaptionElement Js.t val of_table : [< Html_types.table ] elt -> Dom_html.tableElement Js.t val of_canvas : [< 'a Html_types.canvas ] elt -> Dom_html.canvasElement Js.t val of_iframe : [< Html_types.iframe ] elt -> Dom_html.iFrameElement Js.t val of_audio : [< 'a Html_types.audio_interactive ] elt -> Dom_html.audioElement Js.t val of_video : [< 'a Html_types.video_interactive ] elt -> Dom_html.videoElement Js.t (* Dom_html.headingElement *) val of_h1 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h2 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h3 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h4 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h5 : Html_types.heading elt -> Dom_html.headingElement Js.t val of_h6 : Html_types.heading elt -> Dom_html.headingElement Js.t (* Dom_html.element *) val of_abbr : [> Html_types.abbr ] elt -> Dom_html.element Js.t val of_address : [> Html_types.address ] elt -> Dom_html.element Js.t val of_article : [> Html_types.article ] elt -> Dom_html.element Js.t val of_aside : [> Html_types.aside ] elt -> Dom_html.element Js.t val of_b : [> Html_types.b ] elt -> Dom_html.element Js.t val of_bdo : [> Html_types.bdo ] elt -> Dom_html.element Js.t val of_cite : [> Html_types.cite ] elt -> Dom_html.element Js.t val of_code : [> Html_types.code ] elt -> Dom_html.element Js.t val of_colgroup : [> Html_types.colgroup ] elt -> Dom_html.element Js.t val of_command : [> Html_types.command ] elt -> Dom_html.element Js.t val of_datalist : [> Html_types.datalist ] elt -> Dom_html.element Js.t val of_dd : [> Html_types.dd ] elt -> Dom_html.element Js.t val of_details : [> Html_types.details ] elt -> Dom_html.element Js.t val of_dfn : [> Html_types.dfn ] elt -> Dom_html.element Js.t val of_dt : [> Html_types.dt ] elt -> Dom_html.element Js.t val of_em : [> Html_types.em ] elt -> Dom_html.element Js.t val of_embed : [> Html_types.embed ] elt -> Dom_html.element Js.t val of_figcaption : [> Html_types.figcaption ] elt -> Dom_html.element Js.t val of_figure : [> Html_types.figure ] elt -> Dom_html.element Js.t val of_footer : [> Html_types.footer ] elt -> Dom_html.element Js.t val of_header : [> Html_types.header ] elt -> Dom_html.element Js.t val of_hgroup : [> Html_types.hgroup ] elt -> Dom_html.element Js.t val of_i : [> Html_types.i ] elt -> Dom_html.element Js.t val of_kbd : [> Html_types.kbd ] elt -> Dom_html.element Js.t val of_keygen : [> Html_types.keygen ] elt -> Dom_html.element Js.t val of_main : [> Html_types.main ] elt -> Dom_html.element Js.t val of_mark : [> Html_types.mark ] elt -> Dom_html.element Js.t val of_menu : [> Html_types.menu ] elt -> Dom_html.element Js.t val of_meter : [> Html_types.meter ] elt -> Dom_html.element Js.t val of_nav : [> Html_types.nav ] elt -> Dom_html.element Js.t val of_noscript : [> Html_types.noscript ] elt -> Dom_html.element Js.t val of_output : [> Html_types.output_elt ] elt -> Dom_html.element Js.t val of_progress : [> Html_types.progress ] elt -> Dom_html.element Js.t val of_q : [> Html_types.q ] elt -> Dom_html.element Js.t val of_rp : [> Html_types.rp ] elt -> Dom_html.element Js.t val of_rt : [> Html_types.rt ] elt -> Dom_html.element Js.t val of_ruby : [> Html_types.ruby ] elt -> Dom_html.element Js.t val of_samp : [> Html_types.samp ] elt -> Dom_html.element Js.t val of_section : [> Html_types.section ] elt -> Dom_html.element Js.t val of_small : [> Html_types.small ] elt -> Dom_html.element Js.t val of_source : [> Html_types.source ] elt -> Dom_html.element Js.t val of_span : [> Html_types.span ] elt -> Dom_html.element Js.t val of_strong : [> Html_types.strong ] elt -> Dom_html.element Js.t val of_sub : [> Html_types.sub ] elt -> Dom_html.element Js.t val of_summary : [> Html_types.summary ] elt -> Dom_html.element Js.t val of_sup : [> Html_types.sup ] elt -> Dom_html.element Js.t val of_th : [> Html_types.th ] elt -> Dom_html.element Js.t val of_time : [> Html_types.time ] elt -> Dom_html.element Js.t val of_u : [> Html_types.u ] elt -> Dom_html.element Js.t val of_var : [> Html_types.var ] elt -> Dom_html.element Js.t val of_wbr : [> Html_types.wbr ] elt -> Dom_html.element Js.t end js_of_ocaml-3.5.2/lib/tyxml/tyxml_js.ml000066400000000000000000000344541357507750000201450ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Js_of_ocaml open! Import let js_string_of_float f = (Js.number_of_float f)##toString let js_string_of_int i = (Js.number_of_float (float_of_int i))##toString module type XML = Xml_sigs.T with type uri = string and type event_handler = Dom_html.event Js.t -> bool and type mouse_event_handler = Dom_html.mouseEvent Js.t -> bool and type keyboard_event_handler = Dom_html.keyboardEvent Js.t -> bool and type elt = Dom.node Js.t module Xml = struct module W = Xml_wrap.NoWrap type 'a wrap = 'a type 'a list_wrap = 'a list type uri = string let uri_of_string s = s let string_of_uri s = s type aname = string type event_handler = Dom_html.event Js.t -> bool type mouse_event_handler = Dom_html.mouseEvent Js.t -> bool type keyboard_event_handler = Dom_html.keyboardEvent Js.t -> bool type touch_event_handler = Dom_html.touchEvent Js.t -> bool type attrib_k = | Event of event_handler | MouseEvent of mouse_event_handler | KeyboardEvent of keyboard_event_handler | TouchEvent of touch_event_handler | Attr of Js.js_string Js.t option React.S.t type attrib = aname * attrib_k let attr name v = name, Attr (React.S.const (Some v)) let float_attrib name value : attrib = attr name (js_string_of_float value) let int_attrib name value = attr name (js_string_of_int value) let string_attrib name value = attr name (Js.string value) let space_sep_attrib name values = attr name (Js.string (String.concat " " values)) let comma_sep_attrib name values = attr name (Js.string (String.concat "," values)) let event_handler_attrib name (value : event_handler) = name, Event value let mouse_event_handler_attrib name (value : mouse_event_handler) = name, MouseEvent value let keyboard_event_handler_attrib name (value : keyboard_event_handler) = name, KeyboardEvent value let touch_event_handler_attrib name (value : touch_event_handler) = name, TouchEvent value let uri_attrib name value = attr name (Js.string value) let uris_attrib name values = attr name (Js.string (String.concat " " values)) (** Element *) type elt = Dom.node Js.t type ename = string let empty () = (Dom_html.document##createDocumentFragment :> Dom.node Js.t) let comment c = (Dom_html.document##createComment (Js.string c) :> Dom.node Js.t) let pcdata s = (Dom_html.document##createTextNode (Js.string s) :> Dom.node Js.t) let encodedpcdata s = (Dom_html.document##createTextNode (Js.string s) :> Dom.node Js.t) let entity = let string_fold s ~pos ~init ~f = let r = ref init in for i = pos to String.length s - 1 do let c = s.[i] in r := f !r c done; !r in let invalid_entity e = failwith (Printf.sprintf "Invalid entity %S" e) in let int_of_char = function | '0' .. '9' as x -> Some (Char.code x - Char.code '0') | 'a' .. 'f' as x -> Some (Char.code x - Char.code 'a' + 10) | 'A' .. 'F' as x -> Some (Char.code x - Char.code 'A' + 10) | _ -> None in let parse_int ~pos ~base e = string_fold e ~pos ~init:0 ~f:(fun acc x -> match int_of_char x with | Some d when d < base -> (acc * base) + d | Some _ | None -> invalid_entity e) in let is_alpha_num = function | '0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' -> true | _ -> false in fun e -> let len = String.length e in let str = if len >= 1 && Char.equal e.[0] '#' then let i = if len >= 2 && (Char.equal e.[1] 'x' || Char.equal e.[1] 'X') then parse_int ~pos:2 ~base:16 e else parse_int ~pos:1 ~base:10 e in Js.string_constr##fromCharCode i else if string_fold e ~pos:0 ~init:true ~f:(fun acc x -> (* This is not quite right according to https://www.xml.com/axml/target.html#NT-Name. but it seems to cover all html5 entities https://dev.w3.org/html5/html-author/charref *) acc && is_alpha_num x) then match e with | "quot" -> Js.string "\"" | "amp" -> Js.string "&" | "apos" -> Js.string "'" | "lt" -> Js.string "<" | "gt" -> Js.string ">" | "" -> invalid_entity e | _ -> Dom_html.decode_html_entities (Js.string ("&" ^ e ^ ";")) else invalid_entity e in (Dom_html.document##createTextNode str :> Dom.node Js.t) (* TODO: fix get_prop it only work when html attribute and dom property names correspond. find a way to get dom property name corresponding to html attribute *) let get_prop node name = if Js.Optdef.test (Js.Unsafe.get node name) then Some name else None let iter_prop_protected node name f = match get_prop node name with | Some n -> ( try f n with _ -> ()) | None -> () let attach_attribs node l = List.iter (fun (n', att) -> let n = Js.string n' in match att with | Attr a -> (* Note that once we have weak pointers working, we'll need to React.S.retain *) let (_ : unit React.S.t) = React.S.map (function | Some v -> ( ignore (node##setAttribute n v); match n' with | "style" -> node##.style##.cssText := v | _ -> iter_prop_protected node n (fun name -> Js.Unsafe.set node name v)) | None -> ( ignore (node##removeAttribute n); match n' with | "style" -> node##.style##.cssText := Js.string "" | _ -> iter_prop_protected node n (fun name -> Js.Unsafe.set node name Js.null))) a in () | Event h -> Js.Unsafe.set node n (fun ev -> Js.bool (h ev)) | MouseEvent h -> Js.Unsafe.set node n (fun ev -> Js.bool (h ev)) | KeyboardEvent h -> Js.Unsafe.set node n (fun ev -> Js.bool (h ev)) | TouchEvent h -> Js.Unsafe.set node n (fun ev -> Js.bool (h ev))) l let leaf ?(a = []) name = let e = Dom_html.document##createElement (Js.string name) in attach_attribs e a; (e :> Dom.node Js.t) let node ?(a = []) name children = let e = Dom_html.document##createElement (Js.string name) in attach_attribs e a; List.iter (fun c -> ignore (e##appendChild c)) children; (e :> Dom.node Js.t) let cdata s = pcdata s let cdata_script s = cdata s let cdata_style s = cdata s end module Xml_Svg = struct include Xml let leaf ?(a = []) name = let e = Dom_html.document##createElementNS Dom_svg.xmlns (Js.string name) in attach_attribs e a; (e :> Dom.node Js.t) let node ?(a = []) name children = let e = Dom_html.document##createElementNS Dom_svg.xmlns (Js.string name) in attach_attribs e a; List.iter (fun c -> ignore (e##appendChild c)) children; (e :> Dom.node Js.t) end module Svg = Svg_f.Make (Xml_Svg) module Html = Html_f.Make (Xml) (Svg) module Html5 = Html module To_dom = Tyxml_cast.MakeTo (struct type 'a elt = 'a Html.elt let elt = Html.toelt end) module Of_dom = Tyxml_cast.MakeOf (struct type 'a elt = 'a Html.elt let elt = Html.tot end) module Register = struct let removeChildren (node : #Dom.element Js.t) = let l = node##.childNodes in for i = 0 to l##.length - 1 do Js.Opt.iter (l##item i) (fun x -> ignore (node##removeChild x)) done let add_to ?(keep = true) node content = if not keep then removeChildren node; List.iter (fun x -> Dom.appendChild node (To_dom.of_element x)) content let id ?keep id content = let node = Dom_html.getElementById id in add_to ?keep node content let body ?keep content = add_to ?keep Dom_html.document##.body content let head ?keep content = add_to ?keep Dom_html.document##.head content let html ?head body = (match head with | Some h -> Dom_html.document##.head := To_dom.of_head h | None -> ()); Dom_html.document##.body := To_dom.of_body body; () end module Wrap = struct type 'a t = 'a React.signal type 'a tlist = 'a ReactiveData.RList.t type ('a, 'b) ft = 'a -> 'b let return = React.S.const let fmap f = React.S.map f let nil () = ReactiveData.RList.empty let singleton = ReactiveData.RList.singleton_s let cons x xs = ReactiveData.RList.concat (singleton x) xs let map f = ReactiveData.RList.map f let append x y = ReactiveData.RList.concat x y end module Util = struct open ReactiveData open RList let insertAt dom i x = let nodes = dom##.childNodes in assert (i <= nodes##.length); if i = nodes##.length then ignore (dom##appendChild (x :> Dom.node Js.t)) else ignore (dom##insertBefore x (nodes##item i)) let merge_one_patch (dom : Dom.node Js.t) (p : Dom.node Js.t p) = match p with | I (i, x) -> let i = if i < 0 then dom##.childNodes##.length + 1 + i else i in insertAt dom i x | R i -> let i = if i < 0 then dom##.childNodes##.length + i else i in let nodes = dom##.childNodes in assert (i >= 0 && i < nodes##.length); Js.Opt.iter (nodes##item i) (fun n -> Dom.removeChild dom n) | U (i, x) -> ( let i = if i < 0 then dom##.childNodes##.length + i else i in match Js.Opt.to_option (dom##.childNodes##item i) with | Some old -> ignore (dom##replaceChild x old) | _ -> assert false) | X (i, move) -> ( let i = if i < 0 then dom##.childNodes##.length + i else i in if move = 0 then () else match Js.Opt.to_option (dom##.childNodes##item i) with | Some i' -> insertAt dom (i + if move > 0 then move + 1 else move) i' | _ -> assert false) let rec removeChildren dom = match Js.Opt.to_option dom##.lastChild with | None -> () | Some c -> ignore (dom##removeChild c); removeChildren dom let merge_msg (dom : Dom.node Js.t) (msg : Dom.node Js.t msg) = match msg with | Set l -> (* Format.eprintf "replace all@."; *) removeChildren dom; List.iter (fun l -> ignore (dom##appendChild l)) l | Patch p -> (* Format.eprintf "patch@."; *) List.iter (merge_one_patch dom) p let update_children (dom : Dom.node Js.t) (nodes : Dom.node Js.t t) = removeChildren dom; (* Note that once we have weak pointers working, we'll need to React.S.retain *) let _s : unit React.S.t = fold (fun () msg -> merge_msg dom msg) nodes () in () end module R = struct let filter_attrib (name, a) on = match a with | Xml.Event _ | Xml.MouseEvent _ | Xml.KeyboardEvent _ | Xml.TouchEvent _ -> raise (Invalid_argument "filter_attrib not implemented for event handler") | Xml.Attr a -> name, Xml.Attr (React.S.l2 (fun on a -> if on then a else None) on a) let attach_attribs = Xml.attach_attribs module Xml = struct module W = Wrap type 'a wrap = 'a W.t type 'a list_wrap = 'a W.tlist type uri = Xml.uri let string_of_uri = Xml.string_of_uri let uri_of_string = Xml.uri_of_string type aname = Xml.aname type event_handler = Xml.event_handler type mouse_event_handler = Xml.mouse_event_handler type keyboard_event_handler = Xml.keyboard_event_handler type touch_event_handler = Xml.touch_event_handler type attrib = Xml.attrib let attr name f s = let a = W.fmap f s in name, Xml.Attr a let float_attrib name s = attr name (fun f -> Some (js_string_of_float f)) s let int_attrib name s = attr name (fun f -> Some (js_string_of_int f)) s let string_attrib name s = attr name (fun f -> Some (Js.string f)) s let space_sep_attrib name s = attr name (fun f -> Some (Js.string (String.concat " " f))) s let comma_sep_attrib name s = attr name (fun f -> Some (Js.string (String.concat "," f))) s let event_handler_attrib name s = Xml.event_handler_attrib name s let mouse_event_handler_attrib name s = Xml.mouse_event_handler_attrib name s let keyboard_event_handler_attrib name s = Xml.keyboard_event_handler_attrib name s let touch_event_handler_attrib name s = Xml.touch_event_handler_attrib name s let uri_attrib name s = attr name (fun f -> Some (Js.string f)) s let uris_attrib name s = attr name (fun f -> Some (Js.string (String.concat " " f))) s type elt = Xml.elt type ename = Xml.ename let empty = Xml.empty let comment = Xml.comment let pcdata s = let e = Dom_html.document##createTextNode (Js.string "") in let _ = React.S.map (fun s -> e##.data := Js.string s) s in (e :> Dom.node Js.t) let encodedpcdata s = pcdata s let entity s = Xml.entity s let leaf = Xml.leaf let node ?(a = []) name l = let e = Dom_html.document##createElement (Js.string name) in attach_attribs e a; Util.update_children (e :> Dom.node Js.t) l; (e :> Dom.node Js.t) let cdata = Xml.cdata let cdata_script = Xml.cdata_script let cdata_style = Xml.cdata_style end module Xml_Svg = struct include Xml let leaf = Xml_Svg.leaf let node ?(a = []) name l = let e = Dom_html.document##createElementNS Dom_svg.xmlns (Js.string name) in attach_attribs e a; Util.update_children (e :> Dom.node Js.t) l; (e :> Dom.node Js.t) end module Svg = Svg_f.Make (Xml_Svg) module Html = Html_f.Make (Xml) (Svg) module Html5 = Html end js_of_ocaml-3.5.2/lib/tyxml/tyxml_js.mli000066400000000000000000000103561357507750000203110ustar00rootroot00000000000000(* Js_of_ocaml library * http://www.ocsigen.org/js_of_ocaml/ * Copyright (C) 2014 Hugo Heuzard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (** Tyxml interface. Example of use for HTML: {[ module T = Tyxml_js.Html let html = T.( div ~a:[a_class ["several"; "css"; "class"]; a_id "id-of-div"] [ ul ~a:[a_class ["one-css-class"]; a_id "id-of-ul"] [ li [ a ~a:[a_id "id-of-a"; a_href "/url/file.html"] [ pcdata "Go to /url/file.html" ] ] ] ] ) ]} @see the Tyxml project website. @see Html_sigs.T to have a list of available functions to build HTML. *) open Js_of_ocaml module type XML = Xml_sigs.T with type uri = string and type event_handler = Dom_html.event Js.t -> bool and type mouse_event_handler = Dom_html.mouseEvent Js.t -> bool and type keyboard_event_handler = Dom_html.keyboardEvent Js.t -> bool and type elt = Dom.node Js.t module Xml : XML with module W = Xml_wrap.NoWrap module Svg : Svg_sigs.Make(Xml).T with module Xml.W = Xml_wrap.NoWrap module Html : Html_sigs.Make(Xml)(Svg).T with module Xml.W = Xml_wrap.NoWrap (** @deprecated Use {!Tyxml_js.Html}. *) module Html5 : Html_sigs.Make(Xml)(Svg).T with module Xml.W = Xml_wrap.NoWrap and type 'a elt = 'a Html.elt and type +'a attrib = 'a Html.attrib module Register : sig val html : ?head:Html_types.head Html.elt -> Html_types.body Html.elt -> unit (** [Register.html head body] uses the given head and body elements as document. It replaces the previous body and head. [head] and [body] can be reactive. *) val body : ?keep:bool -> [< Html_types.body_content ] Html.elt list -> unit (** [Register.body elements] add [elements] as children of [body]. If [keep] is false (default is true), the children of the body are removed before adding the new elements. *) val head : ?keep:bool -> [< Html_types.head_content ] Html.elt list -> unit (** [Register.head elements] add [elements] as children of [body]. If [keep] is false (default is true), the children of the head are removed before adding the new elements. *) val id : ?keep:bool -> string -> 'a Html.elt list -> unit (** [Register.id "some_id" elements] add [elements] as children of the node with the id ["some_id"]. If [keep] is false (default is true), the children of the node are removed before adding the new elements. Beware, this function ignores tyxml's type information. *) end module Wrap : Xml_wrap.T with type 'a t = 'a React.signal and type 'a tlist = 'a ReactiveData.RList.t and type ('a, 'b) ft = 'a -> 'b module Util : sig val update_children : Dom.node Js.t -> Dom.node Js.t ReactiveData.RList.t -> unit end module R : sig module Xml : XML with module W = Wrap module Svg : Svg_sigs.Make(Xml).T with type +'a elt = 'a Svg.elt and type +'a attrib = 'a Svg.attrib module Html : Html_sigs.Make(Xml)(Svg).T with type +'a elt = 'a Html.elt and type +'a attrib = 'a Html.attrib val filter_attrib : 'a Html.attrib -> bool React.signal -> 'a Html.attrib (** @deprecated Use {!Tyxml_js.R.Html}. *) module Html5 : Html_sigs.Make(Xml)(Svg).T with type +'a elt = 'a Html.elt and type +'a attrib = 'a Html.attrib end module To_dom : Tyxml_cast_sigs.TO with type 'a elt = 'a Html.elt module Of_dom : Tyxml_cast_sigs.OF with type 'a elt = 'a Html.elt js_of_ocaml-3.5.2/manual/000077500000000000000000000000001357507750000152625ustar00rootroot00000000000000js_of_ocaml-3.5.2/manual/bindings.wiki000066400000000000000000000127571357507750000177600ustar00rootroot00000000000000= How to bind a JS library for OCaml ==Accessing a JS variable, ex: {{{document}}}: Write in .ml: <> Alternatively, the global object can be used. In the browser, it refers to {{{window}}}. <> and in .mli: <> Be careful the function [[../api/js_of_ocaml/Js_of_ocaml/Js/Unsafe/index.html#val-js_expr|Js.Unsafe.js_expr]] and the value [[../api/js_of_ocaml/Js_of_ocaml/Js/Unsafe/index.html#val-global|Js.Unsafe.global]] are not typed. Verify the library documentation before writing the type. ==Binding a JS function Example from the Js module: <> Have a look at the [[../api/js_of_ocaml/Js_of_ocaml/Js/Unsafe/index.html|Js.Unsafe]] module API. ==Using a JS constructor, ex: {{{F}}}: Write in .ml: <> and in .mli: < ... Js.t) Js.constr >> and if you want to use JS overloading, do, for example: < ... Js.t) Js.constr val f_fromString : (js_string t -> ... Js.t) Js.constr val f_blah : (#Dom_html.element t -> js_string t -> ... Js.t) Js.constr >> ==Accessing or modifying a JS property to an element When a property is missing in the OCaml interface of an element (for example it has been dynamically added by a library), you can access using unsafe features: <> If you want to add yourself a new property: <> Here, {{{v}}} may be a JS value or an OCaml value. If you want to do that in type safe manner, just define new types for the extended elements, or wrap the unsafe functions inside a getter and setter. == Binding a JS object == Write in .ml and in .mli: < unit meth method my_fun_string : js_string t -> unit meth (* Both will actually call the my_fun JavaScript method. *) (* To call a javascript method starting with one underscore *) method __hiddenfun : .. method __hiddenfun_ : .. method __hiddenfun_something : .. (* This will call the _hiddenfun Javascript method *) (* To call the javascript method '_' *) method __ : .. end >> ===Example binding some constants: For example if the JS class is used to define three constants {{{thelib.Theclass.VALUEA}}}, {{{thelib.Theclass.VALUEB}}}, {{{thelib.Theclass.VALUEC}}}, Since ocaml doesn't allows method name to start with capitalised letter, we can add an {{{_}}} write in .ml and .mli: <> and in .ml: <> and in .mli: <> ==Constructing JS objects manually If you want to construct a JS object manually (without calling a function or a constructor), you can use the <> syntax extension. For example: <> You can also use the unsafe [[../api/js_of_ocaml/Js_of_ocaml/Js/Unsafe/index.html#val-obj|Js.Unsafe.obj]]. == Set/get variables You can access every variable through the global javascript object ({{{window}}}): If the variable {{{var}}} has type {{{t Js.t}}} <> == Object property with multiple types If you want to read a property of an object which can have multiple types, you can define an intermediate type to do typesafe casting ex: Suppose the object {{{obj}}} has a property {{{prop}}} which can be either a string or a Dom node: <> == Check availability of method It is frequent that some method are not to be implemented in some browser. To check the presence of method {{{met}}}: <> js_of_ocaml-3.5.2/manual/camlp4.wiki000066400000000000000000000030001357507750000173200ustar00rootroot00000000000000= Camlp4 syntax extension for Js_of_ocaml WARNING: The Camlp4 syntax extension is not longer part of the js_of_ocaml distribution. A Camlp4 syntax extension is available for manipulating object properties, invoking methods and creating objects. We advise to use the <> syntax extension instead. The syntax and typing rules are as follows: * Getting a property {{{ obj : Js.t ----------------------- obj##m : u }}} * Setting a property {{{ obj : Js.t e : u ----------------------- obj##m <- e : unit }}} * Invoking a method {{{ obj : ... -> t_n -> u meth; ..> Js.t e_i : t_i (1 <= i <= n) ------------------------------------------------- obj##m(e_1, ..., e_n) : u }}} * Using an object constructor {{{ constr : (t_1 -> ... -> t_n -> u Js.t) Js.constr e_i : t_i (1 <= i <= n) ------------------------------------------------ jsnew constr (e1, ..., en) : u Js.t }}} * Creating a literal object <> Properties are defined with the [val] keyword. [mutable] makes the property writable. [self] can be any identifier and will be bind to [this] in javascript. In this case, the object has the following type: < unit Js.meth; x : int Js.readonly_prop; y : int Js.prop > Js.t >> js_of_ocaml-3.5.2/manual/contribute.wiki000066400000000000000000000025571357507750000203360ustar00rootroot00000000000000= Contributing to Js_of_ocaml == Reporting Issues If you encounter a problem when using js_of_ocaml or if you have any questions, please open a [[https://github.com/ocsigen/js_of_ocaml/issues/|GitHub issue]]. 1. Check first if your issue has already been [[https://github.com/ocsigen/js_of_ocaml/issues/|reported]]. 2. Include the version of ocaml and js_of_ocaml you are using ({{{ocamlc -version}}}, {{{js_of_ocaml --version}}}). 3. Describe the expected and actual behavior. 4. Do not unsubscribe from the issue until it is closed, the maintainers may ask for your feedback. == Pull Requests We actively welcome pull requests. 1. Prior to investing a large amount of time into significant or invasive changes, it is likely more efficient to first open an issue for discussion and planning. 2. Install all dependencies (see Install dependencies) 3. Fork the repository and create your branch from {{{master}}}. 4. If you have added code that should be tested, add tests. 5. Ensure tests still pass (see Running the tests). === Install dependencies {{{ opam install --deps-only js_of_ocaml js_of_ocaml-lwt js_of_ocaml-compiler js_of_ocaml-ocamlbuild js_of_ocaml-toplevel js_of_ocaml-ppx js_of_ocaml-ppx_deriving_json js_of_ocaml-tyxml opam install lwt reactiveData tyxml ppxlib cohttp-lwt-unix menhir ppx_expect yojson sexplib }}} === Running the tests Just run {{{make tests}}}. js_of_ocaml-3.5.2/manual/debug.wiki000066400000000000000000000025141357507750000172370ustar00rootroot00000000000000= How to debug an OCaml program compiled to JavaScript. == Use the right compiler flags === OCaml flags Make sure to use "-g" flags when compiling and linking ocaml bytecode. Js_of_ocaml will attempt to preserve variable names. === Js_of_ocaml flags * [--pretty] - format the generated JavaScript in a readable way and try to keep OCaml variable names. * [--no-inline] - prevent function inlining. * [--debug-info] - annotate the JavaScript file with locations from the OCaml sources. * [--source-map] - enable source-map support == Breakpoint One can set breakpoints using developers tools (see https://developer.chrome.com/devtools/docs/javascript-debugging). Alternatively, one can set breakpoints programmatically by calling {{{Js.debugger ()}}}. Note that browsers will only stop at breakpoints when developers tools are in use. == Source map Source map is used to map the generated JavaScript code to original sources. After compiling with sourcemap enabled, using developers tools, one can set breakpoints, step through the code, and inspect variable directly in OCaml sources. == About Chrome DevTools Useful setting Chrome DevTools: * Display variable values inline while debugging * Resolve variable names (hidden DevTools Experiments, see http://islegend.com/development/how-to-enable-devtools-experiments-within-google-chrome) js_of_ocaml-3.5.2/manual/dune000066400000000000000000000020771357507750000161460ustar00rootroot00000000000000(alias (name ocsigen-doc) (deps (alias_rec ../examples/default) (alias ../toplevel/examples/lwt_toplevel/default) (source_tree ../examples) (source_tree ../toplevel/examples/lwt_toplevel) (glob_files *wiki) (source_tree files) ) (action (bash "function copy { \ src=$1; shift; \ dst=$1; shift; \ mkdir -p files/$dst; \ cp -R ${@/#/$src/} files/$dst; \ }; \ copy ../toplevel/examples/lwt_toplevel toplevel index.html toplevel.js test_dynlink.js; \ copy ../examples/boulderdash boulderdash index.html boulderdash.js sprites; \ copy ../examples/webgl webgl index.html webgldemo.js; \ copy ../examples/graph_viewer graph_viewer index.html viewer_js.js; \ copy ../examples/planet planet index.html texture.jpg planet.js; \ copy ../examples/wiki wiki index.html main.js; \ copy ../examples/wysiwyg wysiwyg index.html main.js; \ copy ../examples/hyperbolic hyperbolic index.html hypertree.js icons thumbnails; \ copy ../examples/minesweeper minesweeper index.html main.js sprites; \ copy ../examples/cubes cubes index.html cubes.js; \ ")))js_of_ocaml-3.5.2/manual/files/000077500000000000000000000000001357507750000163645ustar00rootroot00000000000000js_of_ocaml-3.5.2/manual/files/performances/000077500000000000000000000000001357507750000210505ustar00rootroot00000000000000js_of_ocaml-3.5.2/manual/files/performances/perf.png000066400000000000000000001242141357507750000225160ustar00rootroot00000000000000PNG  IHDR8/q sBIT|d pHYsnu>tEXtSoftwarewww.inkscape.org< IDATxw\ C"8ֺ:*VպڢhTԺ+=lu 2 A|<|<ޗ>?#̝;ʏ%%GU9sH,,,$oVu* XXXH.]Zn\^^A)]VTT$YluSSS$00P_iȑ#%̘+WJ,,,$Ǐ.ҥU&.++KUeU7 СCUJ+wl߾͛K,,,$_|EաCIfͪ8 *?V޽1y*?QUAjj*D"S\>} 6o>$&&gϞeÆ ÷~ 90w\tU7dee!55AAA~z1yyyHMMEaatӧO&hР:T9U%233UJ+wKMMˌx"]!==]Gԕz_Q$:JQ3Xh:۷! UJ&akNikiѝUgĉGDUQj7M :99]v8}4n޼&MqFB1pUرp4nرcoߎCP u7JiT ;ivEEE_MMMgΜX߽lff&RSSTIn܀$=^ UgQرcΆ;w,`. *p!!!_>,,,ʍOJJƒP^=XZZ;wŋptt1```@"%%nnnPWmC$%%&&&:B#++ 4\Lvv6455,ZZZDl DVVjժZjU(,l?4*[8phhhe_s"PWWG ʌ}`ll ʬ˃D"qM^#@FACCB#qMD"8;;C__Bۑ<<< xyyݻҸ;v'N@akk-Z@jj*Zj[[[iظqYv-lll oooԮ]:uBrrL N &&&ׯP466F||<ܹccc̜9^mɞ={c [F͡ӧ4^wcccl͚5C:ue}666h׮4iCCCL6Mg}N:a׮]011AfPn]4iؿ?LLLмys $ưa`ffwwwh666 >H!vD"~˖-5jtYV'O͚5ŒToѢES~g\zUa|vP~} Xd qy|(֭ {n|N>ǏcW^E֭aoovڡ^z燦M󰲲B ТE cժU066ܹs HyA__nnnΝ+v+++x{{NNNҥ TqƗ_~ KKK>|7n+p xzz?>f͚''':u /_СCyf777.__~݋ŋ4i\#:`hhh`ذa 믿B ``io8;;رcAHHgϞoذ?#̟?655ɓ'akk {{{>>pvvΝ;qu,_Xh/s۷ocȑ֭[ر#0|p;v ~~~E```ӧOlݺÇǵkp!4n'O.'"4hqY6m%>Fa8pƌ#G`ƌ E֭+ׯH$̏ Ez-}4d>[FFF4~C`` <==qyDEEÇ!00&Mmۆ7n`ƌXxkf͚CCCL2}􁍍t]Zлwoi7WܹvvvRRRЭ[7$$$`Æ y&|'8rL'OЫW/t֭[mmm7wD"رcn:|wXdt݄ 6m`Ϟ=~:1{lL8`dd\v #۪/22)))eH???ɓ0224ifff8p fΜC,c…prrѣG]H_aX|9.]l|wo-Z@^p?^. b׮] ٳ'n߾ 6}8x4Epp0O^q'N6jڴ)_c޼y nSXXoiii?> ={CсP(D*ŧصk|}}/H{yy!33SZ\k۶-<gٳlق;bϞ=æMpww9Gz/kCطobbb}tCʕ+eŋqI5JbYfpqqAÆ iӦ2U֬Ym۶]v.]B\\f̘!xYt~ ֭[uɮSAڵ+ƌkbΜ9?~F˖-_rR`'??W^E:uی38z(7n hܸ16l͛o)۳g&uE=pyia„ Dرcڷou`ff.]`_͚5CxxѲeKVW Μ9#kҤ RSScǢM~jhhٳ Md!<<~~~v+}Ǐsݲ]]]ggg|7st|̚5KP(9"x7|5k ((HZLL ֮] WWW˖-Crr2V^ 4n#F۱uVϼ͛7CKK  b w"%%7J 08qa :TT("** ENϞ=˗aiiϟѹsg%ō%UؒDǎ+nʔ) }^{zzɓ'%֬YgϞI.^%K^u&oMMM4o[[2rtttģG%jѢ6mݻw<.i'///};v\!РA m۶e7LLLdDFF"##CEEEYZ(akkݻw̺W[VH$?~~8b1&L Q\\ӧOx[۷ovk}ߏ> &&&,pPׯ$I)XHDhh(|||P^=m۶//?H155YhDG(o;o`Mz{彿^w2 K>mLL &O:/ׯ555AE׋mEKyCfflaa!v܉]K+V˗믿bÆ ٳ'.]ׯѣG2s> +7ۨWCaaaΐH$HHHxcBll,OΝ; vvv2d޽ D HIIƔxZu]r|wrҥ KWihhGΝ;RU~xiyX[[]2K+jÆ 󃞞ߢm۶AD_^+4ѻ/1}tlݺ9~wdff .Z055E~dשSݺuf tcƌ5kXlpo*rHT]#33Sz(zakxx8Zj cǎ7ի'''@NE9bo\N~g̘!W(C֊0`֯_ؿ?NZjlIoz,jjjX|9ٳg̚V̝;k.u...żyuVk7o2 T!%xɓWb￰@ &%%ٳN”)Sxbx]Ɉ$Xdݾ}ݨpܿ2'OFڵ1c L2vLkG¬IJJk1w\c*މ z 77[n\x9q%PXX(!ѣXxqkoouuRueD$R)I&A__2 . jjjԄn޼ sssBi7o}(i5ѰaCHsssq޽2 ر#ͱ{n"'')ڰKjSo k.,Z}A֭4kLKff&?~,888Hǖ ٳg1ei]TB۷ɓ'2mۆT|^9̰eD"i\qq1f̘uDEY2Fʊnnn@XXt k֬A~~|J={Vn˗?zzz@1..]*\"H,yĖQ̙3 ELL RSS;;;HD"J*>wڵ_!** ~~~(((;!Cȍ[ƽ{}rKӨ[.,--6IݻWa|I"ԩΝ;'7%+Wpc) e %6jb`nn.JbFtttжm[DFFuM@ӦMŌ;^zXz5ӥq2/ҥKe~7ѤI)e+J(o߾8vТE2/G,OJJ޽{$ӊmc^()u-kƍL&#GDzz: eƉc*DCCA6mc={ѣѼysH7oѹsg>>>\*..\'Owƙ3g?`h۶-f͚%X,-[ԩS7nt -ZHlmm']aԩ|||CűcpǏGPPjݿxyyaSӂ`̙3^ ܸqƐ!Cp*VY7n?O^}a)<, =ztq!!!'|ŋ#** AAAbի6QЩSR, wٳ|r["44޽;֮](Yݺu\HJZw ڵkK+tuuѲeKcƌƱc0rHoԔZt)йsg,_gΜApp0FMMM,XM˖-Cvv6<<<ٳgYfيJ*;88`ʔ)F۶mgDDD`ܸqظq#\]]K*"/^/FFhh(Ν;M6صk[͛cɸ}6~/<=OF׮]q:t#F)-o߾000͛ѪU+4lP]T*@C{:O\?sDFFb)!'`ڵ2CGG'O6ܹsiӦ!>>7n@J$-- _}O 02NWallI&I]6 5kok߾=\\\0rHD"Ü9sd&Ncٲeg}V%WGB_\-7ܱc~'JPoР.\ӧKpQL0/… |pa4m{n 2s9sS%2dPPPPʰm6ԩS+WڵklgtԩJ UgQ3@ `Ĉ3gZh77R㜜p93FO#>ݻuTA B<G"118uuu`ɒ%;w.ЫW25j+WcǎX,>#XB%@h-oxN#F@BB-Z$jР~֭[1x`#88;w͛71qD8q044Dfpecĉ7oooo~{SN!((V1[[[?zzzuA``@ _|KްFJJ Xn%_ӦMCqq1ЪU+Kg AAAػw/,Yxyyaʕ_>ϟ޽{x95l0ʍbݺuEKIlGTLYaͅSdee!99<0JOOGfffMB!:wcǎ!??>,s۷OL"]cHIIKMM!""[pB/q-XXXȬ;D~޽x9ڵkZja駟ׯ_Zj]vJϝjvQ!""*o߾;v,~W4o8wCCCѣG\t o֭[ajj3!""NM"HTW^exϟKIQQ 333i˗:VZ2IMMŹs  ++?)"""X """"""cpQA믿ݻN^3`vdc̙HOOWuDDDDDDDT 8ނ@^:DDDUI[OBPa(+!#"""b;mA8ڷoSN: ""HIU } %dDDDDՑP(|"/Qx,pQx,pQx5j@\|u?3ݕU5e<~FFFrrssU)X C oTqBDDDDTԘGVVݻqaŊNTE$8,BjPcPcxxx8"""""""njL#::G^^nݺgϞ8+"""""""jTCMM -4i###tNTƌ DXشi>#Ɩ:hy p=quỷ>LHOOWʱjLc޽;fϞZj ggg̚5 ?#-ZFt"++&""""""PcĈJ9V)p|ҤIq9%gDDDDDDDDE)pE[[FFFHKK{mw^qA(Q666o}QDŽ yɬ@ff&ZlԄeeIDDDDDDDֆRU#&ԩSgΜ… q}uK._Q5P# QTTO>k֬ٳg1a裏4HEjD8q"B!_tuuPBgHDDDDDDDRc 0~x?^iQ5S#"""""""X """"""Ǟ={0yd|g8{,?~+V //O)$7'OЧODEEI 6 "ǏGXX;ڵk+5Q"""""""ȵ5j\ɓ'ѣ9r$1k,&IDDDDDDDT 8x V\cӧu H$¶m۰vZ)=a"""""""ɴqǧ z|TmfDDDDDDDD$S\~ 222͌d PWWիQ\\,3,Y5Ғ$"""""""*fff D`` 0p@@tt4l2ܿRIDDDDDDDD&v̙DFHHয়~cٳr$"""""""*\C("((GŋPm۶{G [[[OR nR7Ƙ1c41"""""""+pL:/.w#SSS8F:X0NС ( jBŋ ӦM54446*mQMPr%PT0N hj*!# 27o6n܈6mڨ$71o<`ʕNTH P%ɼݻw#00Tu*DDDDDDDb2&MVRU>CBDDDDDDDR2]T͛uh׮LMM6 $ sss&7Jhh(˗/ 8}4Ο?#F ;;[%yQ!SHIIO?ggg5 ͚5+uuuRܸq3g-[$"""""""~d*.\?WIBe)((!CYf:""""""zG]Ǝ Fiݕd2 ULyp]DGGWZ 7n{ ^)$"""""f q9JȆBdd$/^\XDNǒ4j-[Ă jzWH,_+WD+mPghhXi$""""""P<|B+L#''_}&LwwwhvvvҒHGGӧOWJ0e8}tQTTsyWa\u)$={vbΝN8d =z4 ..qqqndjj:tttpQ幹H$8z[ͦRn7.QŸݽb̛7 ҁFS*Uڵk.wuuEvv6߿|z)phkkSUSNA(m۶˗n6m(!="""""""";v]]]"11;vT)ӕ^~7: """""""R1 @SS`aa (HGG󪐖-[:"""""""տKSXXwVu^DDDDDDDD&3 WWWܼyn0uT[ϟ?@ PJDDT=}ÑǏcܹ`mm-CCCKESѣGNU عsr!"""""""z+j<8cj<8cj<#!!Ϟ=H$[*O" 'O/UQE81h NNN֖HGGGi Q)k\ 8^T,Y&MRUNDDDDDT&"x)q>зPBFDDDDDD!ShԨ TK444$ӧt4iL( 77+1n86lؠ⌈HK[x}x!}AHHtuuƏ8H$+@^DDDDDDD*;w*SW`*I!99׮]PD"yc8\;"77 4@׮]QPPx^7oÇN~ΝD"ƍpB2sT>}(344DVVۦKDDDDDD|EEݫ8NC 'N#d߯)pD" 6 ?о}{bo0uT]V) dөSG@@GCC&&& *O""""""6,,*6Aj #S={7#!!{+Rd(,,r___ "" }N:UYQ` o},Gll,7^զM,Z033{XSNYWuJ)Qp5*2y񀽉2""""""U)p @^---W}vaÆS?K.u^v9s&o߾JˇT/ 9=/zlHd 022ĉqQ X`<==! Mйsgt}Aƍq_>|8 DDT<~yy ˈrc4 ^d ;w.&LGGG(,,Dll,!Hl2'ڮ];\~?Μ9#Gqؼy3|Ẽ$>MT׽Qw8:(!#"""Isӑ>5 EJʦz&v񰶶رczju_榴_}DDDDDDDT}8YIII&`gg555eHDDDDDDDTR  6%""""""M}Μ9̙3\RF:::>}zgGDDDDgHy0LfJȈrAWW3gDZZndjjQ kX~Qaܷ1q2"""\.\N .(HCC"R:c@a8ZZJȈ*JSD"AAAZl ]]R7q.]eHہY7 DDDDDDՌ?ѱcG$&&uÚO/#GtҥKaff&]vvPW/s""""""""Rwuu_|<°7PWGpp2r#"""""""u;;;ܾ}ǧ~~2jjj0449A#"""""""R>uXXX`hӦ LLLTQQ\⊴rVWpڴχ$31U QT\ ɥK44>"L:u믿VYRDDDDDDDDoB]v!4)"""""""7!Shذ!233͛7WZDDDDDDDD8䂌`mmvڡo߾:t($Qyx׏??^1u! PTTmmȩL"۶måK'''-ZPjDDDDDDDT8 pm XL;wVBÆ a``$ӧh۶-bccGGGٳ!!!7ofΜ|>T!S'0UBFDD8ЬYr7ĪU4Ҍ; ?Gǎ>4k׀,Ł/^ADJ#S077ٳK ҂>s+%8x 1yd/iذ!f̘!C,pD xH:""d kƜ9sEEEА{,--v"XF:u2"-3WaMQ-L =0o&X42"""eV`ҤI?q3f "" .R/aaaOOOetj"@"QY{M1dݻM6X,ѣG1j(B*;W9'v܉MbРAN^#>Wmj "w"S޽{1at?~<СC̙3GC_~Ulͷ߸qݻwWIŋW(VR)pܺu bc]o011y={`РA011ADD6mVDDD8CC÷?\=TW-*!#xa~wW V-&*æM;;;DFFegg+~c팈?o*۹{UhҤ f̘Qwj!Shݺ5tuu1|lذA.ŋXr%:.]ɓ' ;?s%eGDDDDDDDGbCBB*Cb͚5_sp]GeL4 :tzE%44baaa|:333]}UZ)S@(O?Ş={b֭:(5AqH8iPQBFDDDDDDD jڵktRڵkH$prrJ Ǔ'OSL)5_~,pT!wOq܋U QY % OOOeSnݺɓƘ+)"""""POX8ҥU )RfcϞ=B||ct˩]F 6`֬YXnғ%"""zh߹ |qjj)!#""Obʕ;v,>}*]g``0D"l۶ k׮&""",6FLq+fkj>Ǎ7>>>enУGl޼)))숈$p^9{ޤji4g""6myyyҥKEaa)^;H ?"tfa0rp( oo߾Iw!BA!!!Tn]`aaHӐZ6;D#~;̎ =),`0̛ qp<DThQj߾Z--\Fe1#=K^N!},`0 0 0 ٳgN+W: qu֍ݻaވ'nҔ͎yee3 X0 0 0L~B&WWWر#ߟ,X@NNNDDl25jsaaaNM%^kv\G)F* c7H… ӥK|ri4gڻw/)S֬YCk׶ 0 0 0pJH2;[nT,b=W`Aڲe [ B 4 "ѣGӔ)SČ];D/͎\c,aaa;En`zz:]zRSSI&ԽOZ8 ГN3aaa_28=J}[nQiմvZ1cUPfϞM  0 0 0΋;ino 0L u5lؐ߿O3gΤ#GPɒ%iʔ)t1AQVe^'ORFFMaaaI/g2}!PJ?3URE2VZE#F۷[HSDDDܹsTdIk0 0 0 XfXHtYrvv69ՕVXA}Eˎ˗ܹsj0 0 0 c[컺/G7_Ģ G M[:!!8]F;=31A/st2R$,eMR:cZu-<;OHyj~M6CifǍlAT/h a^)M{9x>`~MA9Vؿ8 fܔS<8n "A}IMڼ7&8r"{PTTŊ&}n {c<>-ޘ<N]>jq(-pY0 0 0 0 DDwޥwrIw[0 0 0 0 C'NxT<0 듳Maaaa(¬m[1l06l`aaa`Qaaaavp0 0 0 0 caaaaGimaA7u*QZq ,`0 0 Xvp0 p*Qj:]0 0 0KTaaa{0 0 0 0aaaa`H+W=deX"aaaw x2g55aaa&aaaa2մhqal4=Hdvlaa&9y)iv\Ig{^`ݧ3f}=,` `+rSqA(1 0 0L.pi2>kvܝ'y_`0 0 0 frY} 0 H8x&cv\/(0 'f72,` ?X Eݏ7;ɫ4 X0b|t:}qm\%'/N$ 9asa"<-` ?+:u*޽RSSv4d[Mcr@\RF&)-:PbtN?+^&i[fǽztxB4^q{*aaa؍#995jD/^N:?m߾>#ڶmh&2{ɣ9?0 0 0 b7-ZD.\UV/B}:uiРAm"0 0 0 0Vn28֬YC>>>ԭ[7񘯯/ 0"""hԲeK+Z0 0 cy3b4%h=U:?_iB:]I0;E0aϟӝ;wSNRI [hAtIvp06ZtqK0FSbkētN0ww :OiY:&ҡ'fݏ} -]U>{}gyBa7'C k -W9v>efldLJ<1cKqAm8zWϟ[&Htɉs?O6;.o'24:yncND!9]l~a쇳w_Ҷ͎{Ͷ]882ׂ3/t2 ü 1q)f=M5 4L0 0 m9>LM4ӧӸq$t:)JjԨ>|8GKqqo(L GwtZ-iuӣݔZrR"59f(WZ-iN$3;(N!smM ԜEgswnҐ.9}sz_SI17g&{c~ 25WkF:i2r?73H#uF)}}4}ֱ+ǫW r}ӧO'N/P(Td?c?5kЋ// ZۤRSSiҥ4`k<+eWƞٴiT*9s&uܙ֭[gm۷͞=j֬I;v ,'9 _5NzԫWu=Kx{{^9y`[ۜ<… P(mNx{{CTl2NÒ%Kʕ+cܹjVݸx" ( ^o&SըX"T*>|hE+sHd2gbccŋ#55)׮]RDJ>}%Kb׮]6E=e6%8s N< ZmmsNH9s:.]#d2q}kg2 D'NX$4i$zXrH hm6*RiϞ=4rHj׮M,\tB&M?r9-[4_QVS ̗(Oƍ@AAAv҅ݻG]tsQFF滈;5hЀVXADD=P RnH.SFFm߾Zf8Q &"XR .\Z0jݺ5mذ\]] oߞ>|H[nB… [۴ﱲ卸|2*Tyƌ(T:u@.vf7oΕ+Wh;BCC!PlYXۼ\ѣo`(]45j@\\Ul"^/J, "G}$kj D+Ve˖(_<ڶm`ٳM6!>>־=z5jԀB P~}|wHHH@BBd[UZwc3WWW4i'OB&^zx؃Pjٳg:tOMM5m^x ^8wr9P( ")So߶yAD ѥK(JL2ڦ:+VM2 ;wi?M;wcǎ " 8ڦ:=zL&ҥKyfhDoڦ:>+gl2f5hѢpwwѬY3<{fY rp<~gϞEbbMw<~X^v-d2BBBRdN,m; "|W@Cʕl]Prer|wbZ www4miii #V^-߿?ѣG+Z8pDvډߏEPn]g ""?RaȐ!ŕ+W1Drr2)LkB"##ӦM^0r?/_ѢE ӧO.]' jK3޽gb̙hܸ1%K5j"ǭhSn]ƏF4ر...(Zεw/^,: 6ƬY2 V^˗ׯ[ۼ\O>IG"‘#GhYSV-8;;ϰ^G׮]!])Rn@Dضmxbb"]7oZɲg„ "̙3Gr<557ow6+v`rhlٲO6D={DŽͤe<رD/ܬY@DeEGNVF LwZg ",Z\׮]oV4 ʖ- '''{ oooڵkHOOGRxyyI2,+CЪU+kN|W "L0\xx8d2?nr!S@#˗uVZ5jdeߎst>>> "rTR#FΝ;Źi "tV+~ѹC{n+XFIV OOOxzz" _d^5JtZeE`ڴiԩ>3ر Vk֬aÆ6Пl̘1C mӦM "޽{v1 d24h@r|(X\2V\j\z5}'RJI TR5kk.\ɹ;8̛7OR-ǎ+>Ba4ILN4Zf(Y$T*ɍ)6tZ3fBd ٳAD8}] 6ٱ`޽{i&|6l@%PX1&Nh%ߞqƁpB>HMh4(WT*nܸa S߉{d/^* O>uBD(]4P(L^NCժUP(ekߍO2 *T */_MOOG%lw(^8L~ ">|X-i;߂0}tsO>3/.F'|"E.߳gOIm۷oC.f͚I,m;ӲeK~wSRRrJq=x %M}'P(п֭[УGƍQ|yZzזi4 L&f"<<DѣGM4A۶mѧO2+6y׮ڷo_ƌ#9.8lӧOиqc^ADh߾pwqq ;8sQFIkZ?bc-l&7m$[~;;bccQ@Iod||<$3... Pxӧ@ѢEM.̭ɵkנR@Dؾ}T*T^@fQ޽EU"ƌc3/8~h .H^z:"xBEK4G' IDAT-2`֯_/9\sI 5Æ P}AXFFBBB$:"|N:vN_hҤ /̱͛DOOOL4SLPqS;dzw ӹ\P!ʕ+aÆ "9fxxxLe?zHZ* 5k0sLK%J6 V92ӳgOrB&I%]v}l(p߿Dm>))ٳdSN^kŅ Df͚ٴaDDH0~x.]$+9Rh;v,ß9r$U_OYG%m6EC([*ϟ5GסR$: EY'8Lݻ_>d/.ƍ 2ݽj ۷/۲NJ*AR|?66BL&wM&DYE}TIVHxMHH-[Vӧ "IfrM4iDR' ==P(f$&&Q U/^AAAVO:wj׮-i4ЧOhZzԪU d'26mj/^֭[5jI; ̟?D;DŽ2={MII1ݻXv-s "֝;wPF 1@ LKfddŋyn{n$:tJ7 󃇇~ ,'''?^/Ppa+V*申gbɘ;w$Bggg4oL"B޽%Dž>Y)))(Vʕ+gx^ǏoqYܹs^ }|JJ d2ZnmV#G`„ XhA%g ={|ttɲ[c D/;ju֕dMmݺDRFg:[_dzg&s4hEE:u U͚51|0ӿ.\ئ[U Q[5)>)QO2Ҧ3K.Vk׮!44x!b K+h4uR  nGAD +\~(QaU @9ZB 23#<<

>>˗L&C߾}yfL0=z4ҥKۤsG06!!%J8_^0ĖEˬ@J/ܹsAdF֯m۶ "*+W 00ݻw/<%+Je˖5zt:5jdw .4-[I')PWdItd Rj)Y9wн{w:ˮSL!2d9A@ĒVZa>|8\]]Q|yMnmJ/ /R:1,I ͛7Ѯ];899APN("2Ҟb],\YfaСر(nQbNrʡ|FA7PJҔJet_ "BjgTF#ts&$ѣXt)V\i /^ѭ[7q5\Or|<==h;w`ڴiڵ+WWW(J1.99 lURmpv_lovp0fFvo>ж0P?P(}G "q?޸~xl޽F%_nZTSuBz۷oRSSMrDDx|ܸq "#w>@mB5:e˖Eҥ%qg$6f^x!!!YGǶm۠T*;wXۜ<#55@*Uc۷OժU&oUdСbLa̘1 vwʕ+'v ݟ mtj|ضm8 vRUs$''aaaؽ{7كMШQ#-)))񁷷k 0ҩS'ٔ;vL&DY322PdI?!۔ӧObŊz^8cZPנAأGзo_)Su}m8,_*QDܾ}[Ա64l>>>w777룭[A,յÇ*U`Æ ؽ{(#:.ȿ+hrktt48 <<\5k&fvk a6J2qppn:l Yn].\/_ۣdɒh޼9ϟo٣^\.G׮]cB73!kYxMe 2rgKycL e E,[odWWWWj u#Bɓ'ADh۶322DѦf͚Y7֭[ '#G"88DzImڴc{QѦ7M@ , !C0l01 m۶EXX%ߵk憝;wZ7⯿B(;nݺ% eu;:_}:u)r\0 ;F ֡C?ڵ lRL7::+W l"o˗"^R)VO:dɒu V"##ADhܸIG;ĿϜ9*.iiik,r(QBy2%l\xǎdGyfYFW7Tw:u*2eK.bJϞ=Qn]888 ((ݳEW\ѣGZsy סRlV`7>>+&O2LR߳gO#+*UBƍd(P6)uaԩa <`LBP~%''J*pqqa.B݃812.8b7n,Y'fdd $$DG fve%Cg`I ә!ФIsqqq8vQVdÆ AD8zʼN%H࿬2õӧO'''IQpaZ! ԰wvB׳ѣG}OBB:udk&ҧ-ZdtN-Ҽj Rڵkڶ7oVX,ٺu+$ΊիH"& #FX\#zz: zVÇPjUI}uDGGGGiƤZ1cǎEzzנAhߋ ...ԩauA&z+xa˗/CTx,nIә|؋ cnQF k c`ɒ%Fm5Heс'oJ7?p޽{-x.X vp0yFBB-4Lq"Bhh(&Mׯ|C%!CtRk]Jcܸq([,Za4{⧟~kWXGGG(Q/^4{A ;w.jݺuѣGm۶6BtR@c̙P(dV IDATPɺuց_o |}}}BaJ=ЫW/K^Èq ZHgB0?H2;nݺ"E 00ϟ?'Mm mvpURRRзo_8;;k;">>bccV0J2:-*i, GGGh4(^QNd ŋlj'0g|GBٳ-m>ƍ0`6mUV NCɤ?R LL\֭[ۤtJJ jr͏]5j$ nڴ 2 Ŋ5 怜Quf5  8Pr<%%^UyFYfӓ'OPH8::ڔ ;8<˗ׯp~%T*pm@# .]Zߺr J%tR̟?o߶eeK\\\]]%J!jݺuivBs 8 Ku,[7oބի3f`Vgdd2 "è&\`ĉ ">}@fk׮d\#LdhӦ &NÇtĉ 8d ӆaƙpUgddQF "lܸ$''믿իϛLADXvѹ7n@P>>İarabK["11׮] 3gy- BL:u$櫯ٳgFΝwjǛY{qU4hbj.ɪUbԨQؽ{Me{B&!$$D,M:dA׮]qq >|JhР ,"B"E0b1K k%---d3%>|"ԩSE͛My9sL|ϳ8jwF߾}矣A q9s&ӦM3 Q}vHjkժ%.:.\"ѣl黳fFӴiSQD3g-en͛6""DYfIA&f͚&ߚ73 5j.,9WLOO/mB{ѣٮ4 ,X Cϟcԩӧ~FDDKGңGF͛EAl899lmt D]vȼGQPLQDpddd`bYPP `cǡC@D ׅXB'`:Jhc(P2L."Dfp9swF?ĉ +..^^^)Aw!-- wƚ5kD4 FKRt(]4 .Dɹ;wd, e._kf@ףlٲ.]Ν;纽yMϞ=!0b>|7oFj0|qZFҥ%-oܸ!:]]]"_|Vz󚬙:[ $''b%QEl-:w "r YlHҩ[n l3;|L0~~~w}"]f vp0V'99Y[-_ xϞ=+ ʕ+'v`lfkkD{Z^BddO>D"N)`p5pqqaQ!)) N.88Onr6XL7O.:(?ݻwǏx/UD 1tСV2vX;\uE+Q5,( Wңif~y"s PTZ=p^*a([.0|~'GƲzt\}_ב#GHJW~-ZSSSIJ| n߾ ʍ&33j=QښJ˗ǏoK);;&_(>3:88UV q?HC4(%%%?LkkZҨVj*)ƍ]vqׯmmmuҥKjwߔ}*((hwEgb831ЯYk׮mEee%[nmDFF-,,ئMVUU!III5ITRRBgggnZlSO׭[WyFIKK oǎ޽{IL@rI;;;%[G-===Bn ʽ{m۶nݺ)U"y먑5}||j}~$oqttGy4(..6wXhpXPP@///ܼy3]\\z?00,,9_N:qfZSQQQٶ{2d{5!ZHH-,,jkZshgg+ b:991((eeefk-(yyyz*l–-[RR5VxxQ _~jE "C݆|immmsNj*cTTlݺ5y n޼mڴ#~_6m ݕ8+W$~'&?~<[je4V]]Z\6E'NK/{qqq {h$!CŅ*J/ݮ];޽oZR=Њ$ΝKFwsssNh4;gfxx8%!N}jZ~km2eR={4yFԯxݹe||CǏZ6c_&++hRcMZɉzEEEtvvVˣe_{II [h (cSN5YpvDkzz:{EZMJ@BKA+++ qƍv؋/H @''' .SNLLL]v?c;v(:;F)c/25n`!D# hz+gg} >Fũߒy?}]AA]nqq{,9+K?%$$jhpܹ.믿q7o'O̮]Ɔ۶m3wxwئMvY:AqF̰vwQVTTDKKKW3K/dt<$MN:5YcƌZ3vZ z)(( .[̌+B]֑#G3g47˗Iֶ7J>BOƍ%_}Uw^wΆ*0ݻEI4_~m۶ҶvK.%\R={nݺۦRm6`6mvTUU188nnn&`7999ܹ3͍NNNJц=e׮]M>fHf:|J4VKKKK x9{\]pҥlѢ2dsssYRRBKKK011:t̙Ë/2''pBs/C7HC4jJ˗sɴ`XXR9--8bĈZF+yhRRRǖ-[r͚5xTTwݡ1x`Pt:İwO<۷uaʕ+WxAe˖WXQknII ᡴpܵk]ѣQthJjbOe0qDoB-//۱o\f Ǎlj'rΝMի FY]tQSÆ #N>7n˗9tPnKVUUœ'OuoonvUVVrŊtpp+{9G}d$8D_O>ʇv)bOKKKG VZUafDߧ3wnvzZfVVVǓ< [ އ{)S.%"iӦ7l@V!R{{{3!!+:o߾z׃K.ёC8p@y+b VVV*;nB?8/^#F]\\;v(; |8ju"\'}||8k,$oر#mmmWڲ2UV={6۶mjz=٩S'G9¨(3D&$!K.͍nnnF EhSTlٲ%U*ܸgϞZu;udggsE>޼y6+V-ZD֖rիɻAAAtwwoDHqwR .B|7ڵ+]\\nͭ[G9c̘0a <Ñ۽[}̙F\b{`Sioo޽{s˖-ݻwwejZܑ­[kS8cƌ{5"GQQٶm[ Cў={68ڵQooo9rܡ !Ip&ʕ+&LHުniiIooZۡO8A|הUV̙S M޽찈$nڴIӧ2((jZ dPPϝ; >&]V:495jrtv6lZѣ5j'Nh,>>!!!T5"ʕ+ }LJJ2fe`/ݎQӍ}aǎMT>!NkkkAii)[nVZIrLVkBJJ ۴ict7W^7xbej` ݊a'''ǎ[ !=R$hFƎD;v ///X[[̙3PFo޼_ĬYzjL4 AAAСẖL-X+WDNNqN=z5j˗jqa`ȑغu+ & ##qqq8q9s :vh򱚚;wFRN͛7CNN 440z?BAA`;u8q L:u G!jhvjjj eW_}ѣjjj`oo\p;wݻѡC_@ii)agg 6 00'Oܹs S^GNl2!)) /z=ڵk|t:J2wo(//ڵkZBxx8/_%K_7bҤIǣ>Wbӧj 899[nΖQ!D)B4-(ڵCnn^;w\`(--Eii)v؁_~č7*l!lVСCammnݺ!-- OF*++d3<|[o&\\\Rj*`֬Yx7h\,ZPRRb4?==ҥ {ܹiiiؾ};>sc w}s#&ICrrrh"t:MСC;v`߾}x' [[[T*sDFFߩ0wB4&LxbDFFuχzIDAT]*̟?Oj]<<Ԫ!D}ҥ t͛FJJ .\L<zQ GŰa0i$ 4_}о}{{QG;n޼ PTxТE |GN* =zF3ӣG%}p튋56!$8ovލqzl޼ytd"66O[n4 /_?;wFTTn޼ kkkEhh(bBf$44:u*qIlٲ~~~5jjjjBFDB܃#Fۻw/v܉ѣG|\n:̝; z{0`Nرc1|#>>W滻#11v! Fo߾ < &&MF1wB!Ipļy`eeG,XݺuCPPƏsun\v-兰0?J͉VEjj*fǣ=CBHC@RaBΝF<==oҥ ƍ&4v2ֽ{w!11Ghh򘇇7nիO!S1}tL0G!D#$]TKHH F1 33F`` ѥK!%%K./SNE۶m2xxx`̙Xp!m}B!BBf눌Ddd$֬Y=18x yW^XhSNO)dڳgO+;v$6B!HC!sz*lقG cƌaÔǏ9$%%AIII0`TWWc̄ѻwo)(B!$8Bݻw#""鰰㑓ϣhNȑ#KKK899… ѣcU!BN !۷#44ĴiO?aƍEii)̑#==SNŋQVV̙3xQUUe!BNB!駟O?ӧOc gggTWW… ܘlڴ G DDD~'޽,B!MBѰyyy3p,..?֭[Je4_8Z!B\!ulII 8~8Ǝ OOZ KgϞB!h>dB?m֬Y(//Ǖ+W]߲eK,[B!͐$8Bixw===aee\3F%B!39"osssCXX␘^NcРAR{C!B9!Xj\PN3wxB!SB4Djj*p5 0aaaJQR!B!$8B!B?.%ۉIENDB`js_of_ocaml-3.5.2/manual/files/performances/size.png000066400000000000000000001560741357507750000225450ustar00rootroot00000000000000PNG  IHDR}7csBIT|d pHYsnu>tEXtSoftwarewww.inkscape.org< IDATx{\?uuu.F%-9klj[da99n6cdٜPP*PtP_]zon7|ADDDDDDL&ׯ_W_nWL9rϟu)oaff&_TsۅL&ǎ+5&77WtAhii mmmo … FՑ;v{{{!ҥKˌFFFBPvN:BP֭[ T1c333!6l(J~hӦu% sssѶm۪JTE_}2Lhii{O庍z WDDDDDDTkmڴ .(**߿1cƠ~صkУG<~Xm |*_fffx ڵko߾P(ؾ};ciii1b+5Ν͛ɓaggy6lëÆ ;nݺaĉ8|pK,֭[1yd 99...u___lݺs/[na8;wb͚5qAe˖111ؽ{7O;v_-_~HNNƓ'O2޽*Ç/1/кuk;v ؽ{7~G@vv6ݻ:goo_DD:Qěo)WJ+tttϹB.1c-"##ѥK!0o>>g---(Gᰰ+W޿݃p=ܻwݻwA8رcvvv%yqAlذӦMSֱcGKssO^/5|հǏ իٳg1b*u&444ĝ;wB>|XBiW[?##Chhh!;vr\l޼_|!}600vvv"++K={V !;w ! "**ڞΝ;B&I~r\ !wB! $455ŋEJJҥ BCCB8:: CCC/n߾-Je߿4~x!EFF8p 6n(x2~x)H899Tqall\jζյZ,--EzĽ{ŋS2uTa!-ؾ}Us:b!ő#GDzzRE_"""""ZB L&mmm_KF!iaÆRN*ttt\.bU0($ԩ#}>}022JJy!rK.g'9@XlBaee%L&444TwJR/K~~x7r=ztSr͛%]SE} @kkk͛ !033e`` "''G{$ܹs#BjTLDDDDDD<ɩRֻqF-"^qqqSNzp-4nܸ2{ɓ'8s \]]all8ܿ%^ZGTDGG}|YXZZh ==2`Wbb"R Qm/k䖗>066F.]T*jNf͚ʕ+P(hٲ% SSSDEEDL"""""""""zꝾ۶mÕ+W\;w==zٳgtDDDDDDDDDDRA@@J3f~J(j:`,X@m~ """""""""zŞ3?\sNŕ{ LMM+'~222Xxkkk NNNj׸;qN:Gرc(((~r?~ό311IDDDDDR8W,[9uMu1÷}encXZZtDDDDDDDDDDV;ׯnܸ'xaԩk8C"""""""""E_hժݻѣhҤ Zn]i=Z_-V~}tDDDDDDDDDD/V%"""""""""zݰKDDDDDDDDDaї5¢/kE_"""""""""DDDDDDDDDD}jP||ZhӧӣW """"""""Ml???ԩSRDFFO|W8s BBB`ddTө+E_""""""""j4}td2DDDAҸĮ]uV`~j.NH4*]M9ii^dїDEE!..T)L&̙3_Ģ{+++4i jyFݺu!_gע"$&&BOOGA333\zڰSYϟ\.Ǜo ==Rd2YMBHȮ𼗝Fߓ=}-pQ$&&]o֬>|{_~]t-v gggXZZb֭*qSN5^z8~8N6m **J믿`hhC???$%%ϝK^T>_pv;::"%%;w>>>*q666pwwɓ'QPPycїhiiO>( <xw(4j"##+B[[[/JZ||!-- d*_gΜAAAn߾\yыa{""""""""j?㯿a``r۶mCff&ۇ7oQFd28_[[[ (,,,9MbܸqzDDDDDDDDDvaȐ!%zvvvv󡩩[÷xntHq?DNTڴiӠP(0g(Jdffbjkܸq077/}Q5yw<-^tIkFiӦݻ#336lPMKKƍall:T S-[ݺulܸQe<<<ϗѣ޽`hݽTu^ǹs''NHMfͰpBL:ҥ \]]W_\.W)N2?#ƍDt 5kw^hii}]̜9}T*g=z EJzBݱzj( /_ڵk3gΝ;v`Ĉ~:<==q5Z 9997o^I!!!CZZ4ɓ'cܹxMOO+'''L<ԩS*k>ݻիWoÞ={077ǥK g`ƍ9rdދ F|R|U~8p ppp:gb޼y066ƤI\#44`ff===kի܉򂗗p}( 4mTPbF~~>bbbT*jYņ fff,'OTׯT*o>!&&Q;X<խ6gz(** A!3fʕ+1n8̙3E$NcLDDDDDDDDTԔzE&IMMr̴r%Jr̛7Oe<00 \֭[P(,kWSPPPgkkkaƍD1lذNʽE<<<ʌ;uHLL4e|g8q4W"""""""""}}];wػwoa9r$1i$ܽ{;wF|||s5kףGӧ… +eתۭ[79r8utuuˌ5jбcGtFFFHHHm0dȐ iӦrݸqE_"""""""""/+WVZAn#G@WW\]]9ӧO r9:u?*B(חI&""""""""׏a-**+._ ccc\r/wd+Sll,JeQ4uTL:\2N_GGG\|JwޭP zzz5kڵ/ڷo_Y+( VVV*_666ԩF-ՑWS/-Zw5+] Dtt4lmmq֭2OKKKCppJ˖-S kנ ??I^ iiix!5j@T"..֭Cp;tP|ᇕqHJJBJJJMAʶwի݃fqcǎa044Dzz:`ؽ{76m -- W\\.!uq""""""""$Α:r0ydӧkVVzI>QiT:}]mLP|e7n܀aMMMall Hcrn݂BCCqihiiI&رc7o^kk׮h۶-;$XXXѣG˃Zռ<|xx1Μ9֭[Kbݺu= s1tP[?DFFLLL_7~xI .@GGT4hZ_PGe8y$ J}V:KDDDDDDDDTAAApuuUaðzjn#G :}n݊#??۷o'4hP=bcc<\ah111/JZ稨(d2٩"##/_F r8\~~>PXX}}R%ޗDDDDDDDDDϩN:6mvڅknn///ݻ믿,]/MQQz_jrZV\`*1455UM6ŸqJQrŢ/ P(TGݻwc޽8z( V[=Z˗aeesjq{šC0aA7nE*q;|mmmovڅ'O@GGG+**;wФIOJ%y ܼ祪DDDDDDDDDϩW^Į]~ 8*1* Cʕ+*C-o&իm۶ɓ'RSNڵkabbݻ/_^QQ4h׮f۷#==]eG{.UƣwwrBŝDDDDDDDDD0eHp9$%%ÝBСCtR( 34h[xxx3gDq,[ :::5kϟ#FsΘ2e 駟pUL8Qj3ѳgO+WXh7o=z4~7|BN/uQ}ܹرcFׯ׮]êUyIzÇ?d2^z'|xaҥhܸ1:tv}ر8|0֮] .`РApssٳg1f7NۼyslݺÇC[[ƍ{iӧc̙Rݻ1k,Z 6l1~x)NCC;v1cxb̘1Xr%V\9.]|W={67>1U}?~ŻcJ޺uk#99Yгz aaa͛7aiiu떸7t٩<`̟?7oބ!,,,J\?3  ;;;hhh`ԨQjJC^^bbb````OC`߾}OJUKTX%""""""""D %KtJT˰KDDDDDDDDTܹEZE_ƬYp=k׮Eݺuk:5""""""""zE*cBcݺuXv-pԩ*#11pvvpAih=Өtut1p'zZ_1b6o A^^o~C޽k8C""""""""zUd2bٲe_pY.((BQB@Ϟ=ˌ),,s'??ʧ$7b©=eejnYEZ}ÇyfhiiaAFF|||PXXooN^:::hР C O8>}8{,Ν GGGhkkI&Xt)_~ݻwlڴ 8s 233舉'JÀ>}رcQXX7n{022!>#dee䙛)Sڨ_>F*yT>zʕ+=z 駟k.dffڵkprr4?/2+4M3%\5 KСCx",--aggب(o񈊊YYYB@@"##1` 8[lI 1a4n^^^Xb4iݻt;wիԩZjI&aXz5 R)S`޽abboFʿC [oKXj~w}j ECOOfR<|E_"*q?1Bs,L(""n%axbTAF/4$fWhUQɊw[JJ nݺGBKK }]-+..n݂%زe &LWWWbŊ^%}5!!Xv-;?⫯´iǏGq!b aʔ)?:t耩SbÆ juwԨQ5j  \OOȌJ 7h~~~ Df^ o~HJJz5G- G}2޸qcܿ_۴i Uk߾=}v|dϝ=Z]-Iff&yȑ#k6""""""""zeݻϝ;aРA/\R6fffRF|622,,,T vBܼyhMOOGvv6Q~΍$%%aÆϽɩ\1tPi<d2w}OF-ʵVAAA::ێICC%ɓ'Az`eevx :z+WJ4^_bb" \z)}s߃^~X|9зo_DDDHa\PWyVT:u`eecccl߾y-#3bėE_<%j֬222вeK\pٳgե/t""""""""z"$$u=z羟w Wz ŋѲeKihٲ%KPٺwre^EHl999ի8k~w%W!"""""""ix7;v1`ժU2d羗5r9N8?͛7f%>S_5<bÆ h߾=1c bҤI,V'<==ֲHUVZ!''G/)J̛7B|RQwʕ@`` Ѷm[a„ }/B={ҥKx{z ͚5î] OOOԩSNNN ñ`*/=[l!==ēO''Ȏ^ ˌ Ά6:w(:u x뭷;wW^N֭[ѣS[wj;wލ0ǣuѣGQn])fɒ%HMMU[oɒ%HOOW_rYVC.]py\~pssC&M|% *3F.SNj&&&xwT6l tܹu[j6vکw~K\q *Ԛ4Z0z5Z]]lʌիW5eCDDDDDDDDDju7 S """""""""T 7""""""""" DDDDDDDDDD}^#/.gn?w*4ZWQFD2x.~6BsOSE}8lsBs\cї^),U9TxN{fWQm/QrTKDDDDDύE_""""*ᷱx @¡UDDDDTn <*Bs45("""""* """""""""Sb733{!444вeK@ݺu1{jM^NXp!u놦MYfҥKYU'O --RLMMqJ]E_#<~AAAظq#K\+??庯Bn]%:--r"9<+(((Bsh>inB$_}/+Ӱ+\pBk׮ >>>ت͌^:wFJJ F]b &HgE{ иqchkkF£G{uz [nvлwoAWW͚5?D8::bÆ  >qO] BFccc~;v,,X6l\]]kB,[ Յ9[b-..cƌA `dd={ۥŋoׯ_???ԫWZZZhذ!Ft5O< ooonݺ裏S#""еkWCWW...˝?U-|f!!!:t[oUqjDDDDDDDDٻw/i l2R/6n܈m۶}|M[#xѢE7nZ;힕U+ >Sqt ǝ;wT*q14mTeS\.ǔ)SU=s `ڴi*Æ ) ozK*2d.\m۶aݺux"##/|*9~8n޼CJ_d5jBBBc}kZѷSN СC_,deeASSAAA믫=Q"""z]~M{WhNF,U#kkkܾ}P**׌ ɤBxz8۷At$%%B=;J\ 4P311Q兤$M6RG}Tfylmڴ6?~"KmmmhhhrIRlI9|NKK_n]xRY5UիѱcG8;;Tsb֭/7… pwwG=ʵΝ;//YYY^izj 4Hj,FFF0559o^i4j"((FVV~7 Ӳٱcܹsزe44V{S "8W:|m갎U[]ZV)nmeUU",a5HDIdwf2r'ܓx=1nf[\WFxx8-[VAq(p/v(wׯFx!"~={p?~<sl~իWǴi?åK۷c AժUCXXۇݻw#//iiiW_}k7** g̞=*U3>?/*Aa0ر-3gd2[n^|^:~g̜9~!.]K<'..˖-CfʹcZg}֭V+rssa61a-+[nG}nxx8>#hV+V\ &G ō7Pzu|xpڵCdd$}HJJBdd$`>|8,6k6..\~cAZp8x뭷?744_}}@,[ }pŻヒYf!&&6 vCiO"!!o&׿l6#88/2͛ZZ*֮]q<*]UVř3g7"66?J;{:q7nO>vҝzV~BZZz{T~{/Ʈ]pyvƢE7Kwӧ<'OB h߾=4h7|frkߢE |wZ-_ áCp%Ԯ]zr,""}WGFΝ{nQFСBBBРA Xnoǎ#7M@bk㯟Ǐ`XѽK{y *G[.֭[kj׮qKq/܏niӻwocw/ !..ϋ@~ *T# Sttt )kf4CBB]v?zK)Q ߢشiƍhܸ1zK.a˖-ؼy3u_%*Qs~b>ٷ  g?xSA0w\?~o6K??uԩtϟGy ʚ9s*h2{gf,\P/ZV <s+^zut|z;""""""""";9syظqcuUʋxwƥKt]h֭[%4"""""""""*gz)ԯ_P}']m~Wưa\;uUV_wԨQ]vHDDDDDDDDD_zOJ[lJ*a֭HTT??c߈f3_3g|2|_ /미v^ z]K<(ގDmݺDʕXr%ի4lO>$?yyy2eJ4O^fh\S<ҩ"2U%{aP(e!"uvFصk ӧOk3~m6/^3f./tEdՖjx)˞}Y<E7 f>< tf͚Çc۶mC۶m֭9YG ݎ#Go.\A-vZ#""""""""""W$~?oҷ7julK_y7I{Z:t{K߹c{Mq]m<z)˺R/=oJH|xy-&}9ojⒿŔq/N}Qw;_!]2o*.զ[A>ܺn%{M4iwl,;Qwq&}s )j |6+ũsu}WWFlr3/N֟.l mڴlgu,۽= Ѥo֥t@CNݴxZW'I_o?jZ'w6&}Yy_rGQ]</~CWoy7xqf]m<I].ƗI ~>Sn߬jH^qyԮ]0`m!/6al/EC_믿^L>Τ/LBp}3dy)kS3ӿB{ PA%""""""""B CfKpW45fƮ`җcW@mt3FKV+*V}s3 """""""""{L_'!!!HKݚ)DDDd<ğ|"""gM}bh.&} !V0ʵڕL۵U/}fDwejB$DDDDDD LgTwY^I_2bW?#7/OW\QǤ/Q`Nܲ;t|""""""""*F@DDDDDDDDDD%3}ʱãQ! ZW^ JDXjZOW^ J;#KDDDDDDDDTƥe"+G߆7y^Ƥ/Q5pCW7 &}w(g[h1[vÎ|YW,o!""""u-CզDDD#&}ʀǻWE*u9r횗!"""_Ƥ/T5&}Ѓ6iͩ|5•+W/7nzyسg`޼yh׮caaa^zv.D_\DDDDD8x.&=+Kѽs=xѨQ#@ժUtRL8gƏ?x8~8`nDDTb'Iw'2Ag'T&r? xW\O0&MѣGIII a—JNxjt7]mRR4DDDDDDDVL&"## Dff]_znBxx86mӧOp ""oƏ>;/n'\NDDDDDDDD`6:p8Z=oڴ پgϞEtt4"##qL0A+ADDDDDDDDDTV陾"1ŋ9 A&M~~QFaŊ6mի+;v6n8k^ʟ?s-*I_l7v+1}t#G믿x[WbbbwA]KDDDDDDDDDӉ'p…y2 Bzzn޼C{Ŋڱǿom6mZ{.JhDDDDDDDDDTδm-Z(s9rt7<<׮]4jH;,ܹܵsk.\M6uy,)) ;[vںiС:thk2xm?..\A˖-~׮]ػw/|I㹹سg`̘1%1wܹsM6aɒ%ç~7x& ߿իWGNc̓d?ɓ'ի8q5jltm0/+I_ذal6fΜ łQF!///vI&%%!)) Ǐ׎f3V\*UI&=z`޽F%""""""""""+5}_~tVZ}vژ9s&ԩN:aٲe^?xꩧoÈȑ#Ѿ}|DDDDDDDDDD%'} ""s̹sV{7B#"""ҭzE T&ۥگy!"""""W[Z6Coy)nw L&5Тv ]mJxv@{?13t{:9]mnqEQA%?אa,/ECDDDDDD%H/Τ/ \&W?ؔhW0K>/MzSWIbVxzvy[t#""ۓݵ,ߝeGDDt/ lV6Ҽ  &}\.n7;1KDŖlXJJd[꫟HDDDDDT1KDӷYC%;yҴj.^ӷS:QqU 5rJT`R4DDDDD%""""iHs3즫+LDDDDC_o""""""""""iKDDDD^`;^oV,Y^cҗ*OXg[!*Y9yz]w5-/EC8yI^|DDDDDDEt>!IWk׮{)_\%}I+l "0KDDDt|-js>妗!""""¤/}+7D6I3IYڜ͚ѽv /DS2<&%hH=I_""*pBȀ?6l󟈌4:4"*BKx6-+oa+]<;v9i^dXP]mrr$dCNn6vwIߙ3gbɒ%CNpe9r5j"cC 飫/)EDDD݉4J7;!Qߊ"""".ڵkXt)l6Ξ=={ٳ0anܸɓ'".uw…C׮]QV-łFGDDDDDDDDD}=qՊzn_5"4""""""""""k^|РA*U8v,`""""rMڪOR4%CWq69[W_R4DDDD}ʺ@X"ׯ_ED~7myH~v-+'.ej|)jLڤg-}o3bMw+rDa~}H9<\˴{)Y]~g!VXt ~qKlB0?~˰BDoAh1RGu 6Y9ddz! YP!X8v5ߝ9X1*\} IDAT7o!=7~V3*~ y>U "_VnngdP9TzV.}ooAwCP?,v7n:yG~T ^ٷpnq+7vaA6| (EGr~wP?Xsu@? t߾7bU߹W7oxLJ*!%%.\@ƍ]۳TbDhelE=ϧEI疿\˓re8壝*oM7ȗo,V9<_u䗔\G;g8|f|9Q7o9|6TT<Yv\2:U=P,[-*_/:ӧO{L^~z9}V'0BCCZt, 4ibt8%Ӹy&QfM)gΜAvIp88qcDFF"227PNTPpҥKHMM?6lht8DD^s9ܸq!!!xn޼ӧOd2qưX&EǏ@ZISp8ͽ9Q~7o&Fʕ1uTI&M`Ϟ=ذayΝ;ɄBVNpQoIEXX`Æ 4hw <HNNZvO ^|Ei? >/^Ċ+'NѣGѨQ#3+Yf~Պ_U,:|0[Z 0eʔrQmƌ8z(֭_~p>QޮIGyy˅f\~]O'7o" 0Ncb6%,,Lv|͚5@ |q4kPJLxx+VJ͝;Wh?7oKOO d+ʌ3 bbb$999""beҤI@7onp$&&l$'O4:ѹsg 7:-AAA2zhC8 =zJɑw}WVZ%FS"'-ÇJeggfӮIӦM3:b4h~BCCDjráĶmfիDEEIlla.|\R222D<"۷o7:OdddH@@JI_޽{ ];2uT-9>K,??? 6M#Ǐ7:"p႘f ~ltX2{l 2|p;v;v谊nࢢd֭""Ү]; EL&7xh '00Pd8IKK쨨(3{LvSqd޼yeg9vSl6f[n1U>ҪU+ԩ$%%V;vL3,&L0:b޽@dZܹsFU, .ޏ[萊puftH֫W/ UTȔ)SŋFUdv]F%AAAbZaÆK/VlܸQjԨ!VUeРAeIDJ*@~i2d|D7)ѣG u>|aKRR9}ᔈ%KH*UfI``WRSSeȑ(6M"""d̙FU, ҹsgC)>p8O>.t???Yrѡ) 6mH͚5d2l˗{l3`ܹrӪU+;aZp۶m]f.3vMdŋ^ļdiӦX,ys$##C&Mdt2g-ݻwoٵks̛7-]v_ߑjm۶^ԬYSȟ'wKwIȸqJ3D]N> Uջktx%&&J@@J*IǎB LۃoIL+X  YfiWm۶5:"QPYdʼnl&w6:"q8,dΜ9RZ5ٴiaO?-$&&F $ڵ3:b9p9AV6^֨l( Rn]dÆ ڵRJRZ51LbXdW_}UY,oV&V.Agxl3eiܸuUH׮]套^x@HÆ $C/ԀVDFFj{5:<Ҵjujݸq2:99pO*Ν;dȡC޶m pAm\zzzizO۶m:2*ip8$..NȘ1c PzHHժUΝ0 G_6m1BDnj}bdܹF|WZb~߾}"r{ƋYڲeKk׮:ؾ,**J+,C,X]puYbʕ+KRR̝;W5k}nvZٽ{6ˉM iРHvv^ZK2bY#@}Q:uHjd/~jB rIΖˠA*W,\VlR٤ұcGJԭ[Ȋnĉ@6mr<--M6m$k֬)S7qjS}ڵk\YujؔٹsXVZenaôY{LCie˖i'f8'H }T~Gõ:dffJTTL&ٱcv.j_kz!dѢEFV4j`_,^XСCL_ݰa2Y~AZ9?dȐ2yiԨz[Jttt70KŖ(gϖ%KUU""2k֬ ԒUVw8b2$ 3RÇ~ؠfF͔UH9plڴIur}CЯ_? ݻww9fdP ~Β%K-o|Xz=Y!*)㏻=ʓ℄21Cʟׯ#FȂ p8d]={VL&ΙJ4_եKe_siOT)u С={h`_Vzu ,ۥԪ.]hɑ>_nkV=Ze,B jYѭ_^HppUj;c@t0KŲvZ&IevEkj*-[ڵ=>*Яxb?~IW$2{l֭[Yѩ%0Υ)ϔݼySʹǎӖ8w:g*=5hP %''G[b>Qsj|Æ =tS "-n6% @ʺu|v5ӧWhX1LaÆ SUl6 |s[%?sR}ٱcǖV5ospvERf޽>˹\&MTXQ%11Qz!I$AAAb|:xbsӧ{lkTMgΜ)dԩYѩ\{q5,TH{5VZڱ͛7Ƥ/ڄeРAdرY6Zy5Ź>233iv^jjL&k׮Ȋ+\IH^Z Thܹn3}SSSe̙2i$Lm,SzujlYM)߿Ovbbb.3K7o,"=rҽ{wdxϙ"fY,Kbj2x`1bϽ/jΝ;'gϞvUTʕ+K|nvߟgfggk.W2K 8PHϞ=c*竛3,[msT d\.\Rt\&&&Ǐw-00Pf̘Qgddz1 =we6ݒqjz*U={ʩS |3JqYؤƴiwݗP, Sٳ9C󪙥#ܞ-&Il6ܹC(!!AVs^Oݺu}o۶m5JDt=1bQFć< f:S7ߪCK3T]fLE_ժq^~gy6 tQ>:uʭl۵/,uf[֩SG;%opLs,={1ch7588/sJt8'.Jj,p{itfl6K``Yb6 Ly:;}Y4hرcٳ.mg\ BnԨQJbWP帚ܣGm2e!:F.Wt-δ4q8.=/m^tv]u&2w\5jP+H G%}6PsҥK4M6mZZjeIPPuG%w+WqRGW٨kJ*U<>t{ 5WWq%$$ Te*zOݦMרQ:'~'ݺusiI;vKE)SWuԍ/G}?TNmO2lb2<&:hk)';vHLLl۶M>,>|X,Zw:'M1GDd˖-^0W%:7-_[sJuIgiHXt۠dm0d2I dSݨ:c˗/'>ph现Zȝ6fpHttی6Uh58G;wԾ?γ,8 &I^[޻o"Q5OddLUjo``6T~_;vرc뚯,V %99YW:tH;+Ag#AAAn tihܸK(nZۻwl6gʪfYVQ ~w"ՃÇ:kY t+n iC؃jFR}j|B.]J* Z```6νO{ r3f6f͒͛7k3CCC}$.]m cժUvZ쟯lP{?#-Wfkڵkˈ#qwݻx LR[N֭[7Yx 2DUD<_\T:00P,Iv MHHZ*W,eqtΜ9"r#\^CR |gZqr9IJJҖX,9uꔶٛdrKرdTׯfA3e{Z>sSΝ;F7ґ#Gjԍx"wFt`Uó08eqf6%88嘪 uohl2RSGO5.'M%w*W,k֬uiIڜu2uEiѢE5kָmhlUV]sf4iDpTR)AAV\G%ׯf˪ί}n:*yھ}{sv'jI-ަMʒ%KdҤI u6hmd5R4h {n6l_8ر%;;[hB[f2d֭*͓|eߐ_(Wj0@RSSԩS5(44T233>uKnz#[~~~2o<ٽ{VW;b iѢtm5xԤI#H}qqqGɪUOVݻץ5Emxf9ܙA)IM999pBj k׮nJ<:vRIƍٳg%99Y;l6-&8Ī?kaiϴdӰadOm]>PA}ҠαOYnm۶T0@;˳gϞigӮ]$&&Fl"fgdyAvT3-=^0 wӨQ#3fLޣG Jk֬2sW%ڝxvw ###Cީ! 6,sztE;f5U\钑$ IDAT<R6nh@%66V VBBBd||6D5 Ù&}ĩO=vLjiRijO-%%EO.;wcǺ,OT*<%9?Kiƍ9>Sn#ް~2d[f̘T]--h),,̥0.pY ueF}'jY)9Orrrjde>njԩS*~:˝;wFgL Yp4o\[j[%HlM#p˸q\i@Ns7PeI6m*W6| O6t^٩\A_8p@o?q'O̙3W^nϭZ}u',=J[||̚5K6nܨYWx۲eiFdȐ!.+B5J̽}thhJ͋/jgyFe׮]iz?~\&M$}>H듥kI`O*8 UVqIFF o=tÆ 2`0a@*-\ ٟ'gϊnKTTTVM~i v]222un*q *Z*+LR۵kDFFj59)0|<: /Ebbb I-Z^2eˆo,YO`2 )6nBUFވLf}Vf͚5.<[ dggҥKE.7qj#ؾ}{NRRY"-Z$VZ>[nuǹ\M~6U7==]^ָqg^;k.RSS͌}5sNoiӦ1/m`f͛%--M^}Uyٳn=iZep8946UIOĮY-llUF9oK3ԀliӦ69ivrlҰaCwi S=]DS{8rd|͛5 SLL߻EL"r{ݾjjzuLzz<Ål۶8m4 `i޼˽c+2,X Rt;^} jڷyP$C[`mcǎ`qYtMAT5kJfʹ>ݞ-Q%R< ׳gO>BPfˤҶcXU^2\;;?ԗ71K^|1PI&]xQдhBƍZ,W6ȟȐ`Uv,C)ShK7o|̈́JΓf͚6HKKRzuj/+VZI@@I^\۱cV6C%}ש|[nnǀ۳l2f{۷XV w?~\KV{*˶o.YCusޜ!$$D,]v6l fMr\2:v66ߺvFw.MOTU^]vڱl-9*+WoQoI6U tSu{t4U~GJ۹skjuo64,N:%G~X/_n5СC2`Yԯ__dPga_>egg˼y$::Z֭pۨD[m˖-bX|f#Dnnk7|IxZ&&&bqY^MjY {ՠsY'Oj#GM6ɴiӴFR8_pAOrîxڵkرc2h l >ӵT 7ܲe̜9S3?%>RرWHFXnzU:ϥ_giK];yOp.aaaWOIJSNҳgbܰaLӽj&dYεՠs=99Y-ZLWIΝe"w>͂:wr\-g*̲ҠfCծ][`j5df&ׯ3vrrr$,,LV5E8qq5OW焜5 -oU(%%E &y:t4z䢘3gs8Ţ}r4$;gEnϺ^b} 8͏IQQ0rH!۷/[hoܸ"յFpqEFF"&&F6T,YTU&V/_nỄs|iq%0smiv;N :ڵ %bnYs1|dlFtt4'Gb|UU:Ξ=+ qUhFmPqϞ=2dnf)~Z=+ ."5WYY UU/Ev;&M^zI>W/ 8Ell, ZuuǹԩZͲ'dW&saA{bANtvtZJqjѣ۷G||H63u֨bٳ[8o&''L.f8^ZkdŊZG`֚ Yŋu獪jOF2ԈF{oszٲerQuᡓ WX,:5kրٽ8{,]_v1Bm6WR,A OOOJfDK8y;Vgzp8sXj͎DۦN(233u Q/]j+k6 v111n}Vn#!!Ν;,ћғ'Obɒ%\NYW2eeebZk(sKRUUq=qP繺:5:qFSrhn޼)nݺ!66VZ,QIW\`Ŗlضmz]9X^˅ ZN0 .Z . >>^S劲\s;9"WW\i41 @9ܡsđxL@ lAc߿ѮUw|5MsR[[+nݺ!33'NZΝ;}"22k֬i]zUAAAAJ"qppvv6u?~|Qؼy'ٌ7o ƌ#C***ľJ;Zj0aSB%^z5Ν+v(W^EDD-nG54s1"::ZdqM C o߾%,\b0`NӧE }pFii)oߎ'O^!pmbb6r$Dݻ#88XUnҧ"Ν;jQUUcĈX`E&M"jԽk׮b̀sK{sulL0ӧOw2<+UUյhrW15f tFFFBQddd):1bl6t0a۷{nQ¸2Zw؄Hv2:d GqLy󦐰00v\{Չ@ݳ>+ZL9sLߑ2( TpaG˂ `X2SLy///ƊjG:uĎQu}x]r٨Nkci\\8At#u#Z%n#m b8ѕ}YYY5-'xt.l2j2J+aRѹJ:P\ (.װjN sM~~~qU&?hM4gaEEFڵ 0"Qz%qif{)ߙ:u 0L0L߿? E~itI鼼Dqc; \%FPXXTE $)mh=زeWp+cn۷}cԱcG;33D &|?gsas㊇TCQl6s?v kmo\ǙPc;tFHkk:t6܂6o 1c}JhhϤ;cseǭļ*Z[RfXZoܸ̙3e˖-ظq᭶+XZ)--}䀹V繂С.\kw{.-- @Crlܹ֭[u?Aj*UC@@"h ;*uXWUg h#qusnǎN.6֑(jkk1m4tm8|DG ''WG2f{h+/Y>*وCOWuiڤ#'m %qՏ'ß. wԮ];"//Izv;"##LKyyw׬[C hbW^ӧEQ?w_#DuSSS-[ Mov4l0aS;w(%q,Fg6SOL}WdWb8ZǪݲ2f͛ł%K`MhNU ́vCƮ6/, 1xfOsၠ v $'/ "6B*ylsl pӧk+8n6L 5[L:<s95+Bx!g2̕ݱ1rQQQnnh o 0eeeY:Z).ضmHN4'(((pz}ԩ }k FE/Nrzmٲe jLakBUU5 zb(uuuشi"C\weqޔjaw"::8UVsW6Q9L23fw6ɭG-YDgy|l L&6ӭ0Ncg;~:&O:`ܸq#yXܕ%Knh/ !"t]tcG֭[b16 .//kE999۷Z ߩsC}%SUUaÆ`Yf=wl6(pj%#<<<`Zu^/^UMli*AAAv~~x(::,۝LN$СCunόt1x~aX\:J;[l!))IwW^Uƀ둒3 wdE:77f111;T7VQ]]e˖nc޽ jkiϢEEE"!:`s7m$ +WDff&Ѯ];[kR9 ם 7nXh._ٳg6<\LEFF.:=r䈡OP=z4(j9wao͟?_:I۱seFF&Oݻw\UUU"p];«;ȥ+@DNW^/uF-Mqq1&O3f@UU]qLRRZqYs4z6vu#Z2ڪf6c!///]^^^tD$O:U}uS/]-[`Æ w 8pD] 7='9+++ UU޽{7++K ù!CHoeֳg6 ӧOԳgn S7VԈ=;{Op;u4CP-Bqq1^ wem&Gw#VX; DU^^ѣG/qرo<-ON8bƍM,;#M>,(oooL6 #F7+7*>6$P5Zy3$1Wݻb 8Хmbe˖aƌ8pn0`RRRD?v@h۵z)DEE W@CǎuCT]]b#G\g0hI l' ӦM'Eƾ52+q[€u#Yqaٿ"[5gذaÈl'Gcwx饗`q t6ߪd2aΝbBԶm߿[e$'\=dڵNEg\(qf!>>^1h׮`ETYXV]Lh9Y$YkԱ XWypB1祥'DTUŞ={m6 3f@HH|ɇ: *-ܑtf._d`b6]nZ2eskN\7+WRqi5v;Eq٬V2 OOO{U;~k0NiݙRL:F6' R,UQRR".'N0͢hms־tUqݹsg("W^yEO7oƴiӐ"ˮ(--ɓѮ];bĉߕV6mKQ\\, m¥ ;vp7d2uʼn䁪B|NIl۶YMbΝ;#|^]v0s[nҥKEcU=k!55[naشiqիAZxգ3f 䶲R=>>>:`VmD&EY˝;rJm IDATwh" 4III"-\izzz5^KH}Z[ZV1s0a) 7o^RSSXs Auu]fIȠm>}"׭[zݻB[8mg?~<&NL7J貇f٥#2`!"Z5oȐ!T)dDEE5$0\ᘵgo޼)6DիW9w]vYV}ºEgXIDݻ[T19999ӧOF,5'N:s֖&??3JނD Dcmi6TPä9jjj\\IXL4I tŋŵJ/9sxbqSi+s-mr{etD 桎@-qZ:6BM]:|}}B6hH:tyX5ʪ\~]|=^}F6ͭu&ݙrz\2|pL8Qa0sLn:o<7jQէ_֠ImNٳgE2Rۂ\v ۷G=N:U[]An#7nTrBlX5>>qKD޽XO ȱQhkiV3M˱qF޺hVV͛},-//S5(.#""sltQ!oz ,4=.\Hf#!!Ag'iZ8FJHűڪ^^^PE/_\Gtt 9v47ovYi$֮b3鉧~qqq "1B|;v0TԩS:PdNOOGmmïQ\x:Yw %%ũ;&88%%%(,,]2},7m6 <@C!>>ްsq[g͚;^[[)S@Qx{{sQtTNN}0իWъ{3K+~ddK#sd2ErȐ! r;hmNTyΜ9r ^ug4^ramw7ywE5uwjn ݻfܹ HEQddee!55U$W8+#_V gf̘!"UEnbqjŦMe˖o(y8GŒ%KvZ]#M\jJ,сԼıgbbLvnݰqFl۶ ڵu0WeD}}(bjvId2j:L& z`§I9??_T\!<<\-iV@u$gΜ;NUTT-ingE՝4WrBMM п1)"*;dҒddd`ظqo޼)sɆQ† 0|ݺnСPEy_( N8 "l޼E0l6<==aXt-UUU(++CQQhϿuTUW1B۷OW[VV& 7n@YYYk I͛71n8=GDDOPPb,//GΝukhB,uVR$܅ 6@QQ,h<h+e@'OjbA]1$ jUڸq#VX2 _F|ueWy饗čK/IJϼ+ " 8@8;k3/bΝ;AԠW%4.4aXT[9aN<ڵ+ҥLG wd^pX`bp0K.ᥗ^K/$cv]Hn̟?_,4+++O Š+u<==j5rjjj3Ϡ _~2i-iQXb <<\C 𖔔k)4 c0 "1^\t).\(J6(]{رؕ+W;xrOOO{ZTVVbĉL>|d2!::cǎе<D$mx.в rmŕF6ׯ_jEn nmW\II rrr: *++!iZZA۷/puK.o߾&]I>&V{ "c\(d2!Gc̖&55U׹( /N}(dWl(:M'ٕ'l֊`oool߾b5<4}鎕 ;2///(ںu+2鈋s|;qF̟?BB@[⤯Ʋ RاO(AZzG{=VUU9%# ҹ}e d>j(IY䛳n:=wj$)G1h Qm7osܺu|7o "~40p g6QmlpЎb555 ( su(///](kO0};~㼿ʏSQQ!4J]I1$/^tb\YoZ &TTT~a-uuuYMMMرc 5&!00P$yjE౥ϟ6ڙ:u$Jsω-NAawi*h+9rqڽSO="B׮]uÇ&Њb۷/}Bpw؀<$$5N~,^6mz"²e˜>ڄ!!!8q 0j(5Z( y+YQ'Vb `GkVϪ,A/^g3,00Pt4|{rrrDIc=Z+Wl6CUU̟?)r0BMM v):8l2TTTC'.䆫b¤Ν;EQ퍴4\pAM0}c9 re-ylٹs'EbСC1rHтzxqY_ $I맾iii;vh@k`Cii)  CqqqC['77{ddBTTNc5UUq9q:#"{nW^"cHEqq1/^9s**y+Zu& ##CFa󭀀BDDXc1JFIƍi߾=TU,<0VUUza(Vm\tItr{FQ*++1ffΜ}܋'..v j0w>p.^(aFUZ}}=ڷo/a,YYfd25 HO>x'O,2ΕYPQQzyyСC-}-@n… ŘmmGqz;9F]$3ӧOcm& ٖy؜hXqékر "of:鰺#W\AYYl6222˗͸19s٪*1;vDΝ~a]J\ja>lȾغu+ wmNdW"ACu^^^͛g "cΝCLL "##`WWW7IH$&'==?qhD'Zf*qOnݺѣG X???$$$*q qIDATMrrr-eeexꩧPTTd$;vLjaJGc7fذa " 6(i>G,ҥ D'Ym۷c͚5FYyQ4dYCX,Nd#q,2+4pΝ [,(޼ybb4hPsD"i-5+_*UEhJ$_+@__F+MQ֊Mo>̙3V$Izjjj( aaaظqc ZҚvUhbbbDV7۷oիLZ%`iG,Djjc߿_8CZ\|m66$2+Bߗ\W^( L&0nsp#u42e \?%I- jjj ".? K$߆Eлwo7D٣S]]޽{;iI LDTTT47Dk;m"7%5"tro0qD]_~b}(4˗}0yo;/_į5"I#\|Yg@ü "D 5{~(--mޓH$MΥKбcG~lիWɷtgCv(,,Ċ++W=Dfd2SYUQF~~Wlؘ%F )mXf F-FJZ)))BK.Kٳ.0}tN}}K]toy___yсk׮tmqEEE5p+T &~Q||<ǾK""_"ǔGDDDDt}ÇS@@OjK$`ذazj ҿ/ >}P`` ѣG:-I+ Hn޼)OSUV?͘1+""~Qtt46x)<<.\(uݻw̙3*|0aܹLTU!** ڵøqPRRbHZFk׮EYYOЮ];^6VxRRoVWWc„ P>>>ػw~f "{qacw˗/7%dW"\xD`0̄jBUUUȑ#'&&0eʔD"nDDDpq .۷o4:D~~>zL"H$qwd5p@z)qlȐ! "۷`ѷo_NhX)I3.#l۫W/ז/_ EQP^^>>8q"1f]`XK^^̙o=悂Dnݺ=0nȑ "l߾]{ׄAbuu5_%6L=z4zUU[qK#I&N\mEDHHH$$$0a.ZDC%wDMMMō7ooo֮]k%D"iQjpBlڴ { ޗ_~D:PTT$Z@D8p@ХK7l6v9sDOOO]Wŋ( vCBqݻD0ڶmۜLИ)SDdd$( Eb2 "q~222"˜1cPYY۷f;w3dS@[``wo[F}%&ʕ+HHH@.]Я_?߿PXXEQ`6EJ ;:t,Hw}WiƎk$D"iӬ_;v0{lK.l(//Gxx8F!~ҥKADѣ!#i ** &M'EѵoDlѭ[7X, Պe˖h<==AD8weeeBVѣxvv6޺ܹS$ƚ ݎ yN4hXnn*}MܸqC7n'L"ŋlm H:[Oq%̚5 R["H$lFmm- Æ  "Btt +**Dqٖ?I iiӦv DpHz!2{l#F0ydTUdN9oyLT.^]4aʕS0uT >D,^gƍ'@4IM)))HUUUNoߞ>cڵkX€J$D"H$mHQz"jp}ٳ'}4|})//O, '?W^yNBҪN;w&"Sv/}ѿۿ>s}#JCv)BK.?ITTTDoߦN:hdXO>!___ڮ]G?EFFRII %%%ѱchСblhС0_}ݻjjjhʔ)ԯ_?qׯ_/R\\; /PYYP}}=}TRRBON4w\ꫯhݺud6I[ӦMs).N:02D"H$m UUufBgϞF˗E̙3u Ɉ͛71|I+eڴiz:saҤI#GI*K.Vvđcͻ~zX7otki6t4۾}Nܹ8Άo }>j ǘ% ooo:u=sߧ4"":vCH$D"H4?髯#G/~y""JLL'NИ1c??7 ޽/iӧIUU2Lo^?s effF__/GUUUO-۷oӀ :Ik 22R_TZZJek˖-{Q߾}E|bƌD;WjJLLM6яcOHUUZj:tvJӧOoRA"13gɓ')...^hp$D"H$6޽{iҥdIQ@iܹoPjj*˗iĈE7 $'x>Zp!ݼyrssgI&Й3gA^Ν;ӝ;wÃy{={rrr{Q$iETӧiʔ)L;v>ӧ9s&OL^^^t=@`Ҝ9s~_ȑ#IUU(((l6ܹV\IDD}k׎|}}SȩO>5l6Nj/QXXUUUnpNPdD"H$D"H;.\H4p@z{QHHl6z* 8РQJZ t]Ƞ9?~zEܹs)33?9͜9.^H&-ZDvZOJDD;vO>>Sns>?Q||wA?>M:~^HԫW;}D"H$D"41+WD( _>[oe0Y-Z)K&"iŊ( y^VJ$D"H$cƍ'/K/4p@RU($$ĠJ2;v젗_~MFNҽNNaaaTRRB9R}}=L& >iܸq5p]ԩM2)66.]dȾǏٳg}駤 ?_N#i7|TU_bȠD"H$D"H$G޽.]H???>׿$"":pEDDرcݻԵkWz7 ҇~H_?ҡC= Ibݻw)44|' JIIɓ''jD N_~%1ˋrssJZZн{h֬Y/jmidW"H$D"H$jhw~Ϗݻgp$m⨶ÃIQzwhzEP~~> d2ÃƎr'-D"H$D"H$'u֍¨Tz_}礪*ӇnܸAPN裏>"NK,4,Y+H$D"H$D"H vJ111G~q{ѝ;wTUzK|yߧѣGΝ; SYfѫJDD+Wj޽{ J_D"H$D"H$D"|'J_~%СC7FVJ$D"H$D"H$sї_~IǏo_"Y+H$D"H$D"H$={?O1 0A$PP];4w ~3b<;j;c:IENDB`js_of_ocaml-3.5.2/manual/install.wiki000066400000000000000000000012031357507750000176110ustar00rootroot00000000000000= Installation = == Requirements = * dune * Cmdliner, ppx_tools_versioned, ocaml-migrate-parsetree See opam files at the root of the repository for version constraints. Optional dependencies: * tyxml(see https://github.com/ocsigen/tyxml) * reactiveData(see https://github.com/ocsigen/reactiveData) * yojson(see https://github.com/mjambon/yojson) == Install from opam {{{opam install js_of_ocaml js_of_ocaml-ppx js_of_ocaml-lwt}}} == Build and install from source {{{ make }}} {{{ opam-installer js_of_ocaml-compiler }}} {{{ opam-installer js_of_ocaml }}} {{{ opam-installer js_of_ocaml-ppx }}} {{{ opam-installer js_of_ocaml-lwt }}} js_of_ocaml-3.5.2/manual/library.wiki000066400000000000000000000116431357507750000176200ustar00rootroot00000000000000= The Js_of_ocaml library == Base types == Base values are not represented the same way in OCaml and Javascript. In particular, OCaml strings are mutable arrays of bytes, while Javascript strings are constant arrays of UTF-16 code points. We list here the correspondence between base types. Conversion functions are provided. |= OCaml values |= Ocaml type of Javascript values |= Actual Javascript type | | {{{int}}} | {{{int}}} | Number | | {{{float}}} | {{{float}}} | Number | | {{{bool}}} | {{{bool Js.t}}} | Boolean | | {{{string}}} | {{{Js.js_string Js.t}}} | String | | {{{array}}} | {{{Js.js_array Js.t}}} | Array | Integers and floats are implemented as Javascript numbers. They can thus be directly passed to and from Javascript. == Typing Javascript objects == Javascript objects are given types of the shape {{{ Js.t}}}, using a phantom object type. The methods {{{m_i}}} stands for the field of the Javascript object. For instance, a Javascript object of type: {{{ < data : js_string t Js.prop; appendData : js_string t -> unit Js.meth> Js.t }}} has a property {{{data}}} containing a Javascript string, and a method {{{appendData}}} taking a Javascript string as argument and returning no value. === Method name and underscore Some overloading is possible using a syntactic trick: names {{{_foo}}}, {{{foo_abcd}}} and {{{foo}}} are all mapped to a same Javascript field name {{{foo}}}: when accessing a field of an object, the name given in the OCaml code is transformed by removing a leading underscore and then removing all characters starting from the last underscore; this yields the corresponding Javascript name. For instance, these three types correspond to the same Javascript method {{{drawImage}}}: {{{ drawImage : imageElement t -> float -> float -> unit meth drawImage_withSize : imageElement t -> float -> float -> float -> float -> unit meth drawImage_fromCanvas : canvasElement t -> float -> float -> unit meth }}} This trick can also be used to refer to Javascript fields {{{type}}} or {{{Uppercase}}}, for instance as {{{_type}}} and {{{_Uppercase}}}. ==== Example <> == Syntax extension == Two syntax extensions are provided: the <> one and the <> one. This manual is written using the ppx extension, which we advise. == OCaml and Javascript functions == OCaml and Javascript do not follow the same calling convention. In OCaml, functions can be partially applied, returning a function closure. In Javascript, when only some of the parameters are passed, the others are set to the {{{undefined}}} value. As a consequence, it is not possible to call a Javascript function from OCaml as if it was an OCaml function, and conversely. === Calling Javascript functions === At the moment, there is no syntactic sugar for calling Javascript functions. You should use either {{{Js.Unsafe.call}}} or {{{Js.Unsafe.fun_call}}}, depending whether you want {{{this}}} to be bound to some particular object in the function body or not. You can also refer to a Javascript function using an OCaml external declaration. Then, you need to write stub functions in C so that the OCaml compiler accept the external declaration: {{{ Ocaml file: external foo : t1 -> t2 = "foo" C file: #include #define D(f) void f () { exit(1); } D(foo) }}} You can call this function as if it was an OCaml function, as the Javascript function is appropriately wrapped by the system. Refer to <> to link your program with javascript stubs. == IO == The [[../api/js_of_ocaml/Js_of_ocaml/Json/index.html|Json]] module allows to marshal and unmarshal the javascript representation of OCaml values into the corresponding JSON string. The unmarshaling is unsafe in the same way the OCaml {{{Marshal.from_string}}} function is. Type-safe unmarshaling may be achieved with the {{{deriving}}} library using either the optional {{{Json}}} class or the {{{Pickle}}} class. * The {{{Json}}} class use a Json as external representation and do not preserve potential sharings in the data representation. See [[../api/js_of_ocaml/Deriving_Json/index.html|Deriving_Json]] for more information. * The {{{Pickle}}} class use a binary format as external representation and preserve sharings in the data representation. js_of_ocaml-3.5.2/manual/linker.wiki000066400000000000000000000041221357507750000174320ustar00rootroot00000000000000= Link with JavaScript code The Js_of_ocaml compiler accepts JavaScript files provided on the command-line. The main purpose is to provide (external) primitives needed by the bytecode program. Most of the primitives from the standard library are already implemented and loaded by default (located in "runtime.js"). Additionally, some other primitives are installed but not loaded by default: * "+toplevel.js" : when compiling toplevel == Command-line Pass the JavaScript file (must have a ".js" extension) <> Or load it from a findlib package <> The file **jsfile.js** will be looked up inside **mypackage** lib directory. When no package is provided, the compiler will look inside js_of_ocaml-compiler lib directory. == Provide your own JavaScript You may need to provide extra JavaScript files to provide missing primitives or to override existing ones. Primitive code must be annotated with the primitive name and primitive requirements. The linker uses these information to only include the primitive actually used in the program and to perform better deadcode elimination. ===Syntax {{{ //Provides: primitive_name [const|mutable] //Requires: primitive_name[,primitive_name]* //Version: version_constraint[,version_constraint]* function primitive_name(..){ ... JavaScript code ... } }}} * **{{{//Provides}}}** is used to declare a primitive; an annotation can be used to specify the possible side-effects of the primitive: **const** means no side-effect; **mutable** indicates that the primitive has no side-effect but that other primitives might affect the returned value of the primitive; when no annotation is provided, the linker assumes that the primitive may have side-effects. * **{{{//Requires}}}** is used if other primitives need to be loaded first * **version_constraint** looks like "{{{< 4.02.1}}}" * **{{{//Version}}}** is optional and is rarely used All JavaScript code following a **{{{//Provides}}}** annotation is associated to this annotation, until the next **{{{//Provides}}}** annotation. js_of_ocaml-3.5.2/manual/lwt.wiki000066400000000000000000000030731357507750000167600ustar00rootroot00000000000000== Events == Besides the functions provided by {{{Dom_html}}} to register event handlers (mainly [[../api/js_of_ocaml/Js_of_ocaml/Dom_html/index.html#val-addEventListener|Dom_html.addEventListener]]) using the usual Javascript way, js_of_ocaml provides another module to program event handlers very easily and concisely, in the module [[../api/js_of_ocaml-lwt/Js_of_ocaml_lwt/Lwt_js_events/index.html|Lwt_js_events]]. This module defines functions you can call on a DOM element to create an Lwt thread that will return when the event occurs. Example: <>= handler); >> The handler receives the JS event as parameter. Each of these functions has a version (same name with an ending "s") that loops when the handler terminates. Example: <> To remove an event handler, cancel the Lwt threads using {{{Lwt.cancel}}}. It is also possible to use {{{Lwt.pick}}}. For example the following piece of code waits for a click on one of t1 or t2: <>= handler1; Lwt_js_events.click t2 ~>>= handler2] >> Warning: If you are using {{{Lwt.pick}}} and your handlers take time, be aware that other events listeners will not be cancelled before the handler has terminated. It is probably a better idea to return immediately after having launched the long handlers. Look at the [[../api/js_of_ocaml-lwt/Js_of_ocaml_lwt/Lwt_js_events/index.html|Lwt_js_events]] for more information. js_of_ocaml-3.5.2/manual/menu.wiki000066400000000000000000000024211357507750000171120ustar00rootroot00000000000000=Js_of_ocaml - Reference Manual ==[[overview|Overview]] ==[[install|Install]] ==[[library|Library overview]] ==[[bindings|Binding a JS library]] ==[[rev-bindings|Export OCaml code to JavaScript]] ==[[../api/index.html|API]] =Js_of_ocaml_lwt - Reference Manual ==[[lwt|Lwt support]] =Syntaxes ==[[ppx|Ppx syntax extension]] ==[[camlp4|Camlp4 syntax extension]] ==[[ppx-deriving|Ppx deriving json]] =Compiler ==[[options|Command line options]] ==[[linker|Link javascript code]] ==[[separate-compilation|Separate compilation]] ==[[tailcall|About tailcall optimization]] =Misc ==[[debug|How to debug a program]] ==[[contribute|How to contribute]] ==[[performances|Performances]] =Js_of_ocaml examples ==<> ==<> ==<> ==<> ==<> ==<> ==<> ==<> ==<> js_of_ocaml-3.5.2/manual/options.wiki000066400000000000000000000045511357507750000176470ustar00rootroot00000000000000= Main Command-Line options |= Option name |= Description | | --version | Display the version of the compiler | | -o | Set the output filename to | | --source-map | Generate sourcemap | | --opt {1,2,3} | Set the compilation profile (default 1). See **Optimization** section below. | | --pretty | Pretty print javascript output | | --no-inline | Disable code inlining | | --debug-info | Output debug information | | -I dir | Add

to the list of include directories | | --file file[:dir] | Register to the pseudo filesystem and choose the the destination directory (default /) | | --enable