termi 0.1.6

A modal terminal code editor written in Rust
//! Zig language definition.
//!
//! Zig has no block comments at all, so `block_comment` is `None` and the engine
//! never has to carry state between lines for a Zig buffer. Builtins (`@import`,
//! `@intCast`) get their own rule because `@` is otherwise an operator.

use crate::syntax::{HighlightKind, Language};

/// Zig.
pub static ZIG: Language = Language {
    name: "zig",
    extensions: &["zig", "zon"],
    filenames: &[],
    keywords: &[
        "align",
        "allowzero",
        "and",
        "anyframe",
        "anytype",
        "asm",
        "async",
        "await",
        "break",
        "callconv",
        "catch",
        "comptime",
        "const",
        "continue",
        "defer",
        "else",
        "enum",
        "errdefer",
        "error",
        "export",
        "extern",
        "fn",
        "for",
        "if",
        "inline",
        "linksection",
        "noalias",
        "noinline",
        "nosuspend",
        "opaque",
        "or",
        "orelse",
        "packed",
        "pub",
        "resume",
        "return",
        "struct",
        "suspend",
        "switch",
        "test",
        "threadlocal",
        "try",
        "union",
        "unreachable",
        "usingnamespace",
        "var",
        "volatile",
        "while",
    ],
    types: &[
        "anyerror",
        "anyopaque",
        "bool",
        "c_char",
        "c_int",
        "c_long",
        "c_longdouble",
        "c_longlong",
        "c_short",
        "c_uint",
        "c_ulong",
        "c_ulonglong",
        "c_ushort",
        "comptime_float",
        "comptime_int",
        "f16",
        "f32",
        "f64",
        "f80",
        "f128",
        "i8",
        "i16",
        "i32",
        "i64",
        "i128",
        "isize",
        "noreturn",
        "type",
        "u8",
        "u16",
        "u32",
        "u64",
        "u128",
        "usize",
        "void",
    ],
    constants: &["true", "false", "null", "undefined"],
    line_comment: Some("//"),
    block_comment: None,
    nested_block_comments: false,
    macro_suffix: false,
    capitalised_types: true,
    extra_rules: &[
        (r"///.*", HighlightKind::Comment),
        (r"@[A-Za-z_]\w*", HighlightKind::Macro),
        // Multiline string literals are line-scoped in Zig, which suits a
        // per-line scanner exactly.
        (r"\\\\.*", HighlightKind::String),
    ],
    prose: false,
};