Add sublime syntax files
461ef29eb47e1d29738cc48b872ca358f1b279a67326f3c354bcb7fe7ddb8e80
1 parent
0a1ec566
sublime/radiance.sublime-syntax
added
+113 -0
| 1 | + | %YAML 1.2 |
|
| 2 | + | --- |
|
| 3 | + | name: Radiance |
|
| 4 | + | file_extensions: |
|
| 5 | + | - rad |
|
| 6 | + | scope: source.radiance |
|
| 7 | + | ||
| 8 | + | variables: |
|
| 9 | + | ident: '[A-Za-z_][A-Za-z0-9_]*' |
|
| 10 | + | keywords: '\b(?:align|and|as|assert|break|case|catch|constant|continue|else|export|fn|for|if|in|instance|let|log|loop|match|mod|mut|not|or|panic|record|return|set|static|super|throw|throws|trait|try|union|use|while)\b' |
|
| 11 | + | constants: '\b(?:false|nil|true|undefined)\b' |
|
| 12 | + | types: '\b(?:bit|bool|f32|i8|i16|i32|i64|opaque|u8|u16|u32|u64|void)\b' |
|
| 13 | + | ||
| 14 | + | contexts: |
|
| 15 | + | main: |
|
| 16 | + | - include: comments |
|
| 17 | + | - include: strings |
|
| 18 | + | - include: builtins |
|
| 19 | + | - include: namespaces |
|
| 20 | + | - include: keywords |
|
| 21 | + | - include: functions |
|
| 22 | + | - include: numbers |
|
| 23 | + | - include: operators |
|
| 24 | + | - include: punctuation |
|
| 25 | + | ||
| 26 | + | comments: |
|
| 27 | + | - match: '//' |
|
| 28 | + | scope: punctuation.definition.comment.radiance |
|
| 29 | + | push: lineComment |
|
| 30 | + | - match: '--' |
|
| 31 | + | scope: punctuation.definition.comment.radiance |
|
| 32 | + | push: lineComment |
|
| 33 | + | ||
| 34 | + | lineComment: |
|
| 35 | + | - meta_scope: comment.line.radiance |
|
| 36 | + | - match: '\b(?:TODO|FIXME)\b' |
|
| 37 | + | scope: keyword.other.todo.radiance |
|
| 38 | + | - match: '$' |
|
| 39 | + | pop: true |
|
| 40 | + | ||
| 41 | + | strings: |
|
| 42 | + | - match: '"' |
|
| 43 | + | scope: punctuation.definition.string.begin.radiance |
|
| 44 | + | push: doubleQuotedString |
|
| 45 | + | - match: "'" |
|
| 46 | + | scope: punctuation.definition.string.begin.radiance |
|
| 47 | + | push: character |
|
| 48 | + | ||
| 49 | + | doubleQuotedString: |
|
| 50 | + | - meta_scope: string.quoted.double.radiance |
|
| 51 | + | - match: '\\["''nrtvfab\\]' |
|
| 52 | + | scope: constant.character.escape.radiance |
|
| 53 | + | - match: '\\.' |
|
| 54 | + | scope: invalid.illegal.escape.radiance |
|
| 55 | + | - match: '"' |
|
| 56 | + | scope: punctuation.definition.string.end.radiance |
|
| 57 | + | pop: true |
|
| 58 | + | ||
| 59 | + | character: |
|
| 60 | + | - meta_scope: string.quoted.single.radiance |
|
| 61 | + | - match: '\\["''nrtvfab\\]' |
|
| 62 | + | scope: constant.character.escape.radiance |
|
| 63 | + | - match: '\\.' |
|
| 64 | + | scope: invalid.illegal.escape.radiance |
|
| 65 | + | - match: "'" |
|
| 66 | + | scope: punctuation.definition.string.end.radiance |
|
| 67 | + | pop: true |
|
| 68 | + | ||
| 69 | + | builtins: |
|
| 70 | + | - match: '@{{ident}}' |
|
| 71 | + | scope: support.function.builtin.radiance |
|
| 72 | + | ||
| 73 | + | namespaces: |
|
| 74 | + | - match: '\b{{ident}}\b(?=\s*::)' |
|
| 75 | + | scope: entity.name.namespace.radiance |
|
| 76 | + | - match: '::' |
|
| 77 | + | scope: punctuation.accessor.double-colon.radiance |
|
| 78 | + | ||
| 79 | + | functions: |
|
| 80 | + | - match: '\b{{ident}}\b(?=\s*\??\()' |
|
| 81 | + | scope: entity.name.function.radiance |
|
| 82 | + | ||
| 83 | + | keywords: |
|
| 84 | + | - match: '{{types}}' |
|
| 85 | + | scope: storage.type.radiance |
|
| 86 | + | - match: '{{constants}}' |
|
| 87 | + | scope: constant.language.radiance |
|
| 88 | + | - match: '{{keywords}}' |
|
| 89 | + | scope: keyword.control.radiance |
|
| 90 | + | - match: '\b_\b' |
|
| 91 | + | scope: constant.language.placeholder.radiance |
|
| 92 | + | ||
| 93 | + | numbers: |
|
| 94 | + | - match: '(?<![A-Za-z0-9_])[+-]?0[xX][0-9A-Fa-f]+' |
|
| 95 | + | scope: constant.numeric.integer.hexadecimal.radiance |
|
| 96 | + | - match: '(?<![A-Za-z0-9_])[+-]?0[bB][01]+' |
|
| 97 | + | scope: constant.numeric.integer.binary.radiance |
|
| 98 | + | - match: '(?<![A-Za-z0-9_])[+-]?(?:[0-9]+\.[0-9]+|[0-9]+)' |
|
| 99 | + | scope: constant.numeric.radiance |
|
| 100 | + | ||
| 101 | + | operators: |
|
| 102 | + | - match: '=>|->|\.\.|<<=|>>=|==|<>|<=|>=|\+=|-=|\*=|/=|%=|&=|\|=|\^=|<<|>>|[.!?~&|^%+\-*/=<>:]' |
|
| 103 | + | scope: keyword.operator.radiance |
|
| 104 | + | ||
| 105 | + | punctuation: |
|
| 106 | + | - match: '[{}]' |
|
| 107 | + | scope: punctuation.section.block.radiance |
|
| 108 | + | - match: '[()]' |
|
| 109 | + | scope: punctuation.section.group.radiance |
|
| 110 | + | - match: '[\[\]]' |
|
| 111 | + | scope: punctuation.section.brackets.radiance |
|
| 112 | + | - match: '[,;]' |
|
| 113 | + | scope: punctuation.separator.radiance |
sublime/ril.sublime-syntax
added
+102 -0
| 1 | + | %YAML 1.2 |
|
| 2 | + | --- |
|
| 3 | + | name: Radiance IL |
|
| 4 | + | file_extensions: |
|
| 5 | + | - ril |
|
| 6 | + | scope: source.ril |
|
| 7 | + | ||
| 8 | + | variables: |
|
| 9 | + | label: '[A-Za-z_][A-Za-z0-9_#.]*' |
|
| 10 | + | symbol: '[A-Za-z_][$A-Za-z0-9_]*' |
|
| 11 | + | keywords: '\b(?:align|data|extern|fn|mut)\b' |
|
| 12 | + | instructions: '\b(?:add|and|blit|call|copy|ebreak|ecall|eq|jmp|load|mul|ne|neg|not|or|reserve|ret|sdiv|sext|sge|shl|sload|slt|srem|sshr|store|sub|switch|udiv|uge|ult|unreachable|urem|ushr|xor|zext)\b' |
|
| 13 | + | dataItems: '\b(?:str|sym|undef|undefined)\b' |
|
| 14 | + | types: '\b(?:void|w8|w16|w32|w64)\b' |
|
| 15 | + | ||
| 16 | + | contexts: |
|
| 17 | + | main: |
|
| 18 | + | - include: comments |
|
| 19 | + | - include: symbols |
|
| 20 | + | - include: strings |
|
| 21 | + | - include: labels |
|
| 22 | + | - include: registers |
|
| 23 | + | - include: branches |
|
| 24 | + | - include: keywords |
|
| 25 | + | - include: numbers |
|
| 26 | + | - include: punctuation |
|
| 27 | + | ||
| 28 | + | comments: |
|
| 29 | + | - match: '//' |
|
| 30 | + | scope: punctuation.definition.comment.ril |
|
| 31 | + | push: lineComment |
|
| 32 | + | ||
| 33 | + | lineComment: |
|
| 34 | + | - meta_scope: comment.line.double-slash.ril |
|
| 35 | + | - match: '\b(?:TODO|FIXME)\b' |
|
| 36 | + | scope: keyword.other.todo.ril |
|
| 37 | + | - match: '$' |
|
| 38 | + | pop: true |
|
| 39 | + | ||
| 40 | + | strings: |
|
| 41 | + | - match: '"' |
|
| 42 | + | scope: punctuation.definition.string.begin.ril |
|
| 43 | + | push: doubleQuotedString |
|
| 44 | + | ||
| 45 | + | doubleQuotedString: |
|
| 46 | + | - meta_scope: string.quoted.double.ril |
|
| 47 | + | - match: '\\.' |
|
| 48 | + | scope: constant.character.escape.ril |
|
| 49 | + | - match: '"' |
|
| 50 | + | scope: punctuation.definition.string.end.ril |
|
| 51 | + | pop: true |
|
| 52 | + | ||
| 53 | + | symbols: |
|
| 54 | + | - match: '(\$)(")([^"]*)(")' |
|
| 55 | + | captures: |
|
| 56 | + | 1: punctuation.definition.variable.ril |
|
| 57 | + | 2: punctuation.definition.string.begin.ril |
|
| 58 | + | 3: variable.other.symbol.quoted.ril |
|
| 59 | + | 4: punctuation.definition.string.end.ril |
|
| 60 | + | - match: '\${{symbol}}' |
|
| 61 | + | scope: variable.other.symbol.ril |
|
| 62 | + | ||
| 63 | + | labels: |
|
| 64 | + | - match: '@{{label}}' |
|
| 65 | + | scope: entity.name.label.ril |
|
| 66 | + | ||
| 67 | + | registers: |
|
| 68 | + | - match: '%[A-Za-z0-9_]+' |
|
| 69 | + | scope: variable.other.register.ril |
|
| 70 | + | ||
| 71 | + | branches: |
|
| 72 | + | - match: '\b(br)\.(eq|ne|slt|ult)\b' |
|
| 73 | + | scope: keyword.control.branch.ril |
|
| 74 | + | captures: |
|
| 75 | + | 1: keyword.control.branch.ril |
|
| 76 | + | 2: keyword.operator.comparison.ril |
|
| 77 | + | ||
| 78 | + | keywords: |
|
| 79 | + | - match: '{{types}}' |
|
| 80 | + | scope: storage.type.ril |
|
| 81 | + | - match: '{{dataItems}}' |
|
| 82 | + | scope: constant.language.ril |
|
| 83 | + | - match: '{{instructions}}' |
|
| 84 | + | scope: keyword.other.instruction.ril |
|
| 85 | + | - match: '{{keywords}}' |
|
| 86 | + | scope: keyword.control.ril |
|
| 87 | + | ||
| 88 | + | numbers: |
|
| 89 | + | - match: '(?<![A-Za-z0-9_])-?0[xX][0-9A-Fa-f]+' |
|
| 90 | + | scope: constant.numeric.integer.hexadecimal.ril |
|
| 91 | + | - match: '(?<![A-Za-z0-9_])-?[0-9]+' |
|
| 92 | + | scope: constant.numeric.integer.decimal.ril |
|
| 93 | + | ||
| 94 | + | punctuation: |
|
| 95 | + | - match: '[{}]' |
|
| 96 | + | scope: punctuation.section.block.ril |
|
| 97 | + | - match: '[()]' |
|
| 98 | + | scope: punctuation.section.group.ril |
|
| 99 | + | - match: '[;:,]' |
|
| 100 | + | scope: punctuation.separator.ril |
|
| 101 | + | - match: '\*' |
|
| 102 | + | scope: keyword.operator.ril |