Created
December 16, 2014 12:47
-
-
Save banacorn/9856ed0a164f0f5415f6 to your computer and use it in GitHub Desktop.
alex posn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scan :: String -> Pipeline [Token] | |
scan str = go (alexStartPos, '\n', [], str) | |
where | |
go inp@(pos, _, _, str) = case alexScan inp 0 of | |
AlexEOF -> return [] | |
AlexError (pos, _, _, _) -> throwError $ LexError (toPosition pos) "fucked up" | |
AlexSkip inp_ len -> go inp_ | |
AlexToken inp_ len act -> do | |
xs <- go inp_ | |
return $ act pos (take len str) : xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment