Closed mega-dean closed 6 months ago
I update the PR so now it adds (defconst zig-re-type "[[:word:]_.][[:word:]_.[:digit:]]*")
and uses that in zig-re-type-annotation
.
At first I tried updating the zig-re-type-annotation
regex to keep using zig-re-identifier
and I got it working with this:
(defconst zig-re-type-annotation
(concat (zig-re-grab zig-re-identifier)
"[[:space:]]*:[[:space:]]*"
zig-re-optionals-pointers-arrays
(zig-re-grab (concat (zig-re-grab (concat zig-re-identifier "\\.?")) "*"))))
But I think it's probably better to just define the new constant. Let me know if you want me to change it though.
Thanks! For now, this is perfectly fine. I think the regexes need to be revamped altogether in future to more closely match the zig grammar – or use tree sitter as basis.
This change adds
.
to thezig-re-identifier
regex so that namespaced types are entirely highlighted usingfont-lock-type-face
, instead of only highlighting the first namespace.Before:
After:
I tried to look at what
zig-re-identifier
is used for to make sure there wouldn't be any unintended side effects from this change, but I can't tell for sure. I skimmed some zig files and it looked like it only affected struct field types and function arguments.