[Haskell-cafe] Alex character sets
Omari Norman
omari at smileystation.com
Sat Mar 24 23:33:31 CET 2012
I'm wrinting (or at least, trying to write) an Alex lexer. Say I want to
group character ranges together and specify that I want a character that is
*not* in any of those ranges. Example
---
{
module Main where
}
%wrapper "posn-bytestring"
$lowAscii = \x00-\x1f -- unprintable stuff
$lowSymbol = \x21-\x2f -- exclamation point to solidus
$space = \x20
$special = [^$lowAscii $lowSymbol]
lex :-
$special { Word }
{
data Token = Word AlexPosn ByteString.ByteString
}
When I run this through Alex, I get "Prelude.Enum.Char.pred: bad argument".
What am I doing wrong? How would I accomplish this sort of thing? Thanks.
--Omari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120324/a8c4bf9f/attachment.htm>
More information about the Haskell-Cafe
mailing list