@@ -198,8 +198,8 @@ tokenize([$0, $o, H | T], Line, Column, Scope, Tokens) when ?is_octal(H) ->
198198
199199tokenize ([$# | String ], Line , Column , Scope , Tokens ) ->
200200 case tokenize_comment (String , [$# ]) of
201- {error , Char } ->
202- error_comment (Char , [$# | String ], Line , Column , Scope , Tokens );
201+ {error , Char , Reason } ->
202+ error_comment (Char , Reason , [$# | String ], Line , Column , Scope , Tokens );
203203 {Rest , Comment } ->
204204 preserve_comments (Line , Column , Tokens , Comment , Rest , Scope ),
205205 tokenize (Rest , Line , Column , Scope , reset_eol (Tokens ))
@@ -748,8 +748,8 @@ tokenize_dot(T, Line, Column, DotInfo, Scope, Tokens) ->
748748 case strip_horizontal_space (T , 0 ) of
749749 {[$# | R ], _ } ->
750750 case tokenize_comment (R , [$# ]) of
751- {error , Char } ->
752- error_comment (Char , [$# | R ], Line , Column , Scope , Tokens );
751+ {error , Char , Reason } ->
752+ error_comment (Char , Reason , [$# | R ], Line , Column , Scope , Tokens );
753753
754754 {Rest , Comment } ->
755755 preserve_comments (Line , Column , Tokens , Comment , Rest , Scope ),
@@ -1315,16 +1315,17 @@ tokenize_comment("\r\n" ++ _ = Rest, Acc) ->
13151315tokenize_comment (" \n " ++ _ = Rest , Acc ) ->
13161316 {Rest , lists :reverse (Acc )};
13171317tokenize_comment ([H | _Rest ], _ ) when ? bidi (H ) ->
1318- {error , H };
1318+ {error , H , " invalid bidirectional formatting character in comment: " };
1319+ tokenize_comment ([H | _Rest ], _ ) when ? break (H ) ->
1320+ {error , H , " invalid line break character in comment: " };
13191321tokenize_comment ([H | Rest ], Acc ) ->
13201322 tokenize_comment (Rest , [H | Acc ]);
13211323tokenize_comment ([], Acc ) ->
13221324 {[], lists :reverse (Acc )}.
13231325
1324- error_comment (H , Comment , Line , Column , Scope , Tokens ) ->
1325- Token = io_lib :format (" \\ u~4.16.0B " , [H ]),
1326- Reason = {? LOC (Line , Column ), " invalid bidirectional formatting character in comment: " , Token },
1327- error (Reason , Comment , Scope , Tokens ).
1326+ error_comment (Char , Reason , Comment , Line , Column , Scope , Tokens ) ->
1327+ Token = io_lib :format (" \\ u~4.16.0B " , [Char ]),
1328+ error ({? LOC (Line , Column ), Reason , Token }, Comment , Scope , Tokens ).
13281329
13291330preserve_comments (Line , Column , Tokens , Comment , Rest , Scope ) ->
13301331 case Scope # elixir_tokenizer .preserve_comments of
0 commit comments