Skip to content

Commit

Permalink
Bump tree-sitter version and deal with arising issues (#297)
Browse files Browse the repository at this point in the history
* Bump tree-sitter commit

Problem: The commit used for tree-sitter is a bit old and it's desired
to bump it up.

Solution: Change the commit in the tree-sitter vendor directory to
something more recent (v.19.5 release).

* Remove ts_parser_halt_on_error

Problem: After bumping the version up, build fails on
ts_parser_halt_on_error.

Solution: Remove this foreign import.

* Bump submodules and deal with problems

Problem: It's been a pretty long time since the previous bump, so we'd
like to do it again, but this time, let's bump everything. This causes
some trouble that we need to deal with, though.

Solution:
* Run `git submodule update --remote --merge --init` to bump submodules.
* After this, running `cabal test all` has one failure. This is because
  the cursor size was increased from 24 to 32, so `sizeOfCursor` was
  updated accordingly. I took the liberty to fix a small typo in its
  documentation as well.
* After this, I wanted to test tree-sitter. I found a demo in
  `tree-sitter-haskell` but noticed it was SEGFAULTing when running. I
  don't understand the cause, but I assume the Haskell tree-sitter
  grammar changed so this demo was no longer valid. I "fixed" it by
  checking the child at index 2 (bindings) rather than 3, since there is
  no index 3. I took the liberty to modernize it so warnings are gone
  too.
* After that, I wanted to test a real-world tree-sitter contract. For
  that, I visited a pretty old commit of one of our Haskell projects
  that used tree-sitter (nowadays it doesn't use it anymore), pointed it
  to my local branch of `haskell-tree-sitter`, and tried to build it.
    * First, it failed because `nodeIsMissing` wasn't present.
      Curiously, I couldn't find it in the branch it was previously
      using either, but it may be trivially added to `Node` using the
      `tree-sitter` API if desired, but I didn't bother. I removed its
      usage from the Haskell project and continued with life.
    * It also complained that `tree_sitter/parser.h` was missing.
      Indeed, it was deleted from the tree-sitter repository, so I
      removed it from the Cabal file.
    * With those changes, the project compiled was able to successfully
      parse a test file for CameLIGO.
* n.b.: I didn't check each tree-sitter-* directory, just the haskell
  one as it had a demo, so it's possible there are other failures I'm
  unaware.

* Make grammars compile

Problem: Note all tree-sitter-* dirs are compiling.

Solution: Some of them had updated files or paths, so fix them
accordingly in the Cabal file. Change their .hs files accordingly.

* Fix some more paths

Problem: I forgot some paths in Cabal for OCaml and PHP.

Solution: Fix their paths to the updated ones.

* Run Build & test commands locally; fix issues

Problem: CI still fails.

Solution: Run the Build & test commands locally, fix remaining paths...
  • Loading branch information
heitor-lassarote authored Jun 23, 2024
1 parent 011482f commit 7ee9c17
Show file tree
Hide file tree
Showing 34 changed files with 53 additions and 61 deletions.
2 changes: 1 addition & 1 deletion tree-sitter-c-sharp/tree-sitter-c-sharp.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ copyright: 2020 GitHub
category: Tree-sitter, CSharp, C#
build-type: Simple
data-files: vendor/tree-sitter-c-sharp/src/node-types.json
, vendor/tree-sitter-c-sharp/corpus/*.txt
, vendor/tree-sitter-c-sharp/test/corpus/*.txt
extra-source-files: ChangeLog.md

common common
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-c-sharp/vendor/tree-sitter-c-sharp
2 changes: 1 addition & 1 deletion tree-sitter-go/tree-sitter-go.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ copyright: 2019 GitHub
category: Tree-sitter, Go
build-type: Simple
data-files: vendor/tree-sitter-go/src/node-types.json
, vendor/tree-sitter-go/corpus/*.txt
, vendor/tree-sitter-go/test/corpus/*.txt
extra-source-files: ChangeLog.md

common common
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-go/vendor/tree-sitter-go
Submodule tree-sitter-go updated 58 files
+39 −0 .editorconfig
+11 −2 .gitattributes
+8 −0 .github/dependabot.yml
+82 −0 .github/workflows/ci.yml
+26 −0 .github/workflows/lint.yml
+23 −0 .github/workflows/publish.yml
+38 −6 .gitignore
+0 −6 .npmignore
+0 −7 .travis.yml
+26 −0 Cargo.toml
+111 −0 Makefile
+46 −0 Package.swift
+14 −5 README.md
+7 −5 binding.gyp
+16 −0 bindings/c/tree-sitter-go.h
+11 −0 bindings/c/tree-sitter-go.pc.in
+12 −0 bindings/go/binding.go
+15 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+20 −0 bindings/node/binding.cc
+28 −0 bindings/node/index.d.ts
+7 −0 bindings/node/index.js
+5 −0 bindings/python/tree_sitter_go/__init__.py
+1 −0 bindings/python/tree_sitter_go/__init__.pyi
+27 −0 bindings/python/tree_sitter_go/binding.c
+0 −0 bindings/python/tree_sitter_go/py.typed
+15 −0 bindings/rust/build.rs
+58 −0 bindings/rust/lib.rs
+16 −0 bindings/swift/TreeSitterGo/go.h
+0 −361 corpus/declarations.txt
+0 −229 corpus/expressions.txt
+0 −317 corpus/literals.txt
+0 −624 corpus/statements.txt
+0 −297 corpus/types.txt
+360 −269 grammar.js
+0 −13 index.js
+1,490 −0 package-lock.json
+86 −10 package.json
+33 −0 pyproject.toml
+88 −71 queries/highlights.scm
+175 −0 queries/structure.scm
+30 −0 queries/tags.scm
+0 −5 script/known-failures.txt
+0 −37 script/parse-examples
+56 −0 setup.py
+0 −28 src/binding.cc
+983 −509 src/grammar.json
+269 −66 src/node-types.json
+35,569 −29,161 src/parser.c
+54 −0 src/tree_sitter/alloc.h
+290 −0 src/tree_sitter/array.h
+116 −74 src/tree_sitter/parser.h
+583 −0 test/corpus/declarations.txt
+477 −0 test/corpus/expressions.txt
+557 −0 test/corpus/literals.txt
+5 −0 test/corpus/source_files.txt
+855 −0 test/corpus/statements.txt
+509 −0 test/corpus/types.txt
26 changes: 10 additions & 16 deletions tree-sitter-haskell/examples/Demo.hs
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Main where
module Main (main) where

import TreeSitter.Parser
import TreeSitter.Tree
import TreeSitter.Language
import TreeSitter.Haskell
import TreeSitter.Node
import Foreign.C.String
import Foreign.C.Types
import Foreign.Ptr ( Ptr(..)
import Foreign.Ptr ( Ptr
, nullPtr
, plusPtr
)
import Foreign.Marshal.Alloc ( malloc
, mallocBytes
)
import Foreign.Marshal.Alloc ( malloc )
import Foreign.Marshal.Array ( mallocArray )
import Foreign.Storable ( peek
, peekElemOff
, poke
)
import Foreign.Marshal.Utils ( new )
import Control.Monad


main :: IO ()
main = do
parser <- ts_parser_new
ts_parser_set_language parser tree_sitter_haskell
_ <- ts_parser_set_language parser tree_sitter_haskell

let source =
"module Test (main) where\nimport Lib\nf1 = undefined\nf2 = undefined"
Expand All @@ -39,8 +33,8 @@ main = do
n <- malloc
ts_tree_root_node_p tree n

print "module (root) ------------"
n@Node {..} <- peek n
putStrLn "module (root) ------------"
Node {..} <- peek n -- header, imports, and declarations
let childCount = fromIntegral nodeChildCount

children <- mallocArray childCount
Expand All @@ -50,8 +44,8 @@ main = do

printChildren children childCount

print "where ------------"
n@Node {..} <- peekElemOff children 3
putStrLn "declarations ------------"
Node {..} <- peekElemOff children 2 -- declarations: bind and bind
let nextChildCount = fromIntegral nodeChildCount

nextChildren <- mallocArray nextChildCount
Expand All @@ -61,7 +55,7 @@ main = do

printChildren nextChildren nextChildCount

print "END"
putStrLn "END"

printChildren :: Ptr Node -> Int -> IO ()
printChildren children count = forM_
Expand All @@ -78,4 +72,4 @@ printNode n@(Node {..}) = do
start = "(" ++ show pointRow ++ "," ++ show pointColumn ++ ")"
let TSPoint {..} = nodeEndPoint
end = "(" ++ show pointRow ++ "," ++ show pointColumn ++ ")"
print $ theType ++ start ++ "-" ++ end
putStrLn $ theType ++ start ++ "-" ++ end
3 changes: 2 additions & 1 deletion tree-sitter-haskell/tree-sitter-haskell.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ library
Include-dirs: vendor/tree-sitter-haskell/src
install-includes: tree_sitter/parser.h
c-sources: vendor/tree-sitter-haskell/src/parser.c
, vendor/tree-sitter-haskell/src/scanner.cc
, vendor/tree-sitter-haskell/src/scanner.c
cxx-sources:
extra-libraries: stdc++

source-repository head
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-haskell/vendor/tree-sitter-haskell
2 changes: 1 addition & 1 deletion tree-sitter-java/tree-sitter-java.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ copyright: 2019 GitHub
category: Tree-sitter, Java
build-type: Simple
data-files: vendor/tree-sitter-java/src/node-types.json
, vendor/tree-sitter-java/corpus/*.txt
, vendor/tree-sitter-java/test/corpus/*.txt
extra-source-files: ChangeLog.md

common common
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-java/vendor/tree-sitter-java
Submodule tree-sitter-java updated 59 files
+39 −0 .editorconfig
+11 −2 .gitattributes
+8 −0 .github/dependabot.yml
+59 −0 .github/workflows/ci.yml
+26 −0 .github/workflows/lint.yml
+23 −0 .github/workflows/publish.yml
+38 −9 .gitignore
+0 −4 .npmignore
+0 −23 .travis.yml
+0 −68 CONTRIBUTING.md
+27 −0 Cargo.toml
+110 −0 Makefile
+46 −0 Package.swift
+14 −4 README.md
+0 −23 appveyor.yml
+7 −5 binding.gyp
+16 −0 bindings/c/tree-sitter-java.h
+11 −0 bindings/c/tree-sitter-java.pc.in
+13 −0 bindings/go/binding.go
+15 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+20 −0 bindings/node/binding.cc
+28 −0 bindings/node/index.d.ts
+7 −0 bindings/node/index.js
+3 −0 bindings/python/tree_sitter_java/__init__.py
+1 −0 bindings/python/tree_sitter_java/__init__.pyi
+27 −0 bindings/python/tree_sitter_java/binding.c
+0 −0 bindings/python/tree_sitter_java/py.typed
+12 −0 bindings/rust/build.rs
+60 −0 bindings/rust/lib.rs
+16 −0 bindings/swift/TreeSitterJava/java.h
+0 −24 corpus/comments.txt
+0 −568 corpus/declarations.txt
+0 −695 corpus/expressions.txt
+0 −77 corpus/types.txt
+649 −412 grammar.js
+0 −13 index.js
+0 −5 issue_template.md
+1,490 −0 package-lock.json
+91 −35 package.json
+34 −0 pyproject.toml
+146 −0 queries/highlights.scm
+20 −0 queries/tags.scm
+0 −45 script/parse-examples
+56 −0 setup.py
+0 −28 src/binding.cc
+2,180 −1,279 src/grammar.json
+1,069 −384 src/node-types.json
+71,563 −32,459 src/parser.c
+54 −0 src/tree_sitter/alloc.h
+290 −0 src/tree_sitter/array.h
+78 −71 src/tree_sitter/parser.h
+37 −0 test/corpus/comments.txt
+1,207 −0 test/corpus/declarations.txt
+1,927 −0 test/corpus/expressions.txt
+130 −4 test/corpus/literals.txt
+58 −0 test/corpus/precedence.txt
+69 −0 test/corpus/types.txt
+36 −0 test/highlight/types.java
2 changes: 1 addition & 1 deletion tree-sitter-json/tree-sitter-json.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ copyright: 2019 GitHub
category: Tree-sitter, JSON
build-type: Simple
data-files: vendor/tree-sitter-json/src/node-types.json
, vendor/tree-sitter-json/corpus/*.txt
, vendor/tree-sitter-json/test/corpus/*.txt
extra-source-files: ChangeLog.md

common common
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-json/vendor/tree-sitter-json
2 changes: 1 addition & 1 deletion tree-sitter-nix/tree-sitter-nix.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ library tree-sitter-nix-internal
, tree-sitter
Include-dirs: vendor/tree-sitter-nix/src
c-sources: vendor/tree-sitter-nix/src/parser.c
vendor/tree-sitter-nix/src/scanner.cc
vendor/tree-sitter-nix/src/scanner.c
extra-libraries: stdc++

source-repository head
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-nix/vendor/tree-sitter-nix
6 changes: 3 additions & 3 deletions tree-sitter-ocaml/TreeSitter/OCaml.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import Foreign.Ptr
import TreeSitter.Language
import Paths_tree_sitter_ocaml

foreign import ccall unsafe "vendor/tree-sitter-ocaml/src/parser.c tree_sitter_ocaml" tree_sitter_ocaml :: Ptr Language
foreign import ccall unsafe "vendor/tree-sitter-ocaml/grammars/ocaml/src/parser.c tree_sitter_ocaml" tree_sitter_ocaml :: Ptr Language

getNodeTypesPath :: IO FilePath
getNodeTypesPath = getDataFileName "vendor/tree-sitter-ocaml/src/node-types.json"
getNodeTypesPath = getDataFileName "vendor/tree-sitter-ocaml/grammars/ocaml/src/node-types.json"

getTestCorpusDir :: IO FilePath
getTestCorpusDir = getDataFileName "vendor/tree-sitter-ocaml/corpus"
getTestCorpusDir = getDataFileName "vendor/tree-sitter-ocaml/grammars/ocaml/test/corpus"
10 changes: 5 additions & 5 deletions tree-sitter-ocaml/tree-sitter-ocaml.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ maintainer: [email protected]
copyright: 2020 GitHub, Anton Kochkov
category: Tree-sitter, OCaml
build-type: Simple
data-files: vendor/tree-sitter-ocaml/src/node-types.json
, vendor/tree-sitter-ocaml/corpus/*.txt
data-files: vendor/tree-sitter-ocaml/grammars/ocaml/src/node-types.json
, vendor/tree-sitter-ocaml/grammars/ocaml/test/corpus/*.txt
extra-source-files: ChangeLog.md

common common
Expand Down Expand Up @@ -46,10 +46,10 @@ library
other-modules: Paths_tree_sitter_ocaml
build-depends: base >= 4.12 && < 5
, tree-sitter ^>= 0.9.0.0
Include-dirs: vendor/tree-sitter-ocaml/src
Include-dirs: vendor/tree-sitter-ocaml/grammars/ocaml/src
install-includes: tree_sitter/parser.h
c-sources: vendor/tree-sitter-ocaml/src/parser.c
, vendor/tree-sitter-ocaml/src/scanner.cc
c-sources: vendor/tree-sitter-ocaml/grammars/ocaml/src/parser.c
, vendor/tree-sitter-ocaml/grammars/ocaml/src/scanner.c
extra-libraries: stdc++

source-repository head
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-ocaml/vendor/tree-sitter-ocaml
Submodule tree-sitter-ocaml updated 122 files
4 changes: 2 additions & 2 deletions tree-sitter-php/TreeSitter/PHP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Foreign.Ptr
import TreeSitter.Language
import Paths_tree_sitter_php

foreign import ccall unsafe "vendor/tree-sitter-php/src/parser.c tree_sitter_php" tree_sitter_php :: Ptr Language
foreign import ccall unsafe "vendor/tree-sitter-php/php/src/parser.c tree_sitter_php" tree_sitter_php :: Ptr Language

getNodeTypesPath :: IO FilePath
getNodeTypesPath = getDataFileName "vendor/tree-sitter-php/src/node-types.json"
getNodeTypesPath = getDataFileName "vendor/tree-sitter-php/php/src/node-types.json"
8 changes: 4 additions & 4 deletions tree-sitter-php/tree-sitter-php.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ maintainer: [email protected]
copyright: 2019 GitHub
category: Tree-sitter, PHP
build-type: Simple
data-files: vendor/tree-sitter-php/src/node-types.json
data-files: vendor/tree-sitter-php/php/src/node-types.json
extra-source-files: ChangeLog.md

common common
Expand Down Expand Up @@ -46,10 +46,10 @@ library
other-modules: Paths_tree_sitter_php
build-depends: base >= 4.12 && < 5
, tree-sitter
include-dirs: vendor/tree-sitter-php/src
include-dirs: vendor/tree-sitter-php/php/src
install-includes: tree_sitter/parser.h
c-sources: vendor/tree-sitter-php/src/parser.c
, vendor/tree-sitter-php/src/scanner.cc
c-sources: vendor/tree-sitter-php/php/src/parser.c
, vendor/tree-sitter-php/php/src/scanner.c
extra-libraries: stdc++

source-repository head
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-php/vendor/tree-sitter-php
Submodule tree-sitter-php updated 95 files
+39 −0 .editorconfig
+11 −3 .gitattributes
+59 −0 .github/ISSUE_TEMPLATE/bug_report.yml
+1 −0 .github/ISSUE_TEMPLATE/config.yml
+36 −0 .github/ISSUE_TEMPLATE/feature_request.yml
+58 −0 .github/workflows/ci.yml
+30 −0 .github/workflows/fuzz.yml
+19 −0 .github/workflows/lint.yml
+23 −0 .github/workflows/publish.yml
+38 −6 .gitignore
+0 −4 .npmignore
+0 −10 .travis.yml
+71 −0 Cargo.lock
+34 −0 Cargo.toml
+22 −0 LICENSE
+8 −0 Makefile
+29 −0 Package.swift
+14 −7 README.md
+0 −22 appveyor.yml
+12 −7 binding.gyp
+16 −0 bindings/c/tree-sitter-php.h
+11 −0 bindings/c/tree-sitter-php.pc.in
+16 −0 bindings/c/tree-sitter-php_only.h
+11 −0 bindings/c/tree-sitter-php_only.pc.in
+22 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+14 −0 bindings/go/php.go
+14 −0 bindings/go/php_only.go
+31 −0 bindings/node/binding.cc
+29 −0 bindings/node/index.d.ts
+8 −0 bindings/node/index.js
+1 −0 bindings/node/php.js
+1 −0 bindings/node/php_only.js
+3 −0 bindings/python/tree_sitter_php/__init__.py
+3 −0 bindings/python/tree_sitter_php/__init__.pyi
+34 −0 bindings/python/tree_sitter_php/binding.c
+0 −0 bindings/python/tree_sitter_php/py.typed
+31 −0 bindings/rust/build.rs
+72 −0 bindings/rust/lib.rs
+17 −0 bindings/swift/TreeSitterPHP/php.h
+107 −0 common/common.mak
+1,692 −0 common/define-grammar.js
+543 −0 common/scanner.h
+43 −0 eslint.config.mjs
+0 −1,130 grammar.js
+0 −9 index.js
+1,507 −0 package-lock.json
+79 −19 package.json
+3 −0 php/Makefile
+3 −0 php/grammar.js
+20 −0 php/package.json
+5,832 −2,984 php/src/grammar.json
+5,760 −0 php/src/node-types.json
+144,810 −0 php/src/parser.c
+17 −0 php/src/scanner.c
+54 −0 php/src/tree_sitter/alloc.h
+290 −0 php/src/tree_sitter/array.h
+117 −87 php/src/tree_sitter/parser.h
+3 −0 php_only/Makefile
+3 −0 php_only/grammar.js
+17 −0 php_only/package.json
+9,149 −0 php_only/src/grammar.json
+2,578 −794 php_only/src/node-types.json
+134,005 −0 php_only/src/parser.c
+17 −0 php_only/src/scanner.c
+54 −0 php_only/src/tree_sitter/alloc.h
+290 −0 php_only/src/tree_sitter/array.h
+265 −0 php_only/src/tree_sitter/parser.h
+33 −0 pyproject.toml
+110 −71 queries/highlights.scm
+3 −0 queries/injections-text.scm
+10 −3 queries/injections.scm
+33 −4 queries/tags.scm
+0 −6 script/known-failures.txt
+0 −39 script/parse-examples
+61 −0 setup.py
+0 −28 src/binding.cc
+0 −69,752 src/parser.c
+0 −269 src/scanner.cc
+233 −0 test/corpus/bugs.txt
+824 −0 test/corpus/class.txt
+792 −83 test/corpus/declarations.txt
+190 −0 test/corpus/execution_operator.txt
+1,144 −81 test/corpus/expressions.txt
+97 −11 test/corpus/interpolation.txt
+48 −73 test/corpus/literals.txt
+20 −0 test/corpus/nowdoc.txt
+60 −0 test/corpus/php_only.txt
+132 −40 test/corpus/statements.txt
+1,191 −0 test/corpus/string.txt
+396 −3 test/corpus/types.txt
+136 −27 test/highlight/keywords.php
+14 −8 test/highlight/literals.php
+16 −4 test/highlight/types.php
+21 −0 test/highlight/variables.php
2 changes: 1 addition & 1 deletion tree-sitter-python/tree-sitter-python.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ library
Include-dirs: vendor/tree-sitter-python/src
install-includes: tree_sitter/parser.h
c-sources: vendor/tree-sitter-python/src/parser.c
, vendor/tree-sitter-python/src/scanner.cc
, vendor/tree-sitter-python/src/scanner.c
extra-libraries: stdc++

source-repository head
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-python/vendor/tree-sitter-python
Submodule tree-sitter-python updated 60 files
+0 −22 .appveyor.yml
+38 −0 .editorconfig
+20 −0 .eslintrc.js
+15 −2 .gitattributes
+59 −0 .github/ISSUE_TEMPLATE/bug_report.yml
+1 −0 .github/ISSUE_TEMPLATE/config.yml
+36 −0 .github/ISSUE_TEMPLATE/feature_request.yml
+74 −0 .github/workflows/ci.yml
+23 −0 .github/workflows/publish.yml
+38 −14 .gitignore
+16 −3 .npmignore
+0 −7 .travis.yml
+27 −0 Cargo.toml
+110 −0 Makefile
+47 −0 Package.swift
+17 −7 README.md
+8 −6 binding.gyp
+16 −0 bindings/c/tree-sitter-python.h
+11 −0 bindings/c/tree-sitter-python.pc.in
+13 −0 bindings/go/binding.go
+15 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+20 −0 bindings/node/binding.cc
+28 −0 bindings/node/index.d.ts
+7 −0 bindings/node/index.js
+3 −0 bindings/python/tree_sitter_python/__init__.py
+1 −0 bindings/python/tree_sitter_python/__init__.pyi
+27 −0 bindings/python/tree_sitter_python/binding.c
+0 −0 bindings/python/tree_sitter_python/py.typed
+35 −0 bindings/rust/README.md
+15 −0 bindings/rust/build.rs
+52 −0 bindings/rust/lib.rs
+16 −0 bindings/swift/TreeSitterPython/python.h
+657 −317 grammar.js
+0 −13 index.js
+1,474 −0 package-lock.json
+45 −13 package.json
+30 −0 pyproject.toml
+91 −76 queries/highlights.scm
+14 −0 queries/tags.scm
+0 −36 script/parse-examples
+57 −0 setup.py
+0 −28 src/binding.cc
+2,832 −1,253 src/grammar.json
+1,372 −282 src/node-types.json
+123,222 −36,851 src/parser.c
+433 −0 src/scanner.c
+0 −382 src/scanner.cc
+54 −0 src/tree_sitter/alloc.h
+287 −0 src/tree_sitter/array.h
+78 −71 src/tree_sitter/parser.h
+30 −0 test/corpus/errors.txt
+666 −229 test/corpus/expressions.txt
+729 −209 test/corpus/literals.txt
+1,572 −0 test/corpus/pattern_matching.txt
+1,038 −324 test/corpus/statements.txt
+4 −0 test/highlight/parameters.py
+54 −0 test/highlight/pattern_matching.py
+15 −0 test/tags/main.py
+379 −0 types/dsl.d.ts
2 changes: 1 addition & 1 deletion tree-sitter-ql/vendor/tree-sitter-ql
Submodule tree-sitter-ql updated 57 files
+39 −0 .editorconfig
+2 −0 .gitattributes
+22 −0 .github/workflows/ci.yml
+5 −1 .gitignore
+2 −0 .npmignore
+4 −0 .travis.yml
+27 −0 Cargo.toml
+21 −0 LICENSE
+112 −0 Makefile
+47 −0 Package.swift
+12 −2 README.md
+30 −0 binding.gyp
+16 −0 bindings/c/tree-sitter-ql.h
+11 −0 bindings/c/tree-sitter-ql.pc.in
+13 −0 bindings/go/binding.go
+15 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+20 −0 bindings/node/binding.cc
+28 −0 bindings/node/index.d.ts
+7 −0 bindings/node/index.js
+5 −0 bindings/python/tree_sitter_ql/__init__.py
+1 −0 bindings/python/tree_sitter_ql/__init__.pyi
+27 −0 bindings/python/tree_sitter_ql/binding.c
+0 −0 bindings/python/tree_sitter_ql/py.typed
+22 −0 bindings/rust/build.rs
+54 −0 bindings/rust/lib.rs
+16 −0 bindings/swift/TreeSitterQl/ql.h
+1 −0 examples/.gitignore
+0 −0 examples/.gitkeep
+0 −1 examples/001.ql
+0 −15 examples/002.ql
+136 −95 grammar.js
+0 −13 index.js
+0 −18 package-lock.json
+40 −6 package.json
+29 −0 pyproject.toml
+86 −77 queries/highlights.scm
+26 −0 queries/tags.scm
+17 −0 script/fetch-examples
+2 −0 script/known-failures.txt
+18 −0 script/parse-examples
+60 −0 setup.py
+0 −28 src/binding.cc
+902 −450 src/grammar.json
+1,623 −771 src/node-types.json
+78,284 −45,013 src/parser.c
+54 −0 src/tree_sitter/alloc.h
+290 −0 src/tree_sitter/array.h
+116 −74 src/tree_sitter/parser.h
+31 −31 test/corpus/basic.txt
+43 −14 test/corpus/class.txt
+213 −25 test/corpus/expr.txt
+107 −52 test/corpus/formula.txt
+217 −6 test/corpus/modules.txt
+47 −47 test/corpus/operators_and_precedence.txt
+47 −23 test/corpus/predicates.txt
+61 −61 test/corpus/primary.txt
2 changes: 1 addition & 1 deletion tree-sitter-ruby/tree-sitter-ruby.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ library
Include-dirs: vendor/tree-sitter-ruby/src
install-includes: tree_sitter/parser.h
c-sources: vendor/tree-sitter-ruby/src/parser.c
, vendor/tree-sitter-ruby/src/scanner.cc
, vendor/tree-sitter-ruby/src/scanner.c
extra-libraries: stdc++


Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-ruby/vendor/tree-sitter-ruby
Submodule tree-sitter-ruby updated 66 files
+0 −28 .appveyor.yml
+39 −0 .editorconfig
+10 −1 .gitattributes
+59 −0 .github/ISSUE_TEMPLATE/bug_report.yml
+1 −0 .github/ISSUE_TEMPLATE/config.yml
+36 −0 .github/ISSUE_TEMPLATE/feature_request.yml
+57 −0 .github/workflows/ci.yml
+19 −0 .github/workflows/fuzz.yml
+26 −0 .github/workflows/lint.yml
+23 −0 .github/workflows/publish.yml
+38 −6 .gitignore
+0 −5 .npmignore
+0 −33 .travis.yml
+26 −0 Cargo.toml
+112 −0 Makefile
+47 −0 Package.swift
+15 −5 README.md
+18 −7 binding.gyp
+16 −0 bindings/c/tree-sitter-ruby.h
+11 −0 bindings/c/tree-sitter-ruby.pc.in
+13 −0 bindings/go/binding.go
+15 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+20 −0 bindings/node/binding.cc
+28 −0 bindings/node/index.d.ts
+7 −0 bindings/node/index.js
+5 −0 bindings/python/tree_sitter_ruby/__init__.py
+1 −0 bindings/python/tree_sitter_ruby/__init__.pyi
+27 −0 bindings/python/tree_sitter_ruby/binding.c
+0 −0 bindings/python/tree_sitter_ruby/py.typed
+22 −0 bindings/rust/build.rs
+59 −0 bindings/rust/lib.rs
+16 −0 bindings/swift/TreeSitterRuby/ruby.h
+673 −247 grammar.js
+0 −13 index.js
+1,474 −0 package-lock.json
+94 −18 package.json
+33 −0 pyproject.toml
+115 −85 queries/highlights.scm
+16 −11 queries/locals.scm
+64 −0 queries/tags.scm
+0 −5 script/known_failures.txt
+0 −39 script/parse-examples
+60 −0 setup.py
+0 −28 src/binding.cc
+4,016 −1,365 src/grammar.json
+1,274 −541 src/node-types.json
+445,911 −166,741 src/parser.c
+1,107 −0 src/scanner.c
+0 −932 src/scanner.cc
+54 −0 src/tree_sitter/alloc.h
+290 −0 src/tree_sitter/array.h
+116 −74 src/tree_sitter/parser.h
+21 −0 test/corpus/comments.txt
+134 −4 test/corpus/control-flow.txt
+165 −25 test/corpus/declarations.txt
+1,830 −322 test/corpus/expressions.txt
+2 −2 test/corpus/line-endings.txt
+1,098 −267 test/corpus/literals.txt
+382 −0 test/corpus/patterns.txt
+1 −1 test/corpus/single-cr-as-whitespace.txt
+4 −4 test/corpus/statements.txt
+24 −0 test/highlight/constants.rb
+2 −2 test/highlight/literals.rb
+18 −0 test/highlight/patterns.rb
+29 −0 test/highlight/variables.rb
2 changes: 1 addition & 1 deletion tree-sitter-rust/tree-sitter-rust.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ copyright: 2020 GitHub
category: Tree-sitter, Rust
build-type: Simple
data-files: vendor/tree-sitter-rust/src/node-types.json
, vendor/tree-sitter-rust/corpus/*.txt
, vendor/tree-sitter-rust/test/corpus/*.txt
extra-source-files: ChangeLog.md

common common
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-rust/vendor/tree-sitter-rust
Submodule tree-sitter-rust updated 73 files
+39 −0 .editorconfig
+11 −2 .gitattributes
+59 −0 .github/ISSUE_TEMPLATE/bug_report.yml
+1 −0 .github/ISSUE_TEMPLATE/config.yml
+36 −0 .github/ISSUE_TEMPLATE/feature_request.yml
+8 −0 .github/dependabot.yml
+51 −0 .github/workflows/ci.yml
+21 −0 .github/workflows/fuzz.yml
+26 −0 .github/workflows/lint.yml
+23 −0 .github/workflows/publish.yml
+38 −6 .gitignore
+0 −5 .npmignore
+0 −11 .travis.yml
+26 −0 Cargo.toml
+111 −0 Makefile
+47 −0 Package.swift
+27 −11 README.md
+0 −22 appveyor.yml
+7 −5 binding.gyp
+16 −0 bindings/c/tree-sitter-rust.h
+11 −0 bindings/c/tree-sitter-rust.pc.in
+13 −0 bindings/go/binding.go
+15 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+20 −0 bindings/node/binding.cc
+28 −0 bindings/node/index.d.ts
+7 −0 bindings/node/index.js
+5 −0 bindings/python/tree_sitter_rust/__init__.py
+1 −0 bindings/python/tree_sitter_rust/__init__.pyi
+27 −0 bindings/python/tree_sitter_rust/binding.c
+0 −0 bindings/python/tree_sitter_rust/py.typed
+20 −0 bindings/rust/build.rs
+61 −0 bindings/rust/lib.rs
+16 −0 bindings/swift/TreeSitterRust/rust.h
+0 −71 corpus/async.txt
+0 −1,331 corpus/declarations.txt
+0 −682 corpus/expressions.txt
+0 −142 corpus/literals.txt
+0 −144 corpus/macros.txt
+0 −137 corpus/patterns.txt
+0 −69 corpus/source_files.txt
+0 −213 corpus/types.txt
+175 −118 examples/ast.rs
+287 −0 examples/weird-exprs.rs
+538 −348 grammar.js
+0 −13 index.js
+1,474 −0 package-lock.json
+97 −10 package.json
+33 −0 pyproject.toml
+38 −14 queries/highlights.scm
+4 −4 queries/injections.scm
+60 −0 queries/tags.scm
+0 −21 script/fetch-examples
+0 −1 script/known_failures.txt
+0 −20 script/parse-examples
+0 −3 script/rustc-parse
+57 −0 setup.py
+0 −28 src/binding.cc
+1,975 −851 src/grammar.json
+713 −238 src/node-types.json
+175,806 −96,084 src/parser.c
+323 −116 src/scanner.c
+54 −0 src/tree_sitter/alloc.h
+290 −0 src/tree_sitter/array.h
+116 −74 src/tree_sitter/parser.h
+101 −0 test/corpus/async.txt
+2,415 −0 test/corpus/declarations.txt
+1,380 −0 test/corpus/expressions.txt
+233 −0 test/corpus/literals.txt
+275 −0 test/corpus/macros.txt
+522 −0 test/corpus/patterns.txt
+230 −0 test/corpus/source_files.txt
+386 −0 test/corpus/types.txt
2 changes: 1 addition & 1 deletion tree-sitter-tsx/tree-sitter-tsx.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ copyright: 2019 GitHub
category: Tree-sitter, TypeScript
build-type: Simple
data-files: vendor/tree-sitter-typescript/tsx/src/node-types.json
, vendor/tree-sitter-typescript/tsx/corpus/**/*.txt
, vendor/tree-sitter-typescript/test/corpus/*.txt
extra-source-files: ChangeLog.md

common common
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-tsx/vendor/tree-sitter-typescript
Submodule tree-sitter-typescript updated 85 files
+39 −0 .editorconfig
+11 −5 .gitattributes
+59 −0 .github/ISSUE_TEMPLATE/bug_report.yml
+1 −0 .github/ISSUE_TEMPLATE/config.yml
+36 −0 .github/ISSUE_TEMPLATE/feature_request.yml
+55 −0 .github/workflows/ci.yml
+29 −0 .github/workflows/fuzz.yml
+26 −0 .github/workflows/lint.yml
+23 −0 .github/workflows/publish.yml
+38 −7 .gitignore
+0 −7 .npmignore
+0 −8 .travis.yml
+34 −0 Cargo.toml
+1 −1 LICENSE
+9 −0 Makefile
+27 −0 Package.swift
+20 −7 README.md
+0 −22 appveyor.yml
+8 −19 binding.gyp
+16 −0 bindings/c/tree-sitter-tsx.h
+11 −0 bindings/c/tree-sitter-tsx.pc.in
+16 −0 bindings/c/tree-sitter-typescript.h
+11 −0 bindings/c/tree-sitter-typescript.pc.in
+22 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+14 −0 bindings/go/tsx.go
+14 −0 bindings/go/typescript.go
+31 −0 bindings/node/binding.cc
+29 −0 bindings/node/index.d.ts
+8 −0 bindings/node/index.js
+1 −0 bindings/node/tsx.js
+1 −0 bindings/node/typescript.js
+3 −0 bindings/python/tree_sitter_typescript/__init__.py
+3 −0 bindings/python/tree_sitter_typescript/__init__.pyi
+34 −0 bindings/python/tree_sitter_typescript/binding.c
+0 −0 bindings/python/tree_sitter_typescript/py.typed
+29 −0 bindings/rust/build.rs
+72 −0 bindings/rust/lib.rs
+17 −0 bindings/swift/TreeSitterTypeScript/typescript.h
+107 −0 common/common.mak
+0 −785 common/corpus/declarations.txt
+0 −120 common/corpus/expressions.txt
+0 −172 common/corpus/functions.txt
+0 −631 common/corpus/types.txt
+739 −311 common/define-grammar.js
+259 −107 common/scanner.h
+1,494 −0 package-lock.json
+104 −17 package.json
+33 −0 pyproject.toml
+22 −14 queries/highlights.scm
+23 −0 queries/tags.scm
+0 −42 script/parse-examples
+61 −0 setup.py
+1,444 −0 test/corpus/declarations.txt
+426 −0 test/corpus/expressions.txt
+340 −0 test/corpus/functions.txt
+2,121 −0 test/corpus/types.txt
+3 −0 tsx/Makefile
+0 −2 tsx/binding.gyp
+0 −1 tsx/corpus/common
+0 −14 tsx/corpus/expressions.txt
+0 −13 tsx/index.js
+3 −0 tsx/package.json
+0 −28 tsx/src/binding.cc
+6,191 −3,071 tsx/src/grammar.json
+2,637 −2,184 tsx/src/node-types.json
+372,278 −140,530 tsx/src/parser.c
+7 −5 tsx/src/scanner.c
+54 −0 tsx/src/tree_sitter/alloc.h
+290 −0 tsx/src/tree_sitter/array.h
+116 −74 tsx/src/tree_sitter/parser.h
+3 −0 typescript/Makefile
+0 −2 typescript/binding.gyp
+0 −1 typescript/corpus/common
+0 −20 typescript/corpus/expressions.txt
+0 −13 typescript/index.js
+3 −0 typescript/package.json
+0 −28 typescript/src/binding.cc
+6,193 −3,069 typescript/src/grammar.json
+2,510 −2,053 typescript/src/node-types.json
+377,741 −133,464 typescript/src/parser.c
+7 −5 typescript/src/scanner.c
+54 −0 typescript/src/tree_sitter/alloc.h
+290 −0 typescript/src/tree_sitter/array.h
+116 −74 typescript/src/tree_sitter/parser.h
2 changes: 1 addition & 1 deletion tree-sitter-typescript/tree-sitter-typescript.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ copyright: 2019 GitHub
category: Tree-sitter, TypeScript
build-type: Simple
data-files: vendor/tree-sitter-typescript/typescript/src/node-types.json
, vendor/tree-sitter-typescript/typescript/corpus/**/*.txt
, vendor/tree-sitter-typescript/test/corpus/*.txt
extra-source-files: ChangeLog.md

common common
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-typescript/vendor/tree-sitter-typescript
Submodule tree-sitter-typescript updated 85 files
+39 −0 .editorconfig
+11 −5 .gitattributes
+59 −0 .github/ISSUE_TEMPLATE/bug_report.yml
+1 −0 .github/ISSUE_TEMPLATE/config.yml
+36 −0 .github/ISSUE_TEMPLATE/feature_request.yml
+55 −0 .github/workflows/ci.yml
+29 −0 .github/workflows/fuzz.yml
+26 −0 .github/workflows/lint.yml
+23 −0 .github/workflows/publish.yml
+38 −7 .gitignore
+0 −7 .npmignore
+0 −8 .travis.yml
+34 −0 Cargo.toml
+1 −1 LICENSE
+9 −0 Makefile
+27 −0 Package.swift
+20 −7 README.md
+0 −22 appveyor.yml
+8 −19 binding.gyp
+16 −0 bindings/c/tree-sitter-tsx.h
+11 −0 bindings/c/tree-sitter-tsx.pc.in
+16 −0 bindings/c/tree-sitter-typescript.h
+11 −0 bindings/c/tree-sitter-typescript.pc.in
+22 −0 bindings/go/binding_test.go
+5 −0 bindings/go/go.mod
+14 −0 bindings/go/tsx.go
+14 −0 bindings/go/typescript.go
+31 −0 bindings/node/binding.cc
+29 −0 bindings/node/index.d.ts
+8 −0 bindings/node/index.js
+1 −0 bindings/node/tsx.js
+1 −0 bindings/node/typescript.js
+3 −0 bindings/python/tree_sitter_typescript/__init__.py
+3 −0 bindings/python/tree_sitter_typescript/__init__.pyi
+34 −0 bindings/python/tree_sitter_typescript/binding.c
+0 −0 bindings/python/tree_sitter_typescript/py.typed
+29 −0 bindings/rust/build.rs
+72 −0 bindings/rust/lib.rs
+17 −0 bindings/swift/TreeSitterTypeScript/typescript.h
+107 −0 common/common.mak
+0 −785 common/corpus/declarations.txt
+0 −120 common/corpus/expressions.txt
+0 −172 common/corpus/functions.txt
+0 −631 common/corpus/types.txt
+739 −311 common/define-grammar.js
+259 −107 common/scanner.h
+1,494 −0 package-lock.json
+104 −17 package.json
+33 −0 pyproject.toml
+22 −14 queries/highlights.scm
+23 −0 queries/tags.scm
+0 −42 script/parse-examples
+61 −0 setup.py
+1,444 −0 test/corpus/declarations.txt
+426 −0 test/corpus/expressions.txt
+340 −0 test/corpus/functions.txt
+2,121 −0 test/corpus/types.txt
+3 −0 tsx/Makefile
+0 −2 tsx/binding.gyp
+0 −1 tsx/corpus/common
+0 −14 tsx/corpus/expressions.txt
+0 −13 tsx/index.js
+3 −0 tsx/package.json
+0 −28 tsx/src/binding.cc
+6,191 −3,071 tsx/src/grammar.json
+2,637 −2,184 tsx/src/node-types.json
+372,278 −140,530 tsx/src/parser.c
+7 −5 tsx/src/scanner.c
+54 −0 tsx/src/tree_sitter/alloc.h
+290 −0 tsx/src/tree_sitter/array.h
+116 −74 tsx/src/tree_sitter/parser.h
+3 −0 typescript/Makefile
+0 −2 typescript/binding.gyp
+0 −1 typescript/corpus/common
+0 −20 typescript/corpus/expressions.txt
+0 −13 typescript/index.js
+3 −0 typescript/package.json
+0 −28 typescript/src/binding.cc
+6,193 −3,069 typescript/src/grammar.json
+2,510 −2,053 typescript/src/node-types.json
+377,741 −133,464 typescript/src/parser.c
+7 −5 typescript/src/scanner.c
+54 −0 typescript/src/tree_sitter/alloc.h
+290 −0 typescript/src/tree_sitter/array.h
+116 −74 typescript/src/tree_sitter/parser.h
4 changes: 2 additions & 2 deletions tree-sitter/src/TreeSitter/Cursor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ withCursor rootPtr action = allocaBytes sizeOfCursor $ \ cursor -> Exc.bracket
ts_tree_cursor_delete
action

-- | THe size of a 'Cursor' in bytes. The tests verify that this value is the same as @sizeof(TSTreeCursor)@.
-- | The size of a 'Cursor' in bytes. The tests verify that this value is the same as @sizeof(TSTreeCursor)@.
sizeOfCursor :: Int
sizeOfCursor = 24
sizeOfCursor = 32

foreign import ccall unsafe "src/bridge.c ts_tree_cursor_new_p" ts_tree_cursor_new_p :: Ptr TSNode -> Ptr Cursor -> IO ()
foreign import ccall unsafe "ts_tree_cursor_delete" ts_tree_cursor_delete :: Ptr Cursor -> IO ()
Expand Down
2 changes: 0 additions & 2 deletions tree-sitter/src/TreeSitter/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module TreeSitter.Parser
, withParser
, withParseTree
, ts_parser_new
, ts_parser_halt_on_error
, ts_parser_parse_string
, ts_parser_delete
, ts_parser_set_language
Expand Down Expand Up @@ -44,7 +43,6 @@ withParseTree parser bytestring action =
| otherwise = ts_tree_delete t

foreign import ccall safe "ts_parser_new" ts_parser_new :: IO (Ptr Parser)
foreign import ccall safe "ts_parser_halt_on_error" ts_parser_halt_on_error :: Ptr Parser -> CBool -> IO ()
foreign import ccall safe "ts_parser_parse_string" ts_parser_parse_string :: Ptr Parser -> Ptr Tree -> CString -> Int -> IO (Ptr Tree)
foreign import ccall safe "ts_parser_delete" ts_parser_delete :: Ptr Parser -> IO ()
foreign import ccall safe "ts_parser_set_language" ts_parser_set_language :: Ptr Parser -> Ptr Language -> IO Bool
Expand Down
1 change: 0 additions & 1 deletion tree-sitter/tree-sitter.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ library
include-dirs: vendor/tree-sitter/lib/include
, vendor/tree-sitter/lib/src
install-includes: tree_sitter/api.h
, tree_sitter/parser.h
c-sources: src/bridge.c
, vendor/tree-sitter/lib/src/lib.c
cc-options: -std=c99
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter/vendor/tree-sitter
Submodule tree-sitter updated 402 files

0 comments on commit 7ee9c17

Please sign in to comment.