-
-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
The code for JavaScript identifiers:
markdown-rs/src/util/identifier.rs
Lines 5 to 17 in 1506572
| /// Check if a character can start a JS identifier. | |
| #[must_use] | |
| pub fn id_start(char: char) -> bool { | |
| UnicodeID::is_id_start(char) || matches!(char, '$' | '_') | |
| } | |
| /// Check if a character can continue a JS (or JSX) identifier. | |
| #[must_use] | |
| pub fn id_cont(char: char, jsx: bool) -> bool { | |
| UnicodeID::is_id_continue(char) | |
| || matches!(char, '\u{200c}' | '\u{200d}') | |
| || (jsx && char == '-') | |
| } |
... has some issues:
- It does not seem to recognize the literal string
\u1234or\u{1234}(see UnicodeEscapeSequence production in ECMAScript) as a valid character in starting/continuing characters—though I am not sure if this is the case; you might convert such instances to Unicode characters beforehand, I do not know. - It does not recognize "$" within a JS identifier (see IdentifierPartChar production in ECMAScript).
- I don't know why you allow U+200C and U+200D in
id_cont; those are not "special" in the productions I looked at in JSX or ECMAScript.
Metadata
Metadata
Assignees
Labels
No labels