Skip to content

Commit

Permalink
Update parse examples
Browse files Browse the repository at this point in the history
  • Loading branch information
314eter committed Mar 23, 2024
1 parent ceadbed commit 9f549cb
Show file tree
Hide file tree
Showing 28 changed files with 122 additions and 84 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@82741f40f135e08e1ed1e347cdce1438624e54a9
uses: tree-sitter/setup-action/cli@v1
- name: Test ocaml
working-directory: grammars/ocaml
run: tree-sitter test
Expand All @@ -28,6 +28,27 @@ jobs:
- name: Test highlighting
run: tree-sitter test

parse-examples:
name: Parse examples
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Parse examples
uses: tree-sitter/parse-action@3a4b1262a5fe2aa8e644e3f9c42059f2f382f2ed
with:
tree-sitter: tree-sitter
files-list: test/files.txt
invalid-files-list: test/invalid-files.txt

test-go:
name: Test Go binding
runs-on: ${{matrix.os}}
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ dist/
*.dll
*.pc

# Example dirs
/examples/*/

# Grammar volatiles
*.wasm
*.obj
Expand Down
57 changes: 57 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[submodule "examples/0install"]
path = examples/0install
url = https://github.com/0install/0install
[submodule "examples/bap"]
path = examples/bap
url = https://github.com/BinaryAnalysisPlatform/bap
[submodule "examples/base"]
path = examples/base
url = https://github.com/janestreet/base
[submodule "examples/cmdliner"]
path = examples/cmdliner
url = https://github.com/dbuenzli/cmdliner
[submodule "examples/dune"]
path = examples/dune
url = https://github.com/ocaml/dune
[submodule "examples/eio"]
path = examples/eio
url = https://github.com/ocaml-multicore/eio
[submodule "examples/js_of_ocaml"]
path = examples/js_of_ocaml
url = https://github.com/ocsigen/js_of_ocaml
[submodule "examples/lablgtk"]
path = examples/lablgtk
url = https://github.com/garrigue/lablgtk
[submodule "examples/lwt"]
path = examples/lwt
url = https://github.com/ocsigen/lwt
[submodule "examples/melange"]
path = examples/melange
url = https://github.com/melange-re/melange
[submodule "examples/merlin"]
path = examples/merlin
url = https://github.com/ocaml/merlin
[submodule "examples/ocaml"]
path = examples/ocaml
url = https://github.com/ocaml/ocaml
[submodule "examples/ocaml-cohttp"]
path = examples/ocaml-cohttp
url = https://github.com/mirage/ocaml-cohttp
[submodule "examples/ocaml-lsp"]
path = examples/ocaml-lsp
url = https://github.com/ocaml/ocaml-lsp
[submodule "examples/ocamlformat"]
path = examples/ocamlformat
url = https://github.com/ocaml-ppx/ocamlformat
[submodule "examples/opam"]
path = examples/opam
url = https://github.com/ocaml/opam
[submodule "examples/owl"]
path = examples/owl
url = https://github.com/owlbarn/owl
[submodule "examples/ppxlib"]
path = examples/ppxlib
url = https://github.com/ocaml-ppx/ppxlib
[submodule "examples/pyre-check"]
path = examples/pyre-check
url = https://github.com/facebook/pyre-check
Empty file removed examples/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions examples/0install
Submodule 0install added at 225587
1 change: 1 addition & 0 deletions examples/bap
Submodule bap added at f969db
1 change: 1 addition & 0 deletions examples/base
Submodule base added at 1311ac
1 change: 1 addition & 0 deletions examples/cmdliner
Submodule cmdliner added at c22919
1 change: 1 addition & 0 deletions examples/dune
Submodule dune added at 58d1cd
1 change: 1 addition & 0 deletions examples/eio
Submodule eio added at 14ae3c
1 change: 1 addition & 0 deletions examples/js_of_ocaml
Submodule js_of_ocaml added at d2cf18
1 change: 1 addition & 0 deletions examples/lablgtk
Submodule lablgtk added at e2d564
1 change: 1 addition & 0 deletions examples/lwt
Submodule lwt added at 73f1a0
1 change: 1 addition & 0 deletions examples/melange
Submodule melange added at 01d6ba
1 change: 1 addition & 0 deletions examples/merlin
Submodule merlin added at b274d3
1 change: 1 addition & 0 deletions examples/ocaml
Submodule ocaml added at 18c451
1 change: 1 addition & 0 deletions examples/ocaml-cohttp
Submodule ocaml-cohttp added at cf2ae3
1 change: 1 addition & 0 deletions examples/ocaml-lsp
Submodule ocaml-lsp added at ad2095
1 change: 1 addition & 0 deletions examples/ocamlformat
Submodule ocamlformat added at 6ce00b
1 change: 1 addition & 0 deletions examples/opam
Submodule opam added at eafdc8
1 change: 1 addition & 0 deletions examples/owl
Submodule owl added at c66069
1 change: 1 addition & 0 deletions examples/ppxlib
Submodule ppxlib added at 455f21
1 change: 1 addition & 0 deletions examples/pyre-check
Submodule pyre-check added at 5cd77e
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"test-interface": "cd grammars/interface && tree-sitter test",
"test-highlight": "tree-sitter test",
"test-binding": "node --test bindings/node/binding_test.js",
"parse": "tree-sitter parse"
"parse": "tree-sitter parse",
"parse-examples": "test/parse-examples.sh"
},
"tree-sitter": [
{
Expand Down
61 changes: 0 additions & 61 deletions script/parse-examples

This file was deleted.

6 changes: 6 additions & 0 deletions test/files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
examples/**/*.ml
examples/**/*.mli
!examples/**/*.cppo.*
!examples/ocamlformat/test/failing/**/*
!examples/ocamlformat/test/passing/**/*
!examples/ocaml/testsuite/tests/parse-errors/**/*
23 changes: 5 additions & 18 deletions script/known_failures.txt → test/invalid-files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,34 @@ examples/lablgtk/applications/osiris/osiris.ml
examples/lablgtk/examples/csview.ml
examples/lablgtk/tools/introspection/stubs/stubs_Atk.ml
examples/lablgtk/tools/introspection/stubs/stubs_Pango.ml
examples/lwt/src/react/lwt_react.cppo.ml
examples/lwt/src/unix/lwt_unix.cppo.ml
examples/lwt/src/unix/lwt_unix.cppo.mli
examples/lwt/test/unix/test_lwt_unix.cppo.ml
examples/melange/bin/melc.ml
examples/merlin/tests/test-dirs/completion/infix.t/infix.ml
examples/merlin/tests/test-dirs/completion/parenthesize.t/parenthesize.ml
examples/merlin/tests/test-dirs/construct/c-modules.t/functor_app.ml
examples/merlin/tests/test-dirs/construct/c-modules.t/module.ml
examples/merlin/tests/test-dirs/errors/typing-after-parsing.t/test.ml
examples/merlin/tests/test-dirs/locate/context-detection/cd-label.t/label.ml
examples/merlin/tests/test-dirs/type-enclosing/issueLSP695.t/main.ml
examples/ocaml/stdlib/templates/float.template.mli
examples/ocaml/stdlib/templates/moreLabels.template.mli
examples/ocaml/testsuite/tests/generated-parse-errors/errors.ml
examples/ocaml/testsuite/tests/lexing/escape.ml
examples/ocaml/testsuite/tests/lexing/uchar_esc.ml
examples/ocaml/testsuite/tests/parse-errors/*
examples/ocaml/testsuite/tests/parsing/anonymous_class_parameter.ml
examples/ocaml/testsuite/tests/parsing/arrow_ambiguity.ml
examples/ocaml/testsuite/tests/parsing/constructor_declarations.ml
examples/ocaml/testsuite/tests/parsing/docstrings.ml
examples/ocaml/testsuite/tests/parsing/pr6604_2.ml
examples/ocaml/testsuite/tests/parsing/pr6604.ml
examples/ocaml/testsuite/tests/parsing/pr6604_2.ml
examples/ocaml/testsuite/tests/tool-toplevel/error_highlighting.ml
examples/ocaml/testsuite/tests/tool-toplevel/error_highlighting_use2.ml
examples/ocaml/testsuite/tests/tool-toplevel/error_highlighting_use3.ml
examples/ocaml/testsuite/tests/tool-toplevel/error_highlighting.ml
examples/ocaml/testsuite/tests/typing-misc/typecore_errors.ml
examples/ocaml/testsuite/tests/typing-sigsubst/sig_local_aliases_syntax_errors.ml
examples/ocaml/testsuite/tests/typing-sigsubst/sig_local_aliases.ml
examples/ocaml/testsuite/tests/typing-warnings/pr7261.ml
examples/ocamlformat/test/failing/*/*
examples/ocamlformat/test/passing/*/*
examples/ocamlformat/test/rpc/big_margin/foo.ml
examples/ocamlformat/vendor/parser-recovery/test/expect/signature/*.mli
examples/ocamlformat/vendor/parser-recovery/test/expect/structure/*.ml
examples/ppxlib/astlib/astlib.ml
examples/ppxlib/astlib/location.ml
examples/ppxlib/astlib/longident.ml
examples/ppxlib/test/code_path/test.ml
examples/ppxlib/test/driver/non-compressible-suffix/test.ml
examples/ppxlib/test/expansion_helpers/mangle/test.ml
examples/ppxlib/test/ppx_import_support/test.ml
examples/ppxlib/test/quoter/test.ml
examples/opam/src/core/opamCompat.ml
examples/opam/src/core/opamCompat.mli
examples/ppxlib/test/expansion_helpers/mangle/test.ml
11 changes: 11 additions & 0 deletions test/parse-examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -ef

cd "$(dirname "$0")/.."

git submodule update --init --depth 1

tree-sitter parse -q -s \
$(cat test/files.txt) \
$(for file in $(cat test/invalid-files.txt); do echo "!${file}"; done)

0 comments on commit 9f549cb

Please sign in to comment.