Skip to content

Commit

Permalink
feat: Add swift bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
yeatse authored and Brian Ryall committed Dec 20, 2023
1 parent d478091 commit 0e08ee4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ build
.direnv
.pre-commit-config.yaml
result

.build/
31 changes: 31 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version:5.3
import PackageDescription

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

typedef struct TSLanguage TSLanguage;

#ifdef __cplusplus
extern "C" {
#endif

extern TSLanguage *tree_sitter_beancount();

#ifdef __cplusplus
}
#endif

#endif // TREE_SITTER_BEANCOUNT_H_

0 comments on commit 0e08ee4

Please sign in to comment.