@@ -162,7 +162,8 @@ function _core_parser_hook(code, filename::String, lineno::Int, offset::Int, opt
162
162
end
163
163
164
164
if any_error (stream)
165
- tree = build_tree (SyntaxNode, stream, wrap_toplevel_as_kind= K " None" )
165
+ tree = build_tree (SyntaxNode, stream,
166
+ wrap_toplevel_as_kind= K " None" , first_line= lineno)
166
167
_,err = _first_error (tree)
167
168
# In the flisp parser errors are normally `Expr(:error, msg)` where
168
169
# `msg` is a String. By using a ParseError for msg we can do fancy
@@ -179,7 +180,7 @@ function _core_parser_hook(code, filename::String, lineno::Int, offset::Int, opt
179
180
" incomplete: premature end of input"
180
181
error_ex = Expr (:incomplete , msg)
181
182
else
182
- error_ex = Expr (:error , ParseError (stream, filename= filename))
183
+ error_ex = Expr (:error , ParseError (stream, filename= filename, first_line = lineno ))
183
184
end
184
185
ex = options === :all ? Expr (:toplevel , error_ex) : error_ex
185
186
else
@@ -190,8 +191,8 @@ function _core_parser_hook(code, filename::String, lineno::Int, offset::Int, opt
190
191
#
191
192
# show_diagnostics(stdout, stream.diagnostics, code)
192
193
#
193
- # FIXME : Add support to lineno to this tree build (via SourceFile?)
194
- ex = build_tree (Expr, stream; filename = filename, wrap_toplevel_as_kind= K " None" )
194
+ ex = build_tree (Expr, stream; filename = filename,
195
+ wrap_toplevel_as_kind= K " None" , first_line = lineno )
195
196
if Meta. isexpr (ex, :None )
196
197
# The None wrapping is only to give somewhere for trivia to be
197
198
# attached; unwrap!
0 commit comments