From 7ee9c172d26f605c3069e443361c1c483c9f58a9 Mon Sep 17 00:00:00 2001 From: Heitor Date: Sun, 23 Jun 2024 19:29:42 -0300 Subject: [PATCH] Bump tree-sitter version and deal with arising issues (#297) * 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... --- tree-sitter-c-sharp/tree-sitter-c-sharp.cabal | 2 +- .../vendor/tree-sitter-c-sharp | 2 +- tree-sitter-go/tree-sitter-go.cabal | 2 +- tree-sitter-go/vendor/tree-sitter-go | 2 +- tree-sitter-haskell/examples/Demo.hs | 26 +++++++------------ tree-sitter-haskell/tree-sitter-haskell.cabal | 3 ++- .../vendor/tree-sitter-haskell | 2 +- tree-sitter-java/tree-sitter-java.cabal | 2 +- tree-sitter-java/vendor/tree-sitter-java | 2 +- tree-sitter-json/tree-sitter-json.cabal | 2 +- tree-sitter-json/vendor/tree-sitter-json | 2 +- tree-sitter-nix/tree-sitter-nix.cabal | 2 +- tree-sitter-nix/vendor/tree-sitter-nix | 2 +- tree-sitter-ocaml/TreeSitter/OCaml.hs | 6 ++--- tree-sitter-ocaml/tree-sitter-ocaml.cabal | 10 +++---- tree-sitter-ocaml/vendor/tree-sitter-ocaml | 2 +- tree-sitter-php/TreeSitter/PHP.hs | 4 +-- tree-sitter-php/tree-sitter-php.cabal | 8 +++--- tree-sitter-php/vendor/tree-sitter-php | 2 +- tree-sitter-python/tree-sitter-python.cabal | 2 +- tree-sitter-python/vendor/tree-sitter-python | 2 +- tree-sitter-ql/vendor/tree-sitter-ql | 2 +- tree-sitter-ruby/tree-sitter-ruby.cabal | 2 +- tree-sitter-ruby/vendor/tree-sitter-ruby | 2 +- tree-sitter-rust/tree-sitter-rust.cabal | 2 +- tree-sitter-rust/vendor/tree-sitter-rust | 2 +- tree-sitter-tsx/tree-sitter-tsx.cabal | 2 +- tree-sitter-tsx/vendor/tree-sitter-typescript | 2 +- .../tree-sitter-typescript.cabal | 2 +- .../vendor/tree-sitter-typescript | 2 +- tree-sitter/src/TreeSitter/Cursor.hs | 4 +-- tree-sitter/src/TreeSitter/Parser.hs | 2 -- tree-sitter/tree-sitter.cabal | 1 - tree-sitter/vendor/tree-sitter | 2 +- 34 files changed, 53 insertions(+), 61 deletions(-) diff --git a/tree-sitter-c-sharp/tree-sitter-c-sharp.cabal b/tree-sitter-c-sharp/tree-sitter-c-sharp.cabal index 3dda8081..cc65cbd5 100644 --- a/tree-sitter-c-sharp/tree-sitter-c-sharp.cabal +++ b/tree-sitter-c-sharp/tree-sitter-c-sharp.cabal @@ -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 diff --git a/tree-sitter-c-sharp/vendor/tree-sitter-c-sharp b/tree-sitter-c-sharp/vendor/tree-sitter-c-sharp index df209552..82fa8f05 160000 --- a/tree-sitter-c-sharp/vendor/tree-sitter-c-sharp +++ b/tree-sitter-c-sharp/vendor/tree-sitter-c-sharp @@ -1 +1 @@ -Subproject commit df20955232ad36a348764ff002313df92321a31a +Subproject commit 82fa8f05f41a33e9bc830f85d74a9548f0291738 diff --git a/tree-sitter-go/tree-sitter-go.cabal b/tree-sitter-go/tree-sitter-go.cabal index 2f92f330..e53540fe 100644 --- a/tree-sitter-go/tree-sitter-go.cabal +++ b/tree-sitter-go/tree-sitter-go.cabal @@ -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 diff --git a/tree-sitter-go/vendor/tree-sitter-go b/tree-sitter-go/vendor/tree-sitter-go index 689cc8fb..7ee8d928 160000 --- a/tree-sitter-go/vendor/tree-sitter-go +++ b/tree-sitter-go/vendor/tree-sitter-go @@ -1 +1 @@ -Subproject commit 689cc8fbdc0613d267434f221af85aff91a31f8c +Subproject commit 7ee8d928db5202f6831a78f8112fd693bf69f98b diff --git a/tree-sitter-haskell/examples/Demo.hs b/tree-sitter-haskell/examples/Demo.hs index 3841bfa3..432dfe86 100644 --- a/tree-sitter-haskell/examples/Demo.hs +++ b/tree-sitter-haskell/examples/Demo.hs @@ -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" @@ -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 @@ -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 @@ -61,7 +55,7 @@ main = do printChildren nextChildren nextChildCount - print "END" + putStrLn "END" printChildren :: Ptr Node -> Int -> IO () printChildren children count = forM_ @@ -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 diff --git a/tree-sitter-haskell/tree-sitter-haskell.cabal b/tree-sitter-haskell/tree-sitter-haskell.cabal index f55a0286..c39d7a8d 100644 --- a/tree-sitter-haskell/tree-sitter-haskell.cabal +++ b/tree-sitter-haskell/tree-sitter-haskell.cabal @@ -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 diff --git a/tree-sitter-haskell/vendor/tree-sitter-haskell b/tree-sitter-haskell/vendor/tree-sitter-haskell index 2a0aa1cb..a50070d5 160000 --- a/tree-sitter-haskell/vendor/tree-sitter-haskell +++ b/tree-sitter-haskell/vendor/tree-sitter-haskell @@ -1 +1 @@ -Subproject commit 2a0aa1cb5f1b787a4056a29fa0791e87846e33fb +Subproject commit a50070d5bb5bd5c1281740a6102ecf1f4b0c4f19 diff --git a/tree-sitter-java/tree-sitter-java.cabal b/tree-sitter-java/tree-sitter-java.cabal index 7fc5393e..ebf705f8 100644 --- a/tree-sitter-java/tree-sitter-java.cabal +++ b/tree-sitter-java/tree-sitter-java.cabal @@ -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 diff --git a/tree-sitter-java/vendor/tree-sitter-java b/tree-sitter-java/vendor/tree-sitter-java index b9431d04..953abfc8 160000 --- a/tree-sitter-java/vendor/tree-sitter-java +++ b/tree-sitter-java/vendor/tree-sitter-java @@ -1 +1 @@ -Subproject commit b9431d046761b8308a471f9364c32e66d3ed31c8 +Subproject commit 953abfc8bb3eb2f578e1f461edba4a9885f974b8 diff --git a/tree-sitter-json/tree-sitter-json.cabal b/tree-sitter-json/tree-sitter-json.cabal index 924abc69..7688e352 100644 --- a/tree-sitter-json/tree-sitter-json.cabal +++ b/tree-sitter-json/tree-sitter-json.cabal @@ -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 diff --git a/tree-sitter-json/vendor/tree-sitter-json b/tree-sitter-json/vendor/tree-sitter-json index f5abfaf7..94f5c527 160000 --- a/tree-sitter-json/vendor/tree-sitter-json +++ b/tree-sitter-json/vendor/tree-sitter-json @@ -1 +1 @@ -Subproject commit f5abfaf7d513db34b04c029d2bd52d69ef0838a8 +Subproject commit 94f5c527b2965465956c2000ed6134dd24daf2a7 diff --git a/tree-sitter-nix/tree-sitter-nix.cabal b/tree-sitter-nix/tree-sitter-nix.cabal index ad0a783e..206987cf 100644 --- a/tree-sitter-nix/tree-sitter-nix.cabal +++ b/tree-sitter-nix/tree-sitter-nix.cabal @@ -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 diff --git a/tree-sitter-nix/vendor/tree-sitter-nix b/tree-sitter-nix/vendor/tree-sitter-nix index 791b5ff0..0fdada10 160000 --- a/tree-sitter-nix/vendor/tree-sitter-nix +++ b/tree-sitter-nix/vendor/tree-sitter-nix @@ -1 +1 @@ -Subproject commit 791b5ff0e4f0da358cbb941788b78d436a2ca621 +Subproject commit 0fdada10f1f845ca9116e279ad8f5d0ca93e9949 diff --git a/tree-sitter-ocaml/TreeSitter/OCaml.hs b/tree-sitter-ocaml/TreeSitter/OCaml.hs index 8b5d470d..9609c75f 100644 --- a/tree-sitter-ocaml/TreeSitter/OCaml.hs +++ b/tree-sitter-ocaml/TreeSitter/OCaml.hs @@ -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" diff --git a/tree-sitter-ocaml/tree-sitter-ocaml.cabal b/tree-sitter-ocaml/tree-sitter-ocaml.cabal index d8071373..7af6d479 100644 --- a/tree-sitter-ocaml/tree-sitter-ocaml.cabal +++ b/tree-sitter-ocaml/tree-sitter-ocaml.cabal @@ -9,8 +9,8 @@ maintainer: rewinfrey@github.com 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 @@ -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 diff --git a/tree-sitter-ocaml/vendor/tree-sitter-ocaml b/tree-sitter-ocaml/vendor/tree-sitter-ocaml index 6b15a40c..0b12614d 160000 --- a/tree-sitter-ocaml/vendor/tree-sitter-ocaml +++ b/tree-sitter-ocaml/vendor/tree-sitter-ocaml @@ -1 +1 @@ -Subproject commit 6b15a40cda0164feb58c8cce24531b4de4e3e276 +Subproject commit 0b12614ded3ec7ed7ab7933a9ba4f695ba4c342e diff --git a/tree-sitter-php/TreeSitter/PHP.hs b/tree-sitter-php/TreeSitter/PHP.hs index f88a0a26..9596d0ee 100644 --- a/tree-sitter-php/TreeSitter/PHP.hs +++ b/tree-sitter-php/TreeSitter/PHP.hs @@ -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" diff --git a/tree-sitter-php/tree-sitter-php.cabal b/tree-sitter-php/tree-sitter-php.cabal index 5b9a3fc7..f854133a 100644 --- a/tree-sitter-php/tree-sitter-php.cabal +++ b/tree-sitter-php/tree-sitter-php.cabal @@ -10,7 +10,7 @@ maintainer: vera@github.com 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 @@ -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 diff --git a/tree-sitter-php/vendor/tree-sitter-php b/tree-sitter-php/vendor/tree-sitter-php index 41a408d5..4f124bc6 160000 --- a/tree-sitter-php/vendor/tree-sitter-php +++ b/tree-sitter-php/vendor/tree-sitter-php @@ -1 +1 @@ -Subproject commit 41a408d5b996ef54d8b9e1b9a2469fad00c1b52b +Subproject commit 4f124bc6075e1c3333e80190c1c170933ed72c95 diff --git a/tree-sitter-python/tree-sitter-python.cabal b/tree-sitter-python/tree-sitter-python.cabal index aea40467..044b5714 100644 --- a/tree-sitter-python/tree-sitter-python.cabal +++ b/tree-sitter-python/tree-sitter-python.cabal @@ -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 diff --git a/tree-sitter-python/vendor/tree-sitter-python b/tree-sitter-python/vendor/tree-sitter-python index 118cf401..71778c2a 160000 --- a/tree-sitter-python/vendor/tree-sitter-python +++ b/tree-sitter-python/vendor/tree-sitter-python @@ -1 +1 @@ -Subproject commit 118cf40115e13e95ed3ac4c0e05c0534e07bc0fa +Subproject commit 71778c2a472ed00a64abf4219544edbf8e4b86d7 diff --git a/tree-sitter-ql/vendor/tree-sitter-ql b/tree-sitter-ql/vendor/tree-sitter-ql index c0d674ab..42becd6f 160000 --- a/tree-sitter-ql/vendor/tree-sitter-ql +++ b/tree-sitter-ql/vendor/tree-sitter-ql @@ -1 +1 @@ -Subproject commit c0d674abed8836bb5a4770f547343ef100f88c24 +Subproject commit 42becd6f8f7bae82c818fa3abb1b6ff34b552310 diff --git a/tree-sitter-ruby/tree-sitter-ruby.cabal b/tree-sitter-ruby/tree-sitter-ruby.cabal index 8dd4592f..90809c0e 100644 --- a/tree-sitter-ruby/tree-sitter-ruby.cabal +++ b/tree-sitter-ruby/tree-sitter-ruby.cabal @@ -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++ diff --git a/tree-sitter-ruby/vendor/tree-sitter-ruby b/tree-sitter-ruby/vendor/tree-sitter-ruby index eb2b6225..0ffe457f 160000 --- a/tree-sitter-ruby/vendor/tree-sitter-ruby +++ b/tree-sitter-ruby/vendor/tree-sitter-ruby @@ -1 +1 @@ -Subproject commit eb2b6225bfb80010f2e4cbd27db8c6f3775230b5 +Subproject commit 0ffe457fb6aabf064f173fd30ea356845cef2513 diff --git a/tree-sitter-rust/tree-sitter-rust.cabal b/tree-sitter-rust/tree-sitter-rust.cabal index ea18fdc0..2a9e1542 100644 --- a/tree-sitter-rust/tree-sitter-rust.cabal +++ b/tree-sitter-rust/tree-sitter-rust.cabal @@ -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 diff --git a/tree-sitter-rust/vendor/tree-sitter-rust b/tree-sitter-rust/vendor/tree-sitter-rust index ab40806a..9c84af00 160000 --- a/tree-sitter-rust/vendor/tree-sitter-rust +++ b/tree-sitter-rust/vendor/tree-sitter-rust @@ -1 +1 @@ -Subproject commit ab40806a4583b84b9d5636f5a93c0ebfa45b2675 +Subproject commit 9c84af007b0f144954adb26b3f336495cbb320a7 diff --git a/tree-sitter-tsx/tree-sitter-tsx.cabal b/tree-sitter-tsx/tree-sitter-tsx.cabal index 8fa2f9e7..f1d639c7 100644 --- a/tree-sitter-tsx/tree-sitter-tsx.cabal +++ b/tree-sitter-tsx/tree-sitter-tsx.cabal @@ -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 diff --git a/tree-sitter-tsx/vendor/tree-sitter-typescript b/tree-sitter-tsx/vendor/tree-sitter-typescript index aa950f58..4f3eb665 160000 --- a/tree-sitter-tsx/vendor/tree-sitter-typescript +++ b/tree-sitter-tsx/vendor/tree-sitter-typescript @@ -1 +1 @@ -Subproject commit aa950f58ea8aa112bc72f3481b98fc2d3c07b3e0 +Subproject commit 4f3eb6655a1cd1a1f87ef10201f8e22886dcd76e diff --git a/tree-sitter-typescript/tree-sitter-typescript.cabal b/tree-sitter-typescript/tree-sitter-typescript.cabal index b91d855a..b3ade9af 100644 --- a/tree-sitter-typescript/tree-sitter-typescript.cabal +++ b/tree-sitter-typescript/tree-sitter-typescript.cabal @@ -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 diff --git a/tree-sitter-typescript/vendor/tree-sitter-typescript b/tree-sitter-typescript/vendor/tree-sitter-typescript index aa950f58..4f3eb665 160000 --- a/tree-sitter-typescript/vendor/tree-sitter-typescript +++ b/tree-sitter-typescript/vendor/tree-sitter-typescript @@ -1 +1 @@ -Subproject commit aa950f58ea8aa112bc72f3481b98fc2d3c07b3e0 +Subproject commit 4f3eb6655a1cd1a1f87ef10201f8e22886dcd76e diff --git a/tree-sitter/src/TreeSitter/Cursor.hs b/tree-sitter/src/TreeSitter/Cursor.hs index 34338c67..cc58d140 100644 --- a/tree-sitter/src/TreeSitter/Cursor.hs +++ b/tree-sitter/src/TreeSitter/Cursor.hs @@ -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 () diff --git a/tree-sitter/src/TreeSitter/Parser.hs b/tree-sitter/src/TreeSitter/Parser.hs index e1d08aae..9983e257 100644 --- a/tree-sitter/src/TreeSitter/Parser.hs +++ b/tree-sitter/src/TreeSitter/Parser.hs @@ -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 @@ -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 diff --git a/tree-sitter/tree-sitter.cabal b/tree-sitter/tree-sitter.cabal index 5fffd4dd..c62787a3 100644 --- a/tree-sitter/tree-sitter.cabal +++ b/tree-sitter/tree-sitter.cabal @@ -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 diff --git a/tree-sitter/vendor/tree-sitter b/tree-sitter/vendor/tree-sitter index 9ffcb163..6ec478c1 160000 --- a/tree-sitter/vendor/tree-sitter +++ b/tree-sitter/vendor/tree-sitter @@ -1 +1 @@ -Subproject commit 9ffcb16392941c15fdd8bf45c8ea6ea3f1799668 +Subproject commit 6ec478c1e94a3e37fc17dc9b0e274fea20a6969f