summaryrefslogtreecommitdiff
path: root/src/Syntax.zig
blob: f29c7fc77d807d94794201e2df88a184fb2a22d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
}