Skip to content

Commit ebdd312

Browse files
committed
1 parent b01837a commit ebdd312

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/tokenize.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Tokenize
22

33
export tokenize, untokenize
44

5-
using ..JuliaSyntax: JuliaSyntax, Kind, @K_str, @KSet_str
5+
using ..JuliaSyntax: JuliaSyntax, Kind, @K_str, @KSet_str, @callsite_inline
66

77
import ..JuliaSyntax: kind,
88
is_literal, is_contextual_keyword, is_word_operator
@@ -1303,14 +1303,14 @@ function lex_identifier(l::Lexer, c)
13031303
@inbounds if (pc_byte == UInt8('!') && ppc == '=') || !ascii_is_identifier_char[pc_byte+1]
13041304
break
13051305
end
1306-
elseif Unicode.isgraphemebreak!(graphemestate, c, pc)
1306+
elseif @callsite_inline Unicode.isgraphemebreak!(graphemestate, c, pc)
13071307
if (pc == '!' && ppc == '=') || !is_identifier_char(pc)
13081308
break
13091309
end
13101310
elseif pc in ('\u200c','\u200d') # ZWNJ/ZWJ control characters
13111311
# ZWJ/ZWNJ only within grapheme sequences, not at end
13121312
graphemestate_peek[] = graphemestate[]
1313-
if Unicode.isgraphemebreak!(graphemestate_peek, pc, ppc)
1313+
if @callsite_inline Unicode.isgraphemebreak!(graphemestate_peek, pc, ppc)
13141314
break
13151315
end
13161316
end

src/utils.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ if VERSION < v"1.5"
1414
import Base.peek
1515
end
1616

17+
if VERSION < v"1.8"
18+
macro callsite_inline(call)
19+
esc(call)
20+
end
21+
else
22+
const var"@callsite_inline" = var"@inline"
23+
end
24+
25+
1726
_unsafe_wrap_substring(s) = (s.offset, unsafe_wrap(Vector{UInt8}, s.string))
1827

1928
#--------------------------------------------------

0 commit comments

Comments
 (0)