├── .editorconfig ├── .gitattributes ├── .gitignore ├── .prettierignore ├── .prettierrc.yml ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── .yarnclean ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets ├── logo.png └── screenshot.png ├── examples ├── Cats.ml ├── Cats.re ├── Example.ml ├── Example.re ├── Example.rei ├── Species.ml └── Species.re ├── ocaml.configuration.json ├── package.json ├── reason.configuration.json ├── script └── syntax.js ├── snippets └── reason.json ├── src ├── client │ ├── command │ │ ├── doShowAvailableLibraries.ts │ │ ├── doShowMerlinFiles.ts │ │ ├── doShowProjectEnv.ts │ │ ├── doSplitCases.ts │ │ ├── fixEqualsShouldBeArrow.ts │ │ ├── fixMissingSemicolon.ts │ │ ├── fixUnusedVariable.ts │ │ └── index.ts │ ├── index.ts │ └── request │ │ └── index.ts ├── extension.ts └── syntaxes │ ├── basis.ts │ ├── ocaml.ts │ └── schema.ts ├── syntaxes ├── merlin.json ├── ocaml-hover-info.json ├── ocaml-hover-type.json ├── ocaml-markdown-codeblock.json ├── ocaml.json ├── ocamlbuild.json ├── opam.json ├── reason-hover-info.json ├── reason-hover-signature.json ├── reason-hover-type.json ├── reason-markdown-codeblock.json └── reason.json ├── tsconfig.json ├── tslint.json ├── vscode-reasonml.code-workspace └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.gif binary 3 | *.png binary 4 | *.json text eol=lf 5 | *.md text eol=lf 6 | *.ts text eol=lf 7 | .editorconfig text eol=lf 8 | .gitattributes text eol=lf 9 | .gitignore text eol=lf 10 | .vscodeignore text eol=lf 11 | LICENSE text eol=lf 12 | yarn.lock text eol=lf 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | 3 | ### https://raw.github.com/github/gitignore/afbff9027d02ccfc680e031f6c295f79ad61662d/Node.gitignore 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # node-waf configuration 29 | .lock-wscript 30 | 31 | # Compiled binary addons (http://nodejs.org/api/addons.html) 32 | build/Release 33 | 34 | # Dependency directories 35 | node_modules 36 | jspm_packages 37 | 38 | # Optional npm cache directory 39 | .npm 40 | 41 | # Optional eslint cache 42 | .eslintcache 43 | 44 | # Optional REPL history 45 | .node_repl_history 46 | 47 | 48 | ### https://raw.github.com/github/gitignore/afbff9027d02ccfc680e031f6c295f79ad61662d/OCaml.gitignore 49 | 50 | *.annot 51 | *.cmo 52 | *.cma 53 | *.cmi 54 | *.a 55 | *.o 56 | *.cmx 57 | *.cmxs 58 | *.cmxa 59 | 60 | # ocamlbuild working directory 61 | _build/ 62 | 63 | # ocamlbuild targets 64 | *.byte 65 | *.native 66 | 67 | # oasis generated files 68 | setup.data 69 | setup.log 70 | 71 | 72 | ### https://raw.github.com/github/gitignore/afbff9027d02ccfc680e031f6c295f79ad61662d/Global/VisualStudioCode.gitignore 73 | 74 | .vscode/* 75 | !.vscode/settings.json 76 | !.vscode/tasks.json 77 | !.vscode/launch.json 78 | 79 | 80 | ### https://raw.github.com/github/gitignore/afbff9027d02ccfc680e031f6c295f79ad61662d/Global/Linux.gitignore 81 | 82 | *~ 83 | 84 | # temporary files which can be created if a process still has a handle open of a deleted file 85 | .fuse_hidden* 86 | 87 | # KDE directory preferences 88 | .directory 89 | 90 | # Linux trash folder which might appear on any partition or disk 91 | .Trash-* 92 | 93 | 94 | ### https://raw.github.com/github/gitignore/afbff9027d02ccfc680e031f6c295f79ad61662d/Global/macOS.gitignore 95 | 96 | *.DS_Store 97 | .AppleDouble 98 | .LSOverride 99 | 100 | # Icon must end with two \r 101 | Icon 102 | 103 | 104 | # Thumbnails 105 | ._* 106 | 107 | # Files that might appear in the root of a volume 108 | .DocumentRevisions-V100 109 | .fseventsd 110 | .Spotlight-V100 111 | .TemporaryItems 112 | .Trashes 113 | .VolumeIcon.icns 114 | .com.apple.timemachine.donotpresent 115 | 116 | # Directories potentially created on remote AFP share 117 | .AppleDB 118 | .AppleDesktop 119 | Network Trash Folder 120 | Temporary Items 121 | .apdisk 122 | 123 | 124 | ### https://raw.github.com/github/gitignore/afbff9027d02ccfc680e031f6c295f79ad61662d/Global/Windows.gitignore 125 | 126 | # Windows image file caches 127 | Thumbs.db 128 | ehthumbs.db 129 | 130 | # Folder config file 131 | Desktop.ini 132 | 133 | # Recycle Bin used on file shares 134 | $RECYCLE.BIN/ 135 | 136 | # Windows Installer files 137 | *.cab 138 | *.msi 139 | *.msm 140 | *.msp 141 | 142 | # Windows shortcuts 143 | *.lnk 144 | 145 | 146 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reasonml-editor/vscode-reasonml/cfe243cb714415a6d782d39c547b69fd74462179/.prettierignore -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | bracketSpacing: true 2 | jsxBracketSameLine: true 3 | printWidth: 120 4 | semi: true 5 | singleQuote: false 6 | tabWidth: 2 7 | trailingComma: all 8 | useTabs: false 9 | overrides: 10 | - files: "*.ts" 11 | options: 12 | parser: typescript 13 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "EditorConfig.EditorConfig", 4 | "eg2.tslint", 5 | "esbenp.prettier-vscode", 6 | "gamunu.vscode-yarn", 7 | "stkb.rewrap" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Launch Extension", 9 | "type": "extensionHost", 10 | "request": "launch", 11 | "runtimeExecutable": "${execPath}", 12 | "args": ["--extensionDevelopmentPath=${workspaceFolder}"], 13 | "outFiles": ["${workspaceFolder}/out/**/*.js"], 14 | "sourceMaps": true, 15 | "stopOnEntry": false, 16 | "smartStep": true 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.detectIndentation": false, 4 | "editor.insertSpaces": true, 5 | "editor.tabSize": 2, 6 | "editor.trimAutoWhitespace": true, 7 | "editor.wordWrapColumn": 120, 8 | "files.exclude": { 9 | "out": true, 10 | "syntaxes": false, 11 | "node_modules": true, 12 | "yarn.lock": true 13 | }, 14 | "search.exclude": { 15 | "syntaxes": false 16 | }, 17 | "typescript.tsdk": "./node_modules/typescript/lib" 18 | } 19 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "identifier": "build", 8 | "type": "npm", 9 | "script": "build", 10 | "isBackground": false, 11 | "group": { 12 | "kind": "build", 13 | "isDefault": true 14 | }, 15 | "presentation": { 16 | "echo": false, 17 | "reveal": "never", 18 | "focus": false, 19 | "panel": "dedicated" 20 | }, 21 | "problemMatcher": ["$tslint5", "$tsc"] 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | typings/** 3 | out/test/** 4 | test/** 5 | src/** 6 | **/*.map 7 | .gitignore 8 | tsconfig.json 9 | -------------------------------------------------------------------------------- /.yarnclean: -------------------------------------------------------------------------------- 1 | # test directories 2 | __tests__ 3 | test 4 | tests 5 | powered-test 6 | 7 | # asset directories 8 | docs 9 | doc 10 | website 11 | images 12 | assets 13 | 14 | # examples 15 | example 16 | examples 17 | 18 | # code coverage directories 19 | coverage 20 | .nyc_output 21 | 22 | # build scripts 23 | Makefile 24 | Gulpfile.js 25 | Gruntfile.js 26 | 27 | # configs 28 | .tern-project 29 | .gitattributes 30 | .editorconfig 31 | .*ignore 32 | .eslintrc 33 | .jshintrc 34 | .flowconfig 35 | .documentup.json 36 | .yarn-metadata.json 37 | .*.yml 38 | *.yml 39 | 40 | # misc 41 | *.gz 42 | *.md 43 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | * Fix highlighting for punned arguments. 4 | 5 | ## 0.0.99 6 | 7 | * Fix bug with format-on-save. 8 | 9 | ## 0.0.98 10 | 11 | * Added format-on-save thanks to Iwan Karamazow (see the `reason.formatOnSave` setting). 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### This extension is old and unmaintained 2 | 3 | **Please use [VSCode OCaml Platform](https://github.com/ocamllabs/vscode-ocaml-platform)**. If you want to know more about other supported editors, take a look at our documentation: https://reasonml.github.io/docs/en/editor-plugins 4 | -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reasonml-editor/vscode-reasonml/cfe243cb714415a6d782d39c547b69fd74462179/assets/logo.png -------------------------------------------------------------------------------- /assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reasonml-editor/vscode-reasonml/cfe243cb714415a6d782d39c547b69fd74462179/assets/screenshot.png -------------------------------------------------------------------------------- /examples/Cats.ml: -------------------------------------------------------------------------------- 1 | open TyCon 2 | 3 | (* The Sig module collects structure signatures. *) 4 | 5 | module type INITIAL = sig 6 | type t 7 | val gnab : t -> 'a 8 | end 9 | type 't initial = (module INITIAL with type t = 't) 10 | 11 | module type TERMINAL = sig 12 | type t 13 | val bang : 'a -> t 14 | end 15 | type 't terminal = (module TERMINAL with type t = 't) 16 | 17 | module type LEIBNIZ = sig 18 | type ('a, 'b) t 19 | val nope : ('a, 'a) t 20 | val subst : 'f tc1 -> ('a, 'b) t -> (('a, 'f) ap -> ('b, 'f) ap) 21 | end 22 | 23 | module type APART = sig 24 | module I : INITIAL 25 | module L : LEIBNIZ 26 | type ('a, 'b) t = ('a, 'b) L.t -> I.t 27 | end 28 | 29 | module type UNIVERSAL = sig 30 | module T : TC1 31 | type poly = { ap : 'x. 'x T.el } 32 | type t 33 | val into : poly -> t 34 | val from : t -> poly 35 | end 36 | type 'f universal = (module UNIVERSAL with type T.co = 'f) 37 | 38 | module type EXISTENTIAL = sig 39 | module T : TC1 40 | type 'r elim = { ap : 'x. 'x T.el -> 'r } 41 | type t 42 | val into : 'a T.el -> t 43 | val from : t -> ('r elim -> 'r) 44 | end 45 | type 'f existential = (module EXISTENTIAL with type T.co = 'f) 46 | 47 | module type SEMIGROUP = sig 48 | module T : TC0 49 | val op : T.el -> T.el -> T.el 50 | end 51 | type 't semigroup = (module SEMIGROUP with type T.el = 't) 52 | 53 | module type MONOID = sig 54 | include SEMIGROUP 55 | val unit : T.el 56 | end 57 | type 't monoid = (module MONOID with type T.el = 't) 58 | 59 | module type SEMIRING = sig 60 | module T : TC0 61 | val zero : T.el 62 | val add : T.el -> T.el -> T.el 63 | val one : T.el 64 | val mul : T.el -> T.el -> T.el 65 | end 66 | type 't semiring = (module SEMIRING with type T.el = 't) 67 | 68 | module type MODULOSEMIRING = sig 69 | include SEMIRING 70 | val div : T.el -> T.el -> T.el 71 | val modulo : T.el -> T.el -> T.el 72 | end 73 | type 't modulosemiring = (module MODULOSEMIRING with type T.el = 't) 74 | 75 | module type RING = sig 76 | include SEMIRING 77 | val sub : T.el -> T.el -> T.el 78 | end 79 | type 't ring = (module RING with type T.el = 't) 80 | 81 | module type DIVISIONRING = sig 82 | include RING 83 | include MODULOSEMIRING with module T := T 84 | end 85 | type 't divisionring = (module DIVISIONRING with type T.el = 't) 86 | 87 | module type FUNCTOR = sig 88 | module T : TC1 89 | val map : ('a -> 'b) -> ('a T.el -> 'b T.el) 90 | end 91 | type 'f functor' = (module FUNCTOR with type T.co = 'f) 92 | 93 | module type BIFUNCTOR = sig 94 | module T : TC2 95 | val bimap : ('a -> 'b) -> ('c -> 'd) -> (('a, 'c) T.el -> ('b, 'd) T.el) 96 | end 97 | type 'f bifunctor = (module BIFUNCTOR with type T.co = 'f) 98 | 99 | module type PRESHEAF = sig 100 | module T : TC1 101 | val premap : ('a -> 'b) -> ('b T.el -> 'a T.el) 102 | end 103 | type 'f presheaf = (module PRESHEAF with type T.co = 'f) 104 | 105 | module type PROFUNCTOR = sig 106 | module T : TC2 107 | val dimap : ('a -> 'b) -> ('c -> 'd) -> (('b, 'c) T.el -> ('a, 'd) T.el) 108 | end 109 | type 'p profunctor = (module PROFUNCTOR with type T.co = 'p) 110 | 111 | module type SEMIGROUPOID = sig 112 | include PROFUNCTOR 113 | val compose : ('b, 'c) T.el -> ('a, 'b) T.el -> ('a, 'c) T.el 114 | end 115 | type 'hom semigroupoid = (module SEMIGROUPOID with type T.co = 'hom) 116 | 117 | module type CATEGORY = sig 118 | include PROFUNCTOR 119 | val id : ('a, 'a) T.el 120 | end 121 | type 'hom category = (module CATEGORY with type T.co = 'hom) 122 | 123 | module type END = sig 124 | module Hom : PROFUNCTOR 125 | type poly = { ap : 'x. ('x, 'x) Hom.T.el } 126 | type t 127 | val into : poly -> t 128 | val from : t -> poly 129 | end 130 | type 'p end' = (module END with type Hom.T.co = 'p) 131 | 132 | module type COEND = sig 133 | module Hom : PROFUNCTOR 134 | type 'r elim = { ap : 'x. ('x, 'x) Hom.T.el -> 'r } 135 | type t 136 | val into : ('a, 'a) Hom.T.el -> t 137 | val from : t -> ('r elim -> 'r) 138 | end 139 | type 'p coend = (module COEND with type Hom.T.co = 'p) 140 | 141 | module type TRANSFORM = sig 142 | module F : FUNCTOR 143 | module G : FUNCTOR 144 | type t = { ap : 'x. 'x F.T.el -> 'x G.T.el } 145 | end 146 | type ('f, 'g) transform = (module TRANSFORM with type F.T.co = 'f and type G.T.co = 'g) 147 | 148 | (*pullback (along J) *) 149 | module type PULLBACK = sig 150 | module J : TC1 151 | (* J↑* f ≅ f ∘ J *) 152 | type ('x, 'f) t = ('x J.el, 'f) ap 153 | end 154 | type 'j pullback = (module PULLBACK with type J.co = 'j) 155 | 156 | (* left adjoint to the pullback (along J) *) 157 | module type LAN = sig 158 | module J : TC1 159 | module G : TC1 160 | (* J↑* F ≅ F ∘ J *) 161 | module AlongJ : PULLBACK with module J = J 162 | (* Lan J G ⊣ J↑* *) 163 | type 'a lan = Lan : ('x J.el -> 'a) * 'x G.el -> 'a lan 164 | module L : TC1 with type 'a el = 'a lan 165 | type 'f lhs = { lhs : 'x. 'x G.el -> ('x, 'f) AlongJ.t } 166 | type 'f rhs = { rhs : 'x. 'x L.el -> ('x, 'f) ap } 167 | (* (G ~> J↑* F) → (Lan J G ~> F) *) 168 | val into : 'f functor' -> 'f lhs -> 'f rhs 169 | (* (G ~> J↑* F) ← (Lan J G ~> F) *) 170 | val from : 'f functor' -> 'f rhs -> 'f lhs 171 | end 172 | type ('j, 'g) lan = (module LAN with type J.co = 'j and type G.co = 'g) 173 | 174 | (* right adjoint to the pullback (along J) *) 175 | module type RAN = sig 176 | module J : TC1 177 | module G : TC1 178 | (* J↑* F ≅ F ∘ J *) 179 | module AlongJ : PULLBACK with module J = J 180 | (* J↑* ⊣ Ran J G *) 181 | type 'a ran = { ran : 'x. ('a -> 'x J.el) -> 'x G.el } 182 | module R : TC1 with type 'a el = 'a ran 183 | type 'f lhs = { lhs : 'x. ('x, 'f) AlongJ.t -> 'x G.el } 184 | type 'f rhs = { rhs : 'x. ('x, 'f) ap -> 'x R.el } 185 | (* (J↑* F ~> G) → (F ~> Ran J G) *) 186 | val into : 'f functor' -> 'f lhs -> 'f rhs 187 | (* (J↑* F ~> G) ← (F ~> Ran J G) *) 188 | val from : 'f functor' -> 'f rhs -> 'f lhs 189 | end 190 | type ('j, 'g) ran = (module RAN with type J.co = 'j and type G.co = 'g) 191 | 192 | module type COPRODUCT = sig 193 | include BIFUNCTOR 194 | val inl : 'a -> ('a, 'b) T.el 195 | val inr : 'b -> ('a, 'b) T.el 196 | val from : ('a -> 'x) -> ('b -> 'x) -> (('a, 'b) T.el -> 'x) 197 | end 198 | type 't coproduct = (module COPRODUCT with type T.co = 't) 199 | 200 | module type PRODUCT = sig 201 | include BIFUNCTOR 202 | val fst : ('a, 'b) T.el -> 'a 203 | val snd : ('a, 'b) T.el -> 'b 204 | val into : ('x -> 'a) -> ('x -> 'b) -> ('x -> ('a, 'b) T.el) 205 | end 206 | type 't product = (module PRODUCT with type T.co = 't) 207 | 208 | module type APPLY = sig 209 | include FUNCTOR 210 | val apply : ('a -> 'b) T.el -> ('a T.el -> 'b T.el) 211 | end 212 | type 'f apply = (module APPLY with type T.co = 'f) 213 | 214 | module type APPLICATIVE = sig 215 | include APPLY 216 | val pure : 'a -> 'a T.el 217 | end 218 | type 'f applicative = (module APPLICATIVE with type T.co = 'f) 219 | 220 | module type BIND = sig 221 | include APPLY 222 | val bind : 'a T.el -> ('a -> 'b T.el) -> 'b T.el 223 | end 224 | type 'm bind = (module BIND with type T.co = 'm) 225 | 226 | module type MONAD = sig 227 | include APPLICATIVE 228 | include BIND with module T := T 229 | end 230 | type 'm monad = (module MONAD with type T.co = 'm) 231 | 232 | module type EXTEND = sig 233 | include FUNCTOR 234 | val extend : 'a T.el -> ('a T.el -> 'b) -> 'b T.el 235 | end 236 | type 'w extend = (module EXTEND with type T.co = 'w) 237 | 238 | module type COMONAD = sig 239 | include EXTEND 240 | val extract : 'a T.el -> 'a 241 | end 242 | type 'w comonad = (module COMONAD with type T.co = 'w) 243 | 244 | module type FOLDABLE = sig 245 | module T : TC1 246 | val fold_map : 'm monoid -> ('a -> 'm) -> ('a T.el -> 'm) 247 | end 248 | type 'f foldable = (module FOLDABLE with type T.co = 'f) 249 | 250 | module type TRAVERSABLE = sig 251 | include FUNCTOR 252 | include FOLDABLE with module T := T 253 | val traverse : 'm applicative -> ('a -> ('b, 'm) ap) -> ('a T.el -> ('b T.el, 'm) ap) 254 | end 255 | type 'f traversable = (module TRAVERSABLE with type T.co = 'f) 256 | 257 | module type BIAPPLY = sig 258 | include BIFUNCTOR 259 | val biapply : ('a -> 'b, 'c -> 'd) T.el -> ('a, 'c) T.el -> ('b, 'd) T.el 260 | end 261 | type 'f biapply = (module BIAPPLY with type T.co = 'f) 262 | 263 | module type BIAPPLICATIVE = sig 264 | include BIAPPLY 265 | val bipure : 'a -> 'b -> ('a, 'b) T.el 266 | end 267 | type 'f biapplicative = (module BIAPPLICATIVE with type T.co = 'f) 268 | 269 | module type BIFOLDABLE = sig 270 | module T : TC2 271 | val bifold_map : 'm monoid -> ('a -> 'm) -> ('b -> 'm) -> (('a, 'b) T.el -> 'm) 272 | end 273 | type 'f bifoldable = (module BIFOLDABLE with type T.co = 'f) 274 | 275 | module type BITRAVERSABLE = sig 276 | include BIFUNCTOR 277 | include BIFOLDABLE with module T := T 278 | val bitraverse : 'm applicative -> ('a -> ('c, 'm) ap) -> ('b -> ('d, 'm) ap) -> (('a, 'b) T.el -> (('c, 'd) T.el, 'm) ap) 279 | end 280 | type 'f bitraversable = (module BITRAVERSABLE with type T.co = 'f) 281 | -------------------------------------------------------------------------------- /examples/Cats.re: -------------------------------------------------------------------------------- 1 | open TyCon; 2 | 3 | /* The Sig module collects structure signatures. */ 4 | module type INITIAL = { 5 | type t; 6 | let gnab: t => 'a; 7 | }; 8 | type initial 't = (module INITIAL with type t = 't); 9 | 10 | module type TERMINAL = { 11 | type t; 12 | let bang: 'a => t; 13 | }; 14 | type terminal 't = (module TERMINAL with type t = 't); 15 | 16 | module type LEIBNIZ = { 17 | type t 'a 'b; 18 | let refl: t 'a 'a; 19 | let subst: tc1 'f => t 'a 'b => (ap 'f 'a => ap 'f 'b); 20 | }; 21 | 22 | module type APART = { 23 | let module I: INITIAL; 24 | let module L: LEIBNIZ; 25 | type t 'a 'b = L.t 'a 'b => I.t; 26 | }; 27 | 28 | module type UNIVERSAL = { 29 | let module T: TC1; 30 | type poly = { ap: 'x. T.el 'x }; 31 | type t; 32 | let into: poly => t; 33 | let from: t => poly; 34 | }; 35 | type universal 'f = (module UNIVERSAL with type T.co = 'f); 36 | 37 | module type EXISTENTIAL = { 38 | let module T: TC1; 39 | type elim 'r = { ap: 'x. T.el 'x => 'r }; 40 | type t; 41 | let into: T.el 'a => t; 42 | let from: t => elim 'r => 'r; 43 | }; 44 | type existential 'f = (module EXISTENTIAL with type T.co = 'f); 45 | 46 | module type SEMIGROUP = { 47 | let module T: TC0; 48 | let op: T.el => T.el => T.el; 49 | }; 50 | type semigroup 't = (module SEMIGROUP with type T.el = 't); 51 | 52 | module type MONOID = { 53 | include SEMIGROUP; 54 | let unit: T.el; 55 | }; 56 | type monoid 't = (module MONOID with type T.el = 't); 57 | 58 | module type SEMIRING = { 59 | let module T: TC0; 60 | let zero: T.el; 61 | let add: T.el => T.el => T.el; 62 | let one: T.el; 63 | let mul: T.el => T.el => T.el; 64 | }; 65 | type semiring 't = (module SEMIRING with type T.el = 't); 66 | 67 | module type MODULOSEMIRING = { 68 | include SEMIRING; 69 | let div: T.el => T.el => T.el; 70 | let modulo: T.el => T.el => T.el; 71 | }; 72 | type moduloSemiring 't = (module MODULOSEMIRING with type T.el = 't); 73 | 74 | module type RING = { 75 | include SEMIRING; 76 | let sub: T.el => T.el => T.el; 77 | }; 78 | type ring 't = (module RING with type T.el ='t); 79 | 80 | module type DIVISIONRING = { 81 | include RING; 82 | include MODULOSEMIRING with module T := T; 83 | }; 84 | type divisionring 't = (module DIVISIONRING with type T.el = 't); 85 | 86 | module type FUNCTOR = { 87 | let module T: TC1; 88 | let map: ('a => 'b) => (T.el 'a => T.el 'b); 89 | }; 90 | type functor' 'f = (module FUNCTOR with type T.co = 'f); 91 | 92 | module type BIFUNCTOR = { 93 | let module T: TC2; 94 | let bimap: ('a => 'b) => ('c => 'd) => (T.el 'a 'c => T.el 'b 'd); 95 | }; 96 | type bifunctor 'f = (module BIFUNCTOR with type T.co = 'f); 97 | 98 | module type PRESHEAF = { 99 | let module T: TC1; 100 | let premap: ('a => 'b) => T.el 'b => T.el 'a; 101 | }; 102 | type presheaf 'f = (module PRESHEAF with type T.co = 'f); 103 | 104 | module type PROFUNCTOR = { 105 | let module T: TC2; 106 | let dimap: ('a => 'b) => ('c => 'd) => (T.el 'b 'c => T.el 'a 'd); 107 | }; 108 | type profunctor 'p = (module PROFUNCTOR with type T.co = 'p); 109 | 110 | module type SEMIGROUPOID = { 111 | include PROFUNCTOR; 112 | let compose: T.el 'b 'c => T.el 'a 'b => T.el 'a 'c; 113 | }; 114 | type semigroupoid 'hom = (module SEMIGROUPOID with type T.co = 'hom); 115 | 116 | module type CATEGORY = { 117 | include PROFUNCTOR; 118 | let id: T.el 'a 'a; 119 | }; 120 | type category 'hom = (module CATEGORY with type T.co = 'hom); 121 | 122 | module type END = { 123 | let module Hom: PROFUNCTOR; 124 | type poly = { ap: 'x. Hom.T.el 'x 'x }; 125 | type t; 126 | let into: poly => t; 127 | let from: t => poly; 128 | }; 129 | type end' 'p = (module END with type Hom.T.co = 'p); 130 | 131 | module type COEND = { 132 | let module Hom: PROFUNCTOR; 133 | type elim 'r = { ap: 'x. Hom.T.el 'x 'x => 'r }; 134 | type t; 135 | let into: Hom.T.el 'a 'a => t; 136 | let from: t => elim 'r => 'r; 137 | }; 138 | type coend 'p = (module COEND with type Hom.T.co = 'p); 139 | 140 | module type TRANSFORM = { 141 | let module F: FUNCTOR; 142 | let module G: FUNCTOR; 143 | type t = { ap: 'x .F.T.el 'x => G.T.el 'x }; 144 | }; 145 | type transform 'f 'g = (module TRANSFORM with type F.T.co = 'f and type G.T.co = 'g); 146 | 147 | /* pullback (along J) */ 148 | module type PULLBACK = { 149 | let module J: TC1; 150 | /* J↑* f ≅ f ∘ J */ 151 | type t 'f 'x = ap 'f (J.el 'x); 152 | }; 153 | type pullback 'j = (module PULLBACK with type J.co = 'j); 154 | 155 | /* left adjoint to the pullback (along J) */ 156 | module type LAN = { 157 | let module J: TC1; 158 | let module G: TC1; 159 | /* J↑* F ≅ F ∘ J */ 160 | let module AlongJ: PULLBACK with module J = J; 161 | /* Lan J G ⊣ J↑* */ 162 | type lan 'a = 163 | | Lan (J.el 'x => 'a) (G.el 'x): lan 'a; 164 | let module L: TC1 with type el 'a = lan 'a; 165 | type lhs 'f = { lhs: 'x. G.el 'x => AlongJ.t 'f 'x }; 166 | type rhs 'f = { rhs: 'x. L.el 'x => ap 'f 'x }; 167 | /* (G ~> J↑* F) → (Lan J G ~> F) */ 168 | let into: functor' 'f => lhs 'f => rhs 'f; 169 | /* (G ~> J↑* F) ← (Lan J G ~> F) */ 170 | let from: functor' 'f => rhs 'f => lhs 'f; 171 | }; 172 | type lan 'j 'g = (module LAN with type J.co = 'j and type G.co = 'g); 173 | 174 | /* right adjoint to the pullback (along J) */ 175 | module type RAN = { 176 | let module J: TC1; 177 | let module G: TC1; 178 | /* J↑* F ≅ F ∘ J */ 179 | let module AlongJ: PULLBACK with module J = J; 180 | /* J↑* ⊣ Ran J G */ 181 | type ran 'a = { ran: 'x. ('a => J.el 'x) => G.el 'x }; 182 | let module R: TC1 with type el 'a = ran 'a; 183 | type lhs 'f = { lhs: 'x. AlongJ.t 'f 'x => G.el 'x }; 184 | type rhs 'f = { rhs: 'x. ap 'f 'x => R.el 'x }; 185 | /* (J↑* F ~> G) → (F ~> Ran J G) */ 186 | let into: functor' 'f => lhs 'f => rhs 'f; 187 | /* (J↑* F ~> G) ← (F ~> Ran J G) */ 188 | let from: functor' 'f => rhs 'f => lhs 'f; 189 | }; 190 | type ran 'j 'g = (module RAN with type J.co = 'j and type G.co = 'g); 191 | 192 | module type COPRODUCT = { 193 | include BIFUNCTOR; 194 | let inl: 'a => T.el 'a 'b; 195 | let inr: 'b => T.el 'a 'b; 196 | let from: ('a => 'x) => ('b => 'x) => T.el 'a 'b => 'x; 197 | }; 198 | type coproduct 't = (module COPRODUCT with type T.co = 't); 199 | 200 | module type PRODUCT = { 201 | include BIFUNCTOR; 202 | let fst: T.el 'a 'b => 'a; 203 | let snd: T.el 'a 'b => 'b; 204 | let into: ('x => 'a) => ('x => 'b) => 'x => T.el 'a 'b; 205 | }; 206 | type product 't = (module PRODUCT with type T.co = 't); 207 | 208 | module type APPLY = { 209 | include FUNCTOR; 210 | let apply: T.el ('a => 'b) => T.el 'a => T.el 'b; 211 | }; 212 | type apply 'f = (module APPLY with type T.co = 'f); 213 | 214 | module type APPLICATIVE = { 215 | include APPLY; 216 | let pure: 'a => T.el 'a; 217 | }; 218 | type applicative 'f = (module APPLICATIVE with type T.co = 'f); 219 | 220 | module type BIND = { 221 | include APPLY; 222 | let bind: T.el 'a => ('a => T.el 'b) => T.el 'b; 223 | }; 224 | type bind 'm = (module BIND with type T.co = 'm); 225 | 226 | module type MONAD = { 227 | include APPLICATIVE; 228 | include BIND with module T := T; 229 | }; 230 | type monad 'm = (module MONAD with type T.co = 'm); 231 | 232 | module type EXTEND = { 233 | include FUNCTOR; 234 | let extend: T.el 'a => (T.el 'a => 'b) => T.el 'b; 235 | }; 236 | type extend 'w = (module EXTEND with type T.co = 'w); 237 | 238 | module type COMONAD = { 239 | include EXTEND; 240 | let extract: T.el 'a => 'a; 241 | }; 242 | type comonad 'w = (module COMONAD with type T.co = 'w); 243 | 244 | module type FOLDABLE = { 245 | let module T: TC1; 246 | let fold_map: monoid 'm => ('a => 'm) => T.el 'a => 'm; 247 | }; 248 | type foldable 'f = (module FOLDABLE with type T.co = 'f); 249 | 250 | module type TRAVERSABLE = { 251 | include FUNCTOR; 252 | include FOLDABLE with module T := T; 253 | let traverse: applicative 'm => ('a => ap 'm 'b) => T.el 'a => ap 'm (T.el 'b); 254 | }; 255 | type traversable 'f = (module TRAVERSABLE with type T.co = 'f); 256 | 257 | module type BIAPPLY = { 258 | include BIFUNCTOR; 259 | let biapply: T.el ('a => 'b) ('c => 'd) => (T.el 'a 'c => T.el 'b 'd); 260 | }; 261 | type biapply 'f = (module BIAPPLY with type T.co = 'f); 262 | 263 | module type BIAPPLICATIVE = { 264 | include BIAPPLY; 265 | let bipure: 'a => 'b => T.el 'a 'b; 266 | }; 267 | type biapplicative 'f = (module BIAPPLICATIVE with type T.co = 'f); 268 | 269 | module type BIFOLDABLE = { 270 | let module T: TC2; 271 | let bifold_map: monoid 'm => ('a => 'm) => ('b => 'm) => T.el 'a 'b => 'm; 272 | }; 273 | type bifoldable 'f = (module BIFOLDABLE with type T.co = 'f); 274 | 275 | module type BITRAVERSABLE = { 276 | include BIFUNCTOR; 277 | include BIFOLDABLE with module T := T; 278 | let bitraverse: applicative 'm => ('a => ap 'm 'c) => ('b => ap 'm 'd) => T.el 'a 'b => ap 'm (T.el 'c 'd); 279 | }; 280 | type bitraversable 'f = (module BITRAVERSABLE with type T.co = 'f); 281 | -------------------------------------------------------------------------------- /examples/Example.ml: -------------------------------------------------------------------------------- 1 | class foo bar baz = object 2 | method field0 = bar + 1 3 | method field1 = baz ^ "" 4 | end 5 | -------------------------------------------------------------------------------- /examples/Example.re: -------------------------------------------------------------------------------- 1 | let module List: { 2 | type t 'a = 3 | | Nil 4 | | Cons 'a (t 'a) 5 | ; 6 | let nil: t 'a; 7 | let cons: 'a => t 'a => t 'a; 8 | let append: t 'a => t 'a => t 'a; 9 | let from: list 'a => t 'a; 10 | } = { 11 | type t 'a = 12 | | Nil 13 | | Cons 'a (t 'a) 14 | ; 15 | let nil = Nil; 16 | let cons x xs => Cons x xs; 17 | let rec append xs ys => 18 | switch xs { 19 | | Nil => ys 20 | | Cons x xs => Cons x (append xs ys) 21 | }; 22 | let rec from = fun 23 | | [] => Nil 24 | | [x, ...xs] => Cons x (from xs) 25 | ; 26 | }; 27 | -------------------------------------------------------------------------------- /examples/Example.rei: -------------------------------------------------------------------------------- 1 | type t 'a = 2 | | Nil 3 | | Cons 'a (t 'a) 4 | ; 5 | 6 | let nil: t 'a; 7 | let cons: 'a => t 'a => t 'a; 8 | let append: t 'a => t 'a => t 'a; 9 | let from: list 'a => t 'a; 10 | -------------------------------------------------------------------------------- /examples/Species.ml: -------------------------------------------------------------------------------- 1 | open Cats 2 | open TyCon 3 | 4 | module Pre = 5 | struct 6 | type 'a t = 'a GenClone.prependable 7 | 8 | let of_gen xs = xs 9 | |> GenMList.of_gen 10 | |> GenMList.to_clonable 11 | |> GenClone.to_prependable 12 | 13 | let of_list xs = 14 | Gen.of_list xs 15 | |> of_gen 16 | 17 | let map f xs = 18 | Gen.map f xs#gen 19 | |> of_gen 20 | 21 | let empty () = 22 | Gen.empty 23 | |> of_gen 24 | 25 | let singleton a = 26 | Gen.singleton a 27 | |> of_gen 28 | 29 | let append xs ys = 30 | Gen.append xs#gen ys#gen 31 | |> of_gen 32 | 33 | let splits xs = 34 | let fst f (x, y) = (f x, y) in 35 | let snd f (x, y) = (x, f y) in 36 | let rec go xs = 37 | match Gen.next xs#gen with 38 | | None -> 39 | singleton ((empty (), empty ())) 40 | | Some(x) -> 41 | append 42 | (map (fst (fun ys -> ys#prepend x; ys)) (go xs#clone)) 43 | (map (snd (fun ys -> ys#prepend x; ys)) (go xs#clone)) in 44 | go xs 45 | end 46 | 47 | module Seq = 48 | struct 49 | type 'a t = 'a GenClone.clonable 50 | 51 | let of_gen xs = xs 52 | |> GenMList.of_gen 53 | |> GenMList.to_clonable 54 | 55 | let of_pre (xs : 'a Pre.t) = 56 | xs#gen 57 | |> of_gen 58 | 59 | let of_list xs = 60 | Gen.of_list xs 61 | |> of_gen 62 | 63 | let to_list xs = 64 | xs#gen 65 | |> Gen.to_list 66 | 67 | let map f xs = 68 | GenClone.map f xs 69 | 70 | let empty () = 71 | Gen.empty 72 | |> of_gen 73 | 74 | let singleton a = 75 | Gen.singleton a 76 | |> of_gen 77 | 78 | let append xs ys = 79 | Gen.append xs#gen ys#gen 80 | |> of_gen 81 | 82 | let interleave xs ys = 83 | Gen.interleave xs#gen ys#gen 84 | |> of_gen 85 | 86 | let permutations xs = 87 | Gen.permutations xs#gen 88 | |> of_gen 89 | 90 | let splits xs = 91 | xs#gen 92 | |> Pre.of_gen 93 | |> Pre.splits 94 | |> Pre.map (fun (x, y) -> (of_pre x, of_pre y)) 95 | |> of_pre 96 | end 97 | 98 | module type Enum = 99 | sig 100 | module T : TC1 101 | val enum : 'a Seq.t -> 'a T.el Seq.t 102 | val to_list : ('a, T.co) ap Seq.t -> 'a T.el list 103 | end 104 | (*type 'f enum = (module Enum with type T.co = 'f)*) 105 | 106 | module type Pack = 107 | sig 108 | include Enum 109 | val pack : T.co enum 110 | end 111 | 112 | module Void : 113 | sig 114 | type 'a t 115 | module T : TC1 with type 'a el = 'a t 116 | include Pack with module T := T 117 | end = 118 | struct 119 | module Def = 120 | struct 121 | type 'a t 122 | module T = TC1(struct type nonrec 'a t = 'a t end) 123 | let enum xs = Seq.empty () 124 | let to_list xs = Seq.map T.el xs |> Seq.to_list 125 | end 126 | include Def 127 | let pack : Def.T.co enum = (module Def) 128 | end 129 | 130 | module Unit : 131 | sig 132 | type 'a t = Unit 133 | module T : TC1 with type 'a el = 'a t 134 | include Pack with module T := T 135 | end = 136 | struct 137 | module Def = 138 | struct 139 | type 'a t = Unit 140 | module T = TC1(struct type nonrec 'a t = 'a t end) 141 | let enum xs = 142 | match Gen.next xs#gen with 143 | | None -> Seq.singleton Unit 144 | | Some(_) -> Seq.empty () 145 | let to_list xs = Seq.map T.el xs |> Seq.to_list 146 | end 147 | include Def 148 | let pack : Def.T.co enum = (module Def) 149 | end 150 | 151 | module Add (F : Pack) (G : Pack) : 152 | sig 153 | type 'a t = 154 | | Inl of 'a F.T.el 155 | | Inr of 'a G.T.el 156 | module T : TC1 with type 'a el = 'a t 157 | include Pack with module T := T 158 | end = 159 | struct 160 | module Def = 161 | struct 162 | type 'a t = 163 | | Inl of 'a F.T.el 164 | | Inr of 'a G.T.el 165 | module T = TC1(struct type nonrec 'a t = 'a t end) 166 | let enum xs = 167 | let lhs = Seq.map (fun x -> Inl x) (F.enum xs#clone) in 168 | let rhs = Seq.map (fun x -> Inr x) (G.enum xs#clone) in 169 | Seq.interleave lhs rhs 170 | let to_list xs = Seq.map T.el xs |> Seq.to_list 171 | end 172 | include Def 173 | let pack : Def.T.co enum = (module Def) 174 | end 175 | 176 | module Mul (F : Pack) (G : Pack) : 177 | sig 178 | type 'a t = 'a F.T.el * 'a G.T.el 179 | module T : TC1 with type 'a el = 'a t 180 | include Pack with module T := T 181 | end = 182 | struct 183 | module Def = 184 | struct 185 | type 'a t = 'a F.T.el * 'a G.T.el 186 | module T = TC1(struct type nonrec 'a t = 'a t end) 187 | 188 | let enum xs = 189 | let go0 (fls, gls) = 190 | let go1 x = 191 | let go2 y = 192 | Gen.singleton (x, y) in 193 | Gen.flat_map go2 (G.enum gls)#gen in 194 | Gen.flat_map go1 (F.enum fls)#gen in 195 | Gen.flat_map go0 (Seq.splits xs)#gen 196 | |> Seq.of_gen 197 | 198 | let to_list xs = Seq.map T.el xs |> Seq.to_list 199 | end 200 | include Def 201 | let pack : Def.T.co enum = (module Def) 202 | end 203 | 204 | module Sing : 205 | sig 206 | type 'a t = X of 'a 207 | module T : TC1 with type 'a el = 'a t 208 | include Pack with module T := T 209 | end = 210 | struct 211 | module Def = 212 | struct 213 | type 'a t = X of 'a 214 | module T = TC1(struct type nonrec 'a t = 'a t end) 215 | let enum xs = 216 | begin 217 | match Gen.next xs#gen with 218 | | None -> Seq.empty () 219 | | Some(x) -> 220 | begin 221 | match Gen.next xs#gen with 222 | | None -> 223 | Seq.singleton (X(x)) 224 | | Some(y) -> 225 | Seq.empty () 226 | end 227 | end 228 | let to_list xs = Seq.map T.el xs |> Seq.to_list 229 | end 230 | include Def 231 | let pack : Def.T.co enum = (module Def) 232 | end 233 | 234 | module Linear : 235 | sig 236 | type 'a t = 'a list 237 | module T : TC1 with type 'a el = 'a t 238 | include Pack with module T := T 239 | end = 240 | struct 241 | module Def = 242 | struct 243 | type 'a t = 'a list 244 | module T = TC1(struct type nonrec 'a t = 'a t end) 245 | let enum = Seq.permutations 246 | let to_list xs = Seq.map T.el xs |> Seq.to_list 247 | end 248 | include Def 249 | let pack : Def.T.co enum = (module Def) 250 | end 251 | 252 | module Species = 253 | struct 254 | let enum (type f) (e : f enum) xs = 255 | let module E = (val e) in 256 | Seq.map E.T.co (E.enum xs) 257 | end 258 | 259 | module Test = 260 | struct 261 | let ex0 : int Void.t list = 262 | Species.enum Void.pack (Seq.of_list [0; 1; 2; 3; 4]) 263 | |> Void.to_list 264 | 265 | let ex1 : int Sing.t list = 266 | Species.enum Sing.pack (Seq.of_list [0; 1; 2; 3; 4]) 267 | |> Sing.to_list 268 | 269 | let ex2 : int Sing.t list = 270 | Species.enum Sing.pack (Seq.singleton 2) 271 | |> Sing.to_list 272 | 273 | let ex3 : int Add(Linear)(Void).t list = 274 | let module M = Add(Linear)(Void) in 275 | Species.enum M.pack (Seq.of_list [0; 1]) 276 | |> M.to_list 277 | 278 | let ex4 : int Mul(Linear)(Void).t list = 279 | let module M = Mul(Linear)(Void) in 280 | Species.enum M.pack (Seq.of_list [0; 1]) 281 | |> M.to_list 282 | 283 | let ex5 : int Mul(Unit)(Linear).t list = 284 | let module M = Mul(Unit)(Linear) in 285 | Species.enum M.pack (Seq.of_list [0; 1]) 286 | |> M.to_list 287 | 288 | let ex6 : int Add(Linear)(Mul(Unit)(Linear)).t list = 289 | let module M = Add(Linear)(Mul(Unit)(Linear)) in 290 | Species.enum M.pack (Seq.of_list [0; 1; 2]) 291 | |> M.to_list 292 | 293 | (* output: 294 | [ M.Inl [2; 1; 0] 295 | ; M.Inr (Unit, [2; 1; 0]) 296 | ; M.Inl [1; 2; 0] 297 | ; M.Inr (Unit, [1; 2; 0]) 298 | ; M.Inl [1; 0; 2] 299 | ; M.Inr (Unit, [1; 0; 2]) 300 | ; M.Inl [2; 0; 1] 301 | ; M.Inr (Unit, [2; 0; 1]) 302 | ; M.Inl [0; 2; 1] 303 | ; M.Inr (Unit, [0; 2; 1]) 304 | ; M.Inl [0; 1; 2] 305 | ; M.Inr (Unit, [0; 1; 2]) 306 | ] 307 | *) 308 | end 309 | -------------------------------------------------------------------------------- /examples/Species.re: -------------------------------------------------------------------------------- 1 | open Cats; 2 | open TyCon; 3 | 4 | let module Pre = { 5 | type t 'a = GenClone.prependable 'a; 6 | let of_gen xs => xs |> GenMList.of_gen |> GenMList.to_clonable |> GenClone.to_prependable; 7 | let of_list xs => Gen.of_list xs |> of_gen; 8 | let map f xs => Gen.map f xs#gen |> of_gen; 9 | let empty () => Gen.empty |> of_gen; 10 | let singleton a => Gen.singleton a |> of_gen; 11 | let append xs ys => Gen.append xs#gen ys#gen |> of_gen; 12 | let splits xs => { 13 | let fst f (x, y) => (f x, y); 14 | let snd f (x, y) => (x, f y); 15 | let rec go xs => 16 | switch (Gen.next xs#gen) { 17 | | None => singleton (empty (), empty ()) 18 | | Some x => 19 | append 20 | (map (fst (fun ys => { ys#prepend x; ys })) (go xs#clone)) 21 | (map (snd (fun ys => { ys#prepend x; ys })) (go xs#clone)) 22 | }; 23 | go xs 24 | }; 25 | }; 26 | 27 | let module Seq = { 28 | type t 'a = GenClone.clonable 'a; 29 | let of_gen xs => xs |> GenMList.of_gen |> GenMList.to_clonable; 30 | let of_pre (xs: Pre.t 'a) => xs#gen |> of_gen; 31 | let of_list xs => Gen.of_list xs |> of_gen; 32 | let to_list xs => xs#gen |> Gen.to_list; 33 | let map f xs => GenClone.map f xs; 34 | let empty () => Gen.empty |> of_gen; 35 | let singleton a => Gen.singleton a |> of_gen; 36 | let append xs ys => Gen.append xs#gen ys#gen |> of_gen; 37 | let interleave xs ys => Gen.interleave xs#gen ys#gen |> of_gen; 38 | let permutations xs => Gen.permutations xs#gen |> of_gen; 39 | let splits xs => xs#gen 40 | |> Pre.of_gen 41 | |> Pre.splits 42 | |> Pre.map (fun (x, y) => (of_pre x, of_pre y)) 43 | |> of_pre; 44 | }; 45 | 46 | module type Enum = { 47 | let module T: TC1; 48 | let enum: Seq.t 'a => Seq.t (T.el 'a); 49 | let to_list: Seq.t (ap 'a T.co) => list (T.el 'a); 50 | }; 51 | 52 | type enum 'f = (module Enum with type T.co = 'f); 53 | 54 | module type Pack = { 55 | include Enum; 56 | let pack: enum T.co; 57 | }; 58 | 59 | let module Void: { 60 | type t 'a; 61 | let module T: TC1 with type el 'a = t 'a; 62 | include Pack with module T := T; 63 | } = { 64 | let module Def = { 65 | type t 'a; 66 | let module T = TC1 { type nonrec t 'a = t 'a }; 67 | let enum xs => Seq.empty (); 68 | let to_list xs => Seq.map T.el xs |> Seq.to_list; 69 | }; 70 | include Def; 71 | let pack: enum Def.T.co = (module Def); 72 | }; 73 | 74 | let module Unit: { 75 | type t 'a = Unit; 76 | let module T: TC1 with type el 'a = t 'a; 77 | include Pack with module T := T; 78 | } = { 79 | let module Def = { 80 | type t 'a = Unit; 81 | let module T = TC1 { type nonrec t 'a = t 'a; }; 82 | let enum xs => 83 | switch (Gen.next xs#gen) { 84 | | None => Seq.singleton Unit 85 | | Some _ => Seq.empty () 86 | }; 87 | let to_list xs => Seq.map T.el xs |> Seq.to_list; 88 | }; 89 | include Def; 90 | let pack: enum Def.T.co = (module Def); 91 | }; 92 | 93 | let module Add (F: Pack) (G: Pack): { 94 | type t 'a = 95 | | Inl (F.T.el 'a) 96 | | Inr (G.T.el 'a); 97 | let module T: TC1 with type el 'a = t 'a; 98 | include Pack with module T := T; 99 | } => { 100 | let module Def = { 101 | type t 'a = 102 | | Inl (F.T.el 'a) 103 | | Inr (G.T.el 'a); 104 | let module T = TC1 { type nonrec t 'a = t 'a }; 105 | let enum xs => { 106 | let lhs = Seq.map (fun x => Inl x) (F.enum xs#clone); 107 | let rhs = Seq.map (fun x => Inr x) (G.enum xs#clone); 108 | Seq.interleave lhs rhs 109 | }; 110 | let to_list xs => Seq.map T.el xs |> Seq.to_list; 111 | }; 112 | include Def; 113 | let pack: enum Def.T.co = (module Def); 114 | }; 115 | 116 | let module Mul (F: Pack) (G: Pack): { 117 | type t 'a = (F.T.el 'a, G.T.el 'a); 118 | let module T: TC1 with type el 'a = t 'a; 119 | include Pack with module T := T; 120 | } => { 121 | let module Def = { 122 | type t 'a = (F.T.el 'a, G.T.el 'a); 123 | let module T = TC1 { type nonrec t 'a = t 'a }; 124 | let enum xs => { 125 | let go0 (fls, gls) => { 126 | let go1 x => { 127 | let go2 y => Gen.singleton (x, y); 128 | Gen.flat_map go2 (G.enum gls)#gen 129 | }; 130 | Gen.flat_map go1 (F.enum fls)#gen 131 | }; 132 | Gen.flat_map go0 (Seq.splits xs)#gen |> Seq.of_gen 133 | }; 134 | let to_list xs => Seq.map T.el xs |> Seq.to_list; 135 | }; 136 | include Def; 137 | let pack: enum Def.T.co = (module Def); 138 | }; 139 | 140 | let module Sing: { 141 | type t 'a = X 'a; 142 | let module T: TC1 with type el 'a = t 'a; 143 | include Pack with module T := T; 144 | } = { 145 | let module Def = { 146 | type t 'a = X 'a; 147 | let module T = TC1 { 148 | type nonrec t 'a = t 'a; 149 | }; 150 | let enum xs => 151 | switch (Gen.next xs#gen) { 152 | | None => Seq.empty () 153 | | Some x => 154 | switch (Gen.next xs#gen) { 155 | | None => Seq.singleton (X x) 156 | | Some y => Seq.empty () 157 | } 158 | }; 159 | let to_list xs => Seq.map T.el xs |> Seq.to_list; 160 | }; 161 | include Def; 162 | let pack: enum Def.T.co = (module Def); 163 | }; 164 | 165 | let module Linear: { 166 | type t 'a = list 'a; 167 | let module T: TC1 with type el 'a = t 'a; 168 | include Pack with module T := T; 169 | } = { 170 | let module Def = { 171 | type t 'a = list 'a; 172 | let module T = TC1 { type nonrec t 'a = t 'a }; 173 | let enum = Seq.permutations; 174 | let to_list xs => Seq.map T.el xs |> Seq.to_list; 175 | }; 176 | include Def; 177 | let pack: enum Def.T.co = (module Def); 178 | }; 179 | 180 | let module Species = { 181 | let enum (type f) (e: enum f) xs => { 182 | let module E = (val e); 183 | Seq.map E.T.co (E.enum xs) 184 | }; 185 | }; 186 | 187 | let module Test = { 188 | let ex0: list (Void.t int) = 189 | Species.enum Void.pack (Seq.of_list [0, 1, 2, 3, 4]) |> Void.to_list; 190 | let ex1: list (Sing.t int) = 191 | Species.enum Sing.pack (Seq.of_list [0, 1, 2, 3, 4]) |> Sing.to_list; 192 | let ex2: list (Sing.t int) = Species.enum Sing.pack (Seq.singleton 2) |> Sing.to_list; 193 | let ex3: list (Add(Linear)(Void).t int) = { 194 | let module M = Add Linear Void; 195 | Species.enum M.pack (Seq.of_list [0, 1]) |> M.to_list 196 | }; 197 | let ex4: list (Mul(Linear)(Void).t int) = { 198 | let module M = Mul Linear Void; 199 | Species.enum M.pack (Seq.of_list [0, 1]) |> M.to_list 200 | }; 201 | let ex5: list (Mul(Unit)(Linear).t int) = { 202 | let module M = Mul Unit Linear; 203 | Species.enum M.pack (Seq.of_list [0, 1]) |> M.to_list 204 | }; 205 | let ex6: list (Add(Linear)(Mul(Unit)(Linear)).t int) = { 206 | let module M = Add Linear(Mul Unit Linear); 207 | Species.enum M.pack (Seq.of_list [0, 1, 2]) |> M.to_list 208 | }; 209 | /* output: 210 | [ M.Inl [2; 1; 0] 211 | ; M.Inr (Unit, [2; 1; 0]) 212 | ; M.Inl [1; 2; 0] 213 | ; M.Inr (Unit, [1; 2; 0]) 214 | ; M.Inl [1; 0; 2] 215 | ; M.Inr (Unit, [1; 0; 2]) 216 | ; M.Inl [2; 0; 1] 217 | ; M.Inr (Unit, [2; 0; 1]) 218 | ; M.Inl [0; 2; 1] 219 | ; M.Inr (Unit, [0; 2; 1]) 220 | ; M.Inl [0; 1; 2] 221 | ; M.Inr (Unit, [0; 1; 2]) 222 | ] 223 | */ 224 | }; 225 | -------------------------------------------------------------------------------- /ocaml.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "autoClosingPairs": [ 3 | { "open": "{", "close": "}" }, 4 | { "open": "[", "close": "]" }, 5 | { "open": "(", "close": ")" }, 6 | { "open": "\"", "close": "\"", "notIn": [ "string" ] }, 7 | { "open": "(**", "close": " *)", "notIn": [ "string" ] } 8 | ], 9 | "brackets": [ 10 | [ "{", "}" ], 11 | [ "[", "]" ], 12 | [ "(", ")" ] 13 | ], 14 | "comments": { 15 | "blockComment": [ "(*", "*)" ] 16 | }, 17 | "surroundingPairs": [ 18 | [ "{", "}" ], 19 | [ "[", "]" ], 20 | [ "(", ")" ], 21 | [ "'", "'" ], 22 | [ "\"", "\"" ], 23 | [ "`", "`" ] 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "reasonml", 4 | "displayName": "OCaml and Reason IDE", 5 | "description": "OCaml and Reason language support", 6 | "version": "1.0.38", 7 | "publisher": "freebroccolo", 8 | "license": "Apache-2.0", 9 | "bugs": { 10 | "url": "https://github.com/freebroccolo/vscode-reasonml/issues" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/freebroccolo/vscode-reasonml.git" 15 | }, 16 | "engines": { 17 | "vscode": "^1.21.0" 18 | }, 19 | "categories": ["Formatters", "Programming Languages", "Linters", "Snippets"], 20 | "keywords": ["ocaml", "reason", "bucklescript", "reasonml", "merlin"], 21 | "icon": "assets/logo.png", 22 | "activationEvents": ["onLanguage:ocaml", "onLanguage:reason"], 23 | "main": "./out/src/extension", 24 | "contributes": { 25 | "commands": [ 26 | { 27 | "command": "reason.caseSplit", 28 | "title": "Reason: Case Split" 29 | }, 30 | { 31 | "command": "reason.showMerlinFiles", 32 | "title": "Reason: Show Merlin Files" 33 | }, 34 | { 35 | "command": "reason.showAvailableLibraries", 36 | "title": "Reason: Show Libraries Available via Dependencies" 37 | }, 38 | { 39 | "command": "reason.showProjectEnv", 40 | "title": "Reason: Show Environment" 41 | } 42 | ], 43 | "configuration": { 44 | "type": "object", 45 | "title": "Reason configuration", 46 | "properties": { 47 | "reason.codelens.unicode": { 48 | "type": "boolean", 49 | "default": true, 50 | "description": "Enable the use of unicode symbols in codelens." 51 | }, 52 | "reason.codelens.enabled": { 53 | "type": "boolean", 54 | "default": false, 55 | "description": "Specifies whether the code lens is shown." 56 | }, 57 | "reason.debounce.linter": { 58 | "oneOf": [ 59 | { 60 | "type": "integer" 61 | }, 62 | { 63 | "enum": ["Infinity"] 64 | } 65 | ], 66 | "default": 500, 67 | "description": 68 | "How long to idle (in milliseconds) after keypresses before refreshing linter diagnostics. Smaller values refresh diagnostics more quickly." 69 | }, 70 | "reason.diagnostics.tools": { 71 | "type": "array", 72 | "items": { 73 | "enum": ["merlin", "bsb"] 74 | }, 75 | "default": ["merlin"], 76 | "maxItems": 2, 77 | "uniqueItems": true, 78 | "description": 79 | "Specifies which tool or tools will be used to get diagnostics. If you choose both \"merlin\" and \"bsb\", merlin will be used while editing and bsb when saving." 80 | }, 81 | "reason.format.width": { 82 | "type": ["number", null], 83 | "default": null, 84 | "description": "Set the width of lines when formatting code with refmt" 85 | }, 86 | "reason.path.bsb": { 87 | "type": "string", 88 | "default": "./node_modules/bs-platform/lib/bsb.exe", 89 | "description": "The path to the `bsb` binary." 90 | }, 91 | "reason.path.ocamlfind": { 92 | "type": "string", 93 | "default": "ocamlfind", 94 | "description": "The path to the `ocamlfind` binary." 95 | }, 96 | "reason.path.esy": { 97 | "type": "string", 98 | "default": "esy", 99 | "description": "The path to the `esy` binary." 100 | }, 101 | "reason.path.env": { 102 | "type": "string", 103 | "default": "env", 104 | "description": 105 | "The path to the `env` command which prints the language server environment for debugging editor issues." 106 | }, 107 | "reason.path.ocamlmerlin": { 108 | "type": "string", 109 | "default": "ocamlmerlin", 110 | "description": "The path to the `ocamlmerlin` binary." 111 | }, 112 | "reason.path.ocpindent": { 113 | "type": "string", 114 | "default": "ocp-indent", 115 | "description": "The path to the `ocp-indent` binary." 116 | }, 117 | "reason.path.opam": { 118 | "type": "string", 119 | "default": "opam", 120 | "description": "The path to the `opam` binary." 121 | }, 122 | "reason.path.rebuild": { 123 | "type": "string", 124 | "default": "rebuild", 125 | "description": "The path to the `rebuild` binary." 126 | }, 127 | "reason.path.refmt": { 128 | "type": "string", 129 | "default": "refmt", 130 | "description": "The path to the `refmt` binary." 131 | }, 132 | "reason.path.refmterr": { 133 | "type": "string", 134 | "default": "refmterr", 135 | "description": "The path to the `refmterr` binary." 136 | }, 137 | "reason.path.rtop": { 138 | "type": "string", 139 | "default": "rtop", 140 | "description": "The path to the `rtop` binary." 141 | }, 142 | "reason.server.languages": { 143 | "type": "array", 144 | "items": { 145 | "enum": ["ocaml", "reason"] 146 | }, 147 | "default": ["ocaml", "reason"], 148 | "maxItems": 2, 149 | "uniqueItems": true, 150 | "description": "The list of languages enable support for in the language server." 151 | } 152 | } 153 | }, 154 | "grammars": [ 155 | { 156 | "language": "ocaml", 157 | "scopeName": "source.ocaml", 158 | "path": "./syntaxes/ocaml.json" 159 | }, 160 | { 161 | "language": "ocaml.hover.info", 162 | "scopeName": "source.ocaml.hover.info", 163 | "path": "./syntaxes/ocaml-hover-info.json" 164 | }, 165 | { 166 | "language": "ocaml.hover.type", 167 | "scopeName": "source.ocaml.hover.type", 168 | "path": "./syntaxes/ocaml-hover-type.json" 169 | }, 170 | { 171 | "language": "ocaml.merlin", 172 | "scopeName": "source.ocaml.merlin", 173 | "path": "./syntaxes/merlin.json" 174 | }, 175 | { 176 | "language": "ocaml.ocamlbuild", 177 | "scopeName": "source.ocaml.ocamlbuild", 178 | "path": "./syntaxes/ocamlbuild.json" 179 | }, 180 | { 181 | "language": "ocaml.opam", 182 | "scopeName": "source.ocaml.opam", 183 | "path": "./syntaxes/opam.json" 184 | }, 185 | { 186 | "language": "reason", 187 | "scopeName": "source.reason", 188 | "path": "./syntaxes/reason.json" 189 | }, 190 | { 191 | "language": "reason.hover.info", 192 | "scopeName": "source.reason.hover.info", 193 | "path": "./syntaxes/reason-hover-info.json" 194 | }, 195 | { 196 | "language": "reason.hover.signature", 197 | "scopeName": "source.reason.hover.signature", 198 | "path": "./syntaxes/reason-hover-signature.json" 199 | }, 200 | { 201 | "language": "reason.hover.type", 202 | "scopeName": "source.reason.hover.type", 203 | "path": "./syntaxes/reason-hover-type.json" 204 | }, 205 | { 206 | "scopeName": "markdown.reason.codeblock", 207 | "path": "./syntaxes/reason-markdown-codeblock.json", 208 | "injectTo": ["text.html.markdown"], 209 | "embeddedLanguages": { 210 | "meta.embedded.block.reason": "reason" 211 | } 212 | }, 213 | { 214 | "scopeName": "markdown.ocaml.codeblock", 215 | "path": "./syntaxes/ocaml-markdown-codeblock.json", 216 | "injectTo": ["text.html.markdown"], 217 | "embeddedLanguages": { 218 | "meta.embedded.block.ocaml": "ocaml" 219 | } 220 | } 221 | ], 222 | "languages": [ 223 | { 224 | "id": "ocaml", 225 | "aliases": ["OCaml"], 226 | "extensions": [".ml", ".mli"], 227 | "configuration": "./ocaml.configuration.json" 228 | }, 229 | { 230 | "id": "ocaml.hover.info" 231 | }, 232 | { 233 | "id": "ocaml.hover.type" 234 | }, 235 | { 236 | "id": "ocaml.merlin", 237 | "aliases": ["Merlin"], 238 | "extensions": ["merlin"] 239 | }, 240 | { 241 | "id": "ocaml.ocamlbuild", 242 | "aliases": ["OCamlbuild"], 243 | "extensions": ["_tags"] 244 | }, 245 | { 246 | "id": "ocaml.opam", 247 | "aliases": ["OPAM"], 248 | "extensions": ["opam"] 249 | }, 250 | { 251 | "id": "reason", 252 | "aliases": ["Reason"], 253 | "extensions": [".re", ".rei"], 254 | "configuration": "./reason.configuration.json" 255 | }, 256 | { 257 | "id": "reason.hover.info" 258 | }, 259 | { 260 | "id": "reason.hover.signature" 261 | }, 262 | { 263 | "id": "reason.hover.type" 264 | } 265 | ], 266 | "menus": { 267 | "editor/context": [ 268 | { 269 | "command": "reason.caseSplit", 270 | "group": "reason", 271 | "when": "editorTextFocus && resourceLangId == reason" 272 | } 273 | ] 274 | }, 275 | "snippets": [ 276 | { 277 | "language": "reason", 278 | "path": "./snippets/reason.json" 279 | } 280 | ], 281 | "problemMatchers": [ 282 | { 283 | "name": "ocamlc", 284 | 285 | "fileLocation": ["relative", "${workspaceFolder}"], 286 | "pattern": [ 287 | { 288 | "regexp": 289 | "^\\s*\\bFile\\b\\s*\"(.*)\",\\s*\\bline\\b\\s*(\\d+),\\s*\\bcharacters\\b\\s*(\\d+)-(\\d+)\\s*:\\s*$", 290 | "file": 1, 291 | "line": 2, 292 | "column": 3, 293 | "endColumn": 4 294 | }, 295 | { 296 | "regexp": 297 | "^(?:\\s*\\bParse\\b\\s*)?\\s*\\b([Ee]rror|Warning)\\b\\s*(?:\\(\\s*\\bwarning\\b\\s*(\\d+)\\))?\\s*:\\s*(.*)$", 298 | "severity": 1, 299 | "code": 2, 300 | "message": 3 301 | } 302 | ] 303 | } 304 | ] 305 | }, 306 | "scripts": { 307 | "build": "tsc -p ./ && node script/syntax.js", 308 | "format": "./node_modules/.bin/prettier --write \"src/**/*.ts\"", 309 | "lint": "tslint --project tsconfig.json", 310 | "postinstall": "node ./node_modules/vscode/bin/install", 311 | "prebuild": "npm run format && npm run lint", 312 | "vscode:prepublish": "node script/syntax.js" 313 | }, 314 | "devDependencies": { 315 | "@types/lodash.flatmap": "^4.5.3", 316 | "@types/node": "9.6.2", 317 | "@types/pegjs": "0.10.0", 318 | "prettier": "1.11.1", 319 | "tslint": "5.9.1", 320 | "typescript": "2.8.1", 321 | "vscode": "1.1.14" 322 | }, 323 | "dependencies": { 324 | "lodash.flatmap": "^4.5.0", 325 | "ocaml-language-server": "1.0.35", 326 | "pegjs": "0.10.0", 327 | "vscode-jsonrpc": "3.6.0", 328 | "vscode-languageclient": "4.0.1", 329 | "vscode-languageserver": "4.0.0", 330 | "vscode-languageserver-protocol": "3.6.0" 331 | }, 332 | "__metadata": { 333 | "id": "c7ccccce-e272-43df-883f-91f3de932890", 334 | "publisherDisplayName": "Darin Morrison", 335 | "publisherId": "d7d46b7f-d6a6-4bc5-8e41-f35d145c81de" 336 | } 337 | } 338 | -------------------------------------------------------------------------------- /reason.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "autoClosingPairs": [ 3 | { "open": "{", "close": "}" }, 4 | { "open": "[", "close": "]" }, 5 | { "open": "(", "close": ")" }, 6 | { "open": "\"", "close": "\"", "notIn": [ "string" ] }, 7 | { "open": "/**", "close": " */", "notIn": [ "string" ] } 8 | ], 9 | "brackets": [ 10 | [ "{", "}" ], 11 | [ "[", "]" ], 12 | [ "(", ")" ] 13 | ], 14 | "comments": { 15 | "lineComment": "//", 16 | "blockComment": [ "/*", "*/" ] 17 | }, 18 | "surroundingPairs": [ 19 | [ "{", "}" ], 20 | [ "[", "]" ], 21 | [ "(", ")" ], 22 | [ "'", "'" ], 23 | [ "\"", "\"" ], 24 | [ "`", "`" ] 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /script/syntax.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const fs = require("fs"); 4 | const path = require("path"); 5 | const languages = ["ocaml"]; 6 | 7 | function inPath(language) { 8 | return path.resolve(".", "out", "src", "syntaxes", language); 9 | } 10 | 11 | function outPath(language) { 12 | return path.resolve(".", "syntaxes", `${language}.json`); 13 | } 14 | 15 | for (const language of languages) { 16 | const from = inPath(language); 17 | const into = outPath(language); 18 | const data = require(from); 19 | const json = JSON.stringify(data.default); 20 | fs.writeFileSync(into, json); 21 | } 22 | -------------------------------------------------------------------------------- /snippets/reason.json: -------------------------------------------------------------------------------- 1 | { 2 | "function": { 3 | "prefix": "let", 4 | "body": ["let ${1:f} = (${2:pattern}) => ${3:${2:pattern}};$0"] 5 | }, 6 | "function (block)": { 7 | "prefix": "let", 8 | "body": ["let ${1:f} = (${2:pattern}) => {", "\t${3:${2:pattern}}$0", "};"] 9 | }, 10 | "lambda": { 11 | "prefix": "fun", 12 | "body": ["(${1:pattern}) => ${2:${1:pattern}}"] 13 | }, 14 | "lambda (switch)": { 15 | "prefix": "fun", 16 | "body": ["fun", "\t| ${1:pattern} => ${2:${1:pattern}}", "\t;"] 17 | }, 18 | "let": { 19 | "prefix": "let", 20 | "body": ["let ${1:pattern} = ${2:()};$0"] 21 | }, 22 | "let (block)": { 23 | "prefix": "let", 24 | "body": ["let ${1:pattern} = {", "\t$0", "};"] 25 | }, 26 | "module": { 27 | "prefix": "module", 28 | "body": ["module ${1:M} = ${2:{}};$0"] 29 | }, 30 | "module (block)": { 31 | "prefix": "module", 32 | "body": ["module ${1:M} = {", "\t$0", "};"] 33 | }, 34 | "module function": { 35 | "prefix": "module", 36 | "body": ["module ${1:M} = (${2:X}: $3{:{}}) => ${4:${2:X}};$0"] 37 | }, 38 | "module function (block)": { 39 | "prefix": "module", 40 | "body": ["module ${1:M} = (${2:X}: $3{:{}}) => {", "\t${4:include ${2:X}}", "\t$0", "};"] 41 | }, 42 | "switch": { 43 | "prefix": "switch", 44 | "body": ["switch ${1:scrutinee} {", "| ${2:pattern} => ${3:${2:pattern}}", "};"] 45 | }, 46 | "type (alias or abstract)": { 47 | "prefix": "type", 48 | "body": ["type ${1:name} ${2:${3:'${4:arg} }= ${5:'${4:arg}}};$0"] 49 | }, 50 | "type": { 51 | "prefix": "type", 52 | "body": ["type ${1:name} ${2:'${3:arg} }=", "\t| ${4:Con${2: '${3:arg}}}", "\t;"] 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/client/command/doShowAvailableLibraries.ts: -------------------------------------------------------------------------------- 1 | import { remote } from "ocaml-language-server"; 2 | import * as vscode from "vscode"; 3 | import * as client from "vscode-languageclient"; 4 | import * as LSP from "vscode-languageserver-protocol"; 5 | 6 | export function register(context: vscode.ExtensionContext, languageClient: client.LanguageClient): void { 7 | context.subscriptions.push( 8 | vscode.commands.registerTextEditorCommand("reason.showAvailableLibraries", async editor => { 9 | const docURI: LSP.TextDocumentIdentifier = { 10 | uri: editor.document.uri.toString(), 11 | }; 12 | const libraryLines = languageClient.sendRequest(remote.server.giveAvailableLibraries, docURI); 13 | await vscode.window.showQuickPick(libraryLines); 14 | return; 15 | }), 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/client/command/doShowMerlinFiles.ts: -------------------------------------------------------------------------------- 1 | import { remote } from "ocaml-language-server"; 2 | import * as vscode from "vscode"; 3 | import * as client from "vscode-languageclient"; 4 | import * as LSP from "vscode-languageserver-protocol"; 5 | 6 | export function register(context: vscode.ExtensionContext, languageClient: client.LanguageClient): void { 7 | context.subscriptions.push( 8 | vscode.commands.registerTextEditorCommand("reason.showMerlinFiles", async editor => { 9 | const docURI: LSP.TextDocumentIdentifier = { 10 | uri: editor.document.uri.toString(), 11 | }; 12 | const merlinFiles: string[] = await languageClient.sendRequest(remote.server.giveMerlinFiles, docURI); 13 | const selected: string | undefined = await vscode.window.showQuickPick(merlinFiles); 14 | if (null == selected) return; 15 | const textDocument = await vscode.workspace.openTextDocument(selected); 16 | await vscode.window.showTextDocument(textDocument); 17 | }), 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/client/command/doShowProjectEnv.ts: -------------------------------------------------------------------------------- 1 | import { remote } from "ocaml-language-server"; 2 | import * as vscode from "vscode"; 3 | import * as client from "vscode-languageclient"; 4 | import * as LSP from "vscode-languageserver-protocol"; 5 | 6 | const SHOW_ALL_STR = "Show Entire Environment"; 7 | export function register(context: vscode.ExtensionContext, languageClient: client.LanguageClient): void { 8 | context.subscriptions.push( 9 | vscode.commands.registerTextEditorCommand("reason.showProjectEnv", async editor => { 10 | const docURI: LSP.TextDocumentIdentifier = { 11 | uri: editor.document.uri.toString(), 12 | }; 13 | const projectEnv: string[] = await languageClient.sendRequest(remote.server.giveProjectEnv, docURI); 14 | const projectEnvWithAll = [SHOW_ALL_STR].concat(projectEnv); 15 | const selected = await vscode.window.showQuickPick(projectEnvWithAll); 16 | if (null == selected) return; 17 | const content = selected === SHOW_ALL_STR ? projectEnv.join("\n") : selected; 18 | const textDocument = await vscode.workspace.openTextDocument({ 19 | content, 20 | language: "shellscript", 21 | }); 22 | await vscode.window.showTextDocument(textDocument); 23 | }), 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /src/client/command/doSplitCases.ts: -------------------------------------------------------------------------------- 1 | import { merlin, remote } from "ocaml-language-server"; 2 | import * as vscode from "vscode"; 3 | import * as client from "vscode-languageclient"; 4 | import * as LSP from "vscode-languageserver-protocol"; 5 | 6 | async function execute(editor: vscode.TextEditor, destruct: merlin.Case.Destruct): Promise { 7 | const [{ end, start }, content] = destruct; 8 | return editor.edit(editBuilder => { 9 | const range = new vscode.Range( 10 | new vscode.Position(start.line - 1, start.col), 11 | new vscode.Position(end.line - 1, end.col), 12 | ); 13 | const cases = format(editor, content); 14 | editBuilder.replace(range, cases); 15 | }); 16 | } 17 | 18 | export function format(editor: vscode.TextEditor, content: string): string { 19 | const line = editor.document.lineAt(editor.selection.start); 20 | const match = line.text.match(/^\s*/); 21 | const indentation = match && match.length > 0 ? match[0] : ""; // FIXME: use use indentation settings 22 | let result = content; 23 | result = format.deleteWhitespace(result); 24 | result = format.deleteParentheses(result); 25 | result = format.indentExpression(indentation, result); 26 | result = format.indentPatterns(result); 27 | result = format.insertPlaceholders(result); 28 | return result; 29 | } 30 | 31 | export namespace format { 32 | export function deleteParentheses(content: string): string { 33 | return content.replace(/^\(|\n\)$/g, ""); 34 | } 35 | export function deleteWhitespace(content: string): string { 36 | return content.replace(/\n$/, ""); 37 | } 38 | export function indentExpression(indentation: string, content: string): string { 39 | return !/^\bswitch\b/g.test(content) 40 | ? content 41 | : content.replace(/\|/g, `${indentation}|`).replace(/}$/g, `${indentation}}`); 42 | } 43 | export function indentPatterns(content: string): string { 44 | return content.replace(/{(?!\s)/g, "{ ").replace(/([^\s])}/g, "$1 }"); 45 | } 46 | export function insertPlaceholders(content: string): string { 47 | return content.replace(/\(\?\?\)/g, `failwith ""`); 48 | } 49 | } 50 | 51 | export function register(context: vscode.ExtensionContext, languageClient: client.LanguageClient): void { 52 | // FIXME: using the edit builder passed in to the command doesn't seem to work 53 | context.subscriptions.push( 54 | vscode.commands.registerTextEditorCommand("reason.caseSplit", async (editor): Promise => { 55 | const textDocument = { uri: editor.document.uri.toString() }; 56 | const rangeCode = editor.document.getWordRangeAtPosition(editor.selection.start); 57 | if (null == rangeCode) return; 58 | const range = LSP.Range.create(rangeCode.start, rangeCode.end); 59 | const params = { range, textDocument }; 60 | try { 61 | const response = await languageClient.sendRequest(remote.server.giveCaseAnalysis, params); 62 | if (null != response) await execute(editor, response); 63 | } catch (err) { 64 | // FIXME: clean this up 65 | // vscode.window.showErrorMessage(JSON.stringify(err)); 66 | const pattern = /Destruct not allowed on non-immediate type/; 67 | if (pattern.test(err)) { 68 | vscode.window.showWarningMessage( 69 | "More type info needed for case split; try adding an annotation somewhere, e.g., (pattern: type).", 70 | ); 71 | } 72 | } 73 | }), 74 | ); 75 | } 76 | -------------------------------------------------------------------------------- /src/client/command/fixEqualsShouldBeArrow.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import * as client from "vscode-languageclient"; 3 | import * as LSP from "vscode-languageserver-protocol"; 4 | 5 | export function register(context: vscode.ExtensionContext, languageClient: client.LanguageClient): void { 6 | context.subscriptions.push( 7 | vscode.commands.registerTextEditorCommand( 8 | "reason.codeAction.fixEqualsShouldBeArrow", 9 | async (editor: vscode.TextEditor, _: any, [{ range: { end: position } }]: [LSP.Location]): Promise => { 10 | await editor.edit(editBuilder => { 11 | const editPosition = languageClient.protocol2CodeConverter.asPosition(position); 12 | editBuilder.insert(editPosition, ">"); 13 | }); 14 | }, 15 | ), 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/client/command/fixMissingSemicolon.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import * as client from "vscode-languageclient"; 3 | import * as LSP from "vscode-languageserver-protocol"; 4 | 5 | export function register(context: vscode.ExtensionContext, languageClient: client.LanguageClient): void { 6 | context.subscriptions.push( 7 | vscode.commands.registerTextEditorCommand( 8 | "reason.codeAction.fixMissingSemicolon", 9 | async (editor: vscode.TextEditor, _: any, [{ range: { end: position } }]: [LSP.Location]): Promise => { 10 | await editor.edit(editBuilder => { 11 | const editPosition = languageClient.protocol2CodeConverter.asPosition(position); 12 | editBuilder.insert(editPosition, ";"); 13 | }); 14 | }, 15 | ), 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/client/command/fixUnusedVariable.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import * as client from "vscode-languageclient"; 3 | import * as LSP from "vscode-languageserver-protocol"; 4 | 5 | export function register(context: vscode.ExtensionContext, languageClient: client.LanguageClient): void { 6 | context.subscriptions.push( 7 | vscode.commands.registerTextEditorCommand( 8 | "reason.codeAction.fixUnusedVariable", 9 | async (editor: vscode.TextEditor, _: any, [{ range }, name]: [LSP.Location, string]): Promise => { 10 | await editor.edit(editBuilder => { 11 | const editRange = languageClient.protocol2CodeConverter.asRange(range); 12 | editBuilder.replace(editRange, `_${name}`); 13 | }); 14 | }, 15 | ), 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/client/command/index.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import * as client from "vscode-languageclient"; 3 | import * as doShowAvailableLibraries from "./doShowAvailableLibraries"; 4 | import * as doShowMerlinFiles from "./doShowMerlinFiles"; 5 | import * as doShowProjectEnv from "./doShowProjectEnv"; 6 | import * as doSplitCases from "./doSplitCases"; 7 | import * as fixEqualsShouldBeArrow from "./fixEqualsShouldBeArrow"; 8 | import * as fixMissingSemicolon from "./fixMissingSemicolon"; 9 | import * as fixUnusedVariable from "./fixUnusedVariable"; 10 | 11 | export function registerAll(context: vscode.ExtensionContext, languageClient: client.LanguageClient): void { 12 | doShowMerlinFiles.register(context, languageClient); 13 | doShowProjectEnv.register(context, languageClient); 14 | doShowAvailableLibraries.register(context, languageClient); 15 | doSplitCases.register(context, languageClient); 16 | fixEqualsShouldBeArrow.register(context, languageClient); 17 | fixMissingSemicolon.register(context, languageClient); 18 | fixUnusedVariable.register(context, languageClient); 19 | } 20 | -------------------------------------------------------------------------------- /src/client/index.ts: -------------------------------------------------------------------------------- 1 | import flatMap = require("lodash.flatmap"); 2 | import * as path from "path"; 3 | import * as vscode from "vscode"; 4 | import * as client from "vscode-languageclient"; 5 | import * as command from "./command"; 6 | import * as request from "./request"; 7 | 8 | class ClientWindow implements vscode.Disposable { 9 | public readonly merlin: vscode.StatusBarItem; 10 | constructor() { 11 | this.merlin = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 0); 12 | this.merlin.text = "$(hubot) [loading]"; 13 | this.merlin.command = "reason.showMerlinFiles"; 14 | this.merlin.show(); 15 | return this; 16 | } 17 | public dispose() { 18 | this.merlin.dispose(); 19 | } 20 | } 21 | 22 | class ErrorHandler { 23 | public closed(): client.CloseAction { 24 | return client.CloseAction.DoNotRestart; 25 | } 26 | public error(): client.ErrorAction { 27 | return client.ErrorAction.Shutdown; 28 | } 29 | } 30 | 31 | export async function launch(context: vscode.ExtensionContext): Promise { 32 | const reasonConfig = vscode.workspace.getConfiguration("reason"); 33 | const module = context.asAbsolutePath(path.join("node_modules", "ocaml-language-server", "bin", "server")); 34 | const options = { execArgv: ["--nolazy", "--inspect=6009"] }; 35 | const transport = client.TransportKind.ipc; 36 | const run = { module, transport }; 37 | const debug = { 38 | module, 39 | options, 40 | transport, 41 | }; 42 | const serverOptions = { run, debug }; 43 | const languages = reasonConfig.get("server.languages", ["ocaml", "reason"]); 44 | const documentSelector = flatMap(languages, (language: string) => [ 45 | { language, scheme: "file" }, 46 | { language, scheme: "untitled" }, 47 | ]); 48 | 49 | const clientOptions: client.LanguageClientOptions = { 50 | diagnosticCollectionName: "ocaml-language-server", 51 | documentSelector, 52 | errorHandler: new ErrorHandler(), 53 | initializationOptions: reasonConfig, 54 | outputChannelName: "OCaml Language Server", 55 | stdioEncoding: "utf8", 56 | synchronize: { 57 | configurationSection: "reason", 58 | fileEvents: [ 59 | vscode.workspace.createFileSystemWatcher("**/.merlin"), 60 | vscode.workspace.createFileSystemWatcher("**/*.ml"), 61 | vscode.workspace.createFileSystemWatcher("**/*.re"), 62 | vscode.workspace.createFileSystemWatcher("**/command-exec"), 63 | vscode.workspace.createFileSystemWatcher("**/command-exec.bat"), 64 | vscode.workspace.createFileSystemWatcher("**/_build"), 65 | vscode.workspace.createFileSystemWatcher("**/_build/*"), 66 | ], 67 | }, 68 | }; 69 | const languageClient = new client.LanguageClient("Reason", serverOptions, clientOptions); 70 | const window = new ClientWindow(); 71 | const session = languageClient.start(); 72 | context.subscriptions.push(window); 73 | context.subscriptions.push(session); 74 | await languageClient.onReady(); 75 | command.registerAll(context, languageClient); 76 | request.registerAll(context, languageClient); 77 | window.merlin.text = "$(hubot) [merlin]"; 78 | window.merlin.tooltip = "merlin server online"; 79 | } 80 | -------------------------------------------------------------------------------- /src/client/request/index.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import * as client from "vscode-languageclient"; 3 | 4 | export function registerAll(_context: vscode.ExtensionContext, _languageClient: client.LanguageClient): void { 5 | return; 6 | } 7 | -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable object-literal-sort-keys 2 | 3 | import * as vscode from "vscode"; 4 | import * as client from "./client"; 5 | 6 | const reasonConfiguration = { 7 | indentationRules: { 8 | decreaseIndentPattern: /^(.*\*\/)?\s*\}.*$/, 9 | increaseIndentPattern: /^.*\{[^}"']*$/, 10 | }, 11 | onEnterRules: [ 12 | { 13 | beforeText: /^.*\b(switch|try)\b[^\{]*{\s*$/, 14 | action: { 15 | indentAction: vscode.IndentAction.IndentOutdent, 16 | appendText: "| ", 17 | }, 18 | }, 19 | { 20 | beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, 21 | afterText: /^\s*\*\/$/, 22 | action: { 23 | indentAction: vscode.IndentAction.IndentOutdent, 24 | appendText: " * ", 25 | }, 26 | }, 27 | { 28 | beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, 29 | action: { 30 | indentAction: vscode.IndentAction.None, 31 | appendText: " * ", 32 | }, 33 | }, 34 | { 35 | beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/, 36 | action: { 37 | indentAction: vscode.IndentAction.None, 38 | appendText: "* ", 39 | }, 40 | }, 41 | { 42 | beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/, 43 | action: { 44 | indentAction: vscode.IndentAction.None, 45 | removeText: 1, 46 | }, 47 | }, 48 | { 49 | beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/, 50 | action: { 51 | indentAction: vscode.IndentAction.None, 52 | removeText: 1, 53 | }, 54 | }, 55 | { 56 | beforeText: /^.*\bfun\b\s*$/, 57 | action: { 58 | indentAction: vscode.IndentAction.None, 59 | appendText: "| ", 60 | }, 61 | }, 62 | { 63 | beforeText: /^\s*\btype\b.*=(.*[^;\\{<]\s*)?$/, 64 | afterText: /^\s*$/, 65 | action: { 66 | indentAction: vscode.IndentAction.None, 67 | appendText: " | ", 68 | }, 69 | }, 70 | { 71 | beforeText: /^(\t|[ ]{2})*[\|]([^!$%&*+-/<=>?@^~;}])*(?:$|=>.*[^\s\{]\s*$)/m, 72 | action: { 73 | indentAction: vscode.IndentAction.None, 74 | appendText: "| ", 75 | }, 76 | }, 77 | { 78 | beforeText: /^(\t|(\ \ ))*\|(.*[;])$/, 79 | action: { 80 | indentAction: vscode.IndentAction.Outdent, 81 | }, 82 | }, 83 | { 84 | beforeText: /^(\t|(\ \ ))*;\s*$/, 85 | action: { 86 | indentAction: vscode.IndentAction.Outdent, 87 | }, 88 | }, 89 | ], 90 | wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\"\,\.\<\>\/\?\s]+)/g, 91 | }; 92 | 93 | export async function activate(context: vscode.ExtensionContext) { 94 | context.subscriptions.push(vscode.languages.setLanguageConfiguration("reason", reasonConfiguration)); 95 | await client.launch(context); 96 | } 97 | 98 | export function deactivate() { 99 | return; 100 | } 101 | -------------------------------------------------------------------------------- /src/syntaxes/basis.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable object-literal-sort-keys 2 | 3 | import * as schema from "./schema"; 4 | 5 | export function ref(f: (...args: any[]) => schema.Rule): string { 6 | return `#${f.name}`; 7 | } 8 | 9 | export function include(f: (...args: any[]) => schema.Rule): { include: string } { 10 | return { include: ref(f) }; 11 | } 12 | 13 | export const alt = (...rest: string[]) => rest.join("|"); 14 | export const capture = (arg: string) => `(${arg})`; 15 | export const complement = (...rest: string[]) => `[^${rest.join("")}]`; 16 | export const group = (arg: string) => `(?:${arg})`; 17 | export const lookBehind = (arg: string) => `(?<=${arg})`; 18 | export const negativeLookBehind = (arg: string) => `(? `${arg}*`; 25 | export const manyOne = (arg: string) => `${arg}+`; 26 | export const opt = (arg: string) => `${arg}?`; 27 | export const words = (arg: string) => `\\b${arg}\\b`; 28 | export const lookAhead = (arg: string) => `(?=${arg})`; 29 | export const negativeLookAhead = (arg: string) => `(?!${arg})`; 30 | export const seq = (...rest: string[]) => rest.join(""); 31 | export const set = (...rest: string[]) => `[${rest.join("")}]`; 32 | 33 | export const Class = { 34 | alnum: "[:alnum:]", 35 | alpha: "[:alpha:]", 36 | ascii: "[:ascii:]", 37 | blank: "[:blank:]", 38 | cntrl: "[:cntrl:]", 39 | digit: "[:digit:]", 40 | graph: "[:graph:]", 41 | lower: "[:lower:]", 42 | print: "[:print:]", 43 | punct: "[:punct:]", 44 | space: "[:space:]", 45 | upper: "[:upper:]", 46 | word: "[:word:]", 47 | xdigit: "[:xdigit:]", 48 | }; 49 | 50 | export const Token = { 51 | AND: "and", 52 | APOSTROPHE: "'", 53 | AS: "as", 54 | ASR: "asr", 55 | ASSERT: "assert", 56 | ASTERISK: "\\*", 57 | BEGIN: "begin", 58 | CLASS: "class", 59 | COLON: ":", 60 | COMMA: ",", 61 | COMMERCIAL_AT: "@", 62 | CONSTRAINT: "constraint", 63 | DO: "do", 64 | DONE: "done", 65 | DOWNTO: "downto", 66 | ELSE: "else", 67 | END: "end", 68 | EQUALS_SIGN: "=", 69 | EXCEPTION: "exception", 70 | EXTERNAL: "external", 71 | FALSE: "false", 72 | FOR: "for", 73 | FULL_STOP: "\\.", 74 | FUN: "fun", 75 | FUNCTION: "function", 76 | FUNCTOR: "functor", 77 | GREATER_THAN_SIGN: ">", 78 | HYPHEN_MINUS: "-", 79 | IF: "if", 80 | IN: "in", 81 | INCLUDE: "include", 82 | INHERIT: "inherit", 83 | INITIALIZER: "initializer", 84 | LAND: "land", 85 | LAZY: "lazy", 86 | LEFT_CURLY_BRACKET: "\\{", 87 | LEFT_PARENTHESIS: "\\(", 88 | LEFT_SQUARE_BRACKET: "\\[", 89 | LESS_THAN_SIGN: "<", 90 | LET: "let", 91 | LOR: "lor", 92 | LOW_LINE: "_", 93 | LSL: "lsl", 94 | LSR: "lsr", 95 | LXOR: "lxor", 96 | MATCH: "match", 97 | METHOD: "method", 98 | MOD: "mod", 99 | MODULE: "module", 100 | MUTABLE: "mutable", 101 | NEW: "new", 102 | NONREC: "nonrec", 103 | NUMBER_SIGN: "#", 104 | OBJECT: "object", 105 | OF: "of", 106 | OPEN: "open", 107 | OR: "or", 108 | PERCENT_SIGN: "%", 109 | PLUS_SIGN: "\\+", 110 | PRIVATE: "private", 111 | QUESTION_MARK: "\\?", 112 | QUOTATION_MARK: '"', 113 | REC: "rec", 114 | REVERSE_SOLIDUS: "\\\\", 115 | RIGHT_CURLY_BRACKET: "\\}", 116 | RIGHT_PARENTHESIS: "\\)", 117 | RIGHT_SQUARE_BRACKET: "\\]", 118 | SEMICOLON: ";", 119 | SIG: "sig", 120 | SOLIDUS: "/", 121 | STRUCT: "struct", 122 | THEN: "then", 123 | TILDE: "~", 124 | TO: "to", 125 | TRUE: "true", 126 | TRY: "try", 127 | TYPE: "type", 128 | VAL: "val", 129 | VERTICAL_LINE: "\\|", 130 | VIRTUAL: "virtual", 131 | WHEN: "when", 132 | WHILE: "while", 133 | WITH: "with", 134 | }; 135 | 136 | export class Scope { 137 | public static ITEM_AND(): string { 138 | return `${this.STYLE_OPERATOR()} ${this.STYLE_UNDERLINE()}`; 139 | } 140 | 141 | public static ITEM_CLASS(): string { 142 | return `entity.name.class constant.numeric ${this.STYLE_UNDERLINE()}`; 143 | } 144 | 145 | public static ITEM_EXTERNAL(): string { 146 | return `entity.name.class constant.numeric ${this.STYLE_UNDERLINE()}`; 147 | } 148 | 149 | public static ITEM_INCLUDE(): string { 150 | return this.STYLE_OPERATOR(); 151 | } 152 | 153 | public static ITEM_LET(): string { 154 | return `${this.STYLE_CONTROL()} ${this.STYLE_UNDERLINE()}`; 155 | } 156 | 157 | public static ITEM_METHOD(): string { 158 | return `${this.STYLE_BINDER()} ${this.STYLE_UNDERLINE()}`; 159 | } 160 | 161 | public static ITEM_MODULE(): string { 162 | return `markup.inserted constant.language support.constant.property-value entity.name.filename ${this.STYLE_UNDERLINE()}`; 163 | } 164 | 165 | public static ITEM_OPEN(): string { 166 | return this.STYLE_OPERATOR(); 167 | } 168 | 169 | public static ITEM_TYPE(): string { 170 | return `${this.STYLE_KEYWORD()} ${this.STYLE_UNDERLINE()}`; 171 | } 172 | 173 | public static ITEM_VAL(): string { 174 | return `support.type ${this.STYLE_UNDERLINE()}`; 175 | } 176 | 177 | public static KEYWORD_AS(): string { 178 | return this.STYLE_OPERATOR(); 179 | } 180 | 181 | public static KEYWORD_REC(): string { 182 | return this.STYLE_OPERATOR(); 183 | } 184 | 185 | public static KEYWORD_WHEN(): string { 186 | return this.STYLE_OPERATOR(); 187 | } 188 | 189 | public static LITERAL_OBJECT(): string { 190 | return `${this.STYLE_DELIMITER()} ${this.STYLE_ITALICS()}`; 191 | } 192 | 193 | public static LITERAL_SIGNATURE(): string { 194 | return `${this.STYLE_DELIMITER()} ${this.STYLE_ITALICS()}`; 195 | } 196 | 197 | public static LITERAL_STRUCTURE(): string { 198 | return `${this.STYLE_DELIMITER()} ${this.STYLE_ITALICS()}`; 199 | } 200 | 201 | public static META_COMMENT(): string { 202 | return "comment constant.regexp meta.separator.markdown"; 203 | } 204 | 205 | public static MODULE_FUNCTOR(): string { 206 | return "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error"; 207 | } 208 | 209 | public static MODULE_SIG(): string { 210 | return this.STYLE_DELIMITER(); 211 | } 212 | 213 | public static MODULE_STRUCT(): string { 214 | return this.STYLE_DELIMITER(); 215 | } 216 | 217 | public static NAME_FIELD(): string { 218 | return `markup.inserted constant.language support.constant.property-value entity.name.filename`; 219 | } 220 | 221 | public static NAME_FUNCTION(): string { 222 | return `entity.name.function ${this.STYLE_BOLD()} ${this.STYLE_ITALICS()}`; 223 | } 224 | 225 | public static NAME_METHOD(): string { 226 | return "entity.name.function"; 227 | } 228 | 229 | public static NAME_MODULE(): string { 230 | return "entity.name.class constant.numeric"; 231 | } 232 | 233 | public static PUNCTUATION_QUOTE(): string { 234 | return `markup.punctuation.quote.beginning ${this.STYLE_BOLD()} ${this.STYLE_ITALICS()}`; 235 | } 236 | 237 | public static SIGNATURE_WITH(): string { 238 | return `${this.STYLE_OPERATOR()} ${this.STYLE_UNDERLINE()}`; 239 | } 240 | 241 | public static NAME_TYPE(): string { 242 | return `entity.name.function ${this.STYLE_BOLD()} ${this.STYLE_ITALICS()}`; 243 | } 244 | 245 | public static OPERATOR_TYPE(): string { 246 | return `${this.STYLE_OPERATOR()} ${this.STYLE_BOLD()}`; 247 | } 248 | 249 | public static PUNCTUATION_APOSTROPHE(): string { 250 | return `${this.VARIABLE_PATTERN()} ${this.STYLE_BOLD()} ${this.STYLE_ITALICS()}`; 251 | } 252 | 253 | public static PUNCTUATION_COLON(): string { 254 | return `${this.STYLE_OPERATOR()} ${this.STYLE_BOLD()}`; 255 | } 256 | 257 | public static PUNCTUATION_COMMA(): string { 258 | return `string.regexp ${this.STYLE_BOLD()}`; 259 | } 260 | 261 | public static PUNCTUATION_DOT(): string { 262 | return `${this.STYLE_KEYWORD()} ${this.STYLE_BOLD()}`; 263 | } 264 | 265 | public static PUNCTUATION_EQUALS(): string { 266 | return `support.type ${this.STYLE_BOLD()}`; 267 | } 268 | 269 | public static PUNCTUATION_PERCENT_SIGN(): string { 270 | return `${this.STYLE_OPERATOR()} ${this.STYLE_BOLD()}`; 271 | } 272 | 273 | public static STYLE_BINDER(): string { 274 | return "storage.type"; 275 | } 276 | 277 | public static STYLE_BOLD(): string { 278 | return "strong"; 279 | } 280 | 281 | public static STYLE_CONTROL(): string { 282 | return "keyword.control"; 283 | } 284 | 285 | public static STYLE_DELIMITER(): string { 286 | return "punctuation.definition.tag"; 287 | } 288 | 289 | public static STYLE_ITALICS(): string { 290 | return "emphasis"; 291 | } 292 | 293 | public static STYLE_KEYWORD(): string { 294 | return "keyword"; 295 | } 296 | 297 | public static STYLE_OPERATOR(): string { 298 | return "variable.other.class.js message.error variable.interpolation string.regexp"; 299 | } 300 | 301 | public static STYLE_PUNCTUATION(): string { 302 | return "string.regexp"; 303 | } 304 | 305 | public static STYLE_UNDERLINE(): string { 306 | return "markup.underline"; 307 | } 308 | 309 | public static TERM_BUILTIN(): string { 310 | return this.STYLE_OPERATOR(); 311 | } 312 | 313 | public static TERM_CHARACTER(): string { 314 | return "markup.punctuation.quote.beginning"; 315 | } 316 | 317 | public static TERM_CONSTRUCTOR(): string { 318 | return `constant.language constant.numeric entity.other.attribute-name.id.css ${this.STYLE_BOLD()}`; 319 | } 320 | 321 | public static TERM_FUN(): string { 322 | return this.STYLE_BINDER(); 323 | } 324 | 325 | public static TERM_FUNCTION(): string { 326 | return this.STYLE_BINDER(); 327 | } 328 | 329 | public static TERM_IF(): string { 330 | return this.STYLE_CONTROL(); 331 | } 332 | 333 | public static TERM_IN(): string { 334 | return `${this.STYLE_BINDER()} ${this.STYLE_UNDERLINE()}`; 335 | } 336 | 337 | public static TERM_LET(): string { 338 | return `${this.STYLE_BINDER()} ${this.STYLE_UNDERLINE()}`; 339 | } 340 | 341 | public static TERM_MODULE(): string { 342 | return "markup.inserted constant.language support.constant.property-value entity.name.filename"; 343 | } 344 | 345 | public static TERM_NUMBER(): string { 346 | return "constant.numeric"; 347 | } 348 | 349 | public static TERM_STRING(): string { 350 | return "string beginning.punctuation.definition.quote.markdown"; 351 | } 352 | 353 | public static TYPE_CONSTRUCTOR(): string { 354 | return `entity.name.function ${this.STYLE_BOLD()}`; 355 | } 356 | 357 | public static VARIABLE_PATTERN(): string { 358 | return `string.other.link variable.language variable.parameter ${this.STYLE_ITALICS()}`; 359 | } 360 | 361 | public static VARIABLE_TYPE(): string { 362 | return `${this.STYLE_CONTROL()} ${this.STYLE_ITALICS()}`; 363 | } 364 | 365 | public static VERTICAL_LINE(): string { 366 | return `support.type ${this.STYLE_BOLD()}`; 367 | } 368 | } 369 | 370 | export interface IGrammar { 371 | bindClassTerm(): schema.Rule; 372 | bindClassType(): schema.Rule; 373 | bindConstructor(): schema.Rule; 374 | bindSignature(): schema.Rule; 375 | bindStructure(): schema.Rule; 376 | bindTerm(): schema.Rule; 377 | bindTermArgs(): schema.Rule; 378 | bindType(): schema.Rule; 379 | boundary(): string; 380 | comment(): schema.Rule; 381 | commentBlock(): schema.Rule; 382 | commentDoc(): schema.Rule; 383 | decl(): schema.Rule; 384 | declClass(): schema.Rule; 385 | declEnd(): string; 386 | declEndItem(): string; 387 | declEndItemWith(...rest: string[]): string; 388 | declEndSans(...rest: string[]): string; 389 | declEndTokens(): string[]; 390 | declException(): schema.Rule; 391 | declInclude(): schema.Rule; 392 | declModule(): schema.Rule; 393 | declOpen(): schema.Rule; 394 | declStartTokens(): string[]; 395 | declTerm(): schema.Rule; 396 | declType(): schema.Rule; 397 | escapes(...rest: string[]): schema.Rule; 398 | expEnd(): string; 399 | functor(ruleBody: () => schema.Rule): schema.Rule[]; 400 | ident(): string; 401 | identLower(): string; 402 | identUpper(): string; 403 | lastOps(...rest: string[]): string; 404 | literal(): schema.Rule; 405 | literalArray(): schema.Rule; 406 | literalBoolean(): schema.Rule; 407 | literalCharacter(): schema.Rule; 408 | literalCharacterEscape(): schema.Rule; 409 | literalList(): schema.Rule; 410 | literalNumber(): schema.Rule; 411 | literalObjectTerm(): schema.Rule; 412 | literalClassType(): schema.Rule; 413 | literalRecord(): schema.Rule; 414 | literalString(): schema.Rule; 415 | literalStringEscape(): schema.Rule; 416 | literalUnit(): schema.Rule; 417 | operator(): string; 418 | operatorTokens(): string[]; 419 | ops(arg: string): string; 420 | parens(ruleLHS: string, ruleRHS: string): schema.Rule; 421 | pathModuleExtended(): schema.Rule; 422 | pathModulePrefixExtended(): schema.Rule; 423 | pathModulePrefixExtendedParens(): schema.Rule; 424 | pathModulePrefixSimple(): schema.Rule; 425 | pathModuleSimple(): schema.Rule; 426 | pathRecord(): schema.Rule; 427 | pathType(): schema.Rule; 428 | pattern(): schema.Rule; 429 | patternArray(): schema.Rule; 430 | patternLazy(): schema.Rule; 431 | patternList(): schema.Rule; 432 | patternMisc(): schema.Rule; 433 | patternModule(): schema.Rule; 434 | patternParens(): schema.Rule; 435 | patternRecord(): schema.Rule; 436 | patternType(): schema.Rule; 437 | pragma(): schema.Rule; 438 | signature(): schema.Rule; 439 | signatureConstraints(): schema.Rule; 440 | signatureFunctor(): schema.Rule; 441 | signatureLiteral(): schema.Rule; 442 | signatureParens(): schema.Rule; 443 | signatureRecovered(): schema.Rule; 444 | structure(): schema.Rule; 445 | structureFunctor(): schema.Rule; 446 | structureLiteral(): schema.Rule; 447 | structureParens(): schema.Rule; 448 | structureUnpack(): schema.Rule; 449 | term(): schema.Rule; 450 | termAtomic(): schema.Rule; 451 | termConditional(): schema.Rule; 452 | termConstructor(): schema.Rule; 453 | termDelim(): schema.Rule; 454 | termFor(): schema.Rule; 455 | termFunction(): schema.Rule; 456 | termLet(): schema.Rule; 457 | termMatch(): schema.Rule; 458 | termMatchRule(): schema.Rule; 459 | termOperator(): schema.Rule; 460 | termPun(): schema.Rule; 461 | termTry(): schema.Rule; 462 | termWhile(): schema.Rule; 463 | type(): schema.Rule; 464 | typeConstructor(): schema.Rule; 465 | typeLabel(): schema.Rule; 466 | typeModule(): schema.Rule; 467 | typeObject(): schema.Rule; 468 | typeOperator(): schema.Rule; 469 | typeParens(): schema.Rule; 470 | typePolymorphicVariant(): schema.Rule; 471 | typeRecord(): schema.Rule; 472 | variableModule(): schema.Rule; 473 | variablePattern(): schema.Rule; 474 | } 475 | 476 | export interface IRender { 477 | render(): schema.IGrammar; 478 | } 479 | 480 | export interface ILanguage extends IGrammar, IRender {} 481 | -------------------------------------------------------------------------------- /src/syntaxes/schema.ts: -------------------------------------------------------------------------------- 1 | export interface IPatterns extends Array {} 2 | 3 | export interface IGrammar { 4 | name: string; 5 | scopeName: string; 6 | fileTypes: string[]; 7 | patterns: IPatterns; 8 | repository: IRepository; 9 | } 10 | 11 | export interface IMatchScopes { 12 | [key: string]: RuleSimple; 13 | } 14 | 15 | export type Rule = RuleSimple | IRuleCapturing | IRuleDelimited | IRuleReference; 16 | 17 | export interface IRuleCapturing { 18 | match: string; 19 | name?: string; 20 | captures?: IMatchScopes; 21 | patterns?: IPatterns; 22 | } 23 | 24 | export interface IRuleDelimited { 25 | begin: string; 26 | end: string; 27 | applyEndPatternLast?: boolean; 28 | name?: string; 29 | contentName?: string; 30 | beginCaptures?: IMatchScopes; 31 | endCaptures?: IMatchScopes; 32 | patterns?: IPatterns; 33 | } 34 | 35 | export interface IRuleReference { 36 | include: string; 37 | } 38 | 39 | export type RuleSimple = 40 | | { 41 | name: string; 42 | patterns?: IPatterns; 43 | } 44 | | { 45 | name?: string; 46 | patterns: IPatterns; 47 | }; 48 | 49 | export interface IRepository { 50 | [key: string]: Rule; 51 | } 52 | -------------------------------------------------------------------------------- /syntaxes/merlin.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.ocaml.merlin", 3 | "fileTypes": [ 4 | "merlin" 5 | ], 6 | "patterns": [ 7 | { "include": "#comment" }, 8 | { "include": "#directory" }, 9 | { "include": "#flag" }, 10 | { "include": "#package" } 11 | ], 12 | "repository": { 13 | "comment": { 14 | "begin": "#", 15 | "end": "$", 16 | "name": "comment.line" 17 | }, 18 | "directory": { 19 | "begin": "\\b(B|S)\\b", 20 | "end": "$", 21 | "beginCaptures": { 22 | "1": { "name": "keyword.other" } 23 | }, 24 | "patterns": [ 25 | { 26 | "match": "(?|~$])@{1,3}(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\]","beginCaptures":{"1":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#attributePayload"}]},"attributeIdentifier":{"match":"((?|~$])%(?![#\\-:!?.@*/&%^+<=>|~$]))((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))","captures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"punctuation.definition.tag"}}},"attributePayload":{"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]%|^%))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"((?|~$])[:\\?](?![#\\-:!?.@*/&%^+<=>|~$]))|(?<=[[:space:]])|(?=\\])","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#pathModuleExtended"},{"include":"#pathRecord"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=\\])","patterns":[{"include":"#signature"},{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\?|^\\?))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=\\])","patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\?|^\\?))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=\\])|\\bwhen\\b","endCaptures":{"1":{}},"patterns":[{"include":"#pattern"}]},{"begin":"(?:(?<=(?:[^[:word:]]when|^when))(?![[:word:]]))","end":"(?=\\])","patterns":[{"include":"#term"}]}]},{"include":"#term"}]},"bindClassTerm":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]class|^class|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])(:)|(=)(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]class|^class|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?=(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)[[:space:]]*,|[^[:space:][:lower:]%])|(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)|(?=\\btype\\b)","endCaptures":{"0":{"name":"entity.name.function strong emphasis"}},"patterns":[{"include":"#attributeIdentifier"}]},{"begin":"\\[","end":"\\]","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#type"}]},{"include":"#bindTermArgs"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#literalClassType"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#term"}]}]},"bindClassType":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]class|^class|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])(:)|(=)(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]class|^class|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?=(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)[[:space:]]*,|[^[:space:][:lower:]%])|(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)|(?=\\btype\\b)","endCaptures":{"0":{"name":"entity.name.function strong emphasis"}},"patterns":[{"include":"#attributeIdentifier"}]},{"begin":"\\[","end":"\\]","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#type"}]},{"include":"#bindTermArgs"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#literalClassType"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#literalClassType"}]}]},"bindConstructor":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]exception|^exception))(?![[:word:]]))|(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\+=|^\\+=|[^#\\-:!?.@*/&%^+<=>|~$]=|^=|[^#\\-:!?.@*/&%^+<=>|~$]\\||^\\|))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(:)|(\\bof\\b)|((?|~$])\\|(?![#\\-:!?.@*/&%^+<=>|~$]))|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"punctuation.definition.tag"},"3":{"name":"support.type strong"}},"patterns":[{"include":"#attributeIdentifier"},{"match":"\\.\\.","name":"variable.other.class.js message.error variable.interpolation string.regexp"},{"match":"\\b(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)\\b(?![[:space:]]*(?:\\.|\\([^\\*]))","name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?:(?<=(?:[^[:word:]]of|^of))(?![[:word:]]))","end":"(?|~$])\\|(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]}]},"bindSignature":{"patterns":[{"include":"#comment"},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#comment"},{"include":"#pathModuleExtended"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#signature"}]}]},"bindStructure":{"patterns":[{"include":"#comment"},{"begin":"(?:(?<=(?:[^[:word:]]and|^and))(?![[:word:]]))|(?=[[:upper:]])","end":"(?|~$])(:(?!=))|(:?=)(?![#\\-:!?.@*/&%^+<=>|~$])|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#comment"},{"match":"\\bmodule\\b","name":"markup.inserted constant.language support.constant.property-value entity.name.filename"},{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","name":"entity.name.function strong emphasis"},{"begin":"\\((?!\\))","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"begin":"(?|~$]):(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?=\\))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"}},"patterns":[{"include":"#signature"}]},{"include":"#variableModule"}]},{"include":"#literalUnit"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\b(and)\\b|((?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$]))|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#signature"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:=|^:=|[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\b(?:(and)|(with))\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#structure"}]}]},"bindTerm":{"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]!|^!))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]external|^external|[^[:word:]]let|^let|[^[:word:]]method|^method|[^[:word:]]val|^val))(?![[:word:]]))","end":"(\\bmodule\\b)|(\\bopen\\b)|(?|~$])(:)|((?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$]))(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"1":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"4":{"name":"support.type strong"}},"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]!|^!))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]external|^external|[^[:word:]]let|^let|[^[:word:]]method|^method|[^[:word:]]val|^val))(?![[:word:]]))","end":"(?=\\b(?:module|open)\\b)|(?=(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)[[:space:]]*,|[^[:space:][:lower:]%])|(\\brec\\b)|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"entity.name.function strong emphasis"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"}]},{"begin":"(?:(?<=(?:[^[:word:]]rec|^rec))(?![[:word:]]))","end":"((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))|(?=[^[:space:][:alpha:]])","endCaptures":{"0":{"name":"entity.name.function strong emphasis"}},"patterns":[{"include":"#bindTermArgs"}]},{"include":"#bindTermArgs"}]},{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#declModule"}]},{"begin":"(?:(?<=(?:[^[:word:]]open|^open))(?![[:word:]]))","end":"(?=\\bin\\b)|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#pathModuleSimple"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\btype\\b|(?=[^[:space:]])","endCaptures":{"0":{"name":"keyword.control"}}},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$])","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#pattern"}]},{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#term"}]}]},"bindTermArgs":{"patterns":[{"begin":"~|\\?","end":":|(?=[^[:space:]])","applyEndPatternLast":true,"beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"keyword"}},"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]~|^~|[^#\\-:!?.@*/&%^+<=>|~$]\\?|^\\?))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)|(?<=\\))","endCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}},"patterns":[{"include":"#comment"},{"begin":"\\((?!\\*)","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"begin":"(?<=\\()","end":":|=","endCaptures":{"0":{"name":"keyword"}},"patterns":[{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}]},{"begin":"(?<=:)","end":"=|(?=\\))","endCaptures":{"0":{"name":"keyword"}},"patterns":[{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=\\))","patterns":[{"include":"#term"}]}]}]}]},{"include":"#pattern"}]},"bindType":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]type|^type))(?![[:word:]]))","end":"(?|~$])\\+=|=(?![#\\-:!?.@*/&%^+<=>|~$])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#pathType"},{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"entity.name.function strong"},{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\+=|^\\+=|[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\band\\b|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"include":"#bindConstructor"}]}]},"comment":{"patterns":[{"include":"#attribute"},{"include":"#extension"},{"include":"#commentBlock"},{"include":"#commentDoc"}]},"commentBlock":{"begin":"\\(\\*(?!\\*[^\\)])","end":"\\*\\)","name":"comment constant.regexp meta.separator.markdown","contentName":"emphasis","patterns":[{"include":"#commentBlock"},{"include":"#commentDoc"}]},"commentDoc":{"begin":"\\(\\*\\*","end":"\\*\\)","name":"comment constant.regexp meta.separator.markdown","patterns":[{"match":"\\*"},{"include":"#comment"}]},"decl":{"patterns":[{"include":"#declClass"},{"include":"#declException"},{"include":"#declInclude"},{"include":"#declModule"},{"include":"#declOpen"},{"include":"#declTerm"},{"include":"#declType"}]},"declClass":{"begin":"\\bclass\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"entity.name.class constant.numeric markup.underline"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"begin":"(?:(?<=(?:[^[:word:]]class|^class))(?![[:word:]]))","end":"\\btype\\b|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|val)\\b)","beginCaptures":{"0":{"name":"entity.name.class constant.numeric markup.underline"}},"endCaptures":{"0":{"name":"keyword"}},"patterns":[{"include":"#bindClassTerm"}]},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#bindClassType"}]}]},"declException":{"begin":"\\bexception\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"keyword markup.underline"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"},{"include":"#pragma"},{"include":"#bindConstructor"}]},"declInclude":{"begin":"\\binclude\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"},{"include":"#pragma"},{"include":"#signature"}]},"declModule":{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))|\\bmodule\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename markup.underline"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))","end":"(\\btype\\b)|(?=[[:upper:]])","endCaptures":{"0":{"name":"keyword"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"},{"match":"\\brec\\b","name":"variable.other.class.js message.error variable.interpolation string.regexp"}]},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#bindSignature"}]},{"begin":"(?=[[:upper:]])","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#bindStructure"}]}]},"declOpen":{"begin":"\\bopen\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#comment"},{"include":"#pragma"},{"include":"#pathModuleExtended"}]},"declTerm":{"begin":"\\b(?:(external|val)|(method)|(let))\\b(!?)","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"1":{"name":"support.type markup.underline"},"2":{"name":"storage.type markup.underline"},"3":{"name":"keyword.control markup.underline"},"4":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"include":"#bindTerm"}]},"declType":{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))|\\btype\\b","end":";;|(?=\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"keyword markup.underline"}},"endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"include":"#bindType"}]},"extension":{"begin":"(\\[)((?|~$])%{1,3}(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\]","beginCaptures":{"1":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#attributePayload"}]},"literal":{"patterns":[{"include":"#termConstructor"},{"include":"#literalArray"},{"include":"#literalBoolean"},{"include":"#literalCharacter"},{"include":"#literalList"},{"include":"#literalNumber"},{"include":"#literalObjectTerm"},{"include":"#literalString"},{"include":"#literalRecord"},{"include":"#literalUnit"}]},"literalArray":{"begin":"\\[\\|","end":"\\|\\]","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#term"}]},"literalBoolean":{"match":"\\bfalse|true\\b","name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"literalCharacter":{"begin":"(?|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^[:word:]]with|^with))(?![[:word:]]))","end":"(:)|(=)|(;)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(;)|(=)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":";|(?=\\})","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#term"}]}]},"literalString":{"patterns":[{"begin":"\"","end":"\"","name":"string beginning.punctuation.definition.quote.markdown","patterns":[{"include":"#literalStringEscape"}]},{"begin":"(\\{)([_[:lower:]]*?)(\\|)","end":"(\\|)(\\2)(\\})","name":"string beginning.punctuation.definition.quote.markdown","patterns":[{"include":"#literalStringEscape"}]}]},"literalStringEscape":{"match":"\\\\(?:[\\\\\"ntbr]|[[:digit:]][[:digit:]][[:digit:]]|x[[:xdigit:]][[:xdigit:]]|o[0-3][0-7][0-7])"},"literalUnit":{"match":"\\(\\)","name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"pathModuleExtended":{"patterns":[{"include":"#pathModulePrefixExtended"},{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","name":"entity.name.class constant.numeric"}]},"pathModulePrefixExtended":{"begin":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\.|$|\\()","end":"(?![[:space:]\\.]|$|\\()","beginCaptures":{"0":{"name":"entity.name.class constant.numeric"}},"patterns":[{"include":"#comment"},{"begin":"\\(","end":"\\)","captures":{"0":{"name":"keyword.control"}},"patterns":[{"match":"((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\)))","name":"string.other.link variable.language variable.parameter emphasis"},{"include":"#structure"}]},{"begin":"(?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$])","end":"((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\.|$))|((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*(?:$|\\()))|((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\)))|(?![[:space:]\\.[:upper:]]|$|\\()","beginCaptures":{"0":{"name":"keyword strong"}},"endCaptures":{"1":{"name":"entity.name.class constant.numeric"},"2":{"name":"entity.name.function strong"},"3":{"name":"string.other.link variable.language variable.parameter emphasis"}}}]},"pathModulePrefixExtendedParens":{"begin":"\\(","end":"\\)","captures":{"0":{"name":"keyword.control"}},"patterns":[{"match":"((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\)))","name":"string.other.link variable.language variable.parameter emphasis"},{"include":"#structure"}]},"pathModulePrefixSimple":{"begin":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\.)","end":"(?![[:space:]\\.])","beginCaptures":{"0":{"name":"entity.name.class constant.numeric"}},"patterns":[{"include":"#comment"},{"begin":"(?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$])","end":"((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*\\.))|((?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)(?=[[:space:]]*))|(?![[:space:]\\.[:upper:]])","beginCaptures":{"0":{"name":"keyword strong"}},"endCaptures":{"1":{"name":"entity.name.class constant.numeric"},"2":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}}}]},"pathModuleSimple":{"patterns":[{"include":"#pathModulePrefixSimple"},{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","name":"entity.name.class constant.numeric"}]},"pathRecord":{"patterns":[{"begin":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","end":"(?=[^[:space:]\\.])(?!\\(\\*)","patterns":[{"include":"#comment"},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\.|^\\.))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$])","end":"((?|~$])\\.(?![#\\-:!?.@*/&%^+<=>|~$]))|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|mutable|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))|(?<=\\))|(?<=\\])","beginCaptures":{"0":{"name":"keyword strong"}},"endCaptures":{"1":{"name":"keyword strong"},"2":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixSimple"},{"begin":"\\((?!\\*)","end":"\\)","captures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#term"}]},{"begin":"\\[","end":"\\]","captures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#pattern"}]}]}]}]},"pattern":{"patterns":[{"include":"#comment"},{"include":"#patternArray"},{"include":"#patternLazy"},{"include":"#patternList"},{"include":"#patternMisc"},{"include":"#patternModule"},{"include":"#patternRecord"},{"include":"#literal"},{"include":"#patternParens"},{"include":"#patternType"},{"include":"#variablePattern"},{"include":"#termOperator"}]},"patternArray":{"begin":"\\[\\|","end":"\\|\\]","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#pattern"}]},"patternLazy":{"match":"lazy","name":"variable.other.class.js message.error variable.interpolation string.regexp"},"patternList":{"begin":"\\[","end":"\\]","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}},"patterns":[{"include":"#pattern"}]},"patternMisc":{"match":"((?|~$]),(?![#\\-:!?.@*/&%^+<=>|~$]))|([#\\-:!?.@*/&%^+<=>|~$]+)|\\b(as)\\b","captures":{"1":{"name":"string.regexp strong"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}}},"patternModule":{"begin":"\\bmodule\\b","end":"(?=\\))","beginCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}},"patterns":[{"include":"#declModule"}]},"patternParens":{"begin":"\\((?!\\))","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"begin":"(?|~$]):(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?=\\))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"}},"patterns":[{"include":"#type"}]},{"include":"#pattern"}]},"patternRecord":{"begin":"\\{","end":"\\}","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong strong"}},"patterns":[{"begin":"(?<=\\{|;)","end":"(:)|(=)|(;)|(with)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"4":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixSimple"},{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^[:word:]]with|^with))(?![[:word:]]))","end":"(:)|(=)|(;)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(;)|(=)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":";|(?=\\})","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#pattern"}]}]},"patternType":{"begin":"\\btype\\b","end":"(?=\\))","beginCaptures":{"0":{"name":"keyword"}},"patterns":[{"include":"#declType"}]},"pragma":{"begin":"(?|~$])#(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"include":"#literalNumber"},{"include":"#literalString"}]},"signature":{"patterns":[{"include":"#comment"},{"include":"#signatureLiteral"},{"include":"#signatureFunctor"},{"include":"#pathModuleExtended"},{"include":"#signatureParens"},{"include":"#signatureRecovered"},{"include":"#signatureConstraints"}]},"signatureConstraints":{"begin":"\\bwith\\b","end":"(?=\\))|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]with|^with))(?![[:word:]]))","end":"\\b(?:(module)|(type))\\b","endCaptures":{"1":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"},"2":{"name":"keyword"}}},{"include":"#declModule"},{"include":"#declType"}]},"signatureFunctor":{"patterns":[{"begin":"\\bfunctor\\b","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"keyword"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]functor|^functor))(?![[:word:]]))","end":"(\\(\\))|(\\((?!\\)))","endCaptures":{"1":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"2":{"name":"punctuation.definition.tag"}}},{"begin":"(?<=\\()","end":"(:)|(\\))","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#variableModule"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\)","endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#signature"}]},{"begin":"(?<=\\))","end":"(\\()|((?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$]))","endCaptures":{"1":{"name":"punctuation.definition.tag"},"2":{"name":"support.type strong"}}},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]->|^->))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#signature"}]}]},{"match":"(?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$])","name":"support.type strong"}]},"signatureLiteral":{"begin":"\\bsig\\b","end":"\\bend\\b","captures":{"0":{"name":"punctuation.definition.tag emphasis"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"include":"#decl"}]},"signatureParens":{"begin":"\\((?!\\))","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#comment"},{"begin":"(?|~$]):(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?=\\))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"}},"patterns":[{"include":"#signature"}]},{"include":"#signature"}]},"signatureRecovered":{"patterns":[{"begin":"\\(|(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:|[^#\\-:!?.@*/&%^+<=>|~$]->|^->))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?:(?<=(?:[^[:word:]]include|^include|[^[:word:]]open|^open))(?![[:word:]]))","end":"\\bmodule\\b|(?!$|[[:space:]]|\\bmodule\\b)","endCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}}},{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"begin":"(?:(?<=(?:[^[:word:]]module|^module))(?![[:word:]]))","end":"\\btype\\b","endCaptures":{"0":{"name":"keyword"}}},{"begin":"(?:(?<=(?:[^[:word:]]type|^type))(?![[:word:]]))","end":"\\bof\\b","endCaptures":{"0":{"name":"punctuation.definition.tag"}}},{"begin":"(?:(?<=(?:[^[:word:]]of|^of))(?![[:word:]]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#signature"}]}]}]},"structure":{"patterns":[{"include":"#comment"},{"include":"#structureLiteral"},{"include":"#structureFunctor"},{"include":"#pathModuleExtended"},{"include":"#structureParens"}]},"structureFunctor":{"patterns":[{"begin":"\\bfunctor\\b","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"0":{"name":"keyword"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]functor|^functor))(?![[:word:]]))","end":"(\\(\\))|(\\((?!\\)))","endCaptures":{"1":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"},"2":{"name":"punctuation.definition.tag"}}},{"begin":"(?<=\\()","end":"(:)|(\\))","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#variableModule"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\)","endCaptures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#signature"}]},{"begin":"(?<=\\))","end":"(\\()|((?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$]))","endCaptures":{"1":{"name":"punctuation.definition.tag"},"2":{"name":"support.type strong"}}},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]->|^->))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","patterns":[{"include":"#structure"}]}]},{"match":"(?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$])","name":"support.type strong"}]},"structureLiteral":{"begin":"\\bstruct\\b","end":"\\bend\\b","captures":{"0":{"name":"punctuation.definition.tag emphasis"}},"patterns":[{"include":"#comment"},{"include":"#pragma"},{"include":"#decl"}]},"structureParens":{"begin":"\\(","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#structureUnpack"},{"include":"#structure"}]},"structureUnpack":{"begin":"\\bval\\b","end":"(?=\\))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}}},"term":{"patterns":[{"include":"#termLet"},{"include":"#termAtomic"}]},"termAtomic":{"patterns":[{"include":"#comment"},{"include":"#termConditional"},{"include":"#termConstructor"},{"include":"#termDelim"},{"include":"#termFor"},{"include":"#termFunction"},{"include":"#literal"},{"include":"#termMatch"},{"include":"#termMatchRule"},{"include":"#termPun"},{"include":"#termOperator"},{"include":"#termTry"},{"include":"#termWhile"},{"include":"#pathRecord"}]},"termConditional":{"match":"\\b(?:if|then|else)\\b","name":"keyword.control"},"termConstructor":{"patterns":[{"include":"#pathModulePrefixSimple"},{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","name":"constant.language constant.numeric entity.other.attribute-name.id.css strong"}]},"termDelim":{"patterns":[{"begin":"\\((?!\\))","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#term"}]},{"begin":"\\bbegin\\b","end":"\\bend\\b","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"include":"#attributeIdentifier"},{"include":"#term"}]}]},"termFor":{"patterns":[{"begin":"\\bfor\\b","end":"\\bdone\\b","beginCaptures":{"0":{"name":"keyword.control"}},"endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]for|^for))(?![[:word:]]))","end":"(?|~$])=(?![#\\-:!?.@*/&%^+<=>|~$])","endCaptures":{"0":{"name":"support.type strong"}},"patterns":[{"include":"#pattern"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"\\b(?:downto|to)\\b","endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},{"begin":"(?:(?<=(?:[^[:word:]]to|^to))(?![[:word:]]))","end":"\\bdo\\b","endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},{"begin":"(?:(?<=(?:[^[:word:]]do|^do))(?![[:word:]]))","end":"(?=\\bdone\\b)","patterns":[{"include":"#term"}]}]}]},"termFunction":{"match":"\\b(?:(fun)|(function))\\b","captures":{"1":{"name":"storage.type"},"2":{"name":"storage.type"}}},"termLet":{"patterns":[{"begin":"(?:(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=|[^#\\-:!?.@*/&%^+<=>|~$]->|^->))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?<=;|\\())(?=[[:space:]]|\\blet\\b)|(?:(?<=(?:[^[:word:]]begin|^begin|[^[:word:]]do|^do|[^[:word:]]else|^else|[^[:word:]]in|^in|[^[:word:]]struct|^struct|[^[:word:]]then|^then|[^[:word:]]try|^try))(?![[:word:]]))|(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]@@|^@@))(?![#\\-:!?.@*/&%^+<=>|~$]))[[:space:]]+","end":"\\b(?:(and)|(let))\\b|(?=[^[:space:]])(?!\\(\\*)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"},"2":{"name":"storage.type markup.underline"}},"patterns":[{"include":"#comment"}]},{"begin":"(?:(?<=(?:[^[:word:]]and|^and|[^[:word:]]let|^let))(?![[:word:]]))|(let)","end":"\\b(?:(and)|(in))\\b|(?=\\}|\\)|\\]|\\b(?:end|class|exception|external|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"1":{"name":"storage.type markup.underline"}},"endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp markup.underline"},"2":{"name":"storage.type markup.underline"}},"patterns":[{"include":"#bindTerm"}]}]},"termMatch":{"begin":"\\bmatch\\b","end":"\\bwith\\b","captures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},"termMatchRule":{"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]fun|^fun|[^[:word:]]function|^function|[^[:word:]]with|^with))(?![[:word:]]))","end":"(?|~$])(\\|)|(->)(?![#\\-:!?.@*/&%^+<=>|~$])","endCaptures":{"1":{"name":"support.type strong"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#comment"},{"include":"#attributeIdentifier"},{"include":"#pattern"}]},{"begin":"(?:(?<=(?:[^\\[#\\-:!?.@*/&%^+<=>|~$]\\||^\\|))(?![#\\-:!?.@*/&%^+<=>|~$]))|(?|~$])\\|(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?|~$])(\\|)|(->)(?![#\\-:!?.@*/&%^+<=>|~$])","beginCaptures":{"0":{"name":"support.type strong"}},"endCaptures":{"1":{"name":"support.type strong"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#pattern"},{"begin":"\\bwhen\\b","end":"(?=(?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$]))","beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#term"}]}]}]},"termOperator":{"patterns":[{"begin":"(?|~$])#(?![#\\-:!?.@*/&%^+<=>|~$])","end":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","beginCaptures":{"0":{"name":"keyword"}},"endCaptures":{"0":{"name":"entity.name.function"}}},{"match":"<-","captures":{"0":{"name":"keyword.control strong"}}},{"match":"(,|[#\\-:!?.@*/&%^+<=>|~$]+)|(;)","captures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}}},{"match":"\\b(?:and|assert|asr|land|lazy|lsr|lxor|mod|new|or)\\b","name":"variable.other.class.js message.error variable.interpolation string.regexp"}]},"termPun":{"begin":"(?|~$])\\?|~(?![#\\-:!?.@*/&%^+<=>|~$])","end":":|(?=[^[:space:]:])","applyEndPatternLast":true,"beginCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"endCaptures":{"0":{"name":"keyword"}},"patterns":[{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]\\?|^\\?|[^#\\-:!?.@*/&%^+<=>|~$]~|^~))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","endCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}}}]},"termTry":{"begin":"\\btry\\b","end":"\\bwith\\b","captures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},"termWhile":{"patterns":[{"begin":"\\bwhile\\b","end":"\\bdone\\b","beginCaptures":{"0":{"name":"keyword.control"}},"endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"begin":"(?:(?<=(?:[^[:word:]]while|^while))(?![[:word:]]))","end":"\\bdo\\b","endCaptures":{"0":{"name":"keyword.control"}},"patterns":[{"include":"#term"}]},{"begin":"(?:(?<=(?:[^[:word:]]do|^do))(?![[:word:]]))","end":"(?=\\bdone\\b)","patterns":[{"include":"#term"}]}]}]},"type":{"patterns":[{"include":"#comment"},{"match":"\\bnonrec\\b","name":"variable.other.class.js message.error variable.interpolation string.regexp"},{"include":"#pathModulePrefixExtended"},{"include":"#typeLabel"},{"include":"#typeObject"},{"include":"#typeOperator"},{"include":"#typeParens"},{"include":"#typePolymorphicVariant"},{"include":"#typeRecord"},{"include":"#typeConstructor"}]},"typeConstructor":{"patterns":[{"begin":"(_)|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))|(')((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))|(?<=[^\\*]\\)|\\])","end":"(?=\\((?!\\*)|\\*|:|,|=|\\.|>|-|\\{|\\[|\\+|\\}|\\)|\\]|;|\\|)|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))[:space:]*(?!\\(\\*|[[:word:]])|(?=;;|\\}|\\)|\\]|\\b(?:end|and|class|exception|external|in|include|inherit|initializer|let|method|module|open|type|val)\\b)","beginCaptures":{"1":{"name":"comment constant.regexp meta.separator.markdown"},"3":{"name":"string.other.link variable.language variable.parameter emphasis strong emphasis"},"4":{"name":"keyword.control emphasis"}},"endCaptures":{"1":{"name":"entity.name.function strong"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixExtended"}]}]},"typeLabel":{"patterns":[{"begin":"(\\??)((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))[[:space:]]*((?|~$]):(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(?=(?|~$])->(?![#\\-:!?.@*/&%^+<=>|~$]))","captures":{"1":{"name":"keyword strong emphasis"},"2":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"},"3":{"name":"keyword"}},"patterns":[{"include":"#type"}]}]},"typeModule":{"begin":"\\bmodule\\b","end":"(?=\\))","beginCaptures":{"0":{"name":"markup.inserted constant.language support.constant.property-value entity.name.filename"}},"patterns":[{"include":"#pathModuleExtended"},{"include":"#signatureConstraints"}]},"typeObject":{"begin":"<","end":">","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong strong"}},"patterns":[{"begin":"(?<=<|;)","end":"(:)|(?=>)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"4":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixSimple"},{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(;)|(?=>)","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]}]},"typeOperator":{"patterns":[{"match":",|;|[#\\-:!?.@*/&%^+<=>|~$]+","name":"variable.other.class.js message.error variable.interpolation string.regexp strong"}]},"typeParens":{"begin":"\\(","end":"\\)","captures":{"0":{"name":"punctuation.definition.tag"}},"patterns":[{"match":",","name":"variable.other.class.js message.error variable.interpolation string.regexp"},{"include":"#typeModule"},{"include":"#type"}]},"typePolymorphicVariant":{"begin":"\\[","end":"\\]","patterns":[]},"typeRecord":{"begin":"\\{","end":"\\}","captures":{"0":{"name":"constant.language constant.numeric entity.other.attribute-name.id.css strong strong"}},"patterns":[{"begin":"(?<=\\{|;)","end":"(:)|(=)|(;)|(with)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"4":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#comment"},{"include":"#pathModulePrefixSimple"},{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^[:word:]]with|^with))(?![[:word:]]))","end":"(:)|(=)|(;)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp strong"},"2":{"name":"support.type strong"},"3":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"match":"(?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*)","name":"markup.inserted constant.language support.constant.property-value entity.name.filename emphasis"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]:|^:))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":"(;)|(=)|(?=\\})","endCaptures":{"1":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"},"2":{"name":"support.type strong"}},"patterns":[{"include":"#type"}]},{"begin":"(?:(?<=(?:[^#\\-:!?.@*/&%^+<=>|~$]=|^=))(?![#\\-:!?.@*/&%^+<=>|~$]))","end":";|(?=\\})","endCaptures":{"0":{"name":"variable.other.class.js message.error variable.interpolation string.regexp"}},"patterns":[{"include":"#type"}]}]},"variableModule":{"match":"(?:\\b(?=[[:upper:]])[[:alpha:]_][[:word:]']*)","captures":{"0":{"name":"string.other.link variable.language variable.parameter emphasis"}}},"variablePattern":{"match":"(\\b_\\b)|((?:(?!\\b(?:and|'|as|asr|assert|\\*|begin|class|:|,|@|constraint|do|done|downto|else|end|=|exception|external|false|for|\\.|fun|function|functor|>|-|if|in|include|inherit|initializer|land|lazy|\\{|\\(|\\[|<|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|#|object|of|open|or|%|\\+|private|\\?|\"|rec|\\\\|\\}|\\)|\\]|;|sig|/|struct|then|~|to|true|try|type|val|\\||virtual|when|while|with)\\b(?:[^']|$))\\b(?=[[:lower:]_])[[:alpha:]_][[:word:]']*))","captures":{"1":{"name":"comment constant.regexp meta.separator.markdown"},"2":{"name":"string.other.link variable.language variable.parameter emphasis"}}}}} -------------------------------------------------------------------------------- /syntaxes/ocamlbuild.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.ocaml.ocamlbuild", 3 | "fileTypes": [ 4 | "_tags" 5 | ], 6 | "patterns": [ 7 | { "include": "#directive" } 8 | ], 9 | "repository": { 10 | "directive": { 11 | "patterns": [ 12 | { 13 | "begin": "", 14 | "end": "(?=[:])", 15 | "patterns": [ 16 | { 17 | "begin": "(<)", 18 | "end": "(>)", 19 | "beginCaptures": { 20 | "1": { "name": "keyword.other" } 21 | }, 22 | "endCaptures": { 23 | "1": { "name": "keyword.other" } 24 | }, 25 | "patterns": [ 26 | { 27 | "match": "(?