@@ -236,12 +236,16 @@ mutable struct ParseStream
236236 diagnostics:: Vector{Diagnostic}
237237 # Counter for number of peek()s we've done without making progress via a bump()
238238 peek_count:: Int
239+
240+ # Feature flags
239241 # (major,minor) version of Julia we're parsing this code for.
240242 # May be different from VERSION!
241243 version:: Tuple{Int,Int}
244+ # Comma binds looser than macrocall in bracketed expressions
245+ low_precedence_comma_in_brackets:: Bool
242246
243- function ParseStream (text_buf:: Vector{UInt8} , text_root, next_byte:: Integer ,
244- version:: VersionNumber )
247+ function ParseStream (text_buf:: Vector{UInt8} , text_root, next_byte:: Integer ;
248+ version= VERSION , low_precedence_comma_in_brackets = false )
245249 io = IOBuffer (text_buf)
246250 seek (io, next_byte- 1 )
247251 lexer = Tokenize. Lexer (io)
@@ -264,44 +268,45 @@ mutable struct ParseStream
264268 Vector {TaggedRange} (),
265269 Vector {Diagnostic} (),
266270 0 ,
267- ver)
271+ ver,
272+ low_precedence_comma_in_brackets)
268273 end
269274end
270275
271- function ParseStream (text:: Vector{UInt8} , index:: Integer = 1 ; version = VERSION )
272- ParseStream (text, text, index, version )
276+ function ParseStream (text:: Vector{UInt8} , index:: Integer = 1 ; kws ... )
277+ ParseStream (text, text, index; kws ... )
273278end
274279
275280# Buffer with unknown owner. Not exactly recommended, but good for C interop
276- function ParseStream (ptr:: Ptr{UInt8} , len:: Integer , index:: Integer = 1 ; version = VERSION )
277- ParseStream (unsafe_wrap (Vector{UInt8}, ptr, len), nothing , index, version )
281+ function ParseStream (ptr:: Ptr{UInt8} , len:: Integer , index:: Integer = 1 ; kws ... )
282+ ParseStream (unsafe_wrap (Vector{UInt8}, ptr, len), nothing , index; kws ... )
278283end
279284
280285# Buffers originating from strings
281- function ParseStream (text:: String , index:: Integer = 1 ; version = VERSION )
286+ function ParseStream (text:: String , index:: Integer = 1 ; kws ... )
282287 ParseStream (unsafe_wrap (Vector{UInt8}, text),
283- text, index, version )
288+ text, index; kws ... )
284289end
285- function ParseStream (text:: SubString , index:: Integer = 1 ; version = VERSION )
290+ function ParseStream (text:: SubString , index:: Integer = 1 ; kws ... )
286291 # See also IOBuffer(SubString("x"))
287292 ParseStream (unsafe_wrap (Vector{UInt8}, pointer (text), sizeof (text)),
288- text, index, version )
293+ text, index; kws ... )
289294end
290- function ParseStream (text:: AbstractString , index:: Integer = 1 ; version = VERSION )
291- ParseStream (String (text), index; version = version )
295+ function ParseStream (text:: AbstractString , index:: Integer = 1 ; kws ... )
296+ ParseStream (String (text), index; kws ... )
292297end
293298
294299# IO-based cases
295- function ParseStream (io:: IOBuffer ; version = VERSION )
296- ParseStream (io. data, io, position (io)+ 1 , version )
300+ function ParseStream (io:: IOBuffer ; kws ... )
301+ ParseStream (io. data, io, position (io)+ 1 ; kws ... )
297302end
298- function ParseStream (io:: Base.GenericIOBuffer ; version = VERSION )
303+ function ParseStream (io:: Base.GenericIOBuffer ; kws ... )
299304 textbuf = unsafe_wrap (Vector{UInt8}, pointer (io. data), length (io. data))
300- ParseStream (textbuf, io, position (io)+ 1 , version )
305+ ParseStream (textbuf, io, position (io)+ 1 ; kws ... )
301306end
302- function ParseStream (io:: IO ; version = VERSION )
307+ function ParseStream (io:: IO ; kws ... )
303308 textbuf = read (io)
304- ParseStream (textbuf, textbuf, 1 , version )
309+ ParseStream (textbuf, textbuf, 1 ; kws ... )
305310end
306311
307312function Base. show (io:: IO , mime:: MIME"text/plain" , stream:: ParseStream )
0 commit comments