Skip to content

Commit 63c343b

Browse files
committed
fix: correct operator precedence in ZynML syntax highlighting
- Separate equality (==, !=) from assignment (=) patterns - Move equality comparison before assignment to ensure == matches first - Separate fat arrow (=>) from thin arrow (->) - Make type annotation colon (:) punctuation instead of operator - Move path separator (::) before single colon - Add compound assignment patterns (+=, -=, etc.) - Move bitwise shift (<<, >>) before comparison operators
1 parent 409c301 commit 63c343b

1 file changed

Lines changed: 48 additions & 12 deletions

File tree

.vscode/extensions/zynml-syntax/syntaxes/zynml.tmLanguage.json

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,48 +208,84 @@
208208
"operators": {
209209
"patterns": [
210210
{
211+
"comment": "Pipe operator",
211212
"name": "keyword.operator.pipe.zynml",
212213
"match": "\\|>"
213214
},
214215
{
215-
"name": "keyword.operator.arrow.zynml",
216-
"match": "=>|->|:"
216+
"comment": "Fat arrow (lambda)",
217+
"name": "keyword.operator.arrow.fat.zynml",
218+
"match": "=>"
217219
},
218220
{
221+
"comment": "Thin arrow (return type - legacy)",
222+
"name": "keyword.operator.arrow.thin.zynml",
223+
"match": "->"
224+
},
225+
{
226+
"comment": "Path separator",
227+
"name": "keyword.operator.path.zynml",
228+
"match": "::"
229+
},
230+
{
231+
"comment": "Type annotation colon",
232+
"name": "punctuation.separator.type.zynml",
233+
"match": ":"
234+
},
235+
{
236+
"comment": "Null coalescing",
219237
"name": "keyword.operator.nullcoalesce.zynml",
220238
"match": "\\?\\?"
221239
},
222240
{
241+
"comment": "Optional/unwrap",
223242
"name": "keyword.operator.optional.zynml",
224243
"match": "\\?"
225244
},
226245
{
227-
"name": "keyword.operator.path.zynml",
228-
"match": "::"
229-
},
230-
{
246+
"comment": "Spread/range operators",
231247
"name": "keyword.operator.spread.zynml",
232248
"match": "\\.\\.\\.|\\.\\."
233249
},
234250
{
235-
"name": "keyword.operator.comparison.zynml",
236-
"match": "==|!=|<=|>=|<|>"
251+
"comment": "Equality comparison (must come before assignment)",
252+
"name": "keyword.operator.comparison.equality.zynml",
253+
"match": "==|!="
254+
},
255+
{
256+
"comment": "Relational comparison",
257+
"name": "keyword.operator.comparison.relational.zynml",
258+
"match": "<=|>=|<|>"
237259
},
238260
{
261+
"comment": "Compound assignment (must come before simple assignment)",
262+
"name": "keyword.operator.assignment.compound.zynml",
263+
"match": "\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>="
264+
},
265+
{
266+
"comment": "Simple assignment",
267+
"name": "keyword.operator.assignment.zynml",
268+
"match": "="
269+
},
270+
{
271+
"comment": "Logical operators",
239272
"name": "keyword.operator.logical.zynml",
240273
"match": "&&|\\|\\||!"
241274
},
242275
{
276+
"comment": "Arithmetic operators",
243277
"name": "keyword.operator.arithmetic.zynml",
244278
"match": "\\+|-|\\*|/|%|@"
245279
},
246280
{
247-
"name": "keyword.operator.bitwise.zynml",
248-
"match": "&|\\||\\^|~|<<|>>"
281+
"comment": "Bitwise shift (must come before < >)",
282+
"name": "keyword.operator.bitwise.shift.zynml",
283+
"match": "<<|>>"
249284
},
250285
{
251-
"name": "keyword.operator.assignment.zynml",
252-
"match": "=|\\+=|-=|\\*=|/="
286+
"comment": "Bitwise operators",
287+
"name": "keyword.operator.bitwise.zynml",
288+
"match": "&|\\||\\^|~"
253289
}
254290
]
255291
},

0 commit comments

Comments
 (0)