@@ -357,7 +357,7 @@ parse_error(Location, File, <<"syntax error before: ">>, Keyword, Input)
357
357
358
358
% % Produce a human-readable message for errors before a sigil
359
359
parse_error (Location , File , <<" syntax error before: " >>, <<" {sigil," , _Rest /binary >> = Full , Input ) ->
360
- {sigil , _ , Atom , [Content | _ ], _ , _ , _ } = parse_erl_term (Full ),
360
+ {ok , { sigil , _ , Atom , [Content | _ ], _ , _ , _ } } = parse_erl_term (Full ),
361
361
Content2 = case is_binary (Content ) of
362
362
true -> Content ;
363
363
false -> <<>>
@@ -378,7 +378,7 @@ parse_error(Location, File, <<"syntax error before: ">>, <<"{sigil,", _Rest/bina
378
378
% % Binaries (and interpolation) are wrapped in [<<...>>]
379
379
parse_error (Location , File , Error , <<" [" , _ /binary >> = Full , Input ) when is_binary (Error ) ->
380
380
Term = case parse_erl_term (Full ) of
381
- [H | _ ] when is_binary (H ) -> <<$" , H /binary , $" >>;
381
+ { ok , [H | _ ]} when is_binary (H ) -> <<$" , H /binary , $" >>;
382
382
_ -> <<$" >>
383
383
end ,
384
384
raise_snippet (Location , File , Input , 'Elixir.SyntaxError' , <<Error /binary , Term /binary >>);
@@ -408,9 +408,14 @@ parse_error(Location, File, Error, Token, Input) when is_binary(Error), is_binar
408
408
end .
409
409
410
410
parse_erl_term (Term ) ->
411
- {ok , Tokens , _ } = erl_scan :string (binary_to_list (Term )),
412
- {ok , Parsed } = erl_parse :parse_term (Tokens ++ [{dot , 1 }]),
413
- Parsed .
411
+ case erl_scan :string (binary_to_list (Term )) of
412
+ {ok , Tokens , _ } ->
413
+ case erl_parse :parse_term (Tokens ++ [{dot , 1 }]) of
414
+ {ok , Parsed } -> {ok , Parsed };
415
+ _ -> error
416
+ end ;
417
+ _ -> error
418
+ end .
414
419
415
420
raise_reserved (Location , File , Input , Keyword ) ->
416
421
raise_snippet (Location , File , Input , 'Elixir.SyntaxError' ,
0 commit comments