Alex unicode trick

Carter Schonwald carter.schonwald at gmail.com
Tue Jan 7 07:36:22 UTC 2014


you're probably right, this could be regarded as dead code for ghc 7.8 (esp
since alex and happy must be the recent versions to even build ghc HEAD ! )


On Tue, Jan 7, 2014 at 2:25 AM, Mateusz Kowalczyk
<fuuzetsu at fuuzetsu.co.uk>wrote:

> Greetings,
>
> When looking at the GHC lexer (Lexer.x), there's:
>
> > $unispace    = \x05 -- Trick Alex into handling Unicode. See alexGetChar.
> > $whitechar   = [\ \n\r\f\v $unispace]
> > $white_no_nl = $whitechar # \n
> > $tab         = \t
>
> Scrolling down to alexGetChar and alexGetChar', we see the comments:
>
>
> > -- backwards compatibility for Alex 2.x
> > alexGetChar :: AlexInput -> Maybe (Char,AlexInput)
> >
> > -- This version does not squash unicode characters, it is used when
> > -- lexing strings.
> > alexGetChar' :: AlexInput -> Maybe (Char,AlexInput)
>
> What's the reason for these? I was under the impression that since
> 3.0, Alex has natively supported unicode. Is it just dead code? Could
> all the hex $uni* functions be removed? If not, why not?
>
> --
> Mateusz K.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140107/376ffbee/attachment.html>


More information about the ghc-devs mailing list