tree-sitter-beancount 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
8
+ commit-message:
9
+ prefix: "chore:"
10
+ labels:
11
+ - dependabot
@@ -12,12 +12,12 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
14
  - name: Checkout code
15
- uses: actions/checkout@v2
15
+ uses: actions/checkout@v4
16
16
 
17
17
  - name: Setup Node
18
- uses: actions/setup-node@v2-beta
18
+ uses: actions/setup-node@v3.8.1
19
19
  with:
20
- node-version: '16'
20
+ node-version: '18'
21
21
 
22
22
  - name: Display Node versions
23
23
  run: |
@@ -32,9 +32,9 @@ jobs:
32
32
  profile: minimal
33
33
  override: true
34
34
  - name: Checking out sources
35
- uses: actions/checkout@v1
35
+ uses: actions/checkout@v4
36
36
  - name: Cache Cargo
37
- uses: actions/cache@v2
37
+ uses: actions/cache@v3
38
38
  with:
39
39
  path: |
40
40
  ~/.cargo/registry
@@ -57,9 +57,9 @@ jobs:
57
57
  if: needs.release-please.outputs.release_created
58
58
  steps:
59
59
  - name: Checking out sources
60
- uses: actions/checkout@v1
60
+ uses: actions/checkout@v4
61
61
  - name: Set up Node
62
- uses: actions/setup-node@v2
62
+ uses: actions/setup-node@v3.8.1
63
63
  with:
64
64
  node-version: '16'
