@@ -236,12 +236,16 @@ mutable struct ParseStream
236
236
diagnostics:: Vector{Diagnostic}
237
237
# Counter for number of peek()s we've done without making progress via a bump()
238
238
peek_count:: Int
239
+
240
+ # Feature flags
239
241
# (major,minor) version of Julia we're parsing this code for.
240
242
# May be different from VERSION!
241
243
version:: Tuple{Int,Int}
244
+ # Comma binds looser than macrocall in bracketed expressions
245
+ low_precedence_comma_in_brackets:: Bool
242
246
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 )
245
249
io = IOBuffer (text_buf)
246
250
seek (io, next_byte- 1 )
247
251
lexer = Tokenize. Lexer (io)
@@ -264,44 +268,45 @@ mutable struct ParseStream
264
268
Vector {TaggedRange} (),
265
269
Vector {Diagnostic} (),
266
270
0 ,
267
- ver)
271
+ ver,
272
+ low_precedence_comma_in_brackets)
268
273
end
269
274
end
270
275
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 ... )
273
278
end
274
279
275
280
# 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 ... )
278
283
end
279
284
280
285
# Buffers originating from strings
281
- function ParseStream (text:: String , index:: Integer = 1 ; version = VERSION )
286
+ function ParseStream (text:: String , index:: Integer = 1 ; kws ... )
282
287
ParseStream (unsafe_wrap (Vector{UInt8}, text),
283
- text, index, version )
288
+ text, index; kws ... )
284
289
end
285
- function ParseStream (text:: SubString , index:: Integer = 1 ; version = VERSION )
290
+ function ParseStream (text:: SubString , index:: Integer = 1 ; kws ... )
286
291
# See also IOBuffer(SubString("x"))
287
292
ParseStream (unsafe_wrap (Vector{UInt8}, pointer (text), sizeof (text)),
288
- text, index, version )
293
+ text, index; kws ... )
289
294
end
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 ... )
292
297
end
293
298
294
299
# 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 ... )
297
302
end
298
- function ParseStream (io:: Base.GenericIOBuffer ; version = VERSION )
303
+ function ParseStream (io:: Base.GenericIOBuffer ; kws ... )
299
304
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 ... )
301
306
end
302
- function ParseStream (io:: IO ; version = VERSION )
307
+ function ParseStream (io:: IO ; kws ... )
303
308
textbuf = read (io)
304
- ParseStream (textbuf, textbuf, 1 , version )
309
+ ParseStream (textbuf, textbuf, 1 ; kws ... )
305
310
end
306
311
307
312
function Base. show (io:: IO , mime:: MIME"text/plain" , stream:: ParseStream )
0 commit comments