]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/hc.yaml
added support for HolyC (#2473)
[micro.git] / runtime / syntax / hc.yaml
1 filetype: hc
2
3 detect:
4     filename: "(\\.(hc|HC)$|\\.(hh|HH)$|\\.ii?$|\\.(def)$)"
5
6 rules:
7     - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8     - type: "\\b(F64|I8|U8|I16|U16|I32|U32|I64|U64|sizeof|enum|U0|static|extern|struct|union|class|intern|public|argc|argv|asm)\\b"
9     
10     - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
11     - statement: "\\b(try|catch|throw|goto|continue|break|return)\\b"
12     - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|help_index|ifjit|ifaot|exe)"
13      
14       # Operator Color
15     - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
16     - symbol.brackets: "[(){}]|\\[|\\]"
17       # Integer Constants
18     - constant.number: "(\\b([1-9][0-9]*|0[0-7]*|0[Xx][0-9A-Fa-f]+|0[Bb][01]+)([Uu]?[Ll][Ll]?|[Ll][Ll]?[Uu]?)?\\b)"
19       # Decimal Floating Constants
20     - constant.number: "(\\b(([0-9]*[.][0-9]+|[0-9]+[.][0-9]*)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)[FfLl]?\\b)"
21       # Hexadecimal Floating Constants
22     - constant.number: "(\\b0[Xx]([0-9A-Za-z]*[.][0-9A-Za-z]+|[0-9A-Za-z]+[.][0-9A-Za-z]*)[Pp][+-]?[0-9]+[FfLl]?\\b)"
23     - constant.number: "NULL"
24     - constant.number: "TRUE"
25     - constant.number: "FALSE"
26
27     - constant.string:
28         start: "\""
29         end: "\""
30         skip: "\\\\."
31         rules:
32             - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"
33
34     - constant.string:
35         start: "'"
36         end: "'"
37         skip: "\\\\."
38         rules:
39             - error: "..+"
40             - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"
41
42     - comment:
43         start: "//"
44         end: "$"
45         rules:
46             - todo: "(TODO|XXX|FIXME):?"
47
48     - comment:
49         start: "/\\*"
50         end: "\\*/"
51         rules:
52             - todo: "(TODO|XXX|FIXME):?"