Author: Riley Bruins [ribru17@hotmail.com]
Committer: Michael Davis [mcarsondavis@gmail.com] Mon, 13 May 2024 14:38:41 +0000
Hash: 100a7b679840f58cf9e0ba16d9250dd0edf2acee
Timestamp: Mon, 13 May 2024 14:38:41 +0000 (5 months ago)

+23 -6 +/-2 browse
Support mode changing syntax
Support mode changing syntax

Changes that are only permissions take the shape `old/new mode <mode>`.
1diff --git a/grammar.js b/grammar.js
2index 1ecb116..9954788 100644
3--- a/grammar.js
4+++ b/grammar.js
5 @@ -67,12 +67,10 @@ module.exports = grammar({
6 command: ($) => iseq("diff", alias(/[-\w]+/, $.argument), $.filename),
7
8 file_change: ($) =>
9- iseq(
10- field("kind", choice("new", "deleted", "rename")),
11- choice(
12- seq("file", "mode", $.mode),
13- seq(choice("from", "to"), $.filename)
14- )
15+ choice(
16+ seq(choice("new", "deleted"), "file", "mode", $.mode),
17+ seq(choice("new", "old"), "mode", $.mode),
18+ seq("rename", choice("from", "to"), $.filename)
19 ),
20
21 binary_change: ($) =>
22 diff --git a/test/corpus/text.txt b/test/corpus/text.txt
23index 2f38814..cde0efc 100644
24--- a/test/corpus/text.txt
25+++ b/test/corpus/text.txt
26 @@ -284,3 +284,22 @@ Leading plus additions
27 (addition)
28 (addition)
29 (addition))
30+
31+ ================================================================================
32+ File mode changes
33+ ================================================================================
34+ diff --git a/LICENSE b/LICENSE
35+ old mode 100644
36+ new mode 100755
37+
38+ --------------------------------------------------------------------------------
39+
40+ (source
41+ (block
42+ (command
43+ (argument)
44+ (filename))
45+ (file_change
46+ (mode))
47+ (file_change
48+ (mode))))