Skip to content

Commit 10c4290

Browse files
authored
Normalize ℏ (\hslash) to ħ (\hbar) (JuliaLang/JuliaSyntax.jl#277)
See upstream PR #49559
1 parent f0e62bf commit 10c4290

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

JuliaSyntax/src/literal_parsing.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ function utf8proc_custom_func(codepoint::UInt32, ::Ptr{Cvoid})::UInt32
333333
codepoint == 0x00B5 ? 0x03BC : # 'µ' => 'μ'
334334
codepoint == 0x00B7 ? 0x22C5 : # '·' => '⋅'
335335
codepoint == 0x0387 ? 0x22C5 : # '·' => '⋅'
336-
codepoint == 0x2212 ? 0x002D : # '−' => '-'
336+
codepoint == 0x2212 ? 0x002D : # '−' (\minus) => '-'
337+
codepoint == 0x210F ? 0x0127 : # 'ℏ' (\hslash) => 'ħ' \hbar
337338
codepoint)
338339
end
339340

JuliaSyntax/test/literal_parsing.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,8 @@ end
248248
# https://github.com/JuliaLang/julia/pull/42561
249249
@test JuliaSyntax.normalize_identifier("julia\u025B\u00B5\u00B7\u0387\u2212") ==
250250
"julia\u03B5\u03BC\u22C5\u22C5\u002D"
251+
252+
# https://github.com/JuliaLang/julia/issues/48870
253+
# ℏ -> ħ
254+
@test JuliaSyntax.normalize_identifier("\u210f") == "\u0127"
251255
end

0 commit comments

Comments
 (0)