Skip to content

Commit 82830a4

Browse files
authored
ensure that empty and Error kinds does not get added to OPERATOR_KINDS
1 parent c642041 commit 82830a4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/JuliaSyntaxHighlighting.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,19 @@ 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)
47-
let (str2int, int2str) = (getglobal(JuliaSyntax, :_kind_str_to_int), getglobal(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)
49+
let (str2int, int2str) = (JuliaSyntax._kind_str_to_int, JuliaSyntax._kind_int_to_str)
4850
op_start = get(str2int, "BEGIN_OPS", typemax(UInt16))
4951
op_end = get(str2int, "END_OPS", typemin(UInt16))
50-
ops = Set{String}()
5152
for int in op_start:op_end
5253
op = get(int2str, int, "")
53-
!isempty(op) && !startswith(op, "Error")
54-
push!(ops, op)
54+
if !isempty(op) && !startswith(op, "Error")
55+
push!(OPERATOR_KINDS, op)
56+
end
5557
end
56-
ops
5758
end
58-
else
59-
Set{String}()
6059
end
6160

6261
"""

0 commit comments

Comments
 (0)