yi-editor/yi — pull request #435 by ethercrow (2013-03-31 13:19:38+00:00)
Title: Adapt to new alex API

Attached patch fixes yi build failure caused by https://github.com/simonmar/alex/commit/fe081e81bef6bda734829872ae6dcfc665ddb34b

However, yi still fails to build with the following error:
```
[ 77 of 135] Compiling Yi.Lexer.Abella ( dist/build/Yi/Lexer/Abella.hs, dist/build/Yi/Lexer/Abella.o )

src/library/Yi/Lexer/common.hsinc:76:21:
Not in scope: data constructor `AlexAccPred'

src/library/Yi/Lexer/common.hsinc:81:21:
Not in scope: data constructor `AlexAccSkipPred'
Perhaps you meant `AlexAccSkip' (line 205)
```

As far as I can tell, this happens because alex chooses optimized "-nopred" template even when our lexers use predicates.

I've tried wrapping usage of AlexAccPred and AlexAccSkipPred in `#ifndef ALEX_NOPRED`, but that didn't change anything.

Currently yi can be built with `cabal install --alex-options="--debug"`, because this disables "-nopred" templates, so we get missing constructors back.

Out of curiosity I've tried to just remove any usage of AlexAccPred and AlexAccSkipPred from our code, but then yi crashes in runtime with message about non-exhaustive patterns.

I see two (and a half) possible solutions:
1) Yi should have two versions of Yi/Lexer/common.hsinc: with and without "-nopred". This will make lexer maintenance harder.
2) Alex should have an option disabling "-nopred" optimization.
2.5) I've screwed up with ALEX_NOPRED directive somehow and all this is easily fixable with and ifdef.