@@ -9,8 +9,8 @@ struct ParseError <: Exception
9
9
diagnostics:: Vector{Diagnostic}
10
10
end
11
11
12
- function ParseError (stream:: ParseStream ; filename = nothing )
13
- source = SourceFile (sourcetext (stream), filename = filename )
12
+ function ParseError (stream:: ParseStream ; kws ... )
13
+ source = SourceFile (sourcetext (stream); kws ... )
14
14
ParseError (source, stream. diagnostics)
15
15
end
16
16
@@ -72,7 +72,7 @@ function parse!(::Type{TreeType}, io::IO;
72
72
end
73
73
74
74
function _parse (rule:: Symbol , need_eof:: Bool , :: Type{T} , text, index= 1 ; version= VERSION ,
75
- ignore_trivia= true , filename= nothing , ignore_errors= false ,
75
+ ignore_trivia= true , filename= nothing , first_line = 1 , ignore_errors= false ,
76
76
ignore_warnings= ignore_errors) where {T}
77
77
stream = ParseStream (text, index; version= version)
78
78
if ignore_trivia && rule != :toplevel
@@ -88,14 +88,14 @@ function _parse(rule::Symbol, need_eof::Bool, ::Type{T}, text, index=1; version=
88
88
end
89
89
if (! ignore_errors && any_error (stream. diagnostics)) ||
90
90
(! ignore_warnings && ! isempty (stream. diagnostics))
91
- throw (ParseError (stream, filename= filename))
91
+ throw (ParseError (stream, filename= filename, first_line = first_line ))
92
92
end
93
93
# TODO : Figure out a more satisfying solution to the wrap_toplevel_as_kind
94
94
# mess that we've got here.
95
95
# * It's kind of required for GreenNode, as GreenNode only records spans,
96
96
# not absolute positions.
97
97
# * Dropping it would be ok for SyntaxNode and Expr...
98
- tree = build_tree (T, stream; wrap_toplevel_as_kind= K " toplevel" , filename= filename)
98
+ tree = build_tree (T, stream; wrap_toplevel_as_kind= K " toplevel" , filename= filename, first_line = first_line )
99
99
tree, last_byte (stream) + 1
100
100
end
101
101
0 commit comments