Allow unicode sub/superscript symbols in both identifiers and operators
|Reported by:||mikhail.vorozhtsov||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||#10196||Differential Revisions:|
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)
Change History (18)
comment:2 Changed 4 years ago by igloo
- Component changed from Compiler to Compiler (Parser)
- Milestone set to 7.4.1