From 406efbcbdccc920b8ce36c9338ebd6fddb33715f Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Tue, 7 Mar 2023 22:21:26 -0500 Subject: [PATCH] feat: add Swift bindings --- Package.swift | 38 ++++++++++++++++++++++++++++++++++++++ bindings/swift/cairo.h | 16 ++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Package.swift create mode 100644 bindings/swift/cairo.h diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..3ff775b --- /dev/null +++ b/Package.swift @@ -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")]) + ] +) diff --git a/bindings/swift/cairo.h b/bindings/swift/cairo.h new file mode 100644 index 0000000..dbb34b6 --- /dev/null +++ b/bindings/swift/cairo.h @@ -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_