|
| 1 | +; -------------- Objectscript ------------- |
| 2 | + |
| 3 | + |
| 4 | +; Variables |
| 5 | +; ^| e.g. '^||ppg', 'do', 'D' |
| 6 | +; ----------------------------------------- |
| 7 | +(gvn) @variable.special |
| 8 | +(ssvn) @variable.special |
| 9 | +(lvn) @variable |
| 10 | +(instance_variable) @variable.special |
| 11 | + |
| 12 | +; String literals |
| 13 | +; e.g. "Fo345349*_)(*_)8023841-40"" " |
| 14 | +; ----------------------------------------- |
| 15 | +(string_literal) @string |
| 16 | +(pattern_expression) @string.regex |
| 17 | + |
| 18 | +; Operators |
| 19 | +(_ operator: _ @operator) |
| 20 | + |
| 21 | +; Numeric literals |
| 22 | +; e.g. 12345 |
| 23 | +(integer_literal) @number |
| 24 | +(decimal_literal) @float |
| 25 | + |
| 26 | +; System variable name |
| 27 | +; e.g. $IO, $SY[SYTEM] |
| 28 | +(system_defined_variable) @function.builtin |
| 29 | + |
| 30 | +; System defined functions |
| 31 | +; e.g. $ASCII(62) |
| 32 | +(system_defined_function) @function.builtin |
| 33 | + |
| 34 | +(dollarsf |
| 35 | + ; $SYSTEM.Foo.Bar() |
| 36 | + (dollar_system_keyword) @function.builtin |
| 37 | +) |
| 38 | + |
| 39 | +(property_name) @property |
| 40 | +(parameter_name) @constant |
| 41 | +(_ parameter: _ @variable.parameter) |
| 42 | + |
| 43 | +; Method invcoations |
| 44 | +(instance_method_call) @function.method.call |
| 45 | +(class_method_call |
| 46 | + (class_ref (class_name) @type.definition) |
| 47 | + (method_name) @function.method.call |
| 48 | +) |
| 49 | +(oref_method (method_name) @function.method.call) |
| 50 | + |
| 51 | +(_ preproc_keyword: (_) @keyword.directive) |
| 52 | +(_ modifier: (_) @keyword.directive) |
| 53 | + |
| 54 | + |
| 55 | +; User-defined functions |
| 56 | +(extrinsic_function) @function.call |
| 57 | + |
| 58 | +; Goto labels and locations |
| 59 | +(_ label: (_) @label) |
| 60 | +(_ offset: (_) @number) |
| 61 | +(_ routine: (_) @namespace) |
| 62 | + |
| 63 | +; JSON literals |
| 64 | +(json_boolean_literal) @boolean |
| 65 | +(json_null_literal) @constant.builtin |
| 66 | +(json_number_literal) @number |
| 67 | +(json_string_literal) @string.escape |
| 68 | + |
| 69 | +; Macros |
| 70 | +(macro (macro_constant)) @constant.macro |
| 71 | +(macro (macro_function)) @function.macro |
| 72 | + |
| 73 | + |
| 74 | +; -------------- Objectscript Core ------------- |
| 75 | +; Commands |
| 76 | +; e.g. 'set', 'do', 'D' |
| 77 | +; ----------------------------------------- |
| 78 | +(_ command_name: (_) @keyword) |
| 79 | + |
| 80 | +(_ macro_name: (_) @keyword.macro) |
| 81 | +(_ macro_arg: (_) @constant.macro) |
| 82 | +(_ mnemonic: (_) @constant.macro) |
| 83 | + |
| 84 | +; Functions that can be on the LHS of a SET |
| 85 | +(doable_dollar_functions) @function.builtin |
| 86 | + |
| 87 | +; non-extrinsic routine call |
| 88 | +(routine_tag_call) @function.call |
| 89 | + |
| 90 | +;; Technically elseif and else_block are not statements, |
| 91 | +;; so we need ot query them explicitly |
| 92 | +;(elseif_block command_name: (_) @keyword) |
| 93 | +;(else_block command_name: (_) @keyword) |
| 94 | + |
| 95 | +"{" @punctuation.bracket |
| 96 | +"}" @punctuation.bracket |
| 97 | + |
| 98 | +; Comments |
| 99 | +; e.g. '// fj;lkasdfj', '#; sklfjas;k', '; sklfjas','/* sdfs */' |
| 100 | +[ |
| 101 | + (line_comment_1) |
| 102 | + (line_comment_2) |
| 103 | + (line_comment_3) |
| 104 | + (block_comment) |
| 105 | +] @comment |
| 106 | + |
| 107 | +(embedded_html |
| 108 | + (keyword_embedded_html) @keyword.directive |
| 109 | + "<" @keyword.directive |
| 110 | + ">" @keyword.directive |
| 111 | +) |
| 112 | +; (embedded_sql_hash |
| 113 | +; (keyword_embedded_sql_hash) @keyword.directive |
| 114 | +; ) |
| 115 | +; (embedded_sql_amp |
| 116 | +; (keyword_embedded_sql_amp) @keyword.directive |
| 117 | +; "(" @keyword.directive |
| 118 | +; ")" @keyword.directive |
| 119 | +; (embedded_sql_reverse_marker) @keyword.directive |
| 120 | +; ) |
| 121 | + |
| 122 | +(embedded_sql_amp |
| 123 | + (keyword_embedded_sql_amp) @keyword.directive |
| 124 | + "(" @keyword.directive |
| 125 | + ")" @keyword.directive |
| 126 | +) |
| 127 | + |
| 128 | +(embedded_sql_hash |
| 129 | + (keyword_embedded_sql_hash) @keyword.directive |
| 130 | + "(" @keyword.directive |
| 131 | + ")" @keyword.directive |
| 132 | +) |
| 133 | + |
| 134 | +(embedded_js |
| 135 | + (keyword_embedded_js) @keyword.directive |
| 136 | + "<" @keyword.directive |
| 137 | + ">" @keyword.directive |
| 138 | +) |
| 139 | + |
| 140 | +(embedded_xml |
| 141 | + (keyword_embedded_xml) @keyword.directive |
| 142 | + "<" @keyword.directive |
| 143 | + ">" @keyword.directive |
| 144 | +) |
| 145 | + |
| 146 | +(tag) @label |
| 147 | + |
| 148 | +; Lock type specifications |
| 149 | +(locktype) @type.qualifier |
| 150 | + |
| 151 | + |
| 152 | +(_ keyword: (_) @keyword) |
| 153 | + |
| 154 | +; (identifier) @variable |
| 155 | + |
| 156 | + |
| 157 | +; Alternatively |
| 158 | +; (class_statement (_ class_statement_keyword: (_) @keyword ) .) |
| 159 | +"{" @punctuation.bracket |
| 160 | +"}" @punctuation.bracket |
| 161 | + |
| 162 | +; @class.name capture group is not suppported in nvim highlighter |
| 163 | +; (class_definition class_name: (identifier) @class.name) |
| 164 | +(include_clause (identifier) @keyword.import) |
| 165 | +(property (identifier) @property) |
| 166 | +(parameter (identifier) @constant) |
| 167 | +(projection (identifier) @type.definition) |
| 168 | +(trigger (identifier) @type.definition) |
| 169 | +(index (identifier) @type.definition) |
| 170 | +(relationship (identifier) @type.definition) |
| 171 | +(foreignkey (identifier) @type.definition) |
| 172 | +(xdata (identifier) @constant) |
| 173 | +(typename) @type |
| 174 | +(class_definition |
| 175 | + class_name: (identifier) @type |
| 176 | + (class_extends (identifier) @type)) |
| 177 | +(method_definition (identifier (identifier)) @function) |
| 178 | +(query (identifier) @function) |
| 179 | + |
| 180 | +(argument (identifier) @variable.parameter) |
| 181 | + |
| 182 | +(keyword_name) @keyword |
| 183 | + |
| 184 | +(class_keywords (_ rhs: _ @constant.builtin)) |
| 185 | +(parameter_keywords (_ rhs: _ @constant.builtin)) |
| 186 | +(property_keywords (_ rhs: _ @constant.builtin)) |
| 187 | +(xdata_keywords (_ rhs: _ @constant.builtin)) |
| 188 | +(method_keywords (_ rhs: _ @constant.builtin)) |
| 189 | +(trigger_keywords (_ rhs: _ @constant.builtin)) |
| 190 | +(query_keywords (_ rhs: _ @constant.builtin)) |
| 191 | +(index_keywords (_ rhs: _ @constant.builtin)) |
| 192 | +(foreignkey_keywords (_ rhs: _ @constant.builtin)) |
| 193 | +(projection_keywords (_ rhs: _ @constant.builtin)) |
| 194 | +(relationship_keywords (_ rhs: _ @constant.builtin)) |
| 195 | + |
| 196 | +(documatic_line) @comment.doc |
| 197 | + |
0 commit comments