X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fsyntax%2Fzig.yaml;h=75861a29794496d797cdb26ed31e728403656605;hb=54c23cae72d7237bc898a59f79aad0acffdf0ffe;hp=c9cb5cd1bc4a8f4c6935d197642395c338d36e42;hpb=24a684cff25cd9f189a943d1dc2a98d3aa6c796f;p=micro.git diff --git a/runtime/syntax/zig.yaml b/runtime/syntax/zig.yaml index c9cb5cd1..75861a29 100644 --- a/runtime/syntax/zig.yaml +++ b/runtime/syntax/zig.yaml @@ -4,34 +4,50 @@ detect: filename: "\\.zig$" rules: - # function definition - - identifier: "fn [a-z0-9_]+" # Reserved words - - statement: "\\b(align|and|allowzero|anyerror|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|false|fn|for|if|inline|nakedcc|noalias|null|or|orelse|packed|promise|pub|resume|return|linksection|stdcallcc|struct|suspend|switch|test|threadlocal|true|try|undefined|union|unreachable|use|var|volatile|while)\\b" + - statement: "\\b(align|allowzero|and|asm|async|await|break|callconv|catch|comptime|const|continue|defer|else|errdefer|error|export|extern|fn|for|if|inline|noalias|noinline|nosuspend|or|orelse|packed|pub|resume|return|linksection|suspend|switch|test|threadlocal|try|unreachable|usingnamespace|var|volatile|while)\\b" # builtin functions - - special: "@+[a-z_]+" - # Constants - - constant: "[A-Z][A-Z_]+([0-9]+)?" - # Numbers (hexadecimal + decimal) - - constant.number: "\\b(0x[A-F0-9]+|[0-9]+)\\b" - # Primitive Types / Derived Data Types - - type: "\\b([A-Z][a-z]+|(i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void|f16|f32|f64|f128|bool|void|noreturn|type|anyerror|comptime_int|comptime_float))\\b" + - special: "@[a-zA-Z_]+" + # Primitive Types + - type: "\\b(anyframe|anytype|anyerror|bool|comptime_int|comptime_float|enum|f(16|32|64|128)|isize|noreturn|struct|type|union|usize|void)\\b" + - type: "\\b(c_u?(short|int|long(long)?)|c_longdouble|c_void)\\b" + - type: "\\b((i|u)[0-9]+)\\b" + + # Operators + - symbol.operator: "[-!|=;%.+^*:&?<>~]" + + # Parenthesis + - symbol.brackets: "[(){}]|\\[|\\]" + + # Constants + - constant: "\\b(null|undefined)\\b" + - constant.number: "\\b(0b[01_]+|0o[0-7_]+|[0-9_]+|0x[a-fA-F0-9_]+)\\b" + - constant.bool: "\\b(true|false)\\b" - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - - constant.specialChar: "\\\\." + - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" - - comment: - start: "//" - end: "$" + - constant.string: + start: "'" + end: "'" + skip: "\\\\." rules: - - todo: "(TODO|XXX|FIXME):?" + - error: "..+" + - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" + - constant.string: + start: "\\\\\\\\" + end: "$" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" + - comment: - start: "/\\*" - end: "\\*/" + start: "//" + end: "$" rules: - todo: "(TODO|XXX|FIXME):?"