diff options
Diffstat (limited to 'lib/elixir/src')
-rw-r--r-- | lib/elixir/src/elixir_tokenizer.erl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/elixir/src/elixir_tokenizer.erl b/lib/elixir/src/elixir_tokenizer.erl index c5b810625..aef779e6f 100644 --- a/lib/elixir/src/elixir_tokenizer.erl +++ b/lib/elixir/src/elixir_tokenizer.erl @@ -861,10 +861,23 @@ tokenize_identifier(String, Line, Scope) -> {error, _Reason} = Error -> Error end; + {error, {not_nfc, Wrong}} -> + Right = unicode:characters_to_nfc_list(Wrong), + RightCodepoints = list_to_codepoint_hex(Right), + WrongCodepoints = list_to_codepoint_hex(Wrong), + Message = io_lib:format("Elixir expects unquoted Unicode atoms and variables to be in NFC form.\n" + "Got: \"~ts\" (codepoints~ts)\n" + "Expected: \"~ts\" (codepoints~ts)\n + Syntax error before: ", + [Wrong, WrongCodepoints, Right, RightCodepoints]), + {error, {Line, Message, Wrong}}; {error, empty} -> empty end. +list_to_codepoint_hex(List) -> + [io_lib:format(" ~4.16.0B", [Codepoint]) || Codepoint <- List]. + tokenize_alias(Rest, Line, Column, Atom, Length, Ascii, Special, Scope, Tokens) -> if not Ascii -> |