#5108: Allow unicode sub/superscript symbols in both identifiers and operators
-----------------------------------+----------------------------------------
    Reporter:  mikhail.vorozhtsov  |       Owner:               
        Type:  feature request     |      Status:  new          
    Priority:  normal              |   Component:  Compiler     
     Version:  7.1                 |    Keywords:  lexer unicode
    Testcase:                      |   Blockedby:               
          Os:  Unknown/Multiple    |    Blocking:               
Architecture:  Unknown/Multiple    |     Failure:  None/Unknown 
-----------------------------------+----------------------------------------
 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.
  1. A new unicode Alex macro, {{{$subsup}}}, is introduced and added to
 {{{$idchar}}}, {{{$symchar}}}, and {{{$graphic}}}
  2. A unicode code point is classified as {{{$subsup}}} by
 {{{alexGetChar}}} iff either of the following holds:
   a. The code point is annotated with <sub> or <super> in
 [http://www.unicode.org/Public/UNIDATA/UnicodeData.txt]
   b. It is the [DOUBLE/TRIPLE/QUADRUPLE] PRIME (U+2032, U+2033, U+2034,
 U+2057)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5108>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to