|
| 1 | +# If this is your first time writing a language grammar, check out: |
| 2 | +# - http://manual.macromates.com/en/language_grammars |
| 3 | + |
| 4 | +'scopeName': 'source.lcb' |
| 5 | +'name': 'LiveCode Builder' |
| 6 | +'fileTypes': [ |
| 7 | + 'lcb' |
| 8 | +] |
| 9 | +'patterns': [ |
| 10 | + { |
| 11 | + 'include': '#comment-line' |
| 12 | + } |
| 13 | + { |
| 14 | + 'include': '#comment-block' |
| 15 | + } |
| 16 | + { |
| 17 | + 'include': '#string' |
| 18 | + } |
| 19 | + { |
| 20 | + 'include': '#if' |
| 21 | + } |
| 22 | + { |
| 23 | + 'include': '#repeat-block' |
| 24 | + } |
| 25 | + { |
| 26 | + 'match': '\\s*(next|end)\\s*repeat\\b' |
| 27 | + 'name': 'keyword.control.lcb' |
| 28 | + } |
| 29 | + { |
| 30 | + 'include': '#end-block' |
| 31 | + } |
| 32 | + { |
| 33 | + 'include': '#define-module' |
| 34 | + } |
| 35 | + { |
| 36 | + 'include': '#define-constant' |
| 37 | + } |
| 38 | + { |
| 39 | + 'include': '#define-variable' |
| 40 | + } |
| 41 | + { |
| 42 | + 'include': '#define-handler' |
| 43 | + } |
| 44 | + { |
| 45 | + 'include': '#handler-return' |
| 46 | + } |
| 47 | + { |
| 48 | + 'include': '#brackets' |
| 49 | + } |
| 50 | + { |
| 51 | + 'match': '\\b(true|false|nothing|any)\\b' |
| 52 | + 'captures': |
| 53 | + '1': |
| 54 | + 'name': 'constant.language.lcb' |
| 55 | + } |
| 56 | + { |
| 57 | + 'match': '\\b([tpskmxr][A-Z]\\w*)\\b' |
| 58 | + 'captures': |
| 59 | + '1': |
| 60 | + 'name': 'variable.lcb' |
| 61 | + } |
| 62 | + { |
| 63 | + 'match': '\\b(returns)\\b' |
| 64 | + 'captures': |
| 65 | + '1': |
| 66 | + 'name': 'keyword.control.lcb' |
| 67 | + } |
| 68 | +] |
| 69 | + |
| 70 | +'repository': |
| 71 | + |
| 72 | + 'comment-line': |
| 73 | + 'begin': '--' |
| 74 | + 'beginCaptures': |
| 75 | + '0': |
| 76 | + 'name': 'punctuation.definition.comment.double-dash.lcb' |
| 77 | + 'end': '\\n' |
| 78 | + 'name': 'comment.line.lcb' |
| 79 | + |
| 80 | + 'comment-block': |
| 81 | + 'begin': '/\\*' |
| 82 | + 'captures': |
| 83 | + '0': |
| 84 | + 'name': 'punctuation.definition.comment.lcb' |
| 85 | + 'end': '\\*/' |
| 86 | + 'name': 'comment.block.lcb' |
| 87 | + |
| 88 | + 'string': |
| 89 | + 'begin': '"' |
| 90 | + 'beginCaptures': |
| 91 | + '0': |
| 92 | + 'name': 'punctuation.definition.string.begin.lcb' |
| 93 | + 'end': '"' |
| 94 | + 'endCaptures': |
| 95 | + '0': |
| 96 | + 'name': 'punctuation.definition.string.end.lcb' |
| 97 | + 'name': 'string.quoted.double.lcb' |
| 98 | + |
| 99 | + 'if': |
| 100 | + 'begin': '^\\s*(else\\s*if|if|else)\\b' |
| 101 | + 'captures': |
| 102 | + '1': |
| 103 | + 'name': 'keyword.control.lcb' |
| 104 | + 'end': '\\b(then)\\b' |
| 105 | + 'patterns': [ |
| 106 | + { |
| 107 | + 'include': '$self' |
| 108 | + } |
| 109 | + ] |
| 110 | + |
| 111 | + 'end-block': |
| 112 | + 'match': '^\\s*(end(?:\\s*(?:module|library|widget|handler|if|repeat))?)' |
| 113 | + 'name': 'keyword.control.lcb' |
| 114 | + |
| 115 | + 'repeat-block': |
| 116 | + 'match': '^\\s*(repeat)\\b' |
| 117 | + 'name': 'keyword.control.lcb' |
| 118 | + |
| 119 | + 'define-module': |
| 120 | + 'match': '^\\s*(module|library|widget|use)(\\s+[^\\s]*)?\\b' |
| 121 | + 'captures': |
| 122 | + '1': |
| 123 | + 'name': |
| 124 | + 'keyword.control.lcb' |
| 125 | + '2': |
| 126 | + 'name': |
| 127 | + 'entity.name.section.module.lcb' |
| 128 | + |
| 129 | + 'define-constant': |
| 130 | + 'begin': '^\\s*constant\\b' |
| 131 | + 'end': '\\bis\\b' |
| 132 | + 'captures': |
| 133 | + '0': |
| 134 | + 'name': 'keyword.control.lcb' |
| 135 | + 'patterns': [ |
| 136 | + { |
| 137 | + 'match': '\\b\\w+\\b' |
| 138 | + 'name': 'variable.constant.lcb' |
| 139 | + } |
| 140 | + ] |
| 141 | + |
| 142 | + 'define-variable': |
| 143 | + 'match': '^\\s*(variable)(?:\\s+(\\w*)(?:\\s+(as(?:\\soptional)?)(?:\\s+(\\w*))?)?)?' |
| 144 | + 'captures': |
| 145 | + '1': |
| 146 | + 'name': 'keyword.control.lcb' |
| 147 | + '2': |
| 148 | + 'name': 'variable.lcb' |
| 149 | + '3': |
| 150 | + 'name': 'keyword.control.lcb' |
| 151 | + '4': |
| 152 | + 'name': 'storage.type.lcb' |
| 153 | + |
| 154 | + 'define-handler': |
| 155 | + 'match': '^\\s*((?:(?:public|private)\\s+)?handler)(?:\\s+(\\w+))\\b' |
| 156 | + 'captures': |
| 157 | + '1': |
| 158 | + 'name': 'keyword.control.lcb' |
| 159 | + '2': |
| 160 | + 'name': 'entity.name.function.lcb' |
| 161 | + |
| 162 | + 'handler-return': |
| 163 | + 'match': '^\\s*return\\b' |
| 164 | + 'name': 'keyword.control.lcb' |
| 165 | + |
| 166 | + 'brackets': |
| 167 | + 'begin': '\\[' |
| 168 | + 'end': '\\]' |
| 169 | + 'captures': |
| 170 | + '0': |
| 171 | + 'name': 'punctuation.separator.list' |
0 commit comments