@@ -125,8 +125,8 @@ function emit_diagnostic(ps::ParseState, args...; kws...)
125125 emit_diagnostic (ps. stream, args... ; kws... )
126126end
127127
128- function textbuf (ps:: ParseState )
129- textbuf (ps. stream)
128+ function unsafe_textbuf (ps:: ParseState )
129+ unsafe_textbuf (ps. stream)
130130end
131131
132132function first_child_position (ps:: ParseState , pos:: ParseStreamPosition )
@@ -3143,7 +3143,7 @@ function parse_brackets(after_parse::Function,
31433143 return opts
31443144end
31453145
3146- is_indentation (b:: UInt8 ) = (b == UInt8 ( ' ' ) || b == UInt8 ( ' \t ' ) )
3146+ _is_indentation (b:: UInt8 ) = (b == u8 " " || b == u8 " \t " )
31473147
31483148# Parse a string, embedded interpolations and deindent triple quoted strings
31493149# by marking indentation characters as whitespace trivia.
@@ -3157,7 +3157,7 @@ function parse_string(ps::ParseState, raw::Bool)
31573157 indent_ref_i = 0
31583158 indent_ref_len = typemax (Int)
31593159 indent_chunks = acquire_positions (ps. stream)
3160- buf = textbuf (ps)
3160+ txtbuf = unsafe_textbuf (ps)
31613161 chunk_flags = raw ? RAW_STRING_FLAG : EMPTY_FLAGS
31623162 bump (ps, TRIVIA_FLAG)
31633163 first_chunk = true
@@ -3212,10 +3212,10 @@ function parse_string(ps::ParseState, raw::Bool)
32123212 if triplestr && first_chunk && span (t) <= 2 &&
32133213 begin
32143214 s = span (t)
3215- b = buf [last_byte (t)]
3215+ b = txtbuf [last_byte (t)]
32163216 # 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 " ))
32193219 end
32203220 # First line of triple string is a newline only: mark as trivia.
32213221 # """\nx""" ==> (string-s "x")
@@ -3253,8 +3253,8 @@ function parse_string(ps::ParseState, raw::Bool)
32533253 # """\n $a \n $b""" ==> (string-s a " \n" b)
32543254 # """\n $a\n $b\n""" ==> (string-s " " a "\n" " " b "\n")
32553255 #
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 " )
32583258 # Compute length of longest common prefix of mixed
32593259 # spaces and tabs, in bytes
32603260 #
@@ -3267,7 +3267,7 @@ function parse_string(ps::ParseState, raw::Bool)
32673267 # No indentation found yet. Find indentation we'll
32683268 # use as a reference
32693269 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 ])
32713271 i += 1
32723272 end
32733273 indent_ref_i = first_byte (t)
@@ -3277,7 +3277,7 @@ function parse_string(ps::ParseState, raw::Bool)
32773277 # shortening length if necessary.
32783278 j = 0
32793279 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]
32813281 break
32823282 end
32833283 j += 1
@@ -3287,7 +3287,7 @@ function parse_string(ps::ParseState, raw::Bool)
32873287 # Prepare a place for indentiation trivia, if necessary
32883288 push! (indent_chunks, bump_invisible (ps, K " TOMBSTONE" ))
32893289 end
3290- b = buf [last_byte (t)]
3290+ b = txtbuf [last_byte (t)]
32913291 prev_chunk_newline = b == UInt8 (' \n ' ) || b == UInt8 (' \r ' )
32923292 end
32933293 bump (ps, chunk_flags)
0 commit comments