@@ -125,8 +125,8 @@ function emit_diagnostic(ps::ParseState, args...; kws...)
125
125
emit_diagnostic (ps. stream, args... ; kws... )
126
126
end
127
127
128
- function textbuf (ps:: ParseState )
129
- textbuf (ps. stream)
128
+ function unsafe_textbuf (ps:: ParseState )
129
+ unsafe_textbuf (ps. stream)
130
130
end
131
131
132
132
function first_child_position (ps:: ParseState , pos:: ParseStreamPosition )
@@ -3143,7 +3143,7 @@ function parse_brackets(after_parse::Function,
3143
3143
return opts
3144
3144
end
3145
3145
3146
- is_indentation (b:: UInt8 ) = (b == UInt8 ( ' ' ) || b == UInt8 ( ' \t ' ) )
3146
+ _is_indentation (b:: UInt8 ) = (b == u8 " " || b == u8 " \t " )
3147
3147
3148
3148
# Parse a string, embedded interpolations and deindent triple quoted strings
3149
3149
# by marking indentation characters as whitespace trivia.
@@ -3157,7 +3157,7 @@ function parse_string(ps::ParseState, raw::Bool)
3157
3157
indent_ref_i = 0
3158
3158
indent_ref_len = typemax (Int)
3159
3159
indent_chunks = acquire_positions (ps. stream)
3160
- buf = textbuf (ps)
3160
+ txtbuf = unsafe_textbuf (ps)
3161
3161
chunk_flags = raw ? RAW_STRING_FLAG : EMPTY_FLAGS
3162
3162
bump (ps, TRIVIA_FLAG)
3163
3163
first_chunk = true
@@ -3212,10 +3212,10 @@ function parse_string(ps::ParseState, raw::Bool)
3212
3212
if triplestr && first_chunk && span (t) <= 2 &&
3213
3213
begin
3214
3214
s = span (t)
3215
- b = buf [last_byte (t)]
3215
+ b = txtbuf [last_byte (t)]
3216
3216
# Test whether the string is a single logical newline
3217
- (s == 1 && (b == UInt8 ( ' \n ' ) || b == UInt8 ( ' \r ' ) )) ||
3218
- (s == 2 && (buf [first_byte (t)] == UInt8 ( ' \r ' ) && b == UInt8 ( ' \n ' ) ))
3217
+ (s == 1 && (b == u8 " \n " || b == u8 " \r " )) ||
3218
+ (s == 2 && (txtbuf [first_byte (t)] == u8 " \r " && b == u8 " \n " ))
3219
3219
end
3220
3220
# First line of triple string is a newline only: mark as trivia.
3221
3221
# """\nx""" ==> (string-s "x")
@@ -3253,8 +3253,8 @@ function parse_string(ps::ParseState, raw::Bool)
3253
3253
# """\n $a \n $b""" ==> (string-s a " \n" b)
3254
3254
# """\n $a\n $b\n""" ==> (string-s " " a "\n" " " b "\n")
3255
3255
#
3256
- if prev_chunk_newline && (b = buf [first_byte (t)];
3257
- b != UInt8 ( ' \n ' ) && b != UInt8 ( ' \r ' ) )
3256
+ if prev_chunk_newline && (b = txtbuf [first_byte (t)];
3257
+ b != u8 " \n " && b != u8 " \r " )
3258
3258
# Compute length of longest common prefix of mixed
3259
3259
# spaces and tabs, in bytes
3260
3260
#
@@ -3267,7 +3267,7 @@ function parse_string(ps::ParseState, raw::Bool)
3267
3267
# No indentation found yet. Find indentation we'll
3268
3268
# use as a reference
3269
3269
i = first_byte (t) - 1
3270
- while i < last_byte (t) && is_indentation (buf [i+ 1 ])
3270
+ while i < last_byte (t) && _is_indentation (txtbuf [i+ 1 ])
3271
3271
i += 1
3272
3272
end
3273
3273
indent_ref_i = first_byte (t)
@@ -3277,7 +3277,7 @@ function parse_string(ps::ParseState, raw::Bool)
3277
3277
# shortening length if necessary.
3278
3278
j = 0
3279
3279
while j < span (t) && j < indent_ref_len
3280
- if buf [j + first_byte (t)] != buf [j + indent_ref_i]
3280
+ if txtbuf [j + first_byte (t)] != txtbuf [j + indent_ref_i]
3281
3281
break
3282
3282
end
3283
3283
j += 1
@@ -3287,7 +3287,7 @@ function parse_string(ps::ParseState, raw::Bool)
3287
3287
# Prepare a place for indentiation trivia, if necessary
3288
3288
push! (indent_chunks, bump_invisible (ps, K " TOMBSTONE" ))
3289
3289
end
3290
- b = buf [last_byte (t)]
3290
+ b = txtbuf [last_byte (t)]
3291
3291
prev_chunk_newline = b == UInt8 (' \n ' ) || b == UInt8 (' \r ' )
3292
3292
end
3293
3293
bump (ps, chunk_flags)
0 commit comments