Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Package Manager Support #165

Merged
merged 11 commits into from
Jul 10, 2023
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ build
*.log
/examples/*/
/target/
*.a
*.dylib
*.so
*.o
bindings/c/*.h
bindings/c/*.pc
.build/
amaanq marked this conversation as resolved.
Show resolved Hide resolved
33 changes: 33 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// swift-tools-version:5.3
import PackageDescription

let package = Package(
name: "TreeSitterPython",
products: [
.library(name: "TreeSitterPython", targets: ["TreeSitterPython"]),
],
dependencies: [],
targets: [
.target(name: "TreeSitterPython",
path: ".",
exclude: [
"binding.gyp",
"bindings",
"Cargo.toml",
"corpus",
"grammar.js",
"LICENSE",
amaanq marked this conversation as resolved.
Show resolved Hide resolved
"package.json",
"README.md",
],
sources: [
"src/parser.c",
"src/scanner.c",
],
resources: [
.copy("queries")
],
publicHeadersPath: "bindings/swift",
cSettings: [.headerSearchPath("src")])
]
)
16 changes: 16 additions & 0 deletions bindings/swift/TreeSitterPython/python.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef TREE_SITTER_PYTHON_H_
#define TREE_SITTER_PYTHON_H_

typedef struct TSLanguage TSLanguage;

#ifdef __cplusplus
extern "C" {
#endif

extern TSLanguage *tree_sitter_python();

#ifdef __cplusplus
}
#endif

#endif // TREE_SITTER_PYTHON_H_