rustle icon indicating copy to clipboard operation
rustle copied to clipboard

Entities util duplicates in from_code

Open linrium opened this issue 2 years ago • 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,

linrium avatar Aug 14 '22 03:08 linrium

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?

pintariching avatar Aug 14 '22 12:08 pintariching