Skip to content

Commit

Permalink
Implement UAX31's quick check algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
rikkimax committed Apr 15, 2024
1 parent e397d5e commit aa04be1
Show file tree
Hide file tree
Showing 23 changed files with 2,331 additions and 4,372 deletions.
11 changes: 11 additions & 0 deletions changelog/dmd.identifier-quick-check.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Identifiers are verifiable against normalization form C

It is now possible to verify identifiers against normalization form C, as per UAX31 and C23.

The quick check algorithm that is in use is an incomplete form that does not handle maybes and can result in false positives in errors.
The purpose of this algorithm in its incomplete state is to minimize normalization in a future update.

It is configurable for both D and ImportC using ``-normalization=<strategy>`` and ``-normalization-importc=<strategy>``.
Using the options ``ignore``, ``deprecate``, ``warn``, and ``error``.

Unless you use non-ASCII characters, this change will not affect you.
20 changes: 20 additions & 0 deletions compiler/src/dmd/cli.d
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,26 @@ dmd -cov -unittest myprog.d
`Turns off all array bounds checking, even for safe functions. $(RED Deprecated
(use $(TT $(SWLINK -boundscheck)=off) instead).)`,
),
Option("normalization=<strategy>",
"Specify what to do when an identifier is not normalized",
`The strategy that will be used when an identifier may not be normalized (quick check algorithm).
$(UL
$(LI $(I ignore): Silently accept any failing identifiers (default))
$(LI $(I deprecate): Emit a deprecation but accept)
$(LI $(I warn): Emit a warning but accept)
$(LI $(I error): Emit an error and fail)
)`
),
Option("normalization-importc=<strategy>",
"Specify what to do when an identifier is not normalized",
`The strategy that will be used when an identifier may not be normalized (quick check algorithm).
$(UL
$(LI $(I ignore): Silently accept any failing identifiers (default))
$(LI $(I deprecate): Emit a deprecation but accept)
$(LI $(I warn): Emit a warning but accept)
$(LI $(I error): Emit an error and fail)
)`
),
Option("nothrow",
"assume no Exceptions will be thrown",
`Turns off generation of exception stack unwinding code, enables
Expand Down
Loading

0 comments on commit aa04be1

Please sign in to comment.