Skip to content

Commit

Permalink
Add U+1F8B2 🢲 as an operator (#525)
Browse files Browse the repository at this point in the history
The character U+1F8B2 🢲 (RIGHTWARDS ARROW WITH LOWER HOOK) is new is Unicode 16; it is of a kind (no pun intended) with the longstanding characters U+21A9 ↩ (LEFTWARDS ARROW WITH HOOK) and U+21AA ↪ (RIGHTWARDS ARROW WITH HOOK), both of which are already supported as operators in Julia. It was added to Unicode as part of the Symbols for Legacy Computing effort, wherein it was sourced from Smalltalk character sets in the 1970s—so it has a very long history of being used in programming languages.

---------

Co-authored-by: Claire Foster <aka.c42f@gmail.com>
pthariensflame and c42f authored Jan 23, 2025
1 parent 820b646 commit 22caab0
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/kinds.jl
Original file line number Diff line number Diff line change
@@ -464,6 +464,7 @@ register_kinds!(JuliaSyntax, 0, [
"↶"
"↺"
"↻"
"🢲"
"END_ARROW"

# Level 4
1 change: 1 addition & 0 deletions src/tokenize.jl
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ end
function is_identifier_start_char(c::Char)
c == EOF_CHAR && return false
isvalid(c) || return false
c == '🢲' && return false # First divergence from Base.is_id_start_char
return Base.is_id_start_char(c)
end

3 changes: 3 additions & 0 deletions test/tokenize.jl
Original file line number Diff line number Diff line change
@@ -922,6 +922,9 @@ end
end
allops = split(join(ops, " "), " ")
@test all(s->Base.isoperator(Symbol(s)) == is_operator(first(collect(tokenize(s))).kind), allops)

# "\U1f8b2" added in Julia 1.12
@test is_operator(first(collect(tokenize("🢲"))))
end

const all_kws = Set([

0 comments on commit 22caab0

Please sign in to comment.