config
git clone https://git.pyrossh.dev/config
Common configuration
helix/grammars/hica.tmLanguage.json
| 46c8ff3 | 1 | { |
| 46c8ff3 | 2 | "name": "Hica", |
| 46c8ff3 | 3 | "scopeName": "source.hica", |
| 46c8ff3 | 4 | "fileTypes": ["hc"], |
| 46c8ff3 | 5 | "patterns": [ |
| 46c8ff3 | 6 | { "include": "#comments" }, |
| 46c8ff3 | 7 | { "include": "#strings" }, |
| 46c8ff3 | 8 | { "include": "#chars" }, |
| 46c8ff3 | 9 | { "include": "#numbers" }, |
| 46c8ff3 | 10 | { "include": "#keywords" }, |
| 46c8ff3 | 11 | { "include": "#functions" }, |
| 46c8ff3 | 12 | { "include": "#types" }, |
| 46c8ff3 | 13 | { "include": "#operators" }, |
| 46c8ff3 | 14 | { "include": "#identifiers" } |
| 46c8ff3 | 15 | ], |
| 46c8ff3 | 16 | "repository": { |
| 46c8ff3 | 17 | "comments": { |
| 46c8ff3 | 18 | "name": "comment.line.double-slash.hica", |
| 46c8ff3 | 19 | "match": "//.*$" |
| 46c8ff3 | 20 | }, |
| 46c8ff3 | 21 | "strings": { |
| 46c8ff3 | 22 | "name": "string.quoted.double.hica", |
| 46c8ff3 | 23 | "begin": "\"", |
| 46c8ff3 | 24 | "end": "\"", |
| 46c8ff3 | 25 | "patterns": [ |
| 46c8ff3 | 26 | { |
| 46c8ff3 | 27 | "name": "constant.character.escape.hica", |
| 46c8ff3 | 28 | "match": "\\\\[ntr\\\\\"'{}$]" |
| 46c8ff3 | 29 | }, |
| 46c8ff3 | 30 | { |
| 46c8ff3 | 31 | "name": "string.interpolation.hica", |
| 46c8ff3 | 32 | "begin": "\\$\\{", |
| 46c8ff3 | 33 | "beginCaptures": { |
| 46c8ff3 | 34 | "0": { "name": "punctuation.definition.interpolation.begin.hica" } |
| 46c8ff3 | 35 | }, |
| 46c8ff3 | 36 | "end": "\\}", |
| 46c8ff3 | 37 | "endCaptures": { |
| 46c8ff3 | 38 | "0": { "name": "punctuation.definition.interpolation.end.hica" } |
| 46c8ff3 | 39 | }, |
| 46c8ff3 | 40 | "patterns": [ |
| 46c8ff3 | 41 | { "include": "#strings" }, |
| 46c8ff3 | 42 | { "include": "#keywords" }, |
| 46c8ff3 | 43 | { "include": "#types" }, |
| 46c8ff3 | 44 | { "include": "#numbers" }, |
| 46c8ff3 | 45 | { "include": "#operators" }, |
| 46c8ff3 | 46 | { "include": "#identifiers" } |
| 46c8ff3 | 47 | ] |
| 46c8ff3 | 48 | } |
| 46c8ff3 | 49 | ] |
| 46c8ff3 | 50 | }, |
| 46c8ff3 | 51 | "chars": { |
| 46c8ff3 | 52 | "name": "string.quoted.single.hica", |
| 46c8ff3 | 53 | "match": "'[^']'" |
| 46c8ff3 | 54 | }, |
| 46c8ff3 | 55 | "numbers": { |
| 46c8ff3 | 56 | "patterns": [ |
| 46c8ff3 | 57 | { "name": "constant.numeric.float.hica", "match": "\\b[0-9]+\\.[0-9]+\\b" }, |
| 46c8ff3 | 58 | { "name": "constant.numeric.integer.hex.hica", "match": "\\b0x[0-9a-fA-F]+\\b" }, |
| 46c8ff3 | 59 | { "name": "constant.numeric.integer.binary.hica", "match": "\\b0b[01]+\\b" }, |
| 46c8ff3 | 60 | { "name": "constant.numeric.integer.hica", "match": "\\b[0-9]+\\b" } |
| 46c8ff3 | 61 | ] |
| 46c8ff3 | 62 | }, |
| 46c8ff3 | 63 | "keywords": { |
| 46c8ff3 | 64 | "patterns": [ |
| 46c8ff3 | 65 | { "name": "keyword.control.hica", "match": "\\b(if|else|match|while|loop|for|in|break|continue|return)\\b" }, |
| 46c8ff3 | 66 | { "name": "keyword.declaration.hica", "match": "\\b(let|var|fun|struct|trait|class|primitive|lib|import|from|pub|extern|out)\\b" }, |
| 46c8ff3 | 67 | { "name": "keyword.declaration.hica", "match": "\\bself\\b" }, |
| 46c8ff3 | 68 | { "name": "constant.language.hica", "match": "\\b(true|false|None|Some|Ok|Err)\\b" } |
| 46c8ff3 | 69 | ] |
| 46c8ff3 | 70 | }, |
| 46c8ff3 | 71 | "functions": { |
| 46c8ff3 | 72 | "patterns": [ |
| 46c8ff3 | 73 | { |
| 46c8ff3 | 74 | "name": "entity.name.function.hica", |
| 46c8ff3 | 75 | "comment": "Function name in definition: fun name(", |
| 46c8ff3 | 76 | "match": "(?<=\\bfun\\s+)[a-z_][a-zA-Z0-9_]*(?=\\s*\\(|\\s*<)" |
| 46c8ff3 | 77 | }, |
| 46c8ff3 | 78 | { |
| 46c8ff3 | 79 | "name": "entity.name.function.hica", |
| 46c8ff3 | 80 | "comment": "Function call: name(", |
| 46c8ff3 | 81 | "match": "\\b[a-z_][a-zA-Z0-9_]*(?=\\s*\\()" |
| 46c8ff3 | 82 | } |
| 46c8ff3 | 83 | ] |
| 46c8ff3 | 84 | }, |
| 46c8ff3 | 85 | "types": { |
| 46c8ff3 | 86 | "name": "support.type.hica", |
| 46c8ff3 | 87 | "match": "\\b(Int|Float|Bool|Char|CStr|String|ptr|int|float|bool|char|string|cstr)\\b" |
| 46c8ff3 | 88 | }, |
| 46c8ff3 | 89 | "operators": { |
| 46c8ff3 | 90 | "name": "keyword.operator.hica", |
| 46c8ff3 | 91 | "match": "(\\+|-|\\*|/|%|==|!=|<|>|<=|>=|&&|\\|\\||!|\\|>|=|=>|\\.\\.=?|\\?|::|\\.\\.\\.)" |
| 46c8ff3 | 92 | }, |
| 46c8ff3 | 93 | "identifiers": { |
| 46c8ff3 | 94 | "patterns": [ |
| 46c8ff3 | 95 | { |
| 46c8ff3 | 96 | "name": "entity.name.type.hica", |
| 46c8ff3 | 97 | "comment": "Uppercase-starting identifiers are types/constructors", |
| 46c8ff3 | 98 | "match": "\\b[A-Z][a-zA-Z0-9_]*\\b" |
| 46c8ff3 | 99 | }, |
| 46c8ff3 | 100 | { |
| 46c8ff3 | 101 | "name": "variable.other.hica", |
| 46c8ff3 | 102 | "match": "\\b[a-z_][a-zA-Z0-9_]*\\b" |
| 46c8ff3 | 103 | } |
| 46c8ff3 | 104 | ] |
| 46c8ff3 | 105 | } |
| 46c8ff3 | 106 | } |
| 46c8ff3 | 107 | } |