Author: Michael Davis [mcarsondavis@gmail.com]
Hash: 4ad7e0bd9ee6f664b95b628136d24990a3753421
Timestamp: Fri, 24 Dec 2021 01:35:50 +0000 (2 years ago)

+22 -0 +/-2 browse
add rule parse binary changes
1diff --git a/grammar.js b/grammar.js
2index 20d076d..c83b6a3 100644
3--- a/grammar.js
4+++ b/grammar.js
5 @@ -14,6 +14,7 @@ module.exports = grammar({
6 choice(
7 $.command,
8 $.file_change,
9+ $.binary_change,
10 $.index,
11 $.similarity,
12 $.file,
13 @@ -34,6 +35,8 @@ module.exports = grammar({
14 )
15 ),
16
17+ binary_change: ($) =>
18+ iseq("Binary", "files", $.filename, "and", $.filename, "differ"),
19
20 index: ($) => iseq("index", $.commit, "..", $.commit, optional($.mode)),
21
22 diff --git a/test/corpus/binary.txt b/test/corpus/binary.txt
23index e69de29..dce7d1d 100644
24--- a/test/corpus/binary.txt
25+++ b/test/corpus/binary.txt
26 @@ -0,0 +1,19 @@
27+ ================================================================================
28+ Single-file small change
29+ ================================================================================
30+ diff --git a/tree-sitter-gitdiff.wasm b/tree-sitter-gitdiff.wasm
31+ index 0e9e828..3e32290 100755
32+ Binary files a/tree-sitter-gitdiff.wasm and b/tree-sitter-gitdiff.wasm differ
33+
34+ --------------------------------------------------------------------------------
35+
36+ (source
37+ (command
38+ (filename))
39+ (index
40+ (commit)
41+ (commit)
42+ (mode))
43+ (binary_change
44+ (filename)
45+ (filename)))