65
65
  registry-url: 'https://registry.npmjs.org'
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.0](https://github.com/polarmutex/tree-sitter-beancount/compare/v2.1.3...v2.2.0) (2023-10-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * add named field for narration and payee ([0631b99](https://github.com/polarmutex/tree-sitter-beancount/commit/0631b99d9096e10f4e289efe618e518debe918b4))
9
+
10
+ ## [2.1.3](https://github.com/polarmutex/tree-sitter-beancount/compare/v2.1.2...v2.1.3) (2023-07-02)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * detect in error recovery and exit scan ([f3c05c6](https://github.com/polarmutex/tree-sitter-beancount/commit/f3c05c68aa03631fb4b9f0f7592bfec48376e65a))
16
+
3
17
  ## [2.1.2](https://github.com/polarmutex/tree-sitter-beancount/compare/v2.1.1...v2.1.2) (2023-01-28)
4
18
 
5
19
 
package/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "tree-sitter-beancount"
3
3
  description = "beancount grammar for the tree-sitter parsing library"
4
- version = "2.1.2" # {x-release-please-version}
4
+ version = "2.2.0" # {x-release-please-version}
5
5
  keywords = ["incremental", "parsing", "beancount", "tree-sitter"]
6
6
  categories = ["parsing", "text-editors"]
7
7
  repository = "https://github.com/polarmutex/tree-sitter-beancount"
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 PolarMutex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/flake.lock CHANGED
@@ -1,12 +1,31 @@
1
1
  {
2
2
  "nodes": {
3
+ "flake-compat": {
4
+ "flake": false,
5
+ "locked": {
6
+ "lastModified": 1673956053,
7
+ "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
8
+ "owner": "edolstra",
9
+ "repo": "flake-compat",
10
+ "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
11
+ "type": "github"
12
+ },
13
+ "original": {
14
+ "owner": "edolstra",
15
+ "repo": "flake-compat",
16
+ "type": "github"
17
+ }
18
+ },
3
19
  "flake-utils": {
20
+ "inputs": {
21
+ "systems": "systems"
22
+ },
4
23
  "locked": {
5
- "lastModified": 1656065134,
6
- "narHash": "sha256-oc6E6ByIw3oJaIyc67maaFcnjYOz1mMcOtHxbEf9NwQ=",
24
+ "lastModified": 1694529238,
25
+ "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
7
26
  "owner": "numtide",
8
27
  "repo": "flake-utils",
9
- "rev": "bee6a7250dd1b01844a2de7e02e4df7d8a0a206c",
28
+ "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
10
29
  "type": "github"
11
30
  },
12
31
  "original": {
@@ -15,13 +34,34 @@
15
34
  "type": "github"
16
35
  }
17
36
  },
37
+ "gitignore": {
38
+ "inputs": {
39
+ "nixpkgs": [
40
+ "pre-commit-hooks",
41
+ "nixpkgs"
42
+ ]
43
+ },
44
+ "locked": {
45
+ "lastModified": 1660459072,
46
+ "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
47
+ "owner": "hercules-ci",
48
+ "repo": "gitignore.nix",
49
+ "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
50
+ "type": "github"
51
+ },
52
+ "original": {
53
+ "owner": "hercules-ci",
54
+ "repo": "gitignore.nix",
55
+ "type": "github"
56
+ }
57
+ },
18
58
  "nixpkgs": {
19
59
  "locked": {
20
- "lastModified": 1656239181,
21
- "narHash": "sha256-wW1xRFBn376yGloXZ4QzBE4hjipMawpV18Lshd9QSPw=",
60
+ "lastModified": 1696604326,
61
+ "narHash": "sha256-YXUNI0kLEcI5g8lqGMb0nh67fY9f2YoJsILafh6zlMo=",
22
62
  "owner": "NixOS",
23
63
  "repo": "nixpkgs",
24
- "rev": "f2537a505d45c31fe5d9c27ea9829b6f4c4e6ac5",
64
+ "rev": "87828a0e03d1418e848d3dd3f3014a632e4a4f64",
25
65
  "type": "github"
26
66
  },
27
67
  "original": {
@@ -31,21 +71,40 @@
31
71
  "type": "github"
32
72
  }
33
73
  },
74
+ "nixpkgs-stable": {
75
+ "locked": {
76
+ "lastModified": 1685801374,
77
+ "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
78
+ "owner": "NixOS",
79
+ "repo": "nixpkgs",
80
+ "rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
81
+ "type": "github"
82
+ },
83
+ "original": {
84
+ "owner": "NixOS",
85
+ "ref": "nixos-23.05",
86
+ "repo": "nixpkgs",
87
+ "type": "github"
88
+ }
89
+ },
34
90
  "pre-commit-hooks": {
35
91
  "inputs": {
92
+ "flake-compat": "flake-compat",
36
93
  "flake-utils": [
37
94
  "flake-utils"
38
95
  ],
96
+ "gitignore": "gitignore",
39
97
  "nixpkgs": [
40
98
  "nixpkgs"
41
- ]
99
+ ],
100
+ "nixpkgs-stable": "nixpkgs-stable"
42
101
  },
43
102
  "locked": {
44
- "lastModified": 1656169028,
45
- "narHash": "sha256-y9DRauokIeVHM7d29lwT8A+0YoGUBXV3H0VErxQeA8s=",
103
+ "lastModified": 1696846637,
104
+ "narHash": "sha256-0hv4kbXxci2+pxhuXlVgftj/Jq79VSmtAyvfabCCtYk=",
46
105
  "owner": "cachix",
47
106
  "repo": "pre-commit-hooks.nix",
48
- "rev": "db3bd555d3a3ceab208bed48f983ccaa6a71a25e",
107
+ "rev": "42e1b6095ef80a51f79595d9951eb38e91c4e6ca",
49
108
  "type": "github"
50
109
  },
51
110
  "original": {
@@ -60,6 +119,21 @@
60
119
  "nixpkgs": "nixpkgs",
61
120
  "pre-commit-hooks": "pre-commit-hooks"
62
121
  }
122
+ },
123
+ "systems": {
124
+ "locked": {
125
+ "lastModified": 1681028828,
126
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
127
+ "owner": "nix-systems",
128
+ "repo": "default",
129
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
130
+ "type": "github"
131
+ },
132
+ "original": {
133
+ "owner": "nix-systems",
134
+ "repo": "default",
135
+ "type": "github"
136
+ }
63
137
  }
64
138
  },
65
139
  "root": "root",
package/flake.nix CHANGED
@@ -13,101 +13,97 @@
13
13
  };
14
14
  };
15
15
 
