Skip to content

Commit 136d9b1

Browse files
committed
ensure that empty and Error kinds does not get added to OPERATOR_KINDS
Previously, there was a no-op `!isempty(op) && !startswith(op, "Error")` condition that didn't guard anything
1 parent c642041 commit 136d9b1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/JuliaSyntaxHighlighting.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ A set of known operator kind strings.
4343
4444
This is a workaround for operators that are classified as `K"Identifier"`.
4545
"""
46-
const OPERATOR_KINDS = if isdefined(JuliaSyntax, :_kind_str_to_int) && isdefined(JuliaSyntax, :_kind_int_to_str)
46+
const OPERATOR_KINDS = Set{String}()
47+
48+
if isdefined(JuliaSyntax, :_kind_str_to_int) && isdefined(JuliaSyntax, :_kind_int_to_str)
4749
let (str2int, int2str) = (getglobal(JuliaSyntax, :_kind_str_to_int), getglobal(JuliaSyntax, :_kind_int_to_str))
4850
op_start = get(str2int, "BEGIN_OPS", typemax(UInt16))
4951
op_end = get(str2int, "END_OPS", typemin(UInt16))
5052
ops = Set{String}()
5153
for int in op_start:op_end
5254
op = get(int2str, int, "")
53-
!isempty(op) && !startswith(op, "Error")
54-
push!(ops, op)
55+
if !isempty(op) && !startswith(op, "Error")
56+
push!(OPERATOR_KINDS, op)
57+
end
5558
end
56-
ops
5759
end
58-
else
59-
Set{String}()
6060
end
6161

6262
"""

0 commit comments

Comments
 (0)