Skip to content

Commit 36ae187

Browse files
authored
Merge pull request #144 from lukepistrol/feature/spm
Swift Package Manager
2 parents afed274 + ae1dc74 commit 36ae187

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ package-lock.json
66
examples
77
!examples/ast.rs
88
/target/
9+
.build/

Package.swift

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// swift-tools-version:5.3
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "TreeSitterRust",
6+
platforms: [.macOS(.v10_13), .iOS(.v11)],
7+
products: [
8+
.library(name: "TreeSitterRust", targets: ["TreeSitterRust"]),
9+
],
10+
dependencies: [],
11+
targets: [
12+
.target(name: "TreeSitterRust",
13+
path: ".",
14+
exclude: [
15+
"binding.gyp",
16+
"bindings",
17+
"Cargo.toml",
18+
"corpus",
19+
"examples",
20+
"grammar.js",
21+
"LICENSE",
22+
"Makefile",
23+
"package.json",
24+
"README.md",
25+
"script",
26+
"src/grammar.json",
27+
"src/node-types.json",
28+
],
29+
sources: [
30+
"src/parser.c",
31+
"src/scanner.c",
32+
],
33+
resources: [
34+
.copy("queries")
35+
],
36+
publicHeadersPath: "bindings/swift",
37+
cSettings: [.headerSearchPath("src")])
38+
]
39+
)

bindings/swift/TreeSitterRust/rust.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef TREE_SITTER_RUST_H_
2+
#define TREE_SITTER_RUST_H_
3+
4+
typedef struct TSLanguage TSLanguage;
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
extern TSLanguage *tree_sitter_rust();
11+
12+
#ifdef __cplusplus
13+
}
14+
#endif
15+
16+
#endif // TREE_SITTER_RUST_H_

0 commit comments

Comments
 (0)