diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/CHANGELOG.md | 8 | ||||
| -rw-r--r-- | core/Output.zig | 2 | ||||
| -rw-r--r-- | core/grammar_manifest.zig | 4 | ||||
| -rw-r--r-- | core/lib_syntax.zig | 2 | ||||
| -rw-r--r-- | core/syntax.zig | 11 |
5 files changed, 15 insertions, 12 deletions
diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index b1875877..813f24e6 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -212,7 +212,7 @@ grammars, highlighting, declarations, syntax tree and themes as the editor has them, for a program that draws source text itself. Every dependency but tree-sitter's runtime is lazy in the manifest, so such a - package fetches the runtime and the grammars of its `tree-sitter` set + package fetches the runtime and the grammars of its `grammars` set and nothing else; `zig build lib-test`, which `unit-test` runs, builds one (`test/lib`). The markdown grammar is pinned by its commit: its branch has moved, and a fresh checkout could not fetch it. @@ -574,7 +574,11 @@ terminal's pardes with no host but the terminal and no filesystem had not compiled for some releases, and nothing ran it. So is `-Dtree-sitter=disabled`, a pardes with no tree-sitter, which did not - compile either: every build has the runtime and the Zig grammar. + compile either; every build has tree-sitter's runtime. The grammar set + is `-Dgrammars` (`.grammars` for a package that depends on pardes, no + longer `.@"tree-sitter"`): `none`, the runtime alone, where a program + hands in a grammar of its own at run time, `minimal` or `full`; the + `zig` set, which `none` replaces, is gone. ## 0.24 diff --git a/core/Output.zig b/core/Output.zig index 759bada9..c7bfde14 100644 --- a/core/Output.zig +++ b/core/Output.zig @@ -907,7 +907,7 @@ pub fn openBuild(p: *Pardes, id: usize) !void { @tagName(builtin.abi), @tagName(build_options.platform), }); try w.print("grammars {s}\naddons {s}\nsemantics {x:0>16}\n\ndependencies\n{s}", .{ - if (build_options.grammars == .full) "full" else if (build_options.grammars == .minimal) "minimal" else "none", + @tagName(build_options.grammars), if (build_options.builtin_addons) "compiled in" else "loaded from <prefix>/lib/pardes/addons", @import("wire").semantics, build_info.deps, diff --git a/core/grammar_manifest.zig b/core/grammar_manifest.zig index 711c31a4..b4ff30b9 100644 --- a/core/grammar_manifest.zig +++ b/core/grammar_manifest.zig @@ -5,7 +5,7 @@ const std = @import("std"); -pub const Tier = enum { zig, minimal, full }; +pub const Tier = enum { minimal, full }; pub const Grammar = struct { name: []const u8, @@ -58,7 +58,7 @@ pub const all = [_]Grammar{ \\"#" @keyword \\ }, - .{ .name = "zig", .dep = "ts_zig", .exts = &.{ ".zig", ".zon" }, .tier = .zig }, + .{ .name = "zig", .dep = "ts_zig", .exts = &.{ ".zig", ".zon" }, .tier = .minimal }, }; /// The names a language goes by besides its grammar's: a fence's `py`, diff --git a/core/lib_syntax.zig b/core/lib_syntax.zig index a25af884..f10f88a5 100644 --- a/core/lib_syntax.zig +++ b/core/lib_syntax.zig @@ -15,7 +15,7 @@ const colors = @import("colors.zig"); const modal = @import("modal.zig"); /// Every grammar pardes knows (`all`), by name or alias (`byName`) and by -/// path (`byPath`). The build's `tree-sitter` option says which of them are +/// path (`byPath`). The build's `grammars` option says which of them are /// compiled in, and `supportsPath` answers for this build. pub const grammars = @import("grammar_manifest.zig"); pub const supportsPath = syntax.supportsPath; diff --git a/core/syntax.zig b/core/syntax.zig index 1147b6b9..19831ec2 100644 --- a/core/syntax.zig +++ b/core/syntax.zig @@ -7,7 +7,7 @@ const regexp = @import("regexp.zig"); const c_heap = @import("c_heap"); const diff = @import("diff.zig"); -const minimal_grammars = config.grammars == .minimal or config.grammars == .full; +const minimal_grammars = config.grammars != .none; const full_grammars = config.grammars == .full; pub const ts = @import("tree-sitter"); @@ -37,7 +37,6 @@ const Spec = struct { fn grammarSelected(comptime g: grammar_manifest.Grammar) bool { return switch (g.tier) { - .zig => true, .minimal => minimal_grammars, .full => full_grammars, }; @@ -1314,7 +1313,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 and !full_grammars) return; + if (!minimal_grammars) return; 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); @@ -1342,7 +1341,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 and !full_grammars) return; + if (!minimal_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1889,7 +1888,7 @@ test "syntax allocator switching clears default-runtime caches" { } test "syntax location context snapshots retain omitted multiline comment scope" { - if (!minimal_grammars and !full_grammars) return; + if (!minimal_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1934,7 +1933,7 @@ test "syntax declaration locations clear snapshots without muting ordinary conte } test "syntax stacked addresses do not split multiline source groups" { - if (!minimal_grammars and !full_grammars) return; + if (!minimal_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); |
