Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tree-sitter-typescript = "=0.20.1"
tree-sitter-javascript = "=0.20.0"
tree-sitter-python = "=0.20.2"
tree-sitter-rust = "=0.20.3"
tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "=0.20.0" }
tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "=0.20.1" }
tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "=0.20.0" }
tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "=0.20.1" }
tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "=0.20.0" }
Expand Down
2 changes: 1 addition & 1 deletion enums/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tree-sitter-typescript = "=0.20.1"
tree-sitter-javascript = "=0.20.0"
tree-sitter-python = "=0.20.2"
tree-sitter-rust = "=0.20.3"
tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "=0.20.0" }
tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "=0.20.1" }
tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "=0.20.0" }
tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp", version = "=0.20.1" }
tree-sitter-mozjs = { path = "../tree-sitter-mozjs", version = "=0.20.0" }
Expand Down
2 changes: 1 addition & 1 deletion tests/repositories/rca-output
4 changes: 2 additions & 2 deletions tree-sitter-preproc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tree-sitter-preproc"
description = "Preproc grammar for the tree-sitter parsing library"
version = "0.20.0"
version = "0.20.1"
authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
license = "MIT"
readme = "bindings/rust/README.md"
Expand All @@ -21,7 +21,7 @@ include = [
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = "0.20.0"
tree-sitter = "0.20.9"

[build-dependencies]
cc = "^1.0"
2 changes: 1 addition & 1 deletion tree-sitter-preproc/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"sources": [
"src/parser.c",
"src/binding.cc"
"bindings/node/binding.cc"
],
"cflags_c": [
"-std=c99",
Expand Down
28 changes: 28 additions & 0 deletions tree-sitter-preproc/bindings/node/binding.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "tree_sitter/parser.h"
#include <node.h>
#include "nan.h"

using namespace v8;

extern "C" TSLanguage * tree_sitter_preproc();

namespace {

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_preproc());

Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("preproc").ToLocalChecked());
Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
}

NODE_MODULE(tree_sitter_preproc_binding, Init)

} // namespace
19 changes: 19 additions & 0 deletions tree-sitter-preproc/bindings/node/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
try {
module.exports = require("../../build/Release/tree_sitter_preproc_binding");
} catch (error1) {
if (error1.code !== 'MODULE_NOT_FOUND') {
throw error1;
}
try {
module.exports = require("../../build/Debug/tree_sitter_preproc_binding");
} catch (error2) {
if (error2.code !== 'MODULE_NOT_FOUND') {
throw error2;
}
throw error1
}
}

try {
module.exports.nodeTypeInfo = require("../../src/node-types.json");
} catch (_) {}
13 changes: 0 additions & 13 deletions tree-sitter-preproc/index.js

This file was deleted.

6 changes: 3 additions & 3 deletions tree-sitter-preproc/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "tree-sitter-preproc",
"version": "0.19.0",
"version": "0.20.0",
"description": "Preproc grammar for node-tree-sitter",
"main": "index.js",
"main": "bindings/node",
"keywords": [
"parser",
"lexer"
Expand All @@ -13,7 +13,7 @@
"nan": "^2.14.2"
},
"devDependencies": {
"tree-sitter-cli": "^0.19.3"
"tree-sitter-cli": "^0.20.7"
},
"scripts": {
"build": "tree-sitter generate && node-gyp build",
Expand Down
28 changes: 0 additions & 28 deletions tree-sitter-preproc/src/binding.cc

This file was deleted.

Loading