pintariching/rustle

Entities util duplicates in from_code

linrium opened this issue · 1 comments

In src/compiler/parse/utils/entities.rs. from_code method matches duplicate two codes to both Entity::nbsp and Entity::NonBreakingSpace. It will cause the second statement to be never reached.

160 => Entity::NonBreakingSpace,
160 => Entity::nbsp,

Yeah I copied all the types directly from the svelte repo. Also, the code links to this website where it notes

It is intentional, for legacy compatibility, that many code points have multiple character reference names. For example, some appear both with and without the trailing semicolon, or with different capitalizations.

Maybe if the Entities enum is rewritten as a HashMap, that would be better?