diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 19:02:34 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 19:02:34 -0300 |
| commit | 486f347adeed5bac6aaabe8be34e6a69bf323a62 (patch) | |
| tree | da8b333b4033889aa2fd16ab7f5a4bef35b0401d /core/syntax.zig | |
| parent | 4053e62a2aabd794db9075d93ebe57eec3f432a6 (diff) | |
| parent | 06f6c72583faf8256190a0ae195a8085e7cd7f32 (diff) | |
| download | pardes-486f347adeed5bac6aaabe8be34e6a69bf323a62.tar.gz pardes-486f347adeed5bac6aaabe8be34e6a69bf323a62.zip | |
integration: six small faults on a hang-up as a close: pardes-faults-6 (a hang-up with no daemon kills the language servers' children; the daemon's reader hands a note under a lock; a retried Edit write answered from the listener's hold; the cursor hidden when a frame has no caret; syntax-test deleted and the grammar tiers' tests skipping; the tty harness's Esc after what came before is read) and pardes-merge41, merged without a textual conflict; tui core-test 874/1031 (157 skipped), shell-test 1073/1076, term-test 17/17, both soaks diverged 0, unequal 0, unlisted 0, the window builds; the coordinator's gate in the ledger (reorg/merge42)
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/syntax.zig')
| -rw-r--r-- | core/syntax.zig | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/core/syntax.zig b/core/syntax.zig index 19831ec2..00ee497f 100644 --- a/core/syntax.zig +++ b/core/syntax.zig @@ -7,8 +7,10 @@ const regexp = @import("regexp.zig"); const c_heap = @import("c_heap"); const diff = @import("diff.zig"); -const minimal_grammars = config.grammars != .none; -const full_grammars = config.grammars == .full; +/// The grammar sets built (`-Dgrammars`): a test that needs a grammar +/// not built skips. +pub const minimal_grammars = config.grammars != .none; +pub const full_grammars = config.grammars == .full; pub const ts = @import("tree-sitter"); const ts_queries = @import("ts_queries"); @@ -1260,6 +1262,7 @@ test "every vendored textobject and indent query compiles against its grammar" { } test "syntax context nested Zig containers and multiline function signatures" { + if (comptime !minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1291,7 +1294,7 @@ test "syntax context nested Zig containers and multiline function signatures" { } test "syntax context Python class and function body excludes first statement" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1304,6 +1307,7 @@ test "syntax context Python class and function body excludes first statement" { } test "syntax context multiline bindings and C++ namespaces preserve declaration starts" { + if (comptime !minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1313,7 +1317,7 @@ test "syntax context multiline bindings and C++ namespaces preserve declaration try std.testing.expectEqual(@as(usize, 1), zig_declarations.len); try std.testing.expectEqual(@as(usize, 0), zig_declarations[0].start_line); try std.testing.expectEqual(@as(usize, 1), zig_declarations[0].header_end_line); - if (!minimal_grammars) return; + if (!minimal_grammars) return error.SkipZigTest; const cpp_source = "namespace example {\nstruct Outer {\n int run() {\n return 1;\n }\n};\n}\n"; const cpp_declarations = try contextDeclarations(gpa, "nested.cpp", cpp_source); defer gpa.free(cpp_declarations); @@ -1325,7 +1329,7 @@ test "syntax context multiline bindings and C++ namespaces preserve declaration } test "syntax context Rust modules impls and methods remain nested" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1341,7 +1345,7 @@ test "syntax context Rust modules impls and methods remain nested" { } test "syntax formatted locations color hidden context and preserve multiline source" { - if (!minimal_grammars) return; + if (!minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1366,7 +1370,7 @@ test "syntax formatted locations color hidden context and preserve multiline sou } test "syntax formatted locations separate alignment from Markdown indentation" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1382,6 +1386,7 @@ test "syntax formatted locations separate alignment from Markdown indentation" { } test "syntax a results row is coloured by the file its location names" { + if (comptime !minimal_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); const gpa = std.testing.allocator; @@ -1431,7 +1436,7 @@ test "syntax codeAfterLocation takes whole-token locations and nothing else" { } test "syntax default full grammar set highlights Typst source" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); @@ -1454,7 +1459,7 @@ test "syntax default full grammar set highlights Typst source" { } test "syntax Typst markup constructs paint and raw blocks inject their language" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); @@ -1498,7 +1503,7 @@ test "syntax Typst markup constructs paint and raw blocks inject their language" } test "syntax markdown highlights markup, injects inline spans and fenced code blocks" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); @@ -1530,7 +1535,7 @@ test "syntax markdown highlights markup, injects inline spans and fenced code bl } test "syntax inline fast path agrees with full Markdown query" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); const selected = (try forLang("markdown_inline")).?; @@ -1577,7 +1582,7 @@ test "syntax inline fast path agrees with full Markdown query" { } test "syntax plain Markdown keeps block styles without starting the inline parser" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); const source = "# Heading\n\nPlain prose.\n\n indented code\n"; @@ -1619,6 +1624,7 @@ test "syntax highlightDiff colors unified diff lines by prefix" { } test "syntax a Zig hunk is coloured as Zig, each side parsed whole" { + if (comptime !minimal_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); const diff_text = @@ -1659,7 +1665,7 @@ test "syntax a Zig hunk is coloured as Zig, each side parsed whole" { } test "syntax a Python hunk is coloured as Python" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); const diff_text = @@ -1680,6 +1686,7 @@ test "syntax a Python hunk is coloured as Python" { } test "syntax a deleted file's lines are coloured in its language" { + if (comptime !minimal_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); const diff_text = @@ -1715,6 +1722,7 @@ test "syntax a hunk in no known language keeps the line colours" { } test "syntax git diff output in a command pane is told and coloured by its rows" { + if (comptime !minimal_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); // A command pane's rows: its command line, then git's output, with one @@ -1747,6 +1755,7 @@ test "syntax git diff output in a command pane is told and coloured by its rows" } test "syntax a section's small hunks share one parse" { + if (comptime !minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1768,6 +1777,7 @@ test "syntax a section's small hunks share one parse" { } test "syntax a hunk painted once is kept, and a long one is parsed in pieces" { + if (comptime !minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1856,6 +1866,7 @@ test "syntax query filtering preserves upstream colors" { } test "syntax Zig keyword captures cover both bytes beyond line ten thousand" { + if (comptime !minimal_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); const code = "pub fn main() void {\n if (true) return;\n}\n"; @@ -1873,6 +1884,7 @@ test "syntax Zig keyword captures cover both bytes beyond line ten thousand" { } test "syntax allocator switching clears default-runtime caches" { + if (comptime !minimal_grammars) return error.SkipZigTest; const source = "fn main() void {}"; const initial = try highlightFileRange(std.testing.allocator, "a.zig", source, 0, source.len); std.testing.allocator.free(initial); @@ -1888,7 +1900,7 @@ test "syntax allocator switching clears default-runtime caches" { } test "syntax location context snapshots retain omitted multiline comment scope" { - if (!minimal_grammars) return; + if (!minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1914,6 +1926,7 @@ test "syntax location context snapshots retain omitted multiline comment scope" } test "syntax declaration locations clear snapshots without muting ordinary context" { + if (comptime !minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1933,7 +1946,7 @@ test "syntax declaration locations clear snapshots without muting ordinary conte } test "syntax stacked addresses do not split multiline source groups" { - if (!minimal_grammars) return; + if (!minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -2018,7 +2031,7 @@ test "syntax source analysis preserves declarations and injected colors" { } test "tables are the pipe_tables tree-sitter finds" { - if (!full_grammars) return; + if (!full_grammars) return error.SkipZigTest; start(std.testing.allocator); defer stop(); const Tables = @import("Tables.zig"); @@ -2087,6 +2100,7 @@ test "tables are the pipe_tables tree-sitter finds" { } test "a kept tree told its edits parses to the fresh parse's tree, places and all" { + if (comptime !minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; const a = "const std = @import(\"std\");\n\nfn f(x: u32) u32 {\n return x;\n}\n\ntest \"t\" {\n _ = f(1);\n}\n"; const old_tree = parseTree("a.zig", a, null) orelse return error.NoTree; @@ -2126,6 +2140,7 @@ test "a kept tree told its edits parses to the fresh parse's tree, places and al } test "syntax: a grammar handed in at run time colours and walks as the one compiled in" { + if (comptime !minimal_grammars) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); |
