|
| 1 | +{ |
| 2 | + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
| 3 | + "name": "cachéobjectscriptinclude", |
| 4 | + "scopeName": "source.cosinc", |
| 5 | + "patterns": [ |
| 6 | + |
| 7 | + { "include": "#include" }, |
| 8 | + { "include": "#define" }, |
| 9 | + { "include": "#def1arg" }, |
| 10 | + { "include": "#ifdef" }, |
| 11 | + { "include": "#comment-line" } |
| 12 | + |
| 13 | + ], |
| 14 | + |
| 15 | + "repository": { |
| 16 | + |
| 17 | + "include": { |
| 18 | + "patterns": [ |
| 19 | + { "begin": "^\\s*(\\#\\s*(?:(?i)include))\\s+([a-zA-Z%][a-zA-Z0-9]*)", "end": "(?=$)", |
| 20 | + "beginCaptures": { |
| 21 | + "1": {"name":"keyword.other.cos"}, |
| 22 | + "2": { "name": "entity.name.cos" } |
| 23 | + } |
| 24 | + } |
| 25 | + ] |
| 26 | + |
| 27 | + }, |
| 28 | + |
| 29 | + "define": { |
| 30 | + "patterns": [ |
| 31 | + { |
| 32 | + "name": "meta.preprocessor.cos", |
| 33 | + "begin": "^\\s*(\\#\\s*(?:(?i)define))\\s+((?<id>[a-zA-Z%][a-zA-Z0-9]*))(?:(\\()(\\s*\\g<id>\\s*((,)\\s*\\g<id>\\s*)*)(\\)))?", |
| 34 | + "beginCaptures": { |
| 35 | + |
| 36 | + "1": { "name": "keyword.control.cos" }, |
| 37 | + "2": { "name": "entity.name.cos" }, |
| 38 | + "4": { "name": "punctuation.definition.cos" }, |
| 39 | + "5": { "name": "variable.parameter.cos" }, |
| 40 | + "7": { "name": "punctuation.definition.cos" } |
| 41 | + |
| 42 | + }, |
| 43 | + "end": "(?<!\\#\\#continue)\\n", |
| 44 | + |
| 45 | + "patterns":[ |
| 46 | + |
| 47 | + { "include": "#comment-line" }, |
| 48 | + { "include": "#continue" }, |
| 49 | + { "include": "#digits" }, |
| 50 | + { "include": "#macros" } |
| 51 | + |
| 52 | + ] |
| 53 | + } |
| 54 | + ] |
| 55 | + }, |
| 56 | + |
| 57 | + "def1arg": { |
| 58 | + "patterns": [ |
| 59 | + { |
| 60 | + "name": "meta.preprocessor.cos", |
| 61 | + "begin": "^\\s*(\\#\\s*(?:(?i)def1arg))\\s+((?<id>[a-zA-Z%][a-zA-Z0-9]*))(?:(\\()(\\s*\\g<id>\\s*)(\\)))", |
| 62 | + "beginCaptures": { |
| 63 | + |
| 64 | + "1": { "name": "keyword.control.cos" }, |
| 65 | + "2": { "name": "entity.name.cos" }, |
| 66 | + "4": { "name": "punctuation.definition.cos" }, |
| 67 | + "5": { "name": "variable.parameter.cos" }, |
| 68 | + "6": { "name": "punctuation.definition.cos" } |
| 69 | + |
| 70 | + }, |
| 71 | + "end": "(?<!\\#\\#continue)\\n", |
| 72 | + |
| 73 | + "patterns":[ |
| 74 | + |
| 75 | + { "include": "#comment-line" }, |
| 76 | + { "include": "#continue" }, |
| 77 | + { "include": "#digits" }, |
| 78 | + { "include": "#macros" } |
| 79 | + |
| 80 | + ] |
| 81 | + } |
| 82 | + ] |
| 83 | + }, |
| 84 | + |
| 85 | + "ifdef": { |
| 86 | + "patterns": [ |
| 87 | + { |
| 88 | + "name": "meta.preprocessor.cos", |
| 89 | + "begin": "^\\s*(#\\s*(?i)(?:if|ifdef|ifndef|elif|else|undef|endif))\\b", |
| 90 | + "beginCaptures": { "1": { "name": "keyword.control.cos" } }, |
| 91 | + "end": "(?=(?:;|//|/\\*))|$", |
| 92 | + "patterns": [ |
| 93 | + { "include": "#digits" }, |
| 94 | + { "include": "#comment-line" } |
| 95 | + ] |
| 96 | + |
| 97 | + } |
| 98 | + |
| 99 | + ] |
| 100 | + }, |
| 101 | + |
| 102 | + "continue": { |
| 103 | + "patterns": [ |
| 104 | + { "match": "(\\s+\\#\\#(?i)(continue)\\s*)", "name": "keyword.control.cos" } |
| 105 | + ] |
| 106 | + }, |
| 107 | + |
| 108 | + "digits": { |
| 109 | + "patterns":[ |
| 110 | + { "match": "\\b((([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b", |
| 111 | + "name": "constant.numeric.cos" |
| 112 | + } |
| 113 | + ] |
| 114 | + }, |
| 115 | + |
| 116 | + "macros": { |
| 117 | + "patterns": [ |
| 118 | + { "match": "\\$\\$\\$[a-zA-Z]([a-zA-Z0-9])*", "name":"support.constant" } |
| 119 | + ] |
| 120 | + }, |
| 121 | + |
| 122 | + "comment-line": { |
| 123 | + "patterns": [ |
| 124 | + { "match": "^///.*$", "name": "comment.line.cos" }, |
| 125 | + { "match": "\\s+//.*$", "name": "comment.line.cos" }, |
| 126 | + { "match": "\\s+;.*$", "name": "comment.line.cos" }, |
| 127 | + { "match": "^\\s*#;.*$", "name": "comment.line.cos" }, |
| 128 | + { "name": "comment.block.cos", "begin": "/\\*", "end": "\\*/", |
| 129 | + "beginCaptures": { "0": { "name": "punctuation.definition.cos" } }, |
| 130 | + "endCaptures": { "0": { "name": "punctuation.definition.cos" } } |
| 131 | + } |
| 132 | + ] |
| 133 | + |
| 134 | + } |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + } |
| 139 | +} |
0 commit comments