Skip to content

Commit

Permalink
Merge pull request #39 from mattmassicotte/feature/spm
Browse files Browse the repository at this point in the history
Bindings for Swift
  • Loading branch information
aryx committed Jun 28, 2023
2 parents 03e9435 + bf4b009 commit 7b5ecd3
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Cargo.lock
*.so
*.o
bindings/c/*.h
bindings/c/*.pc
bindings/c/*.pc
.build/
34 changes: 34 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// swift-tools-version:5.3

import PackageDescription

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

typedef struct TSLanguage TSLanguage;

#ifdef __cplusplus
extern "C" {
#endif

extern TSLanguage *tree_sitter_html();

#ifdef __cplusplus
}
#endif

#endif // TREE_SITTER_HTML_H_

0 comments on commit 7b5ecd3

Please sign in to comment.