Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
Last active March 3, 2026 03:20
Show Gist options
  • Select an option

  • Save raspberrypisig/c64b737e2a8c64b0b120314ff264c64f to your computer and use it in GitHub Desktop.

Select an option

Save raspberrypisig/c64b737e2a8c64b0b120314ff264c64f to your computer and use it in GitHub Desktop.
filetype: zc
detect:
filename: "\\.zc$"
rules:
# === KEYWORDS (statement color - usually purple/magenta) ===
# All Zen C keywords from the official language reference
- statement: "\\b(alias|async|await|break|catch|comptime|const|continue|def|defer|else|embed|enum|fn|for|goto|guard|if|impl|import|launch|let|loop|match|module|opaque|ref|return|sizeof|static|struct|test|trait|try|union|unless|use|volatile|while|and|or)\\b"
# Additional special keywords
- statement: "\\b(assert|autofree|print|println|eprint|eprintln|guard|unless)\\b"
# === TYPES (cyan/blue) ===
# Primitive types + fixed-width + C interop
- type: "\\b(int|uint|bool|char|string|void|byte|isize|usize|F32|F64|f32|f64|U0|u0|i[0-9]+|u[0-9]+|U[0-9]+)\\b"
- type: "\\b(c_char|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_long_long|c_ulong_long)\\b"
# === ATTRIBUTES (@derive, @cfg, @packed, etc.) ===
- special: "@[a-zA-Z_][a-zA-Z0-9_]*(\\([^)]*\\))?"
# === CONSTANTS ===
- constant: "\\b(true|false|null)\\b"
# === NUMBERS (decimal, hex, octal, binary, float, with _ separators) ===
- constant.number: "\\b(0b[01_]+|0o[0-7_]+|0x[a-fA-F0-9_]+|[0-9][0-9_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?[fF]?\\b)"
# === STRINGS ===
# Normal "..." and interpolated f"..." and raw r"..."
- constant.string:
start: '(f|r)?"'
end: '"'
skip: '\\\\.'
rules:
- constant.specialChar: '\\\\.'
# Multiline """...""" (and f"""...""", r"""...""")
- constant.string:
start: '(f|r)?"""'
end: '"""'
rules: []
# === COMMENTS ===
# // line comment
- comment:
start: "//"
end: "$"
rules:
- todo: "(TODO|FIXME|XXX|NOTE):?"
# /* block comment */
- comment:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|FIXME|XXX|NOTE):?"
# Build directives //> ... (treated as special comments)
- comment:
start: "//>"
end: "$"
rules:
- special: "link:|lib:|include:|framework:|cflags:|define:|pkg-config:|shell:|get:"
# === OPERATORS & PUNCTUATION ===
- symbol.operator: "[-+*/%!=<>|&^~?:;,.]|\\.\\.|\\?\\?|\\?\\.|\\?\\=|\\|>"
- symbol.brackets: "[(){}\\[\\]]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment