Skip to content

Commit

Permalink
Merge pull request #283 from mwhitworth/tree-sitter-0.24
Browse files Browse the repository at this point in the history
chore: tree-sitter 0.24 upgrade
  • Loading branch information
matthias-Q authored Nov 16, 2024
2 parents 9383eec + 6df2e3e commit 4240085
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 94 deletions.
60 changes: 60 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
cmake_minimum_required(VERSION 3.13)

project(tree-sitter-sql
VERSION "0.3.5"
DESCRIPTION "Tree-sitter Grammar for SQL"
HOMEPAGE_URL "git+https://github.com/derekstride/tree-sitter-sql.git"
LANGUAGES C)

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
option(TREE_SITTER_REUSE_ALLOCATOR "Reuse the library allocator" OFF)

set(TREE_SITTER_ABI_VERSION 14 CACHE STRING "Tree-sitter ABI version")
if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$")
unset(TREE_SITTER_ABI_VERSION CACHE)
message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer")
endif()

find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI")

add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/grammar.json"
COMMAND "${TREE_SITTER_CLI}" generate src/grammar.json
--abi=${TREE_SITTER_ABI_VERSION}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating parser.c")

add_library(tree-sitter-sql src/parser.c)
if(EXISTS src/scanner.c)
target_sources(tree-sitter-sql PRIVATE src/scanner.c)
endif()
target_include_directories(tree-sitter-sql PRIVATE src)

target_compile_definitions(tree-sitter-sql PRIVATE
$<$<BOOL:${TREE_SITTER_REUSE_ALLOCATOR}>:TREE_SITTER_REUSE_ALLOCATOR>
$<$<CONFIG:Debug>:TREE_SITTER_DEBUG>)

set_target_properties(tree-sitter-sql
PROPERTIES
C_STANDARD 11
POSITION_INDEPENDENT_CODE ON
SOVERSION "${TREE_SITTER_ABI_VERSION}.${PROJECT_VERSION_MAJOR}"
DEFINE_SYMBOL "")

configure_file(bindings/c/tree-sitter-sql.pc.in
"${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-sql.pc" @ONLY)

include(GNUInstallDirs)

install(FILES bindings/c/tree-sitter-sql.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/tree_sitter")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-sql.pc"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig")
install(TARGETS tree-sitter-sql
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")

add_custom_target(test "${TREE_SITTER_CLI}" test
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "tree-sitter test")

# vim:ft=cmake:
22 changes: 10 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
[package]
name = "tree-sitter-sequel"
description = "sql grammar for the tree-sitter parsing library"
description = "Tree-sitter Grammar for SQL"
version = "0.3.5"
keywords = ["incremental", "parsing", "sql"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/DerekStride/tree-sitter-sql"
edition = "2018"
authors = ["derek stride"]
license = "MIT"
readme = "README.md"
keywords = ["incremental", "parsing", "tree-sitter", "sql"]
categories = ["parsing", "text-editors"]
repository = "git+https://github.com/derekstride/tree-sitter-sql.git"
edition = "2021"
autoexamples = false

build = "bindings/rust/build.rs"
include = [
"bindings/rust/*",
"grammar.js",
"queries/*",
"src/*",
]
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]

[lib]
path = "bindings/rust/lib.rs"
Expand All @@ -26,4 +24,4 @@ tree-sitter-language = "0.1"
cc = "~1.2.1"

[dev-dependencies]
tree-sitter = "0.23"
tree-sitter = "0.24.3"
55 changes: 29 additions & 26 deletions Package.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions bindings/c/tree-sitter-sql.pc.in

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/go/binding_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/node/binding.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 39 additions & 2 deletions bindings/python/tree_sitter_sql/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion bindings/python/tree_sitter_sql/__init__.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions bindings/rust/build.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/rust/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 7 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"commit-and-tag-version": "^12.0.0",
"node-gyp": "^10.0.1",
"prebuildify": "^6.0.0",
"tree-sitter-cli": "^0.23.0"
"tree-sitter-cli": "^0.24.0"
},
"peerDependencies": {
"tree-sitter": "^0.21.0"
Expand All @@ -44,20 +44,11 @@
"url": "https://github.com/derekstride/tree-sitter-sql/issues"
},
"homepage": "https://github.com/derekstride/tree-sitter-sql#readme",
"tree-sitter": [
{
"scope": "source.sql",
"file-types": [
"sql"
],
"highlights": [
"queries/highlights.scm"
],
"indents": [
"queries/indents.scm"
]
"commit-and-tag-version": {
"skip": {
"tag": true
}
],
},
"keywords": [
"parser",
"sql"
Expand All @@ -69,10 +60,5 @@
"bindings/node/*",
"queries/*",
"src/**"
],
"commit-and-tag-version": {
"skip": {
"tag": true
}
}
}
]
}
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@ build-backend = "setuptools.build_meta"

[project]
name = "tree-sitter-sql"
description = "Sql grammar for tree-sitter"
description = "Tree-sitter Grammar for SQL"
version = "0.3.5"
keywords = ["incremental", "parsing", "tree-sitter", "sql"]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Topic :: Software Development :: Compilers",
"Topic :: Text Processing :: Linguistic",
"Typing :: Typed"
"Typing :: Typed",
]
requires-python = ">=3.8"
authors = [{ name = "derek stride" }]
requires-python = ">=3.9"
license.text = "MIT"
readme = "README.md"

[project.urls]
Homepage = "https://github.com/tree-sitter/tree-sitter-sql"
Homepage = "git+https://github.com/derekstride/tree-sitter-sql.git"

[project.optional-dependencies]
core = ["tree-sitter~=0.21"]
core = ["tree-sitter~=0.22"]

[tool.cibuildwheel]
build = "cp38-*"
build = "cp39-*"
build-frontend = "build"
Loading

0 comments on commit 4240085

Please sign in to comment.