Skip to content

Commit c01f5d5

Browse files
Add new grammars and improve demo
- Add PHP, XML, AWK, Batch, JQ, VB.NET, and F# grammars - Restructure PHP and XML from monorepo to flat structure - Fix AWK scanner (remove debug printf incompatible with wasm-sysroot) - Fix F# scanner (inline common/scanner.h) - Improve demo: merge source/output panels, add gzip compression - Switch from zopfli to flate2 for faster gzip compression - Run xtask in release mode
1 parent 814bf11 commit c01f5d5

File tree

116 files changed

+1486686
-204903
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1486686
-204903
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[alias]
2-
xtask = "run --package xtask --"
2+
xtask = "run --release --package xtask --"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ node_modules/
3232
/tree-sitter-zig/
3333
/tree-sitter/
3434
/wasm-sysroot/
35+
36+
# Pre-compressed demo files
37+
demo/*.br
38+
demo/*.gz

Cargo.lock

Lines changed: 128 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ members = [
55
"crates/arborium-ada",
66
"crates/arborium-agda",
77
"crates/arborium-asm",
8+
"crates/arborium-awk",
89
"crates/arborium-bash",
10+
"crates/arborium-batch",
911
"crates/arborium-c",
1012
"crates/arborium-c-sharp",
1113
"crates/arborium-caddy",
@@ -26,6 +28,7 @@ members = [
2628
"crates/arborium-elm",
2729
"crates/arborium-erlang",
2830
"crates/arborium-fish",
31+
"crates/arborium-fsharp",
2932
"crates/arborium-gleam",
3033
"crates/arborium-glsl",
3134
"crates/arborium-go",
@@ -40,6 +43,7 @@ members = [
4043
"crates/arborium-java",
4144
"crates/arborium-javascript",
4245
"crates/arborium-jinja2",
46+
"crates/arborium-jq",
4347
"crates/arborium-json",
4448
"crates/arborium-julia",
4549
"crates/arborium-kdl",
@@ -52,6 +56,7 @@ members = [
5256
"crates/arborium-nix",
5357
"crates/arborium-objc",
5458
"crates/arborium-perl",
59+
"crates/arborium-php",
5560
"crates/arborium-python",
5661
"crates/arborium-query",
5762
"crates/arborium-r",
@@ -70,10 +75,12 @@ members = [
7075
"crates/arborium-toml",
7176
"crates/arborium-typst",
7277
"crates/arborium-uiua",
78+
"crates/arborium-vb",
7379
"crates/arborium-verilog",
7480
"crates/arborium-vim",
7581
"crates/arborium-vue",
7682
"crates/arborium-x86asm",
83+
"crates/arborium-xml",
7784
"crates/arborium-yaml",
7885
"crates/arborium-zig",
7986
"crates/arborium-zsh",
@@ -89,3 +96,11 @@ version = "0.1.0"
8996
edition = "2024"
9097
license = "MIT OR Apache-2.0"
9198
repository = "https://github.com/bearcove/arborium"
99+
100+
# Optimize for size in release builds (especially important for WASM)
101+
[profile.release]
102+
opt-level = "z"
103+
lto = true
104+
codegen-units = 1
105+
panic = "abort"
106+
strip = true

GRAMMARS.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ repo = "https://github.com/elm-tooling/tree-sitter-elm"
6464
commit = "d0bec479c0422ed5eb01467790bd3912142fe987"
6565
license = "MIT"
6666

67+
[fsharp]
68+
repo = "https://github.com/ionide/tree-sitter-fsharp"
69+
commit = "5141851c278a99958469eb1736c7afc4ec738e47"
70+
license = "MIT"
71+
# Note: This grammar has a subdirectory structure - using fsharp subdirectory
72+
6773
[gleam]
6874
repo = "https://github.com/gleam-lang/tree-sitter-gleam"
6975
commit = "f4d55f3c5b690d4afe8853da892bc290d96deb34"
@@ -286,3 +292,33 @@ license = "MIT"
286292
repo = "https://github.com/tree-sitter-grammars/tree-sitter-capnp"
287293
commit = "7b0883c03e5edd34ef7bcf703194204299d7099f"
288294
license = "MIT"
295+
296+
[php]
297+
repo = "https://github.com/tree-sitter/tree-sitter-php"
298+
commit = "7d07b41ce2d442ca9a90ed85d0075eccc17ae315"
299+
license = "MIT"
300+
301+
[xml]
302+
repo = "https://github.com/tree-sitter-grammars/tree-sitter-xml"
303+
commit = "863dbc381f44f6c136a399e684383b977bb2beaa"
304+
license = "MIT"
305+
306+
[awk]
307+
repo = "https://github.com/Beaglefoot/tree-sitter-awk"
308+
commit = "34bbdc7cce8e803096f47b625979e34c1be38127"
309+
license = "MIT"
310+
311+
[batch]
312+
repo = "https://github.com/davidevofficial/tree-sitter-batch"
313+
commit = "737a031b42240bf61bf7ea5e4356d4e0580dd6d9"
314+
license = "MIT"
315+
316+
[jq]
317+
repo = "https://github.com/flurie/tree-sitter-jq"
318+
commit = "c204e36d2c3c6fce1f57950b12cabcc24e5cc4d9"
319+
license = "MIT"
320+
321+
[vb]
322+
repo = "https://github.com/CodeAnt-AI/tree-sitter-vb-dotnet"
323+
commit = "cfca210ce8fdcb5245bd9cd5c47ce0a21a8488d5"
324+
license = "MIT"

crates/arborium-awk/Cargo.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "arborium-awk"
3+
version = "0.1.0"
4+
edition = "2024"
5+
description = "awk grammar for arborium (tree-sitter bindings)"
6+
license = "MIT"
7+
repository = "https://github.com/bearcove/arborium"
8+
keywords = ["tree-sitter", "awk", "syntax-highlighting"]
9+
categories = ["parsing", "text-processing"]
10+
11+
[lib]
12+
path = "src/lib.rs"
13+
14+
[dependencies]
15+
tree-sitter-patched-arborium = { version = "0.25.10", path = "../../tree-sitter" }
16+
arborium = { version = "0.1.0", path = "../arborium" }
17+
18+
[build-dependencies]
19+
cc = { version = "1", features = ["parallel"] }

crates/arborium-awk/build.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
fn main() {
2+
let src_dir = "../../tree-sitter-awk/src";
3+
4+
println!("cargo:rerun-if-changed={}/parser.c", src_dir);
5+
println!("cargo:rerun-if-changed={}/scanner.c", src_dir);
6+
7+
let mut build = cc::Build::new();
8+
9+
build
10+
.include(src_dir)
11+
.include(format!("{}/tree_sitter", src_dir))
12+
.warnings(false)
13+
.flag_if_supported("-Wno-unused-parameter")
14+
.flag_if_supported("-Wno-unused-but-set-variable")
15+
.flag_if_supported("-Wno-trigraphs");
16+
17+
// For WASM builds, use our custom sysroot (provided by arborium crate via links = "arborium")
18+
if let Ok(sysroot) = std::env::var("DEP_ARBORIUM_WASM_SYSROOT") {
19+
build.include(&sysroot);
20+
}
21+
22+
build.file(format!("{}/parser.c", src_dir));
23+
build.file(format!("{}/scanner.c", src_dir));
24+
25+
build.compile("tree_sitter_awk");
26+
}

0 commit comments

Comments
 (0)