-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from fwcd/regenerate-artifacts
Run tree-sitter generate on the main branch. Update tree-sitter-cli to 0.22.6
- Loading branch information
Showing
21 changed files
with
3,339 additions
and
6,441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// swift-tools-version:5.3 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "TreeSitterKotlin", | ||
products: [ | ||
.library(name: "TreeSitterKotlin", targets: ["TreeSitterKotlin"]), | ||
], | ||
dependencies: [], | ||
targets: [ | ||
.target(name: "TreeSitterKotlin", | ||
path: ".", | ||
exclude: [ | ||
"Cargo.toml", | ||
"Makefile", | ||
"binding.gyp", | ||
"bindings/c", | ||
"bindings/go", | ||
"bindings/node", | ||
"bindings/python", | ||
"bindings/rust", | ||
"prebuilds", | ||
"grammar.js", | ||
"package.json", | ||
"package-lock.json", | ||
"pyproject.toml", | ||
"setup.py", | ||
"test", | ||
"examples", | ||
".editorconfig", | ||
".github", | ||
".gitignore", | ||
".gitattributes", | ||
".gitmodules", | ||
], | ||
sources: [ | ||
"src/parser.c", | ||
"src/scanner.c", | ||
], | ||
resources: [ | ||
.copy("queries") | ||
], | ||
publicHeadersPath: "bindings/swift", | ||
cSettings: [.headerSearchPath("src")]) | ||
], | ||
cLanguageStandard: .c11 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
prefix=@PREFIX@ | ||
libdir=@LIBDIR@ | ||
includedir=@INCLUDEDIR@ | ||
|
||
Name: tree-sitter-kotlin | ||
Description: Kotlin grammar for tree-sitter | ||
URL: @URL@ | ||
Version: @VERSION@ | ||
Requires: @REQUIRES@ | ||
Libs: -L${libdir} @ADDITIONAL_LIBS@ -ltree-sitter-kotlin | ||
Cflags: -I${includedir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package tree_sitter_kotlin | ||
|
||
// #cgo CFLAGS: -std=c11 -fPIC | ||
// #include "../../src/parser.c" | ||
// #include "../../src/scanner.c" | ||
// // NOTE: if your language has an external scanner, add it here. | ||
import "C" | ||
|
||
import "unsafe" | ||
|
||
// Get the tree-sitter Language for this grammar. | ||
func Language() unsafe.Pointer { | ||
return unsafe.Pointer(C.tree_sitter_kotlin()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package tree_sitter_kotlin_test | ||
|
||
import ( | ||
"testing" | ||
|
||
tree_sitter "github.com/smacker/go-tree-sitter" | ||
"github.com/tree-sitter/tree-sitter-kotlin" | ||
) | ||
|
||
func TestCanLoadGrammar(t *testing.T) { | ||
language := tree_sitter.NewLanguage(tree_sitter_kotlin.Language()) | ||
if language == nil { | ||
t.Errorf("Error loading Kotlin grammar") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/tree-sitter/tree-sitter-kotlin | ||
|
||
go 1.22 | ||
|
||
require github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,20 @@ | ||
#include "tree_sitter/parser.h" | ||
#include <node.h> | ||
#include "nan.h" | ||
#include <napi.h> | ||
|
||
using namespace v8; | ||
typedef struct TSLanguage TSLanguage; | ||
|
||
extern "C" TSLanguage * tree_sitter_kotlin(); | ||
extern "C" TSLanguage *tree_sitter_kotlin(); | ||
|
||
namespace { | ||
// "tree-sitter", "language" hashed with BLAKE2 | ||
const napi_type_tag LANGUAGE_TYPE_TAG = { | ||
0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16 | ||
}; | ||
|
||
NAN_METHOD(New) {} | ||
|
||
void Init(Local<Object> exports, Local<Object> module) { | ||
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New); | ||
tpl->SetClassName(Nan::New("Language").ToLocalChecked()); | ||
tpl->InstanceTemplate()->SetInternalFieldCount(1); | ||
|
||
Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked(); | ||
Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); | ||
Nan::SetInternalFieldPointer(instance, 0, tree_sitter_kotlin()); | ||
|
||
Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("kotlin").ToLocalChecked()); | ||
Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); | ||
Napi::Object Init(Napi::Env env, Napi::Object exports) { | ||
exports["name"] = Napi::String::New(env, "kotlin"); | ||
auto language = Napi::External<TSLanguage>::New(env, tree_sitter_kotlin()); | ||
language.TypeTag(&LANGUAGE_TYPE_TAG); | ||
exports["language"] = language; | ||
return exports; | ||
} | ||
|
||
NODE_MODULE(tree_sitter_kotlin_binding, Init) | ||
|
||
} // namespace | ||
NODE_API_MODULE(tree_sitter_kotlin_binding, Init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
type BaseNode = { | ||
type: string; | ||
named: boolean; | ||
}; | ||
|
||
type ChildNode = { | ||
multiple: boolean; | ||
required: boolean; | ||
types: BaseNode[]; | ||
}; | ||
|
||
type NodeInfo = | ||
| (BaseNode & { | ||
subtypes: BaseNode[]; | ||
}) | ||
| (BaseNode & { | ||
fields: { [name: string]: ChildNode }; | ||
children: ChildNode[]; | ||
}); | ||
|
||
type Language = { | ||
name: string; | ||
language: unknown; | ||
nodeTypeInfo: NodeInfo[]; | ||
}; | ||
|
||
declare const language: Language; | ||
export = language; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"Kotlin grammar for tree-sitter" | ||
|
||
from ._binding import language | ||
|
||
__all__ = ["language"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
def language() -> int: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <Python.h> | ||
|
||
typedef struct TSLanguage TSLanguage; | ||
|
||
TSLanguage *tree_sitter_kotlin(void); | ||
|
||
static PyObject* _binding_language(PyObject *self, PyObject *args) { | ||
return PyLong_FromVoidPtr(tree_sitter_kotlin()); | ||
} | ||
|
||
static PyMethodDef methods[] = { | ||
{"language", _binding_language, METH_NOARGS, | ||
"Get the tree-sitter language for this grammar."}, | ||
{NULL, NULL, 0, NULL} | ||
}; | ||
|
||
static struct PyModuleDef module = { | ||
.m_base = PyModuleDef_HEAD_INIT, | ||
.m_name = "_binding", | ||
.m_doc = NULL, | ||
.m_size = -1, | ||
.m_methods = methods | ||
}; | ||
|
||
PyMODINIT_FUNC PyInit__binding(void) { | ||
return PyModule_Create(&module); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef TREE_SITTER_KOTLIN_H_ | ||
#define TREE_SITTER_KOTLIN_H_ | ||
|
||
typedef struct TSLanguage TSLanguage; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
const TSLanguage *tree_sitter_kotlin(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // TREE_SITTER_KOTLIN_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[build-system] | ||
requires = ["setuptools>=42", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "tree-sitter-kotlin" | ||
description = "Kotlin grammar for tree-sitter" | ||
version = "0.0.1" | ||
keywords = ["incremental", "parsing", "tree-sitter", "kotlin"] | ||
classifiers = [ | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Topic :: Software Development :: Compilers", | ||
"Topic :: Text Processing :: Linguistic", | ||
"Typing :: Typed" | ||
] | ||
requires-python = ">=3.8" | ||
license.text = "MIT" | ||
readme = "README.md" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/tree-sitter/tree-sitter-kotlin" | ||
|
||
[project.optional-dependencies] | ||
core = ["tree-sitter~=0.21"] | ||
|
||
[tool.cibuildwheel] | ||
build = "cp38-*" | ||
build-frontend = "build" |
Oops, something went wrong.