From 2d2278364b6186c6cdf0f0497b0498431dfe7dd1 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Tue, 21 Dec 2021 05:56:41 +0200 Subject: Initial config --- src/Syntax.zig | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Syntax.zig (limited to 'src/Syntax.zig') diff --git a/src/Syntax.zig b/src/Syntax.zig new file mode 100644 index 0000000..ce3f432 --- /dev/null +++ b/src/Syntax.zig @@ -0,0 +1,28 @@ +pub const makefile = @import("Syntax/makefile.zig"); +pub const zig = @import("Syntax/zig.zig"); + +const std = @import("std"); + +const Syntax = @This(); + +pub const database = [_]Syntax{makefile.syntax, zig.syntax}; + +pub const Flags = struct { + hl_numbers: bool = false, + hl_strings: bool = false, +}; + +name: []const u8, +// TODO: Make these into comptime StringSets, see std.ComptimeStringMap +filematch: []const []const u8, +keywords1: []const []const u8, +keywords2: []const []const u8, +singleline_comment_start: ?[]const u8, +multiline_comment_start: ?[]const u8, +multiline_comment_end: ?[]const u8, +separators: []const u8, +flags: Flags, + +pub fn isSeparator(self: Syntax, char: u8) bool { + return std.ascii.isSpace(char) or std.mem.indexOfScalar(u8, self.separators, char) != null; +} -- cgit v1.2.3