tree-sitter-beancount 2.3.3 → 2.4.1
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.
- package/README.md +334 -4
- package/binding.gyp +17 -7
- package/bindings/node/binding.cc +14 -22
- package/bindings/node/index.d.ts +28 -0
- package/bindings/node/index.js +3 -15
- package/grammar.js +38 -125
- package/package.json +35 -5
- package/prebuilds/darwin-arm64/tree-sitter-beancount.node +0 -0
- package/prebuilds/darwin-x64/tree-sitter-beancount.node +0 -0
- package/prebuilds/linux-arm64/tree-sitter-beancount.node +0 -0
- package/prebuilds/linux-x64/tree-sitter-beancount.node +0 -0
- package/prebuilds/win32-arm64/tree-sitter-beancount.node +0 -0
- package/prebuilds/win32-x64/tree-sitter-beancount.node +0 -0
- package/src/grammar.json +149 -560
- package/src/node-types.json +10 -11
- package/src/parser.c +7615 -9089
- package/src/scanner.c +345 -67
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +291 -0
- package/src/tree_sitter/parser.h +68 -12
- package/.clang-format +0 -20
- package/.envrc +0 -1
- package/.gitattributes +0 -6
- package/.github/dependabot.yml +0 -26
- package/.github/workflows/cicd.yml +0 -30
- package/.github/workflows/release.yml +0 -72
- package/CHANGELOG.md +0 -80
- package/Cargo.lock +0 -71
- package/Cargo.toml +0 -26
- package/Package.swift +0 -20
- package/bindings/rust/build.rs +0 -39
- package/bindings/rust/lib.rs +0 -52
- package/flake.lock +0 -141
- package/flake.nix +0 -120
- package/test/corpus/arithmetic.txt +0 -373
- package/test/corpus/comment.txt +0 -992
- package/test/corpus/currencies.txt +0 -66
- package/test/corpus/entry_types.txt +0 -389
- package/test/corpus/markdown_orgmode.txt +0 -60
- package/test/corpus/metadata.txt +0 -414
- package/test/corpus/multi_line.txt +0 -27
- package/test/corpus/orgmode_sections.txt +0 -53
- package/test/corpus/parse_lots.txt +0 -417
- package/test/corpus/parser_include.txt +0 -23
- package/test/corpus/parser_links.txt +0 -32
- package/test/corpus/parser_options.txt +0 -39
- package/test/corpus/parser_plugin.txt +0 -35
- package/test/corpus/push_pop_meta.txt +0 -34
- package/test/corpus/push_pop_tag.txt +0 -23
- package/test/corpus/transaction.txt +0 -224
- package/test/corpus/ugly_bugs.txt +0 -91
package/Cargo.lock
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# This file is automatically @generated by Cargo.
|
|
2
|
-
# It is not intended for manual editing.
|
|
3
|
-
version = 3
|
|
4
|
-
|
|
5
|
-
[[package]]
|
|
6
|
-
name = "aho-corasick"
|
|
7
|
-
version = "1.1.3"
|
|
8
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
-
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
|
10
|
-
dependencies = [
|
|
11
|
-
"memchr",
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
[[package]]
|
|
15
|
-
name = "cc"
|
|
16
|
-
version = "1.1.6"
|
|
17
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
|
-
checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f"
|
|
19
|
-
|
|
20
|
-
[[package]]
|
|
21
|
-
name = "memchr"
|
|
22
|
-
version = "2.7.4"
|
|
23
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
-
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
|
25
|
-
|
|
26
|
-
[[package]]
|
|
27
|
-
name = "regex"
|
|
28
|
-
version = "1.10.5"
|
|
29
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
-
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
|
31
|
-
dependencies = [
|
|
32
|
-
"aho-corasick",
|
|
33
|
-
"memchr",
|
|
34
|
-
"regex-automata",
|
|
35
|
-
"regex-syntax",
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
[[package]]
|
|
39
|
-
name = "regex-automata"
|
|
40
|
-
version = "0.4.7"
|
|
41
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
42
|
-
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
|
43
|
-
dependencies = [
|
|
44
|
-
"aho-corasick",
|
|
45
|
-
"memchr",
|
|
46
|
-
"regex-syntax",
|
|
47
|
-
]
|
|
48
|
-
|
|
49
|
-
[[package]]
|
|
50
|
-
name = "regex-syntax"
|
|
51
|
-
version = "0.8.4"
|
|
52
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
53
|
-
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
|
54
|
-
|
|
55
|
-
[[package]]
|
|
56
|
-
name = "tree-sitter"
|
|
57
|
-
version = "0.22.6"
|
|
58
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
59
|
-
checksum = "df7cc499ceadd4dcdf7ec6d4cbc34ece92c3fa07821e287aedecd4416c516dca"
|
|
60
|
-
dependencies = [
|
|
61
|
-
"cc",
|
|
62
|
-
"regex",
|
|
63
|
-
]
|
|
64
|
-
|
|
65
|
-
[[package]]
|
|
66
|
-
name = "tree-sitter-beancount"
|
|
67
|
-
version = "2.3.2"
|
|
68
|
-
dependencies = [
|
|
69
|
-
"cc",
|
|
70
|
-
"tree-sitter",
|
|
71
|
-
]
|
package/Cargo.toml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "tree-sitter-beancount"
|
|
3
|
-
description = "beancount grammar for the tree-sitter parsing library"
|
|
4
|
-
version = "2.3.2" # {x-release-please-version}
|
|
5
|
-
keywords = ["incremental", "parsing", "beancount", "tree-sitter"]
|
|
6
|
-
categories = ["parsing", "text-editors"]
|
|
7
|
-
repository = "https://github.com/polarmutex/tree-sitter-beancount"
|
|
8
|
-
edition = "2018"
|
|
9
|
-
license = "MIT"
|
|
10
|
-
|
|
11
|
-
build = "bindings/rust/build.rs"
|
|
12
|
-
include = [
|
|
13
|
-
"bindings/rust/*",
|
|
14
|
-
"grammar.js",
|
|
15
|
-
"queries/*",
|
|
16
|
-
"src/*",
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
[lib]
|
|
20
|
-
path = "bindings/rust/lib.rs"
|
|
21
|
-
|
|
22
|
-
[dependencies]
|
|
23
|
-
tree-sitter = "~0.22.6"
|
|
24
|
-
|
|
25
|
-
[build-dependencies]
|
|
26
|
-
cc = "1.0"
|
package/Package.swift
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// swift-tools-version:5.3
|
|
2
|
-
import PackageDescription
|
|
3
|
-
|
|
4
|
-
let package = Package(
|
|
5
|
-
name: "TreeSitterBeancount",
|
|
6
|
-
products: [
|
|
7
|
-
.library(name: "TreeSitterBeancount", targets: ["TreeSitterBeancount"]),
|
|
8
|
-
],
|
|
9
|
-
dependencies: [],
|
|
10
|
-
targets: [
|
|
11
|
-
.target(name: "TreeSitterBeancount",
|
|
12
|
-
path: ".",
|
|
13
|
-
sources: [
|
|
14
|
-
"src/parser.c",
|
|
15
|
-
"src/scanner.c",
|
|
16
|
-
],
|
|
17
|
-
publicHeadersPath: "bindings/swift",
|
|
18
|
-
cSettings: [.headerSearchPath("src")])
|
|
19
|
-
]
|
|
20
|
-
)
|
package/bindings/rust/build.rs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
fn main() {
|
|
2
|
-
let src_dir = std::path::Path::new("src");
|
|
3
|
-
|
|
4
|
-
let mut c_config = cc::Build::new();
|
|
5
|
-
c_config.include(&src_dir);
|
|
6
|
-
c_config
|
|
7
|
-
.flag_if_supported("-Wno-unused-parameter")
|
|
8
|
-
.flag_if_supported("-Wno-unused-but-set-variable")
|
|
9
|
-
.flag_if_supported("-Wno-trigraphs")
|
|
10
|
-
.flag_if_supported("-O");
|
|
11
|
-
let parser_path = src_dir.join("parser.c");
|
|
12
|
-
c_config.file(&parser_path);
|
|
13
|
-
|
|
14
|
-
// If your language uses an external scanner written in C,
|
|
15
|
-
// then include this block of code:
|
|
16
|
-
|
|
17
|
-
let scanner_path = src_dir.join("scanner.c");
|
|
18
|
-
c_config.file(&scanner_path);
|
|
19
|
-
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
|
20
|
-
|
|
21
|
-
c_config.compile("parser");
|
|
22
|
-
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
|
|
23
|
-
|
|
24
|
-
// If your language uses an external scanner written in C++,
|
|
25
|
-
// then include this block of code:
|
|
26
|
-
|
|
27
|
-
/*
|
|
28
|
-
let mut cpp_config = cc::Build::new();
|
|
29
|
-
cpp_config.cpp(true);
|
|
30
|
-
cpp_config.include(&src_dir);
|
|
31
|
-
cpp_config
|
|
32
|
-
.flag_if_supported("-Wno-unused-parameter")
|
|
33
|
-
.flag_if_supported("-Wno-unused-but-set-variable");
|
|
34
|
-
let scanner_path = src_dir.join("scanner.cc");
|
|
35
|
-
cpp_config.file(&scanner_path);
|
|
36
|
-
cpp_config.compile("scanner");
|
|
37
|
-
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
|
38
|
-
*/
|
|
39
|
-
}
|
package/bindings/rust/lib.rs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//! This crate provides beancount language support for the [tree-sitter][] parsing library.
|
|
2
|
-
//!
|
|
3
|
-
//! Typically, you will use the [language][language func] function to add this language to a
|
|
4
|
-
//! tree-sitter [Parser][], and then use the parser to parse some code:
|
|
5
|
-
//!
|
|
6
|
-
//! ```
|
|
7
|
-
//! let code = "";
|
|
8
|
-
//! let mut parser = tree_sitter::Parser::new();
|
|
9
|
-
//! parser.set_language(tree_sitter_beancount::language()).expect("Error loading beancount grammar");
|
|
10
|
-
//! let tree = parser.parse(code, None).unwrap();
|
|
11
|
-
//! ```
|
|
12
|
-
//!
|
|
13
|
-
//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
|
|
14
|
-
//! [language func]: fn.language.html
|
|
15
|
-
//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
|
|
16
|
-
//! [tree-sitter]: https://tree-sitter.github.io/
|
|
17
|
-
|
|
18
|
-
use tree_sitter::Language;
|
|
19
|
-
|
|
20
|
-
extern "C" {
|
|
21
|
-
fn tree_sitter_beancount() -> Language;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/// Get the tree-sitter [Language][] for this grammar.
|
|
25
|
-
///
|
|
26
|
-
/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
|
|
27
|
-
pub fn language() -> Language {
|
|
28
|
-
unsafe { tree_sitter_beancount() }
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/// The content of the [`node-types.json`][] file for this grammar.
|
|
32
|
-
///
|
|
33
|
-
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
|
|
34
|
-
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
|
|
35
|
-
|
|
36
|
-
// Uncomment these to include any queries that this grammar contains
|
|
37
|
-
|
|
38
|
-
// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
|
|
39
|
-
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
|
|
40
|
-
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
|
|
41
|
-
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
|
|
42
|
-
|
|
43
|
-
#[cfg(test)]
|
|
44
|
-
mod tests {
|
|
45
|
-
#[test]
|
|
46
|
-
fn test_can_load_grammar() {
|
|
47
|
-
let mut parser = tree_sitter::Parser::new();
|
|
48
|
-
parser
|
|
49
|
-
.set_language(super::language())
|
|
50
|
-
.expect("Error loading beancount language");
|
|
51
|
-
}
|
|
52
|
-
}
|
package/flake.lock
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"nodes": {
|
|
3
|
-
"flake-compat": {
|
|
4
|
-
"flake": false,
|
|
5
|
-
"locked": {
|
|
6
|
-
"lastModified": 1696426674,
|
|
7
|
-
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
|
8
|
-
"owner": "edolstra",
|
|
9
|
-
"repo": "flake-compat",
|
|
10
|
-
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
|
11
|
-
"type": "github"
|
|
12
|
-
},
|
|
13
|
-
"original": {
|
|
14
|
-
"owner": "edolstra",
|
|
15
|
-
"repo": "flake-compat",
|
|
16
|
-
"type": "github"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"flake-utils": {
|
|
20
|
-
"inputs": {
|
|
21
|
-
"systems": "systems"
|
|
22
|
-
},
|
|
23
|
-
"locked": {
|
|
24
|
-
"lastModified": 1709126324,
|
|
25
|
-
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
|
|
26
|
-
"owner": "numtide",
|
|
27
|
-
"repo": "flake-utils",
|
|
28
|
-
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
|
|
29
|
-
"type": "github"
|
|
30
|
-
},
|
|
31
|
-
"original": {
|
|
32
|
-
"owner": "numtide",
|
|
33
|
-
"repo": "flake-utils",
|
|
34
|
-
"type": "github"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"gitignore": {
|
|
38
|
-
"inputs": {
|
|
39
|
-
"nixpkgs": [
|
|
40
|
-
"pre-commit-hooks",
|
|
41
|
-
"nixpkgs"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
"locked": {
|
|
45
|
-
"lastModified": 1703887061,
|
|
46
|
-
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
|
|
47
|
-
"owner": "hercules-ci",
|
|
48
|
-
"repo": "gitignore.nix",
|
|
49
|
-
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
|
|
50
|
-
"type": "github"
|
|
51
|
-
},
|
|
52
|
-
"original": {
|
|
53
|
-
"owner": "hercules-ci",
|
|
54
|
-
"repo": "gitignore.nix",
|
|
55
|
-
"type": "github"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"nixpkgs": {
|
|
59
|
-
"locked": {
|
|
60
|
-
"lastModified": 1708984720,
|
|
61
|
-
"narHash": "sha256-gJctErLbXx4QZBBbGp78PxtOOzsDaQ+yw1ylNQBuSUY=",
|
|
62
|
-
"owner": "NixOS",
|
|
63
|
-
"repo": "nixpkgs",
|
|
64
|
-
"rev": "13aff9b34cc32e59d35c62ac9356e4a41198a538",
|
|
65
|
-
"type": "github"
|
|
66
|
-
},
|
|
67
|
-
"original": {
|
|
68
|
-
"owner": "NixOS",
|
|
69
|
-
"ref": "nixos-unstable",
|
|
70
|
-
"repo": "nixpkgs",
|
|
71
|
-
"type": "github"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"nixpkgs-stable": {
|
|
75
|
-
"locked": {
|
|
76
|
-
"lastModified": 1704874635,
|
|
77
|
-
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
|
|
78
|
-
"owner": "NixOS",
|
|
79
|
-
"repo": "nixpkgs",
|
|
80
|
-
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
|
|
81
|
-
"type": "github"
|
|
82
|
-
},
|
|
83
|
-
"original": {
|
|
84
|
-
"owner": "NixOS",
|
|
85
|
-
"ref": "nixos-23.11",
|
|
86
|
-
"repo": "nixpkgs",
|
|
87
|
-
"type": "github"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"pre-commit-hooks": {
|
|
91
|
-
"inputs": {
|
|
92
|
-
"flake-compat": "flake-compat",
|
|
93
|
-
"flake-utils": [
|
|
94
|
-
"flake-utils"
|
|
95
|
-
],
|
|
96
|
-
"gitignore": "gitignore",
|
|
97
|
-
"nixpkgs": [
|
|
98
|
-
"nixpkgs"
|
|
99
|
-
],
|
|
100
|
-
"nixpkgs-stable": "nixpkgs-stable"
|
|
101
|
-
},
|
|
102
|
-
"locked": {
|
|
103
|
-
"lastModified": 1708018599,
|
|
104
|
-
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=",
|
|
105
|
-
"owner": "cachix",
|
|
106
|
-
"repo": "pre-commit-hooks.nix",
|
|
107
|
-
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431",
|
|
108
|
-
"type": "github"
|
|
109
|
-
},
|
|
110
|
-
"original": {
|
|
111
|
-
"owner": "cachix",
|
|
112
|
-
"repo": "pre-commit-hooks.nix",
|
|
113
|
-
"type": "github"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"root": {
|
|
117
|
-
"inputs": {
|
|
118
|
-
"flake-utils": "flake-utils",
|
|
119
|
-
"nixpkgs": "nixpkgs",
|
|
120
|
-
"pre-commit-hooks": "pre-commit-hooks"
|
|
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
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
"root": "root",
|
|
140
|
-
"version": 7
|
|
141
|
-
}
|
package/flake.nix
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
inputs = {
|
|
3
|
-
flake-utils.url = "github:numtide/flake-utils";
|
|
4
|
-
nixpkgs = {
|
|
5
|
-
url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
6
|
-
};
|
|
7
|
-
pre-commit-hooks = {
|
|
8
|
-
url = "github:cachix/pre-commit-hooks.nix";
|
|
9
|
-
inputs = {
|
|
10
|
-
flake-utils.follows = "flake-utils";
|
|
11
|
-
nixpkgs.follows = "nixpkgs";
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
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
|
-
};
|
|
60
|
-
|
|
61
|
-
alejandra.enable = true;
|
|
62
|
-
|
|
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
|
-
};
|
|
69
|
-
|
|
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;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
|
|
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
|
-
cargo
|
|
88
|
-
];
|
|
89
|
-
|
|
90
|
-
inherit (checks.pre-commit) shellHook;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
packages = {
|
|
95
|
-
default = packages.tree-sitter-beancount;
|
|
96
|
-
|
|
97
|
-
tree-sitter-beancount = pkgs.callPackage (nixpkgs + "/pkgs/development/tools/parsing/tree-sitter/grammar.nix") {} {
|
|
98
|
-
language = "beancount";
|
|
99
|
-
src = ./.;
|
|
100
|
-
inherit (pkgs.tree-sitter) version;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
inherit (pkgs) tree-sitter;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
// {
|
|
108
|
-
overlays = {
|
|
109
|
-
default = final: prev: {
|
|
110
|
-
tree-sitter = prev.tree-sitter.override {
|
|
111
|
-
extraGrammars = {
|
|
112
|
-
tree-sitter-beancount = {
|
|
113
|
-
src = ./.;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
}
|