[Haskell-cafe] problem with happy

Roman Dzvinkovsky romand.ne at gmail.com
Tue Oct 26 15:21:49 EDT 2010


Great thanks! All work right now.

2010/10/26 Stephen Tetley <stephen.tetley at gmail.com>

> The lexer was wrong - but it was the lexer function not the lexer spec
> - try the one below.
>
> Note that you have to take 'len' chars from the original input.
> Previously you were taking the whole of the "rest-of--input":
>
> lexer :: (TheToken -> P a) -> P a
> lexer f input@(_,_,instr) =
>  case alexScan input 0 of
>    AlexEOF -> f Eof input
>    AlexError (pos, _, _) ->
>      Failed $ showPos pos ++ ": lexical error"
>    AlexSkip input' len -> lexer f input'
>    AlexToken (pos, c, str) len act ->
>      let (Token newpos thetok) = act pos (take len instr)
>      in f thetok (newpos, c, str)
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101026/ca8ebc77/attachment.html


More information about the Haskell-Cafe mailing list