File: binding.cc

package info (click to toggle)
tree-sitter-vim 0.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,724 kB
  • sloc: ansic: 152,370; javascript: 2,370; lisp: 315; makefile: 119; python: 51; cpp: 14; sh: 9
file content (20 lines) | stat: -rw-r--r-- 571 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <napi.h>

typedef struct TSLanguage TSLanguage;

extern "C" TSLanguage *tree_sitter_vim();

// "tree-sitter", "language" hashed with BLAKE2
const napi_type_tag LANGUAGE_TYPE_TAG = {
  0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16
};

Napi::Object Init(Napi::Env env, Napi::Object exports) {
    exports["name"] = Napi::String::New(env, "vim");
    auto language = Napi::External<TSLanguage>::New(env, tree_sitter_vim());
    language.TypeTag(&LANGUAGE_TYPE_TAG);
    exports["language"] = language;
    return exports;
}

NODE_API_MODULE(tree_sitter_vim_binding, Init)