Author: Riley Bruins [ribru17@hotmail.com]
Committer: Michael Davis [mcarsondavis@gmail.com] Mon, 13 May 2024 14:35:22 +0000
Hash: 928b9cafa1a0bf433777f96611446b1112d3ca9b
Timestamp: Mon, 13 May 2024 14:35:22 +0000 (5 months ago)

+10 -1 +/-3 browse
Expose diff argument as a named 'argument' node
1diff --git a/grammar.js b/grammar.js
2index 588ac40..bc9e124 100644
3--- a/grammar.js
4+++ b/grammar.js
5 @@ -64,7 +64,7 @@ module.exports = grammar({
6 )
7 ),
8
9- command: ($) => iseq("diff", /[-\w]+/, $.filename),
10+ command: ($) => iseq("diff", alias(/[-\w]+/, $.argument), $.filename),
11
12 file_change: ($) =>
13 iseq(
14 diff --git a/test/corpus/binary.txt b/test/corpus/binary.txt
15index 08114ae..c7b7c48 100644
16--- a/test/corpus/binary.txt
17+++ b/test/corpus/binary.txt
18 @@ -10,6 +10,7 @@ Binary files a/tree-sitter-gitdiff.wasm and b/tree-sitter-gitdiff.wasm differ
19 (source
20 (block
21 (command
22+ (argument)
23 (filename))
24 (index
25 (commit)
26 @@ -32,6 +33,7 @@ Binary files a/docs/playground.png and /dev/null differ
27 (source
28 (block
29 (command
30+ (argument)
31 (filename))
32 (file_change
33 (mode))
34 diff --git a/test/corpus/text.txt b/test/corpus/text.txt
35index bc4049c..2b82ef4 100644
36--- a/test/corpus/text.txt
37+++ b/test/corpus/text.txt
38 @@ -21,6 +21,7 @@ index dc36969..f37fde0 100644
39 (source
40 (block
41 (command
42+ (argument)
43 (filename))
44 (index
45 (commit)
46 @@ -57,6 +58,7 @@ index 0000000..e69de29
47 (source
48 (block
49 (command
50+ (argument)
51 (filename))
52 (file_change
53 (mode))
54 @@ -76,6 +78,7 @@ index e69de29..0000000
55 (source
56 (block
57 (command
58+ (argument)
59 (filename))
60 (file_change
61 (mode))
62 @@ -96,6 +99,7 @@ rename to tmp.md
63 (source
64 (block
65 (command
66+ (argument)
67 (filename))
68 (similarity)
69 (file_change
70 @@ -132,6 +136,7 @@ index 00000000..ee9808dc
71 (source
72 (block
73 (command
74+ (argument)
75 (filename))
76 (file_change
77 (mode))
78 @@ -197,6 +202,7 @@ index 321c90a..b4a5cba 100644
79 (source
80 (block
81 (command
82+ (argument)
83 (filename))
84 (index
85 (commit)
86 @@ -221,6 +227,7 @@ index 321c90a..b4a5cba 100644
87 (context)))))
88 (block
89 (command
90+ (argument)
91 (filename))
92 (index
93 (commit)