16
- outputs = { self, nixpkgs, flake-utils, pre-commit-hooks }:
17
- { } //
18
- flake-utils.lib.eachDefaultSystem
19
- (
20
- system:
21
- let
22
- pkgs = import nixpkgs {
23
- inherit system;
24
- overlays = [ self.overlays.default ];
25
- };
26
-
27
- tree-sitter-env = pkgs.stdenv.mkDerivation {
28
- name = "tree-sitter-env";
29
-
30
- nativeBuildInputs = with pkgs; [
31
- makeWrapper
32
- ];
33
-
34
- dontUnpack = true;
35
-
36
- dontBuild = true;
37
-
38
- installPhase = ''
39
- mkdir -p $out/bin
40
- makeWrapper \
41
- ${pkgs.tree-sitter}/bin/tree-sitter \
42
- $out/bin/tree-sitter \
43
- --prefix PATH : "${with pkgs; lib.makeBinPath [stdenv.cc nodejs]}"
44
- '';
45
- };
46
-
47
- in
48
- rec {
49
- checks = {
50
- pre-commit = pre-commit-hooks.lib.${system}.run {
51
- src = ./.;
52
-
53
- hooks = {
54
- clang-format = {
55
- enable = true;
56
- name = "clang-format";
57
- entry = "${pkgs.clang-tools}/bin/clang-format -style=file -i";
58
- types = [ "text" "c" ];
59
- # I don't care for generated files' formatting
60
- excludes = [ "src/parser.c" "src/tree_sitter/parser.h" ];
61
- language = "system";
62
- };
16
+ outputs = {
17
+ self,
18
+ nixpkgs,
19
+ flake-utils,
20
+ pre-commit-hooks,
21
+ }:
22
+ {}
23
+ // flake-utils.lib.eachDefaultSystem
24
+ (
25
+ system: let
26
+ pkgs = import nixpkgs {
27
+ inherit system;
28
+ #overlays = [self.overlays.default];
29
+ };
30
+ tree-sitter-env = pkgs.stdenv.mkDerivation {
31
+ name = "tree-sitter-env";
32
+ nativeBuildInputs = with pkgs; [
33
+ makeWrapper
34
+ ];
35
+ dontUnpack = true;
36
+ dontBuild = true;
37
+ installPhase = ''
38
+ mkdir -p $out/bin
39
+ makeWrapper \
40
+ ${pkgs.tree-sitter}/bin/tree-sitter \
41
+ $out/bin/tree-sitter \
42
+ --prefix PATH : "${with pkgs; lib.makeBinPath [stdenv.cc nodejs]}"
43
+ '';
44
+ };
45
+ in rec {
46
+ checks = {
47
+ pre-commit = pre-commit-hooks.lib.${system}.run {
48
+ src = ./.;
49
+
50
+ hooks = {
51
+ clang-format = {
52
+ enable = true;
53
+ name = "clang-format";
54
+ entry = "${pkgs.clang-tools}/bin/clang-format -style=file -i";
55
+ types = ["text" "c"];
56
+ # I don't care for generated files' formatting
57
+ excludes = ["src/parser.c" "src/tree_sitter/parser.h"];
58
+ language = "system";
59
+ };
63
60
 
64
- nixpkgs-fmt = {
65
- enable = true;
66
- };
61
+ alejandra.enable = true;
67
62
 
68
- tree-sitter = {
69
- enable = true;
70
- name = "tree-sitter tests";
71
- entry = "${tree-sitter-env}/bin/tree-sitter test";
72
- pass_filenames = false;
73
- };
63
+ tree-sitter = {
64
+ enable = true;
65
+ name = "tree-sitter tests";
66
+ entry = "${tree-sitter-env}/bin/tree-sitter test";
67
+ pass_filenames = false;
68
+ };
74
69
 
75
- tree-sitter-files = {
76
- enable = true;
77
- name = "tree-sitter generated files";
78
- entry = "${tree-sitter-env}/bin/tree-sitter generate";
79
- pass_filenames = false;
80
- };
70
+ tree-sitter-files = {
71
+ enable = true;
72
+ name = "tree-sitter generated files";
73
+ entry = "${tree-sitter-env}/bin/tree-sitter generate";
74
+ pass_filenames = false;
81
75
  };
82
76
  };
83
77
  };
78
+ };
84
79
 
85
- devShells = {
86
- default = pkgs.mkShell {
87
- nativeBuildInputs = with pkgs; [
88
- nodejs-16_x
89
- python39
90
- nodePackages.typescript
91
- rustc
92
- cargo
93
- rustfmt
94
- clippy
95
- (tree-sitter.override { webUISupport = true; })
96
- ];
80
+ devShells = {
81
+ default = pkgs.mkShell {
82
+ nativeBuildInputs = with pkgs; [
83
+ nodejs
84
+ nodePackages.node-gyp
85
+ # broken (tree-sitter.override {webUISupport = true;})
86
+ tree-sitter
87
+ ];
97
88
 
98
- inherit (checks.pre-commit) shellHook;
99
- };
89
+ inherit (checks.pre-commit) shellHook;
100
90
  };
91
+ };
101
92
 
102
- packages = {
103
- default = packages.tree-sitter-beancount;
104
-
105
- inherit (pkgs.tree-sitter.passthru.builtGrammars) tree-sitter-beancount;
93
+ packages = {
94
+ default = packages.tree-sitter-beancount;
106
95
 
107
- inherit (pkgs) tree-sitter;
96
+ tree-sitter-beancount = pkgs.callPackage (nixpkgs + "/pkgs/development/tools/parsing/tree-sitter/grammar.nix") {} {
97
+ language = "beancount";
98
+ src = ./.;
99
+ inherit (pkgs.tree-sitter) version;
108
100
  };
109
- }
110
- ) // {
101
+
102
+ inherit (pkgs) tree-sitter;
103
+ };
104
+ }
105
+ )
106
+ // {
111
107
  overlays = {
112
108
  default = final: prev: {
113
109
  tree-sitter = prev.tree-sitter.override {
package/grammar.js CHANGED
@@ -169,10 +169,10 @@ module.exports = grammar({
169
169
  _txn_strings: $ =>
170
170
  choice(
171
171
  seq(
172
- alias($.string, $.payee),
173
- alias($.string, $.narration),
172
+ field("payee", alias($.string, $.payee)),
173
+ field("narration", alias($.string, $.narration)),
174
174
  ),
175
- alias($.string, $.narration),
175
+ field("narration", alias($.string, $.narration)),
176
176
  ),
177
177
 
178
178
  // OPTIONAL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-beancount",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "a tree-sitter parser for the beancount syntax",
5
5
  "main": "bindings/node",
6
6
  "scripts": {
@@ -25,6 +25,6 @@
25
25
  "nan": "^2.15.0"
26
26
  },
27
27
  "devDependencies": {
28
- "tree-sitter-cli": "0.20.0"
28
+ "tree-sitter-cli": "^0.20.0"
29
29
  }
30
30
  }
package/src/grammar.json CHANGED
@@ -474,33 +474,45 @@
474
474
  "type": "SEQ",
475
475
  "members": [
476
476
  {
477
- "type": "ALIAS",
477
+ "type": "FIELD",
478
+ "name": "payee",
478
479
  "content": {
479
- "type": "SYMBOL",
480
- "name": "string"
481
- },
482
- "named": true,
483
- "value": "payee"
480
+ "type": "ALIAS",
481
+ "content": {
482
+ "type": "SYMBOL",
483
+ "name": "string"
484
+ },
485
+ "named": true,
486
+ "value": "payee"
487
+ }
484
488
  },
485
489
  {
486
- "type": "ALIAS",
490
+ "type": "FIELD",
491
+ "name": "narration",
487
492
  "content": {
488
- "type": "SYMBOL",
489
- "name": "string"
490
- },
491
- "named": true,
492
- "value": "narration"
493
+ "type": "ALIAS",
494
+ "content": {
495
+ "type": "SYMBOL",
496
+ "name": "string"
497
+ },
498
+ "named": true,
499
+ "value": "narration"
500
+ }
493
501
  }
494
502
  ]
495
503
  },
496
504
  {
497
- "type": "ALIAS",
505
+ "type": "FIELD",
506
+ "name": "narration",
498
507
  "content": {
499
- "type": "SYMBOL",
500
- "name": "string"
501
- },
502
- "named": true,
503
- "value": "narration"
508
+ "type": "ALIAS",
509
+ "content": {
510
+ "type": "SYMBOL",
511
+ "name": "string"
512
+ },
513
+ "named": true,
514
+ "value": "narration"
515
+ }
504
516
  }
505
517
  ]
506
518
  },
@@ -1349,6 +1349,26 @@
1349
1349
  }
1350
1350
  ]
1351
1351
  },
1352
+ "narration": {
1353
+ "multiple": false,
1354
+ "required": false,
1355
+ "types": [
1356
+ {
1357
+ "type": "narration",
1358
+ "named": true
1359
+ }
1360
+ ]
1361
+ },
1362
+ "payee": {
1363
+ "multiple": false,
1364
+ "required": false,
1365
+ "types": [
1366
+ {
1367
+ "type": "payee",
1368
+ "named": true
1369
+ }
1370
+ ]
1371
+ },
1352
1372
  "tags_links": {
1353
1373
  "multiple": false,
1354
1374
  "required": false,
@@ -1382,14 +1402,6 @@
1382
1402
  "type": "key_value",
1383
1403
  "named": true
1384
1404
  },
1385
- {
1386
- "type": "narration",
1387
- "named": true
1388
- },
1389
- {
1390
- "type": "payee",
1391
- "named": true
1392
- },
1393
1405
  {
1394
1406
  "type": "posting",
1395
1407
  "named": true