Ticket #5108 (new feature request)
Allow unicode sub/superscript symbols in both identifiers and operators
| Reported by: | mikhail.vorozhtsov | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.6.2 |
| Component: | Compiler (Parser) | Version: | 7.1 |
| Keywords: | lexer unicode | Cc: | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
While #4373 permits
Prelude> let v₁ = 1
the following is rejected
Prelude> let m >>=₁ f = undefined <interactive>:0:10: lexical error at character '\8321'
Identifiers with non-numeric subscripts are not accepted either:
Prelude> let vₐ = 1 <interactive>:0:6: lexical error at character '\8336'
I wrote a small patch that makes such definitions possible.
- A new unicode Alex macro, $subsup, is introduced and added to $idchar, $symchar, and $graphic
- A unicode code point is classified as $subsup by alexGetChar iff either of the following holds:
- The code point is annotated with <sub> or <super> in http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
- It is the [DOUBLE/TRIPLE/QUADRUPLE] PRIME (U+2032, U+2033, U+2034, U+2057)
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

