Skip to content

Commit

Permalink
feat: add Swift bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Mar 8, 2023
1 parent bcefdcc commit 406efbc
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// swift-tools-version:5.3
import PackageDescription

let package = Package(
name: "TreeSitterCairo",
platforms: [.macOS(.v10_13), .iOS(.v11)],
products: [
.library(name: "TreeSitterCairo", targets: ["TreeSitterCairo"]),
],
dependencies: [],
targets: [
.target(name: "TreeSitterCairo",
path: ".",
exclude: [
"binding.gyp",
"bindings",
"Cargo.toml",
"test",
"examples",
"grammar.js",
"LICENSE",
"package.json",
"README.md",
"script",
"src/grammar.json",
"src/node-types.json",
],
sources: [
"src/parser.c",
"src/scanner.c",
],
resources: [
.copy("queries")
],
publicHeadersPath: "bindings/swift",
cSettings: [.headerSearchPath("src")])
]
)
16 changes: 16 additions & 0 deletions bindings/swift/cairo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef TREE_SITTER_SWIFT_H_
#define TREE_SITTER_SWIFT_H_

typedef struct TSLanguage TSLanguage;

#ifdef __cplusplus
extern "C" {
#endif

extern TSLanguage *tree_sitter_swift();

#ifdef __cplusplus
}
#endif

#endif // TREE_SITTER_SWIFT_H_

0 comments on commit 406efbc

Please sign in to comment.