Skip to content

Commit e33f58e

Browse files
committed
more error handling?
1 parent 1d746d1 commit e33f58e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/utils.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ function comp(x::CSTParser.EXPR, y::CSTParser.EXPR)
313313
end
314314

315315
function minimal_reparse(s0, s1, x0 = CSTParser.parse(s0, true), x1 = CSTParser.parse(s1, true); inds = false)
316+
if has_error(x0)
317+
return inds ? (1:0, 1:length(x1.args), 1:0) : x1 # Error while re-parsing, so lets return the whole expression instead of patching
318+
end
319+
316320
if sizeof(s0) !== x0.fullspan
317321
error("minimal reparse - original input text length doesn't match the full span of the provided CST.")
318322
# return inds ? (1:0, 1:length(x1.args), 1:0) : x1

0 commit comments

Comments
 (0)