Skip to content

Commit e7f06d2

Browse files
committed
Fix: Wrap :error in :toplevel for core parser hook
This is expected for the output of `Meta.parseall()`
1 parent 1e2dbab commit e7f06d2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/hooks.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ function core_parser_hook(code, filename, offset, options)
1212
seek(io, offset)
1313

1414
stream = ParseStream(io)
15-
rule = options == :all ? :toplevel : options
15+
rule = options === :all ? :toplevel : options
1616
JuliaSyntax.parse(stream; rule=rule)
1717

18-
ex = any_error(stream) ?
19-
Expr(:error, ParseError(SourceFile(code), stream.diagnostics)) :
18+
ex = if any_error(stream)
19+
e = Expr(:error, ParseError(SourceFile(code), stream.diagnostics))
20+
options === :all ? Expr(:toplevel, e) : e
21+
else
2022
build_tree(Expr, stream)
23+
end
2124

2225
pos = last_byte(stream) - 1
2326

0 commit comments

Comments
 (0)