isUnicodeIdentifierPart checks if a rune can be part of a Unicode identifier. After the initial character, identifiers can contain: - Any Unicode letter (Lu, Ll, Lt, Lm, Lo) - Any Unicode digit (Nd category) - Underscore (_) - Non-spacing marks (Mn category) - diacritics, accents - Spacing combinin
(r rune)
| 57 | // |
| 58 | // Returns true if the rune can be part of an identifier, false otherwise. |
| 59 | func isUnicodeIdentifierPart(r rune) bool { |
| 60 | return unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' || |
| 61 | unicode.Is(unicode.Mn, r) || // Non-spacing marks |
| 62 | unicode.Is(unicode.Mc, r) || // Spacing combining marks |
| 63 | unicode.Is(unicode.Nd, r) || // Decimal numbers |
| 64 | unicode.Is(unicode.Pc, r) // Connector punctuation |
| 65 | } |
| 66 | |
| 67 | // isUnicodeQuote checks if a rune is a Unicode quote character for identifiers. |
| 68 | // |