Skip to content

Commit

Permalink
Replace the dune grammar and add more filenames
Browse files Browse the repository at this point in the history
Includes `dune` and `dune-workspace`.
  • Loading branch information
huwaireb committed Nov 25, 2024
1 parent f164d13 commit 69d5bf0
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,6 @@
[submodule "vendor/grammars/vscode-curry"]
path = vendor/grammars/vscode-curry
url = https://github.com/fwcd/vscode-curry
[submodule "vendor/grammars/vscode-dune"]
path = vendor/grammars/vscode-dune
url = https://github.com/maelvls/vscode-dune.git
[submodule "vendor/grammars/vscode-euphoria"]
path = vendor/grammars/vscode-euphoria
url = https://github.com/OpenEuphoria/vscode-euphoria
Expand Down Expand Up @@ -1428,3 +1425,6 @@
[submodule "vendor/grammars/zephir-sublime"]
path = vendor/grammars/zephir-sublime
url = https://github.com/phalcon/zephir-sublime
[submodule "vendor/grammars/vscode-ocaml-platform"]
path = vendor/grammars/vscode-ocaml-platform
url = https://github.com/ocamllabs/vscode-ocaml-platform.git
2 changes: 1 addition & 1 deletion grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ vendor/grammars/vscode-curry:
- markdown.curry.codeblock
- source.curry
- source.icurry
vendor/grammars/vscode-dune:
vendor/grammars/vscode-ocaml-platform:
- source.dune
vendor/grammars/vscode-euphoria:
- source.euphoria
Expand Down
2 changes: 2 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,9 @@ Dune:
type: programming
ace_mode: lisp
filenames:
- dune-workspace
- dune-project
- dune
tm_scope: source.dune
color: "#89421e"
language_id: 754574151
Expand Down
101 changes: 101 additions & 0 deletions samples/Dune/filenames/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
(ocamllex
(modules reason_declarative_lexer))

; Use select.exe from janestreet/ppx_ast to choose ocaml_util.ml based on ocaml version

(rule
(targets ocaml_util.ml)
(deps ocaml_util.cppo.ml)
(action
(run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets})))

(menhir
(flags --strict --inspection --unused-tokens --table --cmly)
(modules reason_parser))

; Previously, make preprocess.
; (rule
; (targets reason_parser.cmly reason_parser.ml reason_parser.mli)
; (deps reason_parser.mly)
; (action
; (run menhir --strict --inspection --infer
; --unused-tokens
; --fixed-exception
; --table
; --cmly reason_parser.mly)))

(executables
(names menhir_error_processor)
(modules menhir_error_processor)
(libraries unix menhirSdk))

(rule
(targets reason_parser_explain_raw.ml)
(deps reason_parser.cmly)
(action
(with-stdout-to
%{targets}
(run ./menhir_error_processor.exe reason_parser.cmly))))

(rule
(targets reason_parser_recover.ml)
(deps reason_parser.cmly)
(action
(with-stdout-to
%{targets}
(run ../menhir-recover/main.exe reason_parser.cmly))))

(rule
(targets reason_syntax_util.ml)
(deps reason_syntax_util.cppo.ml)
(action
(run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets})))

(rule
(targets reason_syntax_util.mli)
(deps reason_syntax_util.cppo.mli)
(action
(run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets})))

(library
(name reason)
; Uncomment to allow make coverage target to work
; requires you to have run $ opam install bisect_ppx
; (preprocess (pps (bisect_ppx)))
(public_name reason)
(wrapped false)
(flags
(:standard -w -9-52 -safe-string))
(modules
ocaml_util
reason_syntax_util
reason_comment
reason_attributes
reason_layout
reason_heuristics
reason_location
reason_toolchain_conf
reason_toolchain_reason
reason_toolchain_ocaml
reason_toolchain
reason_config
reason_pprint_ast
reason_errors
reason_parser_def
reason_parser
reason_single_parser
reason_multi_parser
merlin_recovery
reason_recover_parser
reason_declarative_lexer
reason_lexer
reason_oprint
reason_parser_explain_raw
reason_parser_explain
reason_parser_recover)
(modules_without_implementation reason_parser_def)
(libraries
reason.ocaml-migrate-parsetree
menhirLib
reason.easy_format
ppxlib))
2 changes: 2 additions & 0 deletions samples/Dune/filenames/dune-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(lang dune 3.2)
(context default)
2 changes: 1 addition & 1 deletion vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Diff:** [textmate/diff.tmbundle](https://github.com/textmate/diff.tmbundle)
- **Dockerfile:** [asbjornenge/Docker.tmbundle](https://github.com/asbjornenge/Docker.tmbundle)
- **Dotenv:** [Alhadis/language-etc](https://github.com/Alhadis/language-etc)
- **Dune:** [maelvls/vscode-dune](https://github.com/maelvls/vscode-dune)
- **Dune:** [ocamllabs/vscode-ocaml-platform](https://github.com/ocamllabs/vscode-ocaml-platform)
- **Dylan:** [textmate/dylan.tmbundle](https://github.com/textmate/dylan.tmbundle)
- **E-mail:** [mariozaizar/language-eml](https://github.com/mariozaizar/language-eml)
- **EBNF:** [Alhadis/language-grammars](https://github.com/Alhadis/language-grammars)
Expand Down
1 change: 1 addition & 0 deletions vendor/grammars/vscode-ocaml-platform
Submodule vscode-ocaml-platform added at 1113a5
31 changes: 0 additions & 31 deletions vendor/licenses/git_submodule/vscode-dune.dep.yml

This file was deleted.

25 changes: 25 additions & 0 deletions vendor/licenses/git_submodule/vscode-ocaml-platform.dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: vscode-ocaml-platform
version: 1113a5dde0282f074a53f865c9d2a99f8cd5b9ea
type: git_submodule
homepage: https://github.com/ocamllabs/vscode-ocaml-platform.git
license: isc
licenses:
- sources: LICENSE
text: |
ISC License
Copyright (c) 2019 OCaml Labs
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
notices: []

0 comments on commit 69d5bf0

Please sign in to comment.