Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit 38449e9

Browse files
committed
Made & show up as a bit wise operator again. There's now a special case for giving it the special 'pointer' scope. Also changed the scope for those pointer-related things, so they get operator coloring by default, but it is still separately overridable if one so wishes.
1 parent 78cd5eb commit 38449e9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Odin.sublime-syntax

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,15 @@ contexts:
9898
- match: '(\(|\)|\{|\}|\[|\]|,|;)'
9999
scope: punctuation.separator.odin
100100

101-
# TODO: & should work as bit-wise operator too. Needs some special case to
102-
# make it into `keyword.operator.odin`. Probably needs some smarter scoping.
103-
- match: '(\&|\^|\.)'
101+
# Match & as a bit-wise operator if there is a word, number or right paren
102+
# to the left of it. Otherwise: Treat it as a 'pointer'. This is for people
103+
# who want to give special colors to pointer-related usage of & and ^.
104+
- match: '(?<=[\w|\)])\s*(\&)'
105+
scope: keyword.operator.odin
106+
- match: '(\&|\^)'
107+
scope: keyword.operator.pointer.odin
108+
109+
- match: '(\.)'
104110
scope: punctuation.accessor.odin
105111

106112
# - match: '(\$)'

0 commit comments

Comments
 (0)