Author: Michael Davis [mcarsondavis@gmail.com]
Hash: 32cb17faed1544d7fa944c010ec1aa23b20dfb19
Timestamp: Fri, 24 Dec 2021 21:27:00 +0000 (2 years ago)

+17 -17 +/-9 browse
rename to tree-sitter-git-diff
1diff --git a/README.md b/README.md
2index ae58c06..96350e8 100644
3--- a/README.md
4+++ b/README.md
5 @@ -1,9 +1,9 @@
6- # `tree-sitter-gitdiff`
7+ # `tree-sitter-git-diff`
8
9- [![CI](https://github.com/the-mikedavis/tree-sitter-gitcommit/actions/workflows/ci.yml/badge.svg)](https://github.com/the-mikedavis/tree-sitter-gitcommit/actions/workflows/ci.yml)
10+ [![CI](https://github.com/the-mikedavis/tree-sitter-git-diff/actions/workflows/ci.yml/badge.svg)](https://github.com/the-mikedavis/tree-sitter-git-diff/actions/workflows/ci.yml)
11
12 A [tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for `git diff`s.
13
14 ### Status
15
16- Incomplete: just starting out.
17+ Working, but needs more testing.
18 diff --git a/bindings/node/binding.cc b/bindings/node/binding.cc
19index 63701f1..fdf9373 100644
20--- a/bindings/node/binding.cc
21+++ b/bindings/node/binding.cc
22 @@ -4,7 +4,7 @@
23
24 using namespace v8;
25
26- extern "C" TSLanguage * tree_sitter_gitdiff();
27+ extern "C" TSLanguage * tree_sitter_git_diff();
28
29 namespace {
30
31 @@ -17,12 +17,12 @@ void Init(Local<Object> exports, Local<Object> module) {
32
33 Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();
34 Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();
35- Nan::SetInternalFieldPointer(instance, 0, tree_sitter_gitdiff());
36+ Nan::SetInternalFieldPointer(instance, 0, tree_sitter_git_diff());
37
38- Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("gitdiff").ToLocalChecked());
39+ Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("git_diff").ToLocalChecked());
40 Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
41 }
42
43- NODE_MODULE(tree_sitter_gitdiff_binding, Init)
44+ NODE_MODULE(tree_sitter_git_diff_binding, Init)
45
46 } // namespace
47 diff --git a/bindings/node/index.js b/bindings/node/index.js
48index 7ea3730..057ee90 100644
49--- a/bindings/node/index.js
50+++ b/bindings/node/index.js
51 @@ -1,11 +1,11 @@
52 try {
53- module.exports = require("../../build/Release/tree_sitter_gitdiff_binding");
54+ module.exports = require("../../build/Release/tree_sitter_git_diff_binding");
55 } catch (error1) {
56 if (error1.code !== 'MODULE_NOT_FOUND') {
57 throw error1;
58 }
59 try {
60- module.exports = require("../../build/Debug/tree_sitter_gitdiff_binding");
61+ module.exports = require("../../build/Debug/tree_sitter_git_diff_binding");
62 } catch (error2) {
63 if (error2.code !== 'MODULE_NOT_FOUND') {
64 throw error2;
65 diff --git a/bindings/rust/lib.rs b/bindings/rust/lib.rs
66index 202fdb6..05d438e 100644
67--- a/bindings/rust/lib.rs
68+++ b/bindings/rust/lib.rs
69 @@ -1,4 +1,4 @@
70- //! This crate provides gitdiff language support for the [tree-sitter][] parsing library.
71+ //! This crate provides git_diff language support for the [tree-sitter][] parsing library.
72 //!
73 //! Typically, you will use the [language][language func] function to add this language to a
74 //! tree-sitter [Parser][], and then use the parser to parse some code:
75 @@ -6,7 +6,7 @@
76 //! ```
77 //! let code = "";
78 //! let mut parser = tree_sitter::Parser::new();
79- //! parser.set_language(tree_sitter_gitdiff::language()).expect("Error loading gitdiff grammar");
80+ //! parser.set_language(tree_sitter_git_diff::language()).expect("Error loading git_diff grammar");
81 //! let tree = parser.parse(code, None).unwrap();
82 //! ```
83 //!
84 @@ -18,14 +18,14 @@
85 use tree_sitter::Language;
86
87 extern "C" {
88- fn tree_sitter_gitdiff() -> Language;
89+ fn tree_sitter_git_diff() -> Language;
90 }
91
92 /// Get the tree-sitter [Language][] for this grammar.
93 ///
94 /// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
95 pub fn language() -> Language {
96- unsafe { tree_sitter_gitdiff() }
97+ unsafe { tree_sitter_git_diff() }
98 }
99
100 /// The content of the [`node-types.json`][] file for this grammar.
101 @@ -47,6 +47,6 @@ mod tests {
102 let mut parser = tree_sitter::Parser::new();
103 parser
104 .set_language(super::language())
105- .expect("Error loading gitdiff language");
106+ .expect("Error loading git_diff language");
107 }
108 }
109 diff --git a/grammar.js b/grammar.js
110index ba3b9f1..3e9b438 100644
111--- a/grammar.js
112+++ b/grammar.js
113 @@ -3,7 +3,7 @@ const WHITE_SPACE = /[\t\f\v ]+/;
114 const ANYTHING = /[^\r\n]+/;
115
116 module.exports = grammar({
117- name: "gitdiff",
118+ name: "git_diff",
119
120 extras: ($) => [WHITE_SPACE],
121
122 diff --git a/src/grammar.json b/src/grammar.json
123index 60418b0..fedaf09 100644
124--- a/src/grammar.json
125+++ b/src/grammar.json
126 @@ -1,5 +1,5 @@
127 {
128- "name": "gitdiff",
129+ "name": "git_diff",
130 "rules": {
131 "source": {
132 "type": "REPEAT",
133 diff --git a/src/parser.c b/src/parser.c
134index ee291bf..34ebb54 100644
135--- a/src/parser.c
136+++ b/src/parser.c
137 @@ -2141,7 +2141,7 @@ extern "C" {
138 #define extern __declspec(dllexport)
139 #endif
140
141- extern const TSLanguage *tree_sitter_gitdiff(void) {
142+ extern const TSLanguage *tree_sitter_git_diff(void) {
143 static const TSLanguage language = {
144 .version = LANGUAGE_VERSION,
145 .symbol_count = SYMBOL_COUNT,
146 diff --git a/tree-sitter-git_diff.wasm b/tree-sitter-git_diff.wasm
147new file mode 100755
148index 0000000..5d0dcfc
149 Binary files /dev/null and b/tree-sitter-git_diff.wasm differ
150 diff --git a/tree-sitter-gitdiff.wasm b/tree-sitter-gitdiff.wasm
151deleted file mode 100755
152index b5d02f6..0000000
153 Binary files a/tree-sitter-gitdiff.wasm and /dev/null differ