From 99298c8aceb98382588a44a65573b4c1f6027775 Mon Sep 17 00:00:00 2001 From: Matt <85322+mattmassicotte@users.noreply.github.com> Date: Wed, 2 Nov 2022 09:50:51 -0400 Subject: [PATCH] SPM support --- .gitignore | 1 + Package.swift | 39 ++++++++++++++++++++++++++++++ bindings/swift/TreeSitterHCL/hcl.h | 16 ++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 Package.swift create mode 100644 bindings/swift/TreeSitterHCL/hcl.h diff --git a/.gitignore b/.gitignore index bd4ba95..3a6a855 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ npm-debug.log log.html .env .DS_Store +/.build diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..db40578 --- /dev/null +++ b/Package.swift @@ -0,0 +1,39 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let package = Package( + name: "TreeSitterHCL", + platforms: [.macOS(.v10_13), .iOS(.v11)], + products: [ + .library(name: "TreeSitterHCL", targets: ["TreeSitterHCL"]), + ], + dependencies: [], + targets: [ + .target(name: "TreeSitterHCL", + path: ".", + exclude: [ + "binding.gyp", + "bindings", + "Cargo.toml", + "CHANGELOG.md", + "docs", + "example", + "grammar.js", + "LICENSE", + "package.json", + "README.md", + "shell.nix", + "src/grammar.json", + "src/node-types.json", + "test", + ], + sources: [ + "src/parser.c", + "src/scanner.cc", + ], + publicHeadersPath: "bindings/swift", + cSettings: [.headerSearchPath("src")], + linkerSettings: [.linkedLibrary("c++")]) + ] +) diff --git a/bindings/swift/TreeSitterHCL/hcl.h b/bindings/swift/TreeSitterHCL/hcl.h new file mode 100644 index 0000000..38eb75b --- /dev/null +++ b/bindings/swift/TreeSitterHCL/hcl.h @@ -0,0 +1,16 @@ +#ifndef TREE_SITTER_HCL_H_ +#define TREE_SITTER_HCL_H_ + +typedef struct TSLanguage TSLanguage; + +#ifdef __cplusplus +extern "C" { +#endif + +extern TSLanguage *tree_sitter_hcl(); + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_HCL_